public Ship(ShipBlueprint blueprint) : this() { Owner = blueprint.Owner; SetHardPoints(blueprint.HardPoints); Speed = blueprint.Speed; stats = new ShipStatistics(blueprint.Stats); }
public ShipStatistics(ShipStatistics factoryStats) { this.stats = new Dictionary<ShipStatistic, ShipStatisticValue>(); foreach ( ShipStatistic stat in Enum.GetValues(typeof(ShipStatistic)) ) { var val = (factoryStats == null) ? new ShipStatisticValue(stat, 0) : factoryStats[stat]; this.stats.Add(stat, val); } }
public void DefaultStats() { var empty = new ShipStatistics(); var armours = ( from DamageType d in Enum.GetValues(typeof(DamageType)) select empty.ArmourStrength(d) ); Assert.That(armours, Is.All.Matches<ShipStatisticValue>(x => Units.IsZero(x.Value))); }
public ShipBlueprint() { Stats = new ShipStatistics(); }
private Ship() { Speed = 1d; this.hardPoints = new List<HardPoint>(); this.stats = new ShipStatistics(); }
public void HullIntegrity() { var x = new ShipStatistics(StatFactory()); var hullIntegrity = x[ShipStatistic.HullIntegrity]; Assert.That(hullIntegrity.Value, Is.EqualTo(1000)); var shipDamage = new Damage(DamageType.Ballistic) { Value = 10 }; hullIntegrity.Alter(shipDamage); Assert.That(hullIntegrity.Value, Is.EqualTo(1000)); Assert.That(hullIntegrity.CurrentValue, Is.EqualTo(990)); Assert.That(hullIntegrity.Debuffs.Any(), Is.True); }
public void SetUp() { _shipStatistics = new ShipStatistics(StatFactory()); }
public void SetInitialValues() { var empty = new ShipStatistics(); empty[ShipStatistic.HullIntegrity].SetValue(1000d); Assert.That(empty[ShipStatistic.HullIntegrity].Value, Is.EqualTo(1000d)); Assert.That(empty[ShipStatistic.HullIntegrity].CurrentValue, Is.EqualTo(1000d)); empty[ShipStatistic.HullIntegrity].SetValue(10000d, empty[ShipStatistic.HullIntegrity].CurrentValue); Assert.That(empty[ShipStatistic.HullIntegrity].Value, Is.EqualTo(10000d)); Assert.That(empty[ShipStatistic.HullIntegrity].CurrentValue, Is.EqualTo(1000d)); }