コード例 #1
0
        public void TestSet_Stat()
        {
            var room = InARoom(out IWorld world);

            var effect = new EffectBlueprint()
            {
                Set = "Fight+5"
            }.Create().Single();

            effect.Apply(GetSystemArgs(null, room));
            Assert.AreEqual(5, room.BaseStats["Fight"]);
        }
コード例 #2
0
        public void TestSet_Variable()
        {
            var room = InARoom(out IWorld world);

            var effect = new EffectBlueprint()
            {
                Set = "X+5"
            }.Create().Single();

            effect.Apply(GetSystemArgs(null, room));
            Assert.AreEqual(5, room.V["X"]);
        }
コード例 #3
0
ファイル: ApplyEffectTests.cs プロジェクト: tznind/Wanderer
        public void Test_ApplySystem(SystemArgsTarget target, bool toAll)
        {
            TwoInARoom(out You you, out IActor them, out IWorld world);

            world.InjurySystems.Add(new InjurySystem()
            {
                Name     = "Violence",
                Injuries = new List <InjuryBlueprint> {
                    new InjuryBlueprint()
                    {
                        Name = "Cracked Rib"
                    }
                }
            });

            var blue = new EffectBlueprint()
            {
                Target = target,
                Apply  = new ApplySystemBlueprint()
                {
                    Name      = "Violence",
                    Intensity = 40,
                    All       = toAll
                }
            };

            var effect = (ApplyEffect)blue.Create().Single();

            effect.Apply(new SystemArgs(world, new FixedChoiceUI(), 0, you, them, Guid.NewGuid()));

            if (toAll)
            {
                Assert.IsTrue(you.Has("Injured"));
                Assert.IsTrue(them.Has("Injured"));
            }
            else
            if (target == SystemArgsTarget.Aggressor)
            {
                Assert.IsTrue(you.Has("Injured"));
                Assert.IsFalse(them.Has("Injured"));
            }
            else
            if (target == SystemArgsTarget.Recipient)
            {
                Assert.IsFalse(you.Has("Injured"));
                Assert.IsTrue(them.Has("Injured"));
            }
        }
コード例 #4
0
        public void TestEffect_KillPlayer()
        {
            TwoInARoom(out You you, out IActor them, out IWorld world);

            var effect = new EffectBlueprint()
            {
                Kill = "Nukes"
            }.Create().Single();

            Assert.IsFalse(you.Dead);
            Assert.IsFalse(them.Dead);

            effect.Apply(GetSystemArgs(you, them));

            Assert.IsTrue(you.Dead);
            Assert.IsFalse(them.Dead);
        }