Inheritance: IComparable
コード例 #1
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);
        }
コード例 #2
0
ファイル: TyballsShadow.cs プロジェクト: zmazza/ServUO
        public override void OnDeath(Container c)
        {
            if (Map == Map.TerMur)
            {
                List <DamageStore> rights = GetLootingRights();
                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());
                }

                ColUtility.Free(toGive);
            }
            base.OnDeath(c);
        }
コード例 #3
0
ファイル: BaseChampion.cs プロジェクト: nheit/ServUO
        public override void OnDeath(Container c)
        {
            if (Map == Map.Felucca)
            {
                List <DamageStore> rights = GetLootingRights();
                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 (SkullType != ChampionSkullType.None)
                {
                    if (toGive.Count > 0)
                    {
                        toGive[Utility.Random(toGive.Count)].AddToBackpack(new ChampionSkull(SkullType));
                    }
                    else
                    {
                        c.DropItem(new ChampionSkull(SkullType));
                    }
                }

                RefinementComponent.Roll(c, 3, 0.10);
            }

            base.OnDeath(c);
        }
コード例 #4
0
ファイル: BaseChampion.cs プロジェクト: Tabain84/Comraich
        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);
        }
コード例 #5
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);
        }
コード例 #6
0
ファイル: Harrower.cs プロジェクト: jacquesc1/UO-Live-Server
        public override bool OnBeforeDeath()
        {
            if (m_TrueForm)
            {
                List <DamageStore> rights = GetLootingRights();

                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 = Map;

                    GoldShower.DoForHarrower(Location, Map);

                    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);
            }
        }
コード例 #7
0
ファイル: Navrey.cs プロジェクト: zmazza/ServUO
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);

            if (m_Spawner != null)
                m_Spawner.OnNavreyKilled();

            if (Utility.RandomBool())
                c.AddItem(new UntranslatedAncientTome());

            if (0.1 >= Utility.RandomDouble())
                c.AddItem(ScrollOfTranscendence.CreateRandom(30, 30));

            if (0.1 >= Utility.RandomDouble())
                c.AddItem(new TatteredAncientScroll());

            if (Utility.RandomDouble() < 0.10)
                c.DropItem(new LuckyCoin());

            if (Utility.RandomDouble() < 0.025)
                DistributeRandomArtifact(this, m_Artifact);

            // distribute quest items for the 'Green with Envy' quest given by Vernix
            List<DamageStore> rights = GetLootingRights();
            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;
                        }
                    }
                }
            }
        }
コード例 #8
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!");
                }
            }
        }
コード例 #9
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);
        }
コード例 #10
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;
		}
コード例 #11
0
ファイル: BaseChampion.cs プロジェクト: AdamDresch/ServUO
        public override void OnDeath(Container c)
        {
            if (this.Map == Map.Felucca)
            {
                //TODO: Confirm SE change or AoS one too?
                List <DamageStore> rights = GetLootingRights();
                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 (SkullType != ChampionSkullType.None)
                {
                    if (toGive.Count > 0)
                    {
                        toGive[Utility.Random(toGive.Count)].AddToBackpack(new ChampionSkull(this.SkullType));
                    }
                    else
                    {
                        c.DropItem(new ChampionSkull(this.SkullType));
                    }
                }

                if (Core.SA)
                {
                    RefinementComponent.Roll(c, 3, 0.10);
                }

                #region TOL
                if (Core.TOL)
                {
                    SkillMasteryPrimer.CheckPrimerDrop(this);
                }
                #endregion
            }

            base.OnDeath(c);
        }
コード例 #12
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);
        }
コード例 #13
0
        public override void OnDeath(Container c)
        {
            if (Map == Map.Felucca || Map == Map.TerMur)
            {
                //TODO: Confirm SE change or AoS one too?
                List <DamageStore> rights = GetLootingRights();
                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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
ファイル: DemonKnight.cs プロジェクト: Drake1187/runuocustom
        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);
                    }
                }
            }
        }
コード例 #16
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);
            }
        }
コード例 #17
0
ファイル: DemonKnight.cs プロジェクト: Drake1187/runuocustom
        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);
        }
コード例 #18
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);
        }
コード例 #19
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
                }
            }
        }
コード例 #20
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());
        }
