From 8982c287b48262240b0fbfdff2d2018c7b34abaa Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 4 Mar 2025 15:51:24 -0600 Subject: [PATCH] new finish power action system --- src/engine/gameManager/PowersManager.java | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index f121bdd3..ae87a568 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -1198,6 +1198,10 @@ public enum PowersManager { public static void finishUseMobPower(PerformActionMsg msg, Mob caster, int casterLiveCounter, int targetLiveCounter) { + if(true) { + newFinishCast(msg); + return; + } if (caster == null || msg == null) return; @@ -3106,6 +3110,53 @@ public enum PowersManager { } return true; } + + public static void newFinishCast(PerformActionMsg msg){ + + PlayerCharacter source = PlayerCharacter.getPlayerCharacter(msg.getSourceID()); + + if(source == null) + return; + + if(!source.isAlive()) + return; + + PowersBase powerBase = PowersManager.getPowerByToken(msg.getPowerUsedID()); + + if(powerBase == null) + return; + + int trains = msg.getNumTrains(); + if(source.getPowers().containsKey(msg.getPowerUsedID())){ + trains = source.getPowers().get(msg.getPowerUsedID()).getTrains(); + } + AbstractWorldObject target = getTarget(msg); + + if(target == null) + return; + + for(ActionsBase action : powerBase.getActions()){ + String stackType = action.stackType; + if(target.effects.containsKey(stackType)){ + Effect eff = target.effects.get(stackType); + if(action.greaterThan && trains <= eff.getTrains()) + continue; + if(action.greaterThanEqual && trains < eff.getTrains()) + continue; + if(AbstractCharacter.IsAbstractCharacter(target)){ + AbstractCharacter absTar = (AbstractCharacter) target; + if(absTar.getBonuses() != null){ + SourceType sourceType = SourceType.GetSourceType(action.stackType); + if(sourceType != null && absTar.getBonuses().getBool(ModType.ImmuneTo,sourceType)) + continue; + if(sourceType != null && absTar.getBonuses().getBool(ModType.NoMod,sourceType)) + continue; + } + } + } + action.getPowerAction().startAction(source,target,target.loc,trains,action,powerBase); + } + } }