From ba0044f48b2f6ba15c71c3f85355c5b38a48ddcf Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 18 Nov 2015 16:43:19 -0500 Subject: [PATCH] v0.3.2c: Fixed bugs involving tengu and helper mobs --- .../shatteredpixeldungeon/actors/mobs/Bee.java | 4 +++- .../shatteredpixeldungeon/actors/mobs/Tengu.java | 3 +++ .../levels/PrisonBossLevel.java | 13 +++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java index d93330e8b..79bebaa0f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java @@ -39,6 +39,8 @@ public class Bee extends Mob { spriteClass = BeeSprite.class; viewDistance = 4; + + EXP = 0; flying = true; state = WANDERING; @@ -118,7 +120,7 @@ public class Bee extends Mob { else { //if already targeting something, and that thing is still alive and near the pot, keeping targeting it. - if (enemy != null && enemy.isAlive() + if (enemy != null && enemy.isAlive() && Dungeon.level.mobs.contains(enemy) && Level.fieldOfView[enemy.pos] && enemy.invisible == 0 && Level.distance(enemy.pos, potPos) <= 3) return enemy; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java index 77102081f..160b0bee3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java @@ -250,6 +250,9 @@ public class Tengu extends Mob { if (enemyInFOV) { target = enemy.pos; + } else { + chooseEnemy(); + target = enemy.pos; } spend( TICK ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java index ba43d376f..1ccde4d4d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java @@ -245,7 +245,7 @@ public class PrisonBossLevel extends Level { Dungeon.observe(); } - private void clearHeaps(Room safeArea){ + private void clearEntities(Room safeArea){ for (Heap heap : heaps.values()){ if (safeArea == null || !safeArea.inside(heap.pos)){ for (Item item : heap.items) @@ -253,6 +253,11 @@ public class PrisonBossLevel extends Level { heap.destroy(); } } + for (Mob mob : Dungeon.level.mobs.toArray(new Mob[Dungeon.level.mobs.size()])){ + if (mob != tengu && (safeArea == null || !safeArea.inside(mob.pos))){ + mob.destroy(); + } + } } public void progress(){ @@ -275,7 +280,7 @@ public class PrisonBossLevel extends Level { case FIGHT_START: changeMap(MAP_MAZE); - clearHeaps((Room)new Room().set(0, 5, 8, 32)); //clear all but the entrance + clearEntities((Room) new Room().set(0, 5, 8, 32)); //clear all but the entrance Actor.remove(tengu); mobs.remove(tengu); @@ -296,7 +301,7 @@ public class PrisonBossLevel extends Level { Dungeon.hero.sprite.place(Dungeon.hero.pos); changeMap(MAP_ARENA); - clearHeaps(null); + clearEntities(null); tengu.state = tengu.HUNTING; do { @@ -326,7 +331,7 @@ public class PrisonBossLevel extends Level { tengu.sprite.place(5 + 28 * 32); changeMap(MAP_END); - clearHeaps(null); + clearEntities(null); tengu.die(Dungeon.hero);