fix throat spray bugs. move shell bell, throat spray etc to life orb moveend case

This commit is contained in:
ghoulslash 2021-09-03 11:05:11 -04:00
parent 7c53214dad
commit 6ce1227447
5 changed files with 57 additions and 39 deletions

View File

@ -1868,7 +1868,7 @@ BattleScript_RoomServiceLoop:
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 0, BattleScript_RoomServiceLoop_NextBattler
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
@ -2193,18 +2193,21 @@ BattleScript_AlreadyAsleep::
pause B_WAIT_TIME_SHORT
printstring STRINGID_PKMNALREADYASLEEP
waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd
BattleScript_WasntAffected::
pause B_WAIT_TIME_SHORT
printstring STRINGID_PKMNWASNTAFFECTED
waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd
BattleScript_CantMakeAsleep::
pause B_WAIT_TIME_SHORT
printfromtable gUproarAwakeStringIds
waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd
BattleScript_EffectPoisonHit:
@ -5643,7 +5646,7 @@ BattleScript_TargetItemStatRaiseRemoveItemRet:
BattleScript_AttackerItemStatRaise::
copybyte sBATTLER, gBattlerAttacker
statbuffchange 0, BattleScript_AttackerItemStatRaiseRet
statbuffchange MOVE_EFFECT_AFFECTS_USER, BattleScript_AttackerItemStatRaiseRet
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_AttackerItemStatRaiseRet
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL
waitanimation
@ -7120,6 +7123,7 @@ BattleScript_SoundproofProtected::
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNSXBLOCKSY
waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
goto BattleScript_MoveEnd
BattleScript_DazzlingProtected::

View File

@ -28,9 +28,10 @@
#define ITEMEFFECT_ON_SWITCH_IN 0x0
#define ITEMEFFECT_MOVE_END 0x3
#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4
#define ITEMEFFECT_KINGSROCK 0x4
#define ITEMEFFECT_TARGET 0x5
#define ITEMEFFECT_ORBS 0x6
#define ITEMEFFECT_LIFEORB_SHELLBELL 0x7
#define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK)))

View File

@ -231,15 +231,15 @@
#define MOVEEND_ITEM_EFFECTS_TARGET 13
#define MOVEEND_MOVE_EFFECTS2 14
#define MOVEEND_ITEM_EFFECTS_ALL 15
#define MOVEEND_KINGSROCK_SHELLBELL 16
#define MOVEEND_KINGSROCK 16 // these item effects will occur each strike of a multi-hit move
#define MOVEEND_SUBSTITUTE 17
#define MOVEEND_UPDATE_LAST_MOVES 18
#define MOVEEND_MIRROR_MOVE 19
#define MOVEEND_NEXT_TARGET 20
#define MOVEEND_NEXT_TARGET 20 // everything up until here is handled for each strike of a multi-hit move
#define MOVEEND_EJECT_BUTTON 21
#define MOVEEND_RED_CARD 22
#define MOVEEND_EJECT_PACK 23
#define MOVEEND_LIFE_ORB 24
#define MOVEEND_LIFEORB_SHELLBELL 24 // includes shell bell, throat spray, etc
#define MOVEEND_PICKPOCKET 25
#define MOVEEND_DANCER 26
#define MOVEEND_EMERGENCY_EXIT 27

View File

@ -4934,8 +4934,9 @@ static void Cmd_moveend(void)
else
gBattleScripting.moveendState++;
break;
case MOVEEND_KINGSROCK_SHELLBELL: // king's rock and shell bell
if (ItemBattleEffects(ITEMEFFECT_KINGSROCK_SHELLBELL, 0, FALSE))
case MOVEEND_KINGSROCK: // king's rock and shell bell
// these effects will occur at each hit in a multi-strike move
if (ItemBattleEffects(ITEMEFFECT_KINGSROCK, 0, FALSE))
effect = TRUE;
gBattleScripting.moveendState++;
break;
@ -5199,22 +5200,9 @@ static void Cmd_moveend(void)
}
gBattleScripting.moveendState++;
break;
case MOVEEND_LIFE_ORB:
// TODO shell bell goes here too
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LIFE_ORB
&& IsBattlerAlive(gBattlerAttacker)
&& !(TestSheerForceFlag(gBattlerAttacker, gCurrentMove))
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD
&& gSpecialStatuses[gBattlerAttacker].damagedMons)
{
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 10;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
case MOVEEND_LIFEORB_SHELLBELL:
if (ItemBattleEffects(ITEMEFFECT_LIFEORB_SHELLBELL, 0, FALSE))
effect = TRUE;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ItemHurtRet;
gLastUsedItem = gBattleMons[gBattlerAttacker].item;
}
gBattleScripting.moveendState++;
break;
case MOVEEND_PICKPOCKET:

