fix screen cleaner, curious medicine, as one

This commit is contained in:
Evan 2021-02-02 09:00:07 -07:00
parent 8ec12c665c
commit f4d4cf262e
10 changed files with 62 additions and 11 deletions

View file

@ -6628,6 +6628,7 @@ BattleScript_AbilityPopUp:
showabilitypopup BS_ABILITY_BATTLER showabilitypopup BS_ABILITY_BATTLER
recordability BS_ABILITY_BATTLER recordability BS_ABILITY_BATTLER
pause 40 pause 40
sethword sABILITY_OVERWRITE, 0
return return
BattleScript_SpeedBoostActivates:: BattleScript_SpeedBoostActivates::
@ -7219,6 +7220,16 @@ BattleScript_WeakArmorSpeedAnim:
BattleScript_WeakArmorActivatesEnd: BattleScript_WeakArmorActivatesEnd:
return return
BattleScript_RaiseStatOnFaintingTarget::
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp
setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
waitanimation
printstring STRINGID_LASTABILITYRAISEDSTAT
waitmessage 0x40
return
BattleScript_AttackerAbilityStatRaise:: BattleScript_AttackerAbilityStatRaise::
copybyte gBattlerAbility, gBattlerAttacker copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp call BattleScript_AbilityPopUp
@ -7248,6 +7259,18 @@ BattleScript_SwitchInAbilityMsg::
printfromtable gSwitchInAbilityStringIds printfromtable gSwitchInAbilityStringIds
waitmessage 0x40 waitmessage 0x40
end3 end3
BattleScript_ActivateAsOne::
call BattleScript_AbilityPopUp
printfromtable gSwitchInAbilityStringIds
waitmessage 0x40
@ show unnerve
sethword sABILITY_OVERWRITE, ABILITY_UNNERVE
setbyte cMULTISTRING_CHOOSER, MULTI_SWITCHIN_UNNERVE
call BattleScript_AbilityPopUp
printfromtable gSwitchInAbilityStringIds
waitmessage 0x40
end3
BattleScript_FriskMsgWithPopup:: BattleScript_FriskMsgWithPopup::
copybyte gBattlerAbility, gBattlerAttacker copybyte gBattlerAbility, gBattlerAttacker

View file

@ -613,6 +613,7 @@ struct BattleScripting
u16 multihitMoveEffect; u16 multihitMoveEffect;
u8 illusionNickHack; // To properly display nick in STRINGID_ENEMYABOUTTOSWITCHPKMN. u8 illusionNickHack; // To properly display nick in STRINGID_ENEMYABOUTTOSWITCHPKMN.
bool8 fixedPopup; // force ability popup to stick until manually called back bool8 fixedPopup; // force ability popup to stick until manually called back
u16 abilityPopupOverwrite;
}; };
// rom_80A5C6C // rom_80A5C6C

View file

@ -26,7 +26,7 @@ u32 IsFlowerVeilProtected(u32 battler);
u32 IsLeafGuardProtected(u32 battler); u32 IsLeafGuardProtected(u32 battler);
bool32 IsShieldsDownProtected(u32 battler); bool32 IsShieldsDownProtected(u32 battler);
u32 IsAbilityStatusProtected(u32 battler); u32 IsAbilityStatusProtected(u32 battler);
void ResetBattlerStatChanges(u8 battler); bool32 TryResetBattlerStatChanges(u8 battler);
extern void (* const gBattleScriptingCommandsTable[])(void); extern void (* const gBattleScriptingCommandsTable[])(void);
extern const u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4]; extern const u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4];

View file

