diff --git a/config/formats.ts b/config/formats.ts index 38f10829d3a7..37549c0dabbf 100644 --- a/config/formats.ts +++ b/config/formats.ts @@ -1760,13 +1760,11 @@ export const Formats: import('../sim/dex-formats').FormatList = [ return [this.terastallized]; } const types = this.battle.runEvent('Type', this, null, null, this.types); + if (!types.length) types.push(this.battle.gen >= 5 ? 'Normal' : '???'); if (!excludeAdded && this.addedType) return types.concat(this.addedType); const addTeraType = this.m.thirdType; - if (types.length) { - if (addTeraType) return Array.from(new Set([...types, addTeraType])); - return types; - } - return [this.battle.gen >= 5 ? 'Normal' : '???']; + if (addTeraType) return Array.from(new Set([...types, addTeraType])); + return types; }, runEffectiveness(move) { if ((this.terastallized || this.m.thirdType) && move.type === 'Stellar') return 1; diff --git a/sim/pokemon.ts b/sim/pokemon.ts index bca968b7ec95..9a9bd5da2e78 100644 --- a/sim/pokemon.ts +++ b/sim/pokemon.ts @@ -2043,9 +2043,9 @@ export class Pokemon { return [this.terastallized]; } const types = this.battle.runEvent('Type', this, null, null, this.types); + if (!types.length) types.push(this.battle.gen >= 5 ? 'Normal' : '???'); if (!excludeAdded && this.addedType) return types.concat(this.addedType); - if (types.length) return types; - return [this.battle.gen >= 5 ? 'Normal' : '???']; + return types; } isGrounded(negateImmunity = false) { diff --git a/test/sim/moves/roost.js b/test/sim/moves/roost.js index 5151e241aee6..690989a124b9 100644 --- a/test/sim/moves/roost.js +++ b/test/sim/moves/roost.js @@ -73,7 +73,13 @@ describe('Roost', function () { it('should treat a pure Flying pokémon as Normal type', function () { battle = common.createBattle(); battle.setPlayer('p1', {team: [{species: "Tornadus", item: 'focussash', ability: 'prankster', moves: ['roost']}]}); - battle.setPlayer('p2', {team: [{species: "Gastly", item: 'laggingtail', ability: 'levitate', moves: ['astonish']}]}); + battle.setPlayer('p2', {team: [{species: "Gastly", item: 'laggingtail', ability: 'levitate', moves: ['astonish', 'trickortreat']}]}); + battle.makeChoices('move roost', 'move astonish'); + battle.makeChoices('move roost', 'move astonish'); + assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp); // Immune to Astonish + + // Ensure that it also replaces the Flying type with Normal even when there is an added type + battle.makeChoices('move roost', 'move trickortreat'); battle.makeChoices('move roost', 'move astonish'); battle.makeChoices('move roost', 'move astonish'); assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp); // Immune to Astonish