Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gen 4: Fix Klutz not dropping Speed from Iron Ball #562

Merged
merged 2 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -190,9 +190,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
Loading