protected void Init(string name, BasicStatiscits statistics = null) { ActiveGear = new Gear(); Name = name; Inventory = new Inventory(); BaseStatiscits = statistics ?? BasicStatiscits.GenerateRandom(); MaxHealth = PlayerConfig.DEFAULT_HEALTH + (PlayerConfig.DEFAULT_HEALTH * BaseStatiscits.Health / 100); CurrentHealth = PlayerConfig.DEFAULT_HEALTH + (PlayerConfig.DEFAULT_HEALTH * BaseStatiscits.Health / 100); Friends = new List <Player>(); ConsoleEx.Log($"Created new player: {Name}", ConsoleColor.Magenta); }
public void UpdateStatistic(Gear gear, BasicStatiscits BaseStatiscits) { int currentArmor = 0; gear.GetType().GetProperties().ToList().ForEach(prop => { if (typeof(DefensiveItem).IsAssignableFrom(prop.PropertyType)) { var a = (DefensiveItem)prop.GetValue(prop); currentArmor += a.Defence; } }); Armor = currentArmor; Damage = (int)gear.PrimaryWeapon.Power + BaseStatiscits.Agility * BaseStatiscits.Health; }
public Player(Guid id, string name, BasicStatiscits statistics = null) { Id = id; Init(name, statistics); }
public Player(string name, BasicStatiscits statistics = null) { Id = Guid.NewGuid(); Init(name, statistics); }