Skip to content

Commit

Permalink
Clean up event priorities
Browse files Browse the repository at this point in the history
  • Loading branch information
Marty-D committed Jul 21, 2020
1 parent 4b22301 commit 10e4ecd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
16 changes: 8 additions & 8 deletions data/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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())) {
Expand Down Expand Up @@ -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;
}
},
Expand Down Expand Up @@ -1533,14 +1533,14 @@ 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');
this.effectData.busted = false;
pokemon.formeChange('Eiscue', this.effect, true);
}
},
onDamagePriority: 1,
onDamage(damage, target, source, effect) {
if (
effect && effect.effectType === 'Move' && effect.category === 'Physical' &&
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions data/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion data/mods/gen4/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions sim/global-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ interface EventMethods {
onAnyFaintPriority?: number;
onAllyBasePowerPriority?: number;
onAllyModifyAtkPriority?: number;
onAllyModifySpAPriority?: number;
onAllyModifySpDPriority?: number;
onAttractPriority?: number;
onBasePowerPriority?: number;
onBeforeMovePriority?: number;
Expand Down Expand Up @@ -753,6 +755,7 @@ interface EventMethods {
onResidualSubOrder?: number;
onSourceBasePowerPriority?: number;
onSourceInvulnerabilityPriority?: number;
onSourceModifyAccuracyPriority?: number;
onSourceModifyAtkPriority?: number;
onSourceModifySpAPriority?: number;
onSwitchInPriority?: number;
Expand Down

0 comments on commit 10e4ecd

Please sign in to comment.