mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-19 12:08:34 +01:00
merge with be
This commit is contained in:
commit
a2d885c0d4
@ -1242,13 +1242,13 @@ BattleScript_ShellSmashTryDef::
|
|||||||
setbyte sSTAT_ANIM_PLAYED, FALSE
|
setbyte sSTAT_ANIM_PLAYED, FALSE
|
||||||
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, STAT_CHANGE_NEGATIVE | STAT_CHANGE_CANT_PREVENT
|
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, STAT_CHANGE_NEGATIVE | STAT_CHANGE_CANT_PREVENT
|
||||||
setstatchanger STAT_DEF, 1, TRUE
|
setstatchanger STAT_DEF, 1, TRUE
|
||||||
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_ShellSmashTrySpDef
|
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR | MOVE_EFFECT_CERTAIN, BattleScript_ShellSmashTrySpDef
|
||||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_ShellSmashTrySpDef
|
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_ShellSmashTrySpDef
|
||||||
printfromtable gStatUpStringIds
|
printfromtable gStatUpStringIds
|
||||||
waitmessage B_WAIT_TIME_LONG
|
waitmessage B_WAIT_TIME_LONG
|
||||||
BattleScript_ShellSmashTrySpDef:
|
BattleScript_ShellSmashTrySpDef:
|
||||||
setstatchanger STAT_SPDEF, 1, TRUE
|
setstatchanger STAT_SPDEF, 1, TRUE
|
||||||
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_ShellSmashTryAttack
|
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR | MOVE_EFFECT_CERTAIN, BattleScript_ShellSmashTryAttack
|
||||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_ShellSmashTryAttack
|
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_ShellSmashTryAttack
|
||||||
printfromtable gStatUpStringIds
|
printfromtable gStatUpStringIds
|
||||||
waitmessage B_WAIT_TIME_LONG
|
waitmessage B_WAIT_TIME_LONG
|
||||||
|
@ -192,7 +192,8 @@ struct SideTimer
|
|||||||
u8 safeguardTimer;
|
u8 safeguardTimer;
|
||||||
u8 safeguardBattlerId;
|
u8 safeguardBattlerId;
|
||||||
u8 followmeTimer;
|
u8 followmeTimer;
|
||||||
u8 followmeTarget;
|
u8 followmeTarget:3;
|
||||||
|
u8 followmePowder:1; // Rage powder, does not affect grass type pokemon.
|
||||||
u8 spikesAmount;
|
u8 spikesAmount;
|
||||||
u8 toxicSpikesAmount;
|
u8 toxicSpikesAmount;
|
||||||
u8 stealthRockAmount;
|
u8 stealthRockAmount;
|
||||||
|
@ -47,6 +47,7 @@ struct TypePower
|
|||||||
extern const struct TypePower gNaturalGiftTable[];
|
extern const struct TypePower gNaturalGiftTable[];
|
||||||
|
|
||||||
void HandleAction_ThrowBall(void);
|
void HandleAction_ThrowBall(void);
|
||||||
|
bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide);
|
||||||
void HandleAction_UseMove(void);
|
void HandleAction_UseMove(void);
|
||||||
void HandleAction_Switch(void);
|
void HandleAction_Switch(void);
|
||||||
void HandleAction_UseItem(void);
|
void HandleAction_UseItem(void);
|
||||||
|
@ -640,7 +640,7 @@ bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect)
|
|||||||
{
|
{
|
||||||
if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS))
|
if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS))
|
||||||
|| ability == ABILITY_OVERCOAT
|
|| ability == ABILITY_OVERCOAT
|
||||||
|| GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_SAFETY_GOOGLES)
|
|| holdEffect == HOLD_EFFECT_SAFETY_GOOGLES)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -7408,7 +7408,7 @@ static void Cmd_various(void)
|
|||||||
case VARIOUS_SET_MAGIC_COAT_TARGET:
|
case VARIOUS_SET_MAGIC_COAT_TARGET:
|
||||||
gBattlerAttacker = gBattlerTarget;
|
gBattlerAttacker = gBattlerTarget;
|
||||||
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
|
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
|
||||||
if (gSideTimers[side].followmeTimer != 0 && gBattleMons[gSideTimers[side].followmeTarget].hp != 0)
|
if (IsAffectedByFollowMe(gBattlerAttacker, side))
|
||||||
gBattlerTarget = gSideTimers[side].followmeTarget;
|
gBattlerTarget = gSideTimers[side].followmeTarget;
|
||||||
else
|
else
|
||||||
gBattlerTarget = gActiveBattler;
|
gBattlerTarget = gActiveBattler;
|
||||||
@ -9980,7 +9980,7 @@ static void Cmd_counterdamagecalculator(void)
|
|||||||
{
|
{
|
||||||
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].physicalDmg * 2;
|
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].physicalDmg * 2;
|
||||||
|
|
||||||
if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp)
|
if (IsAffectedByFollowMe(gBattlerAttacker, sideTarget))
|
||||||
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
||||||
else
|
else
|
||||||
gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBattlerId;
|
gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBattlerId;
|
||||||
@ -9999,11 +9999,13 @@ static void Cmd_mirrorcoatdamagecalculator(void) // a copy of atkA1 with the phy
|
|||||||
u8 sideAttacker = GetBattlerSide(gBattlerAttacker);
|
u8 sideAttacker = GetBattlerSide(gBattlerAttacker);
|
||||||
u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBattlerId);
|
u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBattlerId);
|
||||||
|
|
||||||
if (gProtectStructs[gBattlerAttacker].specialDmg && sideAttacker != sideTarget && gBattleMons[gProtectStructs[gBattlerAttacker].specialBattlerId].hp)
|
if (gProtectStructs[gBattlerAttacker].specialDmg
|
||||||
|
&& sideAttacker != sideTarget
|
||||||
|
&& gBattleMons[gProtectStructs[gBattlerAttacker].specialBattlerId].hp)
|
||||||
{
|
{
|
||||||
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].specialDmg * 2;
|
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].specialDmg * 2;
|
||||||
|
|
||||||
if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp)
|
if (IsAffectedByFollowMe(gBattlerAttacker, sideTarget))
|
||||||
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
||||||
else
|
else
|
||||||
gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBattlerId;
|
gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBattlerId;
|
||||||
@ -11084,6 +11086,7 @@ static void Cmd_setforcedtarget(void) // follow me
|
|||||||
{
|
{
|
||||||
gSideTimers[GetBattlerSide(gBattlerAttacker)].followmeTimer = 1;
|
gSideTimers[GetBattlerSide(gBattlerAttacker)].followmeTimer = 1;
|
||||||
gSideTimers[GetBattlerSide(gBattlerAttacker)].followmeTarget = gBattlerAttacker;
|
gSideTimers[GetBattlerSide(gBattlerAttacker)].followmeTarget = gBattlerAttacker;
|
||||||
|
gSideTimers[GetBattlerSide(gBattlerAttacker)].followmePowder = TestMoveFlags(gCurrentMove, FLAG_POWDER);
|
||||||
gBattlescriptCurrInstr++;
|
gBattlescriptCurrInstr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12557,7 +12560,7 @@ static void Cmd_metalburstdamagecalculator(void)
|
|||||||
{
|
{
|
||||||
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].physicalDmg * 150 / 100;
|
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].physicalDmg * 150 / 100;
|
||||||
|
|
||||||
if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp)
|
if (IsAffectedByFollowMe(gBattlerAttacker, sideTarget))
|
||||||
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
||||||
else
|
else
|
||||||
gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBattlerId;
|
gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBattlerId;
|
||||||
@ -12570,7 +12573,7 @@ static void Cmd_metalburstdamagecalculator(void)
|
|||||||
{
|
{
|
||||||
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].specialDmg * 150 / 100;
|
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].specialDmg * 150 / 100;
|
||||||
|
|
||||||
if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp)
|
if (IsAffectedByFollowMe(gBattlerAttacker, sideTarget))
|
||||||
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
||||||
else
|
else
|
||||||
gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBattlerId;
|
gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBattlerId;
|
||||||
|
@ -217,6 +217,21 @@ static const u16 sEntrainmentTargetSimpleBeamBannedAbilities[] =
|
|||||||
ABILITY_GULP_MISSILE,
|
ABILITY_GULP_MISSILE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide)
|
||||||
|
{
|
||||||
|
u32 ability = GetBattlerAbility(battlerAtk);
|
||||||
|
|
||||||
|
if (gSideTimers[defSide].followmeTimer == 0
|
||||||
|
|| gBattleMons[gSideTimers[defSide].followmeTarget].hp == 0
|
||||||
|
|| ability == ABILITY_PROPELLER_TAIL || ability == ABILITY_STALWART)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (gSideTimers[defSide].followmePowder && !IsAffectedByPowder(battlerAtk, ability, GetBattlerHoldEffect(battlerAtk, TRUE)))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
void HandleAction_UseMove(void)
|
void HandleAction_UseMove(void)
|
||||||
{
|
{
|
||||||
@ -292,12 +307,9 @@ void HandleAction_UseMove(void)
|
|||||||
|
|
||||||
// choose target
|
// choose target
|
||||||
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
|
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
|
||||||
if (gSideTimers[side].followmeTimer != 0
|
if (IsAffectedByFollowMe(gBattlerAttacker, side)
|
||||||
&& gBattleMoves[gCurrentMove].target == MOVE_TARGET_SELECTED
|
&& gBattleMoves[gCurrentMove].target == MOVE_TARGET_SELECTED
|
||||||
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gSideTimers[side].followmeTarget)
|
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gSideTimers[side].followmeTarget))
|
||||||
&& gBattleMons[gSideTimers[side].followmeTarget].hp != 0
|
|
||||||
&& (GetBattlerAbility(gBattlerAttacker) != ABILITY_PROPELLER_TAIL
|
|
||||||
|| GetBattlerAbility(gBattlerAttacker) != ABILITY_STALWART))
|
|
||||||
{
|
{
|
||||||
gBattlerTarget = gSideTimers[side].followmeTarget;
|
gBattlerTarget = gSideTimers[side].followmeTarget;
|
||||||
}
|
}
|
||||||
@ -6563,7 +6575,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
|
|||||||
{
|
{
|
||||||
case MOVE_TARGET_SELECTED:
|
case MOVE_TARGET_SELECTED:
|
||||||
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
|
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
|
||||||
if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp)
|
if (IsAffectedByFollowMe(gBattlerAttacker, side))
|
||||||
{
|
{
|
||||||
targetBattler = gSideTimers[side].followmeTarget;
|
targetBattler = gSideTimers[side].followmeTarget;
|
||||||
}
|
}
|
||||||
@ -6598,7 +6610,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
|
|||||||
break;
|
break;
|
||||||
case MOVE_TARGET_RANDOM:
|
case MOVE_TARGET_RANDOM:
|
||||||
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
|
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
|
||||||
if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp)
|
if (IsAffectedByFollowMe(gBattlerAttacker, side))
|
||||||
targetBattler = gSideTimers[side].followmeTarget;
|
targetBattler = gSideTimers[side].followmeTarget;
|
||||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM)
|
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM)
|
||||||
targetBattler = SetRandomTarget(gBattlerAttacker);
|
targetBattler = SetRandomTarget(gBattlerAttacker);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user