v0.2.4b: minor tweaks to mob targeting behaviour

This commit is contained in:
Evan Debenham
2015-02-28 04:46:00 -05:00
parent fb6f552e9e
commit d68d70ca76
2 changed files with 11 additions and 5 deletions
@@ -17,6 +17,7 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
public class Amok extends FlavourBuff { public class Amok extends FlavourBuff {
@@ -26,7 +27,14 @@ public class Amok extends FlavourBuff {
return BuffIndicator.AMOK; return BuffIndicator.AMOK;
} }
@Override @Override
public void detach() {
super.detach();
if (target instanceof Mob)
((Mob)target).aggro( null );
}
@Override
public String toString() { public String toString() {
return "Amok"; return "Amok";
} }
@@ -169,11 +169,9 @@ public abstract class Mob extends Char {
//resets target if: the target is dead, the target has been lost (wandering) //resets target if: the target is dead, the target has been lost (wandering)
//or if the mob is amoked and targeting the hero (will try to target something else) //or if the mob is amoked and targeting the hero (will try to target something else)
//or if the mob is not amoked, and is targeting a hostile mob
if ( enemy != null && if ( enemy != null &&
!enemy.isAlive() || state == WANDERING || !enemy.isAlive() || state == WANDERING ||
(buff( Amok.class ) != null && enemy == Dungeon.hero ) || (buff( Amok.class ) != null && enemy == Dungeon.hero ))
(buff( Amok.class ) == null && enemy instanceof Mob && ((Mob) enemy).hostile ))
enemy = null; enemy = null;
//if there is no current target, find a new one. //if there is no current target, find a new one.