Skip to content

Commit

Permalink
Allow Tera Shell to work in Inverse battles (#10599)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkerab authored Oct 5, 2024
1 parent 74a6da2 commit ae14c6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion data/rulesets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,8 @@ export const Rulesets: import('../sim/dex-formats').FormatDataTable = {
// The effectiveness of Freeze Dry on Water isn't reverted
if (move && move.id === 'freezedry' && type === 'Water') return;
if (move && !this.dex.getImmunity(move, type)) return 1;
return -typeMod;
// Ignore normal effectiveness, prevents bug with Tera Shell
if (typeMod) return -typeMod;
},
},

Expand Down
15 changes: 15 additions & 0 deletions test/sim/misc/inversebattle.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,19 @@ describe('Inverse Battle', function () {
battle.makeChoices();
assert.equal(battle.p2.active[0].status, 'slp');
});

it(`should let Tera Shell take not very effective damage`, function () {
battle = common.createBattle({inverseMod: true}, [[
{species: 'wynaut', moves: ['wickedblow']},
], [
{species: 'Terapagos-Terastal', ability: 'terashell', moves: ['sleeptalk']},
]]);
battle.makeChoices();
const terapagos = battle.p2.active[0];
const damage = terapagos.maxhp - terapagos.hp;
assert.bounded(damage, [14, 16], `Tera Shell should yield not very effective damage roll, actual damage taken is ${damage}`);

battle.makeChoices();
assert.bounded(terapagos.maxhp - terapagos.hp - damage, [28, 33], `Tera Shell should not reduce damage, because Terapagos-Terastal was not at full HP`);
});
});

0 comments on commit ae14c6f

Please sign in to comment.