def party_adapter(cls, average_level, num_players=5, difficulty=0): average_level = smart_clamp(average_level, 1, 20) num_players = smart_clamp(num_players, 1, 9) - 5 magic_bonus = ( 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, )[average_level] diff_modifier = smart_clamp(difficulty, -5, 5) return num_players + average_level + magic_bonus + diff_modifier
def __add__(self, other): self.val = smart_clamp(self.val + other, -3, 30) return self
def __init__(self, val): self.val = smart_clamp(val, -3, 30)
def __sub__(self, other): self.val = smart_clamp(self.val - other, -3, 30) return self