From 2f4196b15d511bc3be7b577a74745e40925b54b8 Mon Sep 17 00:00:00 2001 From: shrianshChari <30420527+shrianshChari@users.noreply.github.com> Date: Fri, 22 May 2026 02:31:47 -0700 Subject: [PATCH] Preact: Support Pokemon Champions + Remove IV inputs in Champions (#2676) --- .../js/client-teambuilder.js | 258 +++++++++--------- .../src/battle-searchresults.tsx | 2 +- .../src/battle-team-editor.tsx | 35 ++- .../src/panel-mainmenu.tsx | 14 + .../src/panel-teamdropdown.tsx | 1 + 5 files changed, 167 insertions(+), 143 deletions(-) diff --git a/play.pokemonshowdown.com/js/client-teambuilder.js b/play.pokemonshowdown.com/js/client-teambuilder.js index f48abbdde..5e33f16a4 100644 --- a/play.pokemonshowdown.com/js/client-teambuilder.js +++ b/play.pokemonshowdown.com/js/client-teambuilder.js @@ -2449,135 +2449,137 @@ } buf += ''; - if (this.curTeam.gen > 2) { - buf += '
IVs
'; - if (!set.ivs) set.ivs = {}; - for (var i in stats) { - if (set.ivs[i] === undefined || isNaN(set.ivs[i])) set.ivs[i] = 31; - var val = '' + (set.ivs[i]); - buf += '
'; + if (!usesStatPoints) { + if (this.curTeam.gen > 2) { + buf += '
IVs
'; + if (!set.ivs) set.ivs = {}; + for (var i in stats) { + if (set.ivs[i] === undefined || isNaN(set.ivs[i])) set.ivs[i] = 31; + var val = '' + (set.ivs[i]); + buf += '
'; + } + var hpType = ''; + if (set.moves) { + for (var i = 0; i < set.moves.length; i++) { + var moveid = toID(set.moves[i]); + if (moveid.slice(0, 11) === 'hiddenpower') { + hpType = moveid.slice(11); + } + } + } + if (hpType && !this.canHyperTrain(set)) { + var hpIVs; + switch (hpType) { + case 'dark': + hpIVs = ['111111']; break; + case 'dragon': + hpIVs = ['011111', '101111', '110111']; break; + case 'ice': + hpIVs = ['010111', '100111', '111110']; break; + case 'psychic': + hpIVs = ['011110', '101110', '110110']; break; + case 'electric': + hpIVs = ['010110', '100110', '111011']; break; + case 'grass': + hpIVs = ['011011', '101011', '110011']; break; + case 'water': + hpIVs = ['100011', '111010']; break; + case 'fire': + hpIVs = ['101010', '110010']; break; + case 'steel': + hpIVs = ['100010', '111101']; break; + case 'ghost': + hpIVs = ['101101', '110101']; break; + case 'bug': + hpIVs = ['100101', '111100', '101100']; break; + case 'rock': + hpIVs = ['001100', '110100', '100100']; break; + case 'ground': + hpIVs = ['000100', '111001', '101001']; break; + case 'poison': + hpIVs = ['001001', '110001', '100001']; break; + case 'flying': + hpIVs = ['000001', '111000', '101000']; break; + case 'fighting': + hpIVs = ['001000', '110000', '100000']; break; + } + buf += '
'; + } else if (!usesStatPoints) { + buf += '
'; + } + buf += '
'; + } else { + buf += '
DVs
'; + if (!set.ivs) set.ivs = {}; + for (var i in stats) { + if (set.ivs[i] === undefined || isNaN(set.ivs[i])) set.ivs[i] = 31; + var val = '' + Math.floor(set.ivs[i] / 2); + buf += '
'; + } + buf += '
'; } - var hpType = ''; - if (set.moves) { - for (var i = 0; i < set.moves.length; i++) { - var moveid = toID(set.moves[i]); - if (moveid.slice(0, 11) === 'hiddenpower') { - hpType = moveid.slice(11); - } - } - } - if (hpType && !this.canHyperTrain(set)) { - var hpIVs; - switch (hpType) { - case 'dark': - hpIVs = ['111111']; break; - case 'dragon': - hpIVs = ['011111', '101111', '110111']; break; - case 'ice': - hpIVs = ['010111', '100111', '111110']; break; - case 'psychic': - hpIVs = ['011110', '101110', '110110']; break; - case 'electric': - hpIVs = ['010110', '100110', '111011']; break; - case 'grass': - hpIVs = ['011011', '101011', '110011']; break; - case 'water': - hpIVs = ['100011', '111010']; break; - case 'fire': - hpIVs = ['101010', '110010']; break; - case 'steel': - hpIVs = ['100010', '111101']; break; - case 'ghost': - hpIVs = ['101101', '110101']; break; - case 'bug': - hpIVs = ['100101', '111100', '101100']; break; - case 'rock': - hpIVs = ['001100', '110100', '100100']; break; - case 'ground': - hpIVs = ['000100', '111001', '101001']; break; - case 'poison': - hpIVs = ['001001', '110001', '100001']; break; - case 'flying': - hpIVs = ['000001', '111000', '101000']; break; - case 'fighting': - hpIVs = ['001000', '110000', '100000']; break; - } - buf += '
'; - } else if (!usesStatPoints) { - buf += '
'; - } - buf += '
'; - } else { - buf += '
DVs
'; - if (!set.ivs) set.ivs = {}; - for (var i in stats) { - if (set.ivs[i] === undefined || isNaN(set.ivs[i])) set.ivs[i] = 31; - var val = '' + Math.floor(set.ivs[i] / 2); - buf += '
'; - } - buf += '
'; } buf += '
'; diff --git a/play.pokemonshowdown.com/src/battle-searchresults.tsx b/play.pokemonshowdown.com/src/battle-searchresults.tsx index 38179a678..4d5de8b82 100644 --- a/play.pokemonshowdown.com/src/battle-searchresults.tsx +++ b/play.pokemonshowdown.com/src/battle-searchresults.tsx @@ -243,7 +243,7 @@ export class PSSearchResults extends preact.Component<{ let pp = (move.pp === 1 || move.noPPBoosts ? move.pp : move.pp * 8 / 5); if (search.dex.gen < 3) pp = Math.min(61, pp); if (search.dex.modid === 'champions') { - pp = move.pp > 20 ? 20 : pp; + pp = move.pp > 20 ? 20 : move.pp; if (!move.noPPBoosts) pp = (pp / 5 + 1) * 4; } return
  • {set.shiny ? 'Yes' : '\u2014'} - {editor.gen === 9 ? ( + {editor.gen === 9 && !editor.isChampions ? ( @@ -2001,7 +2004,7 @@ class TeamWizard extends preact.Component<{ Shiny {} {set.shiny ? Yes : '\u2014'} } - {editor.gen === 9 && + {editor.gen === 9 && !editor.isChampions && Tera {} } @@ -2480,6 +2483,7 @@ class StatForm extends preact.Component<{ const hpIVdata = hpType && !editor.canHyperTrain(set) && editor.getHPIVs(hpType) || null; const autoSpread = set.ivs && editor.defaultIVs(set, false); const autoSpreadValue = autoSpread && Object.values(autoSpread).join('/'); + if (editor.isChampions) return null; if (!hpIVdata) { return + type="number" inputMode="numeric" class="textbox default-placeholder" onInput={this.changeIV} + onChange={this.changeIV} disabled={usesStatPoints} + />} {stat} )} @@ -3075,7 +3082,7 @@ class DetailsForm extends preact.Component<{ name="level" value={set.level ?? ''} placeholder={`${editor.defaultLevel}`} type="number" inputMode="numeric" min="1" max="100" step="1" class="textbox inputform numform default-placeholder" style="width: 50px" - onInput={this.changeLevel} onChange={this.changeLevel} + onInput={this.changeLevel} onChange={this.changeLevel} disabled={editor.isChampions} />(You probably want to change the team's levels by changing the format, not here)

    {editor.gen > 1 && (<>

    Shiny:
    @@ -3151,7 +3158,7 @@ class DetailsForm extends preact.Component<{ ))}

    } - {editor.gen === 9 &&

    + {editor.gen === 9 && !editor.isChampions &&

    } + {this.props.selectType === 'challenge' && + window.BattleFormats[formatId]?.itemClauseDefault &&

    +

    }

    {this.props.children}

    ; } diff --git a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx index 8102e9508..185119198 100644 --- a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx +++ b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx @@ -349,6 +349,7 @@ export interface FormatData { tournamentShow?: boolean; bestOfDefault?: boolean; teraPreviewDefault?: boolean; + itemClauseDefault?: boolean; rated: boolean; teambuilderLevel?: number | null; partner?: boolean;