示例#1
0
		public static bool IsEligible(BaseChampion c, Mobile mob)
		{
			if (mob == null)
			{
				return false;
			}

			if (CSOptions.PowerScrollRequireAlive && !mob.Alive)
			{
				return false;
			}

			if (CSOptions.PowerScrollMinimumDistance > -1)
			{
				if (Math.Abs(mob.X - c.X) > CSOptions.PowerScrollMinimumDistance ||
					Math.Abs(mob.Y - c.Y) > CSOptions.PowerScrollMinimumDistance)
				{
					return false;
				}
			}

			return true;
		}
示例#2
0
        public static bool IsEligible(BaseChampion c, Mobile mob)
        {
            if (mob == null)
            {
                return(false);
            }

            if (CSOptions.PowerScrollRequireAlive && !mob.Alive)
            {
                return(false);
            }

            if (CSOptions.PowerScrollMinimumDistance > -1)
            {
                if (Math.Abs(mob.X - c.X) > CSOptions.PowerScrollMinimumDistance ||
                    Math.Abs(mob.Y - c.Y) > CSOptions.PowerScrollMinimumDistance)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#3
0
        public static void GivePowerScrollTo(Mobile m, Item item, BaseChampion champ)
        {
            if (m == null)      //sanity
            {
                return;
            }

            if (!Core.SE || 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(champ, 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))
                    {
                        PowerScroll powerScroll = CreateRandomPowerScroll();

                        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);
                            }
                        }
                    }
                }
            }
        }
示例#4
0
		public static void GiveValor( BaseChampion champ )
		{
			ArrayList toGive = new ArrayList();

			ArrayList list = champ.Aggressors;
			for ( int i = 0; i < list.Count; ++i )
			{
				AggressorInfo info = (AggressorInfo)list[i];

				if ( info.Attacker.Player && info.Attacker.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( info.Attacker ) )
					toGive.Add( info.Attacker );
			}

			list = champ.Aggressed;
			for ( int i = 0; i < list.Count; ++i )
			{
				AggressorInfo info = (AggressorInfo)list[i];

				if ( info.Defender.Player && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( info.Defender ) )
					toGive.Add( info.Defender );
			}

			if ( toGive.Count == 0 )
				return;

			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;
			}

			if ( champ.ChanceToGiveValorPoints >= Utility.RandomDouble() )
			{
				for ( int i = 0; i < toGive.Count; ++i )
					TryToGiveValor( (PlayerMobile)toGive[i % toGive.Count], champ.ValorPoints );
			}
		}