From 86b75eb959179cf4985c917c648c12c7f4b8cd0b Mon Sep 17 00:00:00 2001 From: anastarawneh Date: Fri, 14 Jun 2024 02:36:09 +0300 Subject: [PATCH] Use weather to check Castform's switch-ins --- src/js/game_controls.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/js/game_controls.js b/src/js/game_controls.js index 24dd03e46..2fec20784 100644 --- a/src/js/game_controls.js +++ b/src/js/game_controls.js @@ -319,6 +319,23 @@ var phase1TypeMatchups = { function predictSwitchOrderEmerald() { var advanced = $("#advanced-bait").is(":checked"); var p1 = createPokemon($("#p1")); + var field = createField(); + if (p1.species.name === "Castform") { + switch (field.weather) { + case "Sun": + p1.types[0] = "Fire"; + break; + case "Rain": + p1.types[0] = "Water"; + break; + case "Hail": + p1.types[0] = "Ice"; + break; + default: + p1.types[0] = "Normal"; + break; + } + } var partySpecies = partyOrder[window.CURRENT_TRAINER]; var hasDupes = (new Set(partySpecies)).size !== partySpecies.length; @@ -419,7 +436,6 @@ function predictSwitchOrderEmerald() { var move = new calc.Move(GENERATION, enemy.moves[k]); if (move.category == "Status") continue; if (move.name == "Weather Ball") { - var field = createField(); if (field.weather == "Sun") move.type = "Fire"; else if (field.weather == "Rain") move.type = "Water"; else if (field.weather == "Hail") move.type = "Ice";