Frostbite hurts at the end of the turn and halves SpA

This commit is contained in:
Bassoonian 2023-04-22 18:47:36 +02:00
parent 623e7c5f25
commit f50bfb3770
6 changed files with 37 additions and 2 deletions

View File

@ -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

View File

@ -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[];

View File

@ -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,

View File

@ -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);

View File

@ -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[] =

View File

@ -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))
{