Fix switch-in abilities text/pop-up

This commit is contained in:
DizzyEggg 2019-08-05 11:24:49 +02:00
parent c219776034
commit 2863045241
8 changed files with 21 additions and 25 deletions

View file

@ -1656,6 +1656,10 @@
.4byte \ptr .4byte \ptr
.endm .endm
.macro settracedability battler:req
various \battler, VARIOUS_TRACE_ABILITY
.endm
@ helpful macros @ helpful macros
.macro setstatchanger stat:req, stages:req, down:req .macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View file

@ -6221,6 +6221,7 @@ BattleScript_TraceActivates::
call BattleScript_AbilityPopUp call BattleScript_AbilityPopUp
printstring STRINGID_PKMNTRACED printstring STRINGID_PKMNTRACED
waitmessage 0x40 waitmessage 0x40
settracedability BS_ATTACKER
switchinabilities BS_ATTACKER switchinabilities BS_ATTACKER
end3 end3
@ -6664,6 +6665,7 @@ BattleScript_AttackerAbilityStatRaiseEnd3::
end3 end3
BattleScript_SwitchInAbilityMsg:: BattleScript_SwitchInAbilityMsg::
call BattleScript_AbilityPopUp
printfromtable gSwitchInAbilityStringIds printfromtable gSwitchInAbilityStringIds
waitmessage 0x40 waitmessage 0x40
end3 end3

View file

@ -529,6 +529,7 @@ struct BattleStruct
u8 lastMoveFailed; // as bits for each battler, for the sake of Stomping Tantrum u8 lastMoveFailed; // as bits for each battler, for the sake of Stomping Tantrum
u8 lastMoveTarget[MAX_BATTLERS_COUNT]; // The last target on which each mon used a move, for the sake of Instruct u8 lastMoveTarget[MAX_BATTLERS_COUNT]; // The last target on which each mon used a move, for the sake of Instruct
u8 debugHoldEffects[MAX_BATTLERS_COUNT]; // These override actual items' hold effects. u8 debugHoldEffects[MAX_BATTLERS_COUNT]; // These override actual items' hold effects.
u8 tracedAbility[MAX_BATTLERS_COUNT];
}; };
#define GET_MOVE_TYPE(move, typeArg) \ #define GET_MOVE_TYPE(move, typeArg) \

View file

@ -141,6 +141,7 @@
#define VARIOUS_JUMP_IF_ROAR_FAILS 78 #define VARIOUS_JUMP_IF_ROAR_FAILS 78
#define VARIOUS_TRY_INSTRUCT 79 #define VARIOUS_TRY_INSTRUCT 79
#define VARIOUS_JUMP_IF_NOT_BERRY 80 #define VARIOUS_JUMP_IF_NOT_BERRY 80
#define VARIOUS_TRACE_ABILITY 81
// atk80, dmg manipulation // atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0 #define ATK80_DMG_CHANGE_SIGN 0

View file

@ -3479,9 +3479,7 @@ static void DoBattleIntro(void)
static void TryDoEventsBeforeFirstTurn(void) static void TryDoEventsBeforeFirstTurn(void)
{ {
s32 i; s32 i, j;
s32 j;
u8 effect = 0;
if (gBattleControllerExecFlags) if (gBattleControllerExecFlags)
return; return;
@ -3508,12 +3506,8 @@ static void TryDoEventsBeforeFirstTurn(void)
// Check all switch in abilities happening from the fastest mon to slowest. // Check all switch in abilities happening from the fastest mon to slowest.
while (gBattleStruct->switchInAbilitiesCounter < gBattlersCount) while (gBattleStruct->switchInAbilitiesCounter < gBattlersCount)
{ {
if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerByTurnOrder[gBattleStruct->switchInAbilitiesCounter], 0, 0, 0) != 0) gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->switchInAbilitiesCounter++];
effect++; if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerAttacker, 0, 0, 0) != 0)
gBattleStruct->switchInAbilitiesCounter++;
if (effect)
return; return;
} }
if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) != 0) if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) != 0)
@ -3523,12 +3517,7 @@ static void TryDoEventsBeforeFirstTurn(void)
// Check all switch in items having effect from the fastest mon to slowest. // Check all switch in items having effect from the fastest mon to slowest.
while (gBattleStruct->switchInItemsCounter < gBattlersCount) while (gBattleStruct->switchInItemsCounter < gBattlersCount)
{ {
if (ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gBattlerByTurnOrder[gBattleStruct->switchInItemsCounter], FALSE)) if (ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gBattlerByTurnOrder[gBattleStruct->switchInItemsCounter++], FALSE))
effect++;
gBattleStruct->switchInItemsCounter++;
if (effect)
return; return;
} }
for (i = 0; i < MAX_BATTLERS_COUNT; i++) for (i = 0; i < MAX_BATTLERS_COUNT; i++)

View file

@ -583,8 +583,8 @@ static const u8 sText_PsychicTerrainEnds[] = _("The weirdness disappeared\nfrom
static const u8 sText_GrassyTerrainEnds[] = _("The grass disappeared\nfrom the battlefield."); static const u8 sText_GrassyTerrainEnds[] = _("The grass disappeared\nfrom the battlefield.");
static const u8 sText_AngryPointActivates[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} maxed\nits attack!"); static const u8 sText_AngryPointActivates[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} maxed\nits attack!");
static const u8 sText_PoisonHealHpUp[] = _("The poisoning healed {B_ATK_NAME_WITH_PREFIX}\na little bit!"); static const u8 sText_PoisonHealHpUp[] = _("The poisoning healed {B_ATK_NAME_WITH_PREFIX}\na little bit!");
static const u8 sText_BadDreamsDmg[] = _("The {B_DEF_NAME_WITH_PREFIX} is tormented\nby {B_DEF_ABILITY}!"); static const u8 sText_BadDreamsDmg[] = _("{B_DEF_NAME_WITH_PREFIX} is tormented\nby {B_DEF_ABILITY}!");
static const u8 sText_MoldBreakerEnters[] = _("The {B_DEF_NAME_WITH_PREFIX} breaks the mold!"); static const u8 sText_MoldBreakerEnters[] = _("{B_ATK_NAME_WITH_PREFIX} breaks the mold!");
static const u8 sText_TeravoltEnters[] = _("{B_ATK_NAME_WITH_PREFIX} is radiating a bursting aura!"); static const u8 sText_TeravoltEnters[] = _("{B_ATK_NAME_WITH_PREFIX} is radiating a bursting aura!");
static const u8 sText_TurboblazeEnters[] = _("{B_ATK_NAME_WITH_PREFIX} is radiating a blazing aura!"); static const u8 sText_TurboblazeEnters[] = _("{B_ATK_NAME_WITH_PREFIX} is radiating a blazing aura!");
static const u8 sText_SlowStartEnters[] = _("{B_ATK_NAME_WITH_PREFIX} can't get it going!"); static const u8 sText_SlowStartEnters[] = _("{B_ATK_NAME_WITH_PREFIX} can't get it going!");

View file

@ -6582,6 +6582,9 @@ static void atk76_various(void)
else else
gBattlescriptCurrInstr += 7; gBattlescriptCurrInstr += 7;
return; return;
case VARIOUS_TRACE_ABILITY:
gBattleMons[gActiveBattler].ability = gBattleStruct->tracedAbility[gActiveBattler];
break;
case VARIOUS_JUMP_IF_NOT_BERRY: case VARIOUS_JUMP_IF_NOT_BERRY:
if (ItemId_GetPocket(gBattleMons[gActiveBattler].item) == POCKET_BERRIES) if (ItemId_GetPocket(gBattleMons[gActiveBattler].item) == POCKET_BERRIES)
gBattlescriptCurrInstr += 7; gBattlescriptCurrInstr += 7;

View file

@ -3594,22 +3594,19 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
&& gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0) && gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0)
{ {
gActiveBattler = GetBattlerAtPosition(((Random() & 1) * 2) | side); gActiveBattler = GetBattlerAtPosition(((Random() & 1) * 2) | side);
gBattleMons[i].ability = gBattleMons[gActiveBattler].ability; gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[gActiveBattler].ability;
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
effect++; effect++;
} }
else if (gBattleMons[target1].ability != 0 && gBattleMons[target1].hp != 0) else if (gBattleMons[target1].ability != 0 && gBattleMons[target1].hp != 0)
{ {
gActiveBattler = target1; gActiveBattler = target1;
gBattleMons[i].ability = gBattleMons[gActiveBattler].ability; gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[gActiveBattler].ability;
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
effect++; effect++;
} }
else if (gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0) else if (gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0)
{ {
gActiveBattler = target2; gActiveBattler = target2;
gBattleMons[i].ability = gBattleMons[gActiveBattler].ability; gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[gActiveBattler].ability;
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
effect++; effect++;
} }
} }
@ -3618,8 +3615,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gActiveBattler = target1; gActiveBattler = target1;
if (gBattleMons[target1].ability && gBattleMons[target1].hp) if (gBattleMons[target1].ability && gBattleMons[target1].hp)
{ {
gBattleMons[i].ability = gBattleMons[target1].ability; gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[target1].ability;
gLastUsedAbility = gBattleMons[target1].ability;
effect++; effect++;
} }
} }