From f13c39d784d15186374b7e81cf29e296bb41ede3 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sun, 23 Apr 2023 21:20:23 +0200 Subject: [PATCH] Thawing out for frostbite --- data/battle_scripts_1.s | 12 ++++++++++++ include/battle_scripts.h | 2 ++ include/constants/battle_string_ids.h | 9 ++++++++- src/battle_message.c | 12 ++++++++++++ src/battle_script_commands.c | 19 +++++++++++++++++++ src/battle_util.c | 11 +++++++++++ 6 files changed, 64 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a169b12752..f65d6e18a6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8151,12 +8151,24 @@ BattleScript_MoveUsedUnfroze:: updatestatusicon BS_ATTACKER return +BattleScript_MoveUsedUnfrostbite:: + printfromtable gFrostbiteHealedStringIds + waitmessage B_WAIT_TIME_LONG + updatestatusicon BS_ATTACKER + return + BattleScript_DefrostedViaFireMove:: printstring STRINGID_PKMNWASDEFROSTED waitmessage B_WAIT_TIME_LONG updatestatusicon BS_TARGET return +BattleScript_FrostbiteHealedViaFireMove:: + printstring STRINGID_PKMNFROSTBITEHEALED + waitmessage B_WAIT_TIME_LONG + updatestatusicon BS_TARGET + return + BattleScript_MoveUsedIsParalyzed:: printstring STRINGID_PKMNISPARALYZED waitmessage B_WAIT_TIME_LONG diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 6fcdcac258..d10d5ba07f 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -111,7 +111,9 @@ extern const u8 BattleScript_BurnTurnDmg[]; extern const u8 BattleScript_FrostbiteTurnDmg[]; extern const u8 BattleScript_MoveUsedIsFrozen[]; extern const u8 BattleScript_MoveUsedUnfroze[]; +extern const u8 BattleScript_MoveUsedUnfrostbite[]; extern const u8 BattleScript_DefrostedViaFireMove[]; +extern const u8 BattleScript_FrostbiteHealedViaFireMove[]; extern const u8 BattleScript_MoveUsedIsParalyzed[]; extern const u8 BattleScript_MoveUsedFlinched[]; extern const u8 BattleScript_PrintUproarOverTurns[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 4e8cd9ab83..294bd1f7cb 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -655,8 +655,11 @@ #define STRINGID_PKMNGOTFROSTBITE 653 #define STRINGID_PKMNSITEMHEALEDFROSTBITE 654 #define STRINGID_ATTACKERHEALEDITSFROSTBITE 655 +#define STRINGID_PKMNFROSTBITEHEALED 656 +#define STRINGID_PKMNFROSTBITEHEALED2 657 +#define STRINGID_PKMNFROSTBITEHEALEDBY 658 -#define BATTLESTRINGS_COUNT 656 +#define BATTLESTRINGS_COUNT 659 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, @@ -864,6 +867,10 @@ #define B_MSG_DEFROSTED 0 #define B_MSG_DEFROSTED_BY_MOVE 1 +// gFrostbiteHealedStringIds +#define B_MSG_FROSTBITE_HEALED 0 +#define B_MSG_FROSTBITE_HEALED_BY_MOVE 1 + // gBattlePalaceFlavorTextTable #define B_MSG_GLINT_IN_EYE 0 #define B_MSG_GETTING_IN_POS 1 diff --git a/src/battle_message.c b/src/battle_message.c index 39d862057c..48c4f222ab 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -112,6 +112,9 @@ static const u8 sText_PkmnIsFrozen[] = _("{B_ATK_NAME_WITH_PREFIX} is\nfrozen so static const u8 sText_PkmnWasDefrosted[] = _("{B_DEF_NAME_WITH_PREFIX} was\ndefrosted!"); static const u8 sText_PkmnWasDefrosted2[] = _("{B_ATK_NAME_WITH_PREFIX} was\ndefrosted!"); static const u8 sText_PkmnWasDefrostedBy[] = _("{B_ATK_NAME_WITH_PREFIX} was\ndefrosted by {B_CURRENT_MOVE}!"); +static const u8 sText_PkmnFrostbiteHealed[] = _("{B_DEF_NAME_WITH_PREFIX}'s\nfrostbite was healed!"); +static const u8 sText_PkmnFrostbiteHealed2[] = _("{B_ATK_NAME_WITH_PREFIX}'s\nfrostbite was healed!"); +static const u8 sText_PkmnFrostbiteHealedBy[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE}\nhealed its frostbite!"); static const u8 sText_PkmnWasParalyzed[] = _("{B_EFF_NAME_WITH_PREFIX} is paralyzed!\nIt may be unable to move!"); static const u8 sText_PkmnWasParalyzedBy[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nparalyzed {B_EFF_NAME_WITH_PREFIX}!\lIt may be unable to move!"); static const u8 sText_PkmnIsParalyzed[] = _("{B_ATK_NAME_WITH_PREFIX} is paralyzed!\nIt can't move!"); @@ -1436,6 +1439,9 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_PKMNGOTFROSTBITE - BATTLESTRINGS_TABLE_START] = sText_PkmnGotFrostbite, [STRINGID_PKMNSITEMHEALEDFROSTBITE - BATTLESTRINGS_TABLE_START] = sText_PkmnsItemHealedFrostbite, [STRINGID_ATTACKERHEALEDITSFROSTBITE - BATTLESTRINGS_TABLE_START] = sText_AttackerHealedItsFrostbite, + [STRINGID_PKMNFROSTBITEHEALED - BATTLESTRINGS_TABLE_START] = sText_PkmnFrostbiteHealed, + [STRINGID_PKMNFROSTBITEHEALED2 - BATTLESTRINGS_TABLE_START] = sText_PkmnFrostbiteHealed2, + [STRINGID_PKMNFROSTBITEHEALEDBY - BATTLESTRINGS_TABLE_START] = sText_PkmnFrostbiteHealedBy, }; const u16 gTrainerUsedItemStringIds[] = @@ -1742,6 +1748,12 @@ const u16 gGotFrostbiteStringIds[] = [B_MSG_STATUSED] = STRINGID_PKMNGOTFROSTBITE }; +const u16 gFrostbiteHealedStringIds[] = +{ + [B_MSG_FROSTBITE_HEALED] = STRINGID_PKMNFROSTBITEHEALED2, + [B_MSG_FROSTBITE_HEALED_BY_MOVE] = STRINGID_PKMNFROSTBITEHEALEDBY +}; + const u16 gGotFrozenStringIds[] = { [B_MSG_STATUSED] = STRINGID_PKMNWASFROZEN, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ecf9023936..81d1a94e81 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5565,6 +5565,25 @@ static void Cmd_moveend(void) gBattlescriptCurrInstr = BattleScript_DefrostedViaFireMove; effect = TRUE; } + if (gBattleMons[gBattlerTarget].status1 & STATUS1_FROSTBITE + && gBattleMons[gBattlerTarget].hp != 0 + && gBattlerAttacker != gBattlerTarget + && gSpecialStatuses[gBattlerTarget].specialDmg + && (moveType == TYPE_FIRE + #if B_BURN_HIT_THAW >= GEN_6 + || gBattleMoves[gCurrentMove].effect == EFFECT_BURN_HIT + #endif + ) + && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) + { + gBattleMons[gBattlerTarget].status1 &= ~STATUS1_FROSTBITE; + gActiveBattler = gBattlerTarget; + BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + MarkBattlerForControllerExec(gActiveBattler); + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_FrostbiteHealedViaFireMove; + effect = TRUE; + } gBattleScripting.moveendState++; break; case MOVEEND_RECOIL: diff --git a/src/battle_util.c b/src/battle_util.c index 456936fadb..97043f7dfd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3644,6 +3644,17 @@ u8 AtkCanceller_UnableToUseMove(void) } effect = 2; } + if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FROSTBITE) + { + if (!(gBattleMoves[gCurrentMove].effect == EFFECT_BURN_UP && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE))) + { + gBattleMons[gBattlerAttacker].status1 &= ~STATUS1_FROSTBITE; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_MoveUsedUnfrostbite; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FROSTBITE_HEALED_BY_MOVE; + } + effect = 2; + } gBattleStruct->atkCancellerTracker++; break; case CANCELLER_POWDER_MOVE: