From fe735f9700262fe0baf103ba77af83c9cf6c59f7 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 1 Mar 2023 20:03:27 -0300 Subject: [PATCH] Applied review suggestions -Merged EFFECT_CEASELESS_EDGE and EFFECT_STONE_AXE into EFFECT_HIT_SET_ENTRY_HAZARD -Updated gDmgHazardsStringIds and relevant battle scripts. Can't say that I like it at all. String tables are stupid imo. -Coupled Barb Barrage's effect in CalcMoveBasePower with Venoshock's --- data/battle_scripts_1.s | 36 ++++--------------------- include/constants/battle_move_effects.h | 7 +++-- include/constants/battle_string_ids.h | 6 +++++ src/battle_ai_main.c | 5 ++-- src/battle_message.c | 5 +++- src/battle_script_commands.c | 6 +++-- src/battle_util.c | 5 +--- src/data/battle_moves.h | 6 +++-- 8 files changed, 29 insertions(+), 47 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 2556d60e1..425834b7e 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -418,39 +418,13 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectTeatime @ EFFECT_TEATIME .4byte BattleScript_EffectAttackUpUserAlly @ EFFECT_ATTACK_UP_USER_ALLY .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP - .4byte BattleScript_EffectCeaselessEdge @ EFFECT_CEASELESS_EDGE + .4byte BattleScript_EffectHitSetEntryHazard @ EFFECT_HIT_SET_ENTRY_HAZARD .4byte BattleScript_EffectDireClaw @ EFFECT_DIRE_CLAW - .4byte BattleScript_EffectStoneAxe @ EFFECT_STONE_AXE .4byte BattleScript_EffectBarbBarrage @ EFFECT_BARB_BARRAGE -BattleScript_EffectStoneAxe:: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_TARGET - setmoveeffect MOVE_EFFECT_STEALTH_ROCK - seteffectprimary - moveendall - end - BattleScript_StealthRockActivates:: setstealthrock BattleScript_MoveEnd - printstring STRINGID_POINTEDSTONESFLOAT + printfromtable gDmgHazardsStringIds waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd @@ -458,7 +432,7 @@ BattleScript_EffectDireClaw:: setmoveeffect MOVE_EFFECT_DIRE_CLAW goto BattleScript_EffectHit -BattleScript_EffectCeaselessEdge:: +BattleScript_EffectHitSetEntryHazard:: attackcanceler accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE attackstring @@ -478,14 +452,14 @@ BattleScript_EffectCeaselessEdge:: resultmessage waitmessage B_WAIT_TIME_LONG tryfaintmon BS_TARGET - setmoveeffect MOVE_EFFECT_SPIKES + argumenttomoveeffect seteffectprimary moveendall end BattleScript_SpikesActivate:: trysetspikes BattleScript_MoveEnd - printstring STRINGID_SPIKESSCATTERED + printfromtable gDmgHazardsStringIds waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 0adee76c9..ad589211c 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -399,11 +399,10 @@ #define EFFECT_TEATIME 393 #define EFFECT_ATTACK_UP_USER_ALLY 394 // Howl 8th Gen #define EFFECT_SHELL_TRAP 395 -#define EFFECT_CEASELESS_EDGE 396 +#define EFFECT_HIT_SET_ENTRY_HAZARD 396 #define EFFECT_DIRE_CLAW 397 -#define EFFECT_STONE_AXE 398 -#define EFFECT_BARB_BARRAGE 399 +#define EFFECT_BARB_BARRAGE 398 -#define NUM_BATTLE_MOVE_EFFECTS 400 +#define NUM_BATTLE_MOVE_EFFECTS 399 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index f3e702ec4..01065e047 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -921,4 +921,10 @@ #define B_MSG_Z_STAT_UP 5 #define B_MSG_Z_HP_TRAP 6 +// gDmgHazardsStringIds +#define B_MSG_PKMNHURTBYSPIKES 0 +#define B_MSG_STEALTHROCKDMG 1 +#define B_MSG_POINTEDSTONESFLOAT 2 +#define B_MSG_SPIKESSCATTERED 3 + #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index bbc1660fa..f61dc49a8 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -3872,9 +3872,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_SPIKES: - case EFFECT_CEASELESS_EDGE: + case EFFECT_HIT_SET_ENTRY_HAZARD: case EFFECT_STEALTH_ROCK: - case EFFECT_STONE_AXE: case EFFECT_STICKY_WEB: case EFFECT_TOXIC_SPIKES: if (AI_DATA->abilities[battlerDef] == ABILITY_MAGIC_BOUNCE || CountUsablePartyMons(battlerDef) == 0) @@ -4910,7 +4909,7 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_HAIL: case EFFECT_GEOMANCY: case EFFECT_VICTORY_DANCE: - case EFFECT_STONE_AXE: + case EFFECT_HIT_SET_ENTRY_HAZARD: score += 2; break; default: diff --git a/src/battle_message.c b/src/battle_message.c index 29580ded0..99f88f53b 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1462,7 +1462,10 @@ const u16 gHealingWishStringIds[] = const u16 gDmgHazardsStringIds[] = { - STRINGID_PKMNHURTBYSPIKES, STRINGID_STEALTHROCKDMG + [B_MSG_PKMNHURTBYSPIKES] = STRINGID_PKMNHURTBYSPIKES, + [B_MSG_STEALTHROCKDMG] = STRINGID_STEALTHROCKDMG, + [B_MSG_POINTEDSTONESFLOAT] = STRINGID_POINTEDSTONESFLOAT, + [B_MSG_SPIKESSCATTERED] = STRINGID_SPIKESSCATTERED }; const u16 gSwitchInAbilityStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a445786ce..0799cf2f3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3768,6 +3768,7 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_STEALTH_ROCK: if (!(gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_STEALTH_ROCK)) { + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_POINTEDSTONESFLOAT; BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_StealthRockActivates; } @@ -3775,6 +3776,7 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SPIKES: if (!(gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_SPIKES)) { + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SPIKESSCATTERED; BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_SpikesActivate; } @@ -7045,7 +7047,7 @@ static void Cmd_switchineffects(void) gBattleMoveDamage = 1; gSideStatuses[GetBattlerSide(gActiveBattler)] |= SIDE_STATUS_SPIKES_DAMAGED; - SetDmgHazardsBattlescript(gActiveBattler, 0); + SetDmgHazardsBattlescript(gActiveBattler, B_MSG_PKMNHURTBYSPIKES); } else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STEALTH_ROCK_DAMAGED) && (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STEALTH_ROCK) @@ -7056,7 +7058,7 @@ static void Cmd_switchineffects(void) gBattleMoveDamage = GetStealthHazardDamage(gBattleMoves[MOVE_STEALTH_ROCK].type, gActiveBattler); if (gBattleMoveDamage != 0) - SetDmgHazardsBattlescript(gActiveBattler, 1); + SetDmgHazardsBattlescript(gActiveBattler, B_MSG_STEALTHROCKDMG); } else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_TOXIC_SPIKES_DAMAGED) && (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_TOXIC_SPIKES) diff --git a/src/battle_util.c b/src/battle_util.c index a94467085..9b3a39406 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8761,10 +8761,6 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower = CalcBeatUpPower(); #endif break; - case EFFECT_BARB_BARRAGE: - if (gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) - basePower *= 2; - break; } // Move-specific base power changes @@ -9130,6 +9126,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe if (gBattleMons[battlerDef].hp <= (gBattleMons[battlerDef].maxHP / 2)) MulModifier(&modifier, UQ_4_12(2.0)); break; + case EFFECT_BARB_BARRAGE: case EFFECT_VENOSHOCK: if (gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) MulModifier(&modifier, UQ_4_12(2.0)); diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index cc4e322f2..530dacd13 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -13323,7 +13323,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_STONE_AXE] = { - .effect = EFFECT_STONE_AXE, + .effect = EFFECT_HIT_SET_ENTRY_HAZARD, .power = 65, .type = TYPE_ROCK, .accuracy = 90, @@ -13335,6 +13335,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .zMovePower = 120, .zMoveEffect = Z_EFFECT_NONE, + .argument = MOVE_EFFECT_STEALTH_ROCK, }, [MOVE_SPRINGTIDE_STORM] = @@ -13599,7 +13600,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_CEASELESS_EDGE] = { - .effect = EFFECT_CEASELESS_EDGE, + .effect = EFFECT_HIT_SET_ENTRY_HAZARD, .power = 65, .type = TYPE_DARK, .accuracy = 90, @@ -13611,6 +13612,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .zMovePower = 120, .zMoveEffect = Z_EFFECT_NONE, + .argument = MOVE_EFFECT_SPIKES, }, [MOVE_BLEAKWIND_STORM] =