本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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();
}
示例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();
}
示例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]);
}
}
示例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());
}
}
}
示例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") );
}
}
}
}
示例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;
}
示例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();
}
示例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;
}
示例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"));
}
}
}
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}