mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-06-02 22:08:36 -05:00
Merge 2c54704ea1 into 6765d8422d
This commit is contained in:
commit
1500e68c8e
|
|
@ -23,9 +23,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
this.hint("In Gen 1, Toxic's counter is retained after Rest and applies to PSN/BRN.", true);
|
||||
}
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
||||
},
|
||||
},
|
||||
par: {
|
||||
name: 'par',
|
||||
|
|
@ -119,9 +116,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
this.hint("In Gen 1, Toxic's counter is retained after Rest and applies to PSN/BRN.", true);
|
||||
}
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
||||
},
|
||||
},
|
||||
tox: {
|
||||
inherit: true,
|
||||
|
|
|
|||
|
|
@ -157,11 +157,6 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
}
|
||||
}
|
||||
|
||||
const abortMove = () => {
|
||||
this.battle.clearActiveMove(true);
|
||||
this.battle.runEvent('AfterMoveSelf', pokemon, target, move);
|
||||
};
|
||||
|
||||
if (move.id === 'cannotmove') {
|
||||
if (pokemon.status === 'slp') {
|
||||
this.battle.hint(
|
||||
|
|
@ -179,7 +174,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
"the move execution will never resolve."
|
||||
);
|
||||
}
|
||||
abortMove();
|
||||
this.battle.clearActiveMove(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -188,11 +183,11 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
this.battle.setActiveMove(move, pokemon, target);
|
||||
|
||||
if (pokemon.moveThisTurn || !this.battle.runEvent('BeforeMove', pokemon, target, move)) {
|
||||
abortMove();
|
||||
this.battle.clearActiveMove(true);
|
||||
return;
|
||||
}
|
||||
if (move.beforeMoveCallback?.call(this.battle, pokemon, target, move)) {
|
||||
abortMove();
|
||||
this.battle.clearActiveMove(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -212,7 +207,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
this.battle.hint(
|
||||
"In Gen 1, a Pokémon might default to using a move that doesn't match the move of the slot it last selected.",
|
||||
);
|
||||
abortMove();
|
||||
this.battle.clearActiveMove(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -268,9 +263,6 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
pokemon.side.lastMove = move;
|
||||
|
||||
this.battle.runEvent('AfterMove', pokemon, target, move);
|
||||
if (!target || target.hp > 0) {
|
||||
this.battle.runEvent('AfterMoveSelf', pokemon, target, move);
|
||||
}
|
||||
}
|
||||
}
|
||||
return moveResult;
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
onAfterMoveSelf(pokemon) {
|
||||
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
||||
},
|
||||
},
|
||||
par: {
|
||||
name: 'par',
|
||||
|
|
@ -88,9 +85,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
onAfterMoveSelf(pokemon) {
|
||||
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
||||
},
|
||||
},
|
||||
confusion: {
|
||||
inherit: true,
|
||||
|
|
|
|||
|
|
@ -83,8 +83,6 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
if (pokemon.moveThisTurn || !this.battle.runEvent('BeforeMove', pokemon, target, move)) {
|
||||
this.battle.debug(`${pokemon.fullname} move interrupted; movedThisTurn: ${pokemon.moveThisTurn}`);
|
||||
this.battle.clearActiveMove(true);
|
||||
// This is only run for sleep
|
||||
this.battle.runEvent('AfterMoveSelf', pokemon, target, move);
|
||||
return;
|
||||
}
|
||||
if (move.beforeMoveCallback) {
|
||||
|
|
@ -142,8 +140,6 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
// If target fainted
|
||||
if (target && target.hp <= 0) {
|
||||
delete pokemon.volatiles['partialtrappinglock'];
|
||||
} else {
|
||||
this.battle.runEvent('AfterMoveSelf', pokemon, target, move);
|
||||
}
|
||||
if (pokemon.volatiles['mustrecharge']) this.battle.add('-mustrecharge', pokemon);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
onAfterMoveSelf(pokemon) {
|
||||
residualdmg(this, pokemon);
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
residualdmg(this, pokemon);
|
||||
},
|
||||
},
|
||||
par: {
|
||||
name: 'par',
|
||||
|
|
@ -87,9 +84,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
onAfterMoveSelf(pokemon) {
|
||||
residualdmg(this, pokemon);
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
residualdmg(this, pokemon);
|
||||
},
|
||||
},
|
||||
tox: {
|
||||
name: 'tox',
|
||||
|
|
@ -109,9 +103,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
pokemon.status = 'psn' as ID;
|
||||
this.add('-status', pokemon, 'psn', '[silent]');
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
||||
},
|
||||
},
|
||||
confusion: {
|
||||
inherit: true,
|
||||
|
|
@ -245,9 +236,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
onAfterMoveSelf(pokemon) {
|
||||
if (['brn', 'psn', 'tox'].includes(pokemon.status)) pokemon.volatiles['residualdmg'].counter++;
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
if (['brn', 'psn', 'tox'].includes(pokemon.status)) pokemon.volatiles['residualdmg'].counter++;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
|
|||
onResidual: undefined, // no inherit
|
||||
onAfterMoveSelfPriority: 1,
|
||||
onAfterMoveSelf(pokemon) {
|
||||
if (pokemon.status === 'slp') this.damage(pokemon.baseMaxhp / 4);
|
||||
if (this.effectState.source.hp) this.damage(pokemon.baseMaxhp / 4);
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -114,8 +114,6 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
if (!this.battle.runEvent('BeforeMove', pokemon, target, move)) {
|
||||
this.battle.runEvent('MoveAborted', pokemon, target, move);
|
||||
this.battle.clearActiveMove(true);
|
||||
// This is only run for sleep and fully paralysed.
|
||||
this.battle.runEvent('AfterMoveSelf', pokemon, target, move);
|
||||
return;
|
||||
}
|
||||
if (move.beforeMoveCallback) {
|
||||
|
|
@ -136,7 +134,6 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
pokemon.moveUsed(move);
|
||||
this.battle.actions.useMove(move, pokemon, { target, sourceEffect: options?.sourceEffect });
|
||||
this.battle.singleEvent('AfterMove', move, null, pokemon, target, move);
|
||||
if (!move.selfSwitch && pokemon.side.foe.active[0].hp) this.battle.runEvent('AfterMoveSelf', pokemon, target, move);
|
||||
},
|
||||
tryMoveHit(target, pokemon, move) {
|
||||
const positiveBoostTable = [1, 1.33, 1.66, 2, 2.33, 2.66, 3];
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
onSwitchIn(pokemon) {
|
||||
pokemon.addVolatile('brnattackdrop');
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
residualdmg(this, pokemon);
|
||||
},
|
||||
},
|
||||
par: {
|
||||
name: 'par',
|
||||
|
|
@ -118,9 +115,6 @@ export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDa
|
|||
onAfterMoveSelf(pokemon) {
|
||||
if (['brn', 'psn', 'tox'].includes(pokemon.status)) pokemon.volatiles['residualdmg'].counter++;
|
||||
},
|
||||
onAfterSwitchInSelf(pokemon) {
|
||||
if (['brn', 'psn', 'tox'].includes(pokemon.status)) pokemon.volatiles['residualdmg'].counter++;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
actions: {
|
||||
inherit: true,
|
||||
runSwitch(pokemon) {
|
||||
this.battle.runEvent('EntryHazard', pokemon);
|
||||
|
||||
this.battle.runEvent('SwitchIn', pokemon);
|
||||
|
||||
if (this.battle.gen <= 2) {
|
||||
// pokemon.lastMove is reset for all Pokemon on the field after a switch. This affects Mirror Move.
|
||||
for (const poke of this.battle.getAllActive()) poke.lastMove = null;
|
||||
|
|
@ -33,9 +29,6 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!pokemon.side.faintedThisTurn && pokemon.draggedIn !== this.battle.turn) {
|
||||
this.battle.runEvent('AfterSwitchInSelf', pokemon);
|
||||
}
|
||||
}
|
||||
if (!pokemon.hp) return false;
|
||||
pokemon.isStarted = true;
|
||||
|
|
|
|||
|
|
@ -150,7 +150,11 @@ export class BattleActions {
|
|||
if (isDrag && this.battle.gen === 2) pokemon.draggedIn = this.battle.turn;
|
||||
pokemon.previouslySwitchedIn++;
|
||||
|
||||
if (isDrag && this.battle.gen >= 5) {
|
||||
if (this.battle.gen <= 4) {
|
||||
this.battle.runEvent('EntryHazard', pokemon);
|
||||
this.battle.runEvent('SwitchIn', pokemon);
|
||||
}
|
||||
if (isDrag) {
|
||||
// runSwitch happens immediately so that Mold Breaker can make hazards bypass Clear Body and Levitate
|
||||
this.runSwitch(pokemon);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export interface SwitchAction {
|
|||
pokemon: Pokemon;
|
||||
/** pokemon to switch to */
|
||||
target: Pokemon;
|
||||
/** effect that called the switch (eg U */
|
||||
/** effect that called the switch (eg U-turn) */
|
||||
sourceEffect: Effect | null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2839,6 +2839,17 @@ export class Battle {
|
|||
break;
|
||||
}
|
||||
|
||||
if (this.gen <= 2) {
|
||||
if (action.choice === 'move' && !action.pokemon.switchFlag) {
|
||||
this.runEvent('AfterMoveSelf', action.pokemon);
|
||||
} else if (action.choice === 'switch' || (action.choice === 'instaswitch' && action.sourceEffect)) {
|
||||
this.runEvent('AfterMoveSelf', action.target);
|
||||
}
|
||||
}
|
||||
|
||||
// Gen 4 and earlier: clear active move so Mold Breaker doesn't allow hazards to bypass Clear Body and Levitate
|
||||
if (this.gen <= 4) this.clearActiveMove();
|
||||
|
||||
// phazing (Roar, etc)
|
||||
for (const side of this.sides) {
|
||||
for (const pokemon of side.active) {
|
||||
|
|
@ -2849,7 +2860,7 @@ export class Battle {
|
|||
}
|
||||
}
|
||||
|
||||
this.clearActiveMove();
|
||||
if (this.gen > 4) this.clearActiveMove();
|
||||
|
||||
// fainting
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ export interface EventMethods {
|
|||
onAfterMega?: (this: Battle, pokemon: Pokemon) => void;
|
||||
onAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
onAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];
|
||||
onAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;
|
||||
onAfterTerastallization?: (this: Battle, pokemon: Pokemon) => void;
|
||||
onAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;
|
||||
onAfterTakeItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;
|
||||
|
|
@ -27,7 +26,7 @@ export interface EventMethods {
|
|||
onAfterMoveSecondarySelf?: MoveEventMethods['onAfterMoveSecondarySelf'];
|
||||
onAfterMoveSecondary?: MoveEventMethods['onAfterMoveSecondary'];
|
||||
onAfterMove?: MoveEventMethods['onAfterMove'];
|
||||
onAfterMoveSelf?: CommonHandlers['VoidSourceMove'];
|
||||
onAfterMoveSelf?: (this: Battle, pokemon: Pokemon) => void;
|
||||
onAttract?: (this: Battle, target: Pokemon, source: Pokemon) => void;
|
||||
onAccuracy?: (
|
||||
this: Battle, accuracy: number, target: Pokemon, source: Pokemon, move: ActiveMove
|
||||
|
|
@ -130,7 +129,6 @@ export interface EventMethods {
|
|||
onFoeAfterHit?: MoveEventMethods['onAfterHit'];
|
||||
onFoeAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
onFoeAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];
|
||||
onFoeAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;
|
||||
onFoeAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;
|
||||
onFoeAfterBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
onFoeAfterFaint?: (this: Battle, length: number, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
|
|
@ -228,7 +226,6 @@ export interface EventMethods {
|
|||
onSourceAfterHit?: MoveEventMethods['onAfterHit'];
|
||||
onSourceAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
onSourceAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];
|
||||
onSourceAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;
|
||||
onSourceAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;
|
||||
onSourceAfterBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
onSourceAfterFaint?: (this: Battle, length: number, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
|
|
@ -328,7 +325,6 @@ export interface EventMethods {
|
|||
onAnyAfterHit?: MoveEventMethods['onAfterHit'];
|
||||
onAnyAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
onAnyAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];
|
||||
onAnyAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;
|
||||
onAnyAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;
|
||||
onAnyAfterBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
onAnyAfterFaint?: (this: Battle, length: number, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
|
|
@ -504,7 +500,6 @@ export interface PokemonEventMethods extends EventMethods {
|
|||
onAllyAfterHit?: MoveEventMethods['onAfterHit'];
|
||||
onAllyAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
onAllyAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];
|
||||
onAllyAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;
|
||||
onAllyAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;
|
||||
onAllyAfterBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
onAllyAfterFaint?: (this: Battle, length: number, target: Pokemon, source: Pokemon, effect: Effect) => void;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user