mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 13:53:52 +01:00
Add Bad Dreams
This commit is contained in:
parent
fdd8765256
commit
6a7d58003b
@ -1238,6 +1238,11 @@
|
|||||||
.4byte \ptr
|
.4byte \ptr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro trygetbaddreamstarget ptr
|
||||||
|
.byte 0xfd
|
||||||
|
.4byte \ptr
|
||||||
|
.endm
|
||||||
|
|
||||||
@ various command changed to more readable macros
|
@ various command changed to more readable macros
|
||||||
.macro cancelmultiturnmoves bank
|
.macro cancelmultiturnmoves bank
|
||||||
various \bank, VARIOUS_CANCEL_MULTI_TURN_MOVES
|
various \bank, VARIOUS_CANCEL_MULTI_TURN_MOVES
|
||||||
@ -1431,3 +1436,7 @@
|
|||||||
.macro jumpifnotbattletype flags, jumpptr
|
.macro jumpifnotbattletype flags, jumpptr
|
||||||
jumpifword CMP_NO_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr
|
jumpifword CMP_NO_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro dmg_1_8_targethp
|
||||||
|
manipulatedamage ATK80_1_8_TARGET_HP
|
||||||
|
.endm
|
||||||
|
@ -4461,6 +4461,24 @@ BattleScript_DroughtActivates::
|
|||||||
playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL
|
playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL
|
||||||
call BattleScript_WeatherFormChanges
|
call BattleScript_WeatherFormChanges
|
||||||
end3
|
end3
|
||||||
|
|
||||||
|
BattleScript_BadDreamsActivates::
|
||||||
|
setbyte gBattlerTarget, 0
|
||||||
|
BattleScript_BadDreamsLoop:
|
||||||
|
trygetbaddreamstarget BattleScript_BadDreamsEnd
|
||||||
|
dmg_1_8_targethp
|
||||||
|
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
|
||||||
|
printstring STRINGID_BADDREAMSDMG
|
||||||
|
waitmessage 0x40
|
||||||
|
healthbarupdate BS_TARGET
|
||||||
|
datahpupdate BS_TARGET
|
||||||
|
tryfaintmon BS_TARGET, FALSE, NULL
|
||||||
|
atk24 BattleScript_BadDreamsIncrement
|
||||||
|
BattleScript_BadDreamsIncrement:
|
||||||
|
addbyte gBattlerTarget, 1
|
||||||
|
goto BattleScript_BadDreamsLoop
|
||||||
|
BattleScript_BadDreamsEnd:
|
||||||
|
end3
|
||||||
|
|
||||||
BattleScript_TookAttack::
|
BattleScript_TookAttack::
|
||||||
attackstring
|
attackstring
|
||||||
|
@ -312,5 +312,6 @@ extern const u8 BattleScript_AngryPointActivates[];
|
|||||||
extern const u8 BattleScript_AttackerAbilityStatRaise[];
|
extern const u8 BattleScript_AttackerAbilityStatRaise[];
|
||||||
extern const u8 BattleScript_AttackerAbilityStatRaiseEnd3[];
|
extern const u8 BattleScript_AttackerAbilityStatRaiseEnd3[];
|
||||||
extern const u8 BattleScript_PoisonHealActivates[];
|
extern const u8 BattleScript_PoisonHealActivates[];
|
||||||
|
extern const u8 BattleScript_BadDreamsActivates[];
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||||
|
@ -79,6 +79,7 @@
|
|||||||
#define ATK80_DMG_CHANGE_SIGN 0
|
#define ATK80_DMG_CHANGE_SIGN 0
|
||||||
#define ATK80_DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP 1
|
#define ATK80_DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP 1
|
||||||
#define ATK80_DMG_DOUBLED 2
|
#define ATK80_DMG_DOUBLED 2
|
||||||
|
#define ATK80_1_8_TARGET_HP 3
|
||||||
|
|
||||||
// atk4F, a flag used for the jumpifcantswitch command
|
// atk4F, a flag used for the jumpifcantswitch command
|
||||||
#define ATK4F_DONT_CHECK_STATUSES 0x80
|
#define ATK4F_DONT_CHECK_STATUSES 0x80
|
||||||
|
@ -454,7 +454,8 @@
|
|||||||
#define STRINGID_ANGRYPOINTACTIVATES 451
|
#define STRINGID_ANGRYPOINTACTIVATES 451
|
||||||
#define STRINGID_ATTACKERABILITYSTATRAISE 452
|
#define STRINGID_ATTACKERABILITYSTATRAISE 452
|
||||||
#define STRINGID_POISONHEALHPUP 453
|
#define STRINGID_POISONHEALHPUP 453
|
||||||
|
#define STRINGID_BADDREAMSDMG 454
|
||||||
|
|
||||||
#define BATTLESTRINGS_COUNT 442
|
#define BATTLESTRINGS_COUNT 443
|
||||||
|
|
||||||
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H
|
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H
|
||||||
|
@ -597,6 +597,7 @@ static const u8 sText_PsychicTerrainEnds[] = _("");
|
|||||||
static const u8 sText_GrassyTerrainEnds[] = _("");
|
static const u8 sText_GrassyTerrainEnds[] = _("");
|
||||||
static const u8 sText_AngryPointActivates[] = _("");
|
static const u8 sText_AngryPointActivates[] = _("");
|
||||||
static const u8 sText_PoisonHealHpUp[] = _("");
|
static const u8 sText_PoisonHealHpUp[] = _("");
|
||||||
|
static const u8 sText_BadDreamsDmg[] = _("");
|
||||||
|
|
||||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||||
{
|
{
|
||||||
@ -1043,6 +1044,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
|||||||
sText_AngryPointActivates, // 451
|
sText_AngryPointActivates, // 451
|
||||||
sText_AttackerAbilityRaisedStat, // 452
|
sText_AttackerAbilityRaisedStat, // 452
|
||||||
sText_PoisonHealHpUp, // 453
|
sText_PoisonHealHpUp, // 453
|
||||||
|
sText_BadDreamsDmg, // 454
|
||||||
};
|
};
|
||||||
|
|
||||||
const u16 gMissStringIds[] =
|
const u16 gMissStringIds[] =
|
||||||
|
@ -344,6 +344,7 @@ static void atkF9_settelekinesis(void);
|
|||||||
static void atkFA_swapstatstages(void);
|
static void atkFA_swapstatstages(void);
|
||||||
static void atkFB_averagestats(void);
|
static void atkFB_averagestats(void);
|
||||||
static void atkFC_jumpifoppositegenders(void);
|
static void atkFC_jumpifoppositegenders(void);
|
||||||
|
static void atkFD_trygetbaddreamstarget(void);
|
||||||
|
|
||||||
void (* const gBattleScriptingCommandsTable[])(void) =
|
void (* const gBattleScriptingCommandsTable[])(void) =
|
||||||
{
|
{
|
||||||
@ -600,6 +601,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
|||||||
atkFA_swapstatstages,
|
atkFA_swapstatstages,
|
||||||
atkFB_averagestats,
|
atkFB_averagestats,
|
||||||
atkFC_jumpifoppositegenders,
|
atkFC_jumpifoppositegenders,
|
||||||
|
atkFD_trygetbaddreamstarget,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StatFractions
|
struct StatFractions
|
||||||
@ -6787,6 +6789,11 @@ static void atk80_manipulatedamage(void)
|
|||||||
case ATK80_DMG_DOUBLED:
|
case ATK80_DMG_DOUBLED:
|
||||||
gBattleMoveDamage *= 2;
|
gBattleMoveDamage *= 2;
|
||||||
break;
|
break;
|
||||||
|
case ATK80_1_8_TARGET_HP:
|
||||||
|
gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 8;
|
||||||
|
if (gBattleMoveDamage == 0)
|
||||||
|
gBattleMoveDamage = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBattlescriptCurrInstr += 2;
|
gBattlescriptCurrInstr += 2;
|
||||||
@ -10339,3 +10346,20 @@ static void atkFC_jumpifoppositegenders(void)
|
|||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void atkFD_trygetbaddreamstarget(void)
|
||||||
|
{
|
||||||
|
u8 badDreamsMonSide = GetBattlerSide(gBattlerAttacker);
|
||||||
|
for (;gBattlerTarget < gBattlersCount; gBattlerTarget++)
|
||||||
|
{
|
||||||
|
if (GetBattlerSide(gBattlerTarget) == badDreamsMonSide)
|
||||||
|
continue;
|
||||||
|
if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP && IsBattlerAlive(gBattlerTarget))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gBattlerTarget >= gBattlersCount)
|
||||||
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
|
else
|
||||||
|
gBattlescriptCurrInstr += 5;
|
||||||
|
}
|
||||||
|
@ -2551,6 +2551,13 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
case ABILITY_TRUANT:
|
case ABILITY_TRUANT:
|
||||||
gDisableStructs[gBattlerAttacker].truantCounter ^= 1;
|
gDisableStructs[gBattlerAttacker].truantCounter ^= 1;
|
||||||
break;
|
break;
|
||||||
|
case ABILITY_BAD_DREAMS:
|
||||||
|
if (gBattleMons[BATTLE_OPPOSITE(battler)].status1 & STATUS1_SLEEP || gBattleMons[BATTLE_OPPOSITE(battler)].status1 & STATUS1_SLEEP)
|
||||||
|
{
|
||||||
|
BattleScriptPushCursorAndCallback(BattleScript_BadDreamsActivates);
|
||||||
|
effect++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user