Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ability popups for Skill Swap, Mummy/Lingering Aroma, Worry Seed, Simple Beam, fix Doodle/Role Play bugs #5493

Merged
merged 7 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 56 additions & 38 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -214,27 +214,25 @@ BattleScript_EffectDoodle::
attackcanceler
attackstring
ppreduce
trycopyability BS_ATTACKER, BattleScript_ButItFailed
attackanimation
waitanimation
setbyte gBattleCommunication, 0
goto BattleScript_EffectDoodle_AfterCopy
BattleScript_EffectDoodle_CopyAbility:
trycopyability BS_ATTACKER, BattleScript_ButItFailed
trycopyability BS_ATTACKER, BattleScript_MoveEnd
BattleScript_EffectDoodle_AfterCopy:
.if B_ABILITY_POP_UP == TRUE
setbyte sFIXED_ABILITY_POPUP, TRUE
showabilitypopup BS_ATTACKER
pause 60
sethword sABILITY_OVERWRITE, 0
updateabilitypopup BS_ATTACKER
pause 20
destroyabilitypopup
pause 40
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUpOverwriteThenNormal
.endif
recordability BS_ATTACKER
printstring STRINGID_PKMNCOPIEDFOE
waitmessage B_WAIT_TIME_LONG
switchinabilities BS_ATTACKER
jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_MoveEnd
addbyte gBattleCommunication, 1
jumpifnoally BS_TARGET, BattleScript_MoveEnd
jumpifnoally BS_ATTACKER, BattleScript_MoveEnd
setallytonextattacker BattleScript_EffectDoodle_CopyAbility
goto BattleScript_MoveEnd

Expand Down Expand Up @@ -2346,6 +2344,11 @@ BattleScript_EffectSimpleBeam::
setabilitysimple BS_TARGET, BattleScript_ButItFailed
attackanimation
waitanimation
.if B_ABILITY_POP_UP == TRUE
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUpOverwriteThenNormal
.endif
recordability BS_TARGET
printstring STRINGID_PKMNACQUIREDSIMPLE
waitmessage B_WAIT_TIME_LONG
trytoclearprimalweather
Expand Down Expand Up @@ -2444,11 +2447,17 @@ BattleScript_EffectWorrySeed::
tryworryseed BattleScript_ButItFailed
attackanimation
waitanimation
.if B_ABILITY_POP_UP == TRUE
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUpOverwriteThenNormal
.endif
recordability BS_TARGET
printstring STRINGID_PKMNACQUIREDABILITY
waitmessage B_WAIT_TIME_LONG
trytoclearprimalweather
tryrevertweatherform
flushtextbox
tryendneutralizinggas BS_TARGET
goto BattleScript_MoveEnd

BattleScript_EffectPowerSplit::
Expand Down Expand Up @@ -5034,15 +5043,10 @@ BattleScript_EffectRolePlay::
attackanimation
waitanimation
.if B_ABILITY_POP_UP == TRUE
setbyte sFIXED_ABILITY_POPUP, TRUE
showabilitypopup BS_ATTACKER
pause 60
sethword sABILITY_OVERWRITE, 0
updateabilitypopup BS_ATTACKER
pause 20
destroyabilitypopup
pause 40
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUpOverwriteThenNormal
.endif
recordability BS_ATTACKER
printstring STRINGID_PKMNCOPIEDFOE
waitmessage B_WAIT_TIME_LONG
switchinabilities BS_ATTACKER
Expand Down Expand Up @@ -5185,12 +5189,17 @@ BattleScript_EffectSkillSwap::
tryswapabilities BattleScript_ButItFailed
attackanimation
waitanimation
jumpiftargetally BattleScript_EffectSkillSwap_AfterAbilityPopUp
.if B_ABILITY_POP_UP == TRUE
call BattleScript_AbilityPopUpTarget
pause 20
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpOverwriteThenNormal
copybyte gBattlerAbility, gBattlerTarget
copyhword sABILITY_OVERWRITE, gLastUsedAbility
call BattleScript_AbilityPopUpOverwriteThenNormal
.endif
BattleScript_EffectSkillSwap_AfterAbilityPopUp:
recordability BS_ATTACKER
recordability BS_TARGET
printstring STRINGID_PKMNSWAPPEDABILITIES
waitmessage B_WAIT_TIME_LONG
.if B_SKILL_SWAP >= GEN_4
Expand Down Expand Up @@ -7605,6 +7614,18 @@ BattleScript_AbilityPopUpScripting:
sethword sABILITY_OVERWRITE, 0
return

