mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
Remove unused code (#11215)
Some checks failed
Node.js CI / build (18.x) (push) Has been cancelled
Some checks failed
Node.js CI / build (18.x) (push) Has been cancelled
* Remove unused Move#negateSecondary * Remove unused 'SubDamage' event * Remove unused Move#pressureTarget * Partially remove unused Move#spreadModifier
This commit is contained in:
parent
7835b015d9
commit
dc7294ed6e
|
|
@ -2082,7 +2082,7 @@ export const Formats: import('../sim/dex-formats').FormatList = [
|
|||
|
||||
if (move.spreadHit) {
|
||||
// multi-target modifier (doubles only)
|
||||
const spreadModifier = move.spreadModifier || (this.battle.gameType === 'freeforall' ? 0.5 : 0.75);
|
||||
const spreadModifier = this.battle.gameType === 'freeforall' ? 0.5 : 0.75;
|
||||
this.battle.debug(`Spread modifier: ${spreadModifier}`);
|
||||
baseDamage = this.battle.modify(baseDamage, spreadModifier);
|
||||
} else if (move.multihitType === 'parentalbond' && move.hit > 1) {
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
|
|||
if (
|
||||
effect.effectType === "Move" &&
|
||||
!effect.multihit &&
|
||||
(!effect.negateSecondary && !(effect.hasSheerForce && source.hasAbility('sheerforce')))
|
||||
!(effect.hasSheerForce && source.hasAbility('sheerforce'))
|
||||
) {
|
||||
this.effectState.checkedAngerShell = false;
|
||||
} else {
|
||||
|
|
@ -411,7 +411,7 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
|
|||
if (
|
||||
effect.effectType === "Move" &&
|
||||
!effect.multihit &&
|
||||
(!effect.negateSecondary && !(effect.hasSheerForce && source.hasAbility('sheerforce')))
|
||||
!(effect.hasSheerForce && source.hasAbility('sheerforce'))
|
||||
) {
|
||||
this.effectState.checkedBerserk = false;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -820,8 +820,6 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
|
|||
let uncappedDamage = move.hit > 1 ? this.lastDamage : this.actions.getDamage(source, target, move);
|
||||
if (move.id === 'bide') uncappedDamage = source.volatiles['bide'].damage * 2;
|
||||
if (!uncappedDamage && uncappedDamage !== 0) return null;
|
||||
uncappedDamage = this.runEvent('SubDamage', target, source, move, uncappedDamage);
|
||||
if (!uncappedDamage && uncappedDamage !== 0) return uncappedDamage;
|
||||
this.lastDamage = uncappedDamage;
|
||||
target.volatiles['substitute'].hp -= uncappedDamage > target.volatiles['substitute'].hp ?
|
||||
target.volatiles['substitute'].hp : uncappedDamage;
|
||||
|
|
|
|||
|
|
@ -320,10 +320,8 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!move.negateSecondary) {
|
||||
this.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);
|
||||
this.battle.runEvent('AfterMoveSecondarySelf', pokemon, target, move);
|
||||
}
|
||||
this.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);
|
||||
this.battle.runEvent('AfterMoveSecondarySelf', pokemon, target, move);
|
||||
return true;
|
||||
},
|
||||
// This function attempts a move hit and returns the attempt result before the actual hit happens.
|
||||
|
|
@ -484,10 +482,8 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
|
||||
if (move.ohko) this.battle.add('-ohko');
|
||||
|
||||
if (!move.negateSecondary) {
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
}
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
|
||||
return damage;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -39,10 +39,8 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
|
|||
// NOTE: In future generations the damage is capped to the remaining HP of the
|
||||
// Substitute, here we deliberately use the uncapped damage when tracking lastDamage etc.
|
||||
// Also, multi-hit moves must always deal the same damage as the first hit for any subsequent hits
|
||||
let uncappedDamage = move.hit > 1 ? this.lastDamage : this.actions.getDamage(source, target, move);
|
||||
const uncappedDamage = move.hit > 1 ? this.lastDamage : this.actions.getDamage(source, target, move);
|
||||
if (!uncappedDamage && uncappedDamage !== 0) return null;
|
||||
uncappedDamage = this.runEvent('SubDamage', target, source, move, uncappedDamage);
|
||||
if (!uncappedDamage && uncappedDamage !== 0) return uncappedDamage;
|
||||
this.lastDamage = uncappedDamage;
|
||||
target.volatiles['substitute'].hp -= uncappedDamage > target.volatiles['substitute'].hp ?
|
||||
target.volatiles['substitute'].hp : uncappedDamage;
|
||||
|
|
|
|||
|
|
@ -249,8 +249,6 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
|
|||
damage = target.volatiles['substitute'].hp;
|
||||
}
|
||||
if (!damage && damage !== 0) return null;
|
||||
damage = this.runEvent('SubDamage', target, source, move, damage);
|
||||
if (!damage && damage !== 0) return damage;
|
||||
target.volatiles['substitute'].hp -= damage;
|
||||
this.lastDamage = damage;
|
||||
if (target.volatiles['substitute'].hp <= 0) {
|
||||
|
|
|
|||
|
|
@ -231,10 +231,8 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!move.negateSecondary) {
|
||||
this.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);
|
||||
this.battle.runEvent('AfterMoveSecondarySelf', pokemon, target, move);
|
||||
}
|
||||
this.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);
|
||||
this.battle.runEvent('AfterMoveSecondarySelf', pokemon, target, move);
|
||||
return true;
|
||||
},
|
||||
tryMoveHit(target, pokemon, move) {
|
||||
|
|
@ -368,10 +366,8 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
|
||||
if (move.ohko) this.battle.add('-ohko');
|
||||
|
||||
if (!move.negateSecondary) {
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
}
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
|
||||
return damage;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -846,10 +846,6 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
|
|||
if (!damage) {
|
||||
return null;
|
||||
}
|
||||
damage = this.runEvent('SubDamage', target, source, move, damage);
|
||||
if (!damage) {
|
||||
return damage;
|
||||
}
|
||||
if (damage > target.volatiles['substitute'].hp) {
|
||||
damage = target.volatiles['substitute'].hp as number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,10 +293,8 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
}
|
||||
if (move.ohko) this.battle.add('-ohko');
|
||||
|
||||
if (!move.negateSecondary) {
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
}
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
|
||||
if (move.recoil && move.totalDamage) {
|
||||
this.battle.damage(this.calcRecoilDamage(move.totalDamage, move, pokemon), pokemon, target, 'recoil');
|
||||
|
|
|
|||
|
|
@ -228,10 +228,8 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
}
|
||||
if (move.ohko) this.battle.add('-ohko');
|
||||
|
||||
if (!move.negateSecondary) {
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
}
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
// Implementing Recoil mechanics from Stadium 2.
|
||||
// If a pokemon caused the other to faint with a recoil move and only one pokemon remains on both sides,
|
||||
// recoil damage will not be taken.
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
// In Generation 3, the spread move modifier is 0.5x instead of 0.75x. Moves that hit both foes
|
||||
// and the user's ally, like Earthquake and Explosion, don't get affected by spread modifiers
|
||||
if (move.spreadHit && move.target === 'allAdjacentFoes') {
|
||||
const spreadModifier = move.spreadModifier || 0.5;
|
||||
const spreadModifier = 0.5;
|
||||
this.battle.debug(`Spread modifier: ${spreadModifier}`);
|
||||
baseDamage = this.battle.modify(baseDamage, spreadModifier);
|
||||
}
|
||||
|
|
@ -256,7 +256,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!move.negateSecondary && !(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
if (!(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
this.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);
|
||||
this.battle.runEvent('AfterMoveSecondarySelf', pokemon, target, move);
|
||||
}
|
||||
|
|
@ -468,7 +468,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
|
||||
this.battle.eachEvent('Update');
|
||||
|
||||
if (target && !move.negateSecondary) {
|
||||
if (target) {
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1630,10 +1630,6 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
|
|||
this.attrLastMove('[still]');
|
||||
return null;
|
||||
}
|
||||
damage = this.runEvent('SubDamage', target, source, move, damage);
|
||||
if (!damage) {
|
||||
return damage;
|
||||
}
|
||||
if (damage > target.volatiles['substitute'].hp) {
|
||||
damage = target.volatiles['substitute'].hp as number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -909,10 +909,6 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
|
|||
this.attrLastMove('[still]');
|
||||
return null;
|
||||
}
|
||||
damage = this.runEvent('SubDamage', target, source, move, damage);
|
||||
if (!damage) {
|
||||
return damage;
|
||||
}
|
||||
if (damage > target.volatiles['substitute'].hp) {
|
||||
damage = target.volatiles['substitute'].hp as number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ export const Abilities: import('../../../sim/dex-abilities').ModdedAbilityDataTa
|
|||
regainpatience: {
|
||||
shortDesc: "Berserk + Regenerator",
|
||||
onDamage(damage, target, source, effect) {
|
||||
this.effectState.checkedBerserk = !!(effect.effectType !== "Move" || effect.multihit || effect.negateSecondary ||
|
||||
this.effectState.checkedBerserk = !!(effect.effectType !== "Move" || effect.multihit ||
|
||||
(effect.hasSheerForce && source.hasAbility(['overwhelming', 'sheerforce', 'forceofnature', 'sandwrath'])));
|
||||
},
|
||||
onTryEatItem(item) {
|
||||
|
|
|
|||
|
|
@ -347,7 +347,6 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
return false;
|
||||
}
|
||||
if (
|
||||
!move.negateSecondary &&
|
||||
!(move.hasSheerForce &&
|
||||
pokemon.hasAbility(['sheerforce', 'forceofnature', 'sandwrath', 'overwhelming', 'powerbuns'])) &&
|
||||
!move.flags['futuremove']
|
||||
|
|
@ -372,7 +371,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
baseDamage += 2;
|
||||
if (move.spreadHit) {
|
||||
// multi-target modifier (doubles only)
|
||||
const spreadModifier = move.spreadModifier || (this.battle.gameType === 'freeforall' ? 0.5 : 0.75);
|
||||
const spreadModifier = this.battle.gameType === 'freeforall' ? 0.5 : 0.75;
|
||||
this.battle.debug(`Spread modifier: ${spreadModifier}`);
|
||||
baseDamage = this.battle.modify(baseDamage, spreadModifier);
|
||||
} else if (move.multihitType === 'parentalbond' && move.hit > 1) {
|
||||
|
|
|
|||
|
|
@ -717,7 +717,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
|
||||
if (move.spreadHit) {
|
||||
// multi-target modifier (doubles only)
|
||||
const spreadModifier = move.spreadModifier || (this.battle.gameType === 'freeforall' ? 0.5 : 0.75);
|
||||
const spreadModifier = this.battle.gameType === 'freeforall' ? 0.5 : 0.75;
|
||||
this.battle.debug(`Spread modifier: ${spreadModifier}`);
|
||||
baseDamage = this.battle.modify(baseDamage, spreadModifier);
|
||||
} else if (move.multihitType === 'parentalbond' && move.hit > 1) {
|
||||
|
|
@ -1390,11 +1390,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!move.negateSecondary &&
|
||||
!(move.hasSheerForce && pokemon.hasAbility('sheerforce')) &&
|
||||
!move.flags['futuremove']
|
||||
) {
|
||||
if (!(move.hasSheerForce && pokemon.hasAbility('sheerforce')) && !move.flags['futuremove']) {
|
||||
const originalHp = pokemon.hp;
|
||||
this.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);
|
||||
this.battle.runEvent('AfterMoveSecondarySelf', pokemon, target, move);
|
||||
|
|
@ -1582,7 +1578,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
|
||||
this.afterMoveSecondaryEvent(targetsCopy.filter(val => !!val), pokemon, move);
|
||||
|
||||
if (!move.negateSecondary && !(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
if (!(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
for (const [i, d] of damage.entries()) {
|
||||
// There are no multihit spread moves, so it's safe to use move.totalDamage for multihit moves
|
||||
// The previous check was for `move.multihit`, but that fails for Dragon Darts
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ export const Scripts: ModdedBattleScriptsData = {
|
|||
|
||||
this.afterMoveSecondaryEvent(targetsCopy.filter(val => !!val), pokemon, move);
|
||||
|
||||
if (!move.negateSecondary && !(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
if (!(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
for (const [i, d] of damage.entries()) {
|
||||
// There are no multihit spread moves, so it's safe to use move.totalDamage for multihit moves
|
||||
// The previous check was for `move.multihit`, but that fails for Dragon Darts
|
||||
|
|
|
|||
|
|
@ -19068,10 +19068,6 @@ export const Moves: import('../sim/dex-moves').MoveDataTable = {
|
|||
this.attrLastMove('[still]');
|
||||
return null;
|
||||
}
|
||||
damage = this.runEvent('SubDamage', target, source, move, damage);
|
||||
if (!damage) {
|
||||
return damage;
|
||||
}
|
||||
if (damage > target.volatiles['substitute'].hp) {
|
||||
damage = target.volatiles['substitute'].hp as number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -524,11 +524,7 @@ export class BattleActions {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!move.negateSecondary &&
|
||||
!(move.hasSheerForce && pokemon.hasAbility('sheerforce')) &&
|
||||
!move.flags['futuremove']
|
||||
) {
|
||||
if (!(move.hasSheerForce && pokemon.hasAbility('sheerforce')) && !move.flags['futuremove']) {
|
||||
const originalHp = pokemon.hp;
|
||||
this.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);
|
||||
this.battle.runEvent('AfterMoveSecondarySelf', pokemon, target, move);
|
||||
|
|
@ -805,7 +801,7 @@ export class BattleActions {
|
|||
}
|
||||
afterMoveSecondaryEvent(targets: Pokemon[], pokemon: Pokemon, move: ActiveMove) {
|
||||
// console.log(`${targets}, ${pokemon}, ${move}`)
|
||||
if (!move.negateSecondary && !(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
if (!(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
this.battle.singleEvent('AfterMoveSecondary', move, null, targets[0], pokemon, move);
|
||||
this.battle.runEvent('AfterMoveSecondary', targets, pokemon, move);
|
||||
}
|
||||
|
|
@ -1024,7 +1020,7 @@ export class BattleActions {
|
|||
|
||||
this.afterMoveSecondaryEvent(targetsCopy.filter(val => !!val), pokemon, move);
|
||||
|
||||
if (!move.negateSecondary && !(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
if (!(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
|
||||
for (const [i, d] of damage.entries()) {
|
||||
// There are no multihit spread moves, so it's safe to use move.totalDamage for multihit moves
|
||||
// The previous check was for `move.multihit`, but that fails for Dragon Darts
|
||||
|
|
@ -1730,7 +1726,7 @@ export class BattleActions {
|
|||
|
||||
if (move.spreadHit) {
|
||||
// multi-target modifier (doubles only)
|
||||
const spreadModifier = move.spreadModifier || (this.battle.gameType === 'freeforall' ? 0.5 : 0.75);
|
||||
const spreadModifier = this.battle.gameType === 'freeforall' ? 0.5 : 0.75;
|
||||
this.battle.debug(`Spread modifier: ${spreadModifier}`);
|
||||
baseDamage = this.battle.modify(baseDamage, spreadModifier);
|
||||
} else if (move.multihitType === 'parentalbond' && move.hit > 1) {
|
||||
|
|
|
|||
|
|
@ -249,7 +249,6 @@ export interface MoveData extends EffectData, MoveEventMethods, HitEffect {
|
|||
multihitType?: 'parentalbond';
|
||||
noDamageVariance?: boolean;
|
||||
nonGhostTarget?: MoveTarget;
|
||||
pressureTarget?: MoveTarget;
|
||||
spreadModifier?: number;
|
||||
sleepUsable?: boolean;
|
||||
/**
|
||||
|
|
@ -325,7 +324,6 @@ export interface ActiveMove extends MutableMove {
|
|||
isExternal?: boolean;
|
||||
lastHit?: boolean;
|
||||
magnitude?: number;
|
||||
negateSecondary?: boolean;
|
||||
pranksterBoosted?: boolean;
|
||||
selfDropped?: boolean;
|
||||
selfSwitch?: 'copyvolatile' | 'shedtail' | boolean;
|
||||
|
|
@ -450,8 +448,6 @@ export class DataMove extends BasicEffect implements Readonly<BasicEffect & Move
|
|||
readonly flags: MoveFlags;
|
||||
/** Whether or not the user must switch after using this move. */
|
||||
readonly selfSwitch?: 'copyvolatile' | 'shedtail' | boolean;
|
||||
/** Move target only used by Pressure. */
|
||||
readonly pressureTarget: MoveTarget;
|
||||
/** Move target used if the user is not a Ghost type (for Curse). */
|
||||
readonly nonGhostTarget: MoveTarget;
|
||||
/** Whether or not the move ignores abilities. */
|
||||
|
|
@ -505,7 +501,6 @@ export class DataMove extends BasicEffect implements Readonly<BasicEffect & Move
|
|||
this.isMax = data.isMax || false;
|
||||
this.flags = data.flags || {};
|
||||
this.selfSwitch = (typeof data.selfSwitch === 'string' ? (data.selfSwitch as ID) : data.selfSwitch) || undefined;
|
||||
this.pressureTarget = data.pressureTarget || '';
|
||||
this.nonGhostTarget = data.nonGhostTarget || '';
|
||||
this.ignoreAbility = data.ignoreAbility || false;
|
||||
this.damage = data.damage!;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user