コード例 #1
0
 private static void AttemptFireBreath(BaseCreature creature, Mobile target)
 {
     if (!creature.InLOS(target))
     {
         creature.SendMessage("Target cannot be seen.");
         return;
     }
     if (!target.InRange(creature, creature.BreathRange))
     {
         creature.SendMessage("That is too far away.");
         return;
     }
     if (target != null && target.Alive && !target.IsDeadBondedPet && creature.CanBeHarmful(target) &&
         target.Map == creature.Map && !creature.IsDeadBondedPet &&
         !creature.BardPacified)
     {
         creature.BreathStart(target);
         creature.SetNextBreathTime();
     }
     else
     {
         creature.SendMessage("You can't breathe fire on that!");
     }
 }
コード例 #2
0
        public void SummonSkullSpikes(BaseCreature creature)
        {
            if (creature == null)
            {
                return;
            }
            if (creature.Deleted || !creature.Alive)
            {
                return;
            }

            Point3D location = creature.Location;
            Map     map      = creature.Map;

            m_SummoningSkullSpikes = true;

            double spawnPercent = (double)intervalCount / (double)totalIntervals;

            int stationaryDuration = 4 - (int)(Math.Ceiling(3 * spawnPercent));

            creature.Frozen   = true;
            creature.CantWalk = true;

            creature.AIObject.NextMove              = creature.AIObject.NextMove + TimeSpan.FromSeconds(stationaryDuration);
            creature.LastSwingTime                  = creature.LastSwingTime + TimeSpan.FromSeconds(stationaryDuration);
            creature.NextSpellTime                  = creature.NextSpellTime + TimeSpan.FromSeconds(stationaryDuration);
            creature.NextCombatHealActionAllowed    = creature.NextCombatHealActionAllowed + TimeSpan.FromSeconds(stationaryDuration);
            creature.NextCombatSpecialActionAllowed = creature.NextCombatSpecialActionAllowed + TimeSpan.FromSeconds(stationaryDuration);
            creature.NextCombatEpicActionAllowed    = creature.NextCombatEpicActionAllowed + TimeSpan.FromSeconds(stationaryDuration);

            List <Point3D> m_Locations = new List <Point3D>();

            IPooledEnumerable mobilesInArea = Map.GetMobilesInRange(creature.Location, 15);

            foreach (Mobile mobile in mobilesInArea)
            {
                if (mobile == null)
                {
                    continue;
                }
                if (mobile == creature)
                {
                    continue;
                }
                if (mobile.Map != map)
                {
                    continue;
                }
                if (!mobile.Alive)
                {
                    continue;
                }
                if (!mobile.CanBeDamaged())
                {
                    continue;
                }
                if (mobile.AccessLevel > AccessLevel.Player)
                {
                    continue;
                }
                if (mobile.Hidden)
                {
                    continue;
                }

                bool validTarget = false;

                PlayerMobile pm_Target = mobile as PlayerMobile;
                BaseCreature bc_Target = mobile as BaseCreature;

                if (pm_Target != null)
                {
                    validTarget = true;
                }

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

                if (!creature.InLOS(mobile))
                {
                    validTarget = false;
                }

                if (validTarget)
                {
                    if (!m_Locations.Contains(mobile.Location))
                    {
                        m_Locations.Add(mobile.Location);
                    }
                }
            }

            mobilesInArea.Free();

            foreach (Point3D point in m_Locations)
            {
                int bonePileCount = 3;

                for (int a = 0; a < bonePileCount; a++)
                {
                    TimedStatic bonePile = new TimedStatic(Utility.RandomList(6922, 6923, 6924, 6925, 6926, 6927, 6928, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794), stationaryDuration);

                    bonePile.Name = "bones";
                    bonePile.MoveToWorld(point, Map);
                }
            }

            Effects.PlaySound(location, map, 0x222);

            for (int a = 0; a < stationaryDuration; a++)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(a * 1), delegate
                {
                    if (creature == null)
                    {
                        return;
                    }
                    if (creature.Deleted || !creature.Alive)
                    {
                        return;
                    }

                    creature.Frozen   = true;
                    creature.CantWalk = true;

                    creature.PlaySound(GetIdleSound());
                    Animate(18, 5, 1, true, false, 0);
                });
            }

            Timer.DelayCall(TimeSpan.FromSeconds(stationaryDuration), delegate
            {
                if (creature == null)
                {
                    return;
                }
                if (creature.Deleted)
                {
                    return;
                }
                if (!creature.Alive)
                {
                    return;
                }

                foreach (Point3D point in m_Locations)
                {
                    Effects.SendLocationParticles(EffectItem.Create(point, map, TimeSpan.FromSeconds(0.25)), 8700, 10, 30, 0, 0, 5029, 0);

                    IPooledEnumerable spikePoint = map.GetMobilesInRange(point, 1);

                    bool hitMobile = false;

                    List <Mobile> m_MobilesHit = new List <Mobile>();

                    foreach (Mobile mobile in spikePoint)
                    {
                        if (mobile == creature)
                        {
                            continue;
                        }
                        if (mobile.Location != point)
                        {
                            continue;
                        }
                        if (mobile.Map != map)
                        {
                            continue;
                        }
                        if (!mobile.Alive)
                        {
                            continue;
                        }
                        if (!mobile.CanBeDamaged())
                        {
                            continue;
                        }
                        if (mobile.AccessLevel > AccessLevel.Player)
                        {
                            continue;
                        }

                        bool validTarget = false;

                        PlayerMobile pm_Target = mobile as PlayerMobile;
                        BaseCreature bc_Target = mobile as BaseCreature;

                        if (pm_Target != null)
                        {
                            validTarget = true;
                        }

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

                        if (!validTarget)
                        {
                            continue;
                        }

                        m_MobilesHit.Add(mobile);
                    }

                    spikePoint.Free();

                    foreach (Mobile mobile in m_MobilesHit)
                    {
                        int damage = DamageMin;

                        if (mobile is BaseCreature)
                        {
                            damage = (int)((double)damage * 2);
                        }

                        SpecialAbilities.PierceSpecialAbility(1.0, this, mobile, 50, 30, -1, true, "", "Bone shards pierce your armor, reducing it's effectiveness!", "-1");

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

                    Effects.PlaySound(point, map, 0x11D);

                    for (int a = 0; a < 5; a++)
                    {
                        Blood dirt           = new Blood();
                        dirt.Name            = "bones";
                        dirt.ItemID          = Utility.RandomList(6929, 6930, 6937, 6938, 6933, 6934, 6935, 6936, 6939, 6940, 6880, 6881, 6882, 6883);
                        Point3D dirtLocation = new Point3D(point.X + Utility.RandomList(-1, 1), point.Y + Utility.RandomList(-1, 1), point.Z);
                        dirt.MoveToWorld(dirtLocation, Map);
                    }

                    int projectiles              = 10;
                    int particleSpeed            = 8;
                    double distanceDelayInterval = .12;

                    int minRadius = 1;
                    int maxRadius = 5;

                    List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(point, true, false, point, map, projectiles, 20, minRadius, maxRadius, false);

                    if (m_ValidLocations.Count == 0)
                    {
                        return;
                    }

                    for (int a = 0; a < projectiles; a++)
                    {
                        Point3D newLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)];

                        IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(point.X, point.Y, point.Z + 2), map);
                        IEntity effectEndLocation   = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 50), map);

                        newLocation.Z += 5;

                        Effects.SendMovingEffect(effectStartLocation, effectEndLocation, Utility.RandomList(6929, 6930, 6937, 6938, 6933, 6934, 6935, 6936, 6939, 6940, 6880, 6881, 6882, 6883), particleSpeed, 0, false, false, 0, 0);
                    }

                    IEntity locationEntity = new Entity(Serial.Zero, new Point3D(point.X, point.Y, point.Z - 1), map);
                    Effects.SendLocationParticles(locationEntity, Utility.RandomList(0x36BD, 0x36BF, 0x36CB, 0x36BC), 30, 7, 2497, 0, 5044, 0);
                }

                m_NextSkullSpikesAllowed = DateTime.UtcNow + NextSkullSpikesDelay;
                m_SummoningSkullSpikes   = false;

                creature.Frozen   = false;
                creature.CantWalk = false;
            });
        }
コード例 #3
0
        public void ThrowSkull(BaseCreature creature)
        {
            if (creature == null)
            {
                return;
            }
            if (creature.Deleted || !creature.Alive)
            {
                return;
            }

            if (creature.Combatant != null)
            {
                Mobile  combatant = creature.Combatant;
                Point3D location  = creature.Location;
                Map     map       = creature.Map;

                if (combatant.Alive && creature.InLOS(combatant) && creature.GetDistanceToSqrt(combatant) <= 12)
                {
                    Animate(4, 4, 1, true, false, 0);

                    double stationaryDuration = 3;

                    creature.CantWalk = true;
                    creature.Frozen   = true;

                    creature.AIObject.NextMove              = creature.AIObject.NextMove + TimeSpan.FromSeconds(stationaryDuration);
                    creature.LastSwingTime                  = creature.LastSwingTime + TimeSpan.FromSeconds(stationaryDuration);
                    creature.NextSpellTime                  = creature.NextSpellTime + TimeSpan.FromSeconds(stationaryDuration);
                    creature.NextCombatHealActionAllowed    = creature.NextCombatHealActionAllowed + TimeSpan.FromSeconds(stationaryDuration);
                    creature.NextCombatSpecialActionAllowed = creature.NextCombatSpecialActionAllowed + TimeSpan.FromSeconds(stationaryDuration);
                    creature.NextCombatEpicActionAllowed    = creature.NextCombatEpicActionAllowed + TimeSpan.FromSeconds(stationaryDuration);

                    IEntity startLocation = new Entity(Serial.Zero, new Point3D(creature.Location.X, creature.Location.Y, creature.Location.Z + 8), map);

                    int attackSound = 0x5D3;
                    int hitSound    = 0x653;

                    Effects.PlaySound(location, map, attackSound);
                    creature.MovingEffect(combatant, 8707, 8, 1, false, false, 2612, 0);

                    double distance         = Utility.GetDistanceToSqrt(creature.Location, combatant.Location);
                    double destinationDelay = (double)distance * .08;

                    Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                    {
                        if (creature == null)
                        {
                            return;
                        }
                        if (creature.Deleted || !creature.Alive)
                        {
                            return;
                        }

                        creature.CantWalk = false;
                        creature.Frozen   = false;

                        m_NextThrownSkullAllowed = DateTime.UtcNow + NextThrownSkullDelay;

                        if (!SpecialAbilities.IsDamagable(combatant))
                        {
                            return;
                        }

                        Effects.PlaySound(combatant.Location, combatant.Map, hitSound);

                        Effects.SendLocationParticles(EffectItem.Create(combatant.Location, map, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 20, 2613, 0, 5029, 0);
                        Effects.SendLocationParticles(EffectItem.Create(combatant.Location, map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 60, 2613, 0, 5029, 0);
                        Effects.SendLocationParticles(EffectItem.Create(combatant.Location, map, TimeSpan.FromSeconds(0.5)), 0x3996, 10, 60, 2613, 0, 5029, 0);

                        BaseCreature monsterToSpawn = null;

                        double spawnPercent = (double)intervalCount / (double)totalIntervals;

                        int creatureCount = 1 + (int)(Math.Ceiling(3 * spawnPercent));

                        for (int a = 0; a < creatureCount; a++)
                        {
                            switch (Utility.RandomMinMax(1, 10))
                            {
                            case 1: monsterToSpawn = new Skeleton(); break;

                            case 2: monsterToSpawn = new Skeleton(); break;

                            case 3: monsterToSpawn = new Skeleton(); break;

                            case 4: monsterToSpawn = new PatchworkSkeleton(); break;

                            case 5: monsterToSpawn = new PatchworkSkeleton(); break;

                            case 6: monsterToSpawn = new SkeletalKnight(); break;

                            case 7: monsterToSpawn = new UndeadKnight(); break;

                            case 8: monsterToSpawn = new RisenKnight(); break;

                            case 9: monsterToSpawn = new RisenNoble(); break;

                            case 10: monsterToSpawn = new SkeletalDrake(); break;
                            }

                            if (monsterToSpawn != null)
                            {
                                monsterToSpawn.BossMinion = true;
                                monsterToSpawn.MoveToWorld(combatant.Location, combatant.Map);
                                monsterToSpawn.BossMinion = true;

                                m_Creatures.Add(monsterToSpawn);
                            }
                        }

                        for (int a = 0; a < 5; a++)
                        {
                            Blood bones           = new Blood();
                            bones.Name            = "bones";
                            bones.ItemID          = Utility.RandomList(6929, 6930, 6937, 6938, 6933, 6934, 6935, 6936, 6939, 6940, 6880, 6881, 6882, 6883);
                            Point3D bonesLocation = new Point3D(combatant.Location.X + Utility.RandomList(-1, 1), combatant.Location.Y + Utility.RandomList(-1, 1), combatant.Location.Z);
                            bones.MoveToWorld(bonesLocation, map);
                        }

                        int damage = creature.DamageMin;

                        if (combatant is BaseCreature)
                        {
                            damage = (int)((double)damage * 1.5);
                        }

                        new Blood().MoveToWorld(combatant.Location, combatant.Map);
                        AOS.Damage(combatant, creature, damage, 0, 100, 0, 0, 0);
                    });
                }
            }
        }
コード例 #4
0
 public virtual bool Validate(BaseCreature attacker, Mobile defender)
 {
     return(defender != null && defender.Alive && !defender.Deleted && !defender.IsDeadBondedPet &&
            attacker.Alive && !attacker.IsDeadBondedPet && defender.InRange(attacker.Location, MaxRange) &&
            defender.Map == attacker.Map && attacker.InLOS(defender) && !attacker.BardPacified);
 }
コード例 #5
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);
        }
コード例 #6
0
        public static bool CanDoCauseWounds(BaseCreature creature)
        {
            if (creature.Combatant == null)
            {
                return(false);
            }

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

            return(true);
        }
コード例 #7
0
        public static bool IsTargetValidHealTarget(BaseCreature creature, Mobile target, bool healOther)
        {
            //Ignore If Deleted or Blessed
            if (target.Deleted || target.Blessed)
            {
                return(false);
            }

            //Ignore If Dead
            if (!target.Alive || target.IsDeadBondedFollower)
            {
                return(false);
            }

            //Ignore ServerStaff
            if (target.AccessLevel > AccessLevel.Player)
            {
                return(false);
            }

            //Target Self (Always Allowed)
            if (healOther && creature == target)
            {
                return(false);
            }

            //Ignore If Target out of Immediate Area
            if (!creature.CanSee(target))
            {
                return(false);
            }

            //Ignore If Target out of LOS
            if (!creature.InLOS(target))
            {
                return(false);
            }

            //Controlled Creatures
            BaseCreature bc_Target = target as BaseCreature;

            if (bc_Target != null)
            {
                if (bc_Target.Controlled && bc_Target.ControlMaster != null)
                {
                    //Controller of Target is This Creature
                    if (bc_Target.ControlMaster == creature)
                    {
                        return(true);
                    }

                    //Controller of Target is Teammate
                    //if (AITeamList.CheckTeam(creature, bc_Target.ControlMaster))
                    //return true;
                }
            }

            //if (!AITeamList.CheckTeam(creature, target))
            //return false;

            return(true);
        }
