Ejemplo n.º 1
0
        public static int GetLuckChanceForKiller(Mobile dead)
        {
            if (dead == null)
            {
                return(240);
            }

            var list = BaseCreature.GetLootingRights(dead.DamageEntries, dead.HitsMax);

            DamageStore highest = null;

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

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

            if (highest == null)
            {
                return(0);
            }

            return(GetLuckChance(highest.m_Mobile, dead));
        }
Ejemplo n.º 2
0
        public static int GetLuckChanceForKiller(Mobile m)
        {
            BaseCreature dead = m as BaseCreature;

            if (dead == null)
            {
                return(240);
            }

            System.Collections.Generic.List <DamageStore> list = dead.GetLootingRights();

            DamageStore highest = null;

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

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

            if (highest == null)
            {
                return(0);
            }

            return(GetLuckChance(highest.m_Mobile, dead));
        }
Ejemplo n.º 3
0
		public static int GetLuckChanceForKiller(Mobile m)
		{
            BaseCreature dead = m as BaseCreature;

            if (dead == null)
                return 240;

			var list = dead.GetLootingRights();

			DamageStore highest = null;

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

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

			if (highest == null)
			{
				return 0;
			}

			return GetLuckChance(highest.m_Mobile, dead);
		}
Ejemplo n.º 4
0
		public static int GetLuckChanceForKiller( Mobile dead )
		{
			List<DamageStore> list = BaseCreature.GetLootingRights( dead.DamageEntries, dead.HitsMax );

			DamageStore highest = null;

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

				if ( ds.HasRight && ( highest == null || ds.Damage > highest.Damage ) )
					highest = ds;
			}

			if ( highest == null )
				return 0;

			return GetLuckChance( highest.Mobile, dead );
		}
Ejemplo n.º 5
0
        public static int GetLuckChanceForKiller(Mobile dead)
        {
            ArrayList list = BaseCreature.GetLootingRights(dead.DamageEntries, dead.HitsMax);

            double luckTotal   = 0;
            int    damageTotal = 0;

            Hashtable partyDamage = new Hashtable();

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

                if (ds.m_HasRight)
                {
                    Party p = Party.Get(ds.m_Mobile);
                    damageTotal += ds.m_Damage;

                    Console.WriteLine("Mobile {0} ({1}); Damage: {2} ", ds.m_Mobile.Name, ds.m_Mobile.Serial.ToString(), ds.m_Damage);

                    if (p != null)
                    {
                        if (partyDamage.Contains(p))
                        {
                            partyDamage[p] = (int)partyDamage[p] + ds.m_Damage;
                        }
                        else
                        {
                            partyDamage.Add(p, ds.m_Damage);
                        }
                    }
                }
            }

            for (int i = 0; i < list.Count; ++i)
            {
                DamageStore ds = (DamageStore)list[i];
                if (ds.m_HasRight)
                {
                    Party p = Party.Get(ds.m_Mobile);

                    if (p == null)
                    {
                        double scale = (double)ds.m_Damage / damageTotal;

                        luckTotal += ds.m_Mobile.Luck * scale;

                        PlayerMobile pm = ds.m_Mobile as PlayerMobile;

                        if (pm != null)
                        {
                            luckTotal += 10 * pm.Perfection * pm.Perfection * scale;
                        }
                    }
                }
            }

            foreach (Party p in partyDamage.Keys)
            {
                double scale = (double)((int)partyDamage[p]) / damageTotal;
                luckTotal += GetLuckChanceForParty(p) * scale;
            }

            return(GetLuckChance((int)luckTotal));
        }