Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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;
            }
        }
Beispiel #4
0
        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));
        }