Advertisement
Guest User

Gladiator

a guest
Jun 21st, 2019
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace FightingArena
  6. {
  7.     public class Gladiator
  8.     {
  9.         public string Name { get; set; }
  10.         public Stat Stat { get; set; }
  11.         public Weapon Weapon { get; set; }
  12.  
  13.         public Gladiator(string Name, Stat Stat, Weapon Weapon)
  14.         {
  15.             this.Name = Name;
  16.             this.Stat = Stat;
  17.             this.Weapon = Weapon;
  18.         }
  19.  
  20.         // return the sum of the stat properties plus the sum of the weapon properties
  21.         public int GetTotalPower()
  22.         {
  23.             return GetWeaponPower() + GetStatPower();
  24.         }
  25.         // return the sum of the weapon properties.
  26.         public int GetWeaponPower()
  27.         {
  28.             int power = this.Weapon.Sharpness + this.Weapon.Size + this.Weapon.Solidity;
  29.             return power;
  30.         }
  31.         // return the sum of the stat properties.
  32.         public int GetStatPower()
  33.         {
  34.             int power = this.Stat.Agility + this.Stat.Flexibility
  35.                 + this.Stat.Intelligence + this.Stat.Skills + this.Stat.Strength;
  36.             return power;
  37.         }
  38.         public override string ToString()
  39.         {
  40.             StringBuilder builder = new StringBuilder();
  41.  
  42.             builder.AppendLine($"{this.Name} - {this.GetTotalPower()}");
  43.             builder.AppendLine($"  Weapon Power: {this.GetWeaponPower()}");
  44.             builder.AppendLine($"  Stat Power: {this.GetStatPower()}");
  45.  
  46.             return builder.ToString();
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement