From d874288dd4f278fb3917da46f275c977073a8846 Mon Sep 17 00:00:00 2001 From: EvGym Date: Tue, 29 Aug 2023 18:15:15 -0500 Subject: [PATCH] re-adding Fixed IV defaults for generations with hypertraining with improvements --- js/storage.js | 28 +++++++--------------------- src/panel-teamdropdown.tsx | 7 ------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/js/storage.js b/js/storage.js index 688bb8d27f2..d32b57a15d7 100644 --- a/js/storage.js +++ b/js/storage.js @@ -1248,11 +1248,13 @@ Storage.importTeam = function (buffer, teams) { if (line.substr(0, 14) === 'Hidden Power [') { var hptype = line.substr(14, line.length - 15); line = 'Hidden Power ' + hptype; - var type = Dex.types.get(hptype); - if (!curSet.ivs && type) { - curSet.ivs = {}; - for (var stat in type.HPivs) { - curSet.ivs[stat] = type.HPivs[stat]; + if ((parseInt(format[3], 10) || 6) < 7) { // update IVs to match hidden power if format is gen 6 or earlier + var type = Dex.types.get(hptype); + if (!curSet.ivs && type) { + curSet.ivs = {}; + for (var stat in type.HPivs) { + curSet.ivs[stat] = type.HPivs[stat]; + } } } } @@ -1360,22 +1362,6 @@ Storage.exportTeam = function (team, gen, hidestats) { if (curSet.ivs) { var defaultIvs = true; var hpType = false; - for (var j = 0; j < curSet.moves.length; j++) { - var move = curSet.moves[j]; - if (move.substr(0, 13) === 'Hidden Power ' && move.substr(0, 14) !== 'Hidden Power [') { - hpType = move.substr(13); - if (!Dex.types.isName(hpType)) { - alert(move + " is not a valid Hidden Power type."); - continue; - } - for (var stat in BattleStatNames) { - if ((curSet.ivs[stat] === undefined ? 31 : curSet.ivs[stat]) !== (Dex.types.get(hpType).HPivs[stat] || 31)) { - defaultIvs = false; - break; - } - } - } - } if (defaultIvs && !hpType) { for (var stat in BattleStatNames) { if (curSet.ivs[stat] !== 31 && curSet.ivs[stat] !== undefined) { diff --git a/src/panel-teamdropdown.tsx b/src/panel-teamdropdown.tsx index 0794f16cab5..986db5bcd09 100644 --- a/src/panel-teamdropdown.tsx +++ b/src/panel-teamdropdown.tsx @@ -398,13 +398,6 @@ class PSTeambuilder { if (line.startsWith('Hidden Power [')) { const hpType = line.slice(14, -1) as TypeName; line = 'Hidden Power ' + hpType; - if (!set.ivs && Dex.types.isName(hpType)) { - set.ivs = {hp: 31, atk: 31, def: 31, spa: 31, spd: 31, spe: 31}; - const hpIVs = Dex.types.get(hpType).HPivs || {}; - for (let stat in hpIVs) { - set.ivs[stat as StatName] = hpIVs[stat as StatName]!; - } - } } if (line === 'Frustration' && set.happiness === undefined) { set.happiness = 0;