Ejemplo n.º 1
0
        public void TestHasCondition_InvertLogic_SystemArgs()
        {
            TwoInARoom(out You you, out IActor them, out IWorld world);

            var condition = new HasCondition("fff", SystemArgsTarget.Aggressor)
            {
                InvertLogic = true
            };

            //everyone meets condition
            Assert.IsTrue(condition.IsMet(world, new SystemArgs(world, new FixedChoiceUI(), 0, you, them, Guid.Empty)));
            Assert.IsTrue(condition.IsMet(world, new SystemArgs(world, new FixedChoiceUI(), 0, null, them, Guid.Empty)));

            //you are now disqualified
            you.BaseActions.Add(new TestAction(world.Player)
            {
                Name = "fff"
            });

            // When args include both an Aggressor and a Recipient then the condition favors the Aggressor
            Assert.IsTrue(condition.IsMet(world, new SystemArgs(world, new FixedChoiceUI(), 0, them, you, Guid.Empty)));
            Assert.IsFalse(condition.IsMet(world, new SystemArgs(world, new FixedChoiceUI(), 0, you, them, Guid.Empty)));

            // When args only have a Recipient then the condition tests the Recipient
            Assert.IsTrue(condition.IsMet(world, new SystemArgs(world, new FixedChoiceUI(), 0, null, them, Guid.Empty)));
            Assert.IsFalse(condition.IsMet(world, new SystemArgs(world, new FixedChoiceUI(), 0, null, you, Guid.Empty)));
        }
Ejemplo n.º 2
0
        public void TestHasCondition_Actor()
        {
            YouInARoom(out IWorld world);

            var condition = new HasCondition("fff", SystemArgsTarget.Aggressor);

            Assert.IsFalse(condition.IsMet(world, GetSystemArgs(world.Player)));

            world.Player.BaseActions.Add(new TestAction(world.Player)
            {
                Name = "fff"
            });

            Assert.IsTrue(condition.IsMet(world, GetSystemArgs(world.Player)));
        }