|
|
@ -2,6 +2,8 @@ package engine.wpakpowers; |
|
|
|
|
|
|
|
|
|
|
|
import engine.objects.AbstractCharacter; |
|
|
|
import engine.objects.AbstractCharacter; |
|
|
|
import engine.objects.AbstractWorldObject; |
|
|
|
import engine.objects.AbstractWorldObject; |
|
|
|
|
|
|
|
import engine.wpak.data.Effect; |
|
|
|
|
|
|
|
import engine.wpak.data.ModifierEntry; |
|
|
|
import engine.wpak.data.Power; |
|
|
|
import engine.wpak.data.Power; |
|
|
|
import engine.wpak.data.PowerAction; |
|
|
|
import engine.wpak.data.PowerAction; |
|
|
|
|
|
|
|
|
|
|
@ -14,7 +16,33 @@ public class Actions { |
|
|
|
|
|
|
|
|
|
|
|
public static void ApplyEffects(AbstractCharacter caster, AbstractWorldObject target, Power power, |
|
|
|
public static void ApplyEffects(AbstractCharacter caster, AbstractWorldObject target, Power power, |
|
|
|
Integer rank, PowerAction powerAction) { |
|
|
|
Integer rank, PowerAction powerAction) { |
|
|
|
System.out.println("PowerAction method called"); |
|
|
|
|
|
|
|
|
|
|
|
// Iterate effects for this powerAction and apply
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Effect effect : powerAction.effects) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create pojo to hold effect/modifiers stored in AWO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppliedEffect appliedEffect = new AppliedEffect(); |
|
|
|
|
|
|
|
appliedEffect.effect = effect; |
|
|
|
|
|
|
|
appliedEffect.rank = rank; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add modifier objects from behaviours to pojo.
|
|
|
|
|
|
|
|
// Anything from a float to an array can be returned
|
|
|
|
|
|
|
|
// based on the needs of the behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (ModifierEntry modifierEntry : effect.mods) { |
|
|
|
|
|
|
|
Object modifier = modifierEntry.type.behaviorType.apply(caster, target, power, |
|
|
|
|
|
|
|
powerAction, effect, modifierEntry, rank); |
|
|
|
|
|
|
|
appliedEffect.modifiers.put(modifierEntry.type, modifier); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add this power effect to the target
|
|
|
|
|
|
|
|
// or overwrite the old value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target._effects.put(effect, appliedEffect); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// target.updateBonuses() here?
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void Block(AbstractCharacter caster, AbstractWorldObject target, Power power, |
|
|
|
public static void Block(AbstractCharacter caster, AbstractWorldObject target, Power power, |
|
|
|