From 10e4ecdc845113261d295f3885dd1d51e9dbdad4 Mon Sep 17 00:00:00 2001 From: Marty-D Date: Tue, 21 Jul 2020 10:43:12 -0400 Subject: [PATCH] Clean up event priorities --- data/abilities.ts | 16 ++++++++-------- data/items.ts | 6 +++--- data/mods/gen4/abilities.ts | 2 +- sim/global-types.ts | 3 +++ 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/data/abilities.ts b/data/abilities.ts index 6b8972046e6a..5c11d63ba77f 100644 --- a/data/abilities.ts +++ b/data/abilities.ts @@ -480,7 +480,7 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = { }, compoundeyes: { shortDesc: "This Pokemon's moves have their accuracy multiplied by 1.3.", - onModifyAccuracyPriority: 9, + onSourceModifyAccuracyPriority: 9, onSourceModifyAccuracy(accuracy) { if (typeof accuracy !== 'number') return; this.debug('compoundeyes - enhancing accuracy'); @@ -1026,7 +1026,7 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = { return this.chainModify(1.5); } }, - onModifySpDPriority: 4, + onAllyModifySpDPriority: 4, onAllyModifySpD(spd, pokemon) { if (this.effectData.target.baseSpecies.baseSpecies !== 'Cherrim') return; if (['sunnyday', 'desolateland'].includes(pokemon.effectiveWeather())) { @@ -1474,9 +1474,9 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = { onModifyAtk(atk) { return this.modify(atk, 1.5); }, - onModifyAccuracyPriority: 7, + onSourceModifyAccuracyPriority: 7, onSourceModifyAccuracy(accuracy, target, source, move) { - if (move.category === 'Physical' && typeof move.accuracy === 'number') { + if (move.category === 'Physical' && typeof accuracy === 'number') { return accuracy * 0.8; } }, @@ -1533,7 +1533,6 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = { iceface: { desc: "If this Pokemon is an Eiscue, the first physical hit it takes in battle deals 0 neutral damage. Its ice face is then broken and it changes forme to Noice Face. Eiscue regains its Ice Face forme when Hail begins or when Eiscue switches in while Hail is active. Confusion damage also breaks the ice face.", shortDesc: "If Eiscue, the first physical hit it takes deals 0 damage. This effect is restored in Hail.", - onDamagePriority: 1, onStart(pokemon) { if (this.field.isWeather('hail') && pokemon.species.id === 'eiscuenoice' && !pokemon.transformed) { this.add('-activate', pokemon, 'ability: Ice Face'); @@ -1541,6 +1540,7 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = { pokemon.formeChange('Eiscue', this.effect, true); } }, + onDamagePriority: 1, onDamage(damage, target, source, effect) { if ( effect && effect.effectType === 'Move' && effect.category === 'Physical' && @@ -4422,13 +4422,13 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = { waterbubble: { desc: "This Pokemon's attacking stat is doubled while using a Water-type attack. If a Pokemon uses a Fire-type attack against this Pokemon, that Pokemon's attacking stat is halved when calculating the damage to this Pokemon. This Pokemon cannot be burned. Gaining this Ability while burned cures it.", shortDesc: "This Pokemon's Water power is 2x; it can't be burned; Fire power against it is halved.", - onModifyAtkPriority: 5, + onSourceModifyAtkPriority: 5, onSourceModifyAtk(atk, attacker, defender, move) { if (move.type === 'Fire') { return this.chainModify(0.5); } }, - onModifySpAPriority: 5, + onSourceModifySpAPriority: 5, onSourceModifySpA(atk, attacker, defender, move) { if (move.type === 'Fire') { return this.chainModify(0.5); @@ -4564,7 +4564,7 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = { shortDesc: "Status moves with accuracy checks are 50% accurate when used on this Pokemon.", onModifyAccuracyPriority: 10, onModifyAccuracy(accuracy, target, source, move) { - if (move.category === 'Status' && typeof move.accuracy === 'number') { + if (move.category === 'Status' && typeof accuracy === 'number') { this.debug('Wonder Skin - setting accuracy to 50'); return 50; } diff --git a/data/items.ts b/data/items.ts index 783240d2ac3d..08788a387733 100644 --- a/data/items.ts +++ b/data/items.ts @@ -3689,7 +3689,7 @@ export const BattleItems: {[itemid: string]: ItemData} = { }, effect: { duration: 2, - onModifyAccuracyPriority: 3, + onSourceModifyAccuracyPriority: 3, onSourceModifyAccuracy(accuracy, target, source) { this.add('-enditem', source, 'Micle Berry'); source.removeVolatile('micleberry'); @@ -7242,7 +7242,7 @@ export const BattleItems: {[itemid: string]: ItemData} = { fling: { basePower: 10, }, - onModifyAccuracyPriority: 4, + onSourceModifyAccuracyPriority: 4, onSourceModifyAccuracy(accuracy) { if (typeof accuracy === 'number') { return accuracy * 1.1; @@ -7347,7 +7347,7 @@ export const BattleItems: {[itemid: string]: ItemData} = { fling: { basePower: 10, }, - onModifyAccuracyPriority: 4, + onSourceModifyAccuracyPriority: 4, onSourceModifyAccuracy(accuracy, target) { if (typeof accuracy === 'number' && !this.queue.willMove(target)) { this.debug('Zoom Lens boosting accuracy'); diff --git a/data/mods/gen4/abilities.ts b/data/mods/gen4/abilities.ts index c05dde0cf5c0..8d0e2fdb353f 100644 --- a/data/mods/gen4/abilities.ts +++ b/data/mods/gen4/abilities.ts @@ -428,7 +428,7 @@ export const BattleAbilities: {[k: string]: ModdedAbilityData} = { }, thickfat: { shortDesc: "The power of Fire- and Ice-type attacks against this Pokemon is halved.", - onBasePowerPriority: 1, + onSourceBasePowerPriority: 1, onSourceBasePower(basePower, attacker, defender, move) { if (move.type === 'Ice' || move.type === 'Fire') { return this.chainModify(0.5); diff --git a/sim/global-types.ts b/sim/global-types.ts index db3198f425f2..19390f4360e6 100644 --- a/sim/global-types.ts +++ b/sim/global-types.ts @@ -722,6 +722,8 @@ interface EventMethods { onAnyFaintPriority?: number; onAllyBasePowerPriority?: number; onAllyModifyAtkPriority?: number; + onAllyModifySpAPriority?: number; + onAllyModifySpDPriority?: number; onAttractPriority?: number; onBasePowerPriority?: number; onBeforeMovePriority?: number; @@ -753,6 +755,7 @@ interface EventMethods { onResidualSubOrder?: number; onSourceBasePowerPriority?: number; onSourceInvulnerabilityPriority?: number; + onSourceModifyAccuracyPriority?: number; onSourceModifyAtkPriority?: number; onSourceModifySpAPriority?: number; onSwitchInPriority?: number;