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;
- using System.Threading;
- namespace KIll_Joe
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<person> players = new List<person>();
- Console.WriteLine("How many players do you want? ");
- int amount = Convert.ToInt16(Console.ReadLine());
- string name;
- string alergy;
- int age;
- for (int i =0;i<amount;i++)
- {
- Console.WriteLine("\n Infomation for player " + (i + 1));
- Console.WriteLine("Enter name ");
- name = Console.ReadLine();
- Console.WriteLine("Enter age");
- age = Convert.ToInt16(Console.ReadLine());
- Console.WriteLine("Enter alegergy");
- alergy = Console.ReadLine();
- players.Add(new person(name, age, alergy));
- }
- person ben = new person("Ben", 17, "Apples");
- person joe = new person("Joe", 17, "Apples");
- ben.attack(joe);
- Console.ReadLine();
- }
- }
- class person
- {
- Random random = new Random();
- static public int hp = 100;
- static public bool alive = true;
- private string name;
- private string allergy;
- private int age;
- private int attackStrenght;
- private int soak;
- public person(string name,int age,string allergy)
- {
- this.name = name;
- this.age = age;
- this.attackStrenght = random.Next() % 200;
- Console.WriteLine("Attack strenght is " + attackStrenght);
- this.allergy = allergy;
- this.soak = random.Next() % 25;
- Console.WriteLine("Soak is " + attackStrenght);
- }
- public void dead()
- {
- Console.WriteLine(name+" has died");
- alive = false;
- output_stats();
- }
- public int getHp()
- {
- return hp;
- }
- public void ChangeHp(int newHp)
- {
- hp = newHp;
- }
- public void attack(person enemy)
- {
- Console.WriteLine(name + " is attacking " + enemy.name);
- if (attackStrenght >= enemy.soak)
- {
- enemy.ChangeHp(enemy.getHp() - (attackStrenght - enemy.soak));
- }
- if (enemy.getHp() <= 0)
- {
- enemy.dead();
- }
- enemy.output_stats();
- }
- public void eat_food(string food)
- {
- if (food == allergy)
- {
- Console.WriteLine("Urrrr.....That thats worse than a democrat");
- hp -= random.Next() % hp;
- }
- else
- {
- Console.WriteLine("Mmmm.......that tastes better than a republican");
- hp += random.Next() % (hp / 2);
- }
- output_stats();
- }
- public void output_stats()
- {
- Console.WriteLine("\n\n\n");
- Console.WriteLine("..............................................");
- Console.WriteLine("..........Stats...............................");
- Console.WriteLine("Name :.................................. " + name);
- Console.WriteLine("Age :.................................. " + age);
- Console.WriteLine("Hp :.................................. " + hp);
- Console.WriteLine("Allergy :.................................. " + allergy);
- Console.WriteLine("Attack Strnenght :.................................. " + attackStrenght);
- }
Advertisement
Add Comment
Please, Sign In to add comment