Summon() public static method

public static Summon ( BaseCreature creature, Mobile caster, Point3D p, int sound, TimeSpan duration ) : bool
creature BaseCreature
caster Mobile
p Point3D
sound int
duration TimeSpan
return bool
Beispiel #1
0
        public void DoGaze()
        {
            Mobile target = FindRandomMedusaTarget();
            Map    map    = Map;

            if (map == null || target == null)
            {
                return;
            }

            if ((target is BaseCreature && ((BaseCreature)target).SummonMaster != this) || CanBeHarmful(target))
            {
                if (CheckBlockGaze(target))
                {
                    if (GorgonLense.TotalCharges(target) == 0)
                    {
                        target.SendLocalizedMessage(1112600); // Your lenses crumble. You are no longer protected from Medusa's gaze!
                    }
                    else
                    {
                        target.SendLocalizedMessage(1112599); //Your Gorgon Lens deflect Medusa's petrifying gaze!
                    }
                }
                else
                {
                    BaseCreature clone = new MedusaClone(target);

                    bool    validLocation = false;
                    Point3D loc           = Location;

                    for (int j = 0; !validLocation && j < 10; ++j)
                    {
                        int x = X + Utility.Random(10) - 1;
                        int y = Y + Utility.Random(10) - 1;
                        int z = map.GetAverageZ(x, y);

                        if (validLocation = map.CanFit(x, y, Z, 16, false, false))
                        {
                            loc = new Point3D(x, y, Z);
                        }
                        else if (validLocation = map.CanFit(x, y, z, 16, false, false))
                        {
                            loc = new Point3D(x, y, z);
                        }
                    }

                    Effects.SendLocationEffect(loc, target.Map, 0x37B9, 10, 5);
                    clone.Frozen           = clone.Blessed = true;
                    clone.SolidHueOverride = 761;

                    target.Frozen           = target.Blessed = true;
                    target.SolidHueOverride = 761;

                    //clone.MoveToWorld(loc, target.Map);
                    BaseCreature.Summon(clone, false, this, loc, 0, TimeSpan.FromMinutes(90));

                    if (target is BaseCreature && !((BaseCreature)target).Summoned && ((BaseCreature)target).GetMaster() != null)
                    {
                        ((BaseCreature)target).GetMaster().SendLocalizedMessage(1113281, null, 43); // Your pet has been petrified!
                    }
                    else
                    {
                        target.SendLocalizedMessage(1112768); // You have been turned to stone!!!
                    }
                    new GazeTimer(target, clone, this, Utility.RandomMinMax(5, 10)).Start();
                    m_GazeDelay = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 75));

                    m_Helpers.Add(clone);
                    m_TurnedToStone.Add(target);

                    BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.MedusaStone, 1153790, 1153825));
                    return;
                }
            }

            m_GazeDelay = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(25, 65));
        }
        public virtual int SummonMinions(Mobile victim)
        {
            int minions = 0;

            if (Map == null || Map == Map.Internal || Map != victim.Map || SummoningType == null)
            {
                return(minions);
            }

            if (m_NextSummonTime >= DateTime.Now && Utility.RandomDouble() > SummoningLowChance)
            {
                return(minions);
            }

            #region Cantidad de Summons
            int min = SummoningMin;
            int max = SummoningMax;

            if (min > max)
            {
                int aux = min;
                max = min;
                min = max;
            }

            int amount = min;

            if (min != max)
            {
                amount = Utility.RandomMinMax(min, max);
            }

            if (amount < 1)
            {
                amount = 1;
            }
            #endregion

            for (int m = 0; m < amount; m++)
            {
                BaseCreature minion;

                try { minion = (BaseCreature)Activator.CreateInstance(SummoningType); }
                catch { continue; }

                int     offset         = Utility.Random(8) * 2;
                Point3D selectedOffset = victim.Location;

                for (int i = 0; i < m_Offsets.Length; i += 2)
                {
                    int x = X + m_Offsets[(offset + i) % m_Offsets.Length];
                    int y = Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];

                    if (Map.CanSpawnMobile(x, y, Z))
                    {
                        selectedOffset = new Point3D(x, y, Z);
                        break;
                    }
                    else
                    {
                        int z = Map.GetAverageZ(x, y);

                        if (Map.CanSpawnMobile(x, y, z))
                        {
                            selectedOffset = new Point3D(x, y, z);
                            break;
                        }
                    }
                }

                BaseCreature.Summon(minion, false, this, selectedOffset, SummoningSound, SummoningDuration);
                minion.Combatant = victim;
                minions++;
            }

            /* NOTA:
             *
             * Cada 6 minions esperamos el doble de tiempo que el pautado,
             * esto logra que no se sumonee 28 summons y se tarde lo mismo
             * que cuando se summonean 3 de ellos. Eh lo.
             */

            m_NextSummonTime = DateTime.Now + TimeSpan.FromSeconds(SummoningDelay.TotalSeconds * (0.8 + (minions * 0.2)));

            return(minions);
        }
