diff --git a/calc/src/mechanics/gen4.ts b/calc/src/mechanics/gen4.ts index fc7c54990..f8b6d3318 100644 --- a/calc/src/mechanics/gen4.ts +++ b/calc/src/mechanics/gen4.ts @@ -66,9 +66,21 @@ export function calculateDPP( return result; } - const tempAbility = defender.ability; + const defenderAbilityIgnored = defender.hasAbility( + 'Battle Armor', 'Clear Body', 'Damp', 'Dry Skin', + 'Filter', 'Flash Fire', 'Flower Gift', 'Heatproof', + 'Hyper Cutter', 'Immunity', 'Inner Focus', 'Insomnia', + 'Keen Eye', 'Leaf Guard', 'Levitate', 'Lightning Rod', + 'Limber', 'Magma Armor', 'Marvel Scale', 'Motor Drive', + 'Oblivious', 'Own Tempo', 'Sand Veil', 'Shell Armor', + 'Shield Dust', 'Simple', 'Snow Cloak', 'Solid Rock', + 'Soundproof', 'Sticky Hold', 'Storm Drain', 'Sturdy', + 'Suction Cups', 'Tangled Feet', 'Thick Fat', 'Unaware', + 'Vital Spirit', 'Volt Absorb', 'Water Absorb', 'Water Veil', + 'White Smoke', 'Wonder Guard' + ); - if (attacker.hasAbility('Mold Breaker')) { + if (attacker.hasAbility('Mold Breaker') && defenderAbilityIgnored) { defender.ability = '' as AbilityName; desc.attackerAbility = attacker.ability; } @@ -202,13 +214,6 @@ export function calculateDPP( // #endregion - // Restores the defender's ability after disabling it for Mold Breaker purposes. - // This will make abilities like Rain Dish and Dry Skin work - // even when the attacker has Mold Breaker. - if (attacker.hasAbility('Mold Breaker')) { - defender.ability = tempAbility; - } - // #region (Special) Defense const defense = calculateDefenseDPP(gen, attacker, defender, move, field, desc, isCritical); diff --git a/calc/src/mechanics/gen56.ts b/calc/src/mechanics/gen56.ts index ef1053787..a36fc8cf1 100644 --- a/calc/src/mechanics/gen56.ts +++ b/calc/src/mechanics/gen56.ts @@ -95,9 +95,26 @@ export function calculateBWXY( return result; } - const tempAbility = defender.ability; + const defenderAbilityIgnored = defender.hasAbility( + 'Aroma Veil', 'Aura Break', 'Battle Armor', 'Big Pecks', + 'Bulletproof', 'Clear Body', 'Contrary', 'Damp', + 'Dark Aura', 'Dry Skin', 'Fairy Aura', 'Filter', + 'Flash Fire', 'Flower Gift', 'Flower Veil', 'Friend Guard', + 'Fur Coat', 'Grass Pelt', 'Heatproof', 'Heavy Metal', + 'Hyper Cutter', 'Immunity', 'Inner Focus', 'Insomnia', + 'Keen Eye', 'Leaf Guard', 'Levitate', 'Light Metal', + 'Lightning Rod', 'Limber', 'Magic Bounce', 'Magma Armor', + 'Marvel Scale', 'Motor Drive', 'Multiscale', 'Oblivious', + 'Overcoat', 'Own Tempo', 'Sand Veil', 'Sap Sipper', + 'Shell Armor', 'Shield Dust', 'Simple', 'Snow Cloak', + 'Solid Rock', 'Soundproof', 'Sticky Hold', 'Storm Drain', + 'Sturdy', 'Suction Cups', 'Sweet Veil', 'Tangled Feet', + 'Telepathy', 'Thick Fat', 'Unaware', 'Vital Spirit', + 'Volt Absorb', 'Water Absorb', 'Water Veil', 'White Smoke', + 'Wonder Guard', 'Wonder Skin' + ); - if (attacker.hasAbility('Mold Breaker', 'Teravolt', 'Turboblaze')) { + if (attacker.hasAbility('Mold Breaker', 'Teravolt', 'Turboblaze') && defenderAbilityIgnored) { defender.ability = '' as AbilityName; desc.attackerAbility = attacker.ability; } @@ -291,13 +308,6 @@ export function calculateBWXY( // #endregion - // Restores the defender's ability after disabling it for Mold Breaker purposes. - // This will make abilities like Rain Dish and Dry Skin work - // even when the attacker has Mold Breaker. - if (attacker.hasAbility('Mold Breaker', 'Teravolt', 'Turboblaze')) { - defender.ability = tempAbility; - } - // #region (Special) Defense const defense = calculateDefenseBWXY(gen, attacker, defender, move, field, desc, isCritical); diff --git a/calc/src/mechanics/gen789.ts b/calc/src/mechanics/gen789.ts index 55a4f9b26..bcb7309f1 100644 --- a/calc/src/mechanics/gen789.ts +++ b/calc/src/mechanics/gen789.ts @@ -149,12 +149,28 @@ export function calculateSMSSSV( return result; } - const defenderIgnoresAbility = defender.hasAbility( - 'Full Metal Body', - 'Prism Armor', - 'Shadow Shield', - 'Tablets of Ruin', - 'Vessel of Ruin' + const defenderAbilityIgnored = defender.hasAbility( + 'Armor Tail', 'Aroma Veil', 'Aura Break', 'Battle Armor', + 'Big Pecks', 'Bulletproof', 'Clear Body', 'Contrary', + 'Damp', 'Dazzling', 'Disguise', 'Dry Skin', + 'Earth Eater', 'Filter', 'Flash Fire', 'Flower Gift', + 'Flower Veil', 'Fluffy', 'Friend Guard', 'Fur Coat', + 'Good as Gold', 'Grass Pelt', 'Guard Dog', 'Heatproof', + 'Heavy Metal', 'Hyper Cutter', 'Ice Face', 'Ice Scales', + 'Illuminate', 'Immunity', 'Inner Focus', 'Insomnia', + 'Keen Eye', 'Leaf Guard', 'Levitate', 'Light Metal', + 'Lightning Rod', 'Limber', 'Magic Bounce', 'Magma Armor', + 'Marvel Scale', "Mind's Eye", 'Mirror Armor', 'Motor Drive', + 'Multiscale', 'Oblivious', 'Overcoat', 'Own Tempo', + 'Pastel Veil', 'Punk Rock', 'Purifying Salt', 'Queenly Majesty', + 'Sand Veil', 'Sap Sipper', 'Shell Armor', 'Shield Dust', + 'Simple', 'Snow Cloak', 'Solid Rock', 'Soundproof', + 'Sticky Hold', 'Storm Drain', 'Sturdy', 'Suction Cups', + 'Sweet Veil', 'Tangled Feet', 'Telepathy', 'Tera Shell', + 'Thermal Exchange', 'Thick Fat', 'Unaware', 'Vital Spirit', + 'Volt Absorb', 'Water Absorb', 'Water Bubble', 'Water Veil', + 'Well-Baked Body', 'White Smoke', 'Wind Rider', 'Wonder Guard', + 'Wonder Skin' ); const attackerIgnoresAbility = attacker.hasAbility('Mold Breaker', 'Teravolt', 'Turboblaze'); @@ -170,9 +186,7 @@ export function calculateSMSSSV( 'Sunsteel Strike' ); - const tempAbility = defender.ability; - - if (!defenderIgnoresAbility && (attackerIgnoresAbility || moveIgnoresAbility)) { + if (defenderAbilityIgnored && (attackerIgnoresAbility || moveIgnoresAbility)) { if (attackerIgnoresAbility) desc.attackerAbility = attacker.ability; if (defender.hasItem('Ability Shield')) { desc.defenderItem = defender.item; @@ -574,14 +588,6 @@ export function calculateSMSSSV( : 'atk'; // #endregion - // Restores the defender's ability after disabling it for the purposes of - // Mold Breaker and other moves that ignore abilities. - // This will make abilities like Rain Dish and Quark Drive work - // even when the attacker has Mold Breaker. - if (attackerIgnoresAbility || moveIgnoresAbility) { - defender.ability = tempAbility; - } - // #region (Special) Defense const defense = calculateDefenseSMSSSV(gen, attacker, defender, move, field, desc, isCritical); diff --git a/calc/src/test/calc.test.ts b/calc/src/test/calc.test.ts index 3890c13ae..9fe61c395 100644 --- a/calc/src/test/calc.test.ts +++ b/calc/src/test/calc.test.ts @@ -744,7 +744,7 @@ describe('calc', () => { expect(result.defender.ability).toBe('Rain Dish'); expect(result.desc()).toBe( - '0 Atk Mold Breaker Rampardos Stone Edge vs. 0 HP / 0 Def Blastoise: 168-198 (56.1 - 66.2%) -- guaranteed 2HKO after Rain Dish recovery' + '0 Atk Rampardos Stone Edge vs. 0 HP / 0 Def Blastoise: 168-198 (56.1 - 66.2%) -- guaranteed 2HKO after Rain Dish recovery' ); }); }); @@ -1251,7 +1251,7 @@ describe('calc', () => { const knockoff = Move('Knock Off'); const result = calculate(sawk, silvally, knockoff); expect(result.desc()).toBe( - '252 Atk Mold Breaker Sawk Knock Off vs. 0 HP / 0 Def Silvally-Dark: 36-43 (10.8 - 12.9%) -- possible 8HKO' + '252 Atk Sawk Knock Off vs. 0 HP / 0 Def Silvally-Dark: 36-43 (10.8 - 12.9%) -- possible 8HKO' ); });