Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp2
- {
- public class Champion
- {
- private string name;
- private double health;
- private double mana;
- private int ap;
- private int ad;
- private int armor;
- private int mr;
- public Champion(string name, double health, double mana, int ap, int ad, int armor, int mr)
- {
- this.name = name;
- this.health = health;
- this.mana = mana;
- this.ap = ap;
- this.ad = ad;
- this.armor = armor;
- this.mr = mr;
- }
- public string ToString()
- {
- return $"Name: {name} \nHealth: {health} ";
- }
- public string GetName()
- {
- return name;
- }
- /*
- * this champion get damaged by ap and reduced by mr
- * return true if this champion still a live. false if dead.
- */
- private bool DamageTakenAP(double ap)
- {
- this.health -= (ap * 100 / (100 + this.mr));
- return this.health > 0;
- }
- private bool DamgeTakenAd(double ad)
- {
- this.health -= (ad * 100 / (100 + this.armor));
- return this.health > 0;
- }
- /*
- * Deal damage to other champion
- */
- public bool DamageDealtAP(Champion other)
- {
- other.DamageTakenAP(this.ap);
- return other.health <= 0;
- }
- public bool DamgeDealtAd(Champion other)
- {
- other.DamgeTakenAd(this.ad);
- return other.health <= 0;
- }
- }
- public class Program
- {
- static bool Attack(Champion attacker, Champion defender)
- {
- }
- static void Main(string[] args)
- {
- Champion Annie = new Champion("Annie", 1000, 500, 100, 50, 60, 70);
- Champion Cait = new Champion("Caitlyn", 1000, 300, 0, 100, 60, 70);
- while (true)
- {
- Champion champion;
- Console.WriteLine($"Choose Champion: \na- {Annie.GetName()}\nc- {Cait.GetName()}");
- string choice = Console.ReadLine();
- if (choice == "a")
- {
- champion = Annie;
- }
- else if (choice == "c")
- {
- champion = Cait;
- }
- else
- {
- Console.WriteLine($"No champion {choice}!");
- continue;
- }
- Console.WriteLine($"Champion Status: {champion.ToString()}");
- Console.WriteLine("Choose an action: \n1- Attack.\n2- FF!\n3- Go Next?");
- choice = Console.ReadLine();
- switch (choice)
- {
- case "1":
- if (champion == Annie)
- champion.DamageDealtAP(Cait);
- else
- champion.DamageDealtAP(Annie);
- break;
- case "2":
- Console.WriteLine("Not yet implemented!");
- break;
- case "3":
- break;
- default:
- Console.WriteLine("Wrong choice!! Go Next selected!");
- break;
- }
- // continue;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement