def test_end_illusion(): logger = MagicMock() battle = Battle("tag", "username", logger) empty_boosts = { "accuracy": 0, "atk": 0, "def": 0, "evasion": 0, "spa": 0, "spd": 0, "spe": 0, } non_empty_boosts = { "accuracy": 1, "atk": 0, "def": -2, "evasion": 3, "spa": 5, "spd": -6, "spe": 2, } battle._player_role = "p2" battle._switch("p2: Celebi", "Celebi", "100/100") battle._switch("p1: Kingdra", "Kingdra, F", "100/100") battle.active_pokemon._boosts = non_empty_boosts assert battle.active_pokemon.species == "celebi" battle._parse_message(["", "replace", "p2: Zoroark", "Zoroark, M"]) assert battle.active_pokemon.species == "zoroark" assert battle.opponent_active_pokemon.species == "kingdra" assert battle.get_pokemon("p2: Zoroark").boosts == non_empty_boosts assert battle.get_pokemon("p2: Celebi").boosts == empty_boosts
def test_sleep_counter(example_request): logger = MagicMock() battle = Battle("tag", "username", logger) battle._parse_request(example_request) battle._parse_message(["", "-status", "p2a: Venusaur", "slp"]) assert battle.active_pokemon.status == Status.SLP assert battle.active_pokemon.status_counter == 0 battle.end_turn(2) battle._parse_message(["", "cant", "p2a: Venusaur", ""]) assert battle.active_pokemon.status == Status.SLP assert battle.active_pokemon.status_counter == 1 battle.end_turn(3) assert battle.active_pokemon.status == Status.SLP assert battle.active_pokemon.status_counter == 1 battle._switch("p2a: Unfezant", "Unfezant, L86, M", "100/100") assert battle.active_pokemon.status is None assert battle.active_pokemon.status_counter == 0 battle.end_turn(4) assert battle.active_pokemon.status is None assert battle.active_pokemon.status_counter == 0 battle._switch("p2a: Venusaur", "Venusaur, L82, M", "100/100 slp") assert battle.active_pokemon.status == Status.SLP assert battle.active_pokemon.status_counter == 1 battle.end_turn(5) battle._parse_message(["", "cant", "p2a: Venusaur", ""]) assert battle.active_pokemon.status == Status.SLP assert battle.active_pokemon.status_counter == 2 battle.end_turn(6) battle._parse_message(["", "cant", "p2a: Venusaur", ""]) assert battle.active_pokemon.status == Status.SLP assert battle.active_pokemon.status_counter == 3