Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace FightingArena
- {
- using System;
- using System.Collections.Generic;
- using System.Text;
- public class Gladiator
- {
- public Gladiator(string name, Stat stat, Weapon weapon)
- {
- this.Name = name;
- this.Stat = stat;
- this.Weapon = weapon;
- }
- public string Name { get; set; }
- public Stat Stat { get; set; }
- public Weapon Weapon { get; set; }
- // return the sum of the weapon properties.
- public int GetWeaponPower()
- {
- int power = this.Weapon.Sharpness + this.Weapon.Size + this.Weapon.Solidity;
- return power;
- }
- // return the sum of the stat properties.
- public int GetStatPower()
- {
- int power = this.Stat.Agility + this.Stat.Flexibility + this.Stat.Intelligence + this.Stat.Skills;
- return power;
- }
- // return the sum of the stat properties plus the sum of the weapon properties
- public int GetTotalPower()
- {
- return GetWeaponPower() + GetStatPower();
- }
- public override string ToString()
- {
- var sb = new StringBuilder();
- sb.AppendLine($"{this.Name} - {this.GetTotalPower()}");
- sb.AppendLine($" Weapon Power: {this.GetWeaponPower()}");
- sb.AppendLine($" Stat Power: {this.GetStatPower()}");
- return sb.ToString().Trim();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement