Fix wrong Contrary message when affected by Intimidate (#2723)

This commit is contained in:
ghoulslash 2023-03-02 09:38:00 -05:00 committed by GitHub
commit 4e138fa4b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 168 additions and 22 deletions

View File

@ -485,15 +485,13 @@ BattleScript_Teatimevul:
moveendcase MOVEEND_CLEAR_BITS
goto BattleScript_MoveEnd
BattleScript_Teatimesorb:
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
moveendto MOVEEND_NEXT_TARGET
jumpifnexttargetvalid BattleScript_TeatimeLoop
moveendcase MOVEEND_CLEAR_BITS
goto BattleScript_MoveEnd
BattleScript_Teatimerod:
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
playstatchangeanimation BS_TARGET, BIT_SPATK, STAT_CHANGE_BY_TWO
setstatchanger STAT_SPATK, 1, FALSE
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_TeatimeBuffer
@ -505,8 +503,7 @@ BattleScript_Teatimerod:
moveendcase MOVEEND_CLEAR_BITS
goto BattleScript_MoveEnd
BattleScript_Teatimemotor:
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
playstatchangeanimation BS_TARGET, BIT_SPEED, STAT_CHANGE_BY_TWO
setstatchanger STAT_SPEED, 1, FALSE
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_TeatimeBuffer
@ -3404,8 +3401,7 @@ BattleScript_EffectAbsorb::
setbyte cMULTISTRING_CHOOSER, B_MSG_ABSORB
goto BattleScript_AbsorbUpdateHp
BattleScript_AbsorbLiquidOoze::
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
manipulatedamage DMG_CHANGE_SIGN
setbyte cMULTISTRING_CHOOSER, B_MSG_ABSORB_OOZE
BattleScript_AbsorbUpdateHp::
@ -5523,9 +5519,8 @@ BattleScript_NotAffected::
goto BattleScript_MoveEnd
BattleScript_NotAffectedAbilityPopUp::
copybyte gBattlerAbility, gBattlerTarget
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
orhalfword gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
resultmessage
waitmessage B_WAIT_TIME_LONG
@ -6014,8 +6009,7 @@ BattleScript_EffectSkillSwap:
attackanimation
waitanimation
.if B_ABILITY_POP_UP == TRUE
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
pause 20
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp
@ -7770,9 +7764,8 @@ BattleScript_EnduredMsg::
return
BattleScript_SturdiedMsg::
copybyte gBattlerAbility, gBattlerTarget
pause B_WAIT_TIME_SHORTEST
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
printstring STRINGID_ENDUREDSTURDY
waitmessage B_WAIT_TIME_LONG
return
@ -7913,8 +7906,7 @@ BattleScript_CudChewActivates::
BattleScript_TargetFormChange::
pause 5
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
printstring STRINGID_EMPTYSTRING3
waitmessage 1
handleformchange BS_TARGET, 0
@ -7926,8 +7918,7 @@ BattleScript_TargetFormChange::
BattleScript_TargetFormChangeWithString::
pause 5
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
printstring STRINGID_EMPTYSTRING3
waitmessage 1
handleformchange BS_TARGET, 0
@ -8390,6 +8381,8 @@ BattleScript_AbilityRaisesDefenderStat::
waitmessage B_WAIT_TIME_LONG
return
BattleScript_AbilityPopUpTarget:
copybyte gBattlerAbility, gBattlerTarget
BattleScript_AbilityPopUp:
.if B_ABILITY_POP_UP == TRUE
showabilitypopup BS_ABILITY_BATTLER
@ -8629,8 +8622,10 @@ BattleScript_IntimidateEffect:
copybyte sBATTLER, gBattlerAttacker
statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_ALLOW_PTR, BattleScript_IntimidateLoopIncrement
setgraphicalstatchangevalues
jumpifability BS_TARGET, ABILITY_CONTRARY, BattleScript_IntimidateContrary
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printstring STRINGID_PKMNCUTSATTACKWITH
BattleScript_IntimidateEffect_WaitString:
waitmessage B_WAIT_TIME_LONG
copybyte sBATTLER, gBattlerTarget
call BattleScript_TryAdrenalineOrb
@ -8642,6 +8637,16 @@ BattleScript_IntimidateEnd:
pause B_WAIT_TIME_MED
end3
BattleScript_IntimidateContrary:
call BattleScript_AbilityPopUpTarget
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_IntimidateContrary_WontIncrease
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printfromtable gStatUpStringIds
goto BattleScript_IntimidateEffect_WaitString
BattleScript_IntimidateContrary_WontIncrease:
printstring STRINGID_TARGETSTATWONTGOHIGHER
goto BattleScript_IntimidateEffect_WaitString
BattleScript_IntimidatePrevented:
call BattleScript_AbilityPopUp
pause B_WAIT_TIME_LONG
@ -8655,8 +8660,7 @@ BattleScript_IntimidatePrevented_Item:
BattleScript_IntimidateInReverse:
copybyte sBATTLER, gBattlerTarget
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
pause B_WAIT_TIME_SHORT
modifybattlerstatstage BS_TARGET, STAT_ATK, INCREASE, 1, BattleScript_IntimidateLoopIncrement, ANIM_ON
call BattleScript_TryAdrenalineOrb
@ -8899,8 +8903,7 @@ BattleScript_SturdyPreventsOHKO::
BattleScript_DampStopsExplosion::
pause B_WAIT_TIME_SHORT
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpTarget
printstring STRINGID_PKMNPREVENTSUSAGE
pause B_WAIT_TIME_LONG
moveendto MOVEEND_NEXT_TARGET

143
test/ability_contrary.c Normal file
View File

@ -0,0 +1,143 @@
#include "global.h"
#include "test_battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
}
SINGLE_BATTLE_TEST("Contrary raises Attack when Intimidated", s16 damage)
{
u32 ability;
PARAMETRIZE { ability = ABILITY_CONTRARY; }
PARAMETRIZE { ability = ABILITY_TANGLED_FEET; }
GIVEN {
PLAYER(SPECIES_MIGHTYENA) { Ability(ABILITY_INTIMIDATE); }
OPPONENT(SPECIES_SPINDA) { Ability(ability); }
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_INTIMIDATE);
if (ability == ABILITY_CONTRARY) {
ABILITY_POPUP(opponent, ABILITY_CONTRARY);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Spinda's attack rose!");
}
HP_BAR(player, captureDamage: &results[i].damage);
}
FINALLY {
EXPECT_MUL_EQ(results[1].damage, Q_4_12(2.125), results[0].damage);
}
}
SINGLE_BATTLE_TEST("Contrary raises stats after using a move which would normally lower them: Overheat", s16 damageBefore, s16 damageAfter)
{
u32 ability;
PARAMETRIZE { ability = ABILITY_CONTRARY; }
PARAMETRIZE { ability = ABILITY_TANGLED_FEET; }
GIVEN {
ASSUME(gBattleMoves[MOVE_OVERHEAT].effect == EFFECT_OVERHEAT);
ASSUME(gBattleMoves[MOVE_OVERHEAT].split == SPLIT_SPECIAL);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SPINDA) { Ability(ability); }
} WHEN {
TURN { MOVE(opponent, MOVE_OVERHEAT); }
TURN { MOVE(opponent, MOVE_OVERHEAT); }
} SCENE {
MESSAGE("Foe Spinda used Overheat!");
HP_BAR(player, captureDamage: &results[i].damageBefore);
if (ability == ABILITY_CONTRARY) {
// ABILITY_POPUP(opponent, ABILITY_CONTRARY);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Spinda's sp. attack sharply rose!");
}
else {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Spinda's sp. attack harshly fell!");
}
// MESSAGE("Foe Spinda used Overheat!");
HP_BAR(player, captureDamage: &results[i].damageAfter);
if (ability == ABILITY_CONTRARY) {
// ABILITY_POPUP(opponent, ABILITY_CONTRARY);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Spinda's sp. attack sharply rose!");
}
else {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Spinda's sp. attack harshly fell!");
}
}
FINALLY {
EXPECT_MUL_EQ(results[0].damageBefore, Q_4_12(2.0), results[0].damageAfter);
EXPECT_MUL_EQ(results[1].damageBefore, Q_4_12(0.5), results[1].damageAfter);
}
}
SINGLE_BATTLE_TEST("Contrary lowers a stat after using a move which would normally raise it: Swords Dance", s16 damageBefore, s16 damageAfter)
{
u32 ability;
PARAMETRIZE { ability = ABILITY_CONTRARY; }
PARAMETRIZE { ability = ABILITY_TANGLED_FEET; }
GIVEN {
ASSUME(gBattleMoves[MOVE_SWORDS_DANCE].effect == EFFECT_ATTACK_UP_2);
PLAYER(SPECIES_WOBBUFFET) {Defense(102); }
OPPONENT(SPECIES_SPINDA) { Ability(ability); Attack(100); }
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
TURN { MOVE(opponent, MOVE_SWORDS_DANCE); }
TURN { MOVE(opponent, MOVE_TACKLE); }
} SCENE {
MESSAGE("Foe Spinda used Tackle!");
HP_BAR(player, captureDamage: &results[i].damageBefore);
//MESSAGE("Foe Spinda used Swords Dance!");
if (ability == ABILITY_CONTRARY) {
// ABILITY_POPUP(opponent, ABILITY_CONTRARY);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Spinda's attack harshly fell!");
}
else {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Spinda's attack sharply rose!");
}
// MESSAGE("Foe Spinda used Tackle!");
HP_BAR(player, captureDamage: &results[i].damageAfter);
}
FINALLY {
EXPECT_MUL_EQ(results[0].damageBefore, Q_4_12(0.5), results[0].damageAfter);
EXPECT_MUL_EQ(results[1].damageBefore, Q_4_12(2.0), results[1].damageAfter);
}
}
SINGLE_BATTLE_TEST("Contrary raises a stat after using a move which would normally lower it: Growl", s16 damage)
{
u32 ability;
PARAMETRIZE { ability = ABILITY_CONTRARY; }
PARAMETRIZE { ability = ABILITY_TANGLED_FEET; }
GIVEN {
ASSUME(gBattleMoves[MOVE_GROWL].effect == EFFECT_ATTACK_DOWN);
PLAYER(SPECIES_WOBBUFFET) {Speed(3); }
OPPONENT(SPECIES_SPINDA) { Ability(ability); Speed(2); }
} WHEN {
TURN { MOVE(player, MOVE_GROWL); MOVE(opponent, MOVE_TACKLE); }
} SCENE {
MESSAGE("Wobbuffet used Growl!");
if (ability == ABILITY_CONTRARY) {
// ABILITY_POPUP(opponent, ABILITY_CONTRARY);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Spinda's attack rose!");
}
else {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Spinda's attack fell!");
}
MESSAGE("Foe Spinda used Tackle!");
HP_BAR(player, captureDamage: &results[i].damage);
}
FINALLY {
EXPECT_MUL_EQ(results[1].damage, Q_4_12(2.125), results[0].damage);
}
}