GetLootingRights() public static method

public static GetLootingRights ( List damageEntries, int hitsMax ) : List
damageEntries List
hitsMax int
return List
Esempio n. 1
0
        protected override void OnAfterDeath(Container c)
        {
            if (Map == Map.Felucca && DropSkull)
            {
                // Get the first mobile in the top attackers list that is in range.
                Mobile to = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax)
                            .OrderByDescending(e => e.DamagePercent)
                            .Select(e => e.Mobile)
                            .FirstOrDefault(m => m.InRange(c, 90));

                Container target = null;

                if (to != null)
                {
                    target = to.Backpack;
                }
                else
                {
                    target = c;                     // If no candidates, the skull goes to the champion's corpse.
                }
                if (target != null)                 // Sanity.
                {
                    target.DropItem(new ChampionSkull(SkullType));
                }
            }

            base.OnAfterDeath(c);
        }
Esempio n. 2
0
        public override void OnDeath(Container c)
        {
            if (Map == Map.TerMur)
            {
                List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);
                List <Mobile>      toGive = new List <Mobile>();

                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)
                {
                    toGive[Utility.Random(toGive.Count)].AddToBackpack(new YellowKey1());
                }

                /*else
                 * c.DropItem(new YellowKey1());*/

                if (Utility.RandomDouble() < 0.10)
                {
                    c.DropItem(new ShroudOfTheCondemned());
                }
            }
            base.OnDeath(c);
        }
Esempio n. 3
0
        public override void OnDeath(Container c)
        {
            if (this.Map == Map.Felucca)
            {
                //TODO: Confirm SE change or AoS one too?
                List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);
                List <Mobile>      toGive = new List <Mobile>();

                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)
                {
                    toGive[Utility.Random(toGive.Count)].AddToBackpack(new ChampionSkull(this.SkullType));
                }
                else
                {
                    c.DropItem(new ChampionSkull(this.SkullType));
                }
            }

            base.OnDeath(c);
        }
Esempio n. 4
0
        public void GiveRewards()
        {
            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;
            }

            GivePowerScrolls(toGive);

            GiveValor(toGive);

            GiveTitles(toGive);
        }
Esempio n. 5
0
        public override bool OnBeforeDeath()
        {
            if (this.m_TrueForm)
            {
                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 && ds.m_Mobile is PlayerMobile)
                    {
                        PlayerMobile.ChampionTitleInfo.AwardHarrowerTitle((PlayerMobile)ds.m_Mobile);
                    }
                }

                if (!this.NoKillAwards)
                {
                    this.GivePowerScrolls();

                    Map map = this.Map;

                    GoldShower.DoForHarrower(Location, Map);

                    this.m_DamageEntries = new Dictionary <Mobile, int>();

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

                        if (!m.Deleted)
                        {
                            m.Kill();
                        }

                        this.RegisterDamageTo(m);
                    }

                    this.m_Tentacles.Clear();

                    this.RegisterDamageTo(this);
                    this.AwardArtifact(this.GetArtifact());

                    if (this.m_GateItem != null)
                    {
                        this.m_GateItem.Delete();
                    }
                }

                return(base.OnBeforeDeath());
            }
            else
            {
                this.Morph();
                return(false);
            }
        }
Esempio n. 6
0
        public void GreaterTokens()
        {
            ArrayList          toGive = new ArrayList();
            List <DamageStore> 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 < 72; ++i)
            {
                Mobile m = (Mobile)toGive[i % toGive.Count];

                if (Utility.Random(72) < 4)
                {
                    m.AddToBackpack(new GoldenPrizeToken());
                    m.SendMessage("You have received a gold token!");
                }
                else if (Utility.Random(72) < 19)
                {
                    m.AddToBackpack(new SilverPrizeToken());
                    m.SendMessage("You have received a silver token!");
                }
                else if (Utility.Random(72) < 34)
                {
                    m.AddToBackpack(new BronzePrizeToken());
                    m.SendMessage("You have received a bronze token!");
                }
            }
        }
Esempio n. 7
0
        public static Mobile GetTopAttacker(BaseCreature bc)
        {
            List <DamageStore> rights = BaseCreature.GetLootingRights(bc.DamageEntries, bc.HitsMax);

            for (int i = 0; i < rights.Count; i++)
            {
                DamageStore ds = rights[i];

                if (ds.HasRight && ds.Mobile.Alive)
                {
                    return(ds.Mobile);
                }
            }

            return(null);
        }
