From c4ffb9b82a01e092efa46034ea650a72ea0d5742 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 17 Jun 2020 15:23:28 -0400 Subject: [PATCH] v0.8.1: passive enemies are no longer auto-surprise attacked --- .../shatteredpixeldungeon/actors/mobs/Mob.java | 5 ++--- .../shatteredpixeldungeon/actors/mobs/YogDzewa.java | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 39663c35b..c0abf6bcd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -543,8 +543,7 @@ public abstract class Mob extends Char { hitWithRanged = true; } - if ((!enemySeen || enemy.invisible > 0) - && enemy == Dungeon.hero && Dungeon.hero.canSurpriseAttack()) { + if (surprisedBy(enemy) && Dungeon.hero.canSurpriseAttack()) { Statistics.sneakAttacks++; Badges.validateRogueUnlock(); Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); @@ -579,7 +578,7 @@ public abstract class Mob extends Char { } public boolean surprisedBy( Char enemy ){ - return (!enemySeen || enemy.invisible > 0) && enemy == Dungeon.hero; + return enemy == Dungeon.hero && (enemy.invisible > 0 || (!enemySeen && state != PASSIVE)); } public void aggro( Char ch ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java index 3896899f8..950b1b9ac 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java @@ -112,10 +112,7 @@ public class YogDzewa extends Mob { @Override protected boolean act() { - //catches an error-case from 0.8.0 & 0.8.0a - if (!isAlive()){ - die(null); - } + enemySeen = true; if (phase == 0){ if (Dungeon.hero.viewDistance >= Dungeon.level.distance(pos, Dungeon.hero.pos)) {