From 7178ea6b460a74de288b0fa9ae343bf4eef5a7cc Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 18 Apr 2020 18:34:18 +0200 Subject: [PATCH] Shore Up --- data/battle_ai_scripts.s | 34 +++++++++++++------------ data/battle_scripts_1.s | 2 ++ include/constants/battle_move_effects.h | 1 + src/battle_script_commands.c | 23 ++++++++++++----- src/data/battle_moves.h | 2 +- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index 6dc1821ffb..ebdea7bc15 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -1066,6 +1066,7 @@ AI_CheckViability: if_effect EFFECT_MORNING_SUN, AI_CV_HealWeather if_effect EFFECT_SYNTHESIS, AI_CV_HealWeather if_effect EFFECT_MOONLIGHT, AI_CV_HealWeather + if_effect EFFECT_SHORE_UP, AI_CV_Heal if_effect EFFECT_RAIN_DANCE, AI_CV_RainDance if_effect EFFECT_SUNNY_DAY, AI_CV_SunnyDay if_effect EFFECT_BELLY_DRUM, AI_CV_BellyDrum @@ -3721,7 +3722,7 @@ AI_HPAware: AI_HPAware_UserHasHighHP: get_considered_move_effect - if_in_bytes AI_HPAware_DiscouragedEffectsWhenHighHP, AI_HPAware_TryToDiscourage + if_in_hwords AI_HPAware_DiscouragedEffectsWhenHighHP, AI_HPAware_TryToDiscourage goto AI_HPAware_ConsiderTarget AI_HPAware_UserHasMediumHP: @@ -3758,21 +3759,22 @@ AI_HPAware_End: end AI_HPAware_DiscouragedEffectsWhenHighHP: @ 82DE21F - .byte EFFECT_EXPLOSION - .byte EFFECT_RESTORE_HP - .byte EFFECT_REST - .byte EFFECT_DESTINY_BOND - .byte EFFECT_FLAIL - .byte EFFECT_ENDURE - .byte EFFECT_MORNING_SUN - .byte EFFECT_SYNTHESIS - .byte EFFECT_MOONLIGHT - .byte EFFECT_SOFTBOILED - .byte EFFECT_ROOST - .byte EFFECT_MEMENTO - .byte EFFECT_GRUDGE - .byte EFFECT_OVERHEAT - .byte -1 + .2byte EFFECT_EXPLOSION + .2byte EFFECT_RESTORE_HP + .2byte EFFECT_REST + .2byte EFFECT_DESTINY_BOND + .2byte EFFECT_FLAIL + .2byte EFFECT_ENDURE + .2byte EFFECT_MORNING_SUN + .2byte EFFECT_SYNTHESIS + .2byte EFFECT_MOONLIGHT + .2byte EFFECT_SHORE_UP + .2byte EFFECT_SOFTBOILED + .2byte EFFECT_ROOST + .2byte EFFECT_MEMENTO + .2byte EFFECT_GRUDGE + .2byte EFFECT_OVERHEAT + .2byte -1 AI_HPAware_DiscouragedEffectsWhenMediumHP: @ 82DE22D .byte EFFECT_EXPLOSION diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 9d17b41ae1..18ae8a98a7 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -359,6 +359,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectMindBlown .4byte BattleScript_EffectPurify .4byte BattleScript_EffectBurnUp + .4byte BattleScript_EffectShoreUp BattleScript_EffectBurnUp: attackcanceler @@ -3734,6 +3735,7 @@ BattleScript_EffectSonicboom:: BattleScript_EffectMorningSun:: BattleScript_EffectSynthesis:: BattleScript_EffectMoonlight:: +BattleScript_EffectShoreUp:: attackcanceler attackstring ppreduce diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 185e902f88..5b3c3bd64c 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -347,5 +347,6 @@ #define EFFECT_MIND_BLOWN 341 #define EFFECT_PURIFY 342 #define EFFECT_BURN_UP 343 +#define EFFECT_SHORE_UP 344 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 09567dd161..36793f1655 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10201,15 +10201,24 @@ static void Cmd_setdefensecurlbit(void) static void Cmd_recoverbasedonsunlight(void) { gBattlerTarget = gBattlerAttacker; - if (gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP) { - if (gBattleWeather == 0 || !WEATHER_HAS_EFFECT) - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; - else if (gBattleWeather & WEATHER_SUN_ANY) - gBattleMoveDamage = 20 * gBattleMons[gBattlerAttacker].maxHP / 30; - else // not sunny weather - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + if (gCurrentMove == MOVE_SHORE_UP) + { + if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SANDSTORM_ANY) + gBattleMoveDamage = 20 * gBattleMons[gBattlerAttacker].maxHP / 30; + else + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; + } + else + { + if (!(gBattleWeather & WEATHER_ANY) || !WEATHER_HAS_EFFECT) + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; + else if (gBattleWeather & WEATHER_SUN_ANY) + gBattleMoveDamage = 20 * gBattleMons[gBattlerAttacker].maxHP / 30; + else // not sunny weather + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + } if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index fd7290dd19..462cabeab0 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -8731,7 +8731,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_SHORE_UP] = { - .effect = EFFECT_PLACEHOLDER, + .effect = EFFECT_SHORE_UP, .power = 0, .type = TYPE_GROUND, .accuracy = 0,