Beispiel #3
0
        private void Flare()
        {
            Mobile caster = this.ControlMaster;

            if (caster == null)
            {
                caster = this.SummonMaster;
            }

            if (caster == null)
            {
                return;
            }
            int range         = (int)((caster.Skills.Fletching.Value + caster.Skills.Inscribe.Value + caster.Skills.ArmsLore.Value + caster.Skills.Tinkering.Value) / 100.0);
            int overseerCount = 0;
            int amount        = 0;

            if (!InRange(ControlMaster, 4))
            {
                return;
            }
            ArrayList deadList = new ArrayList();
            ArrayList list     = new ArrayList();
            Spell     spell;

            if ((Hue == 0 || Hue == 2425 || Hue == 2213) && Mana > 40 && Backpack.GetAmount(typeof(RecallRune), false) + Backpack.GetAmount(typeof(Runebook), false) > 0)
            {
                spell = new GateTravelSpell(this, null);
                if (spell != null)
                {
                    spell.Cast();
                }
                return;
            }
            if (Hue == 2419)
            {
                if (ControlOrder == OrderType.Guard)
                {
                    BaseCreature.Summon(new LesserGolem(1, 1, .2), false, this, Location, 0x212, TimeSpan.FromSeconds(120));
                }
                return;
            }

            foreach (Mobile m_patient in this.GetMobilesInRange(range))
            {
                if (m_patient.Alive || ((m_patient is BaseCreature) && ((BaseCreature)m_patient).IsDeadPet))
                {
                    if (m_patient is GolemOverseer)
                    {
                        overseerCount += 1;
                    }
                    else
                    {
                    }
                }
                else
                {
                    deadList.Add(m_patient);
                }
            }
            if (overseerCount > 8)
            {
                overseerCount = 8;
            }
            range += overseerCount;

            foreach (Mobile m_patient in this.GetMobilesInRange(range))
            {
                if (m_patient.Alive && (!(m_patient is BaseCreature) || !((BaseCreature)m_patient).IsDeadPet))
                {
                    list.Add(m_patient);
                }
            }

            amount = (int)((caster.Skills.Inscribe.Value * caster.Skills.Tinkering.Value / 1000.0) * Utility.RandomDouble());

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m        = (Mobile)list[i];
                bool   friendly = true;

                for (int j = 0; friendly && j < caster.Aggressors.Count; ++j)
                {
                    friendly = (caster.Aggressors[j].Attacker != m);
                }

                for (int j = 0; friendly && j < caster.Aggressed.Count; ++j)
                {
                    friendly = (caster.Aggressed[j].Defender != m);
                }

                if (friendly)
                {
                    if (Hue == 2413 || Hue == 2425)  //Copper || Agapite
                    {
                        m.Mana += (amount);
                        m.Hits += (amount / 4);
                        m.Stam += (amount / 2);
                        if (Hue == 2425)
                        {
                            if (m.MeleeDamageAbsorb <= amount * 2)
                            {
                                m.MeleeDamageAbsorb = amount * 2;
                            }
                        }
                    }
                    else if (Hue == 2406 || Hue == 2219)   //Shadow || Valorite
                    {
                        if (m.MagicDamageAbsorb <= amount * 2)
                        {
                            m.MagicDamageAbsorb = amount * 2;
                        }
                        if (Hue == 2406)
                        {
                            ShadowBonus(m, amount);
                            if (ControlMaster.Hidden)
                            {
                                Hidden = true;
                                AllowedStealthSteps = ControlMaster.AllowedStealthSteps;
                            }
                        }
                    }
                }
                if ((m != caster) && m != this && (SpellHelper.ValidIndirectTarget(this, (Mobile)m) && CanBeHarmful((Mobile)m, false)))
                {
                    if (ControlOrder == OrderType.Guard)
                    {
                        if (Hue == 2413 || Hue == 2425)  //Copper or Agapite
                        {
                            DoHarmful(m);
                            m.Mana -= (amount / 2);
                            m.Hits -= (amount / 4);
                            m.Stam -= (amount / 2);
                            Mana   += (amount / 2);
                            if (InRange(caster, range))
                            {
                                caster.Mana += (amount / 2);
                            }
                        }
                        else if (Hue == 2207)   //Verite
                        {
                            DoHarmful(m);
                            EatArmor(m);
                        }
                        else if (Hue == 2418 || Hue == 2219)  //Bronze || Valorite
                        {
                            DoHarmful(m);
                            ThrowGas(m);
                        }
                    }
                }
            }
            if (Mana >= 50 && caster.Skills.Inscribe.Value >= 80 && overseerCount >= 3 && (Hue == 2425 || Hue == 0 || Hue == 2213))//Agapite or Iron or Gold
            {
                for (int i = 0; i < deadList.Count; ++i)
                {
                    if (DateTime.UtcNow < m_NextRes)
                    {
                        return;
                    }

                    if (ControlMaster == null)
                    {
                        m_NextRes = DateTime.UtcNow + TimeSpan.FromSeconds(0.5 + 100.0 * Utility.RandomDouble());
                    }
                    else
                    {
                        m_SpeedBonus = (int)((ControlMaster.Skills.Carpentry.Value + ControlMaster.Skills.Blacksmith.Value) * 4 / 280);
                        m_NextRes    = DateTime.UtcNow + TimeSpan.FromSeconds(0.5 + (8.0 - m_SpeedBonus) * Utility.RandomDouble());//0.5-8.0 (0.5-5.35) (0.5-4.5 with hammer)
                    }

                    int patientNumber = -1;
                    if (Mana >= 50)
                    {
                        Mobile       m_Patient  = (Mobile)deadList[i];
                        BaseCreature petPatient = m_Patient as BaseCreature;
                        if (this == null || !this.Alive || ((BaseCreature)this).IsDeadPet)
                        {
                            patientNumber = -1;
                        }
                        else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet))
                        {
                            if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, false, false))
                            {
                                patientNumber = 502391;                         // Thou can not be resurrected there!
                            }
                            else if (m_Patient.Region != null && m_Patient.Region.IsPartOf("Khaldun"))
                            {
                                patientNumber = 502391;                         // Thou can not be resurrected there!
                            }
                            else
                            {
                                Mana         -= 50;
                                patientNumber = -1;

                                m_Patient.PlaySound(0x214);
                                m_Patient.FixedEffect(0x376A, 10, 16);

                                if (petPatient != null && petPatient.IsDeadPet)
                                {
                                    Mobile master = petPatient.ControlMaster;
                                    if (master != null && ControlMaster == master)
                                    {
                                        petPatient.ResurrectPet();

                                        for (int j = 0; j < petPatient.Skills.Length; ++j)
                                        {
                                            petPatient.Skills[j].Base -= 0.1;
                                        }
                                    }
                                    else if (master != null && master.InRange(petPatient, 3))
                                    {
                                        master.CloseGump(typeof(PetResurrectGump));
                                        master.SendGump(new PetResurrectGump(ControlMaster, petPatient));
                                    }
                                    else
                                    {
                                        bool found = false;

                                        List <Mobile> friends = petPatient.Friends;

                                        for (int j = 0; friends != null && j < friends.Count; ++j)
                                        {
                                            Mobile friend = friends[j];

                                            if (friend.InRange(petPatient, 3))
                                            {
                                                friend.CloseGump(typeof(PetResurrectGump));
                                                friend.SendGump(new PetResurrectGump(ControlMaster, petPatient));

                                                found = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    m_Patient.CloseGump(typeof(ResurrectGump));
                                    m_Patient.SendGump(new ResurrectGump(m_Patient, ControlMaster));
                                }
                            }
                        }
                    }
                }
            }
        }