From 813b1bfd4a8f0fc316e78b39abaaafd09a42f0c4 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 22 Oct 2017 01:04:02 +0200 Subject: label and do more work at player controller --- src/battle_ai_switch_items.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/battle_ai_switch_items.c') diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index d86be6fad..3f97c59a5 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -39,7 +39,7 @@ static bool8 ShouldSwitchIfPerishSong(void) && gDisableStructs[gActiveBank].perishSong1 == 0) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } @@ -121,7 +121,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } } @@ -221,7 +221,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } } @@ -241,13 +241,13 @@ static bool8 ShouldSwitchIfNaturalCure(void) if ((gUnknown_02024250[gActiveBank] == 0 || gUnknown_02024250[gActiveBank] == 0xFFFF) && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } else if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0 && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } @@ -258,7 +258,7 @@ static bool8 ShouldSwitchIfNaturalCure(void) if (Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } @@ -426,7 +426,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent) if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % moduloPercent == 0) { *(gBattleStruct->field_294 + gActiveBank) = i; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } } @@ -611,7 +611,7 @@ void AI_TrySwitchOrUseItem(void) } } - EmitCmd33(1, 0, (gActiveBank ^ BIT_SIDE) << 8); + EmitChoiceReturnValue(1, 0, (gActiveBank ^ BIT_SIDE) << 8); } #define TYPE_FORESIGHT 0xFE @@ -940,7 +940,7 @@ static bool8 ShouldUseItem(void) if (shouldUse) { - EmitCmd33(1, 1, 0); + EmitChoiceReturnValue(1, 1, 0); *(gBattleStruct->field_C0 + (gActiveBank / 2) * 2) = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; -- cgit v1.2.3 From df4e32a307c17163e9a64e5ea615ab9eb18afc4b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 22 Oct 2017 18:43:15 +0200 Subject: player battle controller is done --- src/battle_ai_switch_items.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/battle_ai_switch_items.c') diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 3f97c59a5..de440054c 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -39,7 +39,7 @@ static bool8 ShouldSwitchIfPerishSong(void) && gDisableStructs[gActiveBank].perishSong1 == 0) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -121,7 +121,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -221,7 +221,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -241,13 +241,13 @@ static bool8 ShouldSwitchIfNaturalCure(void) if ((gUnknown_02024250[gActiveBank] == 0 || gUnknown_02024250[gActiveBank] == 0xFFFF) && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } else if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0 && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -258,7 +258,7 @@ static bool8 ShouldSwitchIfNaturalCure(void) if (Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -426,7 +426,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent) if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % moduloPercent == 0) { *(gBattleStruct->field_294 + gActiveBank) = i; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -611,7 +611,7 @@ void AI_TrySwitchOrUseItem(void) } } - EmitChoiceReturnValue(1, 0, (gActiveBank ^ BIT_SIDE) << 8); + EmitTwoReturnValues(1, ACTION_USE_MOVE, (gActiveBank ^ BIT_SIDE) << 8); } #define TYPE_FORESIGHT 0xFE @@ -940,7 +940,7 @@ static bool8 ShouldUseItem(void) if (shouldUse) { - EmitChoiceReturnValue(1, 1, 0); + EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); *(gBattleStruct->field_C0 + (gActiveBank / 2) * 2) = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; -- cgit v1.2.3 From 15061844651c0d0cdbe5ec0a3097b054d58e7f88 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 26 Oct 2017 23:12:48 +0200 Subject: battle controller opponent is done --- src/battle_ai_switch_items.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_ai_switch_items.c') diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index de440054c..a57df85fb 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -941,7 +941,7 @@ static bool8 ShouldUseItem(void) if (shouldUse) { EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); - *(gBattleStruct->field_C0 + (gActiveBank / 2) * 2) = item; + *(gBattleStruct->chosenItem + (gActiveBank / 2) * 2) = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; } -- cgit v1.2.3