From d844f506d24fdb6a8b7a3e64cd83d6e506ef296b Mon Sep 17 00:00:00 2001 From: KirbyRider1337 <39121695+KirbyRider1337@users.noreply.github.com> Date: Sun, 8 Sep 2024 22:39:29 -0400 Subject: [PATCH] Fixing "Kommo" and "Ting" aliases Simply put they cause infinite recursion (Feed Kommo in -> Replace with Kommo-o -> Hyphen present, feed Kommo in) and as such crash builders for mods. This fix checks to see if we're about to feed the same argument(s) into "get" as earlier and if we are, does not perform the internal "get" call. --- play.pokemonshowdown.com/src/battle-dex.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/play.pokemonshowdown.com/src/battle-dex.ts b/play.pokemonshowdown.com/src/battle-dex.ts index 67e46810e..3eb6c4d31 100644 --- a/play.pokemonshowdown.com/src/battle-dex.ts +++ b/play.pokemonshowdown.com/src/battle-dex.ts @@ -1064,6 +1064,7 @@ class ModdedDex { species = { get: (name: string, hasData = true, debug = ""): Species => { + let initialName = name; if (name.id) name = name.id; let id = toID(name); let formid = id; @@ -1071,8 +1072,11 @@ class ModdedDex { name = BattleAliases[id]; id = toID(name); } - - if (name.includes('-')) this.species.get(name.split('-')[0]); + //This is likely meant to put the potential base form in the cache too, but I'll need confirmation as to whether that was the purpose + if (name.includes('-')) { + const potentialBase = name.split('-')[0]; + if (initialName !== potentialBase) this.species.get(potentialBase); + } const table = window.BattleTeambuilderTable[this.modid]; if (!table.BattlePokedexAltForms) table.BattlePokedexAltForms = {}; if (formid in table.BattlePokedexAltForms) {