Esempio n. 8
0
		public static Mobile FindRandomPlayer( BaseCreature creature )
		{
			List<DamageStore> rights = BaseCreature.GetLootingRights( creature.DamageEntries, creature.HitsMax );

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

				if ( !ds.m_HasRight )
					rights.RemoveAt( i );
			}

			if ( rights.Count > 0 )
				return rights[Utility.Random( rights.Count )].m_Mobile;

			return null;
		}
        public static Mobile FindRandomPlayer(BaseCreature creature)
        {
            ArrayList rights = BaseCreature.GetLootingRights(creature.DamageEntries, creature.HitsMax);

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

                if (!ds.m_HasRight)
                {
                    rights.RemoveAt(i);
                }
            }

            if (rights.Count > 0)
            {
                return(((DamageStore)rights[Utility.Random(rights.Count)]).m_Mobile);
            }

            return(null);
        }
Esempio n. 10
0
        public override void OnDeath(Container c)
        {
            if (this.Map == Map.Felucca || this.Map == Map.TerMur)
            {
                //TODO: Confirm SE change or AoS one too?
                List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);
                List <Mobile>      toGive = new List <Mobile>();

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

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

            base.OnDeath(c);
        }
Esempio n. 11
0
        public static Mobile FindRandomPlayer(BaseCreature creature)
        {
            List <DamageStore> rights = creature.GetLootingRights();

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

                if (!ds.m_HasRight)
                {
                    rights.RemoveAt(i);
                }
            }

            if (rights.Count > 0)
            {
                return(rights[Utility.Random(rights.Count)].m_Mobile);
            }

            return(null);
        }
Esempio n. 12
0
        public static void ComputePoints(BaseCreature creature)
        {
            List <DamageStore> rights = BaseCreature.GetLootingRights(creature.DamageEntries, creature.HitsMax);

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

                if (ds.m_HasRight)
                {
                    double baseChance, factor;
                    if (creature is DemonKnight)
                    {
                        baseChance = 1.5;
                    }
                    else
                    {
                        baseChance = 0.75;
                    }

                    switch (i)
                    {
                    case 0: factor = 0.1; break;

                    case 1: factor = 0.065; break;

                    case 2: factor = 0.05; break;

                    default: factor = 0.04; break;
                    }

                    PlayerMobile pm = ds.m_Mobile as PlayerMobile;

                    if (pm != null)
                    {
                        pm.GauntletPoints += (factor * baseChance);
                    }
                }
            }
        }
Esempio n. 13
0
        public static Mobile SortByPoints(BaseCreature creature)
        {
            List <DamageStore> rights = BaseCreature.GetLootingRights(creature.DamageEntries, creature.HitsMax);

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

                if (!ds.m_HasRight)
                {
                    rights.RemoveAt(i);
                }
            }

            if (rights.Count > 0)
            {
                double baseChance;
                if (creature is DemonKnight)
                {
                    baseChance = 1.5;
                }
                else
                {
                    baseChance = 0.75;
                }

                for (int i = rights.Count - 1; i >= 0; --i)
                {
                    PlayerMobile pm = rights[i].m_Mobile as PlayerMobile;
                    if (Utility.Random(100) <= (baseChance + pm.GauntletPoints))
                    {
                        return(pm);
                    }
                }
            }

            return(null);
        }
Esempio n. 14
0
        public void GiveTramTranscendenceScrolls()
        {
            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 < 6; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                ScrollofTranscendence st = CreateRandomTramTranscendenceScroll();

                GiveTramTranscendenceScrollTo(m, st);
            }
        }
Esempio n. 15
0
        public override void OnDeath(Container c)
        {
            if (Map == Map.Felucca)
            {
                ArrayList rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);

                int         random = Utility.RandomMinMax(0, rights.Count);
                DamageStore ds     = (DamageStore)rights[random];

                Container backpack = ds.m_Mobile.Backpack;

                if (backpack != null)
                {
                    backpack.DropItem(new ChampionSkull(SkullType));
                }
                else
                {
                    c.DropItem(new ChampionSkull(SkullType));
                }
            }

            base.OnDeath(c);
        }
