updated up to Cmd_jumpifnotfirstturn

This commit is contained in:
cawtds
2024-05-02 00:51:52 +02:00
parent ad250f64c5
commit be0c2fe535

View File

@@ -719,11 +719,11 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_tryhealhalfhealth, //0x7B // done
Cmd_trymirrormove, //0x7C // done
Cmd_setrain, //0x7D // done
Cmd_setreflect, //0x7E
Cmd_setseeded, //0x7F
Cmd_setreflect, //0x7E // done
Cmd_setseeded, //0x7F // done
Cmd_manipulatedamage, //0x80 // done
Cmd_trysetrest, //0x81
Cmd_jumpifnotfirstturn, //0x82
Cmd_trysetrest, //0x81 // done
Cmd_jumpifnotfirstturn, //0x82 // done
Cmd_nop, //0x83
Cmd_jumpifcantmakeasleep, //0x84
Cmd_stockpile, //0x85
@@ -11380,27 +11380,34 @@ static void Cmd_setrain(void)
static void Cmd_setreflect(void)
{
if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_REFLECT)
CMD_ARGS();
if (gSideStatuses[GetBattlerSide(gBattlerAttacker)] & SIDE_STATUS_REFLECT)
{
gMoveResultFlags |= MOVE_RESULT_MISSED;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED;
}
else
{
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_REFLECT;
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 5;
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker;
gSideStatuses[GetBattlerSide(gBattlerAttacker)] |= SIDE_STATUS_REFLECT;
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LIGHT_CLAY)
gSideTimers[GetBattlerSide(gBattlerAttacker)].reflectTimer = 8;
else
gSideTimers[GetBattlerSide(gBattlerAttacker)].reflectTimer = 5;
gSideTimers[GetBattlerSide(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_DOUBLE;
else
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_SINGLE;
}
gBattlescriptCurrInstr++;
gBattlescriptCurrInstr = cmd->nextInstr;
}
static void Cmd_setseeded(void)
{
CMD_ARGS();
if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT || gStatuses3[gBattlerTarget] & STATUS3_LEECHSEED)
{
gMoveResultFlags |= MOVE_RESULT_MISSED;
@@ -11418,7 +11425,7 @@ static void Cmd_setseeded(void)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LEECH_SEED_SET;
}
gBattlescriptCurrInstr++;
gBattlescriptCurrInstr = cmd->nextInstr;
}
static void Cmd_manipulatedamage(void)
@@ -11493,13 +11500,23 @@ static void Cmd_manipulatedamage(void)
static void Cmd_trysetrest(void)
{
const u8 *failJump = T1_READ_PTR(gBattlescriptCurrInstr + 1);
CMD_ARGS(const u8 *failInstr);
const u8 *failInstr = cmd->failInstr;
gActiveBattler = gBattlerTarget = gBattlerAttacker;
gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP * (-1);
if (gBattleMons[gBattlerTarget].hp == gBattleMons[gBattlerTarget].maxHP)
{
gBattlescriptCurrInstr = failJump;
gBattlescriptCurrInstr = failInstr;
}
else if (IsBattlerTerrainAffected(gBattlerTarget, STATUS_FIELD_ELECTRIC_TERRAIN))
{
gBattlescriptCurrInstr = BattleScript_ElectricTerrainPrevents;
}
else if (IsBattlerTerrainAffected(gBattlerTarget, STATUS_FIELD_MISTY_TERRAIN))
{
gBattlescriptCurrInstr = BattleScript_MistyTerrainPrevents;
}
else
{
@@ -11509,20 +11526,22 @@ static void Cmd_trysetrest(void)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_REST;
gBattleMons[gBattlerTarget].status1 = STATUS1_SLEEP_TURN(3);
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1);
MarkBattlerForControllerExec(gActiveBattler);
gBattlescriptCurrInstr += 5;
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1);
MarkBattlerForControllerExec(gBattlerTarget);
gBattlescriptCurrInstr = cmd->nextInstr;
}
}
static void Cmd_jumpifnotfirstturn(void)
{
const u8 *failJump = T1_READ_PTR(gBattlescriptCurrInstr + 1);
CMD_ARGS(const u8 *jumpInstr);
const u8 *jumpInstr = cmd->jumpInstr;
if (gDisableStructs[gBattlerAttacker].isFirstTurn)
gBattlescriptCurrInstr += 5;
gBattlescriptCurrInstr = cmd->nextInstr;
else
gBattlescriptCurrInstr = failJump;
gBattlescriptCurrInstr = jumpInstr;
}
static void Cmd_nop(void)