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

Allow Tera Shell to work in Inverse battles #10599

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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`);
});
});
Loading