Skip to content

Commit

Permalink
Fix Roost on pure Flying types not keeping Normal type with added type (
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik99999 authored Aug 1, 2024
1 parent 116664c commit 2e3de2f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 3 additions & 5 deletions config/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions sim/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 7 additions & 1 deletion test/sim/moves/roost.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2e3de2f

Please sign in to comment.