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