Skip to content

Commit

Permalink
Support Teal Mask DLC changes (#2147)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik99999 authored Sep 13, 2023
1 parent 87edf47 commit a4d4762
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
22 changes: 14 additions & 8 deletions js/client-teambuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@
}
}
if (this.curTeam.gen === 9) {
buf += '<span class="detailcell"><label>Tera Type</label>' + (set.teraType || species.types[0]) + '</span>';
buf += '<span class="detailcell"><label>Tera Type</label>' + (species.forceTeraType || set.teraType || species.types[0]) + '</span>';
}
}
buf += '</button></div></div>';
Expand Down Expand Up @@ -2689,13 +2689,19 @@
}

if (this.curTeam.gen === 9) {
buf += '<div class="formrow"><label class="formlabel" title="Tera Type">Tera Type:</label><div><select name="teratype">';
var types = Dex.types.all();
var teraType = set.teraType || species.types[0];
for (var i = 0; i < types.length; i++) {
buf += '<option value="' + types[i].name + '"' + (teraType === types[i].name ? ' selected="selected"' : '') + '>' + types[i].name + '</option>';
buf += '<div class="formrow"><label class="formlabel" title="Tera Type">Tera Type:</label><div>';
if (species.forceTeraType) {
buf += species.forceTeraType;
} else {
buf += '<select name="teratype">';
var types = Dex.types.all();
var teraType = set.teraType || species.types[0];
for (var i = 0; i < types.length; i++) {
buf += '<option value="' + types[i].name + '"' + (teraType === types[i].name ? ' selected="selected"' : '') + '>' + types[i].name + '</option>';
}
buf += '</select>';
}
buf += '</select></div></div>';
buf += '</div></div>';
}

buf += '</form>';
Expand Down Expand Up @@ -2806,7 +2812,7 @@
}
}
if (this.curTeam.gen === 9) {
buf += '<span class="detailcell"><label>Tera Type</label>' + (set.teraType || species.types[0]) + '</span>';
buf += '<span class="detailcell"><label>Tera Type</label>' + (species.forceTeraType || set.teraType || species.types[0]) + '</span>';
}
}
this.$('button[name=details]').html(buf);
Expand Down
1 change: 1 addition & 0 deletions src/battle-animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1807,6 +1807,7 @@ export class PokemonSprite extends Sprite {
octolock: ['Octolock', 'bad'],
tarshot: ['Tar Shot', 'bad'],
saltcure: ['Salt Cure', 'bad'],
syrupbomb: ['Syrupy', 'bad'],
doomdesire: null,
futuresight: null,
mimic: ['Mimic', 'good'],
Expand Down
10 changes: 6 additions & 4 deletions src/battle-dex-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1412,9 +1412,10 @@ class Species implements Effect {
readonly tier: string;
readonly isTotem: boolean;
readonly isMega: boolean;
readonly cannotDynamax: boolean;
readonly canGigantamax: boolean;
readonly isPrimal: boolean;
readonly canGigantamax: boolean;
readonly cannotDynamax: boolean;
readonly forceTeraType: TypeName;
readonly battleOnly: string | string[] | undefined;
readonly isNonstandard: string | null;
readonly unreleasedHidden: boolean | 'Past';
Expand Down Expand Up @@ -1466,9 +1467,10 @@ class Species implements Effect {

this.isTotem = false;
this.isMega = !!(this.forme && ['-mega', '-megax', '-megay'].includes(this.formeid));
this.cannotDynamax = !!data.cannotDynamax;
this.canGigantamax = !!data.canGigantamax;
this.isPrimal = !!(this.forme && this.formeid === '-primal');
this.canGigantamax = !!data.canGigantamax;
this.cannotDynamax = !!data.cannotDynamax;
this.forceTeraType = data.forceTeraType || '';
this.battleOnly = data.battleOnly || undefined;
this.isNonstandard = data.isNonstandard || null;
this.unreleasedHidden = data.unreleasedHidden || false;
Expand Down
14 changes: 14 additions & 0 deletions src/battle-tooltips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,20 @@ class BattleTooltips {
break;
}
}
// Ivy Cudgel's type depends on the Ogerpon forme
if (move.id === 'ivycudgel') {
switch (pokemon.getSpeciesForme()) {
case 'Ogerpon-Wellspring': case 'Ogerpon-Wellspring-Tera':
moveType = 'Water';
break;
case 'Ogerpon-Hearthflame': case 'Ogerpon-Hearthflame-Tera':
moveType = 'Fire';
break;
case 'Ogerpon-Cornerstone': case 'Ogerpon-Cornerstone-Tera':
moveType = 'Rock';
break;
}
}

// Other abilities that change the move type.
const noTypeOverride = [
Expand Down
2 changes: 1 addition & 1 deletion src/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ export class Pokemon implements PokemonDetails, PokemonHealth {
// this.lastMove = pokemon.lastMove; // I think
if (!copySource) {
const volatilesToRemove = [
'airballoon', 'attract', 'autotomize', 'disable', 'encore', 'foresight', 'gmaxchistrike', 'imprison', 'laserfocus', 'mimic', 'miracleeye', 'nightmare', 'saltcure', 'smackdown', 'stockpile1', 'stockpile2', 'stockpile3', 'torment', 'typeadd', 'typechange', 'yawn',
'airballoon', 'attract', 'autotomize', 'disable', 'encore', 'foresight', 'gmaxchistrike', 'imprison', 'laserfocus', 'mimic', 'miracleeye', 'nightmare', 'saltcure', 'smackdown', 'stockpile1', 'stockpile2', 'stockpile3', 'syrupbomb', 'torment', 'typeadd', 'typechange', 'yawn',
];
for (const statName of Dex.statNamesExceptHP) {
volatilesToRemove.push('protosynthesis' + statName);
Expand Down

0 comments on commit a4d4762

Please sign in to comment.