/// <summary>
 /// Method to have two <see cref="WarriorModel"/> do Battle.
 /// </summary>
 /// <param name="attackingWarrior">Attacking Warrior.</param>
 /// <param name="defendingWarrior">Defending Warrior.</param>
 public void Battle(WarriorModel attackingWarrior, WarriorModel defendingWarrior)
 {
     if (attackingWarrior.Strength > defendingWarrior.Defence)
     {
         defendingWarrior.CurrentHealth -= (short)(attackingWarrior.Strength - defendingWarrior.Defence);
     }
     else if (attackingWarrior.Strength < defendingWarrior.Defence)
     {
         attackingWarrior.CurrentHealth -= (short)(defendingWarrior.Defence - attackingWarrior.Strength);
     }
     else
     {
         if (defendingWarrior.Strength > attackingWarrior.Defence)
         {
             attackingWarrior.CurrentHealth -= (short)(defendingWarrior.Strength - attackingWarrior.Defence);
         }
         else if (defendingWarrior.Strength < attackingWarrior.Defence)
         {
             defendingWarrior.CurrentHealth -= (short)(attackingWarrior.Defence - defendingWarrior.Strength);
         }
         else
         {
             attackingWarrior.CurrentHealth--;
             defendingWarrior.CurrentHealth--;
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VisualWarriorModel"/> class.
 /// </summary>
 /// <param name="model">The <see cref="WarriorModel"/> to visualize.</param>
 public VisualWarriorModel(WarriorModel model)
 {
     this.MaxHealth     = model.MaxHealth;
     this.CurrentHealth = model.CurrentHealth;
     this.Strength      = model.Strength;
     this.Defence       = model.Defence;
     this.Awarenes      = model.Awarenes;
 }