diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 2474488afa..214adcf78f 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1439,6 +1439,10 @@ various \battler, VARIOUS_TRY_ACTIVATE_MOXIE .endm + .macro tryactivatesoulheart + various BS_ATTACKER, VARIOUS_TRY_ACTIVATE_SOULHEART + .endm + .macro tryactivatefellstinger battler:req various \battler, VARIOUS_TRY_ACTIVATE_FELL_STINGER .endm diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a2cd1e9a8c..d07a0b6177 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4783,6 +4783,7 @@ BattleScript_FaintAttacker:: dofaintanimation BS_ATTACKER printstring STRINGID_ATTACKERFAINTED cleareffectsonfaint BS_ATTACKER + tryactivatesoulheart trytrainerslidefirstdownmsg BS_ATTACKER return @@ -4793,6 +4794,7 @@ BattleScript_FaintTarget:: dofaintanimation BS_TARGET printstring STRINGID_TARGETFAINTED cleareffectsonfaint BS_TARGET + tryactivatesoulheart tryactivatemoxie BS_ATTACKER tryactivatefellstinger BS_ATTACKER trytrainerslidefirstdownmsg BS_TARGET @@ -6799,6 +6801,20 @@ BattleScript_TargetAbilityStatRaise:: printstring STRINGID_TARGETABILITYSTATRAISE waitmessage 0x40 return + +BattleScript_ScriptingAbilityStatRaise:: + copybyte gBattlerAbility, sBATTLER + call BattleScript_AbilityPopUp + copybyte sSAVED_DMG, gBattlerAttacker + copybyte gBattlerAttacker, sBATTLER + statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL + setgraphicalstatchangevalues + playanimation BS_SCRIPTING, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 + waitanimation + printstring STRINGID_ATTACKERABILITYSTATRAISE + waitmessage 0x40 + copybyte gBattlerAttacker, sSAVED_DMG + return BattleScript_WeakArmorActivates:: call BattleScript_AbilityPopUp diff --git a/include/battle.h b/include/battle.h index 45534126ec..b6449837f2 100644 --- a/include/battle.h +++ b/include/battle.h @@ -543,6 +543,7 @@ struct BattleStruct bool8 spriteIgnore0Hp; struct Illusion illusion[MAX_BATTLERS_COUNT]; s8 aiFinalScore[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // AI, target, moves to make debugging easier + u8 soulheartBattlerId; }; #define GET_MOVE_TYPE(move, typeArg) \ diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 70f12b4964..3256ca82cf 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -334,5 +334,6 @@ extern const u8 BattleScript_DisguiseBustedActivates[]; extern const u8 BattleScript_AnticipationActivates[]; extern const u8 BattleScript_SlowStartEnds[]; extern const u8 BattleScript_HealerActivates[]; +extern const u8 BattleScript_ScriptingAbilityStatRaise[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 81ea474e9a..a02e0e73fe 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -149,6 +149,7 @@ #define VARIOUS_GET_STAT_VALUE 86 #define VARIOUS_JUMP_IF_FULL_HP 87 #define VARIOUS_LOSE_TYPE 88 +#define VARIOUS_TRY_ACTIVATE_SOULHEART 89 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 74c121ab12..c2f87298b6 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -543,7 +543,8 @@ #define STRINGID_ATTACKERCUREDTARGETSTATUS 539 #define STRINGID_ATTACKERLOSTFIRETYPE 540 #define STRINGID_HEALERCURE 541 +#define STRINGID_SCRIPTINGABILITYSTATRAISE 542 -#define BATTLESTRINGS_COUNT 542 +#define BATTLESTRINGS_COUNT 543 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_message.c b/src/battle_message.c index 9a5ebcb1d4..c156c7ff1b 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -572,6 +572,7 @@ static const u8 sText_AquaRingHeal[] = _("Aqua Ring restored\n{B_ATK_NAME_WITH_P static const u8 sText_TargetAbilityRaisedStat[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nraised its {B_BUFF1}!"); static const u8 sText_TargetAbilityLoweredStat[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nlowered its {B_BUFF1}!"); static const u8 sText_AttackerAbilityRaisedStat[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\nraised its {B_BUFF1}!"); +static const u8 sText_ScriptingAbilityRaisedStat[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nraised its {B_BUFF1}!"); static const u8 sText_AuroraVeilEnds[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nwore off!"); static const u8 sText_ElectricTerrainEnds[] = _("The electricity disappeared\nfrom the battlefield."); static const u8 sText_MistyTerrainEnds[] = _("The mist disappeared\nfrom the battlefield."); @@ -667,6 +668,7 @@ static const u8 sText_HealerCure[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ABILI const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_SCRIPTINGABILITYSTATRAISE - 12] = sText_ScriptingAbilityRaisedStat, [STRINGID_HEALERCURE - 12] = sText_HealerCure, [STRINGID_ATTACKERLOSTFIRETYPE - 12] = sText_AttackerLostFireType, [STRINGID_ATTACKERCUREDTARGETSTATUS - 12] = sText_AttackerCuredTargetStatus, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 36793f1655..4144267128 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7123,6 +7123,25 @@ static void Cmd_various(void) return; } break; + case VARIOUS_TRY_ACTIVATE_SOULHEART: + while (gBattleStruct->soulheartBattlerId < gBattlersCount) + { + gBattleScripting.battler = gBattleStruct->soulheartBattlerId++; + if (GetBattlerAbility(gBattleScripting.battler) == ABILITY_SOUL_HEART + && IsBattlerAlive(gBattleScripting.battler) + && !NoAliveMonsForEitherParty() + && gBattleMons[gBattleScripting.battler].statStages[STAT_SPATK] != 12) + { + gBattleMons[gBattleScripting.battler].statStages[STAT_SPATK]++; + SET_STATCHANGER(STAT_SPATK, 1, FALSE); + PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK); + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_ScriptingAbilityStatRaise; + return; + } + } + gBattleStruct->soulheartBattlerId = 0; + break; case VARIOUS_TRY_ACTIVATE_FELL_STINGER: if (gBattleMoves[gCurrentMove].effect == EFFECT_FELL_STINGER && HasAttackerFaintedTarget()