diff --git a/data/battle_scripts_2.s b/data/battle_scripts_2.s index 378819a944..996048dd3d 100644 --- a/data/battle_scripts_2.s +++ b/data/battle_scripts_2.s @@ -34,7 +34,7 @@ gBattlescriptsForUsingItem:: @ 82DBD3C .4byte BattleScript_OpponentUsesHealItem @ AI_ITEM_HEAL_HP .4byte BattleScript_OpponentUsesStatusCureItem @ AI_ITEM_CURE_CONDITION .4byte BattleScript_OpponentUsesXItem @ AI_ITEM_X_STAT - .4byte BattleScript_OpponentUsesGuardSpecs @ AI_ITEM_GUARD_SPECS + .4byte BattleScript_OpponentUsesGuardSpec @ AI_ITEM_GUARD_SPEC .align 2 gBattlescriptsForRunningByItem:: @ 82DBD54 @@ -155,7 +155,7 @@ BattleScript_OpponentUsesXItem:: moveendcase MOVEEND_MIRROR_MOVE finishaction -BattleScript_OpponentUsesGuardSpecs:: +BattleScript_OpponentUsesGuardSpec:: printstring STRINGID_EMPTYSTRING3 pause B_WAIT_TIME_MED playse SE_USE_ITEM diff --git a/include/battle_ai_switch_items.h b/include/battle_ai_switch_items.h index db390346d3..a0b6fe62c3 100644 --- a/include/battle_ai_switch_items.h +++ b/include/battle_ai_switch_items.h @@ -7,7 +7,7 @@ enum AI_ITEM_HEAL_HP, AI_ITEM_CURE_CONDITION, AI_ITEM_X_STAT, - AI_ITEM_GUARD_SPECS, + AI_ITEM_GUARD_SPEC, AI_ITEM_NOT_RECOGNIZABLE }; diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index e926308085..04122b17d1 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -789,7 +789,7 @@ static u8 GetAI_ItemType(u8 itemId, const u8 *itemEffect) // NOTE: should take u else if (itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0) return AI_ITEM_X_STAT; else if (itemEffect[3] & ITEM3_GUARD_SPEC) - return AI_ITEM_GUARD_SPECS; + return AI_ITEM_GUARD_SPEC; else return AI_ITEM_NOT_RECOGNIZABLE; } @@ -911,7 +911,7 @@ static bool8 ShouldUseItem(void) *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_DIRE_HIT); shouldUse = TRUE; break; - case AI_ITEM_GUARD_SPECS: + case AI_ITEM_GUARD_SPEC: battlerSide = GetBattlerSide(gActiveBattler); if (gDisableStructs[gActiveBattler].isFirstTurn != 0 && gSideTimers[battlerSide].mistTimer == 0) shouldUse = TRUE; diff --git a/src/battle_util.c b/src/battle_util.c index e2dfeef271..cbcd445b7e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -378,10 +378,19 @@ void HandleAction_UseItem(void) gBattleScripting.animArg2 = 0; } break; - case AI_ITEM_GUARD_SPECS: + case AI_ITEM_GUARD_SPEC: + // It seems probable that at some point there was a special message for + // an AI trainer using Guard Spec in a double battle. + // There isn't now however, and the assignment to 2 below goes out of + // bounds for gMistUsedStringIds and instead prints "{mon} is getting pumped" + // from the next table, gFocusEnergyUsedStringIds. + // In any case this isn't an issue in the retail version, as no trainers + // are ever given any Guard Spec to use. +#ifndef UBFIX if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) - gBattleCommunication[MULTISTRING_CHOOSER] = 2; // Going OOB for gMistUsedStringIds? + gBattleCommunication[MULTISTRING_CHOOSER] = 2; else +#endif gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_MIST; break; }