예제 #1
0
        public void TestBarbarianMeleeConditionsWithFinesseWeapons()
        {
            History.TimeClock = new DndTimeClock();
            Character fred = AllPlayers.GetFromId(PlayerID.Fred);
            DndGame   game = DndGame.Instance;

            game.GetReadyToPlay();
            game.AddPlayer(fred);
            game.Start();
            fred.StartTurnResetState();
            AssignedFeature barbarianMelee = fred.GetFeature("BarbarianMelee");

            Assert.IsFalse(barbarianMelee.ShouldActivateNow());

            fred.ActivateFeature("WildSurgeRage");
            Assert.IsFalse(barbarianMelee.ShouldActivateNow());              // Not yet. We need to be using the right weapon.

            PlayerActionShortcut dagger = fred.GetShortcut("Dagger");

            Assert.IsNotNull(dagger);
            fred.Use(dagger);
            Assert.IsTrue(barbarianMelee.ShouldActivateNow());

            fred.baseDexterity = 18;
            fred.baseStrength  = 10;
            dagger.UpdatePlayerAttackingAbility(fred);
            fred.Use(dagger);
            Assert.IsFalse(barbarianMelee.ShouldActivateNow());              // Should not be satisfied because dexterity is now the ability of choice to use with this finesse weapon.
        }
예제 #2
0
        public void TestBarbarianMeleeRageExpiration()
        {
            AllPlayers.Invalidate();
            AllFeatures.Invalidate();
            History.TimeClock = new DndTimeClock();
            Character fred = AllPlayers.GetFromId(PlayerID.Fred);
            DndGame   game = DndGame.Instance;

            game.GetReadyToPlay();
            game.AddPlayer(fred);
            game.Start();

            fred.StartTurnResetState();
            AssignedFeature barbarianMelee = fred.GetFeature("BarbarianMelee");

            Assert.IsFalse(barbarianMelee.ShouldActivateNow());

            fred.ActivateFeature("WildSurgeRage");
            PlayerActionShortcut greataxe = fred.GetShortcut("Greataxe");

            fred.Use(greataxe);

            Assert.IsTrue(barbarianMelee.ShouldActivateNow());

            // Now test alarm system to turn off rage after one minute....
            History.TimeClock.Advance(DndTimeSpan.FromSeconds(59));
            Assert.IsTrue(barbarianMelee.ShouldActivateNow());
            History.TimeClock.Advance(DndTimeSpan.FromSeconds(1));
            Assert.IsFalse(barbarianMelee.ShouldActivateNow());
        }
예제 #3
0
        public void TestBarbarianMeleeConditionsWithVariousWeapons()
        {
            AllPlayers.Invalidate();
            History.TimeClock = new DndTimeClock();
            Character fred = AllPlayers.GetFromId(PlayerID.Fred);
            DndGame   game = DndGame.Instance;

            game.GetReadyToPlay();
            game.AddPlayer(fred);
            game.Start();
            fred.StartTurnResetState();
            AssignedFeature barbarianMelee = fred.GetFeature("BarbarianMelee");

            Assert.IsFalse(barbarianMelee.ShouldActivateNow());

            fred.ActivateFeature("WildSurgeRage");
            Assert.IsFalse(barbarianMelee.ShouldActivateNow());              // Not yet. We need to be using the right weapon.

            PlayerActionShortcut greataxe = fred.GetShortcut("Greataxe");

            Assert.IsNotNull(greataxe);
            fred.Use(greataxe);

            Assert.IsTrue(Expressions.GetBool("InRage", fred));
            Assert.IsTrue(Expressions.GetBool("AttackIsMelee", fred));
            Assert.IsTrue(Expressions.GetBool("AttackingWith(strength)", fred));
            Assert.IsTrue(barbarianMelee.ShouldActivateNow());

            PlayerActionShortcut longbow = fred.GetShortcut("Longbow");

            fred.Use(longbow);
            Assert.IsFalse(barbarianMelee.ShouldActivateNow());
        }
예제 #4
0
        public void TestBarbarianMeleeConditions()
        {
            Character fred = AllPlayers.GetFromId(PlayerID.Fred);
            DndGame   game = DndGame.Instance;

            game.GetReadyToPlay();
            game.AddPlayer(fred);
            game.Start();
            fred.StartTurnResetState();
            AssignedFeature barbarianMelee = fred.GetFeature("BarbarianMelee");

            Assert.IsFalse(barbarianMelee.ShouldActivateNow());
            Expressions.Do("Set(_rage,true)", fred);
            fred.GetAttackingAbilityModifier(WeaponProperties.Melee, AttackType.Melee);
            Assert.IsTrue(barbarianMelee.ShouldActivateNow());
        }