Forgot to run ruff format

This commit is contained in:
Zoé Cassiopée Gauthier 2024-04-05 22:26:21 -04:00
parent 405173d6cd
commit aceedda2e8
3 changed files with 14 additions and 3 deletions

View File

@ -43,7 +43,11 @@ class Calculator:
self._progress.update(task, advance=1) self._progress.update(task, advance=1)
raid = Raid(raid_tier, defender, level, party) raid = Raid(raid_tier, defender, level, party)
results = { results = {
attacker: [moveset for moveset in movesets if self._pokebattler_proxy.move_type(moveset.charged_move) in self.attacker_types] attacker: [
moveset
for moveset in movesets
if self._pokebattler_proxy.move_type(moveset.charged_move) in self.attacker_types
]
for attacker, movesets in self._pokebattler_proxy.simulate(raid).items() for attacker, movesets in self._pokebattler_proxy.simulate(raid).items()
if attacker in attackers if attacker in attackers
} }
@ -79,7 +83,9 @@ class Calculator:
attacker_type = self._pokebattler_proxy.pokemon_type(attacker) attacker_type = self._pokebattler_proxy.pokemon_type(attacker)
fast_move_type = self._pokebattler_proxy.move_type(fast_move) fast_move_type = self._pokebattler_proxy.move_type(fast_move)
charged_move_type = self._pokebattler_proxy.move_type(charged_move) charged_move_type = self._pokebattler_proxy.move_type(charged_move)
self._progress.console.print(f"[bold]{format_pokemon_name(attacker, attacker_type)}[/bold] ({format_move_name(fast_move, fast_move_type)}/{format_move_name(charged_move, charged_move_type)}): {ase:.2f}") self._progress.console.print(
f"[bold]{format_pokemon_name(attacker, attacker_type)}[/bold] ({format_move_name(fast_move, fast_move_type)}/{format_move_name(charged_move, charged_move_type)}): {ase:.2f}"
)
def _average_estimator(self, movesets: list[Moveset]) -> float: def _average_estimator(self, movesets: list[Moveset]) -> float:
return sum(moveset.estimator for moveset in movesets) / len(movesets) return sum(moveset.estimator for moveset in movesets) / len(movesets)

View File

@ -145,7 +145,11 @@ class PokebattlerProxy:
return False return False
def with_charged_moves(self, attacker_types: list[str]) -> list[str]: def with_charged_moves(self, attacker_types: list[str]) -> list[str]:
charged_moves = [move["moveId"] for move in self.moves if "moveId" in move and "type" in move and move["type"] in attacker_types] charged_moves = [
move["moveId"]
for move in self.moves
if "moveId" in move and "type" in move and move["type"] in attacker_types
]
return [ return [
mon["pokemonId"] mon["pokemonId"]
for mon in self.pokemon for mon in self.pokemon

View File

@ -22,6 +22,7 @@ POKEMON_TYPE_COLORS = {
"POKEMON_TYPE_WATER": "cornflower_blue", "POKEMON_TYPE_WATER": "cornflower_blue",
} }
def format_pokemon_name(name: str, pokemon_type: str | None = None): def format_pokemon_name(name: str, pokemon_type: str | None = None):
parts = [part.capitalize() for part in name.split("_")] parts = [part.capitalize() for part in name.split("_")]
if parts[-1] == "Mega" or parts[-1] == "Primal": if parts[-1] == "Mega" or parts[-1] == "Primal":