예제 #1
0
파일: Ship.cs 프로젝트: andy-uq/Echo
        public Ship(ShipBlueprint blueprint)
            : this()
        {
            Owner = blueprint.Owner;
            SetHardPoints(blueprint.HardPoints);
            Speed = blueprint.Speed;

            stats = new ShipStatistics(blueprint.Stats);
        }
예제 #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);
            }
        }
예제 #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)));
        }
예제 #4
0
파일: Blueprint.cs 프로젝트: andy-uq/Echo
 public ShipBlueprint()
 {
     Stats = new ShipStatistics();
 }
예제 #5
0
파일: Ship.cs 프로젝트: andy-uq/Echo
 private Ship()
 {
     Speed = 1d;
     this.hardPoints = new List<HardPoint>();
     this.stats = new ShipStatistics();
 }
예제 #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);
        }
예제 #7
0
 public void SetUp()
 {
     _shipStatistics = new ShipStatistics(StatFactory());
 }
예제 #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));
        }