public void TestConditionalGrapple() { Monster vineBlight = MonsterBuilder.BuildVineBlight(); Character barbarian1 = CharacterBuilder.BuildTestBarbarian(); Character barbarian2 = CharacterBuilder.BuildTestBarbarian(); Character elf = CharacterBuilder.BuildTestElf(); Character druid = CharacterBuilder.BuildTestDruid(); elf.creatureSize = CreatureSize.Small; barbarian1.creatureSize = CreatureSize.Huge; Assert.IsFalse(barbarian1.HasCondition(Conditions.Grappled)); Assert.IsFalse(elf.HasCondition(Conditions.Grappled)); Assert.IsFalse(druid.HasCondition(Conditions.Grappled)); int attackRoll = vineBlight.GetAttackRoll(12, AttackNames.Constrict); Assert.AreEqual(16, attackRoll); barbarian1.baseArmorClass = 13; barbarian2.baseArmorClass = 17; DamageResult elfDamage = vineBlight.GetDamageFromAttack(elf, AttackNames.Constrict, 10, attackRoll); DamageResult barbarian1Damage = vineBlight.GetDamageFromAttack(barbarian1, AttackNames.Constrict, 10, attackRoll); DamageResult barbarian2Damage = vineBlight.GetDamageFromAttack(barbarian2, AttackNames.Constrict, 10, attackRoll); Assert.IsNull(barbarian2Damage); // Barbarian 2's AC is 17, which should result in a miss - no damage. DamageResult druidDamage = vineBlight.GetDamageFromAttack(druid, AttackNames.Constrict, 12, attackRoll); Assert.IsFalse(barbarian1Damage.HasCondition(Conditions.Grappled)); // barbarian 1 is huge => no damage. Assert.IsTrue(elfDamage.HasCondition(Conditions.Grappled)); Assert.IsFalse(druidDamage.HasCondition(Conditions.Grappled)); // druid saving throw avoids the grapple. Assert.AreEqual(-9, elfDamage.hitPointChange); Assert.AreEqual(-9, barbarian1Damage.hitPointChange); Assert.AreEqual(-9, druidDamage.hitPointChange); Assert.AreEqual(DamageType.Bludgeoning | DamageType.Condition, elfDamage.damageTypes); Assert.AreEqual(DamageType.Bludgeoning, barbarian1Damage.damageTypes); Assert.AreEqual(DamageType.Bludgeoning, druidDamage.damageTypes); }
public void TestPositionCreatures() { DndGame game = DndGame.Instance; game.GetReadyToPlay(); Character alice = game.AddPlayer(CharacterBuilder.BuildTestBarbarian("a")); Character betty = game.AddPlayer(CharacterBuilder.BuildTestDruid("b")); Character charlie = game.AddPlayer(CharacterBuilder.BuildTestElf("c")); Character david = game.AddPlayer(CharacterBuilder.BuildTestWizard("d")); DndMap map = game.AddMap(new DndMap("Caves of the Wandering Winds")); DndRoom dndRoom = map.AddRoom(new DndRoom("Wizard's Workshop")); Assert.AreEqual(new Vector(0, 0), alice.Location); Assert.AreEqual(Vector.zero, betty.Location); dndRoom.PositionCreatures(@" ┌───────────────┐ │ │ │ │ │ a │ │ c │ │ └───────────────┐ │ b │ │ │ │ │ │ │ │ ┌───────────────┘ │ d │ │ │ │ e │ │ │ │ │ └───────────────┘"); game.ActivateMap(map); game.ActivateRoom(dndRoom); Assert.AreEqual(new Vector(DndMap.SquareSide * 5, DndMap.SquareSide * 3), alice.Location); Assert.AreEqual(new Vector(DndMap.SquareSide * 8, DndMap.SquareSide * 6), betty.Location); Assert.AreEqual(new Vector(DndMap.SquareSide * 13, DndMap.SquareSide * 4), charlie.Location); Assert.AreEqual(new Vector(DndMap.SquareSide * 12, DndMap.SquareSide * 11), david.Location); //dndGame.EnterCombat(true); //ergo.QueueAction(new ActionAttack(alice, AttackNames.Constrict)); }
public void TestPositionCreatures() { DndGame dndGame = new DndGame(); Character alice = dndGame.AddPlayer(CharacterBuilder.BuildTestBarbarian("a")); Character betty = dndGame.AddPlayer(CharacterBuilder.BuildTestDruid("b")); Character charlie = dndGame.AddPlayer(CharacterBuilder.BuildTestElf("c")); Character david = dndGame.AddPlayer(CharacterBuilder.BuildTestWizard("d")); DndMap map = dndGame.AddMap(new DndMap("Caves of the Wandering Winds")); DndRoom dndRoom = map.AddRoom(new DndRoom("Wizard's Workshop")); Assert.AreEqual(new Vector(0, 0), alice.WorldPosition); Assert.AreEqual(Vector.zero, betty.WorldPosition); dndRoom.PositionCreatures(@" ┌───────────────┐ │ │ │ │ │ a │ │ c │ │ └───────────────┐ │ b │ │ │ │ │ │ │ │ ┌───────────────┘ │ d │ │ │ │ e │ │ │ │ │ └───────────────┘"); dndGame.ActivateMap(map); dndGame.ActivateRoom(dndRoom); Assert.AreEqual(new Vector(5, 3), alice.WorldPosition); Assert.AreEqual(new Vector(8, 6), betty.WorldPosition); Assert.AreEqual(new Vector(13, 4), charlie.WorldPosition); Assert.AreEqual(new Vector(12, 11), david.WorldPosition); //dndGame.EnterCombat(true); //ergo.QueueAction(new ActionAttack(alice, AttackNames.Constrict)); }