prevent stat-raising damage effects if battle will end

This commit is contained in:
ghoulslash 2021-12-17 10:24:07 -05:00
parent 961710ddd9
commit 31bbc4ddde
2 changed files with 62 additions and 50 deletions

View File

@ -1089,20 +1089,20 @@ BattleScript_VCreateStatAnim:
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF | BIT_SPEED, STAT_CHANGE_NEGATIVE | STAT_CHANGE_CANT_PREVENT playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF | BIT_SPEED, STAT_CHANGE_NEGATIVE | STAT_CHANGE_CANT_PREVENT
setstatchanger STAT_DEF, 1, TRUE setstatchanger STAT_DEF, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, BattleScript_VCreateTrySpDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, BattleScript_VCreateTrySpDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_VCreateTrySpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_VCreateTrySpDef
printfromtable gStatUpStringIds printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_VCreateTrySpDef: BattleScript_VCreateTrySpDef:
setstatchanger STAT_SPDEF, 1, TRUE setstatchanger STAT_SPDEF, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, BattleScript_VCreateTrySpeed statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, BattleScript_VCreateTrySpeed
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_VCreateTrySpeed jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_VCreateTrySpeed
printfromtable gStatUpStringIds printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_VCreateTrySpeed: BattleScript_VCreateTrySpeed:
setstatchanger STAT_SPEED, 1, TRUE setstatchanger STAT_SPEED, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, BattleScript_VCreateStatLossRet statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, BattleScript_VCreateStatLossRet
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_VCreateStatLossRet jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_VCreateStatLossRet
printfromtable gStatUpStringIds printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_VCreateStatLossRet: BattleScript_VCreateStatLossRet:
return return

View File

@ -3205,11 +3205,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
break; break;
case MOVE_EFFECT_ALL_STATS_UP: case MOVE_EFFECT_ALL_STATS_UP:
if (NoAliveMonsForEitherParty()) if (!NoAliveMonsForEitherParty())
{
gBattlescriptCurrInstr++;
}
else
{ {
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_AllStatsUp; gBattlescriptCurrInstr = BattleScript_AllStatsUp;
@ -3248,12 +3244,18 @@ void SetMoveEffect(bool32 primary, u32 certain)
} }
break; break;
case MOVE_EFFECT_ATK_DEF_DOWN: // SuperPower case MOVE_EFFECT_ATK_DEF_DOWN: // SuperPower
BattleScriptPush(gBattlescriptCurrInstr + 1); if (!NoAliveMonsForEitherParty())
gBattlescriptCurrInstr = BattleScript_AtkDefDown; {
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_AtkDefDown;
}
break; break;
case MOVE_EFFECT_DEF_SPDEF_DOWN: // Close Combat case MOVE_EFFECT_DEF_SPDEF_DOWN: // Close Combat
BattleScriptPush(gBattlescriptCurrInstr + 1); if (!NoAliveMonsForEitherParty())
gBattlescriptCurrInstr = BattleScript_DefSpDefDown; {
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_DefSpDefDown;
}
break; break;
case MOVE_EFFECT_RECOIL_25: // Take Down, 25% recoil case MOVE_EFFECT_RECOIL_25: // Take Down, 25% recoil
gBattleMoveDamage = (gHpDealt) / 4; gBattleMoveDamage = (gHpDealt) / 4;
@ -3308,8 +3310,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
} }
break; break;
case MOVE_EFFECT_SP_ATK_TWO_DOWN: // Overheat case MOVE_EFFECT_SP_ATK_TWO_DOWN: // Overheat
BattleScriptPush(gBattlescriptCurrInstr + 1); if (!NoAliveMonsForEitherParty())
gBattlescriptCurrInstr = BattleScript_SAtkDown2; {
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_SAtkDown2;
}
break; break;
case MOVE_EFFECT_CLEAR_SMOG: case MOVE_EFFECT_CLEAR_SMOG:
for (i = 0; i < NUM_BATTLE_STATS; i++) for (i = 0; i < NUM_BATTLE_STATS; i++)
@ -3369,51 +3374,58 @@ void SetMoveEffect(bool32 primary, u32 certain)
} }
break; break;
case MOVE_EFFECT_SPECTRAL_THIEF: case MOVE_EFFECT_SPECTRAL_THIEF:
gBattleStruct->stolenStats[0] = 0; // Stats to steal. if (!NoAliveMonsForEitherParty())
gBattleScripting.animArg1 = 0;
for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++)
{ {
if (gBattleMons[gBattlerTarget].statStages[i] > DEFAULT_STAT_STAGE && gBattleMons[gBattlerAttacker].statStages[i] != MAX_STAT_STAGE) gBattleStruct->stolenStats[0] = 0; // Stats to steal.
gBattleScripting.animArg1 = 0;
for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++)
{ {
gBattleStruct->stolenStats[0] |= gBitTable[i]; if (gBattleMons[gBattlerTarget].statStages[i] > DEFAULT_STAT_STAGE && gBattleMons[gBattlerAttacker].statStages[i] != MAX_STAT_STAGE)
// Store by how many stages to raise the stat.
gBattleStruct->stolenStats[i] = gBattleMons[gBattlerTarget].statStages[i] - DEFAULT_STAT_STAGE;
while (gBattleMons[gBattlerAttacker].statStages[i] + gBattleStruct->stolenStats[i] > MAX_STAT_STAGE)
gBattleStruct->stolenStats[i]--;
gBattleMons[gBattlerTarget].statStages[i] = DEFAULT_STAT_STAGE;
if (gBattleStruct->stolenStats[i] >= 2)
byTwo++;
if (gBattleScripting.animArg1 == 0)
{ {
if (byTwo) gBattleStruct->stolenStats[0] |= gBitTable[i];
gBattleScripting.animArg1 = STAT_ANIM_PLUS2 - 1 + i; // Store by how many stages to raise the stat.
gBattleStruct->stolenStats[i] = gBattleMons[gBattlerTarget].statStages[i] - DEFAULT_STAT_STAGE;
while (gBattleMons[gBattlerAttacker].statStages[i] + gBattleStruct->stolenStats[i] > MAX_STAT_STAGE)
gBattleStruct->stolenStats[i]--;
gBattleMons[gBattlerTarget].statStages[i] = DEFAULT_STAT_STAGE;
if (gBattleStruct->stolenStats[i] >= 2)
byTwo++;
if (gBattleScripting.animArg1 == 0)
{
if (byTwo)
gBattleScripting.animArg1 = STAT_ANIM_PLUS2 - 1 + i;
else
gBattleScripting.animArg1 = STAT_ANIM_PLUS1 - 1 + i;
}
else else
gBattleScripting.animArg1 = STAT_ANIM_PLUS1 - 1 + i; {
} if (byTwo)
else gBattleScripting.animArg1 = STAT_ANIM_MULTIPLE_PLUS2;
{ else
if (byTwo) gBattleScripting.animArg1 = STAT_ANIM_MULTIPLE_PLUS1;
gBattleScripting.animArg1 = STAT_ANIM_MULTIPLE_PLUS2; }
else
gBattleScripting.animArg1 = STAT_ANIM_MULTIPLE_PLUS1;
} }
} }
}
if (gBattleStruct->stolenStats[0] != 0) if (gBattleStruct->stolenStats[0] != 0)
{ {
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_SpectralThiefSteal; gBattlescriptCurrInstr = BattleScript_SpectralThiefSteal;
}
} }
break; break;
case MOVE_EFFECT_V_CREATE: case MOVE_EFFECT_V_CREATE:
BattleScriptPush(gBattlescriptCurrInstr + 1); if (!NoAliveMonsForEitherParty())
gBattlescriptCurrInstr = BattleScript_VCreateStatLoss; {
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_VCreateStatLoss;
}
break; break;
case MOVE_EFFECT_CORE_ENFORCER: case MOVE_EFFECT_CORE_ENFORCER:
if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)
&& !NoAliveMonsForEitherParty())
{ {
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectCoreEnforcer; gBattlescriptCurrInstr = BattleScript_MoveEffectCoreEnforcer;