mirror of
https://github.com/rh-hideout/pokeemerald-expansion.git
synced 2026-03-21 18:04:50 -05:00
Move attack canceler to the move resolution file (#8921)
This commit is contained in:
parent
6c05a08750
commit
da62ebcffd
|
|
@ -6,6 +6,7 @@
|
||||||
#include "constants/battle_switch_in.h"
|
#include "constants/battle_switch_in.h"
|
||||||
#include "constants/abilities.h"
|
#include "constants/abilities.h"
|
||||||
#include "constants/battle.h"
|
#include "constants/battle.h"
|
||||||
|
#include "constants/battle_move_resolution.h"
|
||||||
#include "constants/form_change_types.h"
|
#include "constants/form_change_types.h"
|
||||||
#include "constants/hold_effects.h"
|
#include "constants/hold_effects.h"
|
||||||
#include "constants/moves.h"
|
#include "constants/moves.h"
|
||||||
|
|
@ -554,7 +555,7 @@ struct EventStates
|
||||||
enum FirstTurnEventsStates beforeFirstTurn:8;
|
enum FirstTurnEventsStates beforeFirstTurn:8;
|
||||||
enum FaintedActions faintedAction:8;
|
enum FaintedActions faintedAction:8;
|
||||||
enum BattlerId faintedActionBattler:4;
|
enum BattlerId faintedActionBattler:4;
|
||||||
enum MoveSuccessOrder atkCanceler:8;
|
enum CancelerState atkCanceler:8;
|
||||||
enum BattlerId atkCancelerBattler:4;
|
enum BattlerId atkCancelerBattler:4;
|
||||||
enum BattleIntroStates battleIntro:8;
|
enum BattleIntroStates battleIntro:8;
|
||||||
enum SwitchInEvents switchIn:8;
|
enum SwitchInEvents switchIn:8;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "constants/battle.h"
|
#include "constants/battle.h"
|
||||||
#include "battle_bg.h"
|
#include "battle_bg.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
struct BattleEnvironment
|
struct BattleEnvironment
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
#include "constants/battle_move_resolution.h"
|
#include "constants/battle_move_resolution.h"
|
||||||
|
|
||||||
bool32 DoMoveEnd(enum MoveEndState endMode, enum MoveEndState endState);
|
enum CancelerResult DoAttackCanceler(void);
|
||||||
|
enum MoveEndResult DoMoveEnd(enum MoveEndState endMode, enum MoveEndState endState);
|
||||||
void MoveValuesCleanUp(void);
|
void MoveValuesCleanUp(void);
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_MOVE_RESOLUTION_H
|
#endif // GUARD_BATTLE_MOVE_RESOLUTION_H
|
||||||
|
|
|
||||||
|
|
@ -86,75 +86,11 @@ enum ItemEffect
|
||||||
// for Natural Gift and Fling
|
// for Natural Gift and Fling
|
||||||
struct TypePower
|
struct TypePower
|
||||||
{
|
{
|
||||||
enum Type type;
|
enum Type type:8;
|
||||||
u8 power;
|
u8 power;
|
||||||
u16 effect;
|
u16 effect;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MoveSuccessOrder
|
|
||||||
{
|
|
||||||
CANCELER_STANCE_CHANGE_1,
|
|
||||||
CANCELER_CLEAR_FLAGS,
|
|
||||||
CANCELER_SKY_DROP,
|
|
||||||
CANCELER_RECHARGE,
|
|
||||||
CANCELER_CHILLY_RECEPTION,
|
|
||||||
CANCELER_ASLEEP_OR_FROZEN,
|
|
||||||
CANCELER_POWER_POINTS,
|
|
||||||
CANCELER_OBEDIENCE,
|
|
||||||
CANCELER_TRUANT,
|
|
||||||
CANCELER_FOCUS_GEN5,
|
|
||||||
CANCELER_FLINCH,
|
|
||||||
CANCELER_DISABLED,
|
|
||||||
CANCELER_VOLATILE_BLOCKED, // Gravity / Heal Block / Throat Chop
|
|
||||||
CANCELER_TAUNTED,
|
|
||||||
CANCELER_IMPRISONED,
|
|
||||||
CANCELER_CONFUSED,
|
|
||||||
CANCELER_PARALYZED,
|
|
||||||
CANCELER_INFATUATION,
|
|
||||||
CANCELER_BIDE,
|
|
||||||
CANCELER_Z_MOVES,
|
|
||||||
CANCELER_CHOICE_LOCK,
|
|
||||||
CANCELER_CALLSUBMOVE,
|
|
||||||
CANCELER_THAW,
|
|
||||||
CANCELER_STANCE_CHANGE_2,
|
|
||||||
CANCELER_ATTACKSTRING,
|
|
||||||
CANCELER_PPDEDUCTION,
|
|
||||||
CANCELER_SKY_BATTLE,
|
|
||||||
CANCELER_WEATHER_PRIMAL,
|
|
||||||
CANCELER_FOCUS_PRE_GEN5,
|
|
||||||
CANCELER_MOVE_FAILURE,
|
|
||||||
CANCELER_POWDER_STATUS,
|
|
||||||
CANCELER_PRIORITY_BLOCK,
|
|
||||||
CANCELER_PROTEAN,
|
|
||||||
CANCELER_EXPLODING_DAMP,
|
|
||||||
CANCELER_EXPLOSION,
|
|
||||||
CANCELER_CHARGING,
|
|
||||||
CANCELER_NO_TARGET,
|
|
||||||
CANCELER_TOOK_ATTACK,
|
|
||||||
CANCELER_TARGET_FAILURE,
|
|
||||||
CANCELER_NOT_FULLY_PROTECTED,
|
|
||||||
CANCELER_MULTIHIT_MOVES,
|
|
||||||
CANCELER_END,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Obedience
|
|
||||||
{
|
|
||||||
OBEYS,
|
|
||||||
DISOBEYS_LOAFS,
|
|
||||||
DISOBEYS_HITS_SELF,
|
|
||||||
DISOBEYS_FALL_ASLEEP,
|
|
||||||
DISOBEYS_WHILE_ASLEEP,
|
|
||||||
DISOBEYS_RANDOM_MOVE,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum MoveCanceler
|
|
||||||
{
|
|
||||||
MOVE_STEP_SUCCESS,
|
|
||||||
MOVE_STEP_BREAK, // Runs script. Increments state
|
|
||||||
MOVE_STEP_PAUSE, // Runs script. Does not increment state
|
|
||||||
MOVE_STEP_FAILURE, // Move failed, jump to script that handles the failure
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImmunityHealStatusOutcome
|
enum ImmunityHealStatusOutcome
|
||||||
{
|
{
|
||||||
IMMUNITY_NO_EFFECT,
|
IMMUNITY_NO_EFFECT,
|
||||||
|
|
@ -240,6 +176,7 @@ void HandleAction_ThrowBall(void);
|
||||||
uq4_12_t CalcTypeEffectivenessMultiplierHelper(enum Move move, enum Type moveType, u32 battlerAtk, u32 battlerDef, enum Ability abilityAtk, enum Ability abilityDef, bool32 recordAbilities);
|
uq4_12_t CalcTypeEffectivenessMultiplierHelper(enum Move move, enum Type moveType, u32 battlerAtk, u32 battlerDef, enum Ability abilityAtk, enum Ability abilityDef, bool32 recordAbilities);
|
||||||
u32 GetCurrentBattleWeather(void);
|
u32 GetCurrentBattleWeather(void);
|
||||||
bool32 EndOrContinueWeather(void);
|
bool32 EndOrContinueWeather(void);
|
||||||
|
enum DamageCategory GetReflectDamageMoveDamageCategory(u32 battler, enum Move move);
|
||||||
bool32 IsUnnerveBlocked(u32 battler, enum Item itemId);
|
bool32 IsUnnerveBlocked(u32 battler, enum Item itemId);
|
||||||
bool32 IsAffectedByFollowMe(u32 battlerAtk, enum BattleSide defSide, enum Move move);
|
bool32 IsAffectedByFollowMe(u32 battlerAtk, enum BattleSide defSide, enum Move move);
|
||||||
void DetermineTarget(enum MoveTarget moveTarget, bool32 overwriteTarget);
|
void DetermineTarget(enum MoveTarget moveTarget, bool32 overwriteTarget);
|
||||||
|
|
@ -280,7 +217,6 @@ s32 GetDrainedBigRootHp(u32 battler, s32 hp);
|
||||||
bool32 IsAbilityAndRecord(u32 battler, enum Ability battlerAbility, enum Ability abilityToCheck);
|
bool32 IsAbilityAndRecord(u32 battler, enum Ability battlerAbility, enum Ability abilityToCheck);
|
||||||
bool32 HandleFaintedMonActions(void);
|
bool32 HandleFaintedMonActions(void);
|
||||||
void TryClearRageAndFuryCutter(void);
|
void TryClearRageAndFuryCutter(void);
|
||||||
enum MoveCanceler AtkCanceler_MoveSuccessOrder(void);
|
|
||||||
bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2);
|
bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2);
|
||||||
bool32 TryChangeBattleWeather(u32 battler, u32 battleWeatherId, enum Ability ability);
|
bool32 TryChangeBattleWeather(u32 battler, u32 battleWeatherId, enum Ability ability);
|
||||||
bool32 TryChangeBattleTerrain(u32 battler, u32 statusFlag);
|
bool32 TryChangeBattleTerrain(u32 battler, u32 statusFlag);
|
||||||
|
|
@ -363,6 +299,7 @@ void SetDynamicMoveCategory(u32 battlerAtk, u32 battlerDef, enum Move move);
|
||||||
bool32 CanFling(u32 battlerAtk, u32 battlerDef);
|
bool32 CanFling(u32 battlerAtk, u32 battlerDef);
|
||||||
bool32 IsTelekinesisBannedSpecies(u16 species);
|
bool32 IsTelekinesisBannedSpecies(u16 species);
|
||||||
bool32 IsHealBlockPreventingMove(u32 battler, enum Move move);
|
bool32 IsHealBlockPreventingMove(u32 battler, enum Move move);
|
||||||
|
bool32 IsGravityPreventingMove(enum Move move);
|
||||||
bool32 IsBelchPreventingMove(u32 battler, enum Move move);
|
bool32 IsBelchPreventingMove(u32 battler, enum Move move);
|
||||||
bool32 HasEnoughHpToEatBerry(u32 battler, enum Ability ability, u32 hpFraction, enum Item itemId);
|
bool32 HasEnoughHpToEatBerry(u32 battler, enum Ability ability, u32 hpFraction, enum Item itemId);
|
||||||
bool32 IsPartnerMonFromSameTrainer(u32 battler);
|
bool32 IsPartnerMonFromSameTrainer(u32 battler);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,75 @@
|
||||||
#ifndef GUARD_CONSTANTS_BATTLE_MOVE_RESOLUTION_H
|
#ifndef GUARD_CONSTANTS_BATTLE_MOVE_RESOLUTION_H
|
||||||
#define GUARD_CONSTANTS_BATTLE_MOVE_RESOLUTION_H
|
#define GUARD_CONSTANTS_BATTLE_MOVE_RESOLUTION_H
|
||||||
|
|
||||||
|
enum Obedience
|
||||||
|
{
|
||||||
|
OBEYS,
|
||||||
|
DISOBEYS_LOAFS,
|
||||||
|
DISOBEYS_HITS_SELF,
|
||||||
|
DISOBEYS_FALL_ASLEEP,
|
||||||
|
DISOBEYS_WHILE_ASLEEP,
|
||||||
|
DISOBEYS_RANDOM_MOVE,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CancelerResult
|
||||||
|
{
|
||||||
|
CANCELER_RESULT_SUCCESS,
|
||||||
|
CANCELER_RESULT_BREAK, // Runs script. Increments state
|
||||||
|
CANCELER_RESULT_PAUSE, // Runs script. Does not increment state
|
||||||
|
CANCELER_RESULT_FAILURE, // Move failed, jump to script that handles the failure
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CancelerState
|
||||||
|
{
|
||||||
|
CANCELER_STANCE_CHANGE_1,
|
||||||
|
CANCELER_CLEAR_FLAGS,
|
||||||
|
CANCELER_SKY_DROP,
|
||||||
|
CANCELER_RECHARGE,
|
||||||
|
CANCELER_CHILLY_RECEPTION,
|
||||||
|
CANCELER_ASLEEP_OR_FROZEN,
|
||||||
|
CANCELER_POWER_POINTS,
|
||||||
|
CANCELER_OBEDIENCE,
|
||||||
|
CANCELER_TRUANT,
|
||||||
|
CANCELER_FOCUS_GEN5,
|
||||||
|
CANCELER_FLINCH,
|
||||||
|
CANCELER_DISABLED,
|
||||||
|
CANCELER_VOLATILE_BLOCKED, // Gravity / Heal Block / Throat Chop
|
||||||
|
CANCELER_TAUNTED,
|
||||||
|
CANCELER_IMPRISONED,
|
||||||
|
CANCELER_CONFUSED,
|
||||||
|
CANCELER_PARALYZED,
|
||||||
|
CANCELER_INFATUATION,
|
||||||
|
CANCELER_BIDE,
|
||||||
|
CANCELER_Z_MOVES,
|
||||||
|
CANCELER_CHOICE_LOCK,
|
||||||
|
CANCELER_CALLSUBMOVE,
|
||||||
|
CANCELER_THAW,
|
||||||
|
CANCELER_STANCE_CHANGE_2,
|
||||||
|
CANCELER_ATTACKSTRING,
|
||||||
|
CANCELER_PPDEDUCTION,
|
||||||
|
CANCELER_SKY_BATTLE,
|
||||||
|
CANCELER_WEATHER_PRIMAL,
|
||||||
|
CANCELER_FOCUS_PRE_GEN5,
|
||||||
|
CANCELER_MOVE_FAILURE,
|
||||||
|
CANCELER_POWDER_STATUS,
|
||||||
|
CANCELER_PRIORITY_BLOCK,
|
||||||
|
CANCELER_PROTEAN,
|
||||||
|
CANCELER_EXPLODING_DAMP,
|
||||||
|
CANCELER_EXPLOSION,
|
||||||
|
CANCELER_CHARGING,
|
||||||
|
CANCELER_NO_TARGET,
|
||||||
|
CANCELER_TOOK_ATTACK,
|
||||||
|
CANCELER_TARGET_FAILURE,
|
||||||
|
CANCELER_NOT_FULLY_PROTECTED,
|
||||||
|
CANCELER_MULTIHIT_MOVES,
|
||||||
|
CANCELER_END,
|
||||||
|
};
|
||||||
|
|
||||||
enum MoveEndResult
|
enum MoveEndResult
|
||||||
{
|
{
|
||||||
MOVEEND_STEP_CONTINUE,
|
MOVEEND_RESULT_CONTINUE,
|
||||||
MOVEEND_STEP_RUN_SCRIPT,
|
MOVEEND_RESULT_RUN_SCRIPT,
|
||||||
MOVEEND_STEP_BREAK,
|
MOVEEND_RESULT_BREAK,
|
||||||
};
|
};
|
||||||
|
|
||||||
// cases for Cmd_moveend - Order matters!
|
// cases for Cmd_moveend - Order matters!
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1034,7 +1034,7 @@ static void Cmd_attackcanceler(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AtkCanceler_MoveSuccessOrder() != MOVE_STEP_SUCCESS)
|
if (DoAttackCanceler() != CANCELER_RESULT_SUCCESS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gBattleStruct->magicBounceActive && !gBattleStruct->bouncedMoveIsUsed)
|
if (gBattleStruct->magicBounceActive && !gBattleStruct->bouncedMoveIsUsed)
|
||||||
|
|
@ -5010,10 +5010,10 @@ static void Cmd_moveend(void)
|
||||||
|
|
||||||
enum MoveEndResult result = DoMoveEnd(cmd->endMode, cmd->endState);
|
enum MoveEndResult result = DoMoveEnd(cmd->endMode, cmd->endState);
|
||||||
|
|
||||||
if (result == MOVEEND_STEP_BREAK)
|
if (result == MOVEEND_RESULT_BREAK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gBattleScripting.moveendState == MOVEEND_COUNT && result == MOVEEND_STEP_CONTINUE)
|
if (gBattleScripting.moveendState == MOVEEND_COUNT && result == MOVEEND_RESULT_CONTINUE)
|
||||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6249,7 +6249,7 @@ static void Cmd_futuresighttargetfailure(void)
|
||||||
CMD_ARGS(const u8 *failInstr);
|
CMD_ARGS(const u8 *failInstr);
|
||||||
|
|
||||||
// Just do CancelerTargetFailure
|
// Just do CancelerTargetFailure
|
||||||
if (!DONE_TARGET_FAILURE && AtkCanceler_MoveSuccessOrder() != MOVE_STEP_SUCCESS)
|
if (!DONE_TARGET_FAILURE && DoAttackCanceler() != CANCELER_RESULT_SUCCESS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (IsBattlerUnaffectedByMove(gBattlerTarget))
|
if (IsBattlerUnaffectedByMove(gBattlerTarget))
|
||||||
|
|
@ -6257,6 +6257,7 @@ static void Cmd_futuresighttargetfailure(void)
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||||
}
|
}
|
||||||
|
#undef DONE_TARGET_FAILURE
|
||||||
|
|
||||||
static u32 GetPossibleNextTarget(void)
|
static u32 GetPossibleNextTarget(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
1825
src/battle_util.c
1825
src/battle_util.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user