Add config to Frostbite & allow it to be inflicted

This commit is contained in:
Bassoonian 2023-04-22 23:14:49 +02:00
parent 9c9a1fb831
commit a561c6da6a
11 changed files with 161 additions and 89 deletions

View File

@ -286,7 +286,11 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHealPulse @ EFFECT_HEAL_PULSE
.4byte BattleScript_EffectQuash @ EFFECT_QUASH
.4byte BattleScript_EffectIonDeluge @ EFFECT_ION_DELUGE
#if B_USE_FROSTBITE == TRUE
.4byte BattleScript_EffectFrostbiteHit @ EFFECT_FREEZE_DRY
#else
.4byte BattleScript_EffectFreezeHit @ EFFECT_FREEZE_DRY
#endif
.4byte BattleScript_EffectTopsyTurvy @ EFFECT_TOPSY_TURVY
.4byte BattleScript_EffectMistyTerrain @ EFFECT_MISTY_TERRAIN
.4byte BattleScript_EffectGrassyTerrain @ EFFECT_GRASSY_TERRAIN
@ -424,6 +428,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectDireClaw @ EFFECT_DIRE_CLAW
.4byte BattleScript_EffectBarbBarrage @ EFFECT_BARB_BARRAGE
.4byte BattleScript_EffectRevivalBlessing @ EFFECT_REVIVAL_BLESSING
.4byte BattleScript_EffectFrostbiteHit @ EFFECT_FROSTBITE_HIT
BattleScript_EffectRevivalBlessing::
attackcanceler
@ -3464,6 +3469,10 @@ BattleScript_EffectBurnHit::
setmoveeffect MOVE_EFFECT_BURN
goto BattleScript_EffectHit
BattleScript_EffectFrostbiteHit::
setmoveeffect MOVE_EFFECT_FROSTBITE
goto BattleScript_EffectHit
BattleScript_EffectSleepHit::
setmoveeffect MOVE_EFFECT_SLEEP
goto BattleScript_EffectHit
@ -8365,6 +8374,12 @@ BattleScript_MoveEffectBurn::
waitmessage B_WAIT_TIME_LONG
goto BattleScript_UpdateEffectStatusIconRet
BattleScript_MoveEffectFrostbite::
statusanimation BS_EFFECT_BATTLER
printfromtable gGotFrostbiteStringIds
waitmessage B_WAIT_TIME_LONG
goto BattleScript_UpdateEffectStatusIconRet
BattleScript_MoveEffectFreeze::
statusanimation BS_EFFECT_BATTLER
printfromtable gGotFrozenStringIds

View File

@ -132,6 +132,7 @@ extern const u8 BattleScript_MoveEffectSleep[];
extern const u8 BattleScript_YawnMakesAsleep[];
extern const u8 BattleScript_MoveEffectPoison[];
extern const u8 BattleScript_MoveEffectBurn[];
extern const u8 BattleScript_MoveEffectFrostbite[];
extern const u8 BattleScript_MoveEffectFreeze[];
extern const u8 BattleScript_MoveEffectParalysis[];
extern const u8 BattleScript_MoveEffectUproar[];

View File

@ -190,6 +190,7 @@
#define B_AFFECTION_MECHANICS FALSE // In Gen6+, there's a stat called affection that can trigger different effects in battle. From LGPE onwards, those effects use friendship instead.
#define B_TRAINER_CLASS_POKE_BALLS GEN_LATEST // In Gen7+, trainers will use certain types of Poké Balls depending on their trainer class.
#define B_OBEDIENCE_MECHANICS GEN_LATEST // In PLA+ (here Gen8+), obedience restrictions also apply to non-outsider Pokémon, albeit based on their level met rather than actual level
#define B_USE_FROSTBITE FALSE // In PLA, Frostbite replaces Freeze. Enabling this flag does the same here. Moves can still be cherry-picked to either Freeze or Frostbite. Freeze-Dry, Secret Power & Tri Attack depend on this config.
// Animation Settings
#define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle.

View File

@ -306,79 +306,80 @@
#define MOVE_EFFECT_FREEZE 4
#define MOVE_EFFECT_PARALYSIS 5
#define MOVE_EFFECT_TOXIC 6
#define PRIMARY_STATUS_MOVE_EFFECT MOVE_EFFECT_TOXIC // All above move effects apply primary status
#define MOVE_EFFECT_CONFUSION 7
#define MOVE_EFFECT_FLINCH 8
#define MOVE_EFFECT_TRI_ATTACK 9
#define MOVE_EFFECT_UPROAR 10
#define MOVE_EFFECT_PAYDAY 11
#define MOVE_EFFECT_CHARGING 12
#define MOVE_EFFECT_WRAP 13
#define MOVE_EFFECT_BURN_UP 14 // MOVE_EFFECT_BURN_UP replaces unused MOVE_EFFECT_RECOIL_25 so that stat change animations don't break
#define MOVE_EFFECT_ATK_PLUS_1 15
#define MOVE_EFFECT_DEF_PLUS_1 16
#define MOVE_EFFECT_SPD_PLUS_1 17
#define MOVE_EFFECT_SP_ATK_PLUS_1 18
#define MOVE_EFFECT_SP_DEF_PLUS_1 19
#define MOVE_EFFECT_ACC_PLUS_1 20
#define MOVE_EFFECT_EVS_PLUS_1 21
#define MOVE_EFFECT_ATK_MINUS_1 22
#define MOVE_EFFECT_DEF_MINUS_1 23
#define MOVE_EFFECT_SPD_MINUS_1 24
#define MOVE_EFFECT_SP_ATK_MINUS_1 25
#define MOVE_EFFECT_SP_DEF_MINUS_1 26
#define MOVE_EFFECT_ACC_MINUS_1 27
#define MOVE_EFFECT_EVS_MINUS_1 28
#define MOVE_EFFECT_RECHARGE 29
#define MOVE_EFFECT_RAGE 30
#define MOVE_EFFECT_STEAL_ITEM 31
#define MOVE_EFFECT_PREVENT_ESCAPE 32
#define MOVE_EFFECT_NIGHTMARE 33
#define MOVE_EFFECT_ALL_STATS_UP 34
#define MOVE_EFFECT_RAPIDSPIN 35
#define MOVE_EFFECT_REMOVE_STATUS 36
#define MOVE_EFFECT_ATK_DEF_DOWN 37
#define MOVE_EFFECT_SCALE_SHOT 38 // MOVE_EFFECT_SCALE_SHOT replaces unused MOVE_EFFECT_RECOIL_33 so that stat change animations don't break
#define MOVE_EFFECT_ATK_PLUS_2 39
#define MOVE_EFFECT_DEF_PLUS_2 40
#define MOVE_EFFECT_SPD_PLUS_2 41
#define MOVE_EFFECT_SP_ATK_PLUS_2 42
#define MOVE_EFFECT_SP_DEF_PLUS_2 43
#define MOVE_EFFECT_ACC_PLUS_2 44
#define MOVE_EFFECT_EVS_PLUS_2 45
#define MOVE_EFFECT_ATK_MINUS_2 46
#define MOVE_EFFECT_DEF_MINUS_2 47
#define MOVE_EFFECT_SPD_MINUS_2 48
#define MOVE_EFFECT_SP_ATK_MINUS_2 49
#define MOVE_EFFECT_SP_DEF_MINUS_2 50
#define MOVE_EFFECT_ACC_MINUS_2 51
#define MOVE_EFFECT_EVS_MINUS_2 52
#define MOVE_EFFECT_THRASH 53
#define MOVE_EFFECT_KNOCK_OFF 54
#define MOVE_EFFECT_DEF_SPDEF_DOWN 55
#define MOVE_EFFECT_CLEAR_SMOG 56
#define MOVE_EFFECT_SP_ATK_TWO_DOWN 57
#define MOVE_EFFECT_SMACK_DOWN 58
#define MOVE_EFFECT_FLAME_BURST 59
#define MOVE_EFFECT_FEINT 60
#define MOVE_EFFECT_SPECTRAL_THIEF 61
#define MOVE_EFFECT_V_CREATE 62
#define MOVE_EFFECT_HAPPY_HOUR 63
#define MOVE_EFFECT_CORE_ENFORCER 64
#define MOVE_EFFECT_THROAT_CHOP 65
#define MOVE_EFFECT_INCINERATE 66
#define MOVE_EFFECT_BUG_BITE 67
#define MOVE_EFFECT_RECOIL_HP_25 68
#define MOVE_EFFECT_RELIC_SONG 69
#define MOVE_EFFECT_TRAP_BOTH 70
#define MOVE_EFFECT_DOUBLE_SHOCK 71
#define MOVE_EFFECT_ROUND 72
#define MOVE_EFFECT_STOCKPILE_WORE_OFF 73
#define MOVE_EFFECT_DIRE_CLAW 74
#define MOVE_EFFECT_STEALTH_ROCK 75
#define MOVE_EFFECT_SPIKES 76
#define MOVE_EFFECT_FROSTBITE 7
#define PRIMARY_STATUS_MOVE_EFFECT MOVE_EFFECT_FROSTBITE // All above move effects apply primary status
#define MOVE_EFFECT_CONFUSION 8
#define MOVE_EFFECT_FLINCH 9
#define MOVE_EFFECT_TRI_ATTACK 10
#define MOVE_EFFECT_UPROAR 11
#define MOVE_EFFECT_PAYDAY 12
#define MOVE_EFFECT_CHARGING 13
#define MOVE_EFFECT_WRAP 14
#define MOVE_EFFECT_BURN_UP 15 // MOVE_EFFECT_BURN_UP replaces unused MOVE_EFFECT_RECOIL_25 so that stat change animations don't break
#define MOVE_EFFECT_ATK_PLUS_1 16
#define MOVE_EFFECT_DEF_PLUS_1 17
#define MOVE_EFFECT_SPD_PLUS_1 18
#define MOVE_EFFECT_SP_ATK_PLUS_1 19
#define MOVE_EFFECT_SP_DEF_PLUS_1 20
#define MOVE_EFFECT_ACC_PLUS_1 21
#define MOVE_EFFECT_EVS_PLUS_1 22
#define MOVE_EFFECT_ATK_MINUS_1 23
#define MOVE_EFFECT_DEF_MINUS_1 24
#define MOVE_EFFECT_SPD_MINUS_1 25
#define MOVE_EFFECT_SP_ATK_MINUS_1 26
#define MOVE_EFFECT_SP_DEF_MINUS_1 27
#define MOVE_EFFECT_ACC_MINUS_1 28
#define MOVE_EFFECT_EVS_MINUS_1 29
#define MOVE_EFFECT_RECHARGE 30
#define MOVE_EFFECT_RAGE 31
#define MOVE_EFFECT_STEAL_ITEM 32
#define MOVE_EFFECT_PREVENT_ESCAPE 33
#define MOVE_EFFECT_NIGHTMARE 34
#define MOVE_EFFECT_ALL_STATS_UP 35
#define MOVE_EFFECT_RAPIDSPIN 36
#define MOVE_EFFECT_REMOVE_STATUS 37
#define MOVE_EFFECT_ATK_DEF_DOWN 38
#define MOVE_EFFECT_SCALE_SHOT 39 // MOVE_EFFECT_SCALE_SHOT replaces unused MOVE_EFFECT_RECOIL_33 so that stat change animations don't break
#define MOVE_EFFECT_ATK_PLUS_2 40
#define MOVE_EFFECT_DEF_PLUS_2 41
#define MOVE_EFFECT_SPD_PLUS_2 42
#define MOVE_EFFECT_SP_ATK_PLUS_2 43
#define MOVE_EFFECT_SP_DEF_PLUS_2 44
#define MOVE_EFFECT_ACC_PLUS_2 45
#define MOVE_EFFECT_EVS_PLUS_2 46
#define MOVE_EFFECT_ATK_MINUS_2 47
#define MOVE_EFFECT_DEF_MINUS_2 48
#define MOVE_EFFECT_SPD_MINUS_2 49
#define MOVE_EFFECT_SP_ATK_MINUS_2 50
#define MOVE_EFFECT_SP_DEF_MINUS_2 51
#define MOVE_EFFECT_ACC_MINUS_2 52
#define MOVE_EFFECT_EVS_MINUS_2 53
#define MOVE_EFFECT_THRASH 54
#define MOVE_EFFECT_KNOCK_OFF 55
#define MOVE_EFFECT_DEF_SPDEF_DOWN 56
#define MOVE_EFFECT_CLEAR_SMOG 57
#define MOVE_EFFECT_SP_ATK_TWO_DOWN 58
#define MOVE_EFFECT_SMACK_DOWN 59
#define MOVE_EFFECT_FLAME_BURST 60
#define MOVE_EFFECT_FEINT 61
#define MOVE_EFFECT_SPECTRAL_THIEF 62
#define MOVE_EFFECT_V_CREATE 63
#define MOVE_EFFECT_HAPPY_HOUR 64
#define MOVE_EFFECT_CORE_ENFORCER 65
#define MOVE_EFFECT_THROAT_CHOP 66
#define MOVE_EFFECT_INCINERATE 67
#define MOVE_EFFECT_BUG_BITE 68
#define MOVE_EFFECT_RECOIL_HP_25 69
#define MOVE_EFFECT_RELIC_SONG 70
#define MOVE_EFFECT_TRAP_BOTH 71
#define MOVE_EFFECT_DOUBLE_SHOCK 72
#define MOVE_EFFECT_ROUND 73
#define MOVE_EFFECT_STOCKPILE_WORE_OFF 74
#define MOVE_EFFECT_DIRE_CLAW 75
#define MOVE_EFFECT_STEALTH_ROCK 76
#define MOVE_EFFECT_SPIKES 77
#define NUM_MOVE_EFFECTS 77
#define NUM_MOVE_EFFECTS 78
#define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000

