From 322918e28004673a9ca95d328e29f7ba12bbb18a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 10 Dec 2020 18:27:35 -0300 Subject: [PATCH] Implemented Steam Engine And I also made the BattleScript created for Anger Point a bit more neutral friendly so it can be reused on situations like this. --- data/battle_scripts_1.s | 4 ++-- include/battle_scripts.h | 2 +- include/constants/battle_string_ids.h | 2 +- src/battle_message.c | 4 ++-- src/battle_util.c | 15 ++++++++++++++- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ddfa5e594c..69af61a12e 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7103,12 +7103,12 @@ BattleScript_MummyActivates:: waitmessage 0x40 return -BattleScript_AngryPointActivates:: +BattleScript_TargetsStatWasMaxedOut:: call BattleScript_AbilityPopUp statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL setgraphicalstatchangevalues playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 - printstring STRINGID_ANGRYPOINTACTIVATES + printstring STRINGID_TARGETSSTATWASMAXEDOUT waitmessage 0x40 return diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 864825ed6f..097e907c55 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -250,7 +250,7 @@ extern const u8 BattleScript_GravityEnds[]; extern const u8 BattleScript_MoveStatDrain[]; extern const u8 BattleScript_MoveStatDrain_PPLoss[]; extern const u8 BattleScript_TargetAbilityStatRaiseOnMoveEnd[]; -extern const u8 BattleScript_AngryPointActivates[]; +extern const u8 BattleScript_TargetsStatWasMaxedOut[]; extern const u8 BattleScript_AttackerAbilityStatRaise[]; extern const u8 BattleScript_AttackerAbilityStatRaiseEnd3[]; extern const u8 BattleScript_PoisonHealActivates[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 75a2fddc5e..526a68c588 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -452,7 +452,7 @@ #define STRINGID_PSYCHICTERRAINENDS 448 #define STRINGID_GRASSYTERRAINENDS 449 #define STRINGID_TARGETABILITYSTATRAISE 450 -#define STRINGID_ANGRYPOINTACTIVATES 451 +#define STRINGID_TARGETSSTATWASMAXEDOUT 451 #define STRINGID_ATTACKERABILITYSTATRAISE 452 #define STRINGID_POISONHEALHPUP 453 #define STRINGID_BADDREAMSDMG 454 diff --git a/src/battle_message.c b/src/battle_message.c index e51d85fe36..9ca2b7cce1 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -584,7 +584,7 @@ static const u8 sText_ElectricTerrainEnds[] = _("The electricity disappeared\nfr static const u8 sText_MistyTerrainEnds[] = _("The mist disappeared\nfrom the battlefield."); static const u8 sText_PsychicTerrainEnds[] = _("The weirdness disappeared\nfrom the battlefield."); static const u8 sText_GrassyTerrainEnds[] = _("The grass disappeared\nfrom the battlefield."); -static const u8 sText_AngryPointActivates[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} maxed\nits attack!"); +static const u8 sText_TargetsStatWasMaxedOut[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} maxed\nits {B_BUFF1}!"); static const u8 sText_PoisonHealHpUp[] = _("The poisoning healed {B_ATK_NAME_WITH_PREFIX}\na little bit!"); static const u8 sText_BadDreamsDmg[] = _("{B_DEF_NAME_WITH_PREFIX} is tormented\nby {B_ATK_ABILITY}!"); static const u8 sText_MoldBreakerEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} breaks the mold!"); @@ -1160,7 +1160,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_PSYCHICTERRAINENDS - 12] = sText_PsychicTerrainEnds, [STRINGID_GRASSYTERRAINENDS - 12] = sText_GrassyTerrainEnds, [STRINGID_TARGETABILITYSTATRAISE - 12] = sText_TargetAbilityRaisedStat, - [STRINGID_ANGRYPOINTACTIVATES - 12] = sText_AngryPointActivates, + [STRINGID_TARGETSSTATWASMAXEDOUT - 12] = sText_TargetsStatWasMaxedOut, [STRINGID_ATTACKERABILITYSTATRAISE - 12] = sText_AttackerAbilityRaisedStat, [STRINGID_POISONHEALHPUP - 12] = sText_PoisonHealHpUp, [STRINGID_BADDREAMSDMG - 12] = sText_BadDreamsDmg, diff --git a/src/battle_util.c b/src/battle_util.c index ff93b4120d..c1270453ff 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4425,7 +4425,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { SET_STATCHANGER(STAT_ATK, 12 - gBattleMons[battler].statStages[STAT_ATK], FALSE); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_AngryPointActivates; + gBattlescriptCurrInstr = BattleScript_TargetsStatWasMaxedOut; effect++; } break; @@ -4637,6 +4637,19 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_STEAM_ENGINE: + if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + && TARGET_TURN_DAMAGED + && IsBattlerAlive(battler) + && gBattleMons[battler].statStages[STAT_SPEED] != 12 + && (moveType == TYPE_FIRE || moveType == TYPE_WATER)) + { + SET_STATCHANGER(STAT_SPEED, 12 - gBattleMons[battler].statStages[STAT_SPEED], FALSE); + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_TargetsStatWasMaxedOut; + effect++; + } + break; } break; case ABILITYEFFECT_MOVE_END_ATTACKER: // Same as above, but for attacker