Don't force Tera types because of Hackmons (#2324)
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run

---------

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
This commit is contained in:
André Bastos Dias 2025-05-13 22:45:16 +01:00 committed by GitHub
parent bfb2813c72
commit 73ea84c0d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 24 deletions

View File

@ -1345,7 +1345,7 @@
}
}
if (this.curTeam.gen === 9) {
buf += '<span class="detailcell"><label>Tera Type</label>' + (species.forceTeraType || set.teraType || species.types[0]) + '</span>';
buf += '<span class="detailcell"><label>Tera Type</label>' + (set.teraType || species.requiredTeraType || species.types[0]) + '</span>';
}
}
buf += '</button></div></div>';
@ -1882,7 +1882,7 @@
// never preserve current set tera, even if smogon set used default
if (this.curSet.gen === 9) {
curSet.teraType = species.forceTeraType || sampleSet.teraType || species.types[0];
curSet.teraType = sampleSet.teraType || species.requiredTeraType || species.types[0];
}
var text = Storage.exportTeam([curSet], this.curTeam.gen);
@ -2913,18 +2913,13 @@
if (this.curTeam.gen === 9) {
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" class="button">';
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 name="teratype" class="button">';
var types = Dex.types.all();
var teraType = set.teraType || species.requiredTeraType || 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></div>';
buf += '</select></div></div>';
}
buf += '</form>';
@ -3035,7 +3030,7 @@
}
}
if (this.curTeam.gen === 9) {
buf += '<span class="detailcell"><label>Tera Type</label>' + (species.forceTeraType || set.teraType || species.types[0]) + '</span>';
buf += '<span class="detailcell"><label>Tera Type</label>' + (set.teraType || species.requiredTeraType || species.types[0]) + '</span>';
}
}
this.$('button[name=details]').html(buf);

View File

@ -1419,7 +1419,7 @@ Storage.exportTeam = function (team, gen, hidestats) {
}
if (gen === 9) {
var species = Dex.species.get(curSet.species);
text += 'Tera Type: ' + (species.forceTeraType || curSet.teraType || species.types[0]) + " \n";
text += 'Tera Type: ' + (curSet.teraType || species.requiredTeraType || species.types[0]) + " \n";
}
if (!hidestats) {
var first = true;

View File

@ -1506,7 +1506,7 @@ export class Species implements Effect {
readonly isPrimal: boolean;
readonly canGigantamax: boolean;
readonly cannotDynamax: boolean;
readonly forceTeraType: TypeName;
readonly requiredTeraType: TypeName;
readonly battleOnly: string | string[] | undefined;
readonly isNonstandard: string | null;
readonly unreleasedHidden: boolean | 'Past';
@ -1562,7 +1562,7 @@ export class Species implements Effect {
this.isPrimal = !!(this.forme && this.formeid === '-primal');
this.canGigantamax = !!data.canGigantamax;
this.cannotDynamax = !!data.cannotDynamax;
this.forceTeraType = data.forceTeraType || '';
this.requiredTeraType = data.requiredTeraType || '';
this.battleOnly = data.battleOnly || (this.isMega ? this.baseSpecies : undefined);
this.isNonstandard = data.isNonstandard || null;
this.unreleasedHidden = data.unreleasedHidden || false;

View File

@ -1344,7 +1344,7 @@ export const Teams = new class {
}
if (gen === 9) {
const species = Dex.species.get(curSet.species);
text += `Tera Type: ${species.forceTeraType || curSet.teraType || species.types[0]} \n`;
text += `Tera Type: ${curSet.teraType || species.requiredTeraType || species.types[0]} \n`;
}
if (!hidestats) {
let first = true;

View File

@ -1296,7 +1296,7 @@ class TeamTextbox extends preact.Component<{ editor: TeamEditorState, onChange?:
</span>
{editor.gen === 9 ? (
<span class="detailcell">
<label>Tera</label>{TeamEditor.renderTypeIcon(set.teraType || species.forceTeraType || species.types[0])}
<label>Tera</label>{TeamEditor.renderTypeIcon(set.teraType || species.requiredTeraType || species.types[0])}
</span>
) : editor.hpTypeMatters(set) ? (
<span class="detailcell">
@ -1590,7 +1590,7 @@ class TeamWizard extends preact.Component<{
</span>}
{editor.gen === 9 && <span class="detailcell">
<strong class="label">Tera</strong> {}
{TeamEditor.renderTypeIcon(set.teraType || species.forceTeraType || species.types[0])}
{TeamEditor.renderTypeIcon(set.teraType || species.requiredTeraType || species.types[0])}
</span>}
{editor.hpTypeMatters(set) && <span class="detailcell">
<strong class="label">H.P.</strong> {}
@ -2464,7 +2464,7 @@ class DetailsForm extends preact.Component<{
const target = ev.currentTarget as HTMLInputElement;
const { editor, set } = this.props;
const species = editor.dex.species.get(set.species);
if (!target.value || target.value === (species.forceTeraType || species.types[0])) {
if (!target.value || target.value === (species.requiredTeraType || species.types[0])) {
delete set.teraType;
} else {
set.teraType = target.value.trim();
@ -2638,12 +2638,12 @@ class DetailsForm extends preact.Component<{
{editor.gen === 9 && <p>
<label class="label" title="Tera Type">
Tera Type: {}
{species.forceTeraType ? (
<select name="teratype" class="button cur" disabled><option>{species.forceTeraType}</option></select>
{species.requiredTeraType && editor.formeLegality === 'normal' ? (
<select name="teratype" class="button cur" disabled><option>{species.requiredTeraType}</option></select>
) : (
<select name="teratype" class="button" onChange={this.changeTera}>
{Dex.types.all().map(type => (
<option value={type.name} selected={(set.teraType || species.types[0]) === type.name}>
<option value={type.name} selected={(set.teraType || species.requiredTeraType || species.types[0]) === type.name}>
{type.name}
</option>
))}