コード例 #1
0
        protected override void OnAction()
        {
            var unitLock = GetLock().ThrowIfNotType <UnitLock>(ErrorCodes.InvalidLockType);

            if (!LOSCheckAndCreateBeam(unitLock.Target))
            {
                OnError(ErrorCodes.LOSFailed);
                return;
            }

            var coreNeutralized     = _energyNeutralizedAmount.Value;
            var coreNeutralizedDone = 0.0;

            ModifyValueByReactorRadiation(unitLock.Target, ref coreNeutralized);
            coreNeutralized = ModifyValueByOptimalRange(unitLock.Target, coreNeutralized);

            if (coreNeutralized > 0.0)
            {
                var core = unitLock.Target.Core;
                unitLock.Target.Core -= coreNeutralized;
                coreNeutralizedDone   = Math.Abs(core - unitLock.Target.Core);

                unitLock.Target.OnCombatEvent(ParentRobot, new EnergyDispersionEventArgs(coreNeutralizedDone));
                unitLock.Target.AddThreat(ParentRobot, new Threat(ThreatType.Undefined, coreNeutralizedDone / 2));
            }

            var packet = new CombatLogPacket(CombatLogType.EnergyNeutralize, unitLock.Target, ParentRobot, this);

            packet.AppendDouble(coreNeutralized);
            packet.AppendDouble(coreNeutralizedDone);
            packet.Send(unitLock.Target, ParentRobot);
        }
コード例 #2
0
        protected void OnRepair(Unit target, double amount)
        {
            if (amount <= 0.0)
            {
                return;
            }

            var armor = target.Armor;

            target.Armor += amount;
            var total = Math.Abs(armor - target.Armor);

            var packet = new CombatLogPacket(CombatLogType.ArmorRepair, target, ParentRobot, this);

            packet.AppendDouble(amount);
            packet.AppendDouble(total);
            packet.Send(target, ParentRobot);
        }
コード例 #3
0
        protected override void OnAction()
        {
            var unitLock = GetLock().ThrowIfNotType <UnitLock>(ErrorCodes.InvalidLockType);

            if (!LOSCheckAndCreateBeam(unitLock.Target))
            {
                OnError(ErrorCodes.LOSFailed);
                return;
            }

            // ennyit szedunk le a targettol
            var coreAmount = _energyVampiredAmount.Value;

            ModifyValueByReactorRadiation(unitLock.Target, ref coreAmount);
            // optimalrange-el modositjuk
            coreAmount = ModifyValueByOptimalRange(unitLock.Target, coreAmount);

            var coreNeutralized = 0.0;
            var coreTransfered  = 0.0;

            if (coreAmount > 0.0)
            {
                var targetCore = unitLock.Target.Core;
                unitLock.Target.Core -= coreAmount;
                coreNeutralized       = Math.Abs(targetCore - unitLock.Target.Core);

                unitLock.Target.OnCombatEvent(ParentRobot, new EnergyDispersionEventArgs(coreNeutralized));

                // amit sikerult leszedni azt hozzaadjuk a robothoz
                var core = ParentRobot.Core;
                ParentRobot.Core += coreNeutralized;
                coreTransfered    = Math.Abs(core - ParentRobot.Core);

                unitLock.Target.AddThreat(ParentRobot, new Threat(ThreatType.Undefined, coreTransfered));
            }

            var packet = new CombatLogPacket(CombatLogType.EnergyVampire, unitLock.Target, ParentRobot, this);

            packet.AppendDouble(coreAmount);
            packet.AppendDouble(coreNeutralized);
            packet.AppendDouble(coreTransfered);
            packet.Send(unitLock.Target, ParentRobot);
        }
コード例 #4
0
        protected override void OnAction()
        {
            var unitLock = GetLock().ThrowIfNotType <UnitLock>(ErrorCodes.InvalidLockType);

            (ParentIsPlayer() && unitLock.Target is Npc).ThrowIfTrue(ErrorCodes.ThisModuleIsNotSupportedOnNPCs);

            if (!LOSCheckAndCreateBeam(unitLock.Target))
            {
                OnError(ErrorCodes.LOSFailed);
                return;
            }

            var coreAmount = _energyTransferAmount.Value;

            coreAmount = ModifyValueByOptimalRange(unitLock.Target, coreAmount);

            var coreNeutralized = 0.0;
            var coreTransfered  = 0.0;

            if (coreAmount > 0.0)
            {
                var core = ParentRobot.Core;
                ParentRobot.Core -= coreAmount;
                coreNeutralized   = Math.Abs(core - ParentRobot.Core);

                var targetCore = unitLock.Target.Core;
                unitLock.Target.Core += coreNeutralized;
                coreTransfered        = Math.Abs(targetCore - unitLock.Target.Core);

                unitLock.Target.SpreadAssistThreatToNpcs(ParentRobot, new Threat(ThreatType.Support, coreAmount * 2));
            }

            var packet = new CombatLogPacket(CombatLogType.EnergyTransfer, unitLock.Target, ParentRobot, this);

            packet.AppendDouble(coreAmount);
            packet.AppendDouble(coreNeutralized);
            packet.AppendDouble(coreTransfered);
            packet.Send(unitLock.Target, ParentRobot);
        }
コード例 #5
0
        protected override void OnAction()
        {
            var ammo = GetAmmo();

            if (ammo == null)
            {
                return;
            }

            var coreAdded = ammo.GetPropertyModifier(AggregateField.core_added);

            var core = ParentRobot.Core;

            ParentRobot.Core += coreAdded.Value;
            var coreBoosted = Math.Abs(core - ParentRobot.Core);

            var packet = new CombatLogPacket(CombatLogType.CoreBooster, ParentRobot);

            packet.AppendDouble(coreAdded.Value);
            packet.AppendDouble(coreBoosted);
            packet.Send(ParentRobot);

            ConsumeAmmo();
        }