Beispiel #1
0
        public static void GiveScrollOfTranscendenceFelTo(Mobile killer, ScrollofTranscendence SoTF)
        {
            if (SoTF == null || killer == null) //sanity
            {
                return;
            }

            killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!

            if (killer.Alive)
            {
                killer.AddToBackpack(SoTF);
            }
            else
            {
                if (killer.Corpse != null && !killer.Corpse.Deleted)
                {
                    killer.Corpse.DropItem(SoTF);
                }
                else
                {
                    killer.AddToBackpack(SoTF);
                }
            }


            // Justice reward
            PlayerMobile pm = (PlayerMobile)killer;

            for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
            {
                Mobile prot = (Mobile)pm.JusticeProtectors[j];
                if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(killer, prot))
                {
                    continue;
                }

                int chance = 0;

                switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                {
                case VirtueLevel.Seeker: chance = 60; break;

                case VirtueLevel.Follower: chance = 80; break;

                case VirtueLevel.Knight: chance = 100; break;
                }

                if (chance > Utility.Random(100))
                {
                    prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
                    ScrollofTranscendence SoTFduplicate = new ScrollofTranscendence(SoTF.Skill, SoTF.Value);
                    prot.AddToBackpack(SoTFduplicate);
                }
            }
        }
Beispiel #2
0
        public void GivePowerScrolls(ArrayList toGive)
        {
            if (NoKillAwards)
            {
                return;
            }

            if (Map != Map.Felucca)
            {
                return;
            }

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = (Mobile)toGive[i];

                if (!m.Alive && m.Corpse == null)
                {
                    toGive.Remove(m);
                }
            }

            for (int i = 0; i < 6; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                if (0.1 >= random)
                {
                    level = 20;
                }
                else if (0.4 >= random)
                {
                    level = 15;
                }
                else
                {
                    level = 10;
                }

                Mobile m = (Mobile)toGive[i % toGive.Count];

                PowerScroll ps = PowerScroll.CreateRandomNoCraft(level, level);

                if (m.AccessLevel > AccessLevel.Player)
                {
                    ps.Cheater_Name = String.Format("This item received by GM {0}", m.Name);
                }

                m.SendLocalizedMessage(1049524);                   // You have received a scroll of power!

                if (m.Alive)
                {
                    m.AddToBackpack(ps);
                }
                else
                {
                    Container corpse = m.Corpse;

                    if (corpse != null)
                    {
                        corpse.DropItem(ps);
                    }
                }

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker:
                            chance = 60;
                            break;

                        case VirtueLevel.Follower:
                            chance = 80;
                            break;

                        case VirtueLevel.Knight:
                            chance = 100;
                            break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            PowerScroll pps = PowerScroll.CreateRandomNoCraft(level, level);
                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(pps);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public void GivePowerScrolls()
        {
            List <Mobile>      toGive = new List <Mobile>();
            List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

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

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                Mobile hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

            for (int i = 0; i < 16; ++i)
            {
                /*
                 * int level;
                 *              double random = Utility.RandomDouble();
                 *
                 *              if ( 0.1 >= random )
                 *                      level = 25;
                 *              else if ( 0.25 >= random )
                 *                      level = 20;
                 *              else if ( 0.45 >= random )
                 *                      level = 15;
                 *              else if ( 0.70 >= random )
                 *                      level = 10;
                 *              else
                 *                      level = 5;
                 */

                Mobile m = toGive[i % toGive.Count];

/*
 *                              m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power!
 *                              m.AddToBackpack( new StatCapScroll( 225 + level ) );
 */
                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Kills >= Mobile.MurderCount || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        /*
                         *                      int chance = 0;
                         *
                         *                      switch ( VirtueHelper.GetLevel( prot, VirtueName.Justice ) )
                         *                      {
                         *                              case VirtueLevel.Seeker: chance = 60; break;
                         *                              case VirtueLevel.Follower: chance = 80; break;
                         *                              case VirtueLevel.Knight: chance = 100; break;
                         *                      }
                         *
                         *                      if ( chance > Utility.Random( 100 ) )
                         *                      {
                         *                              prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice!
                         *                              prot.AddToBackpack( new StatCapScroll( 225 + level ) );
                         *                      }
                         */
                    }
                }
            }
        }
