private void HandleArmorCrafting(Person actor, string itemName) { if (actor.HasItemInInventory(ItemType.Iron)) { this.AddToPerson(actor, new Armor(itemName)); } }
private void HandleWeaponCrafting(Person actor, string itemName) { var requiredItems = new List<ItemType> { ItemType.Iron, ItemType.Wood }; if (requiredItems.All(i => actor.HasItemInInventory(i))) { this.AddToPerson(actor, new Weapon(itemName)); } }
private void HandleArmorCrafting(Person actor, string newItemName) { var itemRequired = ItemType.Iron; if (actor.HasItemInInventory(itemRequired)) { this.AddToPerson(actor, new Armor(newItemName)); } }
private void HandleWeaponCrafting(Person actor, string newItemName) { var itemsRequired = new List <ItemType> { ItemType.Iron, ItemType.Wood }; if (itemsRequired.All(i => actor.HasItemInInventory(i))) { this.AddToPerson(actor, new Weapon(newItemName)); } }
private void HandleGatherInteraction(Person actor, string itemName) { if (actor.Location is IGatheringLocation) { var gatheringLocation = actor.Location as IGatheringLocation; if (actor.HasItemInInventory(gatheringLocation.RequiredItem)) { this.AddToPerson(actor, gatheringLocation.ProduceItem(itemName)); } } }
private void HandleArmorCrafting(Person actor, string itemName) { var requiredItems = ItemType.Iron; if (actor.HasItemInInventory(requiredItems)) { this.AddToPerson(actor, new Armor(itemName)); } }
private void HandleGatherInteraction(Person actor, string itemName) { if (actor.Location is IGatheringLocation) { var gatheringLocation = actor.Location as IGatheringLocation; if (actor.HasItemInInventory(gatheringLocation.RequiredItem)) { this.AddToPerson(actor, gatheringLocation.ProduceItem(itemName)); } } // not so smart way, but it works!!! /* if (actor.Location.LocationType == LocationType.Forest && actor.ListInventory().Any(i => i.ItemType == ItemType.Weapon)) { this.AddToPerson(actor, new Wood(itemName)); } if (actor.Location.LocationType == LocationType.Mine && actor.ListInventory().Any(i => i.ItemType == ItemType.Armor)) { this.AddToPerson(actor, new Iron(itemName)); } */ }
private void HandleWeaponCrafting(Person actor, string itemName) { if (actor.HasItemInInventory(ItemType.Iron) && actor.HasItemInInventory(ItemType.Wood)) { this.AddToPerson(actor, new Weapon(itemName)); } /* // another way var itemsRequired = new List<ItemType> { ItemType.Iron, ItemType.Wood }; if (itemsRequired.All(i => actor.HasItemInInventory(i))) { this.AddToPerson(actor, new Weapon(itemName)); } */ }