Beispiel #1
0
        static void Main(string[] args)
        {
            Neighbour pesho = new Neighbour("Pesho", int.Parse(Console.ReadLine()));
            Neighbour gosho = new Neighbour("Gosho", int.Parse(Console.ReadLine()));

            while (Neighbour.IsFighting)
            {
                if (Neighbour.turnCounter % 2 == 0)
                {
                    //Gosho turn
                    gosho.Attack(pesho);
                }
                else
                {
                    //Pesho turn
                    pesho.Attack(gosho);
                }
            }
        }
Beispiel #2
0
        public void Attack(Neighbour other)
        {
            other.takeDamage(this.Damage);
            if (!other.IsAlive())
            {
                Console.WriteLine($"{this.Name} won in {turnCounter}th round.");
                IsFighting = false;
            }
            else
            {
                Console.WriteLine($"{this.Name} used {this.SignatureAttack} and reduced {other.Name} to {other.health} health.");
            }

            if (turnCounter % 3 == 0)
            {
                this.Healing();
                other.Healing();
            }

            turnCounter++;
        }