Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Terastallize Ogerpon and Terapagos with different Tera types #10814

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions data/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,9 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
},
embodyaspectcornerstone: {
onStart(pokemon) {
if (pokemon.baseSpecies.name === 'Ogerpon-Cornerstone-Tera' &&
this.effectState.embodied !== pokemon.previouslySwitchedIn) {
if (pokemon.baseSpecies.name === 'Ogerpon-Cornerstone-Tera' && pokemon.terastallized &&
this.effectState.embodied !== pokemon.previouslySwitchedIn
) {
this.effectState.embodied = pokemon.previouslySwitchedIn;
this.boost({def: 1}, pokemon);
}
Expand All @@ -1180,8 +1181,9 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
},
embodyaspecthearthflame: {
onStart(pokemon) {
if (pokemon.baseSpecies.name === 'Ogerpon-Hearthflame-Tera' &&
this.effectState.embodied !== pokemon.previouslySwitchedIn) {
if (pokemon.baseSpecies.name === 'Ogerpon-Hearthflame-Tera' && pokemon.terastallized &&
this.effectState.embodied !== pokemon.previouslySwitchedIn
) {
this.effectState.embodied = pokemon.previouslySwitchedIn;
this.boost({atk: 1}, pokemon);
}
Expand All @@ -1193,8 +1195,9 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
},
embodyaspectteal: {
onStart(pokemon) {
if (pokemon.baseSpecies.name === 'Ogerpon-Teal-Tera' &&
this.effectState.embodied !== pokemon.previouslySwitchedIn) {
if (pokemon.baseSpecies.name === 'Ogerpon-Teal-Tera' && pokemon.terastallized &&
this.effectState.embodied !== pokemon.previouslySwitchedIn
) {
this.effectState.embodied = pokemon.previouslySwitchedIn;
this.boost({spe: 1}, pokemon);
}
Expand All @@ -1206,8 +1209,9 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
},
embodyaspectwellspring: {
onStart(pokemon) {
if (pokemon.baseSpecies.name === 'Ogerpon-Wellspring-Tera' &&
this.effectState.embodied !== pokemon.previouslySwitchedIn) {
if (pokemon.baseSpecies.name === 'Ogerpon-Wellspring-Tera' && pokemon.terastallized &&
this.effectState.embodied !== pokemon.previouslySwitchedIn
) {
this.effectState.embodied = pokemon.previouslySwitchedIn;
this.boost({spd: 1}, pokemon);
}
Expand Down Expand Up @@ -4842,6 +4846,13 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
if (pokemon.baseSpecies.name !== 'Terapagos-Stellar') return;
if (this.field.weather || this.field.terrain) {
this.add('-ability', pokemon, 'Teraform Zero');
if (pokemon.terastallized !== 'Stellar') {
if (this.field.weather || this.field.terrain) {
// display fail message https://www.youtube.com/watch?v=g-eUP0IrxI0
this.hint("Teraform Zero fails to remove the weather and the terrain if Terapagos-Stellar is not Tera-Stellar.");
}
return;
}
this.field.clearWeather();
this.field.clearTerrain();
}
Expand Down
11 changes: 8 additions & 3 deletions sim/battle-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1928,6 +1928,10 @@ export class BattleActions {
if (pokemon.getItem().zMove || pokemon.canMegaEvo || this.dex.gen !== 9) {
return null;
}
if (pokemon.species.baseSpecies === 'Ogerpon' && !['Fire', 'Grass', 'Rock', 'Water'].includes(pokemon.teraType)) {
this.battle.hint("Ogerpon can only terastallize into Fire, Grass, Rock or Water types, or the game gets softlocked.");
return null;
}
return pokemon.teraType;
}

Expand All @@ -1946,10 +1950,11 @@ export class BattleActions {
pokemon.knownType = true;
pokemon.apparentType = type;
if (pokemon.species.baseSpecies === 'Ogerpon') {
const tera = pokemon.species.id === 'ogerpon' ? 'tealtera' : 'tera';
pokemon.formeChange(pokemon.species.id + tera, null, true);
let ogerponSpecies = toID(pokemon.species.battleOnly || pokemon.species.id);
ogerponSpecies += ogerponSpecies === 'ogerpon' ? 'tealtera' : 'tera';
pokemon.formeChange(ogerponSpecies, null, true);
}
if (pokemon.species.name === 'Terapagos-Terastal' && type === 'Stellar') {
if (pokemon.species.name === 'Terapagos-Terastal') {
pokemon.formeChange('Terapagos-Stellar', null, true);
pokemon.baseMaxhp = Math.floor(Math.floor(
2 * pokemon.species.baseStats['hp'] + pokemon.set.ivs['hp'] + Math.floor(pokemon.set.evs['hp'] / 4) + 100
Expand Down
14 changes: 13 additions & 1 deletion sim/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1387,14 +1387,26 @@ export class Pokemon {
this.illusion ? this.illusion.species.name : species.baseSpecies;
if (isPermanent) {
this.baseSpecies = rawSpecies;
this.details = species.name + (this.level === 100 ? '' : ', L' + this.level) +
let displayedSpeciesName = species.name;
if (species.baseSpecies === 'Ogerpon' && this.terastallized && this.teraType !== species.forceTeraType) {
switch (this.teraType) {
andrebastosdias marked this conversation as resolved.
Show resolved Hide resolved
case 'Grass': displayedSpeciesName = 'Ogerpon-Teal-Tera'; break;
case 'Water': displayedSpeciesName = 'Ogerpon-Wellspring-Tera'; break;
case 'Fire': displayedSpeciesName = 'Ogerpon-Hearthflame-Tera'; break;
case 'Rock': displayedSpeciesName = 'Ogerpon-Cornerstone-Tera'; break;
}
}
this.details = displayedSpeciesName + (this.level === 100 ? '' : ', L' + this.level) +
(this.gender === '' ? '' : ', ' + this.gender) + (this.set.shiny ? ', shiny' : '');
let details = (this.illusion || this).details;
if (this.terastallized) details += `, tera:${this.terastallized}`;
this.battle.add('detailschange', this, details);
if (!source) {
// Tera forme
// Ogerpon/Terapagos text goes here
if (species.baseSpecies === 'Ogerpon' && this.terastallized && this.teraType !== species.forceTeraType) {
this.battle.hint(`Ogerpon terastallized into ${species.name}, but it has taken the appearance of ${displayedSpeciesName} due to its tera type being ${this.teraType}.`);
}
} else if (source.effectType === 'Item') {
this.canTerastallize = null; // National Dex behavior
if (source.zMove) {
Expand Down
2 changes: 1 addition & 1 deletion sim/team-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ export class TeamValidator {
set.hpType = type.name;
}
}
if (species.forceTeraType) {
if (species.forceTeraType && ruleTable.has('obtainablemisc')) {
set.teraType = species.forceTeraType;
}
if (set.teraType) {
Expand Down
76 changes: 76 additions & 0 deletions test/sim/misc/ogerpon.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,80 @@ describe(`[Hackmons] Ogerpon`, function () {
battle.makeChoices('switch 2', 'auto');
assert.equal(ogerpon.ability, 'embodyaspectteal', `Ogerpon's ability should be Embody Aspect after switching out`);
});

it(`can't Terastallize into a type other than Fire, Grass, Rock or Water`, function () {
battle = common.gen(9).createBattle([[
{species: 'ogerponwellspringtera', ability: 'embodyaspectwellspring', moves: ['sleeptalk'], teraType: 'Electric'},
], [
{species: 'silicobra', moves: ['stealthrock']},
]]);
assert.throws(() => battle.makeChoices('move sleeptalk terastallize', 'auto'), "/Can't move: Ogerpon can't Terastallize./");
});

// https://www.smogon.com/forums/threads/ogerpon-teal-tera-tera-can-exist.3742851/post-10132811
it(`can Terastallize to a type other than its mask type`, function () {
battle = common.gen(9).createBattle([[
{species: 'ogerponwellspring', ability: 'waterabsorb', moves: ['ivycudgel'], teraType: 'Rock'},
], [
{species: 'seismitoad', ability: 'waterabsorb', moves: ['stealthrock']},
]]);
const ogerpon = battle.p1.active[0];
battle.makeChoices('move ivycudgel terastallize', 'auto');
assert.species(ogerpon, 'Ogerpon-Wellspring-Tera');
assert.equal(ogerpon.ability, 'embodyaspectwellspring');
assert.statStage(ogerpon, 'spd', 1);
assert.equal(ogerpon.getTypes().join(''), 'Rock');
assert.fullHP(battle.p2.active[0]);
assert(battle.log.includes('|detailschange|p1a: Ogerpon|Ogerpon-Cornerstone-Tera, F, tera:Rock') >= 0);
});

// https://www.smogon.com/forums/threads/ogerpon-teal-tera-tera-can-exist.3742851/post-10132811
it(`Tera form can Terastallize`, function () {
battle = common.gen(9).createBattle([[
{species: 'ogerponwellspringtera', ability: 'embodyaspectwellspring', moves: ['ivycudgel'], teraType: 'Water'},
], [
{species: 'seismitoad', ability: 'waterabsorb', moves: ['stealthrock']},
]]);
const ogerpon = battle.p1.active[0];
battle.makeChoices('move ivycudgel terastallize', 'auto');
assert.species(ogerpon, 'Ogerpon-Wellspring-Tera');
assert.equal(ogerpon.ability, 'embodyaspectwellspring');
assert.statStage(ogerpon, 'spd', 1);
assert.equal(ogerpon.getTypes().join(''), 'Water');
assert.fullHP(battle.p2.active[0]);
assert(battle.log.includes('|detailschange|p1a: Ogerpon|Ogerpon-Wellspring-Tera, F, tera:Water') >= 0);
});

// https://www.smogon.com/forums/threads/ogerpon-teal-tera-tera-can-exist.3742851/post-10132811
it(`Tera form can Terastallize to a type other than its mask type`, function () {
battle = common.gen(9).createBattle([[
{species: 'ogerponwellspringtera', ability: 'embodyaspectwellspring', moves: ['ivycudgel'], teraType: 'Rock'},
], [
{species: 'seismitoad', ability: 'waterabsorb', moves: ['stealthrock']},
]]);
const ogerpon = battle.p1.active[0];
battle.makeChoices('move ivycudgel terastallize', 'auto');
assert.species(ogerpon, 'Ogerpon-Wellspring-Tera');
assert.equal(ogerpon.ability, 'embodyaspectwellspring');
assert.statStage(ogerpon, 'spd', 1);
assert.equal(ogerpon.getTypes().join(''), 'Rock');
assert.fullHP(battle.p2.active[0]);
assert(battle.log.includes('|detailschange|p1a: Ogerpon|Ogerpon-Cornerstone-Tera, F, tera:Rock') >= 0);
});

// https://www.smogon.com/forums/threads/ogerpon-teal-tera-tera-can-exist.3742851/post-10132811
it(`Embody Aspect should not activate unless the user is Terastallized`, function () {
battle = common.gen(9).createBattle([[
{species: 'ogerponwellspringtera', ability: 'embodyaspectwellspring', moves: ['sleeptalk'], teraType: 'Water'},
], [
{species: 'silicobra', moves: ['stealthrock']},
]]);
const ogerpon = battle.p1.active[0];
battle.makeChoices();
assert.species(ogerpon, 'Ogerpon-Wellspring-Tera');
assert.statStage(ogerpon, 'spd', 0);
battle.makeChoices('move sleeptalk terastallize', 'auto');
assert.species(ogerpon, 'Ogerpon-Wellspring-Tera');
assert.statStage(ogerpon, 'spd', 1);
});
});
14 changes: 14 additions & 0 deletions test/sim/misc/terapagos.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,18 @@ describe(`Terapagos`, function () {
const terapagos = battle.p1.active[0];
assert.species(terapagos, 'Terapagos-Terastal');
});

it(`[Hackmons] can Terastallize into other types, but Teraform Zero fails`, function () {
battle = common.createBattle([[
{species: 'terapagos', ability: 'terashift', moves: ['sleeptalk'], teraType: 'Fire'},
], [
{species: 'kyogre', ability: 'drizzle', moves: ['sleeptalk']},
]]);
const terapagos = battle.p1.active[0];
battle.makeChoices('move sleeptalk terastallize', 'auto');
assert.species(terapagos, 'Terapagos-Stellar');
assert.equal(terapagos.terastallized, 'Fire');
assert(battle.log.includes('|-ability|p1a: Terapagos|Teraform Zero'), 'Teraform Zero should activate');
assert.equal(battle.field.weather, 'raindance', 'Teraform Zero should fail');
});
});
Loading