From 33c923b0de1a6e33a4026846bd50df73489da62b Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 13 Jun 2024 20:47:28 -0500 Subject: [PATCH] fixed immunities in powers manager --- src/engine/gameManager/PowersManager.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 59901a99..84b8d0a9 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -925,9 +925,20 @@ public enum PowersManager { if (pb.isHarmful()) mobTarget.handleDirectAggro(playerCharacter); } - //Power is aiding a target, handle aggro if combat target is a Mob. - if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) { + + //Check for immunities + if (target.getObjectType() == GameObjectType.PlayerCharacter) { PlayerCharacter pcTarget = (PlayerCharacter) target; + PlayerBonuses tarBonus = pcTarget.getBonuses(); + SourceType source = SourceType.GetSourceType(pb.category); + boolean immune = tarBonus.getBool(ModType.ImmuneTo, source); + if(!immune){ + DamageType damageType = DamageType.getDamageType(pb.category); + immune = pcTarget.getResists().immuneTo(damageType); + } + if(immune){ + return; + } } // update target of used power timer