From 82cdc7149f413403219ba30f454daa449e142e4d Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 19 May 2016 18:01:32 -0400 Subject: [PATCH] v0.4.0: fixed a number of bugs regarding tengu --- .../actors/mobs/Tengu.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java index af0358756..95c74b12a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java @@ -92,25 +92,23 @@ public class Tengu extends Mob { @Override public void damage(int dmg, Object src) { + int beforeHitHP = HP; + super.damage(dmg, src); + dmg = beforeHitHP - HP; + LockedFloor lock = Dungeon.hero.buff(LockedFloor.class); if (lock != null) { - int multiple = HP > HT/2 ? 1 : 4; + int multiple = beforeHitHP > HT/2 ? 1 : 4; lock.addTime(dmg*multiple); } //phase 2 of the fight is over - if (dmg >= HP) { - if (state == SLEEPING) { - state = WANDERING; - } + if (HP == 0 && beforeHitHP <= HT/2) { ((PrisonBossLevel)Dungeon.level).progress(); return; } - int beforeHitHP = HP; - super.damage(dmg, src); - - int hpBracket = HP > HT/2 ? 12 : 20; + int hpBracket = beforeHitHP > HT/2 ? 12 : 20; //phase 1 of the fight is over if (beforeHitHP > HT/2 && HP <= HT/2){ @@ -125,6 +123,11 @@ public class Tengu extends Mob { } } + @Override + public boolean isAlive() { + return HP > 0 || Dungeon.level.mobs.contains(this); //Tengu has special death rules, see prisonbosslevel.progress() + } + @Override public void die( Object cause ) {