public BattleDamageEvent(Type type, BattleManager manager, BattleQueueTime time, BattleAgent target, Element element, int damage, DamageTo affects = DamageTo.HP) : base(type, manager, time) { Target = target; Element = element; Damage = damage; Affects = affects; }
public BattleSkillEvent(Type type, BattleManager manager, BattleQueueTime time, BattleAgent user, BattleAgent target, Skill skill) : base(type, manager, time) { User = user; Target = target; Skill = skill; Power = Skill.BasePower(user); IgnoreResistance = 0; }
public override BattleQueueTime Generate() { BattleQueueTime next = new BattleQueueTime(m_NextMinimum, m_NextMaximum); m_NextMinimum = m_NextMaximum; m_NextMaximum = 0.5f * (m_NextMaximum + m_AbsoluteMaximum); return(next); }
public override BattleQueueTime Generate() { BattleQueueTime next = new BattleQueueTime(m_NextMinimum, m_NextMaximum); m_NextMinimum += m_Difference; m_NextMaximum += m_Difference; return(next); }
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) { BattleDamageEvent eventInfo = new BattleDamageEvent( BattleEvent.Type.BeforeTakeDamage, manager, time, m_Agent, m_Element, m_Damage ); m_Agent.Damage(eventInfo); }
public override void Execute(BattleManager manager, BattleQueueTime time) { m_Agent.OnTrigger(new BattleEvent(BattleEvent.Type.AfterTurn, manager, time)); m_Agent.CP -= 60; if (m_Agent["Turn:Move"] <= 0) { m_Agent.CP -= 15; } if (m_Agent["Turn:Action"] <= 0) { m_Agent.CP -= 25; } }
/// <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 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 BattleShowAgentReport(BattleQueueTime time, BattleAgent agent) : base(time) { m_Agent = agent; m_ReportUI = GameObject.Find("Battle Agent Report UI").GetComponent <BattleAgentReportUI>(); }
public BattleShowAgentMessage(BattleQueueTime time, BattleManager manager, BattleAgent agent, string message) : this(time, manager, agent, message, Color.white) { }
public BattleShowAgentDialogue(BattleQueueTime time, BattleAgent speaker, string text) : base(time) { m_Speaker = speaker; m_Text = text; }
public override void Execute(BattleManager manager, BattleQueueTime time) { manager.Add(new BattleShowAgentDialogue(time, m_Speaker, m_Text)); }
public BattleAgentDecision(BattleQueueTime time, BattleAgent agent) : base(time) { m_Agent = agent; m_Decider = null; }
public BattleTargetConfirm(BattleQueueTime time, BattleZone range, BattleManhattanDistanceZone target) : base(time) { m_Range = range; m_Target = target; }
public BattleShowAgentMessage(BattleQueueTime time, BattleManager manager, BattleAgent agent, string message, Color color) : base(time) { m_Actor = manager.grid[agent.Coordinates].Actor; m_Message = message; m_Color = color; }
public InfiniteGenerator(BattleQueueTime span) { m_AbsoluteMaximum = span.m_Maximum; m_NextMinimum = span.m_Minimum; m_NextMaximum = 0.5f * (span.m_Minimum + span.m_Maximum); }
public BattleActionEvent(Type eventType, BattleManager manager, BattleQueueTime time, T action) : base(eventType, manager, time) { Action = action; }
public FiniteGenerator(BattleQueueTime span, int number) { m_Difference = (span.m_Maximum - span.m_Minimum) / number; m_NextMinimum = span.m_Minimum; m_NextMaximum = m_NextMinimum + m_Difference; }
public BattleTargetSelect(BattleQueueTime time, BattleZone range) : base(time) { m_Range = range; }
public abstract void Execute(BattleManager manager, BattleQueueTime time);
public BattleActionExecution(BattleQueueTime time, BattleAction action) : base(time) { m_Action = action; }
public override void Execute(BattleManager manager, BattleQueueTime time) { manager.Add(new BattleShowAgentReport(time - 1f, m_Agent)); }
public BattleQueueMember(BattleQueueTime time) { this.time = time; }
public BattleEvent(Type eventType, BattleManager manager, BattleQueueTime time) { Event = eventType; Manager = manager; Time = time; }
public BattleSpecialEffectAnimation(BattleQueueTime time, BattleSpriteAnimation animation, BattleAgent agent) : base(time) { m_Animation = animation; m_Agent = agent; }
public BattleWalk(Vector2Int coordinates, Vector2Int direction, BattleQueueTime time) : base(time) { m_Source = coordinates; m_Direction = direction; m_Velocity = WalkSpeed * new Vector3(direction.x, 0f, -direction.y); }