コード例 #1
0
        public void ExecuteStep(CharacterSheet character)
        {
            var validArmors = new ArmorType[] {
                ArmorType.None,
                ArmorType.Light,
                ArmorType.Medium,
                ArmorType.Heavy
            };
            var armors = this.armorShop.GetInventory <IArmor>().Where(armor =>
                                                                      validArmors.Any(x => x == armor.ArmorType) &&
                                                                      character.Defense.IsProficient(armor) &&
                                                                      character.Inventory.CoinPurse.CanAfford(armor)
                                                                      );

            if (armors.HasChoices())
            {
                var armor = armors.ChooseOne();
                ShortLog.DebugFormat("Purchasing {0}", armor.Name);
                character.Inventory.Purchase(armor);
            }
        }