public static List<DelayedAction> GetAbilityExecutionSteps(Ability ability, PartyMember source, PartyMember primaryTarget) { var toReturn = new List<DelayedAction>(); //for each ability step foreach (var step in ability.GetAbilitySteps(source)) { var allTargets = new PartyMember[0]; toReturn.Add(DelayedAction.New(() => { //get secondary targets for this step based on primary target allTargets = GetAllTargetsForAbilityStep(source, primaryTarget, ability.Target, step); }, 1)); //handle ability animations (in parallel) toReturn.Add(DelayedAction.New( () => HandleAbilityStepAnimations(source, allTargets, step.Animation), step.GetTotalFrames(GameState.InMenu))); //apply effects to targets, long enough to display healing/status/etc toReturn.Add(DelayedAction.New( () => step.ApplyEffectToTargets(null, allTargets), Constants.BATTLE_TIMING_DISPLAY_DAMAGE_TICKS)); } return toReturn; }