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

Implemented the majority of the Gen. 9 Abilities #2470

Merged
merged 39 commits into from
Jan 2, 2023

Conversation

LOuroboros
Copy link
Collaborator

@LOuroboros LOuroboros commented Dec 6, 2022

Description

I totally didn't implement most of these many weeks ago (wink, wink).
That means that I totally implemented them recently and well after the leaks and stuff.

So anyway, here's 27 out of 31 ability effects introduced in the Gen. 9 Games.

Notes:
-I skipped Commander and Opportunist because they both sound like a pita.
-Guard Dog needs #2452 to be merged.
-I'm not sure if it's a good idea to look into Zero to Hero now, or if I should wait for the battle form related form change table changes.

I tried to do Opportunist by expanding the code inside PrepareStringBattle, but I couldn't get anywhere.

Commander is a meme double battle-exclusive ability where when you send out a Dondozo and a Tatsugiri, the latter enters the former's mouth providing them with some stat stage boosts, and in turn "disappearing" from the battle field.
It's not that it dies, it doesn't go away. It remains there, inside Dondozo's mouth, incapable of being targeted until Dondozo faints.
It sounds annoying to do, but earlier I had a potential idea on how to handle it. I may look into it, i don't know.

Things in need of research
-Does Wind Power activate multiple times for multihit moves like Electromorphosis, or not?
-Does Cud Chew activate multiple times in battle, or just once? For example, does it reset on Switch Out and Switch In or not?

Extras
Certain abilities such as Intrepid Sword and Battle Bond were modified in Gen. 9.
I had this in my notes. I'd be willing to look into it, either for this PR or a separate one.
-Add a config for Gen. 9 Intrepid Sword and Dauntless Shield maybe.
-Add a config for Gen. 9 Battle Bond maybe.
-Battle Bond no longer transforms Greninja, it doesn't boost Water Shuriken and it only activates once per battle.
-It also boosts the user's Attack, Sp. Attack and Speed by 1 stat stage.

Discord contact info

Lunos#4026

And took the chance to tweak Mummy's.
-Added a modifybattlerstatstage macro to handle stat stages in battle.
-Rewrote the checks inside the case ABILITYEFFECT_MOVES_BLOCK of AbilityBattleEffects.
Also added a battle preproc config to check if the STATUS3_CHARGED_UP was already applied.
Pokémon Scarlet and Violet don't check if this status flag was already applied on the target of abilities like Electromorphosis (and Wind Power until proven otherwise.)
As a result, the game will trigger the ability multiple times if they're hit by a multihit move.
This directive makes the code end the ability effect preemptively if the target does have the status flag applied.
Also turned GetHighestStatId into a global function since Protosynthesis' effect uses it.
Also tweaked STRINGID_SUNLIGHTACTIVATEDABILITY and STRINGID_STATWASHEIGHTENED.
Abilities such as Protosynthesis and Quark Drive demand it.
@LOuroboros
Copy link
Collaborator Author

With #2452 merged, I can now implement Guard Dog too, so I'll do just that.

@LOuroboros
Copy link
Collaborator Author

Ready 👀

Copy link
Collaborator

@ghoulslash ghoulslash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have any AI considerations been made?

data/battle_scripts_1.s Outdated Show resolved Hide resolved
data/battle_scripts_1.s Outdated Show resolved Hide resolved
data/battle_scripts_1.s Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
data/battle_scripts_1.s Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
Anger Shell:
 -Made it print a string from the gStatDownStringIds table while lowering Def and Sp. Def
 -Made it use the shiny new modifybattlerstatstage macro.
 -Made it activate multiple times per battle, as it should.
Well-Baked Body:
 -Turned it into an absorbing ability.
Wind Rider:
 -Turned it into an absorbing ability.
 -For its Tailwind interaction, I made it activate only when Tailwind kicks in successfully, instead of whenever it's active at the end of a turn.
Guard Dog:
 -Updated its check inside BattleScript_EffectHitEscape.
 -Moved it from Cmd_forcerandomswitch to BattleScript_EffectRoar.
Wind Power:
 -Split off its move end effect from Electromorphosis'.
Electromorphosis:
 -Split off its move end effect from Wind Power's.
Hadron Engine:
 -Merged its Switch In effect with Electric Surge's.
Protosynthesis:
 -Fixed its stat boost.
Quark Drive:
 -Fixed its stat boost.
Cud Chew:
 -Updated its ENDTURN effect's berry check.
Supreme Overlord:
 -Tweaked the looping i variable's data type, the order of the variables and the checks inside ApplySupremeOverlordModifier.
Earth Eater:
 -Turned it into an absorbing ability.