コード例 #21
0
ファイル: Starlight.cs プロジェクト: D-Hiatt/Keepers-of-Time
        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);
            }
        }
コード例 #22
0
ファイル: BaseChampion.cs プロジェクト: nheit/ServUO
        public virtual void GivePowerScrolls()
        {
            if (Map == null || (RestrictedToFelucca && Map.Rules != MapRules.FeluccaRules))
            {
                return;
            }

            List <Mobile>      toGive = new List <Mobile>();
            List <DamageStore> rights = GetLootingRights();

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

                if (ds.m_HasRight && InRange(ds.m_Mobile, 100) && ds.m_Mobile.Map == Map)
                {
                    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 - PowerScrolls
            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 < PowerScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                var ps = CreateRandomPowerScroll();
                GiveItemMessage(m, ps);

                GivePowerScrollTo(m, ps);
            }

            // Randomize - Primers
            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 < PowerScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                SkillMasteryPrimer p = CreateRandomPrimer();
                GiveItemMessage(m, p);

                GivePowerScrollTo(m, p);
            }

            ColUtility.Free(toGive);
        }
コード例 #23
0
        public virtual void GivePowerScrolls()
        {
            if (this.Map != Map.Felucca)
            {
                return;
            }

            List <Mobile>      toGive = new List <Mobile>();
            List <DamageStore> rights = GetLootingRights();

            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 < ChampionSystem.PowerScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                GivePowerScrollTo(m);
            }
        }
コード例 #24
0
ファイル: Harrower.cs プロジェクト: alucardxlx/Casiopia
        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);
            }
        }
コード例 #25
0
ファイル: Harrower.cs プロジェクト: alucardxlx/Casiopia
        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 ) );
                         *                      }
                         */
                    }
                }
            }
        }
コード例 #26
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()));
                        }
                    }
                }
            }
        }
コード例 #27
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));
                        }
                    }
                }
            }
        }
コード例 #28
0
        public override void OnDeath(Container c)
        {
            if (IsKrampusEncounter)
            {
                List <DamageStore> rights = GetLootingRights();

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

                    if (ds.m_Mobile is PlayerMobile m && ds.m_HasRight)
                    {
                        int ordersComplete = 0;

                        if (KrampusEvent.Instance.CompleteTable.ContainsKey(m))
                        {
                            ordersComplete = KrampusEvent.Instance.CompleteTable[m];
                        }

                        if (ordersComplete >= 3 || Utility.RandomMinMax(0, 8) <= ordersComplete)
                        {
                            Item item = null;

                            switch (Utility.Random(13))
                            {
                            case 0:
                                item = new KrampusCoinPurse(m.Karma);
                                break;

                            case 1:
                                item = new CardOfSemidar(Utility.RandomMinMax(0, 6));
                                break;

                            case 2:
                                item = new NiceTitleDeed();
                                break;

                            case 3:
                                item = new NaughtyTitleDeed();
                                break;

                            case 4:
                                item = new PunisherTitleDeed();
                                break;

                            case 5:
                                item = new RecipeScroll(586);
                                break;     // minion hat

                            case 6:
                                item = new RecipeScroll(587);
                                break;     // minion boots

                            case 7:
                                item = new KrampusCoinPurse(463);
                                break;     // minion talons

                            case 8:
                                item = new KrampusCoinPurse(588);
                                break;     // minion earrings

                            case 9:
                                item = new KrampusPunishinList(m.Name);
                                break;

                            case 10:
                                item = new RecipeScroll(466);
                                break;     // barbed whip

                            case 11:
                                item = new RecipeScroll(467);
                                break;     // spiked whip

                            case 12:
                                item = new RecipeScroll(468);
                                break;     // bladed whip
                            }

                            if (item != null)
                            {
                                m.SendLocalizedMessage(
                                    1156269); // For your valor in defeating your foe a specialty item has been awarded to you!

                                if (m.Backpack == null || !m.Backpack.TryDropItem(m, item, false))
                                {
                                    m.BankBox.DropItem(item);
                                }
                            }
                        }
                    }
                }
            }

            base.OnDeath(c);
        }
コード例 #29
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));
                        }
                    }
                }
            }
        }
コード例 #30
0
        public int CompareTo(object obj)
        {
            DamageStore ds = (DamageStore)obj;

            return(ds.m_Damage - m_Damage);
        }