Beispiel #4
0
        public void GivePowerScrolls()
        {
            List <Mobile>      toGive = new List <Mobile>();
            List <DamageStore> rights = GetLootingRights(DamageEntries, HitsMax);

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

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

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                Mobile hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

            for (int i = 0; i < ChampionSystem.StatScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                m.SendLocalizedMessage(1049524); // You have received a scroll of power!
                m.AddToBackpack(new StatCapScroll(m_StatCap + RandomStatScrollLevel()));

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker:
                            chance = 60;
                            break;

                        case VirtueLevel.Follower:
                            chance = 80;
                            break;

                        case VirtueLevel.Knight:
                            chance = 100;
                            break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(new StatCapScroll(m_StatCap + RandomStatScrollLevel()));
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public static void GiveScrollTo(Mobile killer, SpecialScroll scroll)
        {
            if (scroll == null || killer == null)               //sanity
            {
                return;
            }

            if (scroll is ScrollofTranscendence)
            {
                killer.SendLocalizedMessage(1094936);                   // You have received a Scroll of Transcendence!
            }
            else
            {
                killer.SendLocalizedMessage(1049524);                   // You have received a scroll of power!
            }
            if (killer.Alive)
            {
                killer.AddToBackpack(scroll);
            }
            else
            {
                if (killer.Corpse != null && !killer.Corpse.Deleted)
                {
                    killer.Corpse.DropItem(scroll);
                }
                else
                {
                    killer.AddToBackpack(scroll);
                }
            }

            // Justice reward
            PlayerMobile pm = (PlayerMobile)killer;

            for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
            {
                Mobile prot = (Mobile)pm.JusticeProtectors[j];

                if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(killer, prot))
                {
                    continue;
                }

                int chance = 0;

                switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                {
                case VirtueLevel.Seeker: chance = 60; break;

                case VirtueLevel.Follower: chance = 80; break;

                case VirtueLevel.Knight: chance = 100; break;
                }

                if (chance > Utility.Random(100))
                {
                    try
                    {
                        prot.SendLocalizedMessage(1049368);                           // You have been rewarded for your dedication to Justice!

                        SpecialScroll scrollDupe = Activator.CreateInstance(scroll.GetType()) as SpecialScroll;

                        if (scrollDupe != null)
                        {
                            scrollDupe.Skill = scroll.Skill;
                            scrollDupe.Value = scroll.Value;
                            prot.AddToBackpack(scrollDupe);
                        }
                    }
                    catch {}
                }
            }
        }
Beispiel #6
0
        public static void GivePowerScrollTo(Mobile m, PowerScroll ps)
        {
            if (ps == null || m == null)    //sanity
            {
                return;
            }

            m.SendLocalizedMessage(1049524); // You have received a scroll of power!

            if (!Core.SE || m.Alive)
            {
                m.AddToBackpack(ps);
            }
            else
            {
                if (m.Corpse != null && !m.Corpse.Deleted)
                {
                    m.Corpse.DropItem(ps);
                }
                else
                {
                    m.AddToBackpack(ps);
                }
            }

            if (m is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)m;

                for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                {
                    Mobile prot = pm.JusticeProtectors[j];

                    if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                    {
                        continue;
                    }

                    int chance = 0;

                    switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                    {
                    case VirtueLevel.Seeker: chance = 60; break;

                    case VirtueLevel.Follower: chance = 80; break;

                    case VirtueLevel.Knight: chance = 100; break;
                    }

                    if (chance > Utility.Random(100))
                    {
                        PowerScroll powerScroll = new PowerScroll(ps.Skill, ps.Value);

                        prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!

                        if (!Core.SE || prot.Alive)
                        {
                            prot.AddToBackpack(powerScroll);
                        }
                        else
                        {
                            if (prot.Corpse != null && !prot.Corpse.Deleted)
                            {
                                prot.Corpse.DropItem(powerScroll);
                            }
                            else
                            {
                                prot.AddToBackpack(powerScroll);
                            }
                        }
                    }
                }
            }
        }