View File

@ -6354,7 +6354,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
}
break;
case ITEMEFFECT_KINGSROCK_SHELLBELL:
case ITEMEFFECT_KINGSROCK:
// occur on each hit of a multi-strike move
switch (atkHoldEffect)
{
case HOLD_EFFECT_FLINCH:
@ -6371,6 +6372,25 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
BattleScriptPop();
}
break;
case HOLD_EFFECT_BLUNDER_POLICY:
if (gBattleStruct->blunderPolicy
&& gBattleMons[gBattlerAttacker].hp != 0
&& gBattleMons[gBattlerAttacker].statStages[STAT_SPEED] < MAX_STAT_STAGE)
{
gBattleStruct->blunderPolicy = FALSE;
gLastUsedItem = atkItem;
gBattleScripting.statChanger = SET_STATCHANGER(STAT_SPEED, 2, FALSE);
effect = ITEM_STATS_CHANGE;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AttackerItemStatRaise;
}
break;
}
break;
case ITEMEFFECT_LIFEORB_SHELLBELL:
// occur after the final hit of a multi-strike move
switch (atkHoldEffect)
{
case HOLD_EFFECT_SHELL_BELL:
if (gBattleMoveDamage != 0 // Need to have done damage
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
@ -6389,35 +6409,40 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gSpecialStatuses[gBattlerTarget].dmg = 0;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret;
effect++;
effect = TRUE;
}
break;
case HOLD_EFFECT_LIFE_ORB:
if (IsBattlerAlive(gBattlerAttacker)
&& !(TestSheerForceFlag(gBattlerAttacker, gCurrentMove))
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD
&& gSpecialStatuses[gBattlerAttacker].damagedMons)
{
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 10;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
effect = TRUE;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ItemHurtRet;
gLastUsedItem = gBattleMons[gBattlerAttacker].item;
}
break;
case HOLD_EFFECT_THROAT_SPRAY: // Does NOT need to be a damaging move
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& !(gHitMarker & (HITMARKER_UNABLE_TO_USE_MOVE))
&& gBattleMons[gBattlerAttacker].hp != 0
&& gBattleMoves[gCurrentMove].flags & FLAG_SOUND
&& gBattleMons[gBattlerAttacker].statStages[STAT_SPATK] < MAX_STAT_STAGE)
&& gBattleMons[gBattlerAttacker].statStages[STAT_SPATK] < MAX_STAT_STAGE
&& !NoAliveMonsForEitherParty()) // don't activate if battle will end
{
gLastUsedItem = atkItem;
gBattleScripting.battler = gBattlerAttacker;
gBattleScripting.statChanger = SET_STATCHANGER(STAT_SPATK, 1, FALSE);
effect = ITEM_STATS_CHANGE;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AttackerItemStatRaise;
}
break;
case HOLD_EFFECT_BLUNDER_POLICY:
if (gBattleStruct->blunderPolicy
&& gBattleMons[gBattlerAttacker].hp != 0
&& gBattleMons[gBattlerAttacker].statStages[STAT_SPEED] < MAX_STAT_STAGE)
{
gBattleStruct->blunderPolicy = FALSE;
gLastUsedItem = atkItem;
gBattleScripting.statChanger = SET_STATCHANGER(STAT_SPEED, 2, FALSE);
effect = ITEM_STATS_CHANGE;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AttackerItemStatRaise;
}
break;
}
break;
case ITEMEFFECT_TARGET: