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


Java PathFinder.NEIGHBOURS9DIST2属性代码示例

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


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

示例1: onThrow

@Override
protected void onThrow(int cell) {
	if (!Level.pit[cell] && lightingFuse) {
		Actor.addDelayed(fuse = new Fuse().ignite(this), 2);
	}
	if ((Actor.findChar(cell) != null
			&& !(Actor.findChar(cell) instanceof Hero)) ||
			Dungeon.level.heaps.get(cell) != null) {
		ArrayList<Integer> candidates = new ArrayList<>();
		for (int i : PathFinder.NEIGHBOURS9DIST2)
			if (Level.passable[cell + i] && Dungeon.level.heaps.get(cell + i) == null)
				candidates.add(cell + i);
		int newCell = candidates.isEmpty() ? cell : Random
				.element(candidates);
		Dungeon.level.drop(this, newCell).sprite.drop(cell);
	} else
		super.onThrow(cell);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:18,代码来源:HolyHandGrenade.java

示例2: damageRoll

@Override
public int damageRoll() {
	if (pumpedUp > 0) {
		pumpedUp = 0;
		for (int i = 0; i < PathFinder.NEIGHBOURS9DIST2.length; i++) {
			int j = pos + PathFinder.NEIGHBOURS9DIST2[i];
			if (Dungeon.level.insideMap(j) && Level.passable[j])
				CellEmitter.get(j).burst(ElmoParticle.FACTORY, 10);
		}
		Sample.INSTANCE.play(Assets.SND_BURNING);
		return Random.NormalIntRange(5, 30);
	} else {
		return Random.NormalIntRange(2, 12);
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:15,代码来源:Goo.java

示例3: heroNear

protected boolean heroNear() {
	boolean check = false;
	for (int i : PathFinder.NEIGHBOURS9DIST2) {
		int cell = pos + i;
		if (Actor.findChar(cell) != null
				&& (Actor.findChar(cell) instanceof Hero)
				) {
			check = true;
		}
	}
	return check;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:12,代码来源:LitTower.java

示例4: autoAim

public static int autoAim(Char target) {
	if (new Ballistica(Dungeon.hero.pos, target.pos, Ballistica.PROJECTILE).collisionPos == target.pos) {
		return target.pos;
	}
	for (int i : PathFinder.NEIGHBOURS9DIST2) {
		if (new Ballistica(Dungeon.hero.pos, target.pos + i, Ballistica.PROJECTILE).collisionPos == target.pos) {
			return target.pos + i;
		}
	}
	return -1;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:11,代码来源:QuickSlotButton.java

示例5: affectMap

private void affectMap(Ballistica beam) {
	boolean noticed = false;
	for (int c : beam.subPath(0, beam.dist)) {
		for (int n : PathFinder.NEIGHBOURS9DIST2) {
			int cell = c + n;
			if (!Dungeon.level.insideMap(cell))
				continue;

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

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

				Level.set(cell, Terrain.discover(terr));
				GameScene.updateMap(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);

	Dungeon.observe();
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:31,代码来源:WandOfPrismaticLight.java

示例6: 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);
	//}

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

			Heap heap = Dungeon.level.heaps.get(c);
			if (heap != null)
				heap.dumpexplode();

			Char ch = Actor.findChar(c);
			if (ch instanceof AlbinoPiranha) {

				int count = 20;
				int pos;
				do {
					pos = Dungeon.level.randomRespawnCellFish();
					if (count-- <= 0) {
						break;
					}
				} while (pos == -1);

				if (pos == -1) {

					GLog.w(TXT_NO_TELEPORT);

				} else {

					ch.pos = pos;
					ch.sprite.place(ch.pos);
					ch.sprite.visible = Dungeon.visible[pos];
					GLog.i(Messages.get(FishingBomb.class, "tele", curUser.name, ch.name));

				}

			}
		}
	}

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


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