Example #1
0
        public void Move(Warrior warrior)
        {
            int hp = warrior.HP;

            if (hp > 70)
            {
                warrior.SetState(new NormalState());
                warrior.Move();
            }
            else if (hp <= 30)
            {
                warrior.SetState(new DesperateState());
                warrior.Move();
            }
            else
            {
                Console.WriteLine($"HP = {warrior.HP}, furry state so attack add 30%!");
            }
        }
Example #2
0
        public void Move(Warrior warrior)
        {
            int hp = warrior.HP;

            if (hp == 0)
            {
                warrior.SetState(new UnableState());
                warrior.Move();
            }
            else if (hp > 30)
            {
                warrior.SetState(new FuryState());
                warrior.Move();
            }
            else
            {
                Console.WriteLine($"HP = {hp}, do-or-die defenders, attack increase 30% and defense increase 50%");
            }
        }
Example #3
0
 public void Move(Warrior warrior)
 {
     if (warrior.HP > 70)
     {
         Console.WriteLine($"HP = {warrior.HP}, Normal State.");
     }
     else
     {
         warrior.SetState(new FuryState());
         warrior.Move();
     }
 }