public void TestItemEquipMod() { ItemViewModel ringOfLeaping = TestStorageHelper.GetExistingItem("Ring of the Faithful Leap"); Character testWizard = CharacterBuilder.BuildTestWizard(); const int initialDexterity = 12; const int initialStrength = 11; const int initialSpeed = 30; testWizard.baseDexterity = initialDexterity; testWizard.baseStrength = initialStrength; testWizard.baseSpeed = initialSpeed; Assert.AreEqual(VantageKind.Normal, testWizard.GetSkillCheckDice(Skills.athletics)); Assert.AreEqual(VantageKind.Normal, testWizard.GetSkillCheckDice(Skills.acrobatics)); Assert.AreEqual(initialDexterity, testWizard.Dexterity); Assert.AreEqual(initialStrength, testWizard.Strength); Assert.AreEqual(initialSpeed, testWizard.Speed); testWizard.Equip(ringOfLeaping); Assert.AreEqual(initialDexterity + 1, testWizard.Dexterity); Assert.AreEqual(initialStrength + 1, testWizard.Strength); Assert.AreEqual(initialSpeed + 5, testWizard.Speed); Assert.AreEqual(VantageKind.Advantage, testWizard.GetSkillCheckDice(Skills.athletics)); Assert.AreEqual(VantageKind.Advantage, testWizard.GetSkillCheckDice(Skills.acrobatics)); testWizard.Unequip(ringOfLeaping); Assert.AreEqual(VantageKind.Normal, testWizard.GetSkillCheckDice(Skills.athletics)); Assert.AreEqual(VantageKind.Normal, testWizard.GetSkillCheckDice(Skills.acrobatics)); Assert.AreEqual(initialDexterity, testWizard.Dexterity); Assert.AreEqual(initialStrength, testWizard.Strength); Assert.AreEqual(initialSpeed, testWizard.Speed); }
public void TestDamageImmunity() { Monster vrock = MonsterBuilder.BuildVrock(); Character wizard = CharacterBuilder.BuildTestWizard(); Attack beak = vrock.attacks.Find(x => x.Name == "Beak"); Assert.IsTrue(wizard.CanBeAffectedBy(beak)); wizard.AddDamageImmunity(DamageType.Piercing, AttackKind.Any); Assert.IsFalse(wizard.CanBeAffectedBy(beak)); }
public void TestStunnedImmunity() { Monster vrock = MonsterBuilder.BuildVrock(); Character wizard = CharacterBuilder.BuildTestWizard(); Attack stunningScreech = vrock.attacks.Find(x => x.Name == AttackNames.StunningScreech); Assert.IsTrue(wizard.CanBeAffectedBy(stunningScreech)); wizard.conditionImmunities = Conditions.Stunned; Assert.IsFalse(wizard.CanBeAffectedBy(stunningScreech)); }
public void TestDeafnessImmunity() { Monster vrock = MonsterBuilder.BuildVrock(); Character wizard = CharacterBuilder.BuildTestWizard(); Attack stunningScreech = vrock.attacks.Find(x => x.Name == AttackNames.StunningScreech); Assert.IsTrue(wizard.CanBeAffectedBy(stunningScreech)); wizard.ManuallyAddedConditions |= Conditions.Deafened; Assert.IsFalse(wizard.CanBeAffectedBy(stunningScreech)); }
public void TestLowMods() { Character player = CharacterBuilder.BuildTestWizard(); player.baseIntelligence = 6; player.baseStrength = 5; player.baseCharisma = 4; player.baseDexterity = 3; player.baseConstitution = 2; player.baseWisdom = 1; Assert.AreEqual(-2, player.intelligenceMod); Assert.AreEqual(-3, player.strengthMod); Assert.AreEqual(-3, player.charismaMod); Assert.AreEqual(-4, player.dexterityMod); Assert.AreEqual(-4, player.constitutionMod); Assert.AreEqual(-5, player.wisdomMod); }
public void TestMiddleMods() { Character player = CharacterBuilder.BuildTestWizard(); player.baseIntelligence = 12; player.baseStrength = 11; player.baseCharisma = 10; player.baseDexterity = 9; player.baseConstitution = 8; player.baseWisdom = 7; Assert.AreEqual(1, player.intelligenceMod); Assert.AreEqual(0, player.strengthMod); Assert.AreEqual(0, player.charismaMod); Assert.AreEqual(-1, player.dexterityMod); Assert.AreEqual(-1, player.constitutionMod); Assert.AreEqual(-2, player.wisdomMod); }
public void TestHighMods() { Character player = CharacterBuilder.BuildTestWizard(); player.baseIntelligence = 18; player.baseStrength = 17; player.baseCharisma = 16; player.baseDexterity = 15; player.baseConstitution = 14; player.baseWisdom = 13; Assert.AreEqual(4, player.intelligenceMod); Assert.AreEqual(3, player.strengthMod); Assert.AreEqual(3, player.charismaMod); Assert.AreEqual(2, player.dexterityMod); Assert.AreEqual(2, player.constitutionMod); Assert.AreEqual(1, player.wisdomMod); }
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)); }
public void TestCharacterSaveLoad() { Character originalTestWizard = CharacterBuilder.BuildTestWizard(); const string localTestFileName = "Delete_TestCharacterSaveLoad.json"; string fullPathToFile = Storage.GetDataFileName(localTestFileName); DeleteIfExists(fullPathToFile); Storage.Save(localTestFileName, originalTestWizard); Character loadedCharacter = Storage.Load <Character>(localTestFileName); Assert.AreEqual(originalTestWizard.name, loadedCharacter.name); Assert.AreEqual(originalTestWizard.offTurnActions, loadedCharacter.offTurnActions); Assert.AreEqual(originalTestWizard.onTurnActions, loadedCharacter.onTurnActions); Assert.AreEqual(originalTestWizard.maxHitPoints, loadedCharacter.maxHitPoints); Assert.AreEqual(originalTestWizard.load, loadedCharacter.load); Assert.AreEqual(originalTestWizard.ClassLevelStr, loadedCharacter.ClassLevelStr); Assert.AreEqual(originalTestWizard.languagesUnderstood, loadedCharacter.languagesUnderstood); Assert.AreEqual(originalTestWizard.languagesSpoken, loadedCharacter.languagesSpoken); Assert.AreEqual(originalTestWizard.kind, loadedCharacter.kind); Assert.AreEqual(originalTestWizard.Intelligence, loadedCharacter.Intelligence); Assert.AreEqual(originalTestWizard.inspiration, loadedCharacter.inspiration); Assert.AreEqual(originalTestWizard.initiative, loadedCharacter.initiative); Assert.AreEqual(originalTestWizard.HitPoints, loadedCharacter.HitPoints); Assert.AreEqual(originalTestWizard.goldPieces, loadedCharacter.goldPieces); Assert.AreEqual(originalTestWizard.flyingSpeed, loadedCharacter.flyingSpeed); Assert.AreEqual(originalTestWizard.experiencePoints, loadedCharacter.experiencePoints); Assert.AreEqual(originalTestWizard.Dexterity, loadedCharacter.Dexterity); Assert.AreEqual(originalTestWizard.deathSaveLife3, loadedCharacter.deathSaveLife3); Assert.AreEqual(originalTestWizard.deathSaveLife2, loadedCharacter.deathSaveLife2); Assert.AreEqual(originalTestWizard.deathSaveLife1, loadedCharacter.deathSaveLife1); Assert.AreEqual(originalTestWizard.deathSaveDeath3, loadedCharacter.deathSaveDeath3); Assert.AreEqual(originalTestWizard.deathSaveDeath2, loadedCharacter.deathSaveDeath2); Assert.AreEqual(originalTestWizard.deathSaveDeath1, loadedCharacter.deathSaveDeath1); Assert.AreEqual(originalTestWizard.darkvisionRadius, loadedCharacter.darkvisionRadius); Assert.AreEqual(originalTestWizard.creatureSize, loadedCharacter.creatureSize); Assert.AreEqual(originalTestWizard.Constitution, loadedCharacter.Constitution); Assert.AreEqual(originalTestWizard.conditionImmunities, loadedCharacter.conditionImmunities); Assert.AreEqual(originalTestWizard.climbingSpeed, loadedCharacter.climbingSpeed); Assert.AreEqual(originalTestWizard.Charisma, loadedCharacter.Charisma); Assert.AreEqual(originalTestWizard.burrowingSpeed, loadedCharacter.burrowingSpeed); Assert.AreEqual(originalTestWizard.blindsightRadius, loadedCharacter.blindsightRadius); Assert.AreEqual(originalTestWizard.ArmorClass, loadedCharacter.ArmorClass); Assert.AreEqual(originalTestWizard.alignmentStr, loadedCharacter.alignmentStr); Assert.AreEqual(originalTestWizard.advantages, loadedCharacter.advantages); Assert.AreEqual(originalTestWizard.proficiencyBonus, loadedCharacter.proficiencyBonus); Assert.AreEqual(originalTestWizard.proficientSkills, loadedCharacter.proficientSkills); Assert.AreEqual(originalTestWizard.halfProficiency, loadedCharacter.halfProficiency); Assert.AreEqual(originalTestWizard.doubleProficiency, loadedCharacter.doubleProficiency); Assert.AreEqual(originalTestWizard.race, loadedCharacter.race); Assert.AreEqual(originalTestWizard.remainingHitDice, loadedCharacter.remainingHitDice); Assert.AreEqual(originalTestWizard.savingThrowProficiency, loadedCharacter.savingThrowProficiency); Assert.AreEqual(originalTestWizard.spellCastingAbility, loadedCharacter.spellCastingAbility); Assert.AreEqual(originalTestWizard.senses, loadedCharacter.senses); Assert.AreEqual(originalTestWizard.WalkingSpeed, loadedCharacter.WalkingSpeed); Assert.AreEqual(originalTestWizard.Strength, loadedCharacter.Strength); Assert.AreEqual(originalTestWizard.swimmingSpeed, loadedCharacter.swimmingSpeed); Assert.AreEqual(originalTestWizard.telepathyRadius, loadedCharacter.telepathyRadius); Assert.AreEqual(originalTestWizard.tempAcrobaticsMod, loadedCharacter.tempAcrobaticsMod); Assert.AreEqual(originalTestWizard.tempAnimalHandlingMod, loadedCharacter.tempAnimalHandlingMod); Assert.AreEqual(originalTestWizard.tempArcanaMod, loadedCharacter.tempArcanaMod); Assert.AreEqual(originalTestWizard.tempAthleticsMod, loadedCharacter.tempAthleticsMod); Assert.AreEqual(originalTestWizard.tempDeceptionMod, loadedCharacter.tempDeceptionMod); Assert.AreEqual(originalTestWizard.tempHistoryMod, loadedCharacter.tempHistoryMod); Assert.AreEqual(originalTestWizard.tempHitPoints, loadedCharacter.tempHitPoints); Assert.AreEqual(originalTestWizard.tempInsightMod, loadedCharacter.tempInsightMod); Assert.AreEqual(originalTestWizard.tempIntimidationMod, loadedCharacter.tempIntimidationMod); Assert.AreEqual(originalTestWizard.tempInvestigationMod, loadedCharacter.tempInvestigationMod); Assert.AreEqual(originalTestWizard.tempMedicineMod, loadedCharacter.tempMedicineMod); Assert.AreEqual(originalTestWizard.tempNatureMod, loadedCharacter.tempNatureMod); Assert.AreEqual(originalTestWizard.tempPerceptionMod, loadedCharacter.tempPerceptionMod); Assert.AreEqual(originalTestWizard.tempPerformanceMod, loadedCharacter.tempPerformanceMod); Assert.AreEqual(originalTestWizard.tempPersuasionMod, loadedCharacter.tempPersuasionMod); Assert.AreEqual(originalTestWizard.tempReligionMod, loadedCharacter.tempReligionMod); Assert.AreEqual(originalTestWizard.tempSavingThrowModCharisma, loadedCharacter.tempSavingThrowModCharisma); Assert.AreEqual(originalTestWizard.tempSavingThrowModConstitution, loadedCharacter.tempSavingThrowModConstitution); Assert.AreEqual(originalTestWizard.tempSavingThrowModDexterity, loadedCharacter.tempSavingThrowModDexterity); Assert.AreEqual(originalTestWizard.tempSavingThrowModIntelligence, loadedCharacter.tempSavingThrowModIntelligence); Assert.AreEqual(originalTestWizard.tempSavingThrowModStrength, loadedCharacter.tempSavingThrowModStrength); Assert.AreEqual(originalTestWizard.tempSavingThrowModWisdom, loadedCharacter.tempSavingThrowModWisdom); Assert.AreEqual(originalTestWizard.tempSleightOfHandMod, loadedCharacter.tempSleightOfHandMod); Assert.AreEqual(originalTestWizard.tempStealthMod, loadedCharacter.tempStealthMod); Assert.AreEqual(originalTestWizard.tempSurvivalMod, loadedCharacter.tempSurvivalMod); Assert.AreEqual(originalTestWizard.totalHitDice, loadedCharacter.totalHitDice); Assert.AreEqual(originalTestWizard.tremorSenseRadius, loadedCharacter.tremorSenseRadius); Assert.AreEqual(originalTestWizard.truesightRadius, loadedCharacter.truesightRadius); Assert.AreEqual(originalTestWizard.weight, loadedCharacter.weight); Assert.AreEqual(originalTestWizard.Wisdom, loadedCharacter.Wisdom); // TODO: Check these lists for equivalency: //Assert.AreEqual(originalTestWizard.equipment, loadedCharacter.equipment); //Assert.AreEqual(originalTestWizard.disadvantages, loadedCharacter.disadvantages); //Assert.AreEqual(originalTestWizard.cursesAndBlessings, loadedCharacter.cursesAndBlessings); //Assert.AreEqual(originalTestWizard.damageVulnerability, loadedCharacter.damageVulnerability); //Assert.AreEqual(originalTestWizard.damageResistance, loadedCharacter.damageResistance); //Assert.AreEqual(originalTestWizard.damageImmunities, loadedCharacter.damageImmunities); DeleteIfExists(fullPathToFile); }