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()); }
public void TestBarbarianMeleeDeactivate() { AllPlayers.Invalidate(); AllFeatures.Invalidate(); DndGame game = DndGame.Instance; game.GetReadyToPlay(); Character fred = AllPlayers.GetFromId(PlayerID.Fred); game.AddPlayer(fred); game.Start(); PlayerActionShortcut greataxe = fred.GetShortcut("Greataxe"); fred.Use(greataxe); CharacterClass barbarianClass = fred.Classes.FirstOrDefault(x => x.Name == "Barbarian"); Assert.IsNotNull(barbarianClass); barbarianClass.Level = 16; fred.ResetPlayerActionBasedState(); Assert.AreEqual(0, fred.damageOffsetThisRoll); fred.ActivateFeature("WildSurgeRage"); Assert.AreEqual(0, fred.damageOffsetThisRoll); fred.Use(greataxe); Assert.AreEqual(4, fred.damageOffsetThisRoll); AssignedFeature rageFeature = fred.GetFeature("WildSurgeRage"); Assert.IsTrue(rageFeature.Feature.IsActive); Expressions.Do("Set(_rage,false)", fred); Assert.IsFalse(rageFeature.Feature.IsActive); Assert.IsFalse(fred.GetFeature("BarbarianMelee").Feature.IsActive); fred.Use(greataxe); Assert.IsFalse(fred.GetFeature("BarbarianMelee").Feature.IsActive); Assert.AreEqual(0, fred.damageOffsetThisRoll); fred.ActivateFeature("WildSurgeRage"); Assert.IsTrue(fred.GetFeature("BarbarianMelee").Feature.IsActive); Assert.AreEqual(4, fred.damageOffsetThisRoll); fred.DeactivateFeature("WildSurgeRage"); Assert.IsFalse(fred.GetFeature("BarbarianMelee").Feature.IsActive); Assert.AreEqual(0, fred.damageOffsetThisRoll); }
private static Character StartNewGame(string playerClass, int level, string weapon = null) { AllPlayers.Invalidate(); AllFeatures.Invalidate(); DndGame game = DndGame.Instance; game.GetReadyToPlay(); Character player = PlayerHelper.GetPlayerAtLevel(playerClass, level); game.AddPlayer(player); if (weapon != null) { player.AddWeapon(weapon); } game.Start(); return(player); }
public void TestSpellRangeTest() { Spell chaosBolt = AllSpells.Get(SpellNames.ChaosBolt); AllPlayers.Invalidate(); AllFeatures.Invalidate(); DndGame game = DndGame.Instance; game.GetReadyToPlay(); Character sorcerer = PlayerHelper.GetPlayerAtLevel("Sorcerer", 6); sorcerer.name = "Mark"; game.AddPlayer(sorcerer); Monster joe = MonsterBuilder.BuildVineBlight("Joe"); game.AddCreature((Creature)joe); game.Start(); PositionCreatures(@" ┌───────────────┐ │ │ │ │ │ M │ │ │ │ └───────────────┐ │ │ │ │ │ │ │ │ │ ┌───────────────┘ │ J │ │ │ │ │ │ │ │ │ └───────────────┘", game.AllCreatures); Assert.AreEqual(40, sorcerer.CanCast(chaosBolt).DistanceTo(joe)); Assert.IsTrue(sorcerer.CanCast(chaosBolt).At(joe)); PositionCreatures(@" ┌───────────────┐ │ │ │ │ │ M │ │ │ │ └───────────────┐ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌───────────────┘ │ J │ │ │ │ │ │ │ │ │ └───────────────┘", game.AllCreatures); Assert.AreEqual(125, sorcerer.CanCast(chaosBolt).DistanceTo(joe)); Assert.IsFalse(sorcerer.CanCast(chaosBolt).At(joe)); }