sovereignx/include/battle_util.h

118 lines
5.2 KiB
C
Raw Normal View History

2017-10-06 16:06:45 +01:00
#ifndef GUARD_BATTLE_UTIL_H
#define GUARD_BATTLE_UTIL_H
#define MOVE_LIMITATION_ZEROMOVE (1 << 0)
#define MOVE_LIMITATION_PP (1 << 1)
#define MOVE_LIMITATION_DISABLED (1 << 2)
#define MOVE_LIMITATION_TORMENTED (1 << 3)
#define MOVE_LIMITATION_TAUNT (1 << 4)
#define MOVE_LIMITATION_IMPRISON (1 << 5)
2017-10-06 16:06:45 +01:00
2018-07-01 10:15:42 +01:00
#define ABILITYEFFECT_ON_SWITCHIN 0x0
#define ABILITYEFFECT_ENDTURN 0x1
#define ABILITYEFFECT_MOVES_BLOCK 0x2
#define ABILITYEFFECT_ABSORBING 0x3
2020-04-19 13:43:54 +01:00
#define ABILITYEFFECT_MOVE_END_ATTACKER 0x4
#define ABILITYEFFECT_MOVE_END 0x5
#define ABILITYEFFECT_IMMUNITY 0x6
#define ABILITYEFFECT_FORECAST 0x7
#define ABILITYEFFECT_SYNCHRONIZE 0x8
#define ABILITYEFFECT_ATK_SYNCHRONIZE 0x9
#define ABILITYEFFECT_INTIMIDATE1 0xA
#define ABILITYEFFECT_INTIMIDATE2 0xB
#define ABILITYEFFECT_TRACE1 0xC
#define ABILITYEFFECT_TRACE2 0xD
#define ABILITYEFFECT_MOVE_END_OTHER 0xE
2018-07-01 10:15:42 +01:00
#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
2017-10-06 16:06:45 +01:00
#define ITEMEFFECT_ON_SWITCH_IN 0x0
2018-09-01 19:00:13 +01:00
#define ITEMEFFECT_MOVE_END 0x3
#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4
2019-05-09 19:31:58 +01:00
#define ITEMEFFECT_TARGET 0x5
2019-05-10 10:03:33 +01:00
#define ITEMEFFECT_ORBS 0x6
2017-10-06 16:06:45 +01:00
#define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK)))
2017-10-06 16:06:45 +01:00
2019-03-06 11:09:34 +00:00
#define IS_WHOLE_SIDE_ALIVE(battler)((IsBattlerAlive(battler) && IsBattlerAlive(BATTLE_PARTNER(battler))))
2019-05-20 11:03:00 +01:00
// for Natural Gift and Fling
struct TypePower
{
u8 type;
u8 power;
u16 effect;
};
extern const struct TypePower gNaturalGiftTable[];
2018-02-08 10:17:41 +00:00
u8 GetBattlerForBattleScript(u8 caseId);
void PressurePPLose(u8 target, u8 attacker, u16 move);
void PressurePPLoseOnUsingPerishSong(u8 attacker);
void PressurePPLoseOnUsingImprison(u8 attacker);
2018-02-06 19:48:02 +00:00
void MarkAllBattlersForControllerExec(void); // unused
bool32 IsBattlerMarkedForControllerExec(u8 battlerId);
2018-02-28 23:59:52 +00:00
void MarkBattlerForControllerExec(u8 battlerId);
2017-10-06 16:06:45 +01:00
void sub_803F850(u8 arg0);
2018-02-28 23:59:52 +00:00
void CancelMultiTurnMoves(u8 battlerId);
bool8 WasUnableToUseMove(u8 battlerId);
void PrepareStringBattle(u16 stringId, u8 battlerId);
2017-10-06 16:06:45 +01:00
void ResetSentPokesToOpponentValue(void);
2018-02-28 23:59:52 +00:00
void sub_803F9EC(u8 battlerId);
void sub_803FA70(u8 battlerId);
2017-10-06 16:06:45 +01:00
void BattleScriptPush(const u8* bsPtr);
void BattleScriptPushCursor(void);
void BattleScriptPop(void);
u8 TrySetCantSelectMoveBattleScript(void);
2018-02-28 23:59:52 +00:00
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check);
2017-10-06 16:06:45 +01:00
bool8 AreAllMovesUnusable(void);
2018-02-28 23:59:52 +00:00
u8 GetImprisonedMovesCount(u8 battlerId, u16 move);
2018-07-21 11:10:08 +01:00
u8 DoFieldEndTurnEffects(void);
2020-04-13 14:00:17 +01:00
s32 GetDrainedBigRootHp(u32 battler, s32 hp);
2018-07-18 21:07:48 +01:00
u8 DoBattlerEndTurnEffects(void);
2017-12-02 13:08:55 +00:00
bool8 HandleWishPerishSongOnTurnEnd(void);
bool8 HandleFaintedMonActions(void);
2018-08-11 11:16:00 +01:00
void TryClearRageAndFuryCutter(void);
2017-10-06 16:06:45 +01:00
u8 AtkCanceller_UnableToUseMove(void);
2018-12-01 10:35:49 +00:00
u8 AtkCanceller_UnableToUseMove2(void);
2018-07-01 10:15:42 +01:00
bool8 HasNoMonsToSwitch(u8 battlerId, u8 r1, u8 r2);
2019-06-15 13:46:35 +01:00
u8 TryWeatherFormChange(u8 battlerId);
bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility);
2018-02-28 23:59:52 +00:00
u8 AbilityBattleEffects(u8 caseID, u8 battlerId, u8 ability, u8 special, u16 moveArg);
u32 GetBattlerAbility(u8 battlerId);
u32 IsAbilityOnSide(u32 battlerId, u32 ability);
u32 IsAbilityOnOpposingSide(u32 battlerId, u32 ability);
u32 IsAbilityOnField(u32 ability);
u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability);
u32 IsAbilityPreventingEscape(u32 battlerId);
2017-10-06 16:06:45 +01:00
void BattleScriptExecute(const u8* BS_ptr);
void BattleScriptPushCursorAndCallback(const u8* BS_ptr);
2018-02-28 23:59:52 +00:00
u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn);
void ClearFuryCutterDestinyBondGrudge(u8 battlerId);
2017-10-06 16:06:45 +01:00
void HandleAction_RunBattleScript(void);
2019-08-27 17:29:34 +01:00
u32 SetRandomTarget(u32 battlerId);
2018-02-28 23:59:52 +00:00
u8 GetMoveTarget(u16 move, u8 setTarget);
2017-12-02 13:08:55 +00:00
u8 IsMonDisobedient(void);
2018-07-14 15:41:14 +01:00
u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating);
u32 GetBattlerHoldEffectParam(u8 battlerId);
bool32 IsMoveMakingContact(u16 move, u8 battlerAtk);
bool32 IsBattlerGrounded(u8 battlerId);
2018-07-22 14:08:32 +01:00
bool32 IsBattlerAlive(u8 battlerId);
2018-07-14 15:41:14 +01:00
u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move);
u32 GetBattlerWeight(u8 battlerId);
s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags);
2018-07-14 21:56:03 +01:00
u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities);
2018-07-15 11:39:07 +01:00
u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u8 abilityDef);
u16 GetTypeModifier(u8 atkType, u8 defType);
2018-07-24 20:47:00 +01:00
s32 GetStealthHazardDamage(u8 hazardType, u8 battlerId);
u16 GetMegaEvolutionSpecies(u16 preEvoSpecies, u16 heldItemId);
2018-09-16 17:55:32 +01:00
bool32 CanMegaEvolve(u8 battlerId);
void UndoMegaEvolution(u32 monId);
void UndoFormChange(u32 monId, u32 side);
2018-09-29 14:43:56 +01:00
bool32 DoBattlersShareType(u32 battler1, u32 battler2);
2018-09-30 11:27:51 +01:00
bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId);
2019-08-08 12:06:55 +01:00
struct Pokemon *GetIllusionMonPtr(u32 battlerId);
void ClearIllusionMon(u32 battlerId);
bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId);
2017-10-06 16:06:45 +01:00
#endif // GUARD_BATTLE_UTIL_H