fix room service activation msg, stat target

This commit is contained in:
ghoulslash 2021-09-14 12:50:36 -04:00
parent 95af97593b
commit 60713a8f2d
6 changed files with 75 additions and 23 deletions

View File

@ -1786,6 +1786,11 @@
various \battler, VARIOUS_MAKE_INVISIBLE
.endm
.macro tryroomservice battler:req, ptr:req
various \battler, VARIOUS_ROOM_SERVICE
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

@ -1860,21 +1860,12 @@ BattleScript_EffectTrickRoom:
attackanimation
waitanimation
printfromtable gRoomsStringIds
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
savetarget
setbyte gBattlerTarget, 0
BattleScript_RoomServiceLoop:
copybyte sBATTLER, gBattlerTarget
jumpifnoholdeffect BS_TARGET, HOLD_EFFECT_ROOM_SERVICE, BattleScript_RoomServiceLoop_NextBattler
jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPEED, MIN_STAT_STAGE, BattleScript_RoomServiceLoop_NextBattler
setstatchanger STAT_SPEED, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER, BattleScript_RoomServiceLoop_NextBattler
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_RoomServiceLoop_NextBattler
playanimation BS_TARGET, B_ANIM_HELD_ITEM_EFFECT, NULL
waitanimation
playstatchangeanimation BS_TARGET, BIT_SPEED, STAT_CHANGE_NEGATIVE
printstring STRINGID_USINGITEMSTATOFPKMNROSE
waitmessage 0x40
tryroomservice BS_TARGET, BattleScript_RoomServiceLoop_NextBattler
removeitem BS_TARGET
BattleScript_RoomServiceLoop_NextBattler:
addbyte gBattlerTarget, 0x1
@ -7776,7 +7767,7 @@ BattleScript_BerryStatRaiseEnd2::
BattleScript_BerryStatRaiseEnd2_AbilityPopup:
call BattleScript_AbilityPopUp
BattleScript_BerryStatRaiseEnd2_Anim:
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseEnd2_End
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseEnd2_End
setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, sB_ANIM_ARG1
setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM
@ -7791,7 +7782,7 @@ BattleScript_BerryStatRaiseRet::
BattleScript_BerryStatRaiseRet_AbilityPopup:
call BattleScript_AbilityPopUp
BattleScript_BerryStatRaiseRet_Anim:
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseRet_End
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseRet_End
setgraphicalstatchangevalues
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, sB_ANIM_ARG1
setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM

View File

@ -149,6 +149,7 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec
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);
// ability checks
bool32 IsRolePlayBannedAbilityAtk(u16 ability);

View File

@ -177,6 +177,7 @@
#define VARIOUS_MOVEEND_ITEM_EFFECTS 105
#define VARIOUS_TERRAIN_SEED 106
#define VARIOUS_MAKE_INVISIBLE 107
#define VARIOUS_ROOM_SERVICE 108
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -8553,6 +8553,17 @@ static void Cmd_various(void)
if (ItemBattleEffects(1, gActiveBattler, FALSE))
return;
break;
case VARIOUS_ROOM_SERVICE:
if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_ROOM_SERVICE && TryRoomService(gActiveBattler))
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BerryStatRaiseRet;
}
else
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
}
return;
case VARIOUS_TERRAIN_SEED:
if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_SEEDS)
{

View File

@ -5577,8 +5577,7 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
gLastUsedItem = itemId; // For surge abilities
gEffectBattler = battler;
gBattleScripting.battler = battler;
gEffectBattler = gBattleScripting.battler = battler;
SET_STATCHANGER(statId, 1, FALSE);
gBattleScripting.animArg1 = 0xE + statId;
gBattleScripting.animArg2 = 0;
@ -5831,15 +5830,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
RecordItemEffectBattle(battlerId, HOLD_EFFECT_AIR_BALLOON);
break;
case HOLD_EFFECT_ROOM_SERVICE:
if (gFieldStatuses & STATUS_FIELD_TRICK_ROOM && CompareStat(battlerId, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN))
if (TryRoomService(battlerId))
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPEED);
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATFELL);
gEffectBattler = battlerId;
SET_STATCHANGER(STAT_SPEED, 1, TRUE);
gBattleScripting.animArg1 = 0xE + STAT_SPEED;
gBattleScripting.animArg2 = 0;
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
effect = ITEM_STATS_CHANGE;
}
@ -8996,3 +8988,54 @@ bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind)
return ret;
}
void BufferStatChange(u8 battlerId, u8 statId, u8 stringId)
{
bool8 hasContrary = (GetBattlerAbility(battlerId) == ABILITY_CONTRARY);
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId);
if (stringId == STRINGID_STATFELL)
{
if (hasContrary)
{
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
}
else
{
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATFELL);
}
}
else if (stringId == STRINGID_STATROSE)
{
if (hasContrary)
{
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATFELL);
}
else
{
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
}
}
else
{
PREPARE_STRING_BUFFER(gBattleTextBuff2, stringId);
}
}
bool32 TryRoomService(u8 battlerId)
{
if (gFieldStatuses & STATUS_FIELD_TRICK_ROOM && CompareStat(battlerId, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN))
{
BufferStatChange(battlerId, STAT_SPEED, STRINGID_STATFELL);
gEffectBattler = gBattleScripting.battler = battlerId;
SET_STATCHANGER(STAT_SPEED, 1, TRUE);
gBattleScripting.animArg1 = 0xE + STAT_SPEED;
gBattleScripting.animArg2 = 0;
gLastUsedItem = gBattleMons[battlerId].item;
return TRUE;
}
else
{
return FALSE;
}
}