예제 #1
0
        public override void OnThink()
        {
            base.OnThink();

            if (Combatant != null && DateTime.UtcNow >= m_NextAbilityAllowed && !Frozen)
            {
                if (DateTime.UtcNow >= m_NextMassiveBreathAllowed && AICombatEpicAction.CanDoMassiveFireBreathAttack(this))
                {
                    double totalDelay = 3;

                    SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1");

                    Effects.PlaySound(Location, Map, GetAngerSound());

                    Direction direction = Utility.GetDirection(Location, Combatant.Location);

                    SpecialAbilities.DoMassiveBreathAttack(this, Location, direction, MassiveBreathRange, true, BreathType.Fire, true);

                    m_NextMassiveBreathAllowed = DateTime.UtcNow + NextMassiveBreathDelay + TimeSpan.FromSeconds(totalDelay);
                    m_NextAbilityAllowed       = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay);

                    LastSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(totalDelay + 2);
                    NextSpellTime = DateTime.UtcNow + TimeSpan.FromSeconds(totalDelay + 2);

                    return;
                }

                if (DateTime.UtcNow >= m_NextBreathAllowed && AICombatSpecialAction.CanDoFireBreathAttack(this))
                {
                    AICombatSpecialAction.DoFireBreathAttack(this, Combatant);

                    m_NextBreathAllowed  = DateTime.UtcNow + NextBreathDelay;
                    m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay;

                    LastSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(4);
                    NextSpellTime = DateTime.UtcNow + TimeSpan.FromSeconds(4);

                    return;
                }
            }
        }
예제 #2
0
        public static bool DoCombatEpicAction(BaseCreature creature)
        {
            CombatEpicAction combatEpicAction = CombatEpicAction.None;

            int TotalValues = 0;

            Dictionary <CombatEpicAction, int> DictTemp = new Dictionary <CombatEpicAction, int>();

            DictTemp.Add(CombatEpicAction.None, creature.DictCombatEpicAction[CombatEpicAction.None]);

            if (AICombatEpicAction.CanDoMeleeBleedAoe(creature))
            {
                DictTemp.Add(CombatEpicAction.MeleeBleedAoE, creature.DictCombatEpicAction[CombatEpicAction.MeleeBleedAoE]);
            }
            if (AICombatEpicAction.CanDoMassiveFireBreathAttack(creature))
            {
                DictTemp.Add(CombatEpicAction.MassiveFireBreathAttack, creature.DictCombatEpicAction[CombatEpicAction.MassiveFireBreathAttack]);
            }
            if (AICombatEpicAction.CanDoMassiveIceBreathAttack(creature))
            {
                DictTemp.Add(CombatEpicAction.MassiveIceBreathAttack, creature.DictCombatEpicAction[CombatEpicAction.MassiveIceBreathAttack]);
            }
            if (AICombatEpicAction.CanDoMassivePoisonBreathAttack(creature))
            {
                DictTemp.Add(CombatEpicAction.MassivePoisonBreathAttack, creature.DictCombatEpicAction[CombatEpicAction.MassivePoisonBreathAttack]);
            }
            if (AICombatEpicAction.CanDoMassiveBoneBreathAttack(creature))
            {
                DictTemp.Add(CombatEpicAction.MassiveBoneBreathAttack, creature.DictCombatEpicAction[CombatEpicAction.MassiveBoneBreathAttack]);
            }
            if (AICombatEpicAction.CanDoMassivePlantBreathAttack(creature))
            {
                DictTemp.Add(CombatEpicAction.MassivePlantBreathAttack, creature.DictCombatEpicAction[CombatEpicAction.MassivePlantBreathAttack]);
            }

            //Calculate Total Values
            foreach (KeyValuePair <CombatEpicAction, int> pair in DictTemp)
            {
                TotalValues += pair.Value;
            }

            double ActionCheck      = Utility.RandomDouble();
            double CumulativeAmount = 0.0;
            double AdditionalAmount = 0.0;

            //Determine CombatEpicAction
            foreach (KeyValuePair <CombatEpicAction, int> pair in creature.DictCombatEpicAction)
            {
                AdditionalAmount = (double)pair.Value / (double)TotalValues;

                if (ActionCheck >= CumulativeAmount && ActionCheck < (CumulativeAmount + AdditionalAmount))
                {
                    combatEpicAction = pair.Key;

                    switch (combatEpicAction)
                    {
                    case CombatEpicAction.MeleeBleedAoE: AICombatEpicAction.DoMeleeBleedAoE(creature); break;

                    case CombatEpicAction.MassiveFireBreathAttack: AICombatEpicAction.DoMassiveFireBreathAttack(creature); break;

                    case CombatEpicAction.MassiveIceBreathAttack: AICombatEpicAction.DoMassiveIceBreathAttack(creature); break;

                    case CombatEpicAction.MassivePoisonBreathAttack: AICombatEpicAction.DoMassivePoisonBreathAttack(creature); break;

                    case CombatEpicAction.MassiveBoneBreathAttack: AICombatEpicAction.DoMassiveBoneBreathAttack(creature); break;

                    case CombatEpicAction.MassivePlantBreathAttack: AICombatEpicAction.DoMassivePlantBreathAttack(creature); break;
                    }

                    creature.NextCombatSpecialActionAllowed = creature.NextCombatSpecialActionAllowed.AddSeconds(5);
                    creature.NextCombatEpicActionAllowed    = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(creature.CombatEpicActionMinDelay, creature.CombatEpicActionMaxDelay));

                    if (creature.AcquireNewTargetEveryCombatAction)
                    {
                        creature.m_NextAcquireTargetAllowed = DateTime.UtcNow;
                    }

                    return(true);
                }

                CumulativeAmount += AdditionalAmount;
            }

            return(false);
        }