View File

@ -405,7 +405,8 @@
#define EFFECT_DIRE_CLAW 399
#define EFFECT_BARB_BARRAGE 400
#define EFFECT_REVIVAL_BLESSING 401
#define EFFECT_FROSTBITE_HIT 402
#define NUM_BATTLE_MOVE_EFFECTS 402
#define NUM_BATTLE_MOVE_EFFECTS 403
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -652,8 +652,9 @@
#define STRINGID_ITEMCUREDSPECIESSTATUS 650
#define STRINGID_ITEMRESTOREDSPECIESPP 651
#define STRINGID_PKMNHURTBYFROSTBITE 652
#define STRINGID_PKMNGOTFROSTBITE 653
#define BATTLESTRINGS_COUNT 653
#define BATTLESTRINGS_COUNT 654
// This is the string id that gBattleStringsTable starts with.
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,

View File

@ -346,7 +346,7 @@ struct BattleMove
s8 priority;
u32 flags;
u8 split;
u8 argument;
u16 argument;
u8 zMoveEffect;
};

View File

@ -101,6 +101,7 @@ static const u8 sText_PkmnAlreadyPoisoned[] = _("{B_DEF_NAME_WITH_PREFIX} is alr
static const u8 sText_PkmnBadlyPoisoned[] = _("{B_EFF_NAME_WITH_PREFIX} is badly\npoisoned!");
static const u8 sText_PkmnEnergyDrained[] = _("{B_DEF_NAME_WITH_PREFIX} had its\nenergy drained!");
static const u8 sText_PkmnWasBurned[] = _("{B_EFF_NAME_WITH_PREFIX} was burned!");
static const u8 sText_PkmnGotFrostbite[] = _("{B_EFF_NAME_WITH_PREFIX} got frostbite!");
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!");
@ -1430,6 +1431,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_ATTACKERLOSTELECTRICTYPE - BATTLESTRINGS_TABLE_START] = sText_AttackerLostElectricType,
[STRINGID_PKMNSABILITYPREVENTSABILITY - BATTLESTRINGS_TABLE_START] = sText_PkmnsAbilityPreventsAbility,
[STRINGID_PKMNHURTBYFROSTBITE - BATTLESTRINGS_TABLE_START] = sText_PkmnHurtByFrostbite,
[STRINGID_PKMNGOTFROSTBITE - BATTLESTRINGS_TABLE_START] = sText_PkmnGotFrostbite,
};
const u16 gTrainerUsedItemStringIds[] =
@ -1731,6 +1733,11 @@ const u16 gGotBurnedStringIds[] =
[B_MSG_STATUSED_BY_ABILITY] = STRINGID_PKMNBURNEDBY
};
const u16 gGotFrostbiteStringIds[] =
{
[B_MSG_STATUSED] = STRINGID_PKMNGOTFROSTBITE
};
const u16 gGotFrozenStringIds[] =
{
[B_MSG_STATUSED] = STRINGID_PKMNWASFROZEN,

View File

@ -61,6 +61,7 @@
#include "constants/trainers.h"
#include "battle_util.h"
#include "constants/pokemon.h"
#include "config/battle.h"
// Helper for accessing command arguments and advancing gBattlescriptCurrInstr.
//
@ -896,6 +897,7 @@ static const u32 sStatusFlagsForMoveEffects[NUM_MOVE_EFFECTS] =
[MOVE_EFFECT_FREEZE] = STATUS1_FREEZE,
[MOVE_EFFECT_PARALYSIS] = STATUS1_PARALYSIS,
[MOVE_EFFECT_TOXIC] = STATUS1_TOXIC_POISON,
[MOVE_EFFECT_FROSTBITE] = STATUS1_FROSTBITE,
[MOVE_EFFECT_CONFUSION] = STATUS2_CONFUSION,
[MOVE_EFFECT_FLINCH] = STATUS2_FLINCHED,
[MOVE_EFFECT_UPROAR] = STATUS2_UPROAR,
@ -919,6 +921,7 @@ static const u8 *const sMoveEffectBS_Ptrs[] =
[MOVE_EFFECT_UPROAR] = BattleScript_MoveEffectUproar,
[MOVE_EFFECT_PAYDAY] = BattleScript_MoveEffectPayDay,
[MOVE_EFFECT_WRAP] = BattleScript_MoveEffectWrap,
[MOVE_EFFECT_FROSTBITE] = BattleScript_MoveEffectFrostbite,
};
static const struct WindowTemplate sUnusedWinTemplate =
@ -3161,6 +3164,12 @@ void SetMoveEffect(bool32 primary, u32 certain)
gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE;
}
break;
case STATUS1_FROSTBITE:
if (!CanBeFrozen(gEffectBattler))
break;
statusChanged = TRUE;
break;
}
if (statusChanged == TRUE)
{
@ -3319,7 +3328,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
}
else
{
#if B_USE_FROSTBITE == TRUE
static const u8 sTriAttackEffects[] = { MOVE_EFFECT_BURN, MOVE_EFFECT_FROSTBITE, MOVE_EFFECT_PARALYSIS };
#else
static const u8 sTriAttackEffects[] = { MOVE_EFFECT_BURN, MOVE_EFFECT_FREEZE, MOVE_EFFECT_PARALYSIS };
#endif
gBattleScripting.moveEffect = RandomElement(RNG_TRI_ATTACK, sTriAttackEffects);
SetMoveEffect(FALSE, 0);
}
@ -9960,6 +9973,9 @@ static void Cmd_various(void)
case STATUS1_TOXIC_POISON:
gBattleScripting.moveEffect = MOVE_EFFECT_TOXIC;
break;
case STATUS1_FROSTBITE:
gBattleScripting.moveEffect = MOVE_EFFECT_FROSTBITE;
break;
default:
gBattleScripting.moveEffect = 0;
break;
@ -15079,7 +15095,11 @@ u16 GetSecretPowerMoveEffect(void)
break;
case BATTLE_TERRAIN_SNOW:
case BATTLE_TERRAIN_ICE:
#if B_USE_FROSTBITE == TRUE
moveEffect = MOVE_EFFECT_FROSTBITE;
#else
moveEffect = MOVE_EFFECT_FREEZE;
#endif
break;
case BATTLE_TERRAIN_VOLCANO:
moveEffect = MOVE_EFFECT_BURN;

