v2.3.0: fixed amok not properly resetting aggro in some cases

This commit is contained in:
Evan Debenham
2023-11-01 15:14:46 -04:00
parent cdec9a68bf
commit 5c3a143fce
2 changed files with 17 additions and 4 deletions

View File

@@ -21,6 +21,8 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
@@ -38,9 +40,20 @@ public class Amok extends FlavourBuff {
@Override
public void detach() {
super.detach();
if (target instanceof Mob && target.isAlive()) {
((Mob) target).aggro(null);
//if our target is an enemy, reset any enemy-to-enemy aggro involving it
if (target.isAlive()) {
if (target.alignment == Char.Alignment.ENEMY) {
for (Mob m : Dungeon.level.mobs) {
if (m.alignment == Char.Alignment.ENEMY && m.isTargeting(target)) {
m.aggro(null);
}
if (target instanceof Mob && ((Mob) target).isTargeting(m)){
((Mob) target).aggro(null);
}
}
}
}
super.detach();
}
}

View File

@@ -89,7 +89,7 @@ public class StoneOfAggression extends Runestone {
@Override
public void detach() {
//if our target is an enemy, reset the aggro of any enemies targeting it
//if our target is an enemy, reset any enemy-to-enemy aggro involving it
if (target.isAlive()) {
if (target.alignment == Char.Alignment.ENEMY) {
for (Mob m : Dungeon.level.mobs) {