private static void AddLootItem(Monster monster, int itemID, int percentage) { if (RandomNumberGenerator.NumberBetween(1, 100) <= percentage) { monster.AddItemToInventory(ItemFactory.CreateGameItem(itemID)); } }
private static void AddLoot(Monster monster, int itemId, int chance) { if (GodOfRandom.NumberBetween(1, 100) <= chance) { monster.AddItemToInventory(LootFactory.CreateLoot(itemId)); } }
private static void AddLootItem(Monster monster, int itemId, int percentage) { if (RandomNumberGenerator.NumberBetween(1, 100) <= percentage) { // TODO: add the code to use the percentage to choose the item Id monster.AddItemToInventory(ItemFactory.CreateGameItem(itemId)); } }
private static void AddLootItem(Monster monster, int itemID, int percentage) { Random ran = new Random(); int rn = ran.Next(100); if (rn <= percentage) { monster.AddItemToInventory(ItemFactory.CreateGameItem(itemID)); } }
private Monster Itemize(Monster monster) { double roll = _dice.Random(); while (roll < .25) { if (roll < 0.08) { var spell = spellFactory.CreateSpell(monster.Level); var newScroll = new Scroll() { Quantity = 1, Spell = spell }; monster.AddItemToInventory(newScroll); } else { monster.AddItemToInventory(itemFactory.CreateItem(monster.Level)); } roll = _dice.Random(); } return monster; }