Requested changes, Sticky Web edge case

Fix issues found by ghoulslash, and make sure Defiant works properly with Sticky Web and Court Change.
This commit is contained in:
BuffelSaft 2022-04-27 21:51:10 +12:00
parent 5358cc0a00
commit af6242f2e0
5 changed files with 10 additions and 6 deletions

View file

@ -7290,7 +7290,7 @@ BattleScript_DefDownSpeedUpTryDef::
setstatchanger STAT_DEF, 1, TRUE setstatchanger STAT_DEF, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR | MOVE_EFFECT_CERTAIN, BattleScript_DefDownSpeedUpTrySpeed statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR | MOVE_EFFECT_CERTAIN, BattleScript_DefDownSpeedUpTrySpeed
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_DefDownSpeedUpTrySpeed jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_DefDownSpeedUpTrySpeed
printfromtable gStatUpStringIds printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_DefDownSpeedUpTrySpeed: BattleScript_DefDownSpeedUpTrySpeed:
playstatchangeanimation BS_ATTACKER, BIT_SPEED, 0 playstatchangeanimation BS_ATTACKER, BIT_SPEED, 0

View file

@ -39,7 +39,7 @@
#define sABILITY_OVERWRITE (gBattleScripting + 0x34) // abilityPopupOverwrite #define sABILITY_OVERWRITE (gBattleScripting + 0x34) // abilityPopupOverwrite
#define sSWITCH_CASE (gBattleScripting + 0x36) // switchCase #define sSWITCH_CASE (gBattleScripting + 0x36) // switchCase
#define sBERRY_OVERRIDE (gBattleScripting + 0x37) // overrideBerryRequirements #define sBERRY_OVERRIDE (gBattleScripting + 0x37) // overrideBerryRequirements
#define sSTICKY_WEB_STAT_DROP (gBattleScripting + 0x38) // #define sSTICKY_WEB_STAT_DROP (gBattleScripting + 0x38) // stickyWebStatDrop
// Array entries for battle communication // Array entries for battle communication
#define MULTIUSE_STATE 0 #define MULTIUSE_STATE 0

View file

@ -566,7 +566,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
GET_MOVE_TYPE(move, moveType); GET_MOVE_TYPE(move, moveType);
// check non-user target // check non-user target
if (moveTarget & MOVE_TARGET_USER) if (!(moveTarget & MOVE_TARGET_USER))
{ {
// handle negative checks on non-user target // handle negative checks on non-user target
// check powder moves // check powder moves

View file

@ -3504,8 +3504,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattleMons[gBattlerAttacker].status2 |= STATUS2_ESCAPE_PREVENTION; gBattleMons[gBattlerAttacker].status2 |= STATUS2_ESCAPE_PREVENTION;
break; break;
case MOVE_EFFECT_SCALE_SHOT: case MOVE_EFFECT_SCALE_SHOT:
BattleScriptPush(gBattlescriptCurrInstr + 1); if (!NoAliveMonsForEitherParty())
gBattlescriptCurrInstr = BattleScript_DefDownSpeedUp; {
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_DefDownSpeedUp;
}
break; break;
} }
} }
@ -7700,6 +7703,7 @@ static bool32 CourtChangeSwapSideStatuses(void)
UPDATE_COURTCHANGED_BATTLER(auroraVeilBattlerId); UPDATE_COURTCHANGED_BATTLER(auroraVeilBattlerId);
UPDATE_COURTCHANGED_BATTLER(tailwindBattlerId); UPDATE_COURTCHANGED_BATTLER(tailwindBattlerId);
UPDATE_COURTCHANGED_BATTLER(luckyChantBattlerId); UPDATE_COURTCHANGED_BATTLER(luckyChantBattlerId);
gBattleStruct->stickyWebUser ^= BIT_SIDE;
// Track which side originally set the Sticky Web // Track which side originally set the Sticky Web
SWAP(sideTimerPlayer->stickyWebBattlerSide, sideTimerOpp->stickyWebBattlerSide, temp); SWAP(sideTimerPlayer->stickyWebBattlerSide, sideTimerOpp->stickyWebBattlerSide, temp);

View file

@ -1569,7 +1569,7 @@ void PrepareStringBattle(u16 stringId, u8 battler)
&& ((targetAbility == ABILITY_DEFIANT && CompareStat(gBattlerTarget, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN)) && ((targetAbility == ABILITY_DEFIANT && CompareStat(gBattlerTarget, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
|| (targetAbility == ABILITY_COMPETITIVE && CompareStat(gBattlerTarget, STAT_SPATK, MAX_STAT_STAGE, CMP_LESS_THAN))) || (targetAbility == ABILITY_COMPETITIVE && CompareStat(gBattlerTarget, STAT_SPATK, MAX_STAT_STAGE, CMP_LESS_THAN)))
&& gSpecialStatuses[gBattlerTarget].changedStatsBattlerId != BATTLE_PARTNER(gBattlerTarget) && gSpecialStatuses[gBattlerTarget].changedStatsBattlerId != BATTLE_PARTNER(gBattlerTarget)
// && gSpecialStatuses[gBattlerTarget].changedStatsBattlerId != gBattlerTarget) // Why was this here? Needs investigating && ((gSpecialStatuses[gBattlerTarget].changedStatsBattlerId != gBattlerTarget) || gBattleScripting.stickyWebStatDrop == 1)
&& !(gBattleScripting.stickyWebStatDrop == 1 && gSideTimers[targetSide].stickyWebBattlerSide == targetSide)) // Sticky Web must have been set by the foe && !(gBattleScripting.stickyWebStatDrop == 1 && gSideTimers[targetSide].stickyWebBattlerSide == targetSide)) // Sticky Web must have been set by the foe
{ {
gBattleScripting.stickyWebStatDrop = 0; gBattleScripting.stickyWebStatDrop = 0;