From cf6e3873b48bbf3d9c1ed3cd611ca6cf47e04ec2 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sun, 10 Oct 2021 01:13:23 -0300 Subject: [PATCH] Moved Electrified to Status4. --- include/battle.h | 1 + include/constants/battle.h | 5 +++-- src/battle_debug.c | 27 ++++++++++++++++++++++++--- src/battle_main.c | 3 ++- src/battle_script_commands.c | 2 +- src/battle_util.c | 2 +- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/include/battle.h b/include/battle.h index 826a0929ec..6bca8d394f 100644 --- a/include/battle.h +++ b/include/battle.h @@ -857,6 +857,7 @@ extern u8 gUnusedFirstBattleVar2; extern u32 gSideStatuses[2]; extern struct SideTimer gSideTimers[2]; extern u32 gStatuses3[MAX_BATTLERS_COUNT]; +extern u32 gStatuses4[MAX_BATTLERS_COUNT]; extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT]; extern u16 gPauseCounterBattle; extern u16 gPaydayMoney; diff --git a/include/constants/battle.h b/include/constants/battle.h index a59ea2f1a5..abaddde96f 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -169,10 +169,11 @@ #define STATUS3_HEAL_BLOCK (1 << 27) #define STATUS3_AQUA_RING (1 << 28) #define STATUS3_LASER_FOCUS (1 << 29) -#define STATUS3_ELECTRIFIED (1 << 30) -#define STATUS3_POWER_TRICK (1 << 31) +#define STATUS3_POWER_TRICK (1 << 30) #define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER | STATUS3_PHANTOM_FORCE) +#define STATUS4_ELECTRIFIED (1 << 0) + #define HITMARKER_x10 (1 << 4) #define HITMARKER_x20 (1 << 5) #define HITMARKER_DESTINYBOND (1 << 6) diff --git a/src/battle_debug.c b/src/battle_debug.c index 657dc6061c..25ca9e92df 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -97,6 +97,7 @@ enum LIST_ITEM_STATUS1, LIST_ITEM_STATUS2, LIST_ITEM_STATUS3, + LIST_ITEM_STATUS4, LIST_ITEM_SIDE_STATUS, LIST_ITEM_AI, LIST_ITEM_AI_MOVES_PTS, @@ -164,6 +165,7 @@ static const u8 sText_StatStages[] = _("Stat Stages"); static const u8 sText_Status1[] = _("Status1"); static const u8 sText_Status2[] = _("Status2"); static const u8 sText_Status3[] = _("Status3"); +static const u8 sText_Status4[] = _("Status4"); static const u8 sText_HeldItem[] = _("Held Item"); static const u8 sText_SideStatus[] = _("Side Status"); static const u8 sText_MaxHp[] = _("HP Max"); @@ -298,8 +300,12 @@ static const struct BitfieldInfo sStatus3Bitfield[] = // Heal Block 1, 27, {/*Aqua Ring*/ 1, 28}, {/*Laser Focus*/ 1, 29}, - {/*Electrified*/ 1, 30}, - // Power Trick 1, 31, + // Power Trick 1, 30, +}; + +static const struct BitfieldInfo sStatus4Bitfield[] = +{ + {/*Electrified*/ 1, 0,} }; static const struct BitfieldInfo sAIBitfield[] = @@ -329,6 +335,7 @@ static const struct ListMenuItem sMainListItems[] = {sText_Status1, LIST_ITEM_STATUS1}, {sText_Status2, LIST_ITEM_STATUS2}, {sText_Status3, LIST_ITEM_STATUS3}, + {sText_Status4, LIST_ITEM_STATUS4}, {sText_SideStatus, LIST_ITEM_SIDE_STATUS}, {sText_AI, LIST_ITEM_AI}, {sText_AIMovePts, LIST_ITEM_AI_MOVES_PTS}, @@ -414,7 +421,11 @@ static const struct ListMenuItem sStatus3ListItems[] = {sText_MiracleEye, 9}, {sText_AquaRing, 10}, {sText_LaserFocus, 11}, - {sText_Electrified, 12}, +}; + +static const struct ListMenuItem sStatus4ListItems[] = +{ + {sText_Electrified, 0}, }; static const struct ListMenuItem sSideStatusListItems[] = @@ -1183,6 +1194,11 @@ static void CreateSecondaryListMenu(struct BattleDebugMenu *data) itemsCount = ARRAY_COUNT(sStatus3ListItems); data->bitfield = sStatus3Bitfield; break; + case LIST_ITEM_STATUS4: + listTemplate.items = sStatus4ListItems; + itemsCount = ARRAY_COUNT(sStatus4ListItems); + data->bitfield = sStatus4Bitfield; + break; case LIST_ITEM_AI: listTemplate.items = sAIListItems; itemsCount = ARRAY_COUNT(sAIListItems); @@ -1741,6 +1757,11 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data) data->modifyArrows.currValue = GetBitfieldValue(gStatuses3[data->battlerId], data->bitfield[data->currentSecondaryListItemId].currBit, data->bitfield[data->currentSecondaryListItemId].bitsCount); data->modifyArrows.typeOfVal = VAL_BITFIELD_32; goto CASE_ITEM_STATUS; + case LIST_ITEM_STATUS4: + data->modifyArrows.modifiedValPtr = &gStatuses4[data->battlerId]; + data->modifyArrows.currValue = GetBitfieldValue(gStatuses4[data->battlerId], data->bitfield[data->currentSecondaryListItemId].currBit, data->bitfield[data->currentSecondaryListItemId].bitsCount); + data->modifyArrows.typeOfVal = VAL_BITFIELD_32; + goto CASE_ITEM_STATUS; case LIST_ITEM_AI: data->modifyArrows.modifiedValPtr = &gBattleResources->ai->aiFlags; data->modifyArrows.currValue = GetBitfieldValue(gBattleResources->ai->aiFlags, data->bitfield[data->currentSecondaryListItemId].currBit, data->bitfield[data->currentSecondaryListItemId].bitsCount); diff --git a/src/battle_main.c b/src/battle_main.c index 055ec9bbe8..2c15977189 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -190,6 +190,7 @@ EWRAM_DATA u8 gUnusedFirstBattleVar2 = 0; // Never read EWRAM_DATA u32 gSideStatuses[2] = {0}; EWRAM_DATA struct SideTimer gSideTimers[2] = {0}; EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u32 gStatuses4[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u16 gPauseCounterBattle = 0; EWRAM_DATA u16 gPaydayMoney = 0; @@ -5118,7 +5119,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) attackerAbility = GetBattlerAbility(battlerAtk); GET_MOVE_TYPE(move, moveType); if ((gFieldStatuses & STATUS_FIELD_ION_DELUGE && moveType == TYPE_NORMAL) - || gStatuses3[battlerAtk] & STATUS3_ELECTRIFIED) + || gStatuses4[battlerAtk] & STATUS4_ELECTRIFIED) { gBattleStruct->dynamicMoveType = 0x80 | TYPE_ELECTRIC; } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9d6dbb89bc..8eeea603eb 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8089,7 +8089,7 @@ static void Cmd_various(void) } else { - gStatuses3[gBattlerTarget] |= STATUS3_ELECTRIFIED; + gStatuses4[gBattlerTarget] |= STATUS4_ELECTRIFIED; gBattlescriptCurrInstr += 7; } return; diff --git a/src/battle_util.c b/src/battle_util.c index 8195e2f329..36effb2dbe 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2838,7 +2838,7 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ELECTRIFY: - gStatuses3[gActiveBattler] &= ~(STATUS3_ELECTRIFIED); + gStatuses4[gActiveBattler] &= ~(STATUS4_ELECTRIFIED); gBattleStruct->turnEffectsTracker++; case ENDTURN_POWDER: gBattleMons[gActiveBattler].status2 &= ~(STATUS2_POWDER);