public override string MyAction() { string appendToStory = ""; if (!player.CurrentLocation.IsLootable) { return("You can't loot here" + MyStaticClass.WhiteLine()); } if (!player.CurrentLocation.HasLoot) { return("This place was already looted" + MyStaticClass.WhiteLine()); } ILootList location = player.CurrentLocation as ILootList; location.CreateLootTables(); if (location.LootList.Count == 0) { return("You searched the entire place, but everything you found was useless" + MyStaticClass.WhiteLine()); } //TODO Aparte methode voor looten var pickedUp = new List <Item>(); foreach (Item i in location.LootList) { if (Player.inventoryPlayer.NumberOfItems < MyStaticClass.MaximumItemsInInventory) { Player.inventoryPlayer.AddItem(i); pickedUp.Add(i); appendToStory += String.Format("You found a {0}" + MyStaticClass.WhiteLine(), i.Name); } } RemoveFromLootList(location.LootList, pickedUp); if (location.LootList.Count > 0) { appendToStory += "Your inventory is full" + MyStaticClass.WhiteLine(); } if (location.LootList.Count == 0) { player.CurrentLocation.HasLoot = false; } return(appendToStory); }
public static void RareItemTable(ILootList location) { int chanceForRareItemTable = Rng.Next(0, 100); if (chanceForRareItemTable < 10) //10% chance for a item from RareItemTable { int chanceForBinoculars = Rng.Next(0, 100); if (chanceForBinoculars < 50) //50% chance for a Binoculars { location.LootList.Add(new Binoculars()); } else //50% chance for a Backpack { location.LootList.Add(new Backpack()); } } }
public static void HealthTable(ILootList location) { int chanceForHealthTable = Rng.Next(0, 100); if (chanceForHealthTable < 75) //75% chance for a item from HealthTable { int whichPotion = Rng.Next(0, 100); if (whichPotion < 60) //60% chance for SmallHealthPotion { location.LootList.Add(new HealthPotion("Small Health Potion", 30)); } else if (whichPotion >= 60 && whichPotion < 90) //30% chance for NormalHealthPotion { location.LootList.Add(new HealthPotion("Normal Health Potion", 50)); } else //10% chance for BigHealthPotion { location.LootList.Add(new HealthPotion("Big Health Potion", 70)); } } }