Misc changes:
-Added a variable to set the amount of stat stages raised inside AbilityMoveEffects' case ABILITYEFFECT_ABSORBING.
-Added a preproc config to update the text string that they print.
-Limited the scope of atkHighestStat and defHighestStat in CalcMoveBasePowerAfterModifiers to Protosynthesis's and Quark Drive's effects.
@LOuroboros
Copy link
Collaborator Author

LOuroboros commented Dec 20, 2022

Ah, I forgot to merge-in upstream (as in the expansion's upcoming branch). Will do.

@LOuroboros
Copy link
Collaborator Author

Alright, done. I'll wait for your responses to the unresolved reviews @ghoulslash before proceeding with the rest of the changes 👀

src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
@LOuroboros
Copy link
Collaborator Author

I just don't see why wind power is in ENDTURN_TAILWIND at all. Even if it can be activated by tailwind (which doesn't really make sense from the ability description but I assume there's been in game testing for this), it belongs in the move's effect

It's because I thought that it activated during each end of turn while Tailwind's timer was still running @ghoulslash, and I thought the exact same thing about Wind Rider.

I don't intend to keep it like that since you told me that's not how it works, to clarify. The only reason I haven't moved it yet is because I was waiting for your response in relation to the new battle script that was called from insidee BattleScript_EffectTailwind to deecide what it is that I should do 😅 ...

@ghoulslash
Copy link
Collaborator

I just don't see why wind power is in ENDTURN_TAILWIND at all. Even if it can be activated by tailwind (which doesn't really make sense from the ability description but I assume there's been in game testing for this), it belongs in the move's effect

It's because I thought that it activated during each end of turn while Tailwind's timer was still running @ghoulslash, and I thought the exact same thing about Wind Rider.

I don't intend to keep it like that since you told me that's not how it works, to clarify. The only reason I haven't moved it yet is because I was waiting for your response in relation to the new battle script that was called from insidee BattleScript_EffectTailwind to deecide what it is that I should do 😅 ...

Ah gotcha, that makes sense. If the battle script question was about the return then yeah you were right

-Renamed TryActivateWindRiderLoop to BattleScript_TryTailwindAbilitiesLoop
-Modified how it handles the check for Wind Rider by using a various and incorporated Wind Power into the mix because that ability is affected by Tailwind as well.
@LOuroboros
Copy link
Collaborator Author

Updated the PR as it was pointed out to me that Anger Shell is not affected by Sheer Force, just like Berserk.

https://www.smogon.com/forums/threads/inaccurate-anger-shell-description.3713075/post-9441418

data/battle_scripts_1.s Outdated Show resolved Hide resolved
src/battle_util.c Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
data/battle_scripts_1.s Outdated Show resolved Hide resolved
-Removed BattleScript_WindRiderActivatesEnd2
-Tweaked the condition of Wind Power in AbilityBattleEffects
-Renamed ApplySupremeOverlordModifier to GetSupremeOverlordModifier
A new, probably better way to handle the announcement trigger that abilities such as Protosynthesis and Quark Drive have, when the battle weather or the field terrain change.

Misc. changes:
-EFFECT_DAMAGE_SET_TERRAIN -> EFFECT_HIT_SET_REMOVE_TERRAIN
 -It's more appropriate as the effect can be used to force set a terrain or simply to remove an active terrain, after all.
 -The main reason for the rename was the inconsistency with the battle script's label.
-Reverted accidentally committed change to B_DOUBLE_WILD_CHANCE, performed back in c8abf00.
@LOuroboros
Copy link
Collaborator Author

Following @ghoulslash's reply on Discord, I ended up adding new cases for AbilityBattleEffects, to handle ability activations when a weather or a field terrain are invoked.

I also took the chance to undo an accidental change made for testing purposes that I shouldn't have pushed, and since I had to modify its battle script, I also took the chance to rename EFFECT_DAMAGE_SET_TERRAIN.

So yeah, I think this is ready for another review 👀

data/battle_scripts_1.s Outdated Show resolved Hide resolved
asm/macros/battle_script.inc Outdated Show resolved Hide resolved
asm/macros/battle_script.inc Outdated Show resolved Hide resolved
@LOuroboros
Copy link
Collaborator Author

Alright, I think that should be good.

I'm not sure if you wanted me to rewrite TryWeatherFormChange into ABILITYEFFECT_ON_WEATHER or not, so I just moved the cases for Forecast and Flower Gift into ABILITYEFFECT_ON_WEATHER, checked that Castform is still working, and called it a day 👀

As I said on Discord, I think it should be discussed whether it's a good idea to keep GF's hacky way of handling these form changes or just make them use a conventional species swap like any other and also incorporating them into the form change table, but that's separate from this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants