当前位置: 首页>>代码示例>>Java>>正文


Java PathFinder.NEIGHBOURS9属性代码示例

本文整理汇总了Java中com.watabou.utils.PathFinder.NEIGHBOURS9属性的典型用法代码示例。如果您正苦于以下问题:Java PathFinder.NEIGHBOURS9属性的具体用法?Java PathFinder.NEIGHBOURS9怎么用?Java PathFinder.NEIGHBOURS9使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.watabou.utils.PathFinder的用法示例。


在下文中一共展示了PathFinder.NEIGHBOURS9属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shatter

@Override
public void shatter(int cell) {

	if (Dungeon.visible[cell]) {
		setKnown();

		splash(cell);
		Sample.INSTANCE.play(Assets.SND_SHATTER);
	}

	for (int offset : PathFinder.NEIGHBOURS9) {
		if (Level.flamable[cell + offset]
				|| Actor.findChar(cell + offset) != null
				|| Dungeon.level.heaps.get(cell + offset) != null) {

			GameScene.add(Blob.seed(cell + offset, 2, Fire.class));

		} else {

			CellEmitter.get(cell + offset).burst(FlameParticle.FACTORY, 2);

		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:24,代码来源:PotionOfLiquidFlame.java

示例2: shatter

@Override
public void shatter( int cell ) {

	if (Dungeon.visible[cell]) {
		setKnown();

		splash( cell );
		Sample.INSTANCE.play( Assets.SND_SHATTER );
	}

	for (int offset : PathFinder.NEIGHBOURS9){
		if (Level.flamable[cell+offset]
				|| Actor.findChar(cell+offset) != null
				|| Dungeon.level.heaps.get(cell+offset) != null) {

			GameScene.add(Blob.seed(cell + offset, 2, Fire.class));

		} else {

			CellEmitter.get(cell+offset).burst(FlameParticle.FACTORY, 2);

		}
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:24,代码来源:PotionOfLiquidFlame.java

示例3: explodeDew

public void explodeDew(int cell) {

		Sample.INSTANCE.play(Assets.SND_BLAST, 2);

		for (int n : PathFinder.NEIGHBOURS9) {
			int c = cell + n;
			if (c >= 0 && c < Dungeon.level.getLength() && Level.passable[c]) {
				if (Random.Int(10) == 1) {
					if (ShatteredPixelDungeon.autocollect() && vial != null) {
						if (!vial.isFull()) {
							vial.volume = vial.volume + (Dungeon.isChallenged(Challenges.SWARM_INTELLIGENCE) ? 50 : 5);
							GLog.i(Messages.get(HighGrass.class, "red"));
							if (vial.isFull()) {
								vial.volume = DewVial.MAX_VOLUME();
								Messages.get(DewVial.class, "full");
							}
						} else Dungeon.level.drop(new RedDewdrop(), c).sprite.drop();
					} else Dungeon.level.drop(new RedDewdrop(), c).sprite.drop();
				} else if (Random.Int(3) == 1) {
					if (ShatteredPixelDungeon.autocollect() && vial != null) {
						if (!vial.isFull()) {
							vial.volume = vial.volume + (Dungeon.isChallenged(Challenges.SWARM_INTELLIGENCE) ? 20 : 2);
							GLog.i(Messages.get(HighGrass.class, "yellow"));
							if (vial.isFull()) {
								vial.volume = DewVial.MAX_VOLUME();
								Messages.get(DewVial.class, "full");
							}
						} else Dungeon.level.drop(new YellowDewdrop(), c).sprite.drop();
					} else Dungeon.level.drop(new YellowDewdrop(), c).sprite.drop();
				}
			}
		}
		QuickSlotButton.refresh();

	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:35,代码来源:Mob.java

示例4: explodeDewHigh

public void explodeDewHigh(int cell) {

		Sample.INSTANCE.play(Assets.SND_BLAST, 2);

		for (int n : PathFinder.NEIGHBOURS9) {
			int c = cell + n;
			if (c >= 0 && c < Dungeon.level.getLength() && Level.passable[c]) {
				if (Random.Int(8) == 1) {
					if (ShatteredPixelDungeon.autocollect() && vial != null) {
						if (vial.volume <= (DewVial.MAX_VOLUME() - 45)) {
							vial.volume = vial.volume + (Dungeon.isChallenged(Challenges.SWARM_INTELLIGENCE) ? 200 : 50);
							GLog.i(Messages.get(HighGrass.class, "violet"));
							if (vial.isFull()) {
								vial.volume = DewVial.MAX_VOLUME();
								Messages.get(DewVial.class, "full");
							}
						} else Dungeon.level.drop(new VioletDewdrop(), c).sprite.drop();
					} else Dungeon.level.drop(new VioletDewdrop(), c).sprite.drop();
				} else if (Random.Int(2) == 1) {
					if (ShatteredPixelDungeon.autocollect() && vial != null) {
						if (!vial.isFull()) {
							vial.volume = vial.volume + (Dungeon.isChallenged(Challenges.SWARM_INTELLIGENCE) ? 50 : 5);
							GLog.i(Messages.get(HighGrass.class, "red"));
							if (vial.isFull()) {
								vial.volume = DewVial.MAX_VOLUME();
								Messages.get(DewVial.class, "full");
							}
						} else Dungeon.level.drop(new RedDewdrop(), c).sprite.drop();
					} else Dungeon.level.drop(new RedDewdrop(), c).sprite.drop();
				}
			}
		}
		QuickSlotButton.refresh();
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:34,代码来源:Mob.java

示例5: updateMapCell

@Override
public synchronized void updateMapCell(int cell) {
	//update in a 3x3 grid to account for neighbours which might also be affected
	if (Dungeon.level.insideMap(cell)) {
		super.updateMapCell(cell - mapWidth - 1);
		super.updateMapCell(cell + mapWidth + 1);
		for (int i : PathFinder.NEIGHBOURS9)
			data[cell + i] = getTileVisual(cell + i, map[cell + i]);

	//unless we're at the level's edge, then just do the one tile.
	} else {
		super.updateMapCell(cell);
		data[cell] = getTileVisual(cell, map[cell]);
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:15,代码来源:DungeonTilemap.java

示例6: onZap

@Override
protected void onZap(Ballistica bolt) {
	Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level(), VenomGas.class);
	((VenomGas)venomGas).setStrength(level()+1);
	GameScene.add(venomGas);

	for (int i : PathFinder.NEIGHBOURS9) {
		Char ch = Actor.findChar(bolt.collisionPos + i);
		if (ch != null) {
			processSoulMark(ch, chargesPerCast());
		}
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:13,代码来源:WandOfVenom.java

示例7: activate

@Override
public void activate() {

	boolean seen = false;

	for (int i : PathFinder.NEIGHBOURS9){

		if (Level.solid[pos+i])
			continue;

		if (Dungeon.visible[ pos+i ]){
			CellEmitter.get( pos + i - Dungeon.level.width() ).start(Speck.factory(Speck.ROCK), 0.07f, 10);
			if (!seen) {
				Camera.main.shake(3, 0.7f);
				Sample.INSTANCE.play(Assets.SND_ROCKS);
				seen = true;
			}
		}

		Char ch = Actor.findChar( pos+i );

		if (ch != null){
			int damage = Random.NormalIntRange(Dungeon.depth, Dungeon.depth*2);
			damage -= ch.drRoll();
			ch.damage( Math.max(damage, 0) , this);

			Buff.prolong( ch, Paralysis.class, Paralysis.duration(ch)/2);

			if (!ch.isAlive() && ch == Dungeon.hero){
				Dungeon.fail( getClass() );
				GLog.n( Messages.get(this, "ondeath") );
			}
		}
	}

}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:36,代码来源:RockfallTrap.java

示例8: validPlantPos

private static boolean validPlantPos(Level level, int pos){
	if (level.map[pos] != Terrain.GRASS){
		return false;
	}

	for (int i : PathFinder.NEIGHBOURS9){
		if (level.findMob(pos+i) != null){
			return false;
		}
	}

	return true;
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:13,代码来源:RotGardenPainter.java

示例9: affectMap

private void affectMap(Ballistica beam){
	boolean noticed = false;
	for (int c: beam.subPath(0, beam.dist)){
		for (int n : PathFinder.NEIGHBOURS9){
			int cell = c+n;

			if (Level.discoverable[cell])
				Dungeon.level.mapped[cell] = true;

			int terr = Dungeon.level.map[cell];
			if ((Terrain.flags[terr] & Terrain.SECRET) != 0) {

				Dungeon.level.discover( cell );

				GameScene.discoverTile( cell, terr );
				ScrollOfMagicMapping.discover(cell);

				noticed = true;
			}
		}

		CellEmitter.center(c).burst( RainbowParticle.BURST, Random.IntRange( 1, 2 ) );
	}
	if (noticed)
		Sample.INSTANCE.play( Assets.SND_SECRET );

	GameScene.updateFog();
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:28,代码来源:WandOfPrismaticLight.java

示例10: proc

@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {

	if (Random.Int(10) == 0){
		int pos = defender.pos;
		for (int i : PathFinder.NEIGHBOURS9){
			Splash.at(pos+i, 0x000000, 5);
			if (Actor.findChar(pos+i) != null)
				Buff.affect(Actor.findChar(pos+i), Ooze.class);
		}
	}

	return damage;
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:14,代码来源:Corrosion.java

示例11: boneExplode

public void boneExplode(int cell) {

		Camera.main.shake(3, 0.7f);
		for (int n : PathFinder.NEIGHBOURS9) {
			int c = cell + n;
			if (c >= 0 && c < Dungeon.level.getLength()) {
				if (Dungeon.visible[c] && Level.passable[c]) {
					Sample.INSTANCE.play(Assets.SND_BONES);
					CellEmitter.center(c).start(Speck.factory(Speck.RATTLE), 0.1f, 3);
					CellEmitter.center(c).start(Speck.factory(Speck.ROCK), 0.07f, 10);
				}

				if (Random.Int(100) == 42) {
					RedWraith.spawnAt(c);
				}


				Char ch = Actor.findChar(c);
				if (ch != null && ch == Dungeon.hero) {
					// those not at the center of the blast take damage less
					// consistently.
					int minDamage = c == cell ? Dungeon.depth + 5 : 1;
					int maxDamage = 10 + Dungeon.depth * 3;


					int dmg = Random.NormalIntRange(minDamage, maxDamage) - Random.Int(ch.dr());


					if (dmg > 0) {
						ch.damage(dmg, this);
						if (Random.Int(15) == 1) {
							Buff.prolong(ch, Paralysis.class, 1);
						}
					}


					if (ch == Dungeon.hero && !ch.isAlive()) {
						Dungeon.fail(Utils.format(ResultDescriptions.ITEM,
								"bone explosion"));
					}
				}
			}
		}

	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:45,代码来源:DwarfLichSprite.java

示例12: explode

public void explode(int cell) {

		Sample.INSTANCE.play(Assets.SND_BLAST, 2);

		if (Dungeon.visible[cell]) {
			CellEmitter.center(cell).burst(BlastParticle.FACTORY, 30);
		}

		boolean terrainAffected = false;
		for (int n : PathFinder.NEIGHBOURS9) {
			int c = cell + n;
			if (c >= 0 && c < Dungeon.level.getLength()) {

				if (Level.flamable[c]) {
					Level.set(c, Terrain.EMBERS);
					GameScene.updateMap(c);
					terrainAffected = true;
				}

				Char ch = Actor.findChar(c);
				if (ch != null && ch == Dungeon.hero) {
					// those not at the center of the blast take damage less
					// consistently.
					int minDamage = c == cell ? Dungeon.depth + 5 : 1;
					int maxDamage = 10 + Dungeon.depth * 2;

					int dmg = Random.NormalIntRange(minDamage, maxDamage)
							- Random.Int(ch.dr());
					if (dmg > 0) {
						ch.damage(dmg, this);
					}

					if (ch == Dungeon.hero && !ch.isAlive())
						// constant is used here in the rare instance a player
						// is killed by a double bomb.
						Dungeon.fail(Utils.format(ResultDescriptions.ITEM,
								"bomb"));
				}
			}
		}

		if (terrainAffected) {
			Dungeon.observe();
		}

	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:46,代码来源:ZotSprite.java

示例13: explode

public void explode(int cell) {
	// We're blowing up, so no need for a fuse anymore.

	Sample.INSTANCE.play(Assets.SND_BLAST, 2);

	if (Dungeon.visible[cell]) {
		CellEmitter.center(cell).burst(BlastParticle.FACTORY, 30);
	}

	boolean terrainAffected = false;
	for (int n : PathFinder.NEIGHBOURS9) {
		int c = cell + n;
		if (c >= 0 && c < Dungeon.level.getLength()) {
			if (Dungeon.visible[c]) {
				CellEmitter.get(c).burst(SmokeParticle.FACTORY, 4);
			}

			if (Level.flamable[c]) {
				Level.set(c, Terrain.EMBERS);
				GameScene.updateMap(c);
				terrainAffected = true;
			}

			// destroys items / triggers bombs caught in the blast.
			Heap heap = Dungeon.level.heaps.get(c);
			if (heap != null)
				heap.explode();

			Char ch = Actor.findChar(c);
			if (ch != null) {
				// those not at the center of the blast take damage less
				// consistently.
				int minDamage = c == cell ? Dungeon.depth + 5 : 1;
				int maxDamage = 10 + Dungeon.depth * 2;

				int dmg = Random.NormalIntRange(minDamage, maxDamage)
						- Random.Int(ch.dr());
				if (dmg > 0) {
					ch.damage(dmg, this);
				}

				if (ch == this && HP < 1) {
					die(this);
					if (sprite != null)
						sprite.killAndErase();
				}
				if (ch == Dungeon.hero && !ch.isAlive())
					// constant is used here in the rare instance a player
					// is killed by a double bomb.
					Dungeon.fail(Utils.format(ResultDescriptions.ITEM,
							"bomb"));
			}
		}
	}

	if (terrainAffected) {
		Dungeon.observe();
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:59,代码来源:BrokenRobot.java

示例14: explode

public void explode(int cell) {
	// We're blowing up, so no need for a fuse anymore.
	this.fuse = null;

	Sample.INSTANCE.play(Assets.SND_BLAST, 2);

	if (Dungeon.visible[cell]) {
		CellEmitter.center(cell).burst(BlastParticle.FACTORY, 30);
	}

	boolean terrainAffected = false;
	for (int n : PathFinder.NEIGHBOURS9) {
		int c = cell + n;
		if (c >= 0 && c < Dungeon.level.getLength()) {
			if (Dungeon.visible[c]) {
				CellEmitter.get(c).burst(SmokeParticle.FACTORY, 4);
			}

			if (Level.flamable[c]) {
				Level.set(c, Terrain.EMBERS);
				GameScene.updateMap(c);
				terrainAffected = true;
			}

			// destroys items / triggers bombs caught in the blast.
			Heap heap = Dungeon.level.heaps.get(c);
			if (heap != null)
				heap.explode();

			Char ch = Actor.findChar(c);
			if (ch != null) {
				// those not at the center of the blast take damage less
				// consistently.
				int minDamage = c == cell ? Dungeon.depth * 6 : Dungeon.depth * 3;
				int maxDamage = 5 + Dungeon.depth * 15;

				int dmg = Random.NormalIntRange(minDamage, maxDamage)
						- Random.Int(ch.dr());
				if (dmg > 0) {
					ch.damage(dmg, this);
				}

				if (ch == Dungeon.hero && !ch.isAlive())
					// constant is used here in the rare instance a player
					// is killed by a double bomb.
					Dungeon.fail(Utils.format(ResultDescriptions.ITEM,
							"bomb"));
			}
		}
	}

	if (terrainAffected) {
		Dungeon.observe();
	}

}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:56,代码来源:Bomb.java

示例15: explode

public void explode(int cell) {
	// We're blowing up, so no need for a fuse anymore.
	this.fuse = null;

	Sample.INSTANCE.play(Assets.SND_BLAST, 2);

	if (Dungeon.visible[cell]) {
		CellEmitter.center(cell).burst(BlastParticle.FACTORY, 30);
	}

	boolean terrainAffected = false;
	for (int n : PathFinder.NEIGHBOURS9) {
		int c = cell + n;
		if (c >= 0 && c < Dungeon.level.getLength()) {
			if (Dungeon.visible[c]) {
				CellEmitter.get(c).burst(SmokeParticle.FACTORY, 4);
			}

			if (Level.flamable[c]) {
				Level.set(c, Terrain.EMBERS);
				GameScene.updateMap(c);
				terrainAffected = true;
			}

			// destroys items / triggers bombs caught in the blast.
			Heap heap = Dungeon.level.heaps.get(c);
			if (heap != null)
				heap.explode();

			Char ch = Actor.findChar(c);
			if (ch != null) {
				// those not at the center of the blast take damage less
				// consistently.
				int minDamage = c == cell ? Dungeon.depth * 4 : Dungeon.depth * 2;
				int maxDamage = 5 + Dungeon.depth * 10;

				int dmg = Random.NormalIntRange(minDamage, maxDamage)
						- Random.Int(ch.dr());
				if (dmg > 0) {
					ch.damage(dmg, this);
					if (!ch.immunities().contains(ConfusionGas.class) && !(ch instanceof NPC)) {
						Buff.affect(ch, Vertigo.class, Vertigo.duration(ch));
					}
				}


				if (ch == Dungeon.hero && !ch.isAlive())
					// constant is used here in the rare instance a player
					// is killed by a double bomb.
					Dungeon.fail(Utils.format(ResultDescriptions.ITEM,
							"bomb"));
			}
		}
	}

	if (terrainAffected) {
		Dungeon.observe();
	}

}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:60,代码来源:DizzyBomb.java


注:本文中的com.watabou.utils.PathFinder.NEIGHBOURS9属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。