Implemented Custom/Complex/Expanded GiveMon scripting command (#3924)

* Introducing an expanded givemon

* Added debug features to check a Pokémon's EV and IV

* Added a parameter to set a custom mon's gender

* Added a debug feature to clear the party

* Defined the EV/IV getters in gSpecials

* Added Gigantamax Factor toggle to givecustommon

* Updated Gigantamax Factor label in givecustommon macro

* Added tera type parameter to givecustommon

Misc. changes:
-Added a few harmless comments to CreateCustomMon for consistency reasons.

* Cleaned up the code inside CreateCustomMon a bit

Also updated the values assigned to the parameters of ScriptGiveCustomMon
This is temporary though. I'll probably end up turning them into 2byte parameters so they can be filled when the scripting command is called by using variables once I solve the bigger problem that the scripting command is currently facing.

* Foolproofed the Poké Ball check in CreateCustomMon

* Assigned a default gender to givecustommon
This solved the nasty issue by which the command wasn't working properly if you didn't fill in each parameter when calling givecustommon in a script.

* Reinforced the gender checks at CreateCustomMon

* Re-reinforced the gender checks at CreateCustomMon

* Compressed givecustommon and added tests

-Made givecustommon skip unspecified parameters.
-Added scripting variables support for every parameter.
-Added tests.

* Updated the default values of some ScriptGiveCustomMon parameters

* Replaced vanilla's givemon with givecustommon

Misc. Changes:
-Renamed CreateCustomMon to ScriptGiveMonParameterized.
 -The truth is that the function was never limited to creating the skeleton of a Pokémon like the actual CreateMon functions do, so that label was never correct. The function was always an expanded ScriptGiveMon.
-Moved the core functions to src/script_pokemon_util.c which is where they actually belong.
-Updated ScriptGiveMonParameterized a little to incorporateb changes that were applied to the original ScriptGiveMon, namely, Synchronize ability and form change handling.
-Introduced a new ScriptGiveMon to replace the original one.

* Corrected givecustommon tests

* Fixed the default IV values for the new givemon

* Updated DebugAction_Party_ClearParty for consistency with the other debug functions

* Updated the text strings used by the Check EV/IV debug features

---------

Co-authored-by: Martin Griffin <martinrgriffin@gmail.com>
Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
LOuroboros
2024-02-08 05:11:13 -03:00
committed by GitHub
parent 8d4c3a8acb
commit 916e4814bd
10 changed files with 449 additions and 66 deletions

View File

@@ -95,6 +95,48 @@ Debug_BoxFilledMessage::
Debug_BoxFilledMessage_Text:
.string "Storage boxes filled!$"
Debug_EventScript_CheckEV::
lockall
getpartysize
goto_if_eq VAR_RESULT, 0, Debug_HatchAnEgg_NoPokemon
special ChoosePartyMon
waitstate
goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_EventScript_CheckEV_End
callnative Script_GetChosenMonOffensiveEV
msgbox Debug_EventScript_Text_OffensiveEV, MSGBOX_DEFAULT
callnative Script_GetChosenMonDefensiveEV
msgbox Debug_EventScript_Text_DefensiveEV, MSGBOX_DEFAULT
Debug_EventScript_CheckEV_End::
releaseall
end
Debug_EventScript_Text_OffensiveEV:
.string "ATK EV: {STR_VAR_1}, SPATK EV: {STR_VAR_2}, SPEED EV: {STR_VAR_3}$"
Debug_EventScript_Text_DefensiveEV:
.string "HP EV: {STR_VAR_1}, DEF EV: {STR_VAR_2}, SPDEF EV: {STR_VAR_3}$"
Debug_EventScript_CheckIV::
lockall
getpartysize
goto_if_eq VAR_RESULT, 0, Debug_HatchAnEgg_NoPokemon
special ChoosePartyMon
waitstate
goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_EventScript_CheckIV_End
callnative Script_GetChosenMonOffensiveIV
msgbox Debug_EventScript_Text_OffensiveIV, MSGBOX_DEFAULT
callnative Script_GetChosenMonDefensiveIV
msgbox Debug_EventScript_Text_DefensiveIV, MSGBOX_DEFAULT
Debug_EventScript_CheckIV_End::
releaseall
end
Debug_EventScript_Text_OffensiveIV:
.string "ATK IV: {STR_VAR_1}, SPATK IV: {STR_VAR_2}, SPEED IV: {STR_VAR_3}$"
Debug_EventScript_Text_DefensiveIV:
.string "HP IV: {STR_VAR_1}, DEF IV: {STR_VAR_2}, SPDEF IV: {STR_VAR_3}$"
Debug_EventScript_Script_1::
end
@@ -247,4 +289,3 @@ Debug_FlagsAndVarNotSetBattleConfigMessage_Text:
.string "Feature unavailable! Please define a\n"
.string "usable flag and a usable var in:\l"
.string "'include/config/battle.h'!$"