def test_determine_attack_bonus_type_finesse(self): ability_scores = { 'STR': base.AbilityScore('STR', 10), 'DEX': base.AbilityScore('DEX', 14), } str_weapon = weapons.Weapon('Finesse weapon', category=weapons.SIMPLE, damage='1d6 bludgeoning', price=currency.GoldPieces(5), weight=4, properties=['finesse']) result = weapons.determine_attack_bonus_type(str_weapon, ability_scores) self.assertEqual(('DEX', 2), result)
def setUp(self): cantrips = [ spells.SACRED_FLAME, spells.GUIDANCE, spells.SPARE_THE_DYING ] self.spellcasting = cleric.ClericSpellcastingAbility(level=1, cantrips=cantrips) self.ability_scores = {'WIS': base.AbilityScore(name='WIS', score=16)}
def test_spell_attack_bonus(self): ability_scores = {'WIS': base.AbilityScore('WIS', 16)} proficiency_bonus = 2 self.assertEqual( 5, self.spellcasting.spell_attack_bonus(ability_scores, proficiency_bonus))
def test_unskilled(self): skill = base.SkillProficiency(name='Athletics', ability_score=base.AbilityScore( 'STR', 15), proficiency_bonus=2, is_proficient=False, expertise=False) self.assertEqual('STR', skill.ability) self.assertEqual(2, skill.modifier)
def setUp(self): class_languages = feature.LanguagesKnown( languages=[base.Languages.DRACONIC, base.Languages.DWARVISH]) class_skills = [Skills.ARCANA, Skills.HISTORY] class_cantrips = [ spells.SACRED_FLAME, spells.GUIDANCE, spells.SPARE_THE_DYING ] self.cleric = cleric.Cleric(skill_proficiencies=[ Skills.INSIGHT, Skills.RELIGION, Skills.ARCANA, Skills.PERSUASION ], cleric_domain='knowledge', cantrips=class_cantrips, languages=class_languages, skills=class_skills) self.ability_scores = {'WIS': base.AbilityScore(name='WIS', score=16)}
def test_spell_save_dc(self): ability_scores = {'WIS': base.AbilityScore('WIS', 16)} proficiency_bonus = 2 self.assertEqual(13, self.spellcasting.spell_save_dc(ability_scores, proficiency_bonus))
def test_proficient(self): skill = base.SavingThrow(ability_score=base.AbilityScore('DEX', 16), proficiency_bonus=2, is_proficient=True) self.assertEqual('DEX', skill.ability) self.assertEqual(5, skill.modifier)
def test_with_asi_with_not_asi(self): ability = base.AbilityScore('STR', 15) bad = base.AbilityScore('WIS', 1) with self.assertRaises(ValueError): ability.with_ability_score_increase(bad)
def test_with_asi_good(self): ability = base.AbilityScore('STR', 15) asi = base.AbilityScoreIncrease('STR', 1) result = ability.with_ability_score_increase(asi) self.assertEqual(result.name, 'STR') self.assertEqual(result.score, 16)
def test_modifier(self): ability = base.AbilityScore('STR', 15) self.assertEqual(ability.modifier, 2) ability = base.AbilityScore('STR', 7) self.assertEqual(ability.modifier, -2)
def test_combine_with_not_asi(self): asi1 = base.AbilityScoreIncrease('STR', 1) bad = base.AbilityScore('STR', 1) with self.assertRaises(ValueError): asi1.combine(bad)