From 5ed738a5eb0715701b85a975c2b4d97b71fa4193 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 17 Jun 2015 10:52:25 -0400 Subject: [PATCH] v0.3.0e: cleaned up the gnoll trickster's code, enforces parity with scorpios --- .../actors/mobs/npcs/Ghost.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index 45bdba526..d354cd38a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -467,18 +467,14 @@ public class Ghost extends NPC { @Override protected boolean canAttack( Char enemy ) { - Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE ); - if (!Level.adjacent(pos, enemy.pos) && attack.collisionPos == enemy.pos){ - combo++; - return true; - } else { - return false; - } + Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE); + return !Level.adjacent( pos, enemy.pos ) && attack.collisionPos == enemy.pos; } @Override public int attackProc( Char enemy, int damage ) { //The gnoll's attacks get more severe the more the player lets it hit them + combo++; int effect = Random.Int(4)+combo; if (effect > 2) { @@ -499,8 +495,8 @@ public class Ghost extends NPC { @Override protected boolean getCloser( int target ) { combo = 0; //if he's moving, he isn't attacking, reset combo. - if (enemy != null && Level.adjacent(pos, enemy.pos)) { - return getFurther( target ); + if (state == HUNTING) { + return enemySeen && getFurther( target ); } else { return super.getCloser( target ); }