From d68d70ca76beaceb3d92c1779b4acc41d09d6c20 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 28 Feb 2015 04:46:00 -0500 Subject: [PATCH] v0.2.4b: minor tweaks to mob targeting behaviour --- .../shatteredpixeldungeon/actors/buffs/Amok.java | 12 ++++++++++-- .../shatteredpixeldungeon/actors/mobs/Mob.java | 4 +--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java index 7a145b754..93255d11a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java @@ -17,6 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; public class Amok extends FlavourBuff { @@ -25,8 +26,15 @@ public class Amok extends FlavourBuff { public int icon() { return BuffIndicator.AMOK; } - - @Override + + @Override + public void detach() { + super.detach(); + if (target instanceof Mob) + ((Mob)target).aggro( null ); + } + + @Override public String toString() { return "Amok"; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 5a0cfed6e..ae9acff19 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -169,11 +169,9 @@ public abstract class Mob extends Char { //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 not amoked, and is targeting a hostile mob if ( enemy != null && !enemy.isAlive() || state == WANDERING || - (buff( Amok.class ) != null && enemy == Dungeon.hero ) || - (buff( Amok.class ) == null && enemy instanceof Mob && ((Mob) enemy).hostile )) + (buff( Amok.class ) != null && enemy == Dungeon.hero )) enemy = null; //if there is no current target, find a new one.