From cbc0d8a57d9913c3a39df8f96df12e63890a7773 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 18 Apr 2020 19:09:17 +0200 Subject: [PATCH] Healer --- data/battle_scripts_1.s | 8 ++++++++ include/battle_scripts.h | 1 + include/constants/battle_string_ids.h | 3 ++- src/battle_message.c | 2 ++ src/battle_util.c | 10 ++++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 18ae8a98a7..a2cd1e9a8c 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6428,6 +6428,14 @@ BattleScript_SolarPowerActivates:: waitmessage 0x40 tryfaintmon BS_ATTACKER, FALSE, NULL end3 + +BattleScript_HealerActivates:: + call BattleScript_AbilityPopUp + curestatus BS_SCRIPTING + updatestatusicon BS_SCRIPTING + printstring STRINGID_HEALERCURE + waitmessage 0x40 + end3 BattleScript_SandstreamActivates:: pause 0x20 diff --git a/include/battle_scripts.h b/include/battle_scripts.h index fd7a7b4017..70f12b4964 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -333,5 +333,6 @@ extern const u8 BattleScript_StanceChangeActivates[]; extern const u8 BattleScript_DisguiseBustedActivates[]; extern const u8 BattleScript_AnticipationActivates[]; extern const u8 BattleScript_SlowStartEnds[]; +extern const u8 BattleScript_HealerActivates[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 550f567e88..74c121ab12 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -542,7 +542,8 @@ #define STRINGID_ILLUSIONWOREOFF 538 #define STRINGID_ATTACKERCUREDTARGETSTATUS 539 #define STRINGID_ATTACKERLOSTFIRETYPE 540 +#define STRINGID_HEALERCURE 541 -#define BATTLESTRINGS_COUNT 541 +#define BATTLESTRINGS_COUNT 542 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_message.c b/src/battle_message.c index 9508f44216..9a5ebcb1d4 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -663,9 +663,11 @@ static const u8 sText_BugBite[] = _("{B_ATK_NAME_WITH_PREFIX} stole and ate\n{B_ static const u8 sText_IllusionWoreOff[] = _("{B_DEF_NAME_WITH_PREFIX}'s Illusion wore off!"); static const u8 sText_AttackerCuredTargetStatus[] = _("{B_ATK_NAME_WITH_PREFIX} cured\n{B_DEF_NAME_WITH_PREFIX}'s problem!"); static const u8 sText_AttackerLostFireType[] = _("{B_ATK_NAME_WITH_PREFIX} burned itself out!"); +static const u8 sText_HealerCure[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ABILITY}\ncured {B_SCR_ACTIVE_NAME_WITH_PREFIX}'s problem!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_HEALERCURE - 12] = sText_HealerCure, [STRINGID_ATTACKERLOSTFIRETYPE - 12] = sText_AttackerLostFireType, [STRINGID_ATTACKERCUREDTARGETSTATUS - 12] = sText_AttackerCuredTargetStatus, [STRINGID_ILLUSIONWOREOFF - 12] = sText_IllusionWoreOff, diff --git a/src/battle_util.c b/src/battle_util.c index 630f302eed..79ef8eaa79 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3146,6 +3146,16 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA effect++; } break; + case ABILITY_HEALER: + gBattleScripting.battler = BATTLE_PARTNER(battler); + if (IsBattlerAlive(gBattleScripting.battler) + && gBattleMons[gBattleScripting.battler].status1 & STATUS1_ANY + && (Random() % 100) < 30) + { + BattleScriptPushCursorAndCallback(BattleScript_HealerActivates); + effect++; + } + break; } } break;