Skip to content

Commit

Permalink
Fix Protosynthesis + Cloud Nine interaction (#10804)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrebastosdias authored Jan 10, 2025
1 parent c8bc6be commit 2d9dc5d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 1 addition & 2 deletions data/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3441,8 +3441,7 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
// Protosynthesis is not affected by Utility Umbrella
if (this.field.isWeather('sunnyday')) {
pokemon.addVolatile('protosynthesis');
} else if (!pokemon.volatiles['protosynthesis']?.fromBooster && this.field.weather !== 'sunnyday') {
// Protosynthesis will not deactivite if Sun is suppressed, hence the direct ID check (isWeather respects supression)
} else if (!pokemon.volatiles['protosynthesis']?.fromBooster && !this.field.isWeather('sunnyday')) {
pokemon.removeVolatile('protosynthesis');
}
},
Expand Down
9 changes: 9 additions & 0 deletions data/mods/gen9dlc1/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ export const Abilities: import('../../../sim/dex-abilities').ModdedAbilityDataTa
},
protosynthesis: {
inherit: true,
onWeatherChange(pokemon) {
// Protosynthesis is not affected by Utility Umbrella
if (this.field.isWeather('sunnyday')) {
pokemon.addVolatile('protosynthesis');
} else if (!pokemon.volatiles['protosynthesis']?.fromBooster && this.field.weather !== 'sunnyday') {
// Protosynthesis will not deactivite if Sun is suppressed, hence the direct ID check (isWeather respects supression)
pokemon.removeVolatile('protosynthesis');
}
},
condition: {
noCopy: true,
onStart(pokemon, source, effect) {
Expand Down
4 changes: 2 additions & 2 deletions test/sim/abilities/protosynthesis.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Protosynthesis', function () {
assert.equal(tail.volatiles['protosynthesis'].bestStat, 'spd', `Scream Tail's SpD should have been boosted by Protosynthesis in Sun while holding Utility Umbrella`);
});

it(`should not be deactiviated by weather suppressing abilities`, function () {
it(`should be deactiviated by weather suppressing abilities`, function () {
battle = common.createBattle([[
{species: 'Scream Tail', ability: 'protosynthesis', moves: ['splash']},
], [
Expand All @@ -88,7 +88,7 @@ describe('Protosynthesis', function () {
const tail = battle.p1.active[0];

Check warning on line 88 in test/sim/abilities/protosynthesis.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'tail' is assigned a value but never used
battle.makeChoices('move splash', 'switch 2');

assert.equal(tail.volatiles['protosynthesis'].bestStat, 'spd', `Scream Tail's SpD should have remained boosted by Protosynthesis in Sun even though a weather supressing ability was activated`);
assert(!battle.p1.active[0].volatiles['protosynthesis'], `Scream Tail should not have remained boosted by Protosynthesis because a weather supressing ability started even though Sun was active`);
});

it(`should not activate if weather is suppressed`, function () {
Expand Down

0 comments on commit 2d9dc5d

Please sign in to comment.