Esempio n. 1
0
        public bool Gate(Mobile m)
        {
            if (m == null || m.Deleted)
            {
                return(false);
            }

            if (_Location.Internal || _Location.Zero)
            {
                m.SendMessage("That rune is blank.");
                return(false);
            }

            if (m.Player)
            {
                var t = GetType();

                if (m.AccessLevel < AccessLevel.Counselor && !m.BeginAction(t))
                {
                    m.SendMessage("You must wait before using the rune codex again.");
                    return(false);
                }

                GateTravelSpell spell = new GateTravelSpell(
                    m, null, new RunebookEntry(_Location.Location, _Location.Map, _Description, null));

                if (!spell.Cast())
                {
                    m.EndAction(t);
                    return(false);
                }

                Timer.DelayCall(TimeSpan.FromSeconds(3), () => m.EndAction(t));
            }
            else
            {
                _Location.MoveToWorld(m);
            }

            return(true);
        }
Esempio n. 2
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));
                                }
                            }
                        }
                    }
                }
            }
        }