Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PokemonGen1
- {
- class Pokemon
- {
- private string name;
- private int size;
- private int strength;
- private int weight;
- private int energy;
- private int victory;
- private bool life = false;
- public void fill_name()
- {
- Console.WriteLine("Welcome gamer! please chose your Pokemon:"); // pick a 1st gen Pokemon
- name = Console.ReadLine();
- }
- public void fill_values() // generate the Pokemons data
- {
- int count = 100;
- Console.WriteLine("Please fill in your Pokemons data:");
- Console.WriteLine("Size:");
- size = Convert.ToInt32(Console.ReadLine());
- int result = count - size;
- Console.WriteLine("Its size is:{0} and remaining points left: {1}", size, result);
- Console.WriteLine("Strength:");
- strength = Convert.ToInt32(Console.ReadLine());
- result = result - strength;
- Console.WriteLine("Its power is:{0} and remaining points left: {1}", strength, result);
- Console.WriteLine("Weight:");
- weight = Convert.ToInt32(Console.ReadLine());
- result = result - weight;
- Console.WriteLine("Its weight is:{0} and remaining points left: {1}", weight, result);
- Console.WriteLine("Energy:");
- energy = Convert.ToInt32(Console.ReadLine());
- result = result - energy;
- Console.WriteLine("Its energy is:{0} and remaining points left: {1}", energy, result);
- }
- public void check_values() // check if the Data inserted match the discription
- {
- if (weight >= (energy + strength))
- {
- Console.WriteLine("the sum of the energy and strength must be atleast as great than the weight");
- }
- if ((weight + size + strength + energy) > 100)
- {
- Console.WriteLine("the entire sum must be under 100");
- }
- else
- {
- victory = 0;
- life = true;
- Console.WriteLine("Your pokemon {0} is ready for combat!", name);
- }
- }
- public void fill_random() // 2nd possibility is to randomize the data
- {
- Random rnd_size = new Random();
- size = rnd_size.Next(0, 25);
- Random rnd_str = new Random();
- strength = rnd_str.Next(0, 25);
- Random rnd_wei = new Random();
- weight = rnd_wei.Next(0, 25);
- Random rnd_ene = new Random();
- energy = rnd_ene.Next(0, 25);
- life = true;
- Console.WriteLine("The random generated nrs for the Pokemon: Size {0}, Strength {1}, Weight {2}, Energy {3}", size, strength, weight, energy);
- }
- public Pokemon fightmenu(Pokemon rival) // pick the method to battle your rival
- {
- Console.WriteLine(" {0} is ready to fight!", name);
- Console.WriteLine("Choose (1) for creating your rival pokemon, choose (2) to random a rival ");
- int choice = Convert.ToInt32(Console.ReadLine());
- if (choice == 1)
- {
- rival.fill_name();
- do
- {
- rival.fill_values();
- rival.check_values();
- } while (rival.life == false);
- return rival;
- }
- else if (choice == 2)
- {
- rival.fill_name();
- rival.fill_random();
- return rival;
- }
- else
- {
- Console.WriteLine("Wrong Input!");
- return rival;
- }
- }
- public void fight(Pokemon rival) // commence battle
- {
- Console.WriteLine("Prepare for battle!");
- Pokemon big = new Pokemon();
- Pokemon small = new Pokemon();
- if (this.size == rival.size)
- {
- if (this.victory == rival.victory)
- {
- Random zz1 = new Random();
- if (zz1.Next(0, 1) == 0)
- {
- big = this;
- small = rival;
- }
- else
- {
- big = rival;
- small = this;
- }
- }
- else if (this.victory > rival.victory)
- {
- big = this;
- small = rival;
- }
- else
- {
- big = rival;
- small = this;
- }
- }
- else if (this.size > rival.size)
- {
- big = this;
- small = rival;
- }
- else
- {
- big = rival;
- small = this;
- }
- while (small.energy > 1 && big.energy > 1)
- {
- if (small.strength < big.weight)
- {
- small.energy /= 2;
- }
- else
- {
- small.strength -= big.weight;
- }
- if (big.strength < small.weight)
- {
- big.energy /= 2;
- }
- else
- {
- big.strength -= small.weight;
- }
- }
- if (small.energy <= 1)
- {
- small.life = false;
- big.victory++;
- }
- else if (big.energy <= 1)
- {
- big.life = false;
- small.victory++;
- }
- big.output();
- small.output();
- Console.WriteLine();
- }
- public void output()
- {
- Console.WriteLine("Name = " + name);
- Console.WriteLine("Size = " + size);
- Console.WriteLine("strength = " + strength);
- Console.WriteLine("weight = " + weight);
- Console.WriteLine("Energy = " + energy);
- Console.WriteLine("Victory = " + victory);
- Console.WriteLine("Life = " + life);
- }
- class Program
- {
- static void Main(string[] args)
- {
- Pokemon myPoke1 = new Pokemon();
- bool temp_menu = false;
- myPoke1.fill_name();
- do
- {
- myPoke1.fill_values();
- myPoke1.check_values();
- } while (myPoke1.life == false);
- do
- {
- Console.WriteLine("Battle?\n(1)Y!\n(2)N!");
- int input = Convert.ToInt32(Console.ReadLine());
- if (input == 1)
- {
- Pokemon myPoke2 = new Pokemon();
- myPoke1.fightmenu(myPoke2);
- myPoke1.fight(myPoke2);
- temp_menu = true;
- }
- else
- {
- Console.WriteLine("Oh well! . . .Better luck next time");
- temp_menu = true;
- }
- } while (temp_menu == true);
- Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement