Merge pull request #1742 from AsparagusEduardo/be_gStatuses4

Add gStatutes4
This commit is contained in:
ghoulslash 2021-10-19 08:45:47 -04:00 committed by GitHub
commit eda99fcf29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 5 deletions

View file

@ -860,6 +860,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;

View file

@ -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)

View file

@ -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");
@ -207,6 +209,8 @@ static const u8 sText_GastroAcid[] = _("Gastro Acid");
static const u8 sText_SmackDown[] = _("Smacked Down");
static const u8 sText_MiracleEye[] = _("Miracle Eye");
static const u8 sText_AquaRing[] = _("Aqua Ring");
static const u8 sText_LaserFocus[] = _("Laser Focused");
static const u8 sText_Electrified[] = _("Electrified");
static const u8 sText_AuroraVeil[] = _("Aurora Veil");
static const u8 sText_LuckyChant[] = _("Lucky Chant");
static const u8 sText_Tailwind[] = _("Tailwind");
@ -295,6 +299,13 @@ static const struct BitfieldInfo sStatus3Bitfield[] =
// Magnet Rise 1, 26,
// Heal Block 1, 27,
{/*Aqua Ring*/ 1, 28},
{/*Laser Focus*/ 1, 29},
// Power Trick 1, 30,
};
static const struct BitfieldInfo sStatus4Bitfield[] =
{
{/*Electrified*/ 1, 0,}
};
static const struct BitfieldInfo sAIBitfield[] =
@ -324,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},
@ -408,6 +420,12 @@ static const struct ListMenuItem sStatus3ListItems[] =
{sText_SmackDown, 8},
{sText_MiracleEye, 9},
{sText_AquaRing, 10},
{sText_LaserFocus, 11},
};
static const struct ListMenuItem sStatus4ListItems[] =
{
{sText_Electrified, 0},
};
static const struct ListMenuItem sSideStatusListItems[] =
@ -1176,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);
@ -1734,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);

View file

@ -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;
@ -2849,6 +2850,7 @@ static void BattleStartClearSetData(void)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
gStatuses3[i] = 0;
gStatuses4[i] = 0;
gDisableStructs[i].isFirstTurn = 2;
gLastMoves[i] = 0;
gLastLandedMoves[i] = 0;
@ -2980,6 +2982,8 @@ void SwitchInClearSetData(void)
gBattleMons[gActiveBattler].status2 = 0;
gStatuses3[gActiveBattler] = 0;
}
gStatuses4[gActiveBattler] = 0;
for (i = 0; i < gBattlersCount; i++)
{
@ -3053,6 +3057,7 @@ void FaintClearSetData(void)
gBattleMons[gActiveBattler].status2 = 0;
gStatuses3[gActiveBattler] = 0;
gStatuses4[gActiveBattler] = 0;
for (i = 0; i < gBattlersCount; i++)
{
@ -5119,7 +5124,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;
}

View file

@ -8112,7 +8112,7 @@ static void Cmd_various(void)
}
else
{
gStatuses3[gBattlerTarget] |= STATUS3_ELECTRIFIED;
gStatuses4[gBattlerTarget] |= STATUS4_ELECTRIFIED;
gBattlescriptCurrInstr += 7;
}
return;

View file

@ -2862,7 +2862,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);