public Action Act(SimulationState state, CombatUnit unit) { CombatUnit target = null; if (TargetTag != 0) { target = state.GetUnit(TargetTag, unit.Owner); } if (target == null) { List <CombatUnit> allies = unit.Owner == 1 ? state.Player1Units : state.Player2Units; float dist = 10000000000; foreach (CombatUnit ally in allies) { if (!ally.HasAttribute(UnitAttribute.Biological)) { continue; } if (ally.Health >= unit.HealthMax) { continue; } float newDist = unit.DistSq(ally); if (newDist > dist) { continue; } target = ally; TargetTag = ally.Tag; dist = newDist; } if (target == null) { foreach (CombatUnit ally in allies) { if (!ally.HasAttribute(UnitAttribute.Biological)) { continue; } float newDist = unit.DistSq(ally); if (newDist > dist) { continue; } target = ally; TargetTag = ally.Tag; dist = newDist; } } } return(new MedivacHeal(target)); }
public Action Act(SimulationState state, CombatUnit unit) { CombatUnit target = null; if (TargetTag != 0) { target = state.GetUnit(TargetTag, 3 - unit.Owner); } if (target == null) { List <CombatUnit> enemies = unit.Owner == 2 ? state.Player1Units : state.Player2Units; float dist = 10000000000; foreach (CombatUnit enemy in enemies) { float newDist = unit.DistSq(enemy); if (newDist > dist) { continue; } if (unit.GetWeapon(enemy) == null) { continue; } target = enemy; TargetTag = enemy.Tag; dist = newDist; } } return(new Attack(target)); }
public virtual void Perform(SimulationState state, CombatUnit unit) { if (Target == null) { return; } if (unit.FramesUntilNextAttack > 0) { return; } if (unit.AdditionalAttacksRemaining > 0 && unit.PreviousAttackTarget.Tag != Target.Tag) { unit.AdditionalAttacksRemaining = 0; } CombatWeapon picked = unit.GetWeapon(Target); if (picked == null) { return; } if (unit.DistSq(Target) > picked.Range * picked.Range) { unit.Move(Target.Pos); return; } unit.Attack(state, picked, Target, false); }
private void Attack(SimulationState state, CombatUnit damagedUnit, CombatWeapon picked, CombatUnit unit) { if (!damagedUnit.IsGround) { return; } float dist = Target.DistSq(damagedUnit); if (dist >= 1.25f * 1.25f) { return; } if (dist >= 0.7812f * 0.7812f) { unit.Attack(state, picked, damagedUnit, false, 0.25f); return; } if (dist >= 0.4687f * 0.4687f) { unit.Attack(state, picked, damagedUnit, false, 0.5f); return; } unit.Attack(state, picked, damagedUnit, false, 1); }
public virtual void Perform(SimulationState state, CombatUnit unit) { if (Target == null) { return; } if (unit.FramesUntilNextAttack > 0) { return; } CombatWeapon picked = unit.GetWeapon(Target); if (picked == null) { return; } if (unit.DistSq(Target) > picked.Range * picked.Range) { return; } foreach (CombatUnit damagedUnit in state.Player1Units) { Attack(state, damagedUnit, picked, unit); } foreach (CombatUnit damagedUnit in state.Player2Units) { Attack(state, damagedUnit, picked, unit); } }
public override void OnFrame(SimulationState state, CombatUnit unit) { unit.Move(Target.Pos); if (unit.DistSq(Target) <= unit.Weapons[0].Range * unit.Weapons[0].Range) { Target.DealDamage(state, 8, true); if (unit.FramesUntilNextAttack == 0) { unit.Attack(state, unit.Weapons[0], Target, false); } ExpireFrame = -1; } }
public Action Process(SimulationState state, CombatUnit unit, Action action) { if (!(action is Attack)) { return(action); } if (state.SimulationFrame < NextChargeFrame) { return(action); } if (((Attack)action).Target == null || unit.DistSq(((Attack)action).Target) > 4 * 4) { return(action); } unit.AddBuff(new Charge(((Attack)action).Target, state.SimulationFrame + 78)); NextChargeFrame = state.SimulationFrame + 224; return(new DoNothing()); }
public override void Perform(SimulationState state, CombatUnit unit) { if (Target == null) { return; } if (unit.FramesUntilNextAttack > 0) { return; } if (unit.AdditionalAttacksRemaining > 0 && unit.PreviousAttackTarget.Tag != Target.Tag) { unit.AdditionalAttacksRemaining = 0; } CombatWeapon picked = unit.GetWeapon(Target); if (picked == null) { return; } if (unit.DistSq(Target) > picked.Range * picked.Range) { unit.Move(Target.Pos); return; } unit.Attack(state, picked, Target, false); foreach (Buff buff in Target.Buffs) { if (buff is ConcussiveShell) { buff.ExpireFrame = state.SimulationFrame + 24; return; } } Target.AddBuff(new ConcussiveShell(state.SimulationFrame + 24)); }
public virtual void Perform(SimulationState state, CombatUnit unit) { if (Target == null) { return; } if (unit.DistSq(Target) > 4 * 4) { unit.Move(Target.Pos); return; } if (unit.Energy < 0.18516) { return; } if (!Target.HasAttribute(UnitAttribute.Biological)) { return; } unit.Energy -= 0.18516f; Target.Health = System.Math.Min(Target.Health + 0.56f, Target.HealthMax); }