Esempio n. 16
0
        public static void GetLuckChanceDoomChamp(Mobile dead)
        {
            List <DamageStore> damageStoreList          = BaseCreature.GetLootingRights(dead.DamageEntries, dead.HitsMax);
            List <Mobile>      mobileWithLootRightsList = new List <Mobile>();
            DamageStore        highest = null;

            foreach (DamageStore damageStore in damageStoreList)
            {
                if (damageStore.m_HasRight && !mobileWithLootRightsList.Contains(damageStore.m_Mobile))
                {
                    mobileWithLootRightsList.Add(damageStore.m_Mobile);
                }

                if (damageStore.m_HasRight && (highest == null || damageStore.m_Damage > highest.m_Damage))
                {
                    highest = damageStore;
                }
            }

            foreach (Mobile mobile in mobileWithLootRightsList)
            {
                ((PlayerMobile)mobile).DoomKillBonus += 1; // Increase KillBonus

                double mostDamageBonus = mobile == highest.m_Mobile ? 0.5 : 0;
                double doomKillBonus   = ((PlayerMobile)mobile).DoomKillBonus; //new property on PlayerMobile
                double luck            = ((PlayerMobile)mobile).Luck;

                // Just an example, we need to understand the math here.
                double chance = mostDamageBonus + doomKillBonus + luck;

                if (chance > Utility.Random(100))
                {
                    DistributeArtifact(mobile, CreateRandomArtifact());
                    ((PlayerMobile)mobile).DoomKillBonus = 0; // reset kill counter after ger artifact
                }
            }
        }
Esempio n. 17
0
        public override bool OnBeforeDeath()
        {
            if (m_TrueForm)
            {
                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 && ds.m_Mobile is PlayerMobile)
                    {
                        PlayerMobile.ChampionTitleInfo.AwardHarrowerTitle((PlayerMobile)ds.m_Mobile);
                    }
                }

                return(base.OnBeforeDeath());
            }
            else
            {
                Morph();
                return(false);
            }
        }
Esempio n. 18
0
        public override bool OnBeforeDeath()
        {
            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);
                }
            }

            foreach (Mobile m in GetMobilesInRange(5))
            {
                m.Poison = Poison.Lethal;
                m.Freeze(TimeSpan.FromSeconds(15.0));
                m.SendMessage("You have slain the grinch, but at what cost?");
            }

            return(base.OnBeforeDeath());
        }
Esempio n. 19
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 ) );
                         *                      }
                         */
                    }
                }
            }
        }
Esempio n. 20
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);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 21
0
        private void CompileHelpersList(BaseCreature pirate)
        {
            if (Owner == null)
                return;
 
            Party p = Party.Get(Owner);
            List<DamageStore> rights = pirate.GetLootingRights();
 
            IPooledEnumerable eable = pirate.GetMobilesInRange(19);
            foreach (Mobile mob in eable)
            {
                if (mob == Owner || !(mob is PlayerMobile))
                    continue;
 
                Party mobParty = Party.Get(mob);
 
                //Add party memebers regardless of looting rights
                if (p != null && mobParty != null && p == mobParty)
                {
                    m_Helpers.Add(mob);
                    continue;
                }
 
                // add those with looting rights
                for (int i = rights.Count - 1; i >= 0; --i)
                {
                    DamageStore ds = rights[i];
 
                    if (ds.m_HasRight && ds.m_Mobile == mob)
                    {
                        m_Helpers.Add(ds.m_Mobile);
                        break;
                    }
                }
            }
            eable.Free();
        }
Esempio n. 22
0
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);

            if (Utility.RandomBool())
            {
                c.AddItem(ScrollofTranscendence.CreateRandom(30, 30));
            }

            if (Utility.RandomBool())
            {
                c.AddItem(new TatteredAncientScroll());
            }

            if (Utility.RandomBool())
            {
                c.AddItem(new UntransTome());
            }

            if (Utility.RandomBool())
            {
                c.AddItem(new SpiderCarapace());
            }

            if (Utility.RandomDouble() < 0.01)
            {
                DistributeRandomArtifact(this, m_Artifact);
            }

            // distribute quest items for the 'Green with Envy' quest given by Vernix
            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)
                {
                    rights.RemoveAt(i);
                }
            }

            // for each with looting rights... give an eye of navrey if they have the quest
            foreach (DamageStore d in rights)
            {
                PlayerMobile pm = d.m_Mobile as PlayerMobile;
                if (null != pm)
                {
                    foreach (BaseQuest quest in pm.Quests)
                    {
                        if (quest is GreenWithEnvyQuest)
                        {
                            Container pack = pm.Backpack;
                            Item      item = new EyeOfNavrey();
                            if (pack == null || !pack.TryDropItem(pm, item, false))
                            {
                                pm.BankBox.DropItem(item);
                            }
                            pm.SendLocalizedMessage(1095155); // As Navrey Night-Eyes dies, you find and claim one of her eyes as proof of her demise.
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 23
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;
            }

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = 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);
                Mobile hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

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

                PowerScroll ps = CreateRandomPowerScroll();

                GivePowerScrollTo(m, ps);
            }
        }
