Beispiel #1
0
        public static bool TryConsumeSfMaterials(Mobile from)
        {
            Container pack = from.Backpack;

            var            toDelete         = new List <Item>();
            var            dragonboneshards = new List <DragonBoneShards>();
            var            dragonhearts     = new List <DragonHeart>();
            DevourerSoul   devourersoul     = null;
            HarrowerSoul   harrowersoul     = null;
            HeartofRikktor rikktorheart     = null;

            foreach (Item item in pack.Items)
            {
                if (rikktorheart == null && item is HeartofRikktor)
                {
                    rikktorheart = item as HeartofRikktor;
                    toDelete.Add(item);
                }
                else if (devourersoul == null && item is DevourerSoul)
                {
                    devourersoul = item as DevourerSoul;
                    toDelete.Add(item);
                }
                else if (harrowersoul == null && item is HarrowerSoul)
                {
                    harrowersoul = item as HarrowerSoul;
                    toDelete.Add(item);
                }
                else if (dragonboneshards.Count < 20 && item is DragonBoneShards)
                {
                    dragonboneshards.Add(item as DragonBoneShards);
                    toDelete.Add(item);
                }
                else if (dragonhearts.Count < 2 && item is DragonHeart)
                {
                    dragonhearts.Add(item as DragonHeart);
                    toDelete.Add(item);
                }
            }
            if (rikktorheart != null && devourersoul != null && harrowersoul != null && dragonboneshards.Count == 20 &&
                dragonhearts.Count == 2)
            {
                foreach (Item item in toDelete)
                {
                    item.Delete();
                }
                return(true);
            }
            return(false);
        }
        public override void GiveSpecialItems(List <Mobile> eligibleMobs, List <double> eligibleMobScores, double totalScores)
        {
            double currentTestValue = 0.0;
            double roll             = Utility.RandomDouble() * totalScores;

            for (int i = 0; i < eligibleMobScores.Count; i++)
            {
                currentTestValue += eligibleMobScores[i];

                if (roll > currentTestValue)
                {
                    continue;
                }

                DevourerSoul heart = new DevourerSoul();
                if (eligibleMobs[i] is PlayerMobile && eligibleMobs[i].Backpack != null)
                {
                    eligibleMobs[i].Backpack.DropItem(heart);
                    eligibleMobs[i].SendMessage(54, "You have captured the soul of the Devourer!");
                    return;
                }
            }
        }