BattleScript_AbilityPopUpOverwriteThenNormal:
setbyte sFIXED_ABILITY_POPUP, TRUE
showabilitypopup BS_ABILITY_BATTLER
pause 60
sethword sABILITY_OVERWRITE, 0
updateabilitypopup BS_ABILITY_BATTLER
pause 20
recordability BS_ABILITY_BATTLER
destroyabilitypopup
pause 40
return

BattleScript_SpeedBoostActivates::
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_SpeedBoostActivatesEnd
call BattleScript_AbilityPopUp
Expand Down Expand Up @@ -8366,33 +8387,30 @@ BattleScript_CursedBodyActivates::
return

BattleScript_MummyActivates::
call BattleScript_AbilityPopUp
.if B_ABILITY_POP_UP == TRUE
call BattleScript_AbilityPopUpTarget
setbyte sFIXED_ABILITY_POPUP, TRUE
copybyte gBattlerAbility, gBattlerAttacker
copyhword sABILITY_OVERWRITE, gLastUsedAbility
call BattleScript_AbilityPopUpOverwriteThenNormal
.endif
recordability BS_TARGET
recordability BS_ATTACKER
printstring STRINGID_ATTACKERACQUIREDABILITY
waitmessage B_WAIT_TIME_LONG
return

BattleScript_WanderingSpiritActivates::
.if B_ABILITY_POP_UP == TRUE
setbyte sFIXED_ABILITY_POPUP, TRUE
copybyte gBattlerAbility, gBattlerTarget
sethword sABILITY_OVERWRITE, ABILITY_WANDERING_SPIRIT
showabilitypopup BS_TARGET
pause 60
sethword sABILITY_OVERWRITE, 0
updateabilitypopup BS_TARGET
pause 20
destroyabilitypopup
pause 40
call BattleScript_AbilityPopUpOverwriteThenNormal
copybyte gBattlerAbility, gBattlerAttacker
setbyte sFIXED_ABILITY_POPUP, TRUE
copyhword sABILITY_OVERWRITE, gLastUsedAbility
showabilitypopup BS_ATTACKER
pause 60
sethword sABILITY_OVERWRITE, 0
updateabilitypopup BS_ATTACKER
pause 20
destroyabilitypopup
pause 40
call BattleScript_AbilityPopUpOverwriteThenNormal
.endif
recordability BS_TARGET
recordability BS_ATTACKER
printstring STRINGID_SWAPPEDABILITIES
waitmessage B_WAIT_TIME_LONG
switchinabilities BS_ATTACKER
Expand Down
4 changes: 2 additions & 2 deletions src/battle_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ static const u8 sText_HealingWishCameTrue[] = _("The healing wish came true\nfor
static const u8 sText_HealingWishHealed[] = _("{B_ATK_NAME_WITH_PREFIX} regained health!");
static const u8 sText_LunarDanceCameTrue[] = _("{B_ATK_NAME_WITH_PREFIX} became cloaked\nin mystical moonlight!");
static const u8 sText_CursedBodyDisabled[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1} was disabled\nby {B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}!");
static const u8 sText_AttackerAquiredAbility[] = _("{B_ATK_NAME_WITH_PREFIX} acquired\n{B_LAST_ABILITY}!");
static const u8 sText_AttackerAcquiredAbility[] = _("{B_ATK_NAME_WITH_PREFIX} acquired\n{B_ATK_ABILITY}!");
static const u8 sText_TargetStatWontGoHigher[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}\nwon't go higher!");
static const u8 sText_PkmnMoveBouncedViaAbility[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE} was\nbounced back by {B_DEF_NAME_WITH_PREFIX}'s\l{B_DEF_ABILITY}!");
static const u8 sText_ImposterTransform[] = _("{B_ATK_NAME_WITH_PREFIX} transformed into\n{B_DEF_NAME_WITH_PREFIX} using {B_LAST_ABILITY}!");
Expand Down Expand Up @@ -1477,7 +1477,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_HEALINGWISHHEALED - BATTLESTRINGS_TABLE_START] = sText_HealingWishHealed,
[STRINGID_LUNARDANCECAMETRUE - BATTLESTRINGS_TABLE_START] = sText_LunarDanceCameTrue,
[STRINGID_CUSEDBODYDISABLED - BATTLESTRINGS_TABLE_START] = sText_CursedBodyDisabled,
[STRINGID_ATTACKERACQUIREDABILITY - BATTLESTRINGS_TABLE_START] = sText_AttackerAquiredAbility,
[STRINGID_ATTACKERACQUIREDABILITY - BATTLESTRINGS_TABLE_START] = sText_AttackerAcquiredAbility,
[STRINGID_TARGETABILITYSTATLOWER - BATTLESTRINGS_TABLE_START] = sText_TargetAbilityLoweredStat,
[STRINGID_TARGETSTATWONTGOHIGHER - BATTLESTRINGS_TABLE_START] = sText_TargetStatWontGoHigher,
[STRINGID_PKMNMOVEBOUNCEDABILITY - BATTLESTRINGS_TABLE_START] = sText_PkmnMoveBouncedViaAbility,
Expand Down
12 changes: 8 additions & 4 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -9782,6 +9782,7 @@ static void Cmd_various(void)
if (gBattleMons[gBattlerTarget].ability == ABILITY_NEUTRALIZING_GAS)
gSpecialStatuses[gBattlerTarget].neutralizingGasRemoved = TRUE;

