v1.2.2: fixed great crab being able to block attacks from invis enemies

This commit is contained in:
Evan Debenham 2022-04-04 16:10:06 -04:00
parent 6a1c05be4b
commit 9c8b6d44f5

View File

@ -72,8 +72,12 @@ public class GreatCrab extends Crab {
public void damage( int dmg, Object src ){ public void damage( int dmg, Object src ){
//crab blocks all wand damage from the hero if it sees them. //crab blocks all wand damage from the hero if it sees them.
//Direct damage is negated, but add-on effects and environmental effects go through as normal. //Direct damage is negated, but add-on effects and environmental effects go through as normal.
if ((enemySeen && state != SLEEPING && paralysed == 0) if (enemySeen
&& (src instanceof Wand && enemy == Dungeon.hero)){ && state != SLEEPING
&& paralysed == 0
&& src instanceof Wand
&& enemy == Dungeon.hero
&& enemy.invisible == 0){
GLog.n( Messages.get(this, "noticed") ); GLog.n( Messages.get(this, "noticed") );
sprite.showStatus( CharSprite.NEUTRAL, Messages.get(this, "def_verb") ); sprite.showStatus( CharSprite.NEUTRAL, Messages.get(this, "def_verb") );
Sample.INSTANCE.play( Assets.Sounds.HIT_PARRY, 1, Random.Float(0.96f, 1.05f)); Sample.INSTANCE.play( Assets.Sounds.HIT_PARRY, 1, Random.Float(0.96f, 1.05f));
@ -85,7 +89,11 @@ public class GreatCrab extends Crab {
@Override @Override
public int defenseSkill( Char enemy ) { public int defenseSkill( Char enemy ) {
//crab blocks all melee attacks from its current target //crab blocks all melee attacks from its current target
if (enemySeen && state != SLEEPING && paralysed == 0 && enemy == this.enemy){ if (enemySeen
&& state != SLEEPING
&& paralysed == 0
&& enemy == this.enemy
&& enemy.invisible == 0){
if (sprite != null && sprite.visible) { if (sprite != null && sprite.visible) {
Sample.INSTANCE.play(Assets.Sounds.HIT_PARRY, 1, Random.Float(0.96f, 1.05f)); Sample.INSTANCE.play(Assets.Sounds.HIT_PARRY, 1, Random.Float(0.96f, 1.05f));
GLog.n( Messages.get(this, "noticed") ); GLog.n( Messages.get(this, "noticed") );