Skip to content

Commit

Permalink
Update accuracy modifier chaining
Browse files Browse the repository at this point in the history
Based on an understanding of Gen 4's system. Possibly not fully correct, but certainly less incorrect!
  • Loading branch information
Marty-D committed Jul 20, 2020
1 parent 356c065 commit 654d701
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 7 additions & 3 deletions data/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = {
},
compoundeyes: {
shortDesc: "This Pokemon's moves have their accuracy multiplied by 1.3.",
onModifyAccuracyPriority: 9,
onSourceModifyAccuracy(accuracy) {
if (typeof accuracy !== 'number') return;
this.debug('compoundeyes - enhancing accuracy');
Expand Down Expand Up @@ -1473,10 +1474,10 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = {
onModifyAtk(atk) {
return this.modify(atk, 1.5);
},
onModifyMovePriority: -1,
onModifyMove(move) {
onModifyAccuracyPriority: 7,
onSourceModifyAccuracy(accuracy, target, source, move) {
if (move.category === 'Physical' && typeof move.accuracy === 'number') {
move.accuracy *= 0.8;
return accuracy * 0.8;
}
},
name: "Hustle",
Expand Down Expand Up @@ -3265,6 +3266,7 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = {
onImmunity(type, pokemon) {
if (type === 'sandstorm') return false;
},
onModifyAccuracyPriority: 8,
onModifyAccuracy(accuracy) {
if (typeof accuracy !== 'number') return;
if (this.field.isWeather('sandstorm')) {
Expand Down Expand Up @@ -3612,6 +3614,7 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = {
onImmunity(type, pokemon) {
if (type === 'hail') return false;
},
onModifyAccuracyPriority: 8,
onModifyAccuracy(accuracy) {
if (typeof accuracy !== 'number') return;
if (this.field.isWeather('hail')) {
Expand Down Expand Up @@ -4050,6 +4053,7 @@ export const BattleAbilities: {[abilityid: string]: AbilityData} = {
},
tangledfeet: {
shortDesc: "This Pokemon's evasiveness is doubled as long as it is confused.",
onModifyAccuracyPriority: 6,
onModifyAccuracy(accuracy, target) {
if (typeof accuracy !== 'number') return;
if (target?.volatiles['confusion']) {
Expand Down
5 changes: 5 additions & 0 deletions data/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ export const BattleItems: {[itemid: string]: ItemData} = {
fling: {
basePower: 10,
},
onModifyAccuracyPriority: 5,
onModifyAccuracy(accuracy) {
if (typeof accuracy !== 'number') return;
this.debug('brightpowder - decreasing accuracy');
Expand Down Expand Up @@ -2975,6 +2976,7 @@ export const BattleItems: {[itemid: string]: ItemData} = {
fling: {
basePower: 10,
},
onModifyAccuracyPriority: 5,
onModifyAccuracy(accuracy) {
if (typeof accuracy !== 'number') return;
this.debug('lax incense - decreasing accuracy');
Expand Down Expand Up @@ -3687,6 +3689,7 @@ export const BattleItems: {[itemid: string]: ItemData} = {
},
effect: {
duration: 2,
onModifyAccuracyPriority: 3,
onSourceModifyAccuracy(accuracy, target, source) {
this.add('-enditem', source, 'Micle Berry');
source.removeVolatile('micleberry');
Expand Down Expand Up @@ -7239,6 +7242,7 @@ export const BattleItems: {[itemid: string]: ItemData} = {
fling: {
basePower: 10,
},
onModifyAccuracyPriority: 4,
onSourceModifyAccuracy(accuracy) {
if (typeof accuracy === 'number') {
return accuracy * 1.1;
Expand Down Expand Up @@ -7343,6 +7347,7 @@ export const BattleItems: {[itemid: string]: ItemData} = {
fling: {
basePower: 10,
},
onModifyAccuracyPriority: 4,
onSourceModifyAccuracy(accuracy, target) {
if (typeof accuracy === 'number' && !this.queue.willMove(target)) {
this.debug('Zoom Lens boosting accuracy');
Expand Down

0 comments on commit 654d701

Please sign in to comment.