Пример #1
0
        public static bool CanDoPoisonBreathAttack(BaseCreature creature)
        {
            if (creature.Combatant == null)
            {
                return(false);
            }

            if (creature.Frozen || creature.IsHindered() || !creature.Alive)
            {
                return(false);
            }

            if (creature.GetDistanceToSqrt(creature.Combatant) > creature.RangePerception || !creature.InLOS(creature.Combatant))
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        //-------------

        public static bool CanDoMeleeBleedAoe(BaseCreature creature)
        {
            if (creature.Combatant == null)
            {
                return(false);
            }

            if (creature.GetDistanceToSqrt(creature.Combatant) >= 2)
            {
                return(false);
            }

            if (creature.Paralyzed || creature.Frozen || creature.IsHindered() || !creature.Alive)
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
        public static bool CanDoMassivePlantBreathAttack(BaseCreature creature)
        {
            if (creature == null)
            {
                return(false);
            }

            if (creature.Combatant == null)
            {
                return(false);
            }

            if (creature.Frozen || creature.IsHindered() || !creature.Alive)
            {
                return(false);
            }

            if (Utility.GetDistance(creature.Location, creature.Combatant.Location) > creature.MassiveBreathRange)
            {
                return(false);
            }

            return(true);
        }
Пример #4
0
        public static bool DoMeleeBleedAoE(BaseCreature creature)
        {
            if (creature == null)
            {
                return(false);
            }

            double swingCount    = 12;
            double swingInterval = .3;
            double preSwingDelay = .1;

            double hitChance = .25;

            double actionsCooldown = (swingCount * swingInterval) + (swingCount * preSwingDelay) + 1;

            if (creature.AIObject != null)
            {
                creature.AIObject.NextMove              = DateTime.UtcNow + TimeSpan.FromSeconds(actionsCooldown);
                creature.LastSwingTime                  = creature.LastSwingTime + TimeSpan.FromSeconds(actionsCooldown);
                creature.NextSpellTime                  = creature.NextSpellTime + TimeSpan.FromSeconds(actionsCooldown);
                creature.NextCombatHealActionAllowed    = creature.NextCombatHealActionAllowed + TimeSpan.FromSeconds(actionsCooldown);
                creature.NextCombatSpecialActionAllowed = creature.NextCombatSpecialActionAllowed + TimeSpan.FromSeconds(actionsCooldown);
                creature.NextCombatEpicActionAllowed    = creature.NextCombatEpicActionAllowed + TimeSpan.FromSeconds(actionsCooldown);
            }

            for (int a = 0; a < swingCount; a++)
            {
                double delay = (a * swingInterval) + (a * preSwingDelay);

                Timer.DelayCall(TimeSpan.FromSeconds(delay), delegate
                {
                    if (creature == null)
                    {
                        return;
                    }

                    if (!creature.Alive || creature.Paralyzed || creature.Frozen || creature.IsHindered())
                    {
                        return;
                    }

                    Effects.PlaySound(creature.Location, creature.Map, 0x51F);

                    int newDirectionValue = (int)creature.Direction;
                    newDirectionValue    += Utility.RandomList(-3, -4, -5, 3, 4, 5);

                    if (newDirectionValue > 7)
                    {
                        newDirectionValue = 0 + (newDirectionValue - 8);
                    }
                    else if (newDirectionValue < 0)
                    {
                        newDirectionValue = 8 + newDirectionValue;
                    }

                    creature.Direction = (Direction)(newDirectionValue);

                    Timer.DelayCall(TimeSpan.FromSeconds(preSwingDelay), delegate
                    {
                        if (creature == null)
                        {
                            return;
                        }

                        if (!creature.Alive || creature.Paralyzed || creature.Frozen || creature.IsHindered())
                        {
                            return;
                        }

                        BaseWeapon weapon = creature.Weapon as BaseWeapon;

                        if (weapon != null)
                        {
                            weapon.PlaySwingAnimation(creature);

                            IPooledEnumerable eable = creature.Map.GetObjectsInRange(creature.Location, 1);

                            foreach (object obj in eable)
                            {
                                if (obj is Mobile)
                                {
                                    Mobile mobile = obj as Mobile;

                                    if (creature == null || mobile == null)
                                    {
                                        continue;
                                    }

                                    if (!creature.Alive || !mobile.Alive)
                                    {
                                        continue;
                                    }

                                    if (creature == mobile)
                                    {
                                        continue;
                                    }

                                    if (creature.CanBeHarmful(mobile))
                                    {
                                        BaseCreature bc_CreatureTarget = mobile as BaseCreature;

                                        bool validCreatureTarget = false;

                                        if (bc_CreatureTarget != null)
                                        {
                                            if (bc_CreatureTarget.Controlled && bc_CreatureTarget.ControlMaster is PlayerMobile)
                                            {
                                                validCreatureTarget = true;
                                            }
                                        }

                                        //Valid Targets
                                        if (mobile == creature.Combatant || mobile is PlayerMobile || validCreatureTarget)
                                        {
                                            if (a == 0 || Utility.RandomDouble() < hitChance)
                                            {
                                                int damage = Utility.RandomMinMax(creature.DamageMin, creature.DamageMax);

                                                if (damage < 1)
                                                {
                                                    damage = 1;
                                                }

                                                creature.DoHarmful(mobile);

                                                BaseCreature bc_Mobile = mobile as BaseCreature;
                                                PlayerMobile pm_Mobile = mobile as PlayerMobile;

                                                double bleedValue = bc_Mobile.GetSpecialAbilityEntryValue(SpecialAbilityEffect.Bleed);

                                                if (bleedValue == 0)
                                                {
                                                    SpecialAbilities.BleedSpecialAbility(1.0, creature, mobile, creature.DamageMax, 8.0, -1, true, "", "Their attack causes you to bleed!", "-1");
                                                }

                                                AOS.Damage(mobile, creature, damage, 100, 0, 0, 0, 0);
                                                new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                            }
                                        }
                                    }
                                }
                            }

                            eable.Free();
                        }
                    });
                });
            }

            return(true);
        }