コード例 #8
0
        public static void DoBomber(BaseCreature mobile, Mobile player)
        {
            Mobile combatant = player;

            if (combatant == null || combatant.Deleted || combatant.Map != mobile.Map || !mobile.InRange(combatant, 12) || !mobile.CanBeHarmful(combatant) || !mobile.InLOS(combatant))
            {
                return;
            }

            if (DateTime.Now >= m_NextBomb)
            {
                ThrowBomb(combatant, player);

                m_Thrown++;

                if (0.75 >= Utility.RandomDouble() && (m_Thrown % 2) == 1)
                {
                    m_NextBomb = DateTime.Now + TimeSpan.FromSeconds(3.0);
                }
                else
                {
                    m_NextBomb = DateTime.Now + TimeSpan.FromSeconds(5.0 + (10.0 * Utility.RandomDouble()));
                }
            }
        }
コード例 #9
0
ファイル: AIMiscAction.cs プロジェクト: Pumpk1ns/outlands
        public static void DoDetectHidden(BaseCreature creature)
        {
            if (creature.Deleted || creature.Map == null)
            {
                return;
            }

            creature.Emote("*searches*");

            double skillValue = creature.Skills.DetectHidden.Base;

            double minRange = skillValue / 20;
            double maxRange = skillValue / 10;

            int range = (int)(minRange + ((maxRange - minRange) * Utility.RandomDouble()));

            if (range > 0)
            {
                IPooledEnumerable inRange = creature.Map.GetMobilesInRange(creature.Location, range);

                foreach (Mobile mobile in inRange)
                {
                    if (!mobile.Hidden || !mobile.Alive)
                    {
                        continue;
                    }
                    if (mobile.AccessLevel > AccessLevel.Player)
                    {
                        continue;
                    }
                    if (!creature.InLOS(mobile))
                    {
                        continue;
                    }

                    PlayerMobile player      = mobile as PlayerMobile;
                    BaseCreature bc_Creature = mobile as BaseCreature;

                    bool isPlayer        = (player != null);
                    bool isTamedCreature = false;

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

                    if (!(isPlayer || isTamedCreature))
                    {
                        continue;
                    }

                    double revealChance = (skillValue / 100);

                    if (Utility.RandomDouble() < revealChance)
                    {
                        mobile.RevealingAction();
                        mobile.SendMessage("You have been revealed!");
                    }
                }

                inRange.Free();
            }
        }