@ -357,5 +357,7 @@ extern const u8 BattleScript_CottonDownActivates[];
extern const u8 BattleScript_BallFetch[]; extern const u8 BattleScript_BallFetch[];
extern const u8 BattleScript_SandSpitActivates[]; extern const u8 BattleScript_SandSpitActivates[];
extern const u8 BattleScript_PerishBodyActivates[]; extern const u8 BattleScript_PerishBodyActivates[];
extern const u8 BattleScript_ActivateAsOne[];
extern const u8 BattleScript_RaiseStatOnFaintingTarget[];
#endif // GUARD_BATTLE_SCRIPTS_H #endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -36,6 +36,7 @@
#define sMULTIHIT_EFFECT gBattleScripting + 0x30 #define sMULTIHIT_EFFECT gBattleScripting + 0x30
#define sILLUSION_NICK_HACK gBattleScripting + 0x32 #define sILLUSION_NICK_HACK gBattleScripting + 0x32
#define sFIXED_ABILITY_POPUP gBattleScripting + 0x33 #define sFIXED_ABILITY_POPUP gBattleScripting + 0x33
#define sABILITY_OVERWRITE gBattleScripting + 0x34
#define cMULTISTRING_CHOOSER gBattleCommunication + 5 #define cMULTISTRING_CHOOSER gBattleCommunication + 5

View file

@ -470,7 +470,7 @@
#define STRINGID_FRISKACTIVATES 466 #define STRINGID_FRISKACTIVATES 466
#define STRINGID_UNNERVEENTERS 467 #define STRINGID_UNNERVEENTERS 467
#define STRINGID_HARVESTBERRY 468 #define STRINGID_HARVESTBERRY 468
#define STRINGID_MOXIEATKRISE 469 #define STRINGID_LASTABILITYRAISEDSTAT 469
#define STRINGID_MAGICBOUNCEACTIVATES 470 #define STRINGID_MAGICBOUNCEACTIVATES 470
#define STRINGID_PROTEANTYPECHANGE 471 #define STRINGID_PROTEANTYPECHANGE 471
#define STRINGID_SYMBIOSISITEMPASS 472 #define STRINGID_SYMBIOSISITEMPASS 472

View file

@ -3018,6 +3018,9 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
if (!B_ABILITY_POP_UP) if (!B_ABILITY_POP_UP)
return; return;
if (gBattleScripting.abilityPopupOverwrite != 0)
ability = gBattleScripting.abilityPopupOverwrite;
if (!gBattleStruct->activeAbilityPopUps) if (!gBattleStruct->activeAbilityPopUps)
{ {

View file

@ -601,7 +601,7 @@ static const u8 sText_SnowWarningHail[] = _("It started to hail!");
static const u8 sText_FriskActivates[] = _("{B_ATK_NAME_WITH_PREFIX} frisked {B_DEF_NAME_WITH_PREFIX} and\nfound its {B_LAST_ITEM}!"); static const u8 sText_FriskActivates[] = _("{B_ATK_NAME_WITH_PREFIX} frisked {B_DEF_NAME_WITH_PREFIX} and\nfound its {B_LAST_ITEM}!");
static const u8 sText_UnnerveEnters[] = _("The opposing team is too nervous\nto eat Berries!"); static const u8 sText_UnnerveEnters[] = _("The opposing team is too nervous\nto eat Berries!");
static const u8 sText_HarvestBerry[] = _("{B_ATK_NAME_WITH_PREFIX} harvested\nits {B_LAST_ITEM}!"); static const u8 sText_HarvestBerry[] = _("{B_ATK_NAME_WITH_PREFIX} harvested\nits {B_LAST_ITEM}!");
static const u8 sText_MoxieAtkRise[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} raised its Attack!"); static const u8 sText_LastAbilityRaisedBuff1[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ABILITY}\nraised its {B_BUFF1}!");
static const u8 sText_MagicBounceActivates[] = _("The {B_DEF_NAME_WITH_PREFIX} bounced the\n{B_ATK_NAME_WITH_PREFIX} back!"); static const u8 sText_MagicBounceActivates[] = _("The {B_DEF_NAME_WITH_PREFIX} bounced the\n{B_ATK_NAME_WITH_PREFIX} back!");
static const u8 sText_ProteanTypeChange[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} transformed\nit into the {B_BUFF1} type!"); static const u8 sText_ProteanTypeChange[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} transformed\nit into the {B_BUFF1} type!");
static const u8 sText_SymbiosisItemPass[] = _("{B_ATK_NAME_WITH_PREFIX} passed its {B_LAST_ITEM}\nto {B_SCR_ACTIVE_NAME_WITH_PREFIX} through {B_ATK_ABILITY}!"); static const u8 sText_SymbiosisItemPass[] = _("{B_ATK_NAME_WITH_PREFIX} passed its {B_LAST_ITEM}\nto {B_SCR_ACTIVE_NAME_WITH_PREFIX} through {B_ATK_ABILITY}!");
@ -1189,7 +1189,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_FRISKACTIVATES - 12] = sText_FriskActivates, [STRINGID_FRISKACTIVATES - 12] = sText_FriskActivates,
[STRINGID_UNNERVEENTERS - 12] = sText_UnnerveEnters, [STRINGID_UNNERVEENTERS - 12] = sText_UnnerveEnters,
[STRINGID_HARVESTBERRY - 12] = sText_HarvestBerry, [STRINGID_HARVESTBERRY - 12] = sText_HarvestBerry,
[STRINGID_MOXIEATKRISE - 12] = sText_MoxieAtkRise, [STRINGID_LASTABILITYRAISEDSTAT - 12] = sText_LastAbilityRaisedBuff1,
[STRINGID_MAGICBOUNCEACTIVATES - 12] = sText_MagicBounceActivates, [STRINGID_MAGICBOUNCEACTIVATES - 12] = sText_MagicBounceActivates,
[STRINGID_PROTEANTYPECHANGE - 12] = sText_ProteanTypeChange, [STRINGID_PROTEANTYPECHANGE - 12] = sText_ProteanTypeChange,
[STRINGID_SYMBIOSISITEMPASS - 12] = sText_SymbiosisItemPass, [STRINGID_SYMBIOSISITEMPASS - 12] = sText_SymbiosisItemPass,
@ -1292,6 +1292,7 @@ const u16 gSwitchInAbilityStringIds[] =
[MULTI_SWITCHIN_COMATOSE] = STRINGID_COMATOSEENTERS, [MULTI_SWITCHIN_COMATOSE] = STRINGID_COMATOSEENTERS,
[MULTI_SWITCHIN_SCREENCLEANER] = STRINGID_SCREENCLEANERENTERS, [MULTI_SWITCHIN_SCREENCLEANER] = STRINGID_SCREENCLEANERENTERS,
[MULTI_SWITCHIN_ASONE] = STRINGID_ASONEENTERS, [MULTI_SWITCHIN_ASONE] = STRINGID_ASONEENTERS,
[MULTI_SWITCHIN_CURIOUS_MEDICINE] = STRINGID_CURIOUSMEDICINEENTERS,
}; };
const u16 gMissStringIds[] = const u16 gMissStringIds[] =

View file

@ -7534,7 +7534,10 @@ static void Cmd_various(void)
SET_STATCHANGER(STAT_ATK, 1, FALSE); SET_STATCHANGER(STAT_ATK, 1, FALSE);
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK); PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
BattleScriptPush(gBattlescriptCurrInstr + 3); BattleScriptPush(gBattlescriptCurrInstr + 3);
gBattlescriptCurrInstr = BattleScript_AttackerAbilityStatRaise; gLastUsedAbility = GetBattlerAbility(gActiveBattler);
if (GetBattlerAbility(gActiveBattler) == ABILITY_AS_ONE_ICE_RIDER)
gBattleScripting.abilityPopupOverwrite = gLastUsedAbility = ABILITY_CHILLING_NEIGH;
gBattlescriptCurrInstr = BattleScript_RaiseStatOnFaintingTarget;
return; return;
} }
break; break;
@ -7549,7 +7552,10 @@ static void Cmd_various(void)
SET_STATCHANGER(STAT_SPATK, 1, FALSE); SET_STATCHANGER(STAT_SPATK, 1, FALSE);
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK); PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK);
BattleScriptPush(gBattlescriptCurrInstr + 3); BattleScriptPush(gBattlescriptCurrInstr + 3);
gBattlescriptCurrInstr = BattleScript_AttackerAbilityStatRaise; gLastUsedAbility = GetBattlerAbility(gActiveBattler);
if (GetBattlerAbility(gActiveBattler) == ABILITY_AS_ONE_SHADOW_RIDER)
gBattleScripting.abilityPopupOverwrite = gLastUsedAbility = ABILITY_GRIM_NEIGH;
gBattlescriptCurrInstr = BattleScript_RaiseStatOnFaintingTarget;
return; return;
} }
break; break;
@ -9104,14 +9110,22 @@ static void Cmd_statbuffchange(void)
gBattlescriptCurrInstr = jumpPtr; gBattlescriptCurrInstr = jumpPtr;
} }
void ResetBattlerStatChanges(u8 battler) bool32 TryResetBattlerStatChanges(u8 battler)
{ {
u32 j; u32 j;
bool32 ret = FALSE;
gDisableStructs[battler].stockpileDef = 0; gDisableStructs[battler].stockpileDef = 0;
gDisableStructs[battler].stockpileSpDef = 0; gDisableStructs[battler].stockpileSpDef = 0;
for (j = 0; j < NUM_BATTLE_STATS; j++) for (j = 0; j < NUM_BATTLE_STATS; j++)
{
if (gBattleMons[battler].statStages[j] != DEFAULT_STAT_STAGE)
ret = TRUE; // returns TRUE if any stat was reset
gBattleMons[battler].statStages[j] = DEFAULT_STAT_STAGE; gBattleMons[battler].statStages[j] = DEFAULT_STAT_STAGE;
}
return ret;
} }
static void Cmd_normalisebuffs(void) // haze static void Cmd_normalisebuffs(void) // haze
@ -9119,7 +9133,7 @@ static void Cmd_normalisebuffs(void) // haze
s32 i, j; s32 i, j;
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
ResetBattlerStatChanges(i); TryResetBattlerStatChanges(i);
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }

View file

@ -3714,16 +3714,16 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_SWITCHIN_ASONE; gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_SWITCHIN_ASONE;
gSpecialStatuses[battler].switchInAbilityDone = 1; gSpecialStatuses[battler].switchInAbilityDone = 1;
BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); BattleScriptPushCursorAndCallback(BattleScript_ActivateAsOne);
effect++; effect++;
} }
break; break;
case ABILITY_CURIOUS_MEDICINE: case ABILITY_CURIOUS_MEDICINE:
if (!gSpecialStatuses[battler].switchInAbilityDone && IsDoubleBattle() && IsBattlerAlive(BATTLE_PARTNER(battler))) if (!gSpecialStatuses[battler].switchInAbilityDone && IsDoubleBattle()
&& IsBattlerAlive(BATTLE_PARTNER(battler)) && TryResetBattlerStatChanges(BATTLE_PARTNER(battler)))
{ {
u32 i; u32 i;
gEffectBattler = BATTLE_PARTNER(battler); gEffectBattler = BATTLE_PARTNER(battler);
ResetBattlerStatChanges(gEffectBattler);
gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_SWITCHIN_CURIOUS_MEDICINE; gBattleCommunication[MULTISTRING_CHOOSER] = MULTI_SWITCHIN_CURIOUS_MEDICINE;
gSpecialStatuses[battler].switchInAbilityDone = 1; gSpecialStatuses[battler].switchInAbilityDone = 1;
BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg);
@ -7998,6 +7998,9 @@ static bool32 TryRemoveScreens(u8 battler)
if (gSideStatuses[battlerSide] & (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL)) if (gSideStatuses[battlerSide] & (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL))
{ {
gSideStatuses[battlerSide] &= ~(SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL); gSideStatuses[battlerSide] &= ~(SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL);
gSideTimers[battlerSide].reflectTimer = 0;
gSideTimers[battlerSide].lightscreenTimer = 0;
gSideTimers[battlerSide].auroraVeilTimer = 0;
removed = TRUE; removed = TRUE;
} }
@ -8005,6 +8008,9 @@ static bool32 TryRemoveScreens(u8 battler)
if (gSideStatuses[enemySide] & (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL)) if (gSideStatuses[enemySide] & (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL))
{ {
gSideStatuses[enemySide] &= ~(SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL); gSideStatuses[enemySide] &= ~(SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL);
gSideTimers[enemySide].reflectTimer = 0;
gSideTimers[enemySide].lightscreenTimer = 0;
gSideTimers[enemySide].auroraVeilTimer = 0;
removed = TRUE; removed = TRUE;
} }