BUG: Fix best in Python boxing

This commit is contained in:
Martin Thoma
2022-03-23 12:26:07 +01:00
parent 8ee56f94a1
commit 53adcc70d0

View File

@@ -23,9 +23,9 @@ class HitStats(NamedTuple):
@dataclass
class Player:
name: str
best: int # TODO: This is never used!
best: int # this hit guarantees 2 damage on opponent
weakness: int # you're always hit when your opponent uses this punch
is_computer: bool
weakness: int
# for each of the 4 punch types, we have a probability of hitting
hit_stats: Dict[Literal[1, 2, 3, 4], HitStats]
@@ -216,7 +216,7 @@ def play_round(round_number: int, player: Player, opponent: Player) -> None:
# Load the hit characteristics of the current player's punch
hit_stats = active.hit_stats[punch]
if punch == passive.weakness:
if punch == active.best:
passive.damage += 2
print(hit_stats.pre_msg.format(active=active, passive=passive), end=" ")