Skip to content

Commit

Permalink
Merged from official repos
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeyTheA committed Sep 8, 2024
2 parents 33e56d1 + 8082e6d commit d4354e7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/data/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ export class Weather {
return 1;
}

isMoveWeatherCancelled(move: Move): boolean {
isMoveWeatherCancelled(user: Pokemon, move: Move): boolean {
const moveType = user.getMoveType(move);

switch (this.weatherType) {
case WeatherType.HARSH_SUN:
return move instanceof AttackMove && move.type === Type.WATER;
return move instanceof AttackMove && moveType === Type.WATER;
case WeatherType.HEAVY_RAIN:
return move instanceof AttackMove && move.type === Type.FIRE;
return move instanceof AttackMove && moveType === Type.FIRE;
}

return false;
Expand Down
4 changes: 2 additions & 2 deletions src/field/arena.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ export class Arena {
return true;
}

isMoveWeatherCancelled(move: Move) {
return this.weather && !this.weather.isEffectSuppressed(this.scene) && this.weather.isMoveWeatherCancelled(move);
isMoveWeatherCancelled(user: Pokemon, move: Move) {
return this.weather && !this.weather.isEffectSuppressed(this.scene) && this.weather.isMoveWeatherCancelled(user, move);
}

isMoveTerrainCancelled(user: Pokemon, targets: BattlerIndex[], move: Move) {
Expand Down
1 change: 1 addition & 0 deletions src/phases/egg-summary-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class EggSummaryPhase extends Phase {
end() {
this.eggHatchHandler.clear();
this.scene.ui.setModeForceTransition(Mode.MESSAGE).then(() => {});
this.scene.time.delayedCall(250, () => this.scene.setModifiersVisible(true));
super.end();
}
}
2 changes: 1 addition & 1 deletion src/phases/move-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class MovePhase extends BattlePhase {
let success = this.move.getMove().applyConditions(this.pokemon, targets[0], this.move.getMove());
const cancelled = new Utils.BooleanHolder(false);
let failedText = this.move.getMove().getFailedText(this.pokemon, targets[0], this.move.getMove(), cancelled);
if (success && this.scene.arena.isMoveWeatherCancelled(this.move.getMove())) {
if (success && this.scene.arena.isMoveWeatherCancelled(this.pokemon, this.move.getMove())) {
success = false;
} else if (success && this.scene.arena.isMoveTerrainCancelled(this.pokemon, this.targets, this.move.getMove())) {
success = false;
Expand Down

0 comments on commit d4354e7

Please sign in to comment.