Skip to content

Commit

Permalink
Implement Nature Power + Prankster interaction (smogon#603)
Browse files Browse the repository at this point in the history
A Pokemon with the ability Prankster that uses Nature Power will no longer be able to hit.

Grounded defenders if Psychic Terrain is active:
Before:
`252 SpA Choice Specs Whimsicott Psychic (Psychic) vs. 0 HP / 0 SpD Abomasnow in Psychic Terrain: 178-210 (55.4 - 65.4%) -- guaranteed 2HKO`
After:
`Prankster Whimsicott Nature Power vs. 0 HP Abomasnow in Psychic Terrain: 0-0 (0 - 0%) -- possibly the worst move ever`

Defenders that are Dark-type:
Before:
`252 SpA Choice Specs Whimsicott Moonblast (Fairy) vs. 0 HP / 4- SpD Absol in Misty Terrain: 548-648 (202.2 - 239.1%) -- guaranteed OHKO`
After:
`Prankster Whimsicott Nature Power vs. 0 HP Absol in Misty Terrain: 0-0 (0 - 0%) -- possibly the worst move ever`

Fixes smogon#438
  • Loading branch information
shrianshChari authored Mar 13, 2024
1 parent c557602 commit 3a90120
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions calc/src/mechanics/gen789.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,14 @@ export function calculateSMSSSV(
: field.hasTerrain('Psychic') ? 'Psychic'
: 'Normal';
desc.terrain = field.terrain;
desc.moveType = type;

// If the Nature Power user has the ability Prankster, it cannot affect
// Dark-types or grounded foes if Psychic Terrain is active
if (!(move.named('Nature Power') && attacker.hasAbility('Prankster')) &&
(defender.types.includes('Dark') ||
(field.hasTerrain('Psychic') && isGrounded(defender, field)))) {
desc.moveType = type;
}
} else if (move.named('Revelation Dance')) {
if (attacker.teraType) {
type = attacker.teraType;
Expand Down Expand Up @@ -812,6 +819,14 @@ export function calculateBasePowerSMSSSV(
case 'Nature Power':
move.category = 'Special';
move.secondaries = true;

// Nature Power cannot affect Dark-types if it is affected by Prankster
if (attacker.hasAbility('Prankster') && defender.types.includes('Dark')) {
basePower = 0;
desc.moveName = 'Nature Power';
desc.attackerAbility = 'Prankster';
break;
}
switch (field.terrain) {
case 'Electric':
basePower = 90;
Expand All @@ -826,8 +841,15 @@ export function calculateBasePowerSMSSSV(
desc.moveName = 'Moonblast';
break;
case 'Psychic':
basePower = 90;
desc.moveName = 'Psychic';
// Nature Power does not affect grounded Pokemon if it is affected by
// Prankster and there is Psychic Terrain active
if (attacker.hasAbility('Prankster') && isGrounded(defender, field)) {
basePower = 0;
desc.attackerAbility = 'Prankster';
} else {
basePower = 90;
desc.moveName = 'Psychic';
}
break;
default:
basePower = 80;
Expand Down

0 comments on commit 3a90120

Please sign in to comment.