Skip to content

Commit

Permalink
Split failing Commander switch out test and band-aid-fix Commander + …
Browse files Browse the repository at this point in the history
…Eject Pack
  • Loading branch information
pyuk-bot committed Dec 27, 2024
1 parent a0ed1dd commit 95409ab
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion data/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,8 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
this.singleEvent('Update', this.effect, this.effectState, target);
},
onUpdate(pokemon) {
if (this.gameType !== 'doubles' || !this.effectState.started) return;
const ally = pokemon.allies()[0];
if (this.gameType !== 'doubles' || !this.effectState.started || pokemon.switchFlag || ally?.switchFlag) return;
if (!ally || pokemon.baseSpecies.baseSpecies !== 'Tatsugiri' || ally.baseSpecies.baseSpecies !== 'Dondozo') {
// Handle any edge cases
if (pokemon.getVolatile('commanding')) pokemon.removeVolatile('commanding');
Expand Down
32 changes: 23 additions & 9 deletions test/sim/abilities/commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,14 @@ describe('Commander', function () {
{species: 'wynaut', item: 'redcard', ability: 'noguard', moves: ['sleeptalk', 'tackle', 'dragontail']},
{species: 'gyarados', item: 'ejectbutton', ability: 'intimidate', moves: ['sleeptalk', 'trick', 'roar']},
], [
{species: 'tatsugiri', ability: 'commander', item: 'ejectpack', moves: ['sleeptalk']},
{species: 'dondozo', item: 'ejectpack', moves: ['sleeptalk', 'peck']},
{species: 'tatsugiri', ability: 'commander', moves: ['sleeptalk']},
{species: 'dondozo', moves: ['sleeptalk', 'peck']},
{species: 'rufflet', moves: ['sleeptalk']},
]]);

const tatsugiri = battle.p2.active[0];
// const tatsugiri = battle.p2.active[0];
const dondozo = battle.p2.active[1];

assert.statStage(tatsugiri, 'atk', -1);
assert.equal(battle.requestState, 'move', 'It should not have switched out on Eject Pack');
assert.holdsItem(tatsugiri);
assert.statStage(dondozo, 'atk', 1);
assert.holdsItem(dondozo);

battle.makeChoices('move tackle 2, move trick 2', 'auto');
assert.holdsItem(dondozo);
assert.equal(battle.requestState, 'move', 'It should not have switched out on Eject Button');
Expand All @@ -132,6 +126,26 @@ describe('Commander', function () {
assert.equal(battle.requestState, 'move', 'It should not have switched out on standard phazing moves');
});

it.skip(`should prevent Eject Pack switchouts`, function () {
battle = common.createBattle({gameType: 'doubles'}, [[
{species: 'wynaut', item: 'redcard', ability: 'noguard', moves: ['sleeptalk', 'tackle', 'dragontail']},
{species: 'gyarados', item: 'ejectbutton', ability: 'intimidate', moves: ['sleeptalk', 'trick', 'roar']},
], [
{species: 'tatsugiri', ability: 'commander', item: 'ejectpack', moves: ['sleeptalk']},
{species: 'dondozo', item: 'ejectpack', moves: ['sleeptalk', 'peck']},
{species: 'rufflet', moves: ['sleeptalk']},
]]);

const tatsugiri = battle.p2.active[0];
const dondozo = battle.p2.active[1];

assert.statStage(tatsugiri, 'atk', -1);
assert.equal(battle.requestState, 'move', 'It should not have switched out on Eject Pack');
assert.holdsItem(tatsugiri);
assert.statStage(dondozo, 'atk', 1);
assert.holdsItem(dondozo);
});

it(`should cause Dondozo to stay commanded even if Tatsugiri faints`, function () {
battle = common.createBattle({gameType: 'doubles'}, [[
{species: 'hypno', moves: ['sleeptalk']},
Expand Down

0 comments on commit 95409ab

Please sign in to comment.