gBattleScripting.abilityPopupOverwrite = gBattleMons[gBattlerTarget].ability;
gBattleMons[gBattlerTarget].ability = gBattleStruct->overwrittenAbilities[gBattlerTarget] = ABILITY_SIMPLE;
gBattlescriptCurrInstr = cmd->nextInstr;
}
Expand Down Expand Up @@ -14369,7 +14370,7 @@ static void Cmd_trycopyability(void)
if (gBattleMons[battler].ability == defAbility
|| defAbility == ABILITY_NONE
|| gAbilitiesInfo[gBattleMons[battler].ability].cantBeSuppressed
|| gAbilitiesInfo[gBattleMons[BATTLE_PARTNER(battler)].ability].cantBeSuppressed
|| (IsBattlerAlive(BATTLE_PARTNER(battler)) && gAbilitiesInfo[gBattleMons[BATTLE_PARTNER(battler)].ability].cantBeSuppressed && gMovesInfo[gCurrentMove].effect == EFFECT_DOODLE)
|| gAbilitiesInfo[defAbility].cantBeCopied)
{
gBattlescriptCurrInstr = cmd->failInstr;
Expand Down Expand Up @@ -14565,9 +14566,11 @@ static void Cmd_tryswapabilities(void)
}
else
{
u16 abilityAtk = gBattleMons[gBattlerAttacker].ability;
gBattleMons[gBattlerAttacker].ability = gBattleStruct->overwrittenAbilities[gBattlerAttacker] = gBattleMons[gBattlerTarget].ability;
gBattleMons[gBattlerTarget].ability = gBattleStruct->overwrittenAbilities[gBattlerTarget] = abilityAtk;
if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget))
gBattleScripting.abilityPopupOverwrite = gBattleMons[gBattlerAttacker].ability;
gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
gBattleMons[gBattlerTarget].ability = gBattleStruct->overwrittenAbilities[gBattlerTarget] = gBattleMons[gBattlerAttacker].ability;
gBattleMons[gBattlerAttacker].ability = gBattleStruct->overwrittenAbilities[gBattlerAttacker] = gLastUsedAbility;

gBattlescriptCurrInstr = cmd->nextInstr;
}
Expand Down Expand Up @@ -15859,6 +15862,7 @@ static void Cmd_tryworryseed(void)
}
else
{
gBattleScripting.abilityPopupOverwrite = gBattleMons[gBattlerTarget].ability;
gBattleMons[gBattlerTarget].ability = gBattleStruct->overwrittenAbilities[gBattlerTarget] = ABILITY_INSOMNIA;
gBattlescriptCurrInstr = cmd->nextInstr;
}
Expand Down
3 changes: 2 additions & 1 deletion src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -5546,7 +5546,8 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
break;
}

gLastUsedAbility = gBattleMons[gBattlerAttacker].ability = gBattleStruct->overwrittenAbilities[gBattlerAttacker] = gBattleMons[gBattlerTarget].ability;
gLastUsedAbility = gBattleMons[gBattlerAttacker].ability;
gBattleMons[gBattlerAttacker].ability = gBattleStruct->overwrittenAbilities[gBattlerAttacker] = gBattleMons[gBattlerTarget].ability;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MummyActivates;
effect++;
Expand Down
1 change: 1 addition & 0 deletions src/data/abilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,7 @@ const struct Ability gAbilitiesInfo[ABILITIES_COUNT] =
.cantBeSwapped = TRUE,
.cantBeTraced = TRUE,
.cantBeSuppressed = TRUE,
.cantBeOverwritten = TRUE,
AlexOn1ine marked this conversation as resolved.
Show resolved Hide resolved
},

[ABILITY_ELECTROMORPHOSIS] =
Expand Down
12 changes: 6 additions & 6 deletions test/battle/ability/mummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ SINGLE_BATTLE_TEST("Mummy doesn't replace abilities that can't be suppressed")

PARAMETRIZE { species = SPECIES_ARCEUS; ability = ABILITY_MULTITYPE; }
PARAMETRIZE { species = SPECIES_AEGISLASH; ability = ABILITY_STANCE_CHANGE; }
PARAMETRIZE { species = SPECIES_WISHIWASHI; ability = ABILITY_SCHOOLING; }
PARAMETRIZE { species = SPECIES_KOMALA; ability = ABILITY_COMATOSE; }
PARAMETRIZE { species = SPECIES_MINIOR; ability = ABILITY_SHIELDS_DOWN; }
PARAMETRIZE { species = SPECIES_WISHIWASHI; ability = ABILITY_SCHOOLING; }
PARAMETRIZE { species = SPECIES_MIMIKYU; ability = ABILITY_DISGUISE; }
PARAMETRIZE { species = SPECIES_SILVALLY; ability = ABILITY_RKS_SYSTEM; }
PARAMETRIZE { species = SPECIES_GRENINJA_BATTLE_BOND; ability = ABILITY_BATTLE_BOND; }
PARAMETRIZE { species = SPECIES_ZYGARDE; ability = ABILITY_POWER_CONSTRUCT; }
PARAMETRIZE { species = SPECIES_EISCUE; ability = ABILITY_ICE_FACE; }
PARAMETRIZE { species = SPECIES_KOMALA; ability = ABILITY_COMATOSE; }
PARAMETRIZE { species = SPECIES_SILVALLY; ability = ABILITY_RKS_SYSTEM; }
PARAMETRIZE { species = SPECIES_CRAMORANT; ability = ABILITY_GULP_MISSILE; }
PARAMETRIZE { species = SPECIES_EISCUE; ability = ABILITY_ICE_FACE; }
PARAMETRIZE { species = SPECIES_CALYREX_ICE; ability = ABILITY_AS_ONE_ICE_RIDER; }
PARAMETRIZE { species = SPECIES_CALYREX_SHADOW; ability = ABILITY_AS_ONE_SHADOW_RIDER; }
PARAMETRIZE { species = SPECIES_PALAFIN_ZERO; ability = ABILITY_ZERO_TO_HERO; }
PARAMETRIZE { species = SPECIES_TATSUGIRI; ability = ABILITY_COMMANDER; }
PARAMETRIZE { species = SPECIES_CALYREX_SHADOW_RIDER; ability = ABILITY_AS_ONE_SHADOW_RIDER; }
PARAMETRIZE { species = SPECIES_CALYREX_ICE_RIDER; ability = ABILITY_AS_ONE_ICE_RIDER; }

