mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-09-08 01:05:31 -05:00
Correct Room Service event timing (#8959)
This commit is contained in:
committed by
GitHub
parent
2d8a955e24
commit
ff4e51f728
@@ -4576,7 +4576,13 @@ export const Items: {[itemid: string]: ItemData} = {
|
||||
fling: {
|
||||
basePower: 100,
|
||||
},
|
||||
onUpdate(pokemon) {
|
||||
onStart(pokemon) {
|
||||
if (!pokemon.ignoringItem() && this.field.getPseudoWeather('trickroom')) {
|
||||
pokemon.useItem();
|
||||
}
|
||||
},
|
||||
onAnyPseudoWeatherStart() {
|
||||
const pokemon = this.effectState.target;
|
||||
if (this.field.getPseudoWeather('trickroom')) {
|
||||
pokemon.useItem();
|
||||
}
|
||||
|
||||
@@ -375,6 +375,7 @@ export interface EventMethods {
|
||||
onAnyNegateImmunity?: ((this: Battle, pokemon: Pokemon, type: string) => boolean | void) | boolean;
|
||||
onAnyOverrideAction?: (this: Battle, pokemon: Pokemon, target: Pokemon, move: ActiveMove) => string | void;
|
||||
onAnyPrepareHit?: CommonHandlers['ResultSourceMove'];
|
||||
onAnyPseudoWeatherStart?: (this: Battle, target: Pokemon, source: Pokemon, pseudoWeather: Condition) => void;
|
||||
onAnyRedirectTarget?: (
|
||||
this: Battle, target: Pokemon, source: Pokemon, source2: Effect, move: ActiveMove
|
||||
) => Pokemon | void;
|
||||
|
||||
@@ -208,6 +208,7 @@ export class Field {
|
||||
delete this.pseudoWeather[status.id];
|
||||
return false;
|
||||
}
|
||||
this.battle.runEvent('PseudoWeatherStart', source, source, status);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
35
test/sim/items/roomservice.js
Normal file
35
test/sim/items/roomservice.js
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('./../../assert');
|
||||
const common = require('./../../common');
|
||||
|
||||
let battle;
|
||||
|
||||
describe('Room Service', function () {
|
||||
afterEach(function () {
|
||||
battle.destroy();
|
||||
});
|
||||
|
||||
it(`should activate when Trick Room is set`, function () {
|
||||
battle = common.createBattle([[
|
||||
{species: 'slowpoke', item: 'roomservice', moves: ['sleeptalk']},
|
||||
], [
|
||||
{species: 'whimsicott', item: 'roomservice', moves: ['trickroom']},
|
||||
]]);
|
||||
battle.makeChoices();
|
||||
assert.statStage(battle.p1.active[0], 'spe', -1);
|
||||
assert.statStage(battle.p2.active[0], 'spe', -1);
|
||||
});
|
||||
|
||||
it(`should activate after entrance Abilities`, function () {
|
||||
battle = common.createBattle([[
|
||||
{species: 'slowpoke', moves: ['teleport']},
|
||||
{species: 'ditto', ability: 'imposter', item: 'roomservice', moves: ['transform']},
|
||||
], [
|
||||
{species: 'whimsicott', ability: 'prankster', moves: ['trickroom']},
|
||||
]]);
|
||||
battle.makeChoices();
|
||||
battle.makeChoices();
|
||||
assert.statStage(battle.p1.active[0], 'spe', -1, `Ditto-Whimsicott should be at -1 Speed after transforming`);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user