From 208a954dc0b2ffd778e53da071dbb60b893ad547 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 8 Dec 2019 18:38:11 -0500 Subject: [PATCH] v0.8.0: Fixes: - Further bee AI weirdness involving explosive traps - Fixed no logic existing to account for hero being killed by an attack proc --- .../shatteredpixeldungeon/actors/mobs/Statue.java | 8 +++++++- .../actors/mobs/npcs/MirrorImage.java | 9 ++++++++- .../shatteredpixel/shatteredpixeldungeon/items/Heap.java | 4 ++++ .../shatteredpixeldungeon/items/artifacts/DriedRose.java | 4 ++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 6c3f8a243..b06bbc48b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.utils.Bundle; import com.watabou.utils.Random; @@ -120,7 +121,12 @@ public class Statue extends Mob { @Override public int attackProc( Char enemy, int damage ) { damage = super.attackProc( enemy, damage ); - return weapon.proc( this, enemy, damage ); + damage = weapon.proc( this, enemy, damage ); + if (!enemy.isAlive() && enemy == Dungeon.hero){ + Dungeon.fail(getClass()); + GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) ); + } + return damage; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java index 0dd62f51e..3ff04e6cd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java @@ -32,9 +32,11 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.MirrorSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.utils.Bundle; import com.watabou.utils.Random; @@ -158,7 +160,12 @@ public class MirrorImage extends NPC { ((Mob)enemy).aggro( this ); } if (hero.belongings.weapon != null){ - return hero.belongings.weapon.proc( this, enemy, damage ); + damage = hero.belongings.weapon.proc( this, enemy, damage ); + if (!enemy.isAlive() && enemy == Dungeon.hero){ + Dungeon.fail(getClass()); + GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) ); + } + return damage; } else { return damage; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index 9dcf06441..49df2364f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -275,6 +275,10 @@ public class Heap implements Bundlable { items.remove(item); ((Potion) item).shatter(pos); + } else if (item instanceof Honeypot.ShatteredPot) { + items.remove(item); + ((Honeypot.ShatteredPot) item).destroyPot(pos); + } else if (item instanceof Bomb) { items.remove( item ); ((Bomb) item).explode(pos); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index 94a276a36..471018f08 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -619,6 +619,10 @@ public class DriedRose extends Artifact { damage = super.attackProc(enemy, damage); if (rose != null && rose.weapon != null) { damage = rose.weapon.proc( this, enemy, damage ); + if (!enemy.isAlive() && enemy == Dungeon.hero){ + Dungeon.fail(getClass()); + GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) ); + } } return damage; }