From 502b1c5087f22387fb591413d53baae2d3e84090 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Mon, 17 Feb 2025 22:07:30 +0100 Subject: [PATCH] Rename SetPhotonGeyser to a more general use and clean up (#6272) --- asm/macros/battle_script.inc | 4 ++-- data/battle_scripts_1.s | 4 ++-- include/battle_scripts.h | 2 +- src/battle_script_commands.c | 20 ++++++++++++++++---- src/data/battle_move_effects.h | 6 +++--- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index bfd2c2378d..a169b3580b 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1641,8 +1641,8 @@ callnative BS_TryTriggerStatusForm .endm - .macro setphotongeysercategory - callnative BS_SetPhotonGeyserCategory + .macro setdynamicmovecategory + callnative BS_SetDynamicMoveCategory .endm .macro tryupperhand failInstr:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index fe9b6ea4ff..c8fa0103d6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -836,8 +836,8 @@ BattleScript_FlingMissed: ppreduce goto BattleScript_MoveMissedPause -BattleScript_EffectPhotonGeyser:: - setphotongeysercategory +BattleScript_EffectDynamicCategory:: + setdynamicmovecategory goto BattleScript_EffectHit BattleScript_EffectAuraWheel:: @ Aura Wheel can only be used by Morpeko diff --git a/include/battle_scripts.h b/include/battle_scripts.h index bd8601514c..ffa18d0343 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -825,7 +825,7 @@ extern const u8 BattleScript_MoveEffectHaze[]; extern const u8 BattleScript_MoveEffectIonDeluge[]; extern const u8 BattleScript_EffectHyperspaceFury[]; extern const u8 BattleScript_EffectAuraWheel[]; -extern const u8 BattleScript_EffectPhotonGeyser[]; +extern const u8 BattleScript_EffectDynamicCategory[]; extern const u8 BattleScript_EffectNoRetreat[]; extern const u8 BattleScript_EffectTarShot[]; extern const u8 BattleScript_EffectPoltergeist[]; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4241b989b9..6824243300 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -17705,13 +17705,25 @@ void BS_AllySwitchFailChance(void) gBattlescriptCurrInstr = cmd->nextInstr; } -void BS_SetPhotonGeyserCategory(void) +void BS_SetDynamicMoveCategory(void) { NATIVE_ARGS(); - u32 effect = GetMoveEffect(gCurrentMove); - if (!((effect == EFFECT_TERA_BLAST && GetActiveGimmick(gBattlerAttacker) != GIMMICK_TERA) - || (effect == EFFECT_TERA_STARSTORM && GetActiveGimmick(gBattlerAttacker) != GIMMICK_TERA && gBattleMons[gBattlerAttacker].species == SPECIES_TERAPAGOS_STELLAR))) + + switch (GetMoveEffect(gCurrentMove)) + { + case EFFECT_TERA_BLAST: + if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_TERA) + gBattleStruct->swapDamageCategory = (GetCategoryBasedOnStats(gBattlerAttacker) != GetMoveCategory(gCurrentMove)); + break; + case EFFECT_TERA_STARSTORM: + if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_TERA && gBattleMons[gBattlerAttacker].species == SPECIES_TERAPAGOS_STELLAR) + gBattleStruct->swapDamageCategory = (GetCategoryBasedOnStats(gBattlerAttacker) != GetMoveCategory(gCurrentMove)); + break; + default: gBattleStruct->swapDamageCategory = (GetCategoryBasedOnStats(gBattlerAttacker) != GetMoveCategory(gCurrentMove)); + break; + } + gBattlescriptCurrInstr = cmd->nextInstr; } diff --git a/src/data/battle_move_effects.h b/src/data/battle_move_effects.h index d657c429df..e2970afcaf 100644 --- a/src/data/battle_move_effects.h +++ b/src/data/battle_move_effects.h @@ -1909,7 +1909,7 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] = [EFFECT_PHOTON_GEYSER] = { - .battleScript = BattleScript_EffectPhotonGeyser, + .battleScript = BattleScript_EffectDynamicCategory, .battleTvScore = 0, // TODO: Assign points }, @@ -2201,13 +2201,13 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] = [EFFECT_TERA_BLAST] = { - .battleScript = BattleScript_EffectPhotonGeyser, + .battleScript = BattleScript_EffectDynamicCategory, .battleTvScore = 0, // TODO: Assign points }, [EFFECT_TERA_STARSTORM] = { - .battleScript = BattleScript_EffectPhotonGeyser, + .battleScript = BattleScript_EffectDynamicCategory, .battleTvScore = 0, // TODO: Assign points },