Skip to content

Commit

Permalink
added iron ball check to immunity checks, made terrain pulse only tak…
Browse files Browse the repository at this point in the history
…e terrain type for grounded pokemon
  • Loading branch information
jbmagier committed Mar 28, 2021
1 parent 086326f commit 913c489
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions calc/src/mechanics/gen78.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function calculateSMSS(
desc.attackerItem = attacker.item;
desc.moveBP = move.bp;
desc.moveType = move.type;
} else if (move.named('Nature Power', 'Terrain Pulse')) {
} else if (move.named('Nature Power') || (move.named('Terrain Pulse') && isGrounded(attacker, field))) {
move.type =
field.hasTerrain('Electric') ? 'Electric'
: field.hasTerrain('Grassy') ? 'Grass'
Expand Down Expand Up @@ -234,6 +234,8 @@ export function calculateSMSS(
} else if (defender.types[1] && effectiveness[defender.types[1]]! === 0) {
typeEffectiveness = type1Effectiveness;
}
} else if (typeEffectiveness === 0 && move.hasType('Ground') && defender.hasItem('Iron Ball')) {
typeEffectiveness = 1;
}

if (typeEffectiveness === 0) {
Expand All @@ -256,7 +258,8 @@ export function calculateSMSS(
(move.hasType('Electric') &&
defender.hasAbility('Lightning Rod', 'Motor Drive', 'Volt Absorb')) ||
(move.hasType('Ground') &&
!field.isGravity && !move.named('Thousand Arrows') && defender.hasAbility('Levitate')) ||
!field.isGravity && !defender.hasItem('Iron Ball') &&
!move.named('Thousand Arrows') && defender.hasAbility('Levitate')) ||
(move.flags.bullet && defender.hasAbility('Bulletproof')) ||
(move.flags.sound && !move.named('Clangorous Soul') && defender.hasAbility('Soundproof')) ||
(move.priority > 0 && defender.hasAbility('Queenly Majesty', 'Dazzling'))
Expand Down Expand Up @@ -648,7 +651,7 @@ export function calculateBasePowerSMSS(
desc.moveBP = basePower;
break;
case 'Terrain Pulse':
basePower = move.bp * (field.terrain ? 2 : 1);
basePower = move.bp * (field.terrain && isGrounded(attacker, field) ? 2 : 1);
desc.moveBP = basePower;
break;
case 'Fling':
Expand Down

0 comments on commit 913c489

Please sign in to comment.