diff --git a/game/combat.py b/game/combat.py index a74ff03..70f7f51 100644 --- a/game/combat.py +++ b/game/combat.py @@ -171,6 +171,7 @@ def level_up(player: Actor, log: MessageLog) -> None: while player.stats.xp >= threshold: level += 1 threshold *= 2 + level = min(level, 20) if level > player.stats.hd: log.append(f"Welcome to level {level}!") hp_gain = roll(level - player.stats.hd, d=10) diff --git a/game/consumable.py b/game/consumable.py index 572db7c..f39d491 100644 --- a/game/consumable.py +++ b/game/consumable.py @@ -71,7 +71,10 @@ def use(self, actor: Actor, level: Level, log: MessageLog) -> None: @dataclass(frozen=True, slots=True) class RaiseLevel(Consumable): def use(self, actor: Actor, level: Level, log: MessageLog) -> None: - actor.stats.xp = 5 * 2**actor.stats.hd + 1 + target_xp = 10 + while target_xp <= actor.stats.xp: + target_xp *= 2 + actor.stats.xp = target_xp + 1 log.append("You suddenly feel much more skillful.") level_up(actor, log)