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

[Refactor] Align ability display with mainline #5267

Draft
wants to merge 42 commits into
base: beta
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2ab325c
Stop ShowAbilityPhase from ending until the bar has popped out
emdeann Feb 1, 2025
76a0ebb
Remove ability bar hiding from messagePhase
emdeann Feb 1, 2025
c55e60e
Remove abilityBar reference from base Phase class
emdeann Feb 1, 2025
e463071
Add HideAbilityPhase to hide ability bar after effects
emdeann Feb 1, 2025
2ab82e2
Add willSucceed to ability attrs
emdeann Feb 1, 2025
79bc8f9
Update AbAttrs and PostInitAbAttrs
emdeann Feb 1, 2025
cb6ceed
Update PreDefendAbAttrs
emdeann Feb 1, 2025
e2249a2
Update postDefend, postMoveUsed, StatStage, postSetStatus, and PostDa…
emdeann Feb 1, 2025
e958bb5
Update preAttack and fieldStat
emdeann Feb 2, 2025
d85c1ce
Partially implement postAttack
emdeann Feb 2, 2025
0694909
Finish PostAttack
emdeann Feb 2, 2025
cf4166d
Update PostSummon
emdeann Feb 2, 2025
e65ae7d
Update PreSwitchOut
emdeann Feb 2, 2025
fa00a74
Update preStatStageChange
emdeann Feb 2, 2025
33cecea
Update PostStatStageChange, PreSetStatus, PreApplyBattlerTag
emdeann Feb 2, 2025
cb7a1b6
Update postTurn and preWeatherEffect
emdeann Feb 2, 2025
578052b
Update postWeatherChange
emdeann Feb 2, 2025
25965b3
Update postWeatherChange
emdeann Feb 2, 2025
89e4912
Update PostTerrainChange
emdeann Feb 2, 2025
dba1993
Update CheckTrapped and PostBattle
emdeann Feb 2, 2025
4e4d320
Update postFaint
emdeann Feb 2, 2025
7add8d8
Update PostItemLost
emdeann Feb 2, 2025
aea1ee7
Bug fixes from test cases
emdeann Feb 2, 2025
9c9d550
Fix intimidate display
emdeann Feb 2, 2025
b7bcef9
Stop trace from displaying itself
emdeann Feb 2, 2025
28dafb6
Rename to canApply
emdeann Feb 2, 2025
48da9af
Merge branch 'pagefaultgames:beta' into ability_display
emdeann Feb 2, 2025
fea2ce3
Fix ability displays using getTriggerMessage
emdeann Feb 3, 2025
617ff69
Ensure abilities which are mistakenly shown are still hidden
emdeann Feb 4, 2025
2b6a4ec
Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue in…
emdeann Feb 5, 2025
8c0d4da
Fix ability bar showing the wrong ability with imposter
emdeann Feb 5, 2025
17232d7
Add canApply for imposter
emdeann Feb 5, 2025
953a1e4
Update abilities using promises and `trySet...` functions
emdeann Feb 6, 2025
cde9f66
Committing overrides changes is bad
emdeann Feb 6, 2025
7132ea4
Merge branch 'pagefaultgames:beta' into ability_display
emdeann Feb 6, 2025
6d7d5fc
Merge branch 'ability_display' of https://github.com/emdeann/pokerogu…
emdeann Feb 6, 2025
216a7c0
Document apply and canApply
emdeann Feb 7, 2025
8c82ced
Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue in…
emdeann Feb 7, 2025
574d181
Update PreLeaveFieldAbAttr
emdeann Feb 7, 2025
2eb67a5
Merge branch 'beta' into ability_display
emdeann Feb 16, 2025
ddfce53
Remove boolean return type apply functions
emdeann Feb 16, 2025
be2b258
Remove redundant assignment
emdeann Feb 18, 2025
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
Prev Previous commit
Next Next commit
Update postWeatherChange
  • Loading branch information
emdeann committed Feb 2, 2025
commit 25965b34c067f55364e9b9ad8614949142c91a9e
33 changes: 19 additions & 14 deletions src/data/ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3453,6 +3453,10 @@ export class PostWeatherLapseAbAttr extends AbAttr {
this.weatherTypes = weatherTypes;
}

willSucceedPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather | null, args: any[]): boolean {
return true;
}

applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather | null, args: any[]): boolean | Promise<boolean> {
return false;
}
Expand All @@ -3471,17 +3475,17 @@ export class PostWeatherLapseHealAbAttr extends PostWeatherLapseAbAttr {
this.healFactor = healFactor;
}

willSucceedPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather | null, args: any[]): boolean {
return !pokemon.isFullHp();
}

applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather, args: any[]): boolean {
if (!pokemon.isFullHp()) {
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
if (!simulated) {
globalScene.unshiftPhase(new PokemonHealPhase(pokemon.getBattlerIndex(),
Utils.toDmgValue(pokemon.getMaxHp() / (16 / this.healFactor)), i18next.t("abilityTriggers:postWeatherLapseHeal", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }), true));
}
return true;
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
if (!simulated) {
globalScene.unshiftPhase(new PokemonHealPhase(pokemon.getBattlerIndex(),
Utils.toDmgValue(pokemon.getMaxHp() / (16 / this.healFactor)), i18next.t("abilityTriggers:postWeatherLapseHeal", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }), true));
}

return false;
return true;
}
}

Expand All @@ -3494,11 +3498,11 @@ export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr {
this.damageFactor = damageFactor;
}

applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather, args: any[]): boolean {
if (pokemon.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) {
return false;
}
willSucceedPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather | null, args: any[]): boolean {
return !pokemon.hasAbilityWithAttr(BlockNonDirectDamageAbAttr);
}

applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather, args: any[]): boolean {
if (!simulated) {
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
globalScene.queueMessage(i18next.t("abilityTriggers:postWeatherLapseDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }));
Expand Down Expand Up @@ -5384,7 +5388,8 @@ export function applyPostWeatherChangeAbAttrs(attrType: Constructor<PostWeatherC

export function applyPostWeatherLapseAbAttrs(attrType: Constructor<PostWeatherLapseAbAttr>,
pokemon: Pokemon, weather: Weather | null, simulated: boolean = false, ...args: any[]): Promise<void> {
return applyAbAttrsInternal<PostWeatherLapseAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostWeatherLapse(pokemon, passive, simulated, weather, args), args, false, simulated);
return applyAbAttrsInternal<PostWeatherLapseAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostWeatherLapse(pokemon, passive, simulated, weather, args),
(attr, passive) => attr.willSucceedPostWeatherLapse(pokemon, passive, simulated, weather, args), args, false, simulated);
}

export function applyPostTerrainChangeAbAttrs(attrType: Constructor<PostTerrainChangeAbAttr>,
Expand Down