Skip to content

Commit

Permalink
Actually fix called Rollout's targeting (#10764)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyuk-bot authored Dec 19, 2024
1 parent 9d255d0 commit bd537f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
10 changes: 2 additions & 8 deletions data/moves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9578,10 +9578,7 @@ export const Moves: import('../sim/dex-moves').MoveDataTable = {
onModifyMove(move, pokemon, target) {
if (pokemon.volatiles['iceball'] || pokemon.status === 'slp' || !target) return;
pokemon.addVolatile('iceball');
// @ts-ignore
// TS thinks pokemon.volatiles['iceball'] doesn't exist because of the condition on the return above
// but it does exist now because addVolatile created it
pokemon.volatiles['iceball'].targetSlot = move.sourceEffect ? pokemon.lastMoveTargetLoc : pokemon.getLocOf(target);
if (move.sourceEffect) pokemon.lastMoveTargetLoc = pokemon.getLocOf(target);
},
onAfterMove(source, target, move) {
const iceballData = source.volatiles["iceball"];
Expand Down Expand Up @@ -15946,10 +15943,7 @@ export const Moves: import('../sim/dex-moves').MoveDataTable = {
onModifyMove(move, pokemon, target) {
if (pokemon.volatiles['rollout'] || pokemon.status === 'slp' || !target) return;
pokemon.addVolatile('rollout');
// @ts-ignore
// TS thinks pokemon.volatiles['rollout'] doesn't exist because of the condition on the return above
// but it does exist now because addVolatile created it
pokemon.volatiles['rollout'].targetSlot = move.sourceEffect ? pokemon.lastMoveTargetLoc : pokemon.getLocOf(target);
if (move.sourceEffect) pokemon.lastMoveTargetLoc = pokemon.getLocOf(target);
},
onAfterMove(source, target, move) {
const rolloutData = source.volatiles["rollout"];
Expand Down
10 changes: 5 additions & 5 deletions test/sim/misc/target-resolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,18 +361,18 @@ describe('Target Resolution', function () {
// hardcoded RNG seed to show the erroneous targeting behavior
battle = common.createBattle({gameType: 'doubles', seed: [1, 2, 3, 4]}, [[
{species: 'shuckle', ability: 'compoundeyes', moves: ['copycat']},
{species: 'foongus', moves: ['spore']},
{species: 'foongus', item: 'laggingtail', moves: ['spore']},
], [
{species: 'aggron', moves: ['sleeptalk']},
{species: 'slowbro', moves: ['rollout']},
{species: 'aggron', moves: ['splash']},
{species: 'slowbro', moves: ['splash', 'rollout']},
]]);

battle.makeChoices('move copycat, move spore 2', 'auto');
battle.makeChoices('move copycat, move spore 2', 'move splash, move rollout 1');
// Determine which slot was damaged on first turn of Rollout
const aggron = battle.p2.active[0];
const notTargetedPokemon = aggron.hp === aggron.maxhp ? aggron : battle.p2.active[1];

for (let i = 0; i < 4; i++) battle.makeChoices();
for (let i = 0; i < 5; i++) battle.makeChoices();
assert.fullHP(notTargetedPokemon);
});
});

0 comments on commit bd537f6

Please sign in to comment.