public void TestSpellSlotLevelPower() { Spell silentImage = AllSpells.Get("Silent Image"); Assert.AreEqual(1, silentImage.Level); Assert.IsFalse(silentImage.MorePowerfulWhenCastAtHigherLevels); Spell sleep = AllSpells.Get("Sleep"); Assert.AreEqual(1, sleep.Level); Assert.IsTrue(sleep.MorePowerfulWhenCastAtHigherLevels); sleep.RecalculateDiceAndAmmo(2, 5, 0); Assert.AreEqual("7d8(hpCapacity)", sleep.DieStr); sleep.RecalculateDiceAndAmmo(3, 5, 0); Assert.AreEqual("9d8(hpCapacity)", sleep.DieStr); sleep.RecalculateDiceAndAmmo(4, 5, 0); Assert.AreEqual("11d8(hpCapacity)", sleep.DieStr); sleep.RecalculateDiceAndAmmo(5, 5, 0); Assert.AreEqual("13d8(hpCapacity)", sleep.DieStr); Spell astralProjection = AllSpells.Get("Astral Projection"); Assert.AreEqual(9, astralProjection.Level); Assert.IsFalse(astralProjection.MorePowerfulWhenCastAtHigherLevels); }
public void TestSaveSpellEvents() { AllPlayers.Invalidate(); History.TimeClock = new DndTimeClock(); Character merkin = AllPlayers.GetFromId(PlayerID.Merkin); Monster joeTheVineBlight = MonsterBuilder.BuildVineBlight("Joe"); Spell zzzSaveSpell = AllSpells.Get("ZZZ Test Save Spell", merkin, 3); DndGame game = DndGame.Instance; game.GetReadyToPlay(); game.AddPlayer(merkin); game.AddCreature(joeTheVineBlight); merkin.CastTest(zzzSaveSpell, joeTheVineBlight); merkin.ReadyRollDice(DiceRollType.DamageOnly, "3d6(fire)", 12); List <CastedSpell> activeSpells = merkin.GetActiveSpells(); Assert.IsNotNull(activeSpells); Assert.AreEqual(1, activeSpells.Count); Assert.AreEqual("onCast", Expressions.GetStr("Get(_spellState)", merkin)); game.AdvanceClock(DndTimeSpan.FromMinutes(1)); Assert.AreEqual("onDispel", Expressions.GetStr("Get(_spellState)", merkin)); activeSpells = merkin.GetActiveSpells(); Assert.IsNotNull(activeSpells); Assert.AreEqual(0, activeSpells.Count); }
public static void Spells(Character character) { BEHelper.AddSecSpells(character, ExpandedSpells); string pickMsg = "Pick a 1st level spell."; AllSpells spells = new AllSpells(character); foreach (var slotLvl in character.SpellSlots.Keys) { if (slotLvl == 2) { pickMsg = "Pick a 2nd level spell."; } if (slotLvl == 3) { pickMsg = "Pick a 3rd level spell."; } if (slotLvl >= 4) { pickMsg = $"Pick a {slotLvl}th level spell."; } int slots = character.SpellSlots[slotLvl]; for (int i = 0; i < slots; i++) { string spell = CLIHelper.GetNew(spells.Artificer[slotLvl], character.Spells[slotLvl], pickMsg); character.Spells[slotLvl].Add(spell); spells.Artificer[slotLvl].Remove(spell); } } }
public void TestAttackSpellEventsTimeout() { AllPlayers.Invalidate(); Character merkin = AllPlayers.GetFromId(PlayerID.Merkin); Monster joeTheVineBlight = MonsterBuilder.BuildVineBlight("Joe"); Spell zzzRangeSpell = AllSpells.Get("ZZZ Test Range Spell", merkin, 3); DndGame game = DndGame.Instance; game.GetReadyToPlay(); game.AddPlayer(merkin); game.AddCreature(joeTheVineBlight); game.EnteringCombat(); merkin.CastTest(zzzRangeSpell, joeTheVineBlight); List <CastedSpell> activeSpells = merkin.GetActiveSpells(); Assert.IsNotNull(activeSpells); Assert.AreEqual(0, activeSpells.Count); Assert.AreEqual("onCasting", Expressions.GetStr("Get(_spellState)", merkin)); const int hiddenThreshold = 12; merkin.ReadyRollDice(DiceRollType.Attack, "1d20(:score),2d8(:damage),1d6(:damage)", hiddenThreshold); Assert.AreEqual("onCast", Expressions.GetStr("Get(_spellState)", merkin)); const int damage = 7; merkin.DieRollStoppedForTestCases(hiddenThreshold, damage); game.AdvanceClock(DndTimeSpan.FromMinutes(1)); Assert.AreEqual("onDispel", Expressions.GetStr("Get(_spellState)", merkin)); activeSpells = merkin.GetActiveSpells(); Assert.IsNotNull(activeSpells); Assert.AreEqual(0, activeSpells.Count); game.ExitingCombat(); }
public void TestWrathfulSmiteDuration() { Spell wrathfulSmite = AllSpells.Get(SpellNames.WrathfulSmite); Assert.IsNotNull(wrathfulSmite); Assert.AreEqual(TimeSpan.FromMinutes(1), wrathfulSmite.Duration.GetTimeSpan()); }
public void TestAttackSpellEventsOnPlayerAttacks() { AllPlayers.Invalidate(); Character merkin = AllPlayers.GetFromId(PlayerID.Merkin); Monster joeVineBlight = MonsterBuilder.BuildVineBlight("Joe"); Spell zzzSaveSpell = AllSpells.Get("ZZZ Test Save Spell", merkin, 3); DndGame game = DndGame.Instance; game.GetReadyToPlay(); game.AddPlayer(merkin); game.AddCreature(joeVineBlight); game.EnteringCombat(); merkin.CastTest(zzzSaveSpell, joeVineBlight); const int hiddenThreshold = 12; const int damage = 7; Assert.AreEqual("onCasting", Expressions.GetStr("Get(_spellState)", merkin)); merkin.ReadyRollDice(DiceRollType.DamageOnly, "1d6(fire)"); Assert.AreEqual("onCast", Expressions.GetStr("Get(_spellState)", merkin)); merkin.PrepareAttack(joeVineBlight, Attack.Melee("Unarmed Strike", 5, 5)); Assert.AreEqual("onPlayerAttacks", Expressions.GetStr("Get(_spellState)", merkin)); merkin.ReadyRollDice(DiceRollType.Attack, "1d20(:score),2d8(:damage),1d6(:damage)", hiddenThreshold); merkin.DieRollStoppedForTestCases(hiddenThreshold, damage); Assert.AreEqual("onPlayerHitsTarget", Expressions.GetStr("Get(_spellState)", merkin)); List <CastedSpell> activeSpells = merkin.GetActiveSpells(); Assert.IsNotNull(activeSpells); game.ExitingCombat(); }
public void TestAutoAdvanceRound() { DndGame game = DndGame.Instance; game.GetReadyToPlay(); Character merkin = AllPlayers.GetFromId(PlayerID.Merkin); Monster joeTheVineBlight = MonsterBuilder.BuildVineBlight("Joe"); game.AddPlayer(merkin); game.AddMonster(joeTheVineBlight); game.EnteringCombat(); DateTime enterCombatTime = game.Time; Assert.AreEqual(1, game.RoundNumber); Spell zzzSaveSpell = AllSpells.Get("ZZZ Test Save Spell", merkin, 3); merkin.CastTest(zzzSaveSpell, joeTheVineBlight); joeTheVineBlight.PrepareAttack(merkin, joeTheVineBlight.GetAttack(AttackNames.Constrict)); merkin.CastTest(zzzSaveSpell, joeTheVineBlight); Assert.AreEqual(2, game.RoundNumber); DateTime exitCombatTime = game.Time; TimeSpan totalCombatTime = exitCombatTime - enterCombatTime; Assert.AreEqual((game.RoundNumber - 1) * 6 /*seconds*/, totalCombatTime.TotalSeconds); game.ExitingCombat(); Assert.AreEqual(1, game.RoundNumber); }
public static void Spells(Character character) { AllSpells spells = new AllSpells(character); character.Cantrips.AddRange(character.Cantrips); character.CantripsKnown = 2; character.SpellsKnown = 2; string pickMsg = "Pick a spell."; string spell = ""; int slotLvl = 1; int slots = 1; for (int i = 3; i <= character.Lvl; i++) { //slots if (i == 5 || i == 15) { slots++; } if (i == 7 || i == 11 || i == 18) { character.SpellSlots[slotLvl] = 0; slotLvl++; } character.SpellSlots[slotLvl] = slots; //spells known if (i == 10) { character.CantripsKnown++; } if (i % 2 != 0 && i <= 17) { character.SpellsKnown++; } if (i == 18 || i == 20) { character.SpellsKnown++; } } //add spells for (int i = 0; i < character.CantripsKnown; i++) { spell = CLIHelper.GetNew(spells.Warlock[0], character.Cantrips, pickMsg); character.Cantrips.Add(spell); spells.Warlock[0].Remove(spell); } slotLvl = 1; for (int i = 0; i < character.SpellsKnown; i++) { if (i == 3 || i == 5 || i == 9) { slotLvl++; } spell = CLIHelper.GetNew(spells.Warlock[slotLvl], character.Spells[slotLvl], pickMsg); character.Spells[slotLvl].Add(spell); spells.Warlock[slotLvl].Remove(spell); } }
public void TestAmmoAndSpellSlotLevelsWithClonedSpells() { Spell bonesOfTheEarth = AllSpells.Get("Bones of the Earth"); Character merkin = AllPlayers.Get("Merkin"); Assert.AreEqual(6, bonesOfTheEarth.Clone(merkin, 6).AmmoCount); Assert.AreEqual(8, bonesOfTheEarth.Clone(merkin, 7).AmmoCount); Assert.AreEqual(10, bonesOfTheEarth.Clone(merkin, 8).AmmoCount); Assert.AreEqual(12, bonesOfTheEarth.Clone(merkin, 9).AmmoCount); }
public void TestSpellSlotLevels() { Assert.AreEqual("2d8,1d6", AllSpells.Get("Chaos Bolt", 1).DieStr); Assert.AreEqual("2d8,2d6", AllSpells.Get("Chaos Bolt", 2).DieStr); Assert.AreEqual("2d8,3d6", AllSpells.Get("Chaos Bolt", 3).DieStr); Assert.AreEqual("2d8,4d6", AllSpells.Get("Chaos Bolt", 4).DieStr); Assert.AreEqual("2d8,5d6", AllSpells.Get("Chaos Bolt", 5).DieStr); Assert.AreEqual("2d8,6d6", AllSpells.Get("Chaos Bolt", 6).DieStr); Assert.AreEqual("2d8,7d6", AllSpells.Get("Chaos Bolt", 7).DieStr); }
public void TestCureWounds() { Assert.AreEqual("1d8+3(healing)", AllSpells.Get("Cure Wounds", 1, 5, +3).DieStr); Assert.AreEqual("2d8+3(healing)", AllSpells.Get("Cure Wounds", 2, 5, +3).DieStr); Assert.AreEqual("3d8+3(healing)", AllSpells.Get("Cure Wounds", 3, 5, 3).DieStr); Assert.AreEqual("4d8+3(healing)", AllSpells.Get("Cure Wounds", 4, 5, 3).DieStr); Assert.AreEqual("5d8+3(healing)", AllSpells.Get("Cure Wounds", 5, 5, 3).DieStr); Assert.AreEqual("6d8+3(healing)", AllSpells.Get("Cure Wounds", 6, 5, 3).DieStr); Assert.AreEqual("7d8+3(healing)", AllSpells.Get("Cure Wounds", 7, 5, 3).DieStr); }
public static void Spells(Character character) { int lvl = character.Lvl; BEHelper.AddPrimSpells(character, DomainSpells); string pickMsg = "Pick a cantrip."; int spellLvl = 1; AllSpells spells = new AllSpells(character); for (int i = 0; i < character.CantripsKnown; i++) { string spell = CLIHelper.GetNew(spells.Cleric[0], character.Cantrips, pickMsg); character.Cantrips.Add(spell); spells.Cleric[0].Remove(spell); } pickMsg = "Pick a 1st level spell."; for (int i = 1; i <= lvl; i++) { if (i % 2 != 0) { if (3 <= i && i <= 17) { spellLvl++; } if (i == 3) { pickMsg = "Pick a 2nd level spell."; } if (i == 5) { pickMsg = "Pick a 3rd level spell."; } if (i >= 7) { pickMsg = $"Pick a {spellLvl}th level spell."; } if (lvl <= 5) { string spell2 = CLIHelper.GetNew(spells.Cleric[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell2); } if (lvl >= 13) { string spell2 = CLIHelper.GetNew(spells.Cleric[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell2); } } if (lvl <= 11) { string spell = CLIHelper.GetNew(spells.Cleric[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell); spells.Cleric[spellLvl].Remove(spell); } } }
public static void AddSpells(Character character) { var archList = new List <string> { "Aberrant Mind", "Clockwork Soul", "Stone Sorcery" }; if (archList.Contains(SorcerousOrigin)) { BEHelper.AddPrimSpells(character, ExpandedSpells); } Cantrips.AddRange(SorcererSpells.Cantrips); AllSpells sorcSpells = new AllSpells("Sorcerer"); for (int i = 1; i <= 9; i++) { Spells[i].AddRange(sorcSpells.Sorcerer[i]); } string pickMsg = "Pick a cantrip."; for (int i = 0; i < character.CantripsKnown; i++) { string spell = CLIHelper.GetNew(Cantrips, character.Cantrips, pickMsg); character.Cantrips.Add(spell); } pickMsg = "Pick a 1st level spell."; int spellLvl = 1; for (int i = 1; i <= character.SpellsKnown; i++) { if (4 <= i && i <= 14 && i % 2 == 0) { spellLvl++; } if (i == 13 || i == 15) { spellLvl++; } if (i == 4) { pickMsg = "Pick a 2nd level spell."; } if (i == 6) { pickMsg = "Pick a 3rd level spell."; } if (i >= 8) { pickMsg = $"Pick a {spellLvl}th level spell."; } string spell = CLIHelper.GetNew(Spells[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell); Spells[spellLvl].Remove(spell); } }
public void TestPlayerLevels() { Assert.AreEqual("1d8(cold)", AllSpells.Get("Ray of Frost", 1, 1).DieStr); Assert.AreEqual("1d8(cold)", AllSpells.Get("Ray of Frost", 1, 4).DieStr); Assert.AreEqual("2d8(cold)", AllSpells.Get("Ray of Frost", 1, 5).DieStr); Assert.AreEqual("2d8(cold)", AllSpells.Get("Ray of Frost", 1, 10).DieStr); Assert.AreEqual("3d8(cold)", AllSpells.Get("Ray of Frost", 1, 11).DieStr); Assert.AreEqual("3d8(cold)", AllSpells.Get("Ray of Frost", 1, 16).DieStr); Assert.AreEqual("4d8(cold)", AllSpells.Get("Ray of Frost", 1, 17).DieStr); Assert.AreEqual("4d8(cold)", AllSpells.Get("Ray of Frost", 1, 22).DieStr); }
public void StartSpellPicker() { isSelectingTarget = true; GameObject spellPickerObject = Instantiate(Resources.Load("SpellPickerCanvas")) as GameObject; SpellPicker spellPicker = spellPickerObject.GetComponent <SpellPicker> (); List <Spell> spellList = AllSpells.EligibleSpells(sheet); spellPicker.InitialiseSpellList(spellList, SpellSelected, SpellPickerCancelled, combatant.team); spellPicker.transform.position = SpellPickerPosition(spellList.Count, combatant.transform.position); }
public void TestSpellSlotLevelsWithClonedSpells() { Spell fireball = AllSpells.Get("Fireball"); Character merkin = AllPlayers.Get("Merkin"); Assert.AreEqual("8d6(fire)", fireball.Clone(merkin, 3).DieStr); Assert.AreEqual("9d6(fire)", fireball.Clone(merkin, 4).DieStr); Assert.AreEqual("10d6(fire)", fireball.Clone(merkin, 5).DieStr); Assert.AreEqual("11d6(fire)", fireball.Clone(merkin, 6).DieStr); Assert.AreEqual("12d6(fire)", fireball.Clone(merkin, 7).DieStr); Assert.AreEqual("13d6(fire)", fireball.Clone(merkin, 8).DieStr); Assert.AreEqual("14d6(fire)", fireball.Clone(merkin, 9).DieStr); }
public void TestChaosBolt() { Spell chaosBolt = AllSpells.Get("Chaos Bolt"); Assert.IsTrue(chaosBolt.MorePowerfulWhenCastAtHigherLevels); Assert.IsNotNull(chaosBolt); Assert.AreEqual(DndTimeSpan.OneAction, chaosBolt.CastingTime); Assert.AreEqual(DndTimeSpan.Zero, chaosBolt.Duration); Assert.IsTrue(chaosBolt.HasRange(120, SpellRangeType.DistanceFeet)); Assert.IsFalse(chaosBolt.RequiresConcentration); Assert.AreEqual(1, chaosBolt.Level); Assert.AreEqual(SpellComponents.Somatic | SpellComponents.Verbal, chaosBolt.Components); }
public void TestRayOfFrost() { Spell rayOfFrost = AllSpells.Get("Ray of Frost"); Assert.IsNotNull(rayOfFrost); Assert.AreEqual(DndTimeSpan.OneAction, rayOfFrost.CastingTime); Assert.AreEqual(DndTimeSpan.Zero, rayOfFrost.Duration); Assert.IsTrue(rayOfFrost.HasRange(60, SpellRangeType.DistanceFeet)); Assert.IsFalse(rayOfFrost.RequiresConcentration); Assert.AreEqual(Cantrip, rayOfFrost.Level); Assert.AreEqual(SpellComponents.Somatic | SpellComponents.Verbal, rayOfFrost.Components); Assert.AreEqual("1d8(cold)", rayOfFrost.DieStr); }
public MagicSpell NextSpell(Player player) { var spells = AllSpells .Where(s => s.Cost <= player.Mana) .Where(s => s.EffectType == null || !player.Effects.Any(e => e.GetType() == s.EffectType)) .ToArray(); if (!spells.Any()) { return(null); } var spell = spells[Random.Next(0, spells.Length - 1)]; return(spell); }
public static void Spells(Character character) { string pickMsg = "Pick a cantrip."; int spellLvl = 1; AllSpells spells = new AllSpells(character); for (int i = 0; i < character.CantripsKnown; i++) { string spell = CLIHelper.GetNew(spells.Bard[0], character.Cantrips, pickMsg); character.Cantrips.Add(spell); spells.Bard[0].Remove(spell); } pickMsg = "Pick a 1st level spell."; for (int i = 1; i <= character.SpellsKnown; i++) { if (i > 5) { if (i <= 13 && i % 2 == 0) { spellLvl++; } if (i == 15 || i == 16 || i == 19 || i == 20) { spellLvl++; } } if (i == 6) { pickMsg = "Pick a 2nd level spell."; } if (i == 8) { pickMsg = "Pick a 3rd level spell."; } if (i >= 10) { pickMsg = $"Pick a {spellLvl}th level spell."; } if (i != 13 || i != 14 || i != 17 || i != 18 || i != 21 || i != 22) { string spell = CLIHelper.GetNew(spells.Bard[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell); spells.Bard[spellLvl].Remove(spell); } } }
public static void Spells(Character character) { int lvl = character.Lvl; string pickMsg = "Pick a cantrip."; int spellLvl = 1; AllSpells spells = new AllSpells(character); foreach (var newLvl in ExpandedSpells.Keys) { spells.Warlock[newLvl].AddRange(ExpandedSpells[newLvl]); } if (OtherworldlyPatron.Contains("Genie")) { spells.Warlock[9].Add("Wish"); } for (int i = 0; i < character.CantripsKnown; i++) { string spell = CLIHelper.GetNew(WarlockSpells.Cantrips, character.Cantrips, pickMsg); character.Cantrips.Add(spell); } pickMsg = "Pick a 1st level spell."; for (int i = 1; i <= character.SpellsKnown; i++) { if (4 <= i && i <= 10 && i % 2 == 0) { spellLvl++; } if (i == 4) { pickMsg = "Pick a 2nd level spell."; } if (i == 6) { pickMsg = "Pick a 3rd level spell."; } if (i >= 8) { pickMsg = $"Pick a {spellLvl}th level spell."; } string spell = CLIHelper.GetNew(spells.Warlock[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell); spells.Warlock[spellLvl].Remove(spell); } }
public static void Spells(Character character) { int lvl = character.Lvl; string pickMsg = "Pick a cantrip."; int spellLvl = 1; AllSpells spells = new AllSpells("Psion"); character.Cantrips.AddRange(ExpandedSpells[0]); for (int i = 0; i < character.CantripsKnown; i++) { string spell = CLIHelper.GetNew(PsionSpells.Cantrips, character.Cantrips, pickMsg); character.Cantrips.Add(spell); } pickMsg = "Pick a 1st level spell."; for (int i = 1; i <= character.SpellsKnown; i++) { if (4 <= i && i <= 14 && i % 2 == 0) { spellLvl++; } if (i == 4) { pickMsg = "Pick a 2nd level spell."; } if (i == 6) { pickMsg = "Pick a 3rd level spell."; } if (i >= 8) { pickMsg = $"Pick a {spellLvl}th level spell."; } string spell = CLIHelper.GetNew(spells.Psion[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell); spells.Psion[spellLvl].Remove(spell); } }
public static void Spells(Character character) { BEHelper.AddSecSpells(character, ExpandedSpells); string pickMsg = "Pick a cantrip."; AllSpells spells = new AllSpells(character); for (int i = 0; i < character.CantripsKnown; i++) { string spell = CLIHelper.GetNew(spells.Swordmage[0], character.Cantrips, pickMsg); character.Cantrips.Add(spell); spells.Swordmage[0].Remove(spell); } pickMsg = "Pick a 1st level spell."; int spellLvl = 1; for (int i = 1; i <= character.SpellsKnown; i++) { if (i == 6) { spellLvl++; pickMsg = "Pick a 2nd level spell."; } if (i == 10) { spellLvl++; pickMsg = "Pick a 3rd level spell."; } if (i == 12 || i == 14) { spellLvl++; pickMsg = $"Pick a {spellLvl}th level spell."; } string spell = CLIHelper.GetNew(spells.Swordmage[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell); spells.Swordmage[spellLvl].Remove(spell); } }
public static void Spells(Character character) { var archList = new List <string> { "Fey Wanderer", "Gloom Stalker", "Horizon Walker", "Monster Slayer", "Swarmkeeper" }; if (archList.Contains(RangerArchetype)) { BEHelper.AddSecSpells(character, ExpandedSpells); } string pickMsg = "Pick a 1st level spell."; AllSpells spells = new AllSpells(character); foreach (var slotLvl in character.SpellSlots.Keys) { if (slotLvl == 2) { pickMsg = "Pick a 2nd level spell."; } if (slotLvl == 3) { pickMsg = "Pick a 3rd level spell."; } if (slotLvl >= 4) { pickMsg = $"Pick a {slotLvl}th level spell."; } int slots = character.SpellSlots[slotLvl]; for (int i = 0; i < slots; i++) { string spell = CLIHelper.GetNew(spells.Ranger[slotLvl], character.Spells[slotLvl], pickMsg); character.Spells[slotLvl].Add(spell); spells.Ranger[slotLvl].Remove(spell); } } }
public void TestWrathfulSmite() { AllPlayers.Invalidate(); AllSpells.Invalidate(); AllActionShortcuts.Invalidate(); Character ava = AllPlayers.GetFromId(PlayerID.LilCutie); PlayerActionShortcut greatsword = ava.GetShortcut("Greatsword"); Assert.IsNotNull(greatsword); Monster joeVineBlight = MonsterBuilder.BuildVineBlight("Joe"); List <PlayerActionShortcut> wrathfulSmites = AllActionShortcuts.Get(ava.playerID, SpellNames.WrathfulSmite); Assert.AreEqual(1, wrathfulSmites.Count); PlayerActionShortcut wrathfulSmite = wrathfulSmites[0]; Assert.IsNotNull(wrathfulSmite); DndGame game = DndGame.Instance; game.GetReadyToPlay(); game.AddPlayer(ava); game.AddCreature(joeVineBlight); DateTime gameStartTime = game.Time; game.EnteringCombat(); ava.Hits(joeVineBlight, greatsword); // Action. Ava is first to fight. ava.CastTest(wrathfulSmite.Spell); // Bonus Action - Wrathful Smite lasts for one minute. Assert.IsTrue(ava.SpellIsActive(SpellNames.WrathfulSmite)); joeVineBlight.Misses(ava, AttackNames.Constrict); AvaMeleeMissesJoe(); // Round 2 Assert.AreEqual(6, game.SecondsSince(gameStartTime)); joeVineBlight.Misses(ava, AttackNames.Constrict); Assert.AreEqual(6, game.SecondsSince(gameStartTime)); AvaMeleeMissesJoe(); // Round 3 Assert.AreEqual(12, game.SecondsSince(gameStartTime)); joeVineBlight.Misses(ava, AttackNames.Constrict); Assert.AreEqual(12, game.SecondsSince(gameStartTime)); AvaMeleeMissesJoe(); Assert.AreEqual(18, game.SecondsSince(gameStartTime)); joeVineBlight.Misses(ava, AttackNames.Constrict); Assert.AreEqual(18, game.SecondsSince(gameStartTime)); //`+++NOW THE HIT.... ava.Hits(joeVineBlight, greatsword); Assert.AreEqual(24, game.SecondsSince(gameStartTime)); Assert.IsTrue(ava.SpellIsActive(SpellNames.WrathfulSmite)); // Wrathful Smite spell is not yet dispelled, however its impact on attack rolls is done. Assert.AreEqual($"Target must make a Wisdom saving throw or be frightened of {ava.name} until the spell ends. As an action, the creature can make a Wisdom check against {ava.name}'s spell save DC ({ava.GetSpellSaveDC()}) to steel its resolve and end this {wrathfulSmite.Spell.Name} spell.", game.lastMessageSentToDungeonMaster); joeVineBlight.Misses(ava, AttackNames.Constrict); Assert.AreEqual(24, game.SecondsSince(gameStartTime)); ava.Misses(joeVineBlight, greatsword); // Advancing Round (Ava's turn again). Assert.AreEqual("", ava.additionalDiceThisRoll); // No more die roll effects. Assert.AreEqual("", ava.trailingEffectsThisRoll); Assert.AreEqual("", ava.dieRollEffectsThisRoll); Assert.AreEqual("", ava.dieRollMessageThisRoll); Assert.AreEqual(30, game.SecondsSince(gameStartTime)); game.AdvanceClock(DndTimeSpan.FromSeconds(30)); Assert.IsFalse(ava.SpellIsActive(SpellNames.WrathfulSmite)); // Wrathful Smite spell should finally be dispelled. void AvaMeleeMissesJoe() { Assert.AreEqual("", ava.additionalDiceThisRoll); Assert.AreEqual("", ava.trailingEffectsThisRoll); Assert.AreEqual("", ava.dieRollEffectsThisRoll); Assert.AreEqual("", ava.dieRollMessageThisRoll); ava.Misses(joeVineBlight, greatsword); // Advancing Round (Ava's turn again). Assert.AreEqual("1d6(psychic)", ava.additionalDiceThisRoll); Assert.AreEqual("Ravens;Spirals", ava.trailingEffectsThisRoll); Assert.AreEqual("PaladinSmite", ava.dieRollEffectsThisRoll); Assert.AreEqual("Wrathful Smite", ava.dieRollMessageThisRoll); Assert.IsTrue(ava.SpellIsActive(SpellNames.WrathfulSmite)); } }
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)); }
public static void DivineSoul(Character character) { int lvl = character.Lvl; Cantrips.AddRange(ClericSpells.Cantrips); AllSpells clericSpells = new AllSpells("Cleric"); for (int i = 1; i <= 9; i++) { Spells[i].AddRange(clericSpells.Cleric[i]); } var affinity = new List <string> { "Good", "Evil", "Law", "Chaos", "Neutrality" }; Console.WriteLine("Pick an affinity to an alignment that is the source of your divine power"); string alignment = CLIHelper.PrintChoices(affinity); string wingType = ""; switch (alignment) { case "Good": character.Spells[1].Add("Cure Wounds"); wingType = "eagle"; break; case "Evil": character.Spells[1].Add("Inflict Wounds"); wingType = "bat"; break; case "Law": character.Spells[1].Add("Bless"); wingType = "eagle"; break; case "Chaos": character.Spells[1].Add("Bane"); wingType = "bat"; break; case "Neutrality": character.Spells[1].Add("Protection from Evil and Good"); wingType = "dragonfly"; break; } character.ClassFeatures.Add("Divine Magic", "gain access to the Cleric spell list"); character.ClassFeatures.Add("Favored by the Gods", "SR, if you fail a save or miss an atk, +2D4 to the save or atk"); if (lvl >= 6) { character.ClassFeatures.Add("Empowered Healing", "1/turn, 1 sorcery pt, when you or adj ally rolls to recover HP, reroll the dice once"); } if (lvl >= 14) { character.ClassFeatures.Add("Otherworldly Wings", $"bonus, manifest spectral {wingType} wings, gain Fly speed 30ft"); if (!character.Speedstring.Contains("Fly")) { character.Speedstring += ", Fly 30ft"; } } if (lvl >= 18) { character.ClassFeatures.Add("Unearthly Recovery", "LR, bonus, when bloodied, regain HP = 1/2 max HP"); } }
public static void Spells(Character character) { int lvl = character.Lvl; var cantrips = new List <string>(); cantrips.AddRange(WizardSpells.Cantrips); if (ArcaneTradition == "Chronurgy Magic" || ArcaneTradition == "Graviturgy Magic") { cantrips.Add("Sapping Sting"); cantrips.Sort(); } string pickMsg = "Pick a cantrip."; for (int i = 0; i < character.CantripsKnown; i++) { string spell = CLIHelper.GetNew(cantrips, character.Cantrips, pickMsg); character.Cantrips.Add(spell); cantrips.Remove(spell); } pickMsg = "Pick a 1st level spell."; AllSpells spells = new AllSpells(character); if (ArcaneTradition == "Chronurgy Magic" || ArcaneTradition == "Graviturgy Magic") { AddDunamancySpells(spells.Wizard, ArcaneTradition); } for (int i = 0; i < 6; i++) { string spell = CLIHelper.GetNew(spells.Wizard[1], character.Spells[1], pickMsg); character.Spells[1].Add(spell); spells.Wizard[1].Remove(spell); } int spellLvl = 1; for (int i = 2; i <= lvl; i++) { if (3 <= i && i <= 17 && i % 2 != 0) { spellLvl++; if (i == 3) { pickMsg = "Pick a 2nd level spell."; } if (i == 5) { pickMsg = "Pick a 3rd level spell."; } if (i >= 7) { pickMsg = $"Pick a {spellLvl}th level spell."; } } string spell = CLIHelper.GetNew(spells.Wizard[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell); spells.Wizard[spellLvl].Remove(spell); spell = CLIHelper.GetNew(spells.Wizard[spellLvl], character.Spells[spellLvl], pickMsg); character.Spells[spellLvl].Add(spell); spells.Wizard[spellLvl].Remove(spell); } }
public void TestSpellcastingAbilityModifier() { AllSpells.Get("Cure Wounds", 1); }
public static void Spells(Character character) { //spells AllSpells spells = new AllSpells(character); character.Cantrips.AddRange(character.Cantrips); character.CantripsKnown = 2; character.SpellsKnown = 3; int slotLvl = 1; character.SpellSlots[1] += 2; string pickMsg = "Pick a spell."; string cantrip = ""; string spell = ""; for (int i = 0; i < 2; i++) { cantrip = CLIHelper.GetNew(spells.Wizard[0], character.Cantrips, pickMsg); character.Cantrips.Add(cantrip); spells.Wizard[0].Remove(cantrip); } for (int i = 0; i < 2; i++) { spell = CLIHelper.GetNew(spells.Rogue[1], character.Spells[1], pickMsg); character.Spells[1].Add(spell); spells.Rogue[1].Remove(spell); } spell = CLIHelper.GetNew(spells.Wizard[1], character.Spells[1], pickMsg); character.Spells[1].Add(spell); spells.Rogue[1].Remove(spell); for (int i = 3; i <= character.Lvl; i++) { //slots if (i == 7 || i == 13) { slotLvl++; character.SpellSlots[slotLvl] += 2; } if (i == 4 || i == 10 || i == 16) { character.SpellSlots[slotLvl]++; } if (i == 19) { slotLvl++; character.SpellSlots[4] += 1; } //known and add spells if (i == 10) { character.CantripsKnown++; cantrip = CLIHelper.GetNew(spells.Wizard[0], character.Cantrips, pickMsg); character.Cantrips.Add(cantrip); spells.Wizard[0].Remove(cantrip); character.SpellsKnown++; spell = CLIHelper.GetNew(spells.Rogue[slotLvl], character.Spells[slotLvl], pickMsg); character.Spells[slotLvl].Add(spell); spells.Rogue[slotLvl].Remove(spell); } if (i == 8 || i == 14 || i == 20) { character.SpellsKnown++; spell = CLIHelper.GetNew(spells.Wizard[slotLvl], character.Spells[slotLvl], pickMsg); character.Spells[slotLvl].Add(spell); spells.Wizard[slotLvl].Remove(spell); } if (i == 4 || i == 7 || i == 11 || i == 13 || i == 16 || i == 19) { character.SpellsKnown++; spell = CLIHelper.GetNew(spells.Rogue[slotLvl], character.Spells[slotLvl], pickMsg); character.Spells[slotLvl].Add(spell); spells.Rogue[slotLvl].Remove(spell); } } }