diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 0be8934127..316a179ab7 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8121,6 +8121,11 @@ BattleScript_BurnTurnDmg:: waitmessage B_WAIT_TIME_LONG goto BattleScript_DoStatusTurnDmg +BattleScript_FrostbiteTurnDmg:: + printstring STRINGID_PKMNHURTBYFROSTBITE + waitmessage B_WAIT_TIME_LONG + goto BattleScript_DoStatusTurnDmg + BattleScript_MoveUsedIsFrozen:: printstring STRINGID_PKMNISFROZEN waitmessage B_WAIT_TIME_LONG diff --git a/include/battle_scripts.h b/include/battle_scripts.h index c78fcafe48..1fb7d8cc6a 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -108,6 +108,7 @@ extern const u8 BattleScript_MoveUsedWokeUp[]; extern const u8 BattleScript_MonWokeUpInUproar[]; extern const u8 BattleScript_PoisonTurnDmg[]; extern const u8 BattleScript_BurnTurnDmg[]; +extern const u8 BattleScript_FrostbiteTurnDmg[]; extern const u8 BattleScript_MoveUsedIsFrozen[]; extern const u8 BattleScript_MoveUsedUnfroze[]; extern const u8 BattleScript_DefrostedViaFireMove[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index e552077534..10e2a6fe56 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -651,8 +651,9 @@ #define STRINGID_ITEMRESTOREDSPECIESHEALTH 649 #define STRINGID_ITEMCUREDSPECIESSTATUS 650 #define STRINGID_ITEMRESTOREDSPECIESPP 651 +#define STRINGID_PKMNHURTBYFROSTBITE 652 -#define BATTLESTRINGS_COUNT 652 +#define BATTLESTRINGS_COUNT 653 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index bc541f0a01..6404bb7dea 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -398,7 +398,7 @@ void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive = 1; if (!isStatus2) { - if (status == STATUS1_FREEZE) + if (status == STATUS1_FREEZE || status == STATUS1_FROSTBITE) LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_FRZ); else if (status == STATUS1_POISON || status & STATUS1_TOXIC_POISON) LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_PSN); diff --git a/src/battle_message.c b/src/battle_message.c index 7df30cb296..b3be9afd1c 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -103,6 +103,7 @@ static const u8 sText_PkmnEnergyDrained[] = _("{B_DEF_NAME_WITH_PREFIX} had its\ static const u8 sText_PkmnWasBurned[] = _("{B_EFF_NAME_WITH_PREFIX} was burned!"); static const u8 sText_PkmnBurnedBy[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nburned {B_EFF_NAME_WITH_PREFIX}!"); static const u8 sText_PkmnHurtByBurn[] = _("{B_ATK_NAME_WITH_PREFIX} is hurt\nby its burn!"); +static const u8 sText_PkmnHurtByFrostbite[] = _("{B_ATK_NAME_WITH_PREFIX} is hurt\nby its frostbite!"); static const u8 sText_PkmnAlreadyHasBurn[] = _("{B_DEF_NAME_WITH_PREFIX} already\nhas a burn."); static const u8 sText_PkmnWasFrozen[] = _("{B_EFF_NAME_WITH_PREFIX} was\nfrozen solid!"); static const u8 sText_PkmnFrozenBy[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nfroze {B_EFF_NAME_WITH_PREFIX} solid!"); @@ -1428,6 +1429,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_TARGETTOOHEAVY - BATTLESTRINGS_TABLE_START] = sText_TargetTooHeavy, [STRINGID_ATTACKERLOSTELECTRICTYPE - BATTLESTRINGS_TABLE_START] = sText_AttackerLostElectricType, [STRINGID_PKMNSABILITYPREVENTSABILITY - BATTLESTRINGS_TABLE_START] = sText_PkmnsAbilityPreventsAbility, + [STRINGID_PKMNHURTBYFROSTBITE - BATTLESTRINGS_TABLE_START] = sText_PkmnHurtByFrostbite, }; const u16 gTrainerUsedItemStringIds[] = diff --git a/src/battle_util.c b/src/battle_util.c index ac274bf0f8..993a0d5ab3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2523,6 +2523,7 @@ enum ENDTURN_POISON, ENDTURN_BAD_POISON, ENDTURN_BURN, + ENDTURN_FROSTBITE, ENDTURN_NIGHTMARES, ENDTURN_CURSE, ENDTURN_WRAP, @@ -2736,6 +2737,23 @@ u8 DoBattlerEndTurnEffects(void) } gBattleStruct->turnEffectsTracker++; break; + case ENDTURN_FROSTBITE: // burn + if ((gBattleMons[gActiveBattler].status1 & STATUS1_FROSTBITE) + && gBattleMons[gActiveBattler].hp != 0) + { + MAGIC_GUARD_CHECK; + #if B_BURN_DAMAGE >= GEN_7 + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + #else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + #endif + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + BattleScriptExecute(BattleScript_FrostbiteTurnDmg); + effect++; + } + gBattleStruct->turnEffectsTracker++; + break; case ENDTURN_NIGHTMARES: // spooky nightmares if ((gBattleMons[gActiveBattler].status2 & STATUS2_NIGHTMARE) && gBattleMons[gActiveBattler].hp != 0) @@ -9508,6 +9526,14 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move && abilityAtk != ABILITY_GUTS) dmg = ApplyModifier(UQ_4_12(0.5), dmg); + // check frostbite + if (gBattleMons[battlerAtk].status1 & STATUS1_FROSTBITE && !IS_MOVE_PHYSICAL(move) + #if B_BURN_FACADE_DMG >= GEN_6 + && gBattleMoves[move].effect != EFFECT_FACADE + #endif + && abilityAtk != ABILITY_GUTS) + dmg = ApplyModifier(UQ_4_12(0.5), dmg); + // check sunny/rain weather if (IsBattlerWeatherAffected(battlerAtk, B_WEATHER_RAIN)) {