def apply_infernal_template(self):
        """first cut at apply infernal_template

        The template provides a number of features
           dependent on hit dice.
        Assumption at start is that this is a string.
        It might make more sense to work with a list for the
           sq attribute,
        and convert that list into a string using the
           get_html_string() method.
        """
        sq = ""
        hit_dice = self.get_hit_dice() # get 1d8+2
        hit_dice = RpgDataMangling.parse_dice(hit_dice)[0] # get only the 1
        hit_dice = int(hit_dice)  # coerce to int
        smite = "smite good 1/day for +%d dmg" % hit_dice
        sq_list_low = ['resist cold 5', 'resist fire 5', smite]
        sq_list_med = ['DR 5/good', 'resist cold 10', 'resist fire 10', smite]
        sq_list_high = ['DR 10/good', 'resist cold 15',
                        'resist fire 15', smite]
        if hit_dice > 0 and hit_dice < 5:
            self.set_special_qualities(sq_list_low)
        elif hit_dice > 4 and hit_dice < 11:
            self.set_special_qualities(sq_list_med)
        else:
            self.set_special_qualities(sq_list_high)
 def test_find_hd_of_eagle(self):
     """given an eagle, return the number of hit dice the eagle has"""
     expect = 1
     mx = smxml.Smxml()
     raw_hitdice = sorted(mx.id_into_dict("101", ["hit_dice"]).values())[0]
     # raw_hitdice would contain something like (1d8+2) and we want only the 1
     result = RpgDataMangling.parse_dice(raw_hitdice)[0]
     self.assertEqual(expect, result)
 def test_find_hp_of_eagle_w_augs_feat(self):
     """given an eagle, apply augment summoning feat, show hit points """
     expect = 7
     mx = smxml.Smxml()
     raw_hitpoints = sorted(mx.id_into_dict("101", ["hit_points"]).values())[0]
     raw_hitdice = sorted(mx.id_into_dict("101", ["hit_dice"]).values())[0]
     hitdice = RpgDataMangling.parse_dice(raw_hitdice)[0]
     hitpoints = smfoo.apply_augs_feat(hitdice, raw_hitpoints)
     result = int(hitpoints)
     self.assertEqual(expect, result)
    def apply_augs_feat(self):
        """first cut at apply 'augmented summoning' feat.

        The feat adds +4 to STR and +4 to CON.
        In practice, this means +2 hit_point per HD.

        requires hit_dice and hit_point; sets the modified hit_point total
        """
        result = 0
        hit_dice = self.get_hit_dice() # get 1d8+2
        hit_dice = RpgDataMangling.parse_dice(hit_dice)[0] # get only the 1
        hit_point = self.get_hit_points()
        hit_dice = int(hit_dice)  # coerce to int
        hit_point = int(hit_point)  # coerce to int
        bonus = hit_dice * 2
        result = hit_point + bonus
        self.set_hit_points(result)