public override void Execute(BattleManager manager, BattleQueueTime time) { BattleQueueTime.Generator t = new BattleQueueTime.FiniteGenerator(time, Sequence.Count); foreach (BattleAction action in Sequence) { manager.Add(new BattleActionExecution(t.Generate(), action)); } }
public override void Execute(BattleManager manager, BattleQueueTime time) { BattleQueueTime.Generator timeAllTargets = new BattleQueueTime.InfiniteGenerator(time); int hpcost = Mathf.RoundToInt(HPCost * Skill.Cost(Agent)); int spcost = Mathf.RoundToInt(SPCost * Skill.Cost(Agent)); if (Agent.HP <= hpcost || Agent.SP < spcost) { return; } Agent.HP -= hpcost; Agent.SP -= spcost; foreach (Vector2Int point in Target) { BattleTile tile = manager.grid[point]; if (tile != null && tile.Actor != null) { BattleQueueTime.Generator timeThisTarget = new BattleQueueTime.FiniteGenerator(timeAllTargets.Generate(), 5); BattleAgent target = tile.Actor.Agent; // Trigger any events before the user uses the skill BattleSkillEvent eventInfo = new BattleSkillEvent( BattleEvent.Type.BeforeUseSkill, manager, timeThisTarget.Generate(), Agent, target, Skill ); eventInfo.Power = Mathf.RoundToInt(eventInfo.Power * Power); Agent.OnTrigger(eventInfo); // Trigger any events before the target is targeted by the skill eventInfo.Time = timeThisTarget.Generate(); eventInfo.Event = BattleEvent.Type.BeforeTargetedBySkill; target.OnTrigger(eventInfo); // Animate the skill if (Skill.Animation != null) { manager.Add(new BattleSpecialEffectAnimation(timeThisTarget.Generate(), Skill.Animation, eventInfo.Target)); } // Make the skill happen eventInfo.Time = timeThisTarget.Generate(); Skill.Execute(eventInfo); // Trigger any events after the target is targeted by the skill eventInfo.Time = timeThisTarget.Generate(); eventInfo.Event = BattleEvent.Type.AfterTargetedBySkill; target.OnTrigger(eventInfo); } } }
public override void Execute(BattleManager manager, BattleQueueTime time) { // Find a path using A* Stack <Vector2Int> steps; PathFinder.AStar(m_Agent.Coordinates, destination, out steps, m_Agent["Jump"]); // Push each step in path BattleGrid grid = manager.grid; while (steps.Count > 1) { Vector2Int current = steps.Pop(); if (grid[current].Height != grid[steps.Peek()].Height) { manager.Add(new BattleJump(current, steps.Peek() - current, time - steps.Count - 2)); } else { manager.Add(new BattleWalk(current, steps.Peek() - current, time - steps.Count - 2)); } } }
public override void QStart(BattleManager manager) { BattleEvent eventInfo = new BattleEvent(BattleEvent.Type.Tick, manager, time); foreach (BattleAgent agent in manager.agents) { agent.OnTrigger(eventInfo); agent.CP += agent["Speed"]; if (agent.CP >= 100) { agent.CP = 100; manager.Add(new BattleAgentDecision(time - agent["Speed"], agent)); } } }
/// <summary> /// Inflict the agent with a status effect. /// </summary> /// <param name="status">The status effect to inflict</param> /// <param name="duration">The duration of the status effect</param> public void Inflict(Status status, int duration, BattleQueueTime time, string message = "") { BattleManager manager = GameObject.FindObjectOfType <BattleManager>(); if (StatusEffects.ContainsKey(status)) { StatusEffects[status]["Duration"] += duration; } else { StatusEffects[status] = new StatusInstance(status, duration); BattleEvent eventInfo = new BattleEvent(BattleEvent.Type.FirstInflictedWithStatus, manager, time); status.OnTrigger(new StatusEvent(eventInfo, status, StatusEffects[status], this)); } if (!message.Equals("")) { manager.Add(new BattleShowAgentMessage(time, manager, this, message)); } }
public override bool QUpdate(BattleManager manager) { if (m_Agent.CP < 100) { return(true); } BattleAction decision = m_Decider.Update(); if (decision != null) { BattleQueueTime.Generator t = new BattleQueueTime.FiniteGenerator(time - 1, 2); decision.Execute(manager, t.Generate()); time = t.Generate(); manager.Add(this); return(true); } return(false); }
public override bool QUpdate(BattleManager manager) { time += 1f; manager.Add(this); return(true); }
public override void Execute(BattleManager manager, BattleQueueTime time) { manager.Add(new BattleShowAgentDialogue(time, m_Speaker, m_Text)); }
public override void Execute(BattleSkillEvent eventInfo) { BattleManager manager = GameObject.FindObjectOfType <BattleManager>(); manager.Add(new BattleShowAgentReport(eventInfo.Time, eventInfo.Target)); }
public override void Execute(BattleManager manager, BattleQueueTime time) { manager.Add(new BattleShowAgentReport(time - 1f, m_Agent)); }