コード例 #1
0
ファイル: Dungeon.cs プロジェクト: ertay/DungeonRollAlexa
        public void ReturnUsedTreasure(TreasureItem treasure)
        {
            // used treasure items  are shuffled into the pool
            int randomIndex = ThreadSafeRandom.ThisThreadsRandom.Next(TreasureItems.Count);

            TreasureItems.Insert(randomIndex, treasure);
        }
コード例 #2
0
        public string AcquireSingleTreasureItem(CompanionType companion, TreasureItem item)
        {
            // acquire a single treasure item
            // first remove companion from party and add to graveyard
            var companionDie = PartyDice.First(d => d.Companion == companion);

            UsePartyDie(companion);

            // now add treasure
            Inventory.Add(item);

            string message = $"You used a {companionDie.Name} to open a chest and received {item.TreasureType.GetDescription()}. ";

            return(message);
        }
コード例 #3
0
        public string DefeatDragon(TreasureItem treasureItem, Dungeon dungeon)
        {
            // player defeated dragon, let's remove the dice selection and move companions to graveyard
            string selectedCompanions = string.Join(", ", PartyDice.Where(d => d.IsSelected).Select(d => d.Name).ToList());
            int    companionCount     = PartyDice.Count(d => d.IsSelected);

            for (int i = 0; i < companionCount; i++)
            {
                UsePartyDie(PartyDice.First(d => d.IsSelected).Companion);
            }

            Inventory.Add(treasureItem);
            string message = $"{SoundManager.DragonDeathSound(true)} <amazon:emotion name=\"excited\" intensity=\"medium\">You used your {selectedCompanions}, to defeat the dragon. You acquired {treasureItem.TreasureType.GetDescription()}. ";

            message += GainExperiencePoints(1, dungeon);
            message += "</amazon:emotion>";
            return(message);
        }
コード例 #4
0
        public string UseCompanionTreasure(TreasureItem treasure)
        {
            // we used a treasure item, remove it from inventory
            Inventory.Remove(treasure);
            string   message  = "";
            PartyDie partyDie = new PartyDie();

            partyDie.IsFromTreasureOrHeroAbility = true;

            switch (treasure.TreasureType)
            {
            case TreasureType.VorpalSword:
                message            = "You used your vorpal sword and added a fighter to your party. ";
                partyDie.Companion = CompanionType.Fighter;
                break;

            case TreasureType.Talisman:
                message            = "You used your talisman and added a cleric to your party. ";
                partyDie.Companion = CompanionType.Cleric;
                break;

            case TreasureType.ScepterOfPower:
                message            = "You used your scepter of power and added a mage to your party. ";
                partyDie.Companion = CompanionType.Mage;
                break;

            case TreasureType.ThievesTools:
                message            = "You used your thieves tools and added a thief to your party. ";
                partyDie.Companion = CompanionType.Thief;
                break;

            case TreasureType.Scroll:
                message            = "You used your scroll treasure item and added a scroll to your party. ";
                partyDie.Companion = CompanionType.Scroll;
                break;
            }
// insert the new companion in the beginning of the party dice
            PartyDice.Insert(0, partyDie);
            return(message);
        }