fix some comment styling. fix throat spray for multi-target moves

This commit is contained in:
ghoulslash 2021-09-14 11:53:35 -04:00
parent f3f26d1a6f
commit 95af97593b
6 changed files with 23 additions and 21 deletions

View file

@ -6948,13 +6948,13 @@ BattleScript_SnowWarningActivates::
BattleScript_TerrainSeedLoop:
savetarget
setbyte gBattlerTarget, 0
TerrainSeedLoop:
BattleScript_TerrainSeedLoopIter:
copybyte sBATTLER, gBattlerTarget
doterrainseed BS_TARGET, TerrainSeedLoop_NextBattler
doterrainseed BS_TARGET, BattleScript_TerrainSeedLoop_NextBattler
removeitem BS_TARGET
TerrainSeedLoop_NextBattler:
BattleScript_TerrainSeedLoop_NextBattler:
addbyte gBattlerTarget, 0x1
jumpifbytenotequal gBattlerTarget, gBattlersCount, TerrainSeedLoop
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TerrainSeedLoopIter
restoretarget
return
@ -7187,6 +7187,7 @@ BattleScript_AbilityNoSpecificStatLoss::
printstring STRINGID_PKMNSXPREVENTSYLOSS
waitmessage B_WAIT_TIME_LONG
setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY
orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
return
BattleScript_StickyHoldActivates::

View file

@ -126,7 +126,7 @@ struct ProtectStruct
u32 stealMove:1;
u32 prlzImmobility:1;
u32 confusionSelfDmg:1;
u32 targetNotAffected:1;
u32 targetAffected:1;
u32 chargingTurn:1;
u32 fleeFlag:2; // For RunAway and Smoke Ball.
u32 usedImprisonedMove:1;

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 16 // these item effects will occur each strike of a multi-hit move
#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 // everything up until here is handled for each strike of a multi-hit move
#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_LIFEORB_SHELLBELL 24 // includes shell bell, throat spray, etc
#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

@ -3078,7 +3078,7 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].stealMove = 0;
gProtectStructs[gActiveBattler].prlzImmobility = 0;
gProtectStructs[gActiveBattler].confusionSelfDmg = 0;
gProtectStructs[gActiveBattler].targetNotAffected = 0;
gProtectStructs[gActiveBattler].targetAffected = 0;
gProtectStructs[gActiveBattler].chargingTurn = 0;
gProtectStructs[gActiveBattler].fleeFlag = 0;
gProtectStructs[gActiveBattler].usedImprisonedMove = 0;

View file

@ -4913,8 +4913,8 @@ static void Cmd_moveend(void)
else
gBattleScripting.moveendState++;
break;
case MOVEEND_KINGSROCK: // king's rock and shell bell
// these effects will occur at each hit in a multi-strike move
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++;
@ -5043,6 +5043,11 @@ static void Cmd_moveend(void)
gBattleScripting.moveendState++;
break;
case MOVEEND_NEXT_TARGET: // For moves hitting two opposing Pokemon.
// Set a flag if move hits either target (for throat spray that can't check damage)
if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
gProtectStructs[gBattlerAttacker].targetAffected = 1;
if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
&& gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !gProtectStructs[gBattlerAttacker].chargingTurn
@ -5285,6 +5290,7 @@ static void Cmd_moveend(void)
if (gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget)
*(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget & 0x3;
gProtectStructs[gBattlerAttacker].usesBouncedMove = 0;
gProtectStructs[gBattlerAttacker].targetAffected = 0;
gBattleStruct->ateBoost[gBattlerAttacker] = 0;
gStatuses3[gBattlerAttacker] &= ~(STATUS3_ME_FIRST);
gSpecialStatuses[gBattlerAttacker].gemBoost = 0;
@ -5554,7 +5560,7 @@ bool32 CanBattlerSwitch(u32 battlerId)
}
else
{
// check if attacker side has mon to switch into
// Check if attacker side has mon to switch into
battlerIn1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
@ -6147,7 +6153,7 @@ static void Cmd_endlinkbattle(void)
}
static void Cmd_returntoball(void)
{
{
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
BtlController_EmitReturnMonToBall(0, 1);
MarkBattlerForControllerExec(gActiveBattler);
@ -7802,7 +7808,7 @@ static void Cmd_various(void)
if (GetBattlerAbility(gActiveBattler) == ABILITY_BEAST_BOOST
&& HasAttackerFaintedTarget()
&& !NoAliveMonsForEitherParty()
&& CompareStat(gActiveBattler, i, MAX_STAT_STAGE, CMP_LESS_THAN))
&& CompareStat(gBattlerAttacker, i, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gBattleMons[gBattlerAttacker].statStages[i]++;
SET_STATCHANGER(i, 1, FALSE);

View file

@ -1410,7 +1410,6 @@ void CancelMultiTurnMoves(u8 battler)
bool8 WasUnableToUseMove(u8 battler)
{
if (gProtectStructs[battler].prlzImmobility
|| gProtectStructs[battler].targetNotAffected
|| gProtectStructs[battler].usedImprisonedMove
|| gProtectStructs[battler].loveImmobility
|| gProtectStructs[battler].usedDisabledMove
@ -6399,10 +6398,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
switch (atkHoldEffect)
{
case HOLD_EFFECT_SHELL_BELL:
if (gBattleMoveDamage != 0 // Need to have done damage
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& gSpecialStatuses[gBattlerTarget].dmg != 0
&& gSpecialStatuses[gBattlerTarget].dmg != 0xFFFF
if (gSpecialStatuses[gBattlerAttacker].damagedMons // Need to have done damage
&& gBattlerAttacker != gBattlerTarget
&& gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP
&& gBattleMons[gBattlerAttacker].hp != 0)
@ -6435,8 +6431,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
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))
if (gProtectStructs[gBattlerAttacker].targetAffected
&& gBattleMons[gBattlerAttacker].hp != 0
&& gBattleMoves[gCurrentMove].flags & FLAG_SOUND
&& CompareStat(gBattlerAttacker, STAT_SPATK, MAX_STAT_STAGE, CMP_LESS_THAN)