/// <summary> /// Checks for plants /// </summary> /// <param name="universe"></param> /// <param name="adventurer"></param> public static void CheckForFoiliage(Universe universe, Adventurer adventurer) { foreach (Foiliage plant in universe.FoiliageList) { if (plant.Location == adventurer.MapLocation) { switch (plant.Plant) { case Foiliage.plantType.Tree: DisplayMap.DisplayTree(plant.XPos, plant.YPos); break; case Foiliage.plantType.Grass: DisplayMap.DisplayPlantBasic(plant.XPos, plant.YPos, plant.CharIcon); break; case Foiliage.plantType.Flower: break; case Foiliage.plantType.Field: DisplayMap.DisplayPlantGrass(plant.XPos, plant.XEnd, plant.YPos, plant.YEnd, plant.CharIcon); break; case Foiliage.plantType.Fountain: TextDrawings.DisplayFountain(plant.XPos, plant.YPos); break; default: break; } } } }
public static bool BattleLoop(Adventurer adventurer, Universe universe, Slime slime) { TextBoxViews.ClearMapBox(); TextBoxViews.RedrawBox(universe, 6); bool blocked; bool stillAlive = true; TextBoxViews.ReWriteToMessageBox(universe, "A slime attacks!"); Random random = new Random(); do { TextDrawings.DisplaySlime(slime); TextBoxViews.WriteToEvent("Slime : " + slime.Health); TextBoxViews.DisplayPlayerInfo(adventurer); blocked = Attack(adventurer, universe, slime); TextBoxViews.WriteToEvent("Slime : " + slime.Health); if (slime.Health > 0) { SlimeATK(adventurer, universe, slime, blocked); } } while ((adventurer.Health > 0) && (slime.Health > 0)); if (adventurer.Health > 0) { int coinDrop; int gelDrop; int expGain; coinDrop = random.Next(10, 30); gelDrop = random.Next(5, 15); expGain = random.Next(10, slime.ExpGiv); TextBoxViews.WriteToMessageBox(universe, $"You have succeeded in battle and have recieved {coinDrop} coins and {gelDrop} gel."); adventurer.Coins += coinDrop; adventurer.ItemsDictionary[Item.Items.SlimeGel] += gelDrop; adventurer.Experinece += expGain; if (adventurer.Experinece >= adventurer.MaxExperience) { Adventurer.PlayerLevelUp(adventurer, universe); } } else { stillAlive = false; } TextBoxViews.ClearMapBox(); TextBoxViews.RemoveContent(universe, 3); TextBoxViews.DisplayMenu(universe); TextBoxViews.DisplayPlayerInfo(adventurer); return(stillAlive); }