Fix AI Guard Spec use, and Specs->Spec

This commit is contained in:
GriffinR
2021-04-03 15:18:17 -04:00
parent f4d8a91ba4
commit b6711441f5
4 changed files with 16 additions and 7 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ gBattlescriptsForUsingItem:: @ 82DBD3C
.4byte BattleScript_OpponentUsesHealItem @ AI_ITEM_HEAL_HP .4byte BattleScript_OpponentUsesHealItem @ AI_ITEM_HEAL_HP
.4byte BattleScript_OpponentUsesStatusCureItem @ AI_ITEM_CURE_CONDITION .4byte BattleScript_OpponentUsesStatusCureItem @ AI_ITEM_CURE_CONDITION
.4byte BattleScript_OpponentUsesXItem @ AI_ITEM_X_STAT .4byte BattleScript_OpponentUsesXItem @ AI_ITEM_X_STAT
.4byte BattleScript_OpponentUsesGuardSpecs @ AI_ITEM_GUARD_SPECS .4byte BattleScript_OpponentUsesGuardSpec @ AI_ITEM_GUARD_SPEC
.align 2 .align 2
gBattlescriptsForRunningByItem:: @ 82DBD54 gBattlescriptsForRunningByItem:: @ 82DBD54
@@ -155,7 +155,7 @@ BattleScript_OpponentUsesXItem::
moveendcase MOVEEND_MIRROR_MOVE moveendcase MOVEEND_MIRROR_MOVE
finishaction finishaction
BattleScript_OpponentUsesGuardSpecs:: BattleScript_OpponentUsesGuardSpec::
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
pause B_WAIT_TIME_MED pause B_WAIT_TIME_MED
playse SE_USE_ITEM playse SE_USE_ITEM
+1 -1
View File
@@ -7,7 +7,7 @@ enum
AI_ITEM_HEAL_HP, AI_ITEM_HEAL_HP,
AI_ITEM_CURE_CONDITION, AI_ITEM_CURE_CONDITION,
AI_ITEM_X_STAT, AI_ITEM_X_STAT,
AI_ITEM_GUARD_SPECS, AI_ITEM_GUARD_SPEC,
AI_ITEM_NOT_RECOGNIZABLE AI_ITEM_NOT_RECOGNIZABLE
}; };
+2 -2
View File
@@ -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) else if (itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0)
return AI_ITEM_X_STAT; return AI_ITEM_X_STAT;
else if (itemEffect[3] & ITEM3_GUARD_SPEC) else if (itemEffect[3] & ITEM3_GUARD_SPEC)
return AI_ITEM_GUARD_SPECS; return AI_ITEM_GUARD_SPEC;
else else
return AI_ITEM_NOT_RECOGNIZABLE; return AI_ITEM_NOT_RECOGNIZABLE;
} }
@@ -911,7 +911,7 @@ static bool8 ShouldUseItem(void)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_DIRE_HIT); *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= (1 << AI_DIRE_HIT);
shouldUse = TRUE; shouldUse = TRUE;
break; break;
case AI_ITEM_GUARD_SPECS: case AI_ITEM_GUARD_SPEC:
battlerSide = GetBattlerSide(gActiveBattler); battlerSide = GetBattlerSide(gActiveBattler);
if (gDisableStructs[gActiveBattler].isFirstTurn != 0 && gSideTimers[battlerSide].mistTimer == 0) if (gDisableStructs[gActiveBattler].isFirstTurn != 0 && gSideTimers[battlerSide].mistTimer == 0)
shouldUse = TRUE; shouldUse = TRUE;
+11 -2
View File
@@ -378,10 +378,19 @@ void HandleAction_UseItem(void)
gBattleScripting.animArg2 = 0; gBattleScripting.animArg2 = 0;
} }
break; 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) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
gBattleCommunication[MULTISTRING_CHOOSER] = 2; // Going OOB for gMistUsedStringIds? gBattleCommunication[MULTISTRING_CHOOSER] = 2;
else else
#endif
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_MIST; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_MIST;
break; break;
} }