From 6f9096c61346a550cb38f296e03030bb05826cf7 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 31 Mar 2019 22:02:39 +0200 Subject: [PATCH] Add Sweet Veil --- data/battle_scripts_1.s | 13 +++++++++++++ include/battle_scripts.h | 1 + include/constants/battle_script_commands.h | 1 - include/constants/battle_string_ids.h | 1 + src/battle_message.c | 2 ++ src/battle_script_commands.c | 1 + 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 53f7d922a..844368d12 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1819,6 +1819,7 @@ BattleScript_EffectSleep:: jumpifstatus BS_TARGET, STATUS1_SLEEP, BattleScript_AlreadyAsleep jumpifcantmakeasleep BattleScript_CantMakeAsleep jumpifflowerveil BattleScript_FlowerVeilProtects + jumpifability BS_TARGET_SIDE, ABILITY_SWEET_VEIL, BattleScript_SweetVeilProtects jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected @@ -1839,6 +1840,18 @@ BattleScript_FlowerVeilProtects: call BattleScript_FlowerVeilProtectsRet orhalfword gMoveResultFlags, MOVE_RESULT_FAILED goto BattleScript_MoveEnd + +BattleScript_SweetVeilProtectsRet:: + pause 0x20 + call BattleScript_AbilityPopUp + printstring STRINGID_FLOWERVEILPROTECTED + waitmessage 0x40 + return + +BattleScript_SweetVeilProtects: + call BattleScript_SweetVeilProtectsRet + orhalfword gMoveResultFlags, MOVE_RESULT_FAILED + goto BattleScript_MoveEnd BattleScript_AlreadyAsleep:: setalreadystatusedmoveattempt BS_ATTACKER diff --git a/include/battle_scripts.h b/include/battle_scripts.h index efededa9d..1f66b160b 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -301,5 +301,6 @@ extern const u8 BattleScript_GrassyTerrainLoop[]; extern const u8 BattleScript_VCreateStatLoss[]; extern const u8 BattleScript_SpikyShieldEffect[]; extern const u8 BattleScript_FlowerVeilProtectsRet[]; +extern const u8 BattleScript_SweetVeilProtectsRet[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 5b2df78f8..681838f76 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -139,7 +139,6 @@ #define VARIOUS_GRAVITY_ON_AIRBORNE_MONS 76 #define VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS 77 #define VARIOUS_JUMP_IF_ROAR_FAILS 78 -#define VARIOUS_JUMP_IF_FLOWER_VEIL 79 // atk80, dmg manipulation #define ATK80_DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 007ea7987..fb5eb63ab 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -525,6 +525,7 @@ #define STRINGID_PSYCHICTERRAINPREVENTS 521 #define STRINGID_SAFETYGOOGLESPROTECTED 522 #define STRINGID_FLOWERVEILPROTECTED 523 +#define STRINGID_SWEETVEILPROTECTED 524 #define BATTLESTRINGS_COUNT 529 diff --git a/src/battle_message.c b/src/battle_message.c index e141b9edf..3dfe57624 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -650,9 +650,11 @@ static const u8 sText_ElectricTerrainPreventsSleep[] = _("{B_DEF_NAME_WITH_PREFI static const u8 sText_PsychicTerrainPreventsPriority[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith psychic terrain!"); static const u8 sText_SafetyGooglesProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is not affected\nthanks to its {B_LAST_ITEM}!"); static const u8 sText_FlowerVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of petals!"); +static const u8 sText_SweetVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of sweetness!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_SWEETVEILPROTECTED - 12] = sText_SweetVeilProtected, [STRINGID_FLOWERVEILPROTECTED - 12] = sText_FlowerVeilProtected, [STRINGID_SAFETYGOOGLESPROTECTED - 12] = sText_SafetyGooglesProtected, [STRINGID_SPECTRALTHIEFSTEAL - 12] = sText_SpectralThiefSteal, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 29968b92e..5060c2eae 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2050,6 +2050,7 @@ void SetMoveEffect(bool32 primary, u32 certain) break; if (GetBattlerAbility(gEffectBattler) == ABILITY_VITAL_SPIRIT || GetBattlerAbility(gEffectBattler) == ABILITY_INSOMNIA + || IsAbilityOnSide(gEffectBattler, ABILITY_SWEET_VEIL) || IsFlowerVeilProtected(gEffectBattler)) break;