Beispiel #1
0
        public Ship(ShipBlueprint blueprint)
            : this()
        {
            Owner = blueprint.Owner;
            SetHardPoints(blueprint.HardPoints);
            Speed = blueprint.Speed;

            stats = new ShipStatistics(blueprint.Stats);
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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)));
        }
Beispiel #4
0
 public ShipBlueprint()
 {
     Stats = new ShipStatistics();
 }
Beispiel #5
0
 private Ship()
 {
     Speed = 1d;
     this.hardPoints = new List<HardPoint>();
     this.stats = new ShipStatistics();
 }
Beispiel #6
0
        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);
        }
Beispiel #7
0
 public void SetUp()
 {
     _shipStatistics = new ShipStatistics(StatFactory());
 }
Beispiel #8
0
        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));
        }