From e0b53f87fca30e0666f5cf3ba9221b4e26e2d2fa Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 4 Nov 2021 10:56:14 -0300 Subject: [PATCH] Primal Reversion Tweaks -Fixed the inconsistent Primal Reversion activation in double battles. -Optimized the primal weather checks in attackcanceler a little. -Fixed the issue with multi-target fire/water moves during primal rain/sun. --- data/battle_scripts_1.s | 4 ++++ include/constants/battle.h | 1 + src/battle_script_commands.c | 30 +++++++++++++----------------- src/battle_util.c | 10 ++++------ 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 6d6c1dae8b..6373a7750c 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7697,8 +7697,10 @@ BattleScript_DesolateLandEvaporatesWaterTypeMoves:: attackstring pause B_WAIT_TIME_SHORT ppreduce + jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_STRING_PRINTED, BattleScript_MoveEnd printstring STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT waitmessage B_WAIT_TIME_LONG + orword gHitMarker, HITMARKER_STRING_PRINTED goto BattleScript_MoveEnd BattleScript_PrimordialSeaActivates:: @@ -7715,8 +7717,10 @@ BattleScript_PrimordialSeaFizzlesOutFireTypeMoves:: attackstring pause B_WAIT_TIME_SHORT ppreduce + jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_STRING_PRINTED, BattleScript_MoveEnd printstring STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN waitmessage B_WAIT_TIME_LONG + orword gHitMarker, HITMARKER_STRING_PRINTED goto BattleScript_MoveEnd BattleScript_DeltaStreamActivates:: diff --git a/include/constants/battle.h b/include/constants/battle.h index 918c3e7f0d..8841a3c128 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -200,6 +200,7 @@ #define HITMARKER_CHARGING (1 << 27) #define HITMARKER_FAINTED(battler) (gBitTable[battler] << 28) #define HITMARKER_FAINTED2(battler) ((1 << 28) << battler) +#define HITMARKER_STRING_PRINTED (1 << 29) // Per-side statuses that affect an entire party #define SIDE_STATUS_REFLECT (1 << 0) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ee9379d8d1..0fb2e55995 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1337,24 +1337,20 @@ static void Cmd_attackcanceler(void) GET_MOVE_TYPE(gCurrentMove, moveType); - if (moveType == TYPE_FIRE - && (gBattleWeather & WEATHER_RAIN_PRIMAL) - && WEATHER_HAS_EFFECT - && gBattleMoves[gCurrentMove].power) + if (WEATHER_HAS_EFFECT && gBattleMoves[gCurrentMove].power) { - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_PrimordialSeaFizzlesOutFireTypeMoves; - return; - } - - if (moveType == TYPE_WATER - && (gBattleWeather & WEATHER_SUN_PRIMAL) - && WEATHER_HAS_EFFECT - && gBattleMoves[gCurrentMove].power) - { - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_DesolateLandEvaporatesWaterTypeMoves; - return; + if (moveType == TYPE_FIRE && (gBattleWeather & WEATHER_RAIN_PRIMAL)) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_PrimordialSeaFizzlesOutFireTypeMoves; + return; + } + else if (moveType == TYPE_WATER && (gBattleWeather & WEATHER_SUN_PRIMAL)) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_DesolateLandEvaporatesWaterTypeMoves; + return; + } } if (gBattleOutcome != 0) diff --git a/src/battle_util.c b/src/battle_util.c index f87e0a1341..13908c2097 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8884,12 +8884,10 @@ bool32 CanMegaEvolve(u8 battlerId) // Check if trainer already mega evolved a pokemon. if (mega->alreadyEvolved[battlerPosition]) return FALSE; - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) - { - if (IsPartnerMonFromSameTrainer(battlerId) - && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)]))) - return FALSE; - } + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE + && IsPartnerMonFromSameTrainer(battlerId) + && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)]))) + return FALSE; // Gets mon data. if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT)