mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Rethink final strike effects
This is now checked in SetMoveEffect instead of in each move that should behave this way. Some effects will need to be redone to make them play nice with this change, but some just work as is.
This commit is contained in:
parent
d30f2b5712
commit
e407883b58
@ -813,11 +813,9 @@ BattleScript_EffectBurnUp:
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpiftype BS_ATTACKER, TYPE_FIRE, BattleScript_BurnUpWorks
|
||||
goto BattleScript_MoveEnd
|
||||
goto BattleScript_ButItFailed
|
||||
BattleScript_BurnUpWorks:
|
||||
accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE
|
||||
setmoveeffect MOVE_EFFECT_BURN_UP
|
||||
seteffectwithchance
|
||||
critcalc
|
||||
damagecalc
|
||||
adjustdamage
|
||||
@ -832,6 +830,9 @@ BattleScript_BurnUpWorks:
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
losetype BS_ATTACKER, TYPE_FIRE
|
||||
printstring STRINGID_ATTACKERLOSTFIRETYPE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_TARGET, FALSE, NULL
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
|
@ -358,7 +358,7 @@
|
||||
#define MOVE_EFFECT_BUG_BITE 0x45
|
||||
#define MOVE_EFFECT_RECOIL_HP_25 0x46
|
||||
#define MOVE_EFFECT_RELIC_SONG 0x47
|
||||
#define MOVE_EFFECT_BURN_UP 0x48
|
||||
|
||||
#define NUM_MOVE_EFFECTS 0x48
|
||||
|
||||
#define MOVE_EFFECT_AFFECTS_USER 0x4000
|
||||
|
@ -301,6 +301,7 @@ static bool8 sub_804F344(void);
|
||||
static void PutMonIconOnLvlUpBox(void);
|
||||
static void PutLevelAndGenderOnLvlUpBox(void);
|
||||
static bool32 CriticalCapture(u32 odds);
|
||||
static bool8 IsFinalStrikeEffect(u16 move);
|
||||
|
||||
static void SpriteCB_MonIconOnLvlUpBox(struct Sprite* sprite);
|
||||
|
||||
@ -1134,6 +1135,24 @@ static const u16 sMoveEffectsForbiddenToInstruct[] =
|
||||
FORBIDDEN_INSTRUCT_END
|
||||
};
|
||||
|
||||
static const u16 sFinalStrikeOnlyEffects[] =
|
||||
{
|
||||
EFFECT_RELIC_SONG,
|
||||
EFFECT_BUG_BITE,
|
||||
EFFECT_THIEF,
|
||||
EFFECT_BURN_UP,
|
||||
EFFECT_PAY_DAY,
|
||||
EFFECT_SECRET_POWER,
|
||||
EFFECT_HIT_SWITCH_TARGET,
|
||||
EFFECT_SMACK_DOWN,
|
||||
EFFECT_SPARKLING_ARIA,
|
||||
EFFECT_SMELLINGSALT,
|
||||
EFFECT_WAKE_UP_SLAP,
|
||||
EFFECT_HIT_ESCAPE,
|
||||
EFFECT_RECOIL_HP_25,
|
||||
EFFECT_HIT_PREVENT_ESCAPE,
|
||||
};
|
||||
|
||||
static const u16 sNaturePowerMoves[] =
|
||||
{
|
||||
[BATTLE_TERRAIN_GRASS] = MOVE_ENERGY_BALL,
|
||||
@ -2656,13 +2675,20 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
bool32 statusChanged = FALSE;
|
||||
bool32 mirrorArmorReflected = (GetBattlerAbility(gBattlerTarget) == ABILITY_MIRROR_ARMOR);
|
||||
u32 flags = 0;
|
||||
|
||||
|
||||
if (gSpecialStatuses[gBattlerAttacker].parentalBondOn == 2
|
||||
&& gBattleMons[gBattlerTarget].hp != 0
|
||||
&& IsFinalStrikeEffect(gCurrentMove))
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (gBattleScripting.moveEffect) // Set move effects which happen later on
|
||||
{
|
||||
case MOVE_EFFECT_KNOCK_OFF:
|
||||
case MOVE_EFFECT_SMACK_DOWN:
|
||||
case MOVE_EFFECT_REMOVE_STATUS:
|
||||
case MOVE_EFFECT_BURN_UP:
|
||||
gBattleStruct->moveEffect2 = gBattleScripting.moveEffect;
|
||||
gBattlescriptCurrInstr++;
|
||||
return;
|
||||
@ -3160,8 +3186,6 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
gBattlescriptCurrInstr++;
|
||||
break;
|
||||
case MOVE_EFFECT_STEAL_ITEM:
|
||||
// Only steal items on the final strike of Parental Bond
|
||||
if (!(gSpecialStatuses[gBattlerAttacker].parentalBondOn == 2 && gBattleMons[gBattlerTarget].hp != 0))
|
||||
{
|
||||
if (!CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item))
|
||||
{
|
||||
@ -3385,8 +3409,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
break;
|
||||
case MOVE_EFFECT_BUG_BITE:
|
||||
if (ItemId_GetPocket(gBattleMons[gEffectBattler].item) == POCKET_BERRIES
|
||||
&& GetBattlerAbility(gEffectBattler) != ABILITY_STICKY_HOLD
|
||||
&& !(gSpecialStatuses[gBattlerAttacker].parentalBondOn == 2 && gBattleMons[gBattlerTarget].hp != 0)) // Steal berry on final hit
|
||||
&& GetBattlerAbility(gEffectBattler) != ABILITY_STICKY_HOLD)
|
||||
{
|
||||
// target loses their berry
|
||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||
@ -5089,11 +5112,6 @@ static void Cmd_moveend(void)
|
||||
}
|
||||
}
|
||||
break; // MOVE_EFFECT_REMOVE_STATUS
|
||||
case MOVE_EFFECT_BURN_UP:
|
||||
effect = TRUE;
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_BurnUpRemoveType;
|
||||
break;
|
||||
}
|
||||
gBattleStruct->moveEffect2 = 0;
|
||||
gBattleScripting.moveendState++;
|
||||
@ -13582,3 +13600,16 @@ bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool8 IsFinalStrikeEffect(u16 move)
|
||||
{
|
||||
u32 i;
|
||||
u16 moveEffect = gBattleMoves[move].effect;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sFinalStrikeOnlyEffects); i++)
|
||||
{
|
||||
if (moveEffect == sFinalStrikeOnlyEffects[i])
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user