public void AddItem(Item item) { if (item.Modifier.AffectedObject == AffectedObject.Stats && item.Modifier.AffectedValue == "constitution") { HitPoints.AddToMax((int)Math.Floor((item.Modifier.Value / 2.0)) * Level); } _items.Add(item); }
public Character( Name name, int str, int dex, int con, int wis, int _int, int cha) { Name = name; Stats = Stats.SetStats(str, dex, con, wis, _int, cha).Value; HitPoints = HitPoints.NewCharacter().Value; }
public void CalculateNewMaxHitPoints(Class _class) { var addedCon = 0; if (_items != null) { addedCon = _items.Where(e => e.Modifier.AffectedObject == AffectedObject.Stats && e.Modifier.AffectedValue == "constitution").Sum(e => e.Modifier.Value); } Random rand = new Random(); var rolledHp = rand.Next(1, _class.HitDiceValue); var conbonus = (int)Math.Floor(((Stats.Constitution + addedCon) - 10) / 2.0); var addingHp = (rolledHp + conbonus) * _class.ClassLevel; HitPoints.AddToMax(addingHp); }