Filter out legacy fast moves when requested

This commit is contained in:
Zoé Cassiopée Gauthier 2024-04-16 09:49:01 -04:00
parent 6926f2fcf1
commit 72a7a4d215

View File

@ -55,9 +55,7 @@ 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: [ attacker: [moveset for moveset in movesets if self._allowed_moveset(attacker, moveset)]
moveset for moveset in movesets if self._allowed_move(attacker, moveset.charged_move)
]
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
} }
@ -102,14 +100,16 @@ class Calculator:
return False return False
return True return True
def _allowed_move(self, pokemon_id: str, move_id: str) -> bool: def _allowed_moveset(self, pokemon_id: str, moveset: MovesetResult) -> bool:
move = self._pokebattler_proxy.find_move(move_id) charged_move = self._pokebattler_proxy.find_move(moveset.charged_move)
if move.typing not in self.attacker_types: if charged_move.typing not in self.attacker_types:
return False return False
if Filter.DISALLOW_LEGACY_MOVES in self.filters: if Filter.DISALLOW_LEGACY_MOVES in self.filters:
pokemon = self._pokebattler_proxy.find_pokemon(pokemon_id) pokemon = self._pokebattler_proxy.find_pokemon(pokemon_id)
move_id = move_id.removesuffix("_PLUS_PLUS") if moveset.fast_move in pokemon.get("eliteQuickMove", []):
if move_id in pokemon.get("eliteQuickMove", []) or move_id in pokemon.get("eliteCinematicMove", []): return False
charged_move_name = moveset.charged_move.removesuffix("_PLUS_PLUS")
if charged_move_name in pokemon.get("eliteCinematicMove", []):
return False return False
return True return True