GIVEN {
PLAYER(SPECIES_YAMASK);
Expand Down
40 changes: 37 additions & 3 deletions test/battle/move_effect/doodle.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ DOUBLE_BATTLE_TEST("Doodle can't copy a banned ability")
} WHEN {
TURN { MOVE(playerLeft, MOVE_DOODLE, target: opponentLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOODLE, playerLeft);
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOODLE, playerLeft);
MESSAGE("Wynaut copied Foe Great Tusk's Protosynthesis!");
MESSAGE("Wynaut copied Foe Great Tusk's Protosynthesis!");
}
Expand All @@ -56,7 +56,7 @@ DOUBLE_BATTLE_TEST("Doodle fails if user has a banned Ability")
} WHEN {
TURN { MOVE(playerLeft, MOVE_DOODLE, target: opponentLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOODLE, playerLeft);
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_DOODLE, playerLeft);
MESSAGE("But it failed!");
} THEN {
EXPECT(playerLeft->ability == ABILITY_GULP_MISSILE);
Expand All @@ -74,10 +74,44 @@ DOUBLE_BATTLE_TEST("Doodle fails if partner has a banned Ability")
} WHEN {
TURN { MOVE(playerLeft, MOVE_DOODLE, target: opponentLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOODLE, playerLeft);
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_DOODLE, playerLeft);
MESSAGE("But it failed!");
} THEN {
EXPECT(playerLeft->ability == ABILITY_SHADOW_TAG);
EXPECT(playerRight->ability == ABILITY_GULP_MISSILE);
}
}

DOUBLE_BATTLE_TEST("Doodle fails if ally's ability can't be suppressed")
{
u32 species, ability;

PARAMETRIZE { species = SPECIES_ARCEUS; ability = ABILITY_MULTITYPE; }
PARAMETRIZE { species = SPECIES_DARMANITAN; ability = ABILITY_ZEN_MODE; }
PARAMETRIZE { species = SPECIES_AEGISLASH; ability = ABILITY_STANCE_CHANGE; }
PARAMETRIZE { species = SPECIES_MINIOR; ability = ABILITY_SHIELDS_DOWN; }
PARAMETRIZE { species = SPECIES_WISHIWASHI; ability = ABILITY_SCHOOLING; }
PARAMETRIZE { species = SPECIES_MIMIKYU; ability = ABILITY_DISGUISE; }
PARAMETRIZE { species = SPECIES_GRENINJA_BATTLE_BOND; ability = ABILITY_BATTLE_BOND; }
PARAMETRIZE { species = SPECIES_ZYGARDE; ability = ABILITY_POWER_CONSTRUCT; }
PARAMETRIZE { species = SPECIES_KOMALA; ability = ABILITY_COMATOSE; }
PARAMETRIZE { species = SPECIES_SILVALLY; ability = ABILITY_RKS_SYSTEM; }
PARAMETRIZE { species = SPECIES_CRAMORANT; ability = ABILITY_GULP_MISSILE; }
PARAMETRIZE { species = SPECIES_EISCUE; ability = ABILITY_ICE_FACE; }
PARAMETRIZE { species = SPECIES_CALYREX_ICE; ability = ABILITY_AS_ONE_ICE_RIDER; }
PARAMETRIZE { species = SPECIES_CALYREX_SHADOW; ability = ABILITY_AS_ONE_SHADOW_RIDER; }
PARAMETRIZE { species = SPECIES_PALAFIN_ZERO; ability = ABILITY_ZERO_TO_HERO; }
PARAMETRIZE { species = SPECIES_TATSUGIRI; ability = ABILITY_COMMANDER; }

GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_TELEPATHY); }
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_TELEPATHY); }
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_TELEPATHY); }
OPPONENT(species) { Ability(ability); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_DOODLE, target: playerLeft); }
} SCENE {
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_DOODLE, opponentLeft);
MESSAGE("But it failed!");
}
}
Loading
Loading