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
.endm
.macro settracedability battler:req
various \battler, VARIOUS_TRACE_ABILITY
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

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

View File

@ -529,6 +529,7 @@ struct BattleStruct
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 debugHoldEffects[MAX_BATTLERS_COUNT]; // These override actual items' hold effects.
u8 tracedAbility[MAX_BATTLERS_COUNT];
};
#define GET_MOVE_TYPE(move, typeArg) \

View File

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

View File

@ -3479,9 +3479,7 @@ static void DoBattleIntro(void)
static void TryDoEventsBeforeFirstTurn(void)
{
s32 i;
s32 j;
u8 effect = 0;
s32 i, j;
if (gBattleControllerExecFlags)
return;
@ -3508,12 +3506,8 @@ static void TryDoEventsBeforeFirstTurn(void)
// Check all switch in abilities happening from the fastest mon to slowest.
while (gBattleStruct->switchInAbilitiesCounter < gBattlersCount)
{
if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerByTurnOrder[gBattleStruct->switchInAbilitiesCounter], 0, 0, 0) != 0)
effect++;
gBattleStruct->switchInAbilitiesCounter++;
if (effect)
gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->switchInAbilitiesCounter++];
if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerAttacker, 0, 0, 0) != 0)
return;
}
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.
while (gBattleStruct->switchInItemsCounter < gBattlersCount)
{
if (ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gBattlerByTurnOrder[gBattleStruct->switchInItemsCounter], FALSE))
effect++;
gBattleStruct->switchInItemsCounter++;
if (effect)
if (ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gBattlerByTurnOrder[gBattleStruct->switchInItemsCounter++], FALSE))
return;
}
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_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_BadDreamsDmg[] = _("The {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_BadDreamsDmg[] = _("{B_DEF_NAME_WITH_PREFIX} is tormented\nby {B_DEF_ABILITY}!");
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_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!");

View File

@ -6582,6 +6582,9 @@ static void atk76_various(void)
else
gBattlescriptCurrInstr += 7;
return;
case VARIOUS_TRACE_ABILITY:
gBattleMons[gActiveBattler].ability = gBattleStruct->tracedAbility[gActiveBattler];
break;
case VARIOUS_JUMP_IF_NOT_BERRY:
if (ItemId_GetPocket(gBattleMons[gActiveBattler].item) == POCKET_BERRIES)
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)
{
gActiveBattler = GetBattlerAtPosition(((Random() & 1) * 2) | side);
gBattleMons[i].ability = gBattleMons[gActiveBattler].ability;
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[gActiveBattler].ability;
effect++;
}
else if (gBattleMons[target1].ability != 0 && gBattleMons[target1].hp != 0)
{
gActiveBattler = target1;
gBattleMons[i].ability = gBattleMons[gActiveBattler].ability;
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[gActiveBattler].ability;
effect++;
}
else if (gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0)
{
gActiveBattler = target2;
gBattleMons[i].ability = gBattleMons[gActiveBattler].ability;
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[gActiveBattler].ability;
effect++;
}
}
@ -3618,8 +3615,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gActiveBattler = target1;
if (gBattleMons[target1].ability && gBattleMons[target1].hp)
{
gBattleMons[i].ability = gBattleMons[target1].ability;
gLastUsedAbility = gBattleMons[target1].ability;
gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[target1].ability;
effect++;
}
}