Skip to content

Commit

Permalink
Gen 4: Fix Klutz not dropping Speed from Iron Ball (smogon#562)
Browse files Browse the repository at this point in the history
In Generation 4, if a Pokemon with the ability Klutz holds
an Iron Ball it should still get its Speed dropped. However, Klutz
Pokemon holding an Iron Ball won't be grounded.

Fixes smogon#560
  • Loading branch information
shrianshChari authored and ForwardFeed committed Oct 28, 2023
1 parent 1c8c382 commit 07328a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions calc/src/mechanics/gen4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ export function calculateDPP(

let typeEffectiveness = type1Effectiveness * type2Effectiveness;

// Iron Ball ignores Klutz in generation 4
if (typeEffectiveness === 0 && move.hasType('Ground') && defender.hasItem('Iron Ball')) {
// Klutz doesn't let Iron Ball ground in generation 4
if (typeEffectiveness === 0 && move.hasType('Ground') &&
(defender.hasItem('Iron Ball') && !defender.hasAbility('Klutz'))) {
if (type1Effectiveness === 0) {
type1Effectiveness = 1;
} else if (defender.types[1] && type2Effectiveness === 0) {
Expand Down
4 changes: 3 additions & 1 deletion calc/src/mechanics/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@ export function checkForecast(pokemon: Pokemon, weather?: Weather) {
}

export function checkItem(pokemon: Pokemon, magicRoomActive?: boolean) {
// Pokemon with Klutz still get their speed dropped in generation 4
if (pokemon.gen.num === 4 && pokemon.hasItem('Iron Ball')) return;
if (
pokemon.hasAbility('Klutz') && !EV_ITEMS.includes(pokemon.item!) ||
magicRoomActive
magicRoomActive
) {
pokemon.item = '' as ItemName;
}
Expand Down

0 comments on commit 07328a7

Please sign in to comment.