Fix abilities that raise target's stat after hit

Fix Justified, Berserk, Rattled, Stamina and Water Compaction printing the wrong message when they activate. Steam Engine was also updated to follow the gen 5+ ability activation method style.
This commit is contained in:
BuffelSaft 2022-11-03 21:54:56 +13:00
parent 6363e61043
commit 736ca893b6
3 changed files with 23 additions and 6 deletions

View File

@ -9880,3 +9880,13 @@ BattleScript_SymbiosisActivates::
printstring STRINGID_SYMBIOSISITEMPASS
waitmessage B_WAIT_TIME_LONG
return
BattleScript_TargetAbilityStatRaiseRet::
copybyte gBattlerAbility, gEffectBattler
copybyte gBattlerAttacker, gBattlerTarget
call BattleScript_AbilityPopUp
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN, BattleScript_TargetAbilityStatRaiseRet_End
setgraphicalstatchangevalues
call BattleScript_StatUp
BattleScript_TargetAbilityStatRaiseRet_End:
return

View File

@ -429,6 +429,7 @@ extern const u8 BattleScript_DefDownSpeedUp[];
extern const u8 BattleScript_AffectionBasedStatusHeal[];
extern const u8 BattleScript_AffectionBasedEndurance[];
extern const u8 BattleScript_SymbiosisActivates[];
extern const u8 BattleScript_TargetAbilityStatRaiseRet[];
// zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -5159,9 +5159,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& moveType == TYPE_DARK
&& CompareStat(battler, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_ATK, 1, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5172,9 +5173,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& (moveType == TYPE_DARK || moveType == TYPE_BUG || moveType == TYPE_GHOST)
&& CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_SPEED, 1, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5185,9 +5187,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& moveType == TYPE_WATER
&& CompareStat(battler, STAT_DEF, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_DEF, 2, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5197,9 +5200,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& IsBattlerAlive(battler)
&& CompareStat(battler, STAT_DEF, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_DEF, 1, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5214,9 +5218,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& !(TestSheerForceFlag(gBattlerAttacker, gCurrentMove))
&& CompareStat(battler, STAT_SPATK, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_SPATK, 1, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5554,9 +5559,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN)
&& (moveType == TYPE_FIRE || moveType == TYPE_WATER))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_SPEED, 6, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;