v0.3.2c: Fixed bugs involving tengu and helper mobs

This commit is contained in:
Evan Debenham 2015-11-18 16:43:19 -05:00 committed by Evan Debenham
parent 4715b42b77
commit ba0044f48b
3 changed files with 15 additions and 5 deletions

View File

@ -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;

View File

@ -250,6 +250,9 @@ public class Tengu extends Mob {
if (enemyInFOV) {
target = enemy.pos;
} else {
chooseEnemy();
target = enemy.pos;
}
spend( TICK );

View File

@ -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);