def get_total_for_attack_check(self): from world.stat_checks.models import StatWeight value = 0 if self.attack_stat: stat_only = not self.attack_skill level = self.char.traits.get_stat_value(self.attack_stat) value += StatWeight.get_weighted_value_for_stat( level, stat_only, True) if self.attack_skill: level = self.char.traits.get_skill_value(self.attack_skill) value += StatWeight.get_weighted_value_for_skill(level, True) return value
def get_max_hp(self) -> int: from world.stat_checks.models import StatWeight base = StatWeight.get_health_value_for_stamina(self.stamina) bonus = self.bonus_max_hp hp = base + bonus boss = StatWeight.get_health_value_for_boss_rating(self.boss_rating) hp += boss if hp <= 0: raise ValueError( f"Max hp is negative, this should never happen. base: {base}, bonus: {bonus}, boss: {boss}" ) return hp
def get_roll_value_for_stat(self) -> int: if not self.stat: return 0 only_stat = not self.skill return StatWeight.get_weighted_value_for_stat(self.stat_value, only_stat)
def get_roll_value_for_knack(self) -> int: """Looks up the value for the character's knacks, if any.""" try: mods: ModifierHandler = self.character.mods base = mods.get_total_roll_modifiers([self.stat], [self.skill]) except AttributeError: return 0 return StatWeight.get_weighted_value_for_knack(base)
def get_roll_value_for_skill(self) -> int: """ Looks up how much to modify our roll based on our skill. We use a lookup table to determine how much each level of the skill is weighted by. """ if not self.skill: return 0 base = self.character.traits.get_skill_value(self.skill) return StatWeight.get_weighted_value_for_skill(base)
def get_roll_value_for_knack(self) -> int: """Looks up the value for the character's knacks, if any.""" # get stats and skills for our check try: mods: ModifierHandler = self.character.mods base = mods.get_total_roll_modifiers(self.check.get_stats_list(), self.check.get_skills_list()) except AttributeError: return 0 return StatWeight.get_weighted_value_for_knack(base)
def get_modifiers_for_check(self, check) -> int: """ Eventually this will be all the modifiers a player has for a given check, but for now is just knacks. """ from world.stat_checks.models import StatWeight # get stats and skills for our check base = self.get_total_roll_modifiers(check.get_stats_list(self.obj), check.get_skills_list(self.obj)) return StatWeight.get_weighted_value_for_knack(base)
def get_roll_value_for_stat(self) -> int: """ Looks up how much to modify our roll by based on our stat. We use a lookup table to determine how much each level of the stat is weighted by. Weight may be different if there is no skills for this roll. """ if not self.stat: return 0 base = self.character.traits.get_stat_value(self.stat) # if we don't have a skill defined, we're rolling stat alone, and the weight may be different only_stat = not self.skill return StatWeight.get_weighted_value_for_stat(base, only_stat)
def get_roll_value_for_skill(self) -> int: if not self.skill: return 0 skill_val = self.retainer.dbobj.traits.get_skill_value(self.skill) return StatWeight.get_weighted_value_for_skill(skill_val)
def get_roll_value_for_skill(self) -> int: if not self.skill: return 0 return StatWeight.get_weighted_value_for_skill(self.skill_value)