mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Optimized Bad Dreams' code
Misc: -Made the ability pop up stick around until the ability's effect ends just like in ORAS. -Updated sText_BadDreamsDmg accordingly while I was at it.
This commit is contained in:
parent
fa8bf80905
commit
f56df74576
@ -1290,7 +1290,7 @@
|
|||||||
.4byte \ptr
|
.4byte \ptr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro trygetbaddreamstarget ptr:req
|
.macro unused ptr:req
|
||||||
.byte 0xfd
|
.byte 0xfd
|
||||||
.4byte \ptr
|
.4byte \ptr
|
||||||
.endm
|
.endm
|
||||||
|
@ -8358,24 +8358,33 @@ BattleScript_PsychicSurgeActivates::
|
|||||||
call BattleScript_TerrainSeedLoop
|
call BattleScript_TerrainSeedLoop
|
||||||
end3
|
end3
|
||||||
|
|
||||||
BattleScript_BadDreamsActivates::
|
BattleScript_HurtTarget_NoString:
|
||||||
setbyte gBattlerTarget, 0
|
|
||||||
call BattleScript_AbilityPopUp
|
|
||||||
BattleScript_BadDreamsLoop:
|
|
||||||
trygetbaddreamstarget BattleScript_BadDreamsEnd
|
|
||||||
dmg_1_8_targethp
|
|
||||||
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
|
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
|
||||||
printstring STRINGID_BADDREAMSDMG
|
|
||||||
waitmessage B_WAIT_TIME_LONG
|
|
||||||
jumpifability BS_TARGET, ABILITY_MAGIC_GUARD, BattleScript_BadDreamsIncrement
|
|
||||||
healthbarupdate BS_TARGET
|
healthbarupdate BS_TARGET
|
||||||
datahpupdate BS_TARGET
|
datahpupdate BS_TARGET
|
||||||
tryfaintmon BS_TARGET
|
tryfaintmon BS_TARGET
|
||||||
checkteamslost BattleScript_BadDreamsIncrement
|
return
|
||||||
|
|
||||||
|
BattleScript_BadDreamsActivates::
|
||||||
|
call BattleScript_AbilityPopUp
|
||||||
|
setbyte sFIXED_ABILITY_POPUP, TRUE
|
||||||
|
setbyte gBattlerTarget, 0
|
||||||
|
BattleScript_BadDreamsLoop:
|
||||||
|
jumpiftargetally BattleScript_BadDreamsIncrement
|
||||||
|
jumpifability BS_TARGET, ABILITY_MAGIC_GUARD, BattleScript_BadDreamsIncrement
|
||||||
|
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_BadDreams_Dmg
|
||||||
|
jumpifstatus BS_TARGET, STATUS1_SLEEP, BattleScript_BadDreams_Dmg
|
||||||
|
goto BattleScript_BadDreamsIncrement
|
||||||
|
BattleScript_BadDreams_Dmg:
|
||||||
|
printstring STRINGID_BADDREAMSDMG
|
||||||
|
waitmessage B_WAIT_TIME_LONG
|
||||||
|
dmg_1_8_targethp
|
||||||
|
call BattleScript_HurtTarget_NoString
|
||||||
BattleScript_BadDreamsIncrement:
|
BattleScript_BadDreamsIncrement:
|
||||||
addbyte gBattlerTarget, 1
|
addbyte gBattlerTarget, 1
|
||||||
goto BattleScript_BadDreamsLoop
|
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_BadDreamsLoop
|
||||||
BattleScript_BadDreamsEnd:
|
BattleScript_BadDreamsEnd:
|
||||||
|
destroyabilitypopup
|
||||||
end3
|
end3
|
||||||
|
|
||||||
BattleScript_TookAttack::
|
BattleScript_TookAttack::
|
||||||
|
@ -589,7 +589,7 @@ 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_TargetsStatWasMaxedOut[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} maxed\nits {B_BUFF1}!");
|
static const u8 sText_TargetsStatWasMaxedOut[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} maxed\nits {B_BUFF1}!");
|
||||||
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[] = _("{B_DEF_NAME_WITH_PREFIX} is tormented\nby {B_ATK_ABILITY}!");
|
static const u8 sText_BadDreamsDmg[] = _("{B_DEF_NAME_WITH_PREFIX} is tormented!");
|
||||||
static const u8 sText_MoldBreakerEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} breaks the mold!");
|
static const u8 sText_MoldBreakerEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} breaks the mold!");
|
||||||
static const u8 sText_TeravoltEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is radiating \na bursting aura!");
|
static const u8 sText_TeravoltEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is radiating \na bursting aura!");
|
||||||
static const u8 sText_TurboblazeEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is radiating\na blazing aura!");
|
static const u8 sText_TurboblazeEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is radiating\na blazing aura!");
|
||||||
|
@ -573,7 +573,7 @@ static void Cmd_settelekinesis(void);
|
|||||||
static void Cmd_swapstatstages(void);
|
static void Cmd_swapstatstages(void);
|
||||||
static void Cmd_averagestats(void);
|
static void Cmd_averagestats(void);
|
||||||
static void Cmd_jumpifoppositegenders(void);
|
static void Cmd_jumpifoppositegenders(void);
|
||||||
static void Cmd_trygetbaddreamstarget(void);
|
static void Cmd_unused(void);
|
||||||
static void Cmd_tryworryseed(void);
|
static void Cmd_tryworryseed(void);
|
||||||
static void Cmd_metalburstdamagecalculator(void);
|
static void Cmd_metalburstdamagecalculator(void);
|
||||||
|
|
||||||
@ -832,7 +832,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
|||||||
Cmd_swapstatstages, //0xFA
|
Cmd_swapstatstages, //0xFA
|
||||||
Cmd_averagestats, //0xFB
|
Cmd_averagestats, //0xFB
|
||||||
Cmd_jumpifoppositegenders, //0xFC
|
Cmd_jumpifoppositegenders, //0xFC
|
||||||
Cmd_trygetbaddreamstarget, //0xFD
|
Cmd_unused, //0xFD
|
||||||
Cmd_tryworryseed, //0xFE
|
Cmd_tryworryseed, //0xFE
|
||||||
Cmd_metalburstdamagecalculator, //0xFF
|
Cmd_metalburstdamagecalculator, //0xFF
|
||||||
};
|
};
|
||||||
@ -14730,22 +14730,8 @@ static void Cmd_jumpifoppositegenders(void)
|
|||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Cmd_trygetbaddreamstarget(void)
|
static void Cmd_unused(void)
|
||||||
{
|
{
|
||||||
u8 badDreamsMonSide = GetBattlerSide(gBattlerAttacker);
|
|
||||||
for (;gBattlerTarget < gBattlersCount; gBattlerTarget++)
|
|
||||||
{
|
|
||||||
if (GetBattlerSide(gBattlerTarget) == badDreamsMonSide)
|
|
||||||
continue;
|
|
||||||
if ((gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE)
|
|
||||||
&& IsBattlerAlive(gBattlerTarget))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gBattlerTarget >= gBattlersCount)
|
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
|
||||||
else
|
|
||||||
gBattlescriptCurrInstr += 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Cmd_tryworryseed(void)
|
static void Cmd_tryworryseed(void)
|
||||||
|
@ -5003,14 +5003,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||||||
gDisableStructs[gBattlerAttacker].truantCounter ^= 1;
|
gDisableStructs[gBattlerAttacker].truantCounter ^= 1;
|
||||||
break;
|
break;
|
||||||
case ABILITY_BAD_DREAMS:
|
case ABILITY_BAD_DREAMS:
|
||||||
if (gBattleMons[BATTLE_PARTNER(BATTLE_OPPOSITE(battler))].status1 & STATUS1_SLEEP
|
BattleScriptPushCursorAndCallback(BattleScript_BadDreamsActivates);
|
||||||
|| gBattleMons[BATTLE_OPPOSITE(battler)].status1 & STATUS1_SLEEP
|
effect++;
|
||||||
|| GetBattlerAbility(BATTLE_PARTNER(BATTLE_OPPOSITE(battler))) == ABILITY_COMATOSE
|
|
||||||
|| GetBattlerAbility(BATTLE_OPPOSITE(battler)) == ABILITY_COMATOSE)
|
|
||||||
{
|
|
||||||
BattleScriptPushCursorAndCallback(BattleScript_BadDreamsActivates);
|
|
||||||
effect++;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
SOLAR_POWER_HP_DROP:
|
SOLAR_POWER_HP_DROP:
|
||||||
case ABILITY_SOLAR_POWER:
|
case ABILITY_SOLAR_POWER:
|
||||||
|
Loading…
Reference in New Issue
Block a user