diff --git a/calc/bundle b/calc/bundle index bfdc984b1..a3ab8bb15 100755 --- a/calc/bundle +++ b/calc/bundle @@ -13,9 +13,9 @@ const exports = {}; `; bundled += bundler.read('util.js', 3, 1); const species = bundler.read('data/species.js').split('\n'); -bundled += species.slice(1, 64).join('\n'); // generator + iterator + spreadArray polyfill +bundled += species.slice(1, 39).join('\n'); // generator + iterator polyfill bundled += '\nvar e_1, _a, e_2, _b;\nvar util_1 = exports;\n'; -bundled += species.slice(68, -2).join('\n'); +bundled += species.slice(43, -2).join('\n'); const types = bundler.read('data/types.js').split('\n'); bundled += types.slice(1, 12).join('\n'); // __assign polyfill @@ -25,7 +25,9 @@ bundled += natures.slice(28, 44).join('\n'); // __read polyfill bundled += natures.slice(47, -2).join('\n'); bundled += bundler.read('data/abilities.js', 43, 1); bundled += bundler.read('data/moves.js', 43, 1); -bundled += bundler.read('data/items.js', 68, 1); +const items = bundler.read('data/items.js').split('\n'); +bundled += items.slice(44, 53).join('\n'); // __spreadArray polyfill +bundled += items.slice(68, -2).join('\n'); bundled += ` var abilities_1 = exports; var items_1 = exports; diff --git a/calc/src/data/interface.ts b/calc/src/data/interface.ts index 060f2829d..f03571c23 100644 --- a/calc/src/data/interface.ts +++ b/calc/src/data/interface.ts @@ -146,6 +146,7 @@ export interface Specie extends Data { readonly nfe?: boolean; readonly gender?: GenderName; readonly otherFormes?: SpeciesName[]; + readonly canGigantamax?: MoveName; readonly baseSpecies?: SpeciesName; readonly abilities?: {0: AbilityName | ''}; } diff --git a/calc/src/data/moves.ts b/calc/src/data/moves.ts index eaf00d0d2..bfa68858c 100644 --- a/calc/src/data/moves.ts +++ b/calc/src/data/moves.ts @@ -4750,6 +4750,10 @@ const SV_PATCH: {[name: string]: DeepPartial} = { const SV: {[name: string]: MoveData} = extend(true, {}, SS, SV_PATCH); +for (const moveName in SV) { + if (moveName.startsWith('G-Max')) delete SV[moveName]; +} + export const MOVES = [{}, RBY, GSC, ADV, DPP, BW, XY, SM, SS, SV]; export class Moves implements I.Moves { diff --git a/calc/src/data/species.ts b/calc/src/data/species.ts index 8c18ad673..54104e087 100644 --- a/calc/src/data/species.ts +++ b/calc/src/data/species.ts @@ -7513,6 +7513,7 @@ const SS_PATCH: {[name: string]: DeepPartial} = { Kingler: {canGigantamax: "G-Max Foam Burst"}, Lapras: {canGigantamax: "G-Max Resonance"}, Linoone: {otherFormes: ['Linoone-Galar']}, + Machamp: {canGigantamax: "G-Max Chi-Strike"}, Magearna: {otherFormes: ["Magearna-Original"]}, Melmetal: {canGigantamax: "G-Max Meltdown"}, Meowth: {canGigantamax: "G-Max Gold Rush", otherFormes: ['Meowth-Alola', 'Meowth-Galar']}, @@ -8511,6 +8512,12 @@ const SS_PATCH: {[name: string]: DeepPartial} = { const SS: {[name: string]: SpeciesData} = extend(true, {}, SM, SS_PATCH); +for (const speciesName in SS) { + if (SS[speciesName].canGigantamax) { + SS[speciesName + '-Gmax'] = SS[speciesName]; + } +} + delete SS['Pikachu-Starter']; delete SS['Eevee-Starter']; @@ -9520,6 +9527,13 @@ const SV_PATCH: {[name: string]: DeepPartial} = { const SV: {[name: string]: SpeciesData} = extend(true, {}, SS, SV_PATCH, PLA_PATCH); +for (const speciesName in SV) { + if (SV[speciesName].canGigantamax) { + // @ts-ignore readonly + delete SV[speciesName].canGigantamax; + } +} + export const SPECIES = [{}, RBY, GSC, ADV, DPP, BW, XY, SM, SS, SV]; export class Species implements I.Species { @@ -9550,10 +9564,11 @@ class Specie implements I.Specie { readonly nfe?: boolean; readonly gender?: I.GenderName; readonly otherFormes?: I.SpeciesName[]; + readonly canGigantamax?: I.MoveName; readonly baseSpecies?: I.SpeciesName; readonly abilities?: {0: I.AbilityName}; // ability - private static readonly EXCLUDE = new Set(['bs', 'otherFormes']); + private static readonly EXCLUDE = new Set(['bs']); constructor(name: string, data: SpeciesData) { this.kind = 'Species'; @@ -9568,15 +9583,6 @@ class Specie implements I.Specie { baseStats.spd = gen >= 2 ? data.bs.sd : data.bs.sl; baseStats.spe = data.bs.sp; this.baseStats = baseStats as I.StatsTable; - // Hack for getting Gmax pokemon out of existence in Gen 9+ - if (data.otherFormes) { - this.otherFormes = data.otherFormes as I.SpeciesName[]; - if (gen >= 9 && !['toxtricity', 'urshifu'].includes(this.id)) { - this.otherFormes = this.otherFormes.filter(f => !f.endsWith('-Gmax')); - if (!this.otherFormes.length) this.otherFormes = undefined; - if (this.otherFormes) this.otherFormes = [...new Set(this.otherFormes)]; - } - } assignWithout(this, data, Specie.EXCLUDE); } diff --git a/calc/src/move.ts b/calc/src/move.ts index 00badc081..31757313b 100644 --- a/calc/src/move.ts +++ b/calc/src/move.ts @@ -13,7 +13,7 @@ export class Move implements State.Move { item?: I.ItemName; species?: I.SpeciesName; useZ?: boolean; - useMax?: boolean; + useMax?: 'gmax' | boolean; isGmax?: boolean; overrides?: Partial; @@ -64,7 +64,7 @@ export class Move implements State.Move { options.species, !!(data.category === 'Status'), options.ability, - options.isGmax + !!(options.useMax === 'gmax') ); const maxMove = gen.moves.get(toID(maxMoveName)); const maxPower = () => { @@ -112,7 +112,6 @@ export class Move implements State.Move { this.item = options.item; this.useZ = options.useZ; this.useMax = options.useMax; - this.isGmax = options.useMax; this.overrides = options.overrides; this.species = options.species; @@ -178,7 +177,6 @@ export class Move implements State.Move { species: this.species, useZ: this.useZ, useMax: this.useMax, - isGmax: this.isGmax, isCrit: this.isCrit, hits: this.hits, timesUsed: this.timesUsed, @@ -272,8 +270,7 @@ export function getMaxMoveName( } if (moveType === 'Electric') { if (pokemonSpecies === 'Pikachu' && isGmax) return 'G-Max Volt Crash'; - if (pokemonSpecies?.startsWith('Toxtricity') && - pokemonSpecies?.endsWith('Gmax')) return 'G-Max Stun Shock'; + if (pokemonSpecies?.startsWith('Toxtricity') && isGmax) return 'G-Max Stun Shock'; } if (moveType === 'Grass') { if (pokemonSpecies === 'Appletun' && isGmax) return 'G-Max Sweetness'; diff --git a/calc/src/pokemon.ts b/calc/src/pokemon.ts index a1b4f9bb9..00f47fa9d 100644 --- a/calc/src/pokemon.ts +++ b/calc/src/pokemon.ts @@ -53,7 +53,6 @@ export class Pokemon implements State.Pokemon { this.gen = gen; this.name = options.name || name as I.SpeciesName; this.types = this.species.types; - this.weightkg = this.species.weightkg; this.level = options.level || 100; this.gender = options.gender || this.species.gender || 'M'; @@ -61,6 +60,7 @@ export class Pokemon implements State.Pokemon { this.abilityOn = !!options.abilityOn; this.isDynamaxed = !!options.isDynamaxed; + this.weightkg = this.isDynamaxed ? 0 : this.species.weightkg; this.isSaltCure = !!options.isSaltCure; this.alliesFainted = options.alliesFainted; this.teraType = options.teraType; @@ -70,12 +70,6 @@ export class Pokemon implements State.Pokemon { this.evs = Pokemon.withDefault(gen, options.evs, gen.num >= 3 ? 0 : 252); this.boosts = Pokemon.withDefault(gen, options.boosts, 0, false); - // Gigantamax 'forms' inherit weight from their base species when not dynamaxed - // TODO: clean this up with proper Gigantamax support - if (this.weightkg === 0 && !this.isDynamaxed && this.species.baseSpecies) { - this.weightkg = gen.species.get(toID(this.species.baseSpecies))!.weightkg; - } - if (gen.num < 3) { this.ivs.hp = Stats.DVToIV( Stats.getHPDV({ diff --git a/calc/src/state.ts b/calc/src/state.ts index 457725278..69e96e40e 100644 --- a/calc/src/state.ts +++ b/calc/src/state.ts @@ -26,8 +26,7 @@ export namespace State { export interface Move { name: I.MoveName; useZ?: boolean; - useMax?: boolean; - isGmax?: boolean; + useMax?: 'gmax' | boolean; isCrit?: boolean; hits?: number; timesUsed?: number; diff --git a/calc/src/test/gen.ts b/calc/src/test/gen.ts index 0308d1799..384ec77b1 100644 --- a/calc/src/test/gen.ts +++ b/calc/src/test/gen.ts @@ -301,6 +301,7 @@ class Specie implements I.Specie { readonly weightkg: number; readonly nfe?: boolean; readonly gender?: I.GenderName; + readonly canGigantamax?: I.MoveName; readonly otherFormes?: I.SpeciesName[]; readonly baseSpecies?: I.SpeciesName; readonly abilities?: {0: I.AbilityName}; @@ -329,6 +330,7 @@ class Specie implements I.Specie { } else if (species.baseSpecies !== this.name) { this.baseSpecies = species.baseSpecies as I.SpeciesName; } + if (species.canGigantamax) this.canGigantamax = species.canGigantamax; if (dex.gen > 2) this.abilities = {0: species.abilities[0] as I.AbilityName}; } diff --git a/src/honkalculate.template.html b/src/honkalculate.template.html index ea2d0cb4d..f16bb003e 100644 --- a/src/honkalculate.template.html +++ b/src/honkalculate.template.html @@ -438,15 +438,20 @@ /341 ( %) -<<<<<<< HEAD - -======= -
- - - - ->>>>>>> Implement Gigantamaxing properly +
+
+
+ + +
+
+
+
+ + + + +


Health
diff --git a/src/index.template.html b/src/index.template.html index d4eb92e59..8841e1b10 100644 --- a/src/index.template.html +++ b/src/index.template.html @@ -501,19 +501,20 @@ /341 ( %) -<<<<<<< HEAD - - -
-======= -
- - - - -
->>>>>>> Implement Gigantamaxing properly +
+
+
+ + +
+
+
+
+ + + + +

Health
@@ -1389,19 +1390,20 @@ /341 ( %) -<<<<<<< HEAD - - -
-======= -
- - - - -
->>>>>>> Implement Gigantamaxing properly +
+
+
+ + +
+
+
+
+ + + + +

Health
diff --git a/src/js/moveset_import.js b/src/js/moveset_import.js index 66c8dfb45..2677244f8 100644 --- a/src/js/moveset_import.js +++ b/src/js/moveset_import.js @@ -18,7 +18,7 @@ function ExportPokemon(pokeInfo) { finalText += pokemon.nature && gen > 2 ? pokemon.nature + " Nature" + "\n" : ""; finalText += pokemon.teraType && gen > 8 ? "Tera Type: " + pokemon.teraType : ""; finalText += pokemon.ability ? "Ability: " + pokemon.ability + "\n" : ""; - finalText += pokemon.isGigantamaxed ? "Gigantamax: Yes\n" : ""; + finalText += pokemon.isDynamaxed === 'gmax' ? "Gigantamax: Yes\n" : ""; if (gen > 2) { var EVs_Array = []; for (var stat in pokemon.evs) { diff --git a/src/js/shared_controls.js b/src/js/shared_controls.js index fe4949737..70717665f 100644 --- a/src/js/shared_controls.js +++ b/src/js/shared_controls.js @@ -617,6 +617,18 @@ $(".set-selector").change(function () { } else { formeObj.hide(); } + if (gen === 8) { + if (pokemon.canGigantamax) { + $(this).closest('.poke-info').find('.dynamaxOnly').hide(); + $(this).closest('.poke-info').find('.dynamaxAndGigantamax').show(); + } else { + $(this).closest('.poke-info').find('.dynamaxOnly').show(); + $(this).closest('.poke-info').find('.dynamaxAndGigantamax').hide(); + } + } else { + $(this).closest('.poke-info').find('.dynamaxOnly').hide(); + $(this).closest('.poke-info').find('.dynamaxAndGigantamax').hide(); + } calcHP(pokeObj); calcStats(pokeObj); abilityObj.change(); @@ -838,15 +850,17 @@ function createPokemon(pokeInfo) { var ability = pokeInfo.find(".ability").val(); var item = pokeInfo.find(".item").val(); var isDynamaxed = pokeInfo.find(".max").prop("checked"); - var isGigantamaxed = isDynamaxed && pokeInfo.find(".gmax").prop("checked"); + var isGigantamaxed = pokeInfo.find(".gmax").prop("checked"); + if (isGigantamaxed) { + pokeInfo.find(".max").prop("checked", true); + isDynamaxed = pokeInfo.find(".max").prop("checked"); + } var teraType = pokeInfo.find(".teraToggle").is(":checked") ? pokeInfo.find(".teraType").val() : undefined; - pokeInfo.isDynamaxed = isDynamaxed; - pokeInfo.isGigantamaxed = isGigantamaxed; - if (pokeInfo.isGigantamaxed) pokeInfo.isDynamaxed = true; + pokeInfo.isDynamaxed = isGigantamaxed ? 'gmax' : !!isDynamaxed; calcHP(pokeInfo); var curHP = ~~pokeInfo.find(".current-hp").val(); // FIXME the Pokemon constructor expects non-dynamaxed HP - if (isDynamaxed || isGigantamaxed) curHP = Math.floor(curHP / 2); + if (pokeInfo.isDynamaxed) curHP = Math.floor(curHP / 2); var types = [pokeInfo.find(".type1").val(), pokeInfo.find(".type2").val()]; return new calc.Pokemon(gen, name, { level: ~~pokeInfo.find(".level").val(), @@ -866,10 +880,10 @@ function createPokemon(pokeInfo) { status: CALC_STATUS[pokeInfo.find(".status").val()], toxicCounter: status === 'Badly Poisoned' ? ~~pokeInfo.find(".toxic-counter").val() : 0, moves: [ - getMoveDetails(pokeInfo.find(".move1"), name, ability, item, isDynamaxed, isGigantamaxed), - getMoveDetails(pokeInfo.find(".move2"), name, ability, item, isDynamaxed, isGigantamaxed), - getMoveDetails(pokeInfo.find(".move3"), name, ability, item, isDynamaxed, isGigantamaxed), - getMoveDetails(pokeInfo.find(".move4"), name, ability, item, isDynamaxed, isGigantamaxed) + getMoveDetails(pokeInfo.find(".move1"), name, ability, item, isDynamaxed), + getMoveDetails(pokeInfo.find(".move2"), name, ability, item, isDynamaxed), + getMoveDetails(pokeInfo.find(".move3"), name, ability, item, isDynamaxed), + getMoveDetails(pokeInfo.find(".move4"), name, ability, item, isDynamaxed) ], overrides: { baseStats: baseStats, @@ -885,7 +899,7 @@ function getGender(gender) { return 'F'; } -function getMoveDetails(moveInfo, species, ability, item, useMax, isGmax) { +function getMoveDetails(moveInfo, species, ability, item, useMax) { var moveName = moveInfo.find("select.move-selector").val(); var isZMove = gen > 6 && moveInfo.find("input.move-z").prop("checked"); var isCrit = moveInfo.find(".move-crit").prop("checked"); @@ -899,7 +913,7 @@ function getMoveDetails(moveInfo, species, ability, item, useMax, isGmax) { if (gen >= 4) overrides.category = moveInfo.find(".move-cat").val(); return new calc.Move(gen, moveName, { ability: ability, item: item, useZ: isZMove, species: species, isCrit: isCrit, hits: hits, timesUsed: timesUsed, - timesUsedWithMetronome: timesUsedWithMetronome, overrides: overrides, useMax: useMax, isGmax: isGmax + timesUsedWithMetronome: timesUsedWithMetronome, overrides: overrides, useMax: useMax, }); } @@ -996,7 +1010,7 @@ function calcStat(poke, StatID) { } // Shedinja still has 1 max HP during the effect even if its Dynamax Level is maxed (DaWoblefet) var total = calc.calcStat(gen, legacyStatToStat(StatID), base, ivs, evs, level, nature); - if (gen > 7 && StatID === "hp" && (poke.isDynamaxed || poke.isGigantamaxed) && total !== 1) { + if (gen > 7 && StatID === "hp" && poke.isDynamaxed && total !== 1) { total *= 2; } stat.find(".total").text(total); diff --git a/src/randoms.template.html b/src/randoms.template.html index d44bd943a..3b99119ad 100644 --- a/src/randoms.template.html +++ b/src/randoms.template.html @@ -518,19 +518,20 @@ /341 ( %) -<<<<<<< HEAD - - -
-======= -
- - - - -
->>>>>>> Implement Gigantamaxing properly +
+
+
+ + +
+
+
+
+ + + + +

Health
@@ -1379,19 +1380,20 @@ /341 ( %) -<<<<<<< HEAD - - -
-======= -
- - - - -
->>>>>>> Implement Gigantamaxing properly +
+
+
+ + +
+
+
+ + +
+ + +

Health