From 468ee66cd877b175244eb204a1b5cd24cd379d78 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sat, 30 Oct 2021 11:04:50 -0400 Subject: [PATCH] fix synthesis and leaf guard w utility umbrella --- asm/macros/battle_script.inc | 7 +++---- data/battle_scripts_1.s | 12 ++++++------ include/constants/battle_script_commands.h | 1 + src/battle_script_commands.c | 10 ++++++++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 3de14f586..7e35f6ab2 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1989,10 +1989,9 @@ goto \jumpptr .endm - .macro jumpifleafguard jumpptr:req - jumpifhalfword CMP_NO_COMMON_BITS, gBattleWeather, WEATHER_SUN_ANY, 1f - jumpifability BS_TARGET, ABILITY_LEAF_GUARD, \jumpptr - 1: + .macro jumpifleafguardprotected battler:req, jumpptr:req + various \battler, VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED + .4byte \jumpptr .endm .macro jumpifsafeguard jumpptr:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 180c74eed..c050fb4be 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2512,7 +2512,7 @@ BattleScript_EffectSleep:: jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects jumpifflowerveil BattleScript_FlowerVeilProtects jumpifability BS_TARGET_SIDE, ABILITY_SWEET_VEIL, BattleScript_SweetVeilProtects - jumpifleafguard BattleScript_LeafGuardProtects + jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifterrainaffected BS_TARGET, STATUS_FIELD_ELECTRIC_TERRAIN, BattleScript_ElectricTerrainPrevents @@ -3054,7 +3054,7 @@ BattleScript_EffectToxic:: jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects jumpifflowerveil BattleScript_FlowerVeilProtects - jumpifleafguard BattleScript_LeafGuardProtects + jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifsubstituteblocks BattleScript_ButItFailed jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned @@ -3409,7 +3409,7 @@ BattleScript_EffectPoison:: jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects jumpifflowerveil BattleScript_FlowerVeilProtects - jumpifleafguard BattleScript_LeafGuardProtects + jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifsubstituteblocks BattleScript_ButItFailed jumpifstatus BS_TARGET, STATUS1_POISON, BattleScript_AlreadyPoisoned @@ -3434,7 +3434,7 @@ BattleScript_EffectParalyze: jumpifability BS_TARGET, ABILITY_LIMBER, BattleScript_LimberProtected jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects jumpifflowerveil BattleScript_FlowerVeilProtects - jumpifleafguard BattleScript_LeafGuardProtects + jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifsubstituteblocks BattleScript_ButItFailed .if B_GLARE_GHOST >= GEN_4 @@ -4874,7 +4874,7 @@ BattleScript_EffectWillOWisp:: jumpifability BS_TARGET, ABILITY_WATER_BUBBLE, BattleScript_WaterVeilPrevents jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects jumpifflowerveil BattleScript_FlowerVeilProtects - jumpifleafguard BattleScript_LeafGuardProtects + jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents @@ -5152,7 +5152,7 @@ BattleScript_EffectYawn:: jumpifability BS_TARGET, ABILITY_INSOMNIA, BattleScript_PrintBankAbilityMadeIneffective jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_PrintBankAbilityMadeIneffective jumpifflowerveil BattleScript_FlowerVeilProtects - jumpifleafguard BattleScript_LeafGuardProtects + jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifsubstituteblocks BattleScript_ButItFailed jumpifsafeguard BattleScript_SafeguardProtected diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 74c2a3f59..18ae63179 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -195,6 +195,7 @@ #define VARIOUS_APPLY_PLASMA_FISTS 122 #define VARIOUS_JUMP_IF_SPECIES 123 #define VARIOUS_JUMP_IF_WEATHER_AFFECTED 124 +#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 125 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index dbcd3ad95..44ae0e33e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8990,6 +8990,12 @@ static void Cmd_various(void) else gBattlescriptCurrInstr += 9; return; + case VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED: + if (IsLeafGuardProtected(gActiveBattler)) + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 5); + else + gBattlescriptCurrInstr += 7; + return; } gBattlescriptCurrInstr += 3; @@ -11514,9 +11520,9 @@ static void Cmd_recoverbasedonsunlight(void) } else { - if (!(gBattleWeather & WEATHER_ANY) || !WEATHER_HAS_EFFECT) + if (!(gBattleWeather & WEATHER_ANY) || !WEATHER_HAS_EFFECT || GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_UTILITY_UMBRELLA) gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; - else if (IsBattlerWeatherAffected(gBattlerAttacker, WEATHER_SUN_ANY)) + else if (gBattleWeather & WEATHER_SUN_ANY) gBattleMoveDamage = 20 * gBattleMons[gBattlerAttacker].maxHP / 30; else // not sunny weather gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4;