Browse Source

new finish power action system

lakebane
FatBoy-DOTC 4 weeks ago
parent
commit
8982c287b4
  1. 51
      src/engine/gameManager/PowersManager.java

51
src/engine/gameManager/PowersManager.java

@ -1198,6 +1198,10 @@ public enum PowersManager { @@ -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 { @@ -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);
}
}
}

Loading…
Cancel
Save