Ltt Pokemon + Start student admin
This commit is contained in:
parent
4f8b991da6
commit
b5dc3a1e68
12 changed files with 249 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
namespace PokemonMarie;
|
||||
|
||||
public class PokeGym
|
||||
internal class PokeGym
|
||||
{
|
||||
public Trainer GymTrainer { get; private set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace PokemonMarie;
|
||||
|
||||
public class PokeShop
|
||||
internal class PokeShop
|
||||
{
|
||||
|
||||
public List<string> StoreInventory { get; private set; }
|
||||
}
|
|
@ -1,8 +1,29 @@
|
|||
namespace PokemonMarie;
|
||||
|
||||
public class Pokemon
|
||||
internal class Pokemon
|
||||
{
|
||||
int Levet { get; set; }
|
||||
string Type { get; set; }
|
||||
string Name { get; set; }
|
||||
public int Level { get; private set; }
|
||||
public string Type { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public int Health { get; private set; }
|
||||
public int Strength { get; private set; }
|
||||
|
||||
public Pokemon(int level, string name, string type, int health, int strength)
|
||||
{
|
||||
Level = level;
|
||||
Name = name;
|
||||
Type = type;
|
||||
Health = health;
|
||||
Strength = strength;
|
||||
}
|
||||
|
||||
public void Fight(Pokemon opponent)
|
||||
{
|
||||
opponent.LooseHealth(Strength);
|
||||
}
|
||||
|
||||
public void LooseHealth(int strength)
|
||||
{
|
||||
Health -= strength;
|
||||
}
|
||||
}
|
|
@ -2,25 +2,78 @@ using System.ComponentModel.Design;
|
|||
|
||||
namespace PokemonMarie;
|
||||
|
||||
public class PokemonWorld
|
||||
internal class PokemonWorld
|
||||
{
|
||||
public Trainer MyTrainer { get; set; }
|
||||
public Pokemon StartPokemon { get; set; }
|
||||
public List<Pokemon> WildPokemons { get; set; }
|
||||
Random Random { get; set; } = new Random();
|
||||
|
||||
public PokemonWorld()
|
||||
{
|
||||
MyTrainer = new Trainer("Ash");
|
||||
MyTrainer = new Trainer(this, , , "Ash");
|
||||
WildPokemons = new List<Pokemon>()
|
||||
{
|
||||
new Pokemon(),
|
||||
new Pokemon()
|
||||
new Pokemon(11,"Lucario", "Grass",100,100),
|
||||
new Pokemon(12,"Bulbasaur", "Grass",100,100),
|
||||
new Pokemon(13,"Gyarados", "Water",100,100),
|
||||
new Pokemon(14,"Oshawott", "Water",100,100),
|
||||
new Pokemon(15,"Grimer", "Mud",100,100),
|
||||
new Pokemon(16,"Diglett", "Mud",100,100),
|
||||
};
|
||||
Menu();
|
||||
}
|
||||
|
||||
public void Menu()
|
||||
{
|
||||
Console.WriteLine("Welcome to Pokemon");
|
||||
bool appRunning = true;
|
||||
while (appRunning)
|
||||
{
|
||||
Console.WriteLine("What do you want to do?");
|
||||
Console.WriteLine("1. Go to the Wilderness");
|
||||
Console.WriteLine("2. Go to the store");
|
||||
Console.WriteLine("3. Go to a pokemon gym");
|
||||
Console.WriteLine("4. Exit");
|
||||
var choice = Console.ReadLine();
|
||||
switch (choice)
|
||||
{
|
||||
case "1":
|
||||
WildernessMenu();
|
||||
break;
|
||||
case "2":
|
||||
MyTrainer.EnterStore();
|
||||
break;
|
||||
case "3":
|
||||
MyTrainer.GoToGym();
|
||||
break;
|
||||
case "4":
|
||||
appRunning = false;
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Invalid choice");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void WildernessMenu()
|
||||
{
|
||||
var foundPokemon = MyTrainer.GoToWilderness();
|
||||
Console.WriteLine("You found " + foundPokemon.Name );
|
||||
Console.WriteLine("Do you want to (f) fight or (c) catch ?");
|
||||
var input = Console.ReadLine();
|
||||
if (input.ToLower() == "f")
|
||||
{
|
||||
MyTrainer.BattlePokemon(foundPokemon);
|
||||
}
|
||||
else
|
||||
{
|
||||
MyTrainer.CatchPokemon(foundPokemon);
|
||||
}
|
||||
}
|
||||
|
||||
public Pokemon GetRandomPokemon(string type)
|
||||
{
|
||||
var pokemon = WildPokemons.Where(pokemon => pokemon.Type == type).ToList();
|
||||
var randomIndex = Random.Next(0, pokemon.Count);
|
||||
return pokemon[randomIndex];
|
||||
}
|
||||
}
|
|
@ -20,4 +20,6 @@
|
|||
// PokeGym
|
||||
// GymTrainer
|
||||
|
||||
using PokemonMarie;
|
||||
|
||||
new PokemonWorld();
|
||||
|
|
|
@ -2,6 +2,66 @@ namespace PokemonMarie;
|
|||
|
||||
internal class Trainer
|
||||
{
|
||||
public List<string> Inventory { get; set; }
|
||||
public Pokemon Pokemon { get; private set; }
|
||||
public PokemonWorld MyWorld { get; private set; }
|
||||
public List<string> Inventory { get; private set; }
|
||||
public Pokemon StartPokemon { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
|
||||
public Trainer(PokemonWorld myWorld, List<string> inventory, Pokemon startPokemon, string name)
|
||||
{
|
||||
MyWorld = myWorld;
|
||||
Inventory = new List<string>();
|
||||
StartPokemon = new Pokemon(11,"Pikachu", "Lightning",100,100);
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public Pokemon GoToWilderness()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Console.WriteLine("Where do you want to go?");
|
||||
Console.WriteLine("1. Water");
|
||||
Console.WriteLine("2. Grass");
|
||||
Console.WriteLine("3. Mud");
|
||||
var input = Console.ReadLine();
|
||||
|
||||
if (input == "1")
|
||||
{
|
||||
return MyWorld.GetRandomPokemon("Water");
|
||||
} else if (input == "2")
|
||||
{
|
||||
return MyWorld.GetRandomPokemon("Grass");
|
||||
}
|
||||
else
|
||||
{
|
||||
return MyWorld.GetRandomPokemon("Mud");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GoToGym()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void BattlePokemon(Pokemon pokemonToFight)
|
||||
{
|
||||
while (pokemonToFight.Health > 0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void CatchPokemon(Pokemon pokemonToCatch)
|
||||
{
|
||||
|
||||
}
|
||||
public void EnterStore()
|
||||
{
|
||||
|
||||
}
|
||||
public void BuyItem(string itemType)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue