Ejemplo n.º 1
0
        public void Nature_strikes_neighboring_rot_through_our_hero()
        {
            var    player = BeingCreator.CreateBeing("Suvail");
            var    am     = new AttackMethod("physical.impact.blunt", "1d3 +2");
            var    rot    = new AreaRot();
            Attack attack = new Attack
            {
                Attacker      = player,
                AttackMethod  = am,
                Defender      = rot,
                DefenseMethod = rot.GetDefenseMethod(am)
            };

            RotMap rotMap = new RotMap();
            //...add two neighbor ABs, and one further away
            var nbor_1   = new AreaRot();
            var nbor_2   = new AreaRot();
            var stranger = new AreaRot();

            rotMap.Add(rot, (2, 2));
            rotMap.Add(nbor_1, (2, 3));
            rotMap.Add(nbor_2, (3, 1));
            rotMap.Add(stranger, (8, 2));

            GameState gs = new GameState();
            var       cm = new CompoundMap();

            cm.RotMap = rotMap;
            gs.Map    = cm;

            var asys = new AttackSystem {
                GameState = gs
            };

            SourceMe.InjectProperties(asys);

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(0));

            asys.CheckForSpecials(attack);

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(4));

            var splashBack = asys.AttackQueue.Dequeue();

            Assert.NotNull(splashBack);

            var newAttack = asys.AttackQueue.Dequeue();

            Assert.That(newAttack.Defender, Is.EqualTo(rot));

            newAttack = asys.AttackQueue.Dequeue();
            Assert.That(newAttack.Defender, Is.EqualTo(nbor_2));
            newAttack = asys.AttackQueue.Dequeue();
            Assert.That(newAttack.Defender, Is.EqualTo(nbor_1));
        }
Ejemplo n.º 2
0
        public void Nature_strikes_the_rot_through_our_hero()
        {
            GameState gs = new GameState();
            var       cm = new CompoundMap();

            cm.RotMap = new RotMap();
            gs.Map    = cm;

            var asys = new AttackSystem();

            asys.GameState = gs;
            SourceMe.InjectProperties(asys);

            var    player = BeingCreator.CreateBeing("Suvail");
            var    am     = new AttackMethod("physical.impact.blunt", "1d3 +2");
            var    rot    = new AreaRot();
            Attack attack = new Attack
            {
                Attacker      = player,
                AttackMethod  = am,
                Defender      = rot,
                DefenseMethod = rot.GetDefenseMethod(am)
            };

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(0));

            asys.CheckForSpecials(attack);

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(2));

            var splashBack = asys.AttackQueue.Dequeue();

            Assert.NotNull(splashBack);

            var newAttack = asys.AttackQueue.Dequeue();
            var newAM     = newAttack.AttackMethod;
            var newAE     = newAM.AttackEffects[0];

            Assert.That(newAE.Type, Is.EqualTo("vital.nature.itself"));
            Assert.That(newAttack.Defender, Is.EqualTo(rot));
            Assert.That(newAttack.Attacker, Is.EqualTo(player));
        }