View File

@ -481,6 +481,7 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] =
[EFFECT_DOUBLE_SHOCK] = 0, // TODO: Assign points
[EFFECT_SPECIAL_ATTACK_UP_HIT] = 1,
[EFFECT_VICTORY_DANCE] = 0, // TODO: Assign points
[EFFECT_FROSTBITE_HIT] = 1,
};
static const u16 sPoints_Effectiveness[] =

View File

@ -121,7 +121,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_ICE_PUNCH] =
{
#if B_USE_FROSTBITE == TRUE
.effect = EFFECT_FROSTBITE_HIT,
#else
.effect = EFFECT_FREEZE_HIT,
#endif
.power = 75,
.type = TYPE_ICE,
.accuracy = 100,
@ -982,7 +986,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
#else
.power = 95,
#endif
#if B_USE_FROSTBITE == TRUE
.effect = EFFECT_FROSTBITE_HIT,
#else
.effect = EFFECT_FREEZE_HIT,
#endif
.type = TYPE_ICE,
.accuracy = 100,
.pp = 10,
@ -1001,7 +1009,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
#else
.power = 120,
#endif
#if B_USE_FROSTBITE == TRUE
.effect = EFFECT_FROSTBITE_HIT,
#else
.effect = EFFECT_FREEZE_HIT,
#endif
.type = TYPE_ICE,
.accuracy = 70,
.pp = 5,
@ -3062,7 +3074,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_POWDER_SNOW] =
{
#if B_USE_FROSTBITE == TRUE
.effect = EFFECT_FROSTBITE_HIT,
#else
.effect = EFFECT_FREEZE_HIT,
#endif
.power = 40,
.type = TYPE_ICE,
.accuracy = 100,
@ -7177,6 +7193,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
#else
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST,
#endif
#if B_USE_FROSTBITE == TRUE
.argument = STATUS1_FROSTBITE,
#else
.argument = STATUS1_FREEZE,
#endif
.effect = EFFECT_FLINCH_STATUS,
.power = 65,
.type = TYPE_ICE,
@ -7186,7 +7207,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.split = SPLIT_PHYSICAL,
.argument = STATUS1_FREEZE,
.zMoveEffect = Z_EFFECT_NONE,
},
@ -12354,7 +12374,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_FREEZING_GLARE] =
{
.power = 90,
#if B_USE_FROSTBITE == TRUE
.effect = EFFECT_FROSTBITE_HIT,
#else
.effect = EFFECT_FREEZE_HIT,
#endif
.type = TYPE_PSYCHIC,
.accuracy = 100,
.pp = 10,