mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Merge pull request #2434 from LOuroboros/badDreams
Optimized Bad Dreams' code
This commit is contained in:
commit
e6ae0bd01e
@ -1290,7 +1290,7 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro trygetbaddreamstarget ptr:req
|
||||
.macro unused ptr:req
|
||||
.byte 0xfd
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
@ -8363,24 +8363,33 @@ BattleScript_PsychicSurgeActivates::
|
||||
call BattleScript_TerrainSeedLoop
|
||||
end3
|
||||
|
||||
BattleScript_BadDreamsActivates::
|
||||
setbyte gBattlerTarget, 0
|
||||
call BattleScript_AbilityPopUp
|
||||
BattleScript_BadDreamsLoop:
|
||||
trygetbaddreamstarget BattleScript_BadDreamsEnd
|
||||
dmg_1_8_targethp
|
||||
BattleScript_HurtTarget_NoString:
|
||||
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
|
||||
datahpupdate 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:
|
||||
addbyte gBattlerTarget, 1
|
||||
goto BattleScript_BadDreamsLoop
|
||||
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_BadDreamsLoop
|
||||
BattleScript_BadDreamsEnd:
|
||||
destroyabilitypopup
|
||||
end3
|
||||
|
||||
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_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_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_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!");
|
||||
|
@ -573,7 +573,7 @@ static void Cmd_settelekinesis(void);
|
||||
static void Cmd_swapstatstages(void);
|
||||
static void Cmd_averagestats(void);
|
||||
static void Cmd_jumpifoppositegenders(void);
|
||||
static void Cmd_trygetbaddreamstarget(void);
|
||||
static void Cmd_unused(void);
|
||||
static void Cmd_tryworryseed(void);
|
||||
static void Cmd_metalburstdamagecalculator(void);
|
||||
|
||||
@ -832,7 +832,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
||||
Cmd_swapstatstages, //0xFA
|
||||
Cmd_averagestats, //0xFB
|
||||
Cmd_jumpifoppositegenders, //0xFC
|
||||
Cmd_trygetbaddreamstarget, //0xFD
|
||||
Cmd_unused, //0xFD
|
||||
Cmd_tryworryseed, //0xFE
|
||||
Cmd_metalburstdamagecalculator, //0xFF
|
||||
};
|
||||
@ -14727,22 +14727,8 @@ static void Cmd_jumpifoppositegenders(void)
|
||||
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)
|
||||
|
@ -5004,14 +5004,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
gDisableStructs[gBattlerAttacker].truantCounter ^= 1;
|
||||
break;
|
||||
case ABILITY_BAD_DREAMS:
|
||||
if (gBattleMons[BATTLE_PARTNER(BATTLE_OPPOSITE(battler))].status1 & STATUS1_SLEEP
|
||||
|| gBattleMons[BATTLE_OPPOSITE(battler)].status1 & STATUS1_SLEEP
|
||||
|| GetBattlerAbility(BATTLE_PARTNER(BATTLE_OPPOSITE(battler))) == ABILITY_COMATOSE
|
||||
|| GetBattlerAbility(BATTLE_OPPOSITE(battler)) == ABILITY_COMATOSE)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BadDreamsActivates);
|
||||
effect++;
|
||||
}
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BadDreamsActivates);
|
||||
effect++;
|
||||
break;
|
||||
SOLAR_POWER_HP_DROP:
|
||||
case ABILITY_SOLAR_POWER:
|
||||
|
Loading…
Reference in New Issue
Block a user