Esempio n. 24
0
        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));
                        }
                    }
                }
            }
        }
Esempio n. 25
0
        public override bool OnBeforeDeath()
        {
            if (m_TrueForm)
            {
                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 && ds.m_Mobile is PlayerMobile)
                    {
                        PlayerMobile.ChampionTitleInfo.AwardHarrowerTitle((PlayerMobile)ds.m_Mobile);
                    }
                }

                if (!NoKillAwards)
                {
                    //GivePowerScrolls();

                    Map map = this.Map;

                    if (map != null)
                    {
                        for (int x = -16; x <= 16; ++x)
                        {
                            for (int y = -16; y <= 16; ++y)
                            {
                                double dist = Math.Sqrt(x * x + y * y);

                                if (dist <= 16)
                                {
                                    new GoodiesTimer(map, X + x, Y + y).Start();
                                }
                            }
                        }
                    }

                    m_DamageEntries = new Dictionary <Mobile, int>();

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

                        if (!m.Deleted)
                        {
                            m.Kill();
                        }

                        RegisterDamageTo(m);
                    }

                    m_Tentacles.Clear();

                    RegisterDamageTo(this);
                    AwardArtifact(GetArtifact());

                    if (m_GateItem != null)
                    {
                        m_GateItem.Delete();
                    }
                }

                return(base.OnBeforeDeath());
            }
            else
            {
                Morph();
                return(false);
            }
        }
Esempio n. 26
0
		public void OnCreatureKilled(BaseCreature killed)
		{
            if (Waves == null)
                return;

            Waves.ForEach(info =>
            {
                if (info.Creatures.Contains(killed))
                {
                    List<DamageStore> list = killed.GetLootingRights();
                    list.Sort();

                    for (int i = 0; i < list.Count; i++)
                    {
                        DamageStore ds = list[i];
                        Mobile m = ds.m_Mobile;

                        if (ds.m_Mobile is BaseCreature && ((BaseCreature)ds.m_Mobile).GetMaster() is PlayerMobile)
                            m = ((BaseCreature)ds.m_Mobile).GetMaster();

                        if (!info.Credit.Contains(m))
                            info.Credit.Add(m);

                        if (!CurrentScore.ContainsKey(m))
                            CurrentScore[m] = killed.Fame / 998;
                        else
                            CurrentScore[m] += killed.Fame / 998;
                    }

                    list.Clear();
                    list.TrimExcess();

                    info.Creatures.Remove(killed);

                    if (info.Creatures.Count == 0)
                    {
                        foreach (Mobile m in info.Credit.Where(m => m.Region == this.Region && m is PlayerMobile))
                        {
                            double award = Math.Max(0, this.Map == Map.Felucca ? Stage * 2 : Stage);

                            if (award > 0)
                            {
                                //Score Bonus
                                if (!CurrentScore.ContainsKey(m))
                                    CurrentScore[m] = Stage * 125;
                                else
                                    CurrentScore[m] += Stage * 125;
                            }
                        }
                    }

                    if (killed.Corpse != null && !killed.Corpse.Deleted)
                        ((Corpse)killed.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
                }
            });
		}
Esempio n. 27
0
        public static Mobile FindRandomPlayer(BaseCreature creature)
        {
            List<DamageStore> rights = creature.GetLootingRights();

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

                if (!ds.m_HasRight)
                    rights.RemoveAt(i);
            }

            if (rights.Count > 0)
                return rights[Utility.Random(rights.Count)].m_Mobile;

            return null;
        }
Esempio n. 28
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 < 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()));
                        }
                    }
                }
            }
        }
Esempio n. 29
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());
                        }
                    }
                }
            }
        }
Esempio n. 30
0
        public static void OnSpawnCreatureKilled(BaseCreature killed, int spawnLevel)
        {
            if (!Enabled || killed == null)
                return;

            List<DamageStore> rights = killed.GetLootingRights();

            rights.ForEach(store =>
                {
                    CityLoyaltySystem city = CityLoyaltySystem.GetCitizenship(store.m_Mobile);

                    if (city != null)
                        city.AwardLove(store.m_Mobile, 1 * (spawnLevel + 1), 0.10 > Utility.RandomDouble());
                });
        }