Beispiel #7
0
        public void GivePowerScrolls()
        {
            List <Mobile>      toGive = new List <Mobile>();
            List <DamageStore> rights = GetLootingRights(DamageEntries, HitsMax);

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

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

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                Mobile hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

            for (int i = 0; i < 16; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                if (random <= 0.1)
                {
                    level = 25;
                }
                else if (random <= 0.25)
                {
                    level = 20;
                }
                else if (random <= 0.45)
                {
                    level = 15;
                }
                else if (random <= 0.70)
                {
                    level = 10;
                }
                else
                {
                    level = 5;
                }

                Mobile m = toGive[i % toGive.Count];

                m.SendLocalizedMessage(1049524); // You have received a scroll of power!
                m.AddToBackpack(new StatCapScroll(225 + level));

                if (m is PlayerMobile pm)
                {
                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = pm.JusticeProtectors[j];

                        if (prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal ||
                            !JusticeVirtue.CheckMapRegion(pm, prot))
                        {
                            continue;
                        }

                        var chance = VirtueHelper.GetLevel(prot, VirtueName.Justice) switch
                        {
                            VirtueLevel.Seeker => 60,
                            VirtueLevel.Follower => 80,
                            VirtueLevel.Knight => 100,
                            _ => 0
                        };

                        if (chance > Utility.Random(100))
                        {
                            prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(new StatCapScroll(225 + level));
                        }
                    }
                }
            }
        }
Beispiel #8
0
        public static void GivePowerScrollTo(Mobile m, PowerScroll ps)
        {
            if (ps == null || m == null) // sanity
            {
                return;
            }

            m.SendLocalizedMessage(1049524); // You have received a scroll of power!

            if (!Core.SE || m.Alive)
            {
                m.AddToBackpack(ps);
            }
            else
            {
                if (m.Corpse?.Deleted == false)
                {
                    m.Corpse.DropItem(ps);
                }
                else
                {
                    m.AddToBackpack(ps);
                }
            }

            if (m is not PlayerMobile pm)
            {
                return;
            }

            for (var j = 0; j < pm.JusticeProtectors.Count; ++j)
            {
                var prot = pm.JusticeProtectors[j];

                if (prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(pm, prot))
                {
                    continue;
                }

                var chance = VirtueHelper.GetLevel(prot, VirtueName.Justice) switch
                {
                    VirtueLevel.Seeker => 60,
                    VirtueLevel.Follower => 80,
                    VirtueLevel.Knight => 100,
                    _ => 0
                };

                if (chance > Utility.Random(100))
                {
                    var powerScroll = new PowerScroll(ps.Skill, ps.Value);

                    prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!

                    if (!Core.SE || prot.Alive)
                    {
                        prot.AddToBackpack(powerScroll);
                    }
                    else
                    {
                        if (prot.Corpse?.Deleted == false)
                        {
                            prot.Corpse.DropItem(powerScroll);
                        }
                        else
                        {
                            prot.AddToBackpack(powerScroll);
                        }
                    }
                }
            }
        }
        public void GivePowerScrolls()
        {
            if (Map != Map.Felucca)
            {
                return;
            }

            ArrayList toGive = new ArrayList();
            ArrayList rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = (DamageStore)rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

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

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                object hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

            for (int i = 0; i < 6; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                if (0.1 >= random)
                {
                    level = 20;
                }
                else if (0.4 >= random)
                {
                    level = 15;
                }
                else
                {
                    level = 10;
                }

                Mobile m = (Mobile)toGive[i % toGive.Count];

                PowerScroll ps = PowerScroll.CreateRandomNoCraft(level, level);

                m.SendLocalizedMessage(1049524);                   // You have received a scroll of power!
                m.AddToBackpack(ps);

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker: chance = 60; break;

                        case VirtueLevel.Follower: chance = 80; break;

                        case VirtueLevel.Knight: chance = 100; break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(new PowerScroll(ps.Skill, ps.Value));
                        }
                    }
                }
            }
        }
Beispiel #10
0
        public virtual void GivePowerScrollTo(Mobile m, Item item)
        {
            if (m == null)      //sanity
            {
                return;
            }

            if (m.Alive)
            {
                m.AddToBackpack(item);
            }
            else
            {
                if (m.Corpse != null && !m.Corpse.Deleted)
                {
                    m.Corpse.DropItem(item);
                }
                else
                {
                    m.AddToBackpack(item);
                }
            }

            if (item is PowerScroll && m is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)m;

                for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                {
                    Mobile prot = pm.JusticeProtectors[j];

                    if (prot.Map != m.Map || prot.Murderer || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot) || !prot.InRange(this, 100))
                    {
                        continue;
                    }

                    int chance = 0;

                    switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                    {
                    case VirtueLevel.Seeker:
                        chance = 60;
                        break;

                    case VirtueLevel.Follower:
                        chance = 80;
                        break;

                    case VirtueLevel.Knight:
                        chance = 100;
                        break;
                    }

                    if (chance > Utility.Random(100))
                    {
                        var powerScroll = CreateRandomPowerScroll();

                        prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!

                        if (prot.Alive)
                        {
                            prot.AddToBackpack(powerScroll);
                        }
                        else
                        {
                            if (prot.Corpse != null && !prot.Corpse.Deleted)
                            {
                                prot.Corpse.DropItem(powerScroll);
                            }
                            else
                            {
                                prot.AddToBackpack(powerScroll);
                            }
                        }
                    }
                }
            }
        }
Beispiel #11
0
        public void GiveClothingBlessDeed()
        {
            if (Map != Map.Felucca)
            {
                return;
            }

            ArrayList toGive = new ArrayList();
            ArrayList rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = (DamageStore)rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

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

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                object hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

            for (int i = 0; i < 6; ++i)
            {
                Mobile m = (Mobile)toGive[i % toGive.Count];

                ClothingBlessDeed cbd = new ClothingBlessDeed();

                m.SendMessage("You have received a Clothing Bless Deed!");                   // You have received a Clothing Bless Deed!
                m.AddToBackpack(cbd);

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker: chance = 60; break;

                        case VirtueLevel.Follower: chance = 80; break;

                        case VirtueLevel.Knight: chance = 100; break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(new ClothingBlessDeed());
                        }
                    }
                }
            }
        }
Beispiel #12
0
        public void GivePowerScrolls()
        {
            if (Map != Map.Felucca)
            {
                return;
            }

            ArrayList          toGive = new ArrayList();
            List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

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

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = (Mobile)toGive[i];

                if (!(m is PlayerMobile))
                {
                    continue;
                }

                bool gainedPath = false;

                int pointsToGain = 800;

                if (VirtueHelper.Award(m, VirtueName.Valor, pointsToGain, ref gainedPath))
                {
                    if (gainedPath)
                    {
                        m.SendLocalizedMessage(1054032);                           // You have gained a path in Valor!
                    }
                    else
                    {
                        m.SendLocalizedMessage(1054030);                           // You have gained in Valor!
                    }
                    //No delay on Valor gains
                }
            }

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                object hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

            for (int i = 0; i < 6; ++i)
            {
                Mobile m = (Mobile)toGive[i % toGive.Count];

                PowerScroll ps = CreateRandomPowerScroll();

                m.SendLocalizedMessage(1049524);                   // You have received a scroll of power!

                if (!Core.SE || m.Alive)
                {
                    m.AddToBackpack(ps);
                }
                else
                {
                    if (m.Corpse != null && !m.Corpse.Deleted)
                    {
                        ((Container)m.Corpse).DropItem(ps);
                    }
                    else
                    {
                        m.AddToBackpack(ps);
                    }
                }

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker: chance = 60; break;

                        case VirtueLevel.Follower: chance = 80; break;

                        case VirtueLevel.Knight: chance = 100; break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            ps = CreateRandomPowerScroll();

                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!

                            if (!Core.SE || prot.Alive)
                            {
                                prot.AddToBackpack(ps);
                            }
                            else
                            {
                                if (prot.Corpse != null && !prot.Corpse.Deleted)
                                {
                                    ((Container)prot.Corpse).DropItem(ps);
                                }
                                else
                                {
                                    prot.AddToBackpack(ps);
                                }
                            }
                        }
                    }
                }
            }
        }
        public void OnSlice()
        {
            if (!m_Active || Deleted)
            {
                return;
            }

            if (m_Champion != null)
            {
                if (m_Champion.Deleted)
                {
                    RegisterDamageTo(m_Champion);

                    if (m_Champion is BaseChampion)
                    {
                        AwardArtifact(((BaseChampion)m_Champion).GetArtifact());
                    }

                    m_DamageEntries.Clear();

                    if (m_Platform != null)
                    {
                        m_Platform.Hue = 0x497;
                    }

                    if (m_Altar != null)
                    {
                        m_Altar.Hue = 0;

                        if (!Core.ML || Map == Map.Felucca)
                        {
                            new StarRoomGate(true, m_Altar.Location, m_Altar.Map);
                        }
                    }

                    m_Champion = null;
                    Stop();

                    BeginRestart(m_RestartDelay);
                }
            }
            else
            {
                int kills = m_Kills;

                for (int i = 0; i < m_Creatures.Count; ++i)
                {
                    Mobile m = m_Creatures[i];

                    if (m.Deleted)
                    {
                        m_Creatures.RemoveAt(i);
                        --i;
                        ++m_Kills;

                        Mobile killer = m.FindMostRecentDamager(false);

                        RegisterDamageTo(m);

                        if (killer is BaseCreature)
                        {
                            killer = ((BaseCreature)killer).GetMaster();
                        }

                        if (killer is PlayerMobile)
                        {
                            #region Scroll of Transcendence
                            if (Core.ML)
                            {
                                if (Map == Map.Felucca)
                                {
                                    if (Utility.RandomDouble() < 0.001)
                                    {
                                        PlayerMobile pm = (PlayerMobile)killer;

                                        for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                                        {
                                            Mobile prot = (Mobile)pm.JusticeProtectors[j];

                                            if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(killer, prot))
                                            {
                                                continue;
                                            }

                                            int chance = 0;

                                            switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                                            {
                                            case VirtueLevel.Seeker: chance = 60; break;

                                            case VirtueLevel.Follower: chance = 80; break;

                                            case VirtueLevel.Knight: chance = 100; break;
                                            }

                                            if (chance > Utility.Random(100))
                                            {
                                                prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
                                                ScrollofTranscendence SoTF = CreateRandomFelSoT();
                                                prot.AddToBackpack(SoTF);
                                            }
                                        }

                                        double random = Utility.Random(49);

                                        if (random <= 24)
                                        {
                                            killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
                                            ScrollofTranscendence SoTF = CreateRandomFelSoT();
                                            killer.AddToBackpack(SoTF);
                                        }
                                        else
                                        {
                                            killer.SendLocalizedMessage(1049524); // You have received a scroll of power!
                                            PowerScroll PS = CreateRandomFelPS();
                                            killer.AddToBackpack(PS);
                                        }
                                    }
                                }

                                if (Map == Map.Ilshenar || Map == Map.Tokuno)
                                {
                                    if (Utility.RandomDouble() < 0.0015)
                                    {
                                        killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
                                        ScrollofTranscendence SoTT = CreateRandomTramSoT();
                                        killer.AddToBackpack(SoTT);
                                    }
                                }
                            }
                            #endregion

                            int mobSubLevel = GetSubLevelFor(m) + 1;

                            if (mobSubLevel >= 0)
                            {
                                bool gainedPath = false;

                                int pointsToGain = mobSubLevel * 40;

                                if (VirtueHelper.Award(killer, VirtueName.Valor, pointsToGain, ref gainedPath))
                                {
                                    if (gainedPath)
                                    {
                                        m.SendLocalizedMessage(1054032); // You have gained a path in Valor!
                                    }
                                    else
                                    {
                                        m.SendLocalizedMessage(1054030); // You have gained in Valor!
                                    }
                                    //No delay on Valor gains
                                }

                                PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)killer).ChampionTitles;

                                info.Award(m_Type, mobSubLevel);
                            }

                            if (Map == Map.Felucca)
                            {
                                PlayerMobile pm = (PlayerMobile)killer;

                                for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                                {
                                    Mobile prot = pm.JusticeProtectors[j];

                                    if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                                    {
                                        continue;
                                    }

                                    int chance = 0;

                                    switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                                    {
                                    case VirtueLevel.Seeker: chance = 60; break;

                                    case VirtueLevel.Follower: chance = 80; break;

                                    case VirtueLevel.Knight: chance = 100; break;
                                    }

                                    if (chance > Utility.Random(100))
                                    {
                                        ScrollofTranscendence SoTF = CreateRandomFelSoT();

                                        prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!

                                        if (!Core.SE || prot.Alive)
                                        {
                                            prot.AddToBackpack(SoTF);
                                        }
                                        else
                                        {
                                            if (prot.Corpse != null && !prot.Corpse.Deleted)
                                            {
                                                prot.Corpse.DropItem(SoTF);
                                            }
                                            else
                                            {
                                                prot.AddToBackpack(SoTF);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                // Only really needed once.
                if (m_Kills > kills)
                {
                    InvalidateProperties();
                }

                double n = m_Kills / (double)MaxKills;
                int    p = (int)(n * 100);

                if (p >= 90)
                {
                    AdvanceLevel();
                }
                else if (p > 0)
                {
                    SetWhiteSkullCount(p / 20);
                }

                if (DateTime.Now >= m_ExpireTime)
                {
                    Expire();
                }

                Respawn();
            }
        }
Beispiel #14
0
        public void GivePowerScrolls(ArrayList toGive)
        {
            if (NoKillAwards)
            {
                return;
            }

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = (Mobile)toGive[i];

                if (!m.Alive && m.Corpse == null)
                {
                    toGive.Remove(m);
                }
            }

            for (int i = 0; i < 16; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                if (0.1 >= random)
                {
                    level = 25;
                }
                else if (0.25 >= random)
                {
                    level = 20;
                }
                else if (0.45 >= random)
                {
                    level = 15;
                }
                else if (0.70 >= random)
                {
                    level = 10;
                }
                else
                {
                    level = 5;
                }

                Mobile m = (Mobile)toGive[i % toGive.Count];

                StatCapScroll scs = new StatCapScroll(225 + level);

                m.SendLocalizedMessage(1049524);                   // You have received a scroll of power!

                if (m.Alive)
                {
                    m.AddToBackpack(scs);
                }
                else
                {
                    Container corpse = m.Corpse;

                    if (corpse != null)
                    {
                        corpse.DropItem(scs);
                    }
                }

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Murderer || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker: chance = 60; break;

                        case VirtueLevel.Follower: chance = 80; break;

                        case VirtueLevel.Knight: chance = 100; break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(new StatCapScroll(225 + level));
                        }
                    }
                }
            }
        }
Beispiel #15
0
        public void GivePowerScrolls(ArrayList toGive)
        {
            if (NoKillAwards)
            {
                return;
            }

            if (Map != Map.Felucca)
            {
                return;
            }

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = (Mobile)toGive[i];

                if (!(m.Map == this.Map && m.InRange(this, 90)) || (!m.Alive && m.Corpse == null))
                {
                    toGive.Remove(m);
                }
            }

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

            for (int i = 0; i < 6; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                /* Powerscroll type chance:
                 * - 80% chance to get a 110 powerscroll
                 * - 15% chance to get a 115 powerscroll
                 * - 5% chance to get a 120 powerscroll
                 */

                if (0.05 >= random)
                {
                    level = 20;
                }
                else if (0.2 >= random)
                {
                    level = 15;
                }
                else
                {
                    level = 10;
                }

                Mobile m = (Mobile)toGive[i % toGive.Count];

                PowerScroll ps = PowerScroll.CreateRandomNoCraft(level, level);

                m.SendLocalizedMessage(1049524);                   // You have received a scroll of power!

                if (m.Alive)
                {
                    m.AddToBackpack(ps);
                }
                else
                {
                    Container corpse = m.Corpse;

                    if (corpse != null)
                    {
                        corpse.DropItem(ps);
                    }
                }

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Murderer || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker:
                            chance = 60;
                            break;

                        case VirtueLevel.Follower:
                            chance = 80;
                            break;

                        case VirtueLevel.Knight:
                            chance = 100;
                            break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            PowerScroll pps = PowerScroll.CreateRandomNoCraft(level, level);
                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(pps);
                        }
                    }
                }
            }
        }