replace some BufferStatChange, fix room service and terrain seeds

This commit is contained in:
ghoulslash 2021-09-14 15:07:15 -04:00
parent 60713a8f2d
commit 55c3e152cf
2 changed files with 11 additions and 13 deletions

View File

@ -150,6 +150,7 @@ bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes);
void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind);
bool32 TryRoomService(u8 battlerId);
void BufferStatChange(u8 battlerId, u8 statId, u8 stringId);
// ability checks
bool32 IsRolePlayBannedAbilityAtk(u16 ability);

View File

@ -557,6 +557,7 @@ void HandleAction_UseItem(void)
}
break;
case AI_ITEM_X_STAT:
// TODO Contrary check
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_ROSE_ITEM;
if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & (1 << AI_DIRE_HIT))
{
@ -5445,9 +5446,7 @@ static u8 StatRaiseBerry(u32 battlerId, u32 itemId, u32 statId, bool32 end2)
{
if (CompareStat(battlerId, statId, MAX_STAT_STAGE, CMP_LESS_THAN) && HasEnoughHpToEatBerry(battlerId, GetBattlerHoldEffectParam(battlerId), itemId))
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId);
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
BufferStatChange(battlerId, statId, STRINGID_STATROSE);
gEffectBattler = battlerId;
if (GetBattlerAbility(battlerId) == ABILITY_RIPEN)
SET_STATCHANGER(statId, 2, FALSE);
@ -5474,6 +5473,7 @@ static u8 StatRaiseBerry(u32 battlerId, u32 itemId, u32 statId, bool32 end2)
static u8 RandomStatRaiseBerry(u32 battlerId, u32 itemId, bool32 end2)
{
s32 i;
u16 stringId;
for (i = 0; i < 5; i++)
{
@ -5488,14 +5488,15 @@ static u8 RandomStatRaiseBerry(u32 battlerId, u32 itemId, bool32 end2)
} while (!CompareStat(battlerId, STAT_ATK + i, MAX_STAT_STAGE, CMP_LESS_THAN));
PREPARE_STAT_BUFFER(gBattleTextBuff1, i + 1);
stringId = (GetBattlerAbility(battlerId) == ABILITY_CONTRARY) ? STRINGID_STATFELL : STRINGID_STATROSE;
gBattleTextBuff2[0] = B_BUFF_PLACEHOLDER_BEGIN;
gBattleTextBuff2[1] = B_BUFF_STRING;
gBattleTextBuff2[2] = STRINGID_STATSHARPLY;
gBattleTextBuff2[3] = STRINGID_STATSHARPLY >> 8;
gBattleTextBuff2[4] = B_BUFF_STRING;
gBattleTextBuff2[5] = STRINGID_STATROSE;
gBattleTextBuff2[6] = STRINGID_STATROSE >> 8;
gBattleTextBuff2[5] = stringId;
gBattleTextBuff2[6] = stringId >> 8;
gBattleTextBuff2[7] = EOS;
gEffectBattler = battlerId;
@ -5550,9 +5551,7 @@ static u8 DamagedStatBoostBerryEffect(u8 battlerId, u8 statId, u8 split)
&& !DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove)
&& GetBattleMoveSplit(gCurrentMove) == split)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId);
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
BufferStatChange(battlerId, statId, STRINGID_STATROSE);
gEffectBattler = battlerId;
if (GetBattlerAbility(battlerId) == ABILITY_RIPEN)
@ -5573,9 +5572,7 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec
{
if (gFieldStatuses & terrainFlag && CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN))
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId);
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
BufferStatChange(battler, statId, STRINGID_STATROSE);
gLastUsedItem = itemId; // For surge abilities
gEffectBattler = gBattleScripting.battler = battler;
SET_STATCHANGER(statId, 1, FALSE);