2018-02-27 20:40:09 +01:00
|
|
|
#include "global.h"
|
|
|
|
#include "pokemon.h"
|
|
|
|
#include "battle.h"
|
2019-03-31 12:15:39 -05:00
|
|
|
#include "battle_anim.h"
|
2018-02-27 20:40:09 +01:00
|
|
|
#include "battle_tv.h"
|
|
|
|
#include "constants/battle_string_ids.h"
|
|
|
|
#include "constants/battle_anim.h"
|
|
|
|
#include "constants/moves.h"
|
|
|
|
#include "battle_message.h"
|
|
|
|
#include "tv.h"
|
2021-01-14 06:29:59 -05:00
|
|
|
#include "constants/battle_move_effects.h"
|
2018-02-27 20:40:09 +01:00
|
|
|
|
|
|
|
// this file's functions
|
2021-01-14 06:29:59 -05:00
|
|
|
static bool8 IsNotSpecialBattleString(u16 stringId);
|
2018-02-27 20:40:09 +01:00
|
|
|
static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3);
|
|
|
|
static void TrySetBattleSeminarShow(void);
|
|
|
|
static void AddPointsOnFainting(bool8 targetFainted);
|
|
|
|
static void AddPointsBasedOnWeather(u16 weatherFlags, u16 moveId, u8 moveSlot);
|
|
|
|
static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride);
|
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
#define TABLE_END ((u16)-1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PTS_MOVE_EFFECT,
|
|
|
|
PTS_EFFECTIVENESS,
|
|
|
|
PTS_SET_UP, // Broadly. Used by Wish, Future Sight, Ingrain, etc.
|
|
|
|
PTS_RAIN,
|
|
|
|
PTS_SUN,
|
|
|
|
PTS_SANDSTORM,
|
|
|
|
PTS_HAIL,
|
|
|
|
PTS_ELECTRIC,
|
|
|
|
PTS_STATUS_DMG,
|
|
|
|
PTS_STATUS,
|
|
|
|
PTS_SPIKES,
|
|
|
|
PTS_WATER_SPORT,
|
|
|
|
PTS_MUD_SPORT,
|
|
|
|
PTS_REFLECT,
|
|
|
|
PTS_LIGHT_SCREEN,
|
|
|
|
PTS_SAFEGUARD,
|
|
|
|
PTS_MIST,
|
|
|
|
PTS_BREAK_WALL,
|
|
|
|
PTS_CRITICAL_HIT,
|
|
|
|
PTS_FAINT,
|
|
|
|
PTS_FAINT_SET_UP,
|
|
|
|
PTS_FLINCHED,
|
|
|
|
PTS_STAT_INCREASE_1,
|
|
|
|
PTS_STAT_INCREASE_2,
|
|
|
|
PTS_STAT_DECREASE_SELF,
|
|
|
|
PTS_STAT_DECREASE_1,
|
|
|
|
PTS_STAT_DECREASE_2,
|
|
|
|
PTS_STAT_INCREASE_NOT_SELF,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
FNT_NONE,
|
|
|
|
FNT_CURSE,
|
|
|
|
FNT_LEECH_SEED,
|
|
|
|
FNT_POISON,
|
|
|
|
FNT_BURN,
|
|
|
|
FNT_NIGHTMARE,
|
|
|
|
FNT_WRAP,
|
|
|
|
FNT_SPIKES,
|
|
|
|
FNT_FUTURE_SIGHT,
|
|
|
|
FNT_DOOM_DESIRE,
|
|
|
|
FNT_PERISH_SONG,
|
|
|
|
FNT_DESTINY_BOND,
|
|
|
|
FNT_CONFUSION,
|
|
|
|
FNT_EXPLOSION,
|
|
|
|
FNT_RECOIL,
|
|
|
|
FNT_OTHER,
|
|
|
|
};
|
|
|
|
|
2018-02-27 20:40:09 +01:00
|
|
|
// const rom data
|
|
|
|
static const u16 sVariableDmgMoves[] =
|
|
|
|
{
|
|
|
|
MOVE_COUNTER, MOVE_FISSURE, MOVE_BIDE, MOVE_MIRROR_COAT,
|
|
|
|
MOVE_HORN_DRILL, MOVE_FLAIL, MOVE_REVERSAL, MOVE_HIDDEN_POWER,
|
|
|
|
MOVE_SHEER_COLD, MOVE_FOCUS_PUNCH, MOVE_ERUPTION,
|
|
|
|
MOVE_WATER_SPOUT, MOVE_DREAM_EATER, MOVE_WEATHER_BALL,
|
|
|
|
MOVE_SNORE, MOVE_PAIN_SPLIT, MOVE_GUILLOTINE,
|
|
|
|
MOVE_FRUSTRATION, MOVE_RETURN, MOVE_ENDEAVOR,
|
2021-01-14 06:29:59 -05:00
|
|
|
MOVE_PRESENT, MOVE_REVENGE, TABLE_END,
|
2018-02-27 20:40:09 +01:00
|
|
|
// those are handled by the function itself
|
2021-01-14 06:29:59 -05:00
|
|
|
MOVE_MAGNITUDE, MOVE_PSYWAVE, TABLE_END
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2022-12-04 21:23:45 +01:00
|
|
|
[EFFECT_HIT] = 1,
|
|
|
|
[EFFECT_SLEEP] = 1,
|
|
|
|
[EFFECT_POISON_HIT] = 1,
|
|
|
|
[EFFECT_ABSORB] = 4,
|
|
|
|
[EFFECT_BURN_HIT] = 1,
|
|
|
|
[EFFECT_FREEZE_HIT] = 1,
|
|
|
|
[EFFECT_PARALYZE_HIT] = 1,
|
|
|
|
[EFFECT_EXPLOSION] = 0,
|
|
|
|
[EFFECT_DREAM_EATER] = 5,
|
|
|
|
[EFFECT_MIRROR_MOVE] = 1,
|
|
|
|
[EFFECT_ATTACK_UP] = 1,
|
|
|
|
[EFFECT_DEFENSE_UP] = 1,
|
|
|
|
[EFFECT_SPEED_UP] = 1,
|
|
|
|
[EFFECT_SPECIAL_ATTACK_UP] = 1,
|
|
|
|
[EFFECT_SPECIAL_DEFENSE_UP] = 1,
|
|
|
|
[EFFECT_ACCURACY_UP] = 1,
|
|
|
|
[EFFECT_EVASION_UP] = 1,
|
|
|
|
// [EFFECT_ALWAYS_HIT] = 2,
|
|
|
|
[EFFECT_ATTACK_DOWN] = 1,
|
|
|
|
[EFFECT_DEFENSE_DOWN] = 1,
|
|
|
|
[EFFECT_SPEED_DOWN] = 1,
|
|
|
|
[EFFECT_SPECIAL_ATTACK_DOWN] = 1,
|
|
|
|
[EFFECT_SPECIAL_DEFENSE_DOWN] = 1,
|
|
|
|
[EFFECT_ACCURACY_DOWN] = 1,
|
|
|
|
[EFFECT_EVASION_DOWN] = 1,
|
|
|
|
[EFFECT_HAZE] = 5,
|
|
|
|
[EFFECT_BIDE] = 5,
|
|
|
|
[EFFECT_RAMPAGE] = 4,
|
|
|
|
[EFFECT_ROAR] = 5,
|
|
|
|
[EFFECT_MULTI_HIT] = 1,
|
|
|
|
[EFFECT_CONVERSION] = 3,
|
|
|
|
[EFFECT_FLINCH_HIT] = 1,
|
|
|
|
[EFFECT_RESTORE_HP] = 3,
|
|
|
|
[EFFECT_TOXIC] = 5,
|
|
|
|
[EFFECT_PAY_DAY] = 1,
|
|
|
|
[EFFECT_LIGHT_SCREEN] = 7,
|
|
|
|
[EFFECT_TRI_ATTACK] = 1,
|
|
|
|
[EFFECT_REST] = 7,
|
|
|
|
[EFFECT_OHKO] = 7,
|
|
|
|
// [EFFECT_RAZOR_WIND] = 1,
|
|
|
|
[EFFECT_SUPER_FANG] = 5,
|
|
|
|
[EFFECT_DRAGON_RAGE] = 2,
|
|
|
|
[EFFECT_TRAP] = 4,
|
|
|
|
// [EFFECT_HIGH_CRITICAL] = 1,
|
|
|
|
// [EFFECT_DOUBLE_HIT] = 1,
|
|
|
|
[EFFECT_RECOIL_IF_MISS] = 1,
|
|
|
|
[EFFECT_MIST] = 5,
|
|
|
|
[EFFECT_FOCUS_ENERGY] = 1,
|
|
|
|
[EFFECT_RECOIL_25] = 2,
|
|
|
|
[EFFECT_CONFUSE] = 4,
|
|
|
|
[EFFECT_ATTACK_UP_2] = 1,
|
|
|
|
[EFFECT_DEFENSE_UP_2] = 1,
|
|
|
|
[EFFECT_SPEED_UP_2] = 1,
|
|
|
|
[EFFECT_SPECIAL_ATTACK_UP_2] = 1,
|
|
|
|
[EFFECT_SPECIAL_DEFENSE_UP_2] = 1,
|
|
|
|
[EFFECT_ACCURACY_UP_2] = 1,
|
|
|
|
[EFFECT_EVASION_UP_2] = 1,
|
|
|
|
[EFFECT_TRANSFORM] = 0,
|
|
|
|
[EFFECT_ATTACK_DOWN_2] = 1,
|
|
|
|
[EFFECT_DEFENSE_DOWN_2] = 1,
|
|
|
|
[EFFECT_SPEED_DOWN_2] = 1,
|
|
|
|
[EFFECT_SPECIAL_ATTACK_DOWN_2] = 1,
|
|
|
|
[EFFECT_SPECIAL_DEFENSE_DOWN_2] = 1,
|
|
|
|
[EFFECT_ACCURACY_DOWN_2] = 1,
|
|
|
|
[EFFECT_EVASION_DOWN_2] = 1,
|
|
|
|
[EFFECT_REFLECT] = 7,
|
|
|
|
[EFFECT_POISON] = 4,
|
|
|
|
[EFFECT_PARALYZE] = 4,
|
|
|
|
[EFFECT_ATTACK_DOWN_HIT] = 1,
|
|
|
|
[EFFECT_DEFENSE_DOWN_HIT] = 1,
|
|
|
|
[EFFECT_SPEED_DOWN_HIT] = 1,
|
|
|
|
[EFFECT_SPECIAL_ATTACK_DOWN_HIT] = 1,
|
|
|
|
[EFFECT_SPECIAL_DEFENSE_DOWN_HIT] = 1,
|
|
|
|
[EFFECT_ACCURACY_DOWN_HIT] = 1,
|
|
|
|
[EFFECT_EVASION_DOWN_HIT] = 1,
|
|
|
|
// [EFFECT_SKY_ATTACK] = 4,
|
|
|
|
[EFFECT_CONFUSE_HIT] = 1,
|
|
|
|
// [EFFECT_TWINEEDLE] = 1,
|
|
|
|
[EFFECT_VITAL_THROW] = 1,
|
|
|
|
[EFFECT_SUBSTITUTE] = 4,
|
|
|
|
[EFFECT_RECHARGE] = 5,
|
|
|
|
[EFFECT_RAGE] = 2,
|
|
|
|
[EFFECT_MIMIC] = 4,
|
|
|
|
[EFFECT_METRONOME] = 1,
|
|
|
|
[EFFECT_LEECH_SEED] = 4,
|
|
|
|
[EFFECT_DO_NOTHING] = 1,
|
|
|
|
[EFFECT_DISABLE] = 7,
|
|
|
|
[EFFECT_LEVEL_DAMAGE] = 2,
|
|
|
|
[EFFECT_PSYWAVE] = 1,
|
|
|
|
[EFFECT_COUNTER] = 5,
|
|
|
|
[EFFECT_ENCORE] = 7,
|
|
|
|
[EFFECT_PAIN_SPLIT] = 3,
|
|
|
|
[EFFECT_SNORE] = 3,
|
|
|
|
[EFFECT_CONVERSION_2] = 4,
|
|
|
|
[EFFECT_LOCK_ON] = 3,
|
|
|
|
[EFFECT_SKETCH] = 3,
|
|
|
|
// [EFFECT_UNUSED_60] = 3,
|
|
|
|
[EFFECT_SLEEP_TALK] = 3,
|
|
|
|
[EFFECT_DESTINY_BOND] = 3,
|
|
|
|
[EFFECT_FLAIL] = 2,
|
|
|
|
[EFFECT_SPITE] = 4,
|
|
|
|
[EFFECT_FALSE_SWIPE] = 1,
|
|
|
|
[EFFECT_HEAL_BELL] = 5,
|
|
|
|
// [EFFECT_QUICK_ATTACK] = 1,
|
|
|
|
[EFFECT_TRIPLE_KICK] = 1,
|
|
|
|
[EFFECT_THIEF] = 4,
|
|
|
|
[EFFECT_MEAN_LOOK] = 5,
|
|
|
|
[EFFECT_NIGHTMARE] = 3,
|
|
|
|
[EFFECT_MINIMIZE] = 1,
|
|
|
|
[EFFECT_CURSE] = 2,
|
|
|
|
// [EFFECT_UNUSED_6E] = 1,
|
|
|
|
[EFFECT_PROTECT] = 5,
|
|
|
|
[EFFECT_SPIKES] = 4,
|
|
|
|
[EFFECT_FORESIGHT] = 3,
|
|
|
|
[EFFECT_PERISH_SONG] = 6,
|
|
|
|
[EFFECT_SANDSTORM] = 4,
|
|
|
|
[EFFECT_ENDURE] = 3,
|
|
|
|
[EFFECT_ROLLOUT] = 3,
|
|
|
|
[EFFECT_SWAGGER] = 3,
|
|
|
|
[EFFECT_FURY_CUTTER] = 2,
|
|
|
|
[EFFECT_ATTRACT] = 4,
|
|
|
|
[EFFECT_RETURN] = 1,
|
|
|
|
[EFFECT_PRESENT] = 1,
|
|
|
|
[EFFECT_FRUSTRATION] = 1,
|
|
|
|
[EFFECT_SAFEGUARD] = 5,
|
|
|
|
// [EFFECT_THAW_HIT] = 1, Now unused
|
|
|
|
[EFFECT_MAGNITUDE] = 1,
|
|
|
|
[EFFECT_BATON_PASS] = 7,
|
|
|
|
[EFFECT_PURSUIT] = 2,
|
|
|
|
[EFFECT_RAPID_SPIN] = 2,
|
|
|
|
[EFFECT_SONICBOOM] = 1,
|
|
|
|
// [EFFECT_UNUSED_83] = 1,
|
|
|
|
[EFFECT_MORNING_SUN] = 4,
|
|
|
|
[EFFECT_SYNTHESIS] = 4,
|
|
|
|
[EFFECT_MOONLIGHT] = 4,
|
|
|
|
[EFFECT_HIDDEN_POWER] = 1,
|
|
|
|
[EFFECT_RAIN_DANCE] = 4,
|
|
|
|
[EFFECT_SUNNY_DAY] = 4,
|
|
|
|
[EFFECT_DEFENSE_UP_HIT] = 1,
|
|
|
|
[EFFECT_ATTACK_UP_HIT] = 1,
|
|
|
|
[EFFECT_ALL_STATS_UP_HIT] = 1,
|
|
|
|
// [EFFECT_UNUSED_8D] = 1,
|
|
|
|
[EFFECT_BELLY_DRUM] = 7,
|
|
|
|
[EFFECT_PSYCH_UP] = 7,
|
|
|
|
[EFFECT_MIRROR_COAT] = 6,
|
|
|
|
[EFFECT_SKULL_BASH] = 3,
|
|
|
|
[EFFECT_TWISTER] = 1,
|
|
|
|
[EFFECT_EARTHQUAKE] = 1,
|
|
|
|
[EFFECT_FUTURE_SIGHT] = 1,
|
|
|
|
[EFFECT_GUST] = 1,
|
|
|
|
[EFFECT_FLINCH_MINIMIZE_HIT] = 1,
|
|
|
|
[EFFECT_SOLAR_BEAM] = 1,
|
|
|
|
[EFFECT_THUNDER] = 1,
|
|
|
|
[EFFECT_TELEPORT] = 1,
|
|
|
|
[EFFECT_BEAT_UP] = 2,
|
|
|
|
[EFFECT_SEMI_INVULNERABLE] = 3,
|
|
|
|
[EFFECT_DEFENSE_CURL] = 1,
|
|
|
|
[EFFECT_SOFTBOILED] = 1,
|
|
|
|
[EFFECT_FAKE_OUT] = 4,
|
|
|
|
[EFFECT_UPROAR] = 4,
|
|
|
|
[EFFECT_STOCKPILE] = 3,
|
|
|
|
[EFFECT_SPIT_UP] = 3,
|
|
|
|
[EFFECT_SWALLOW] = 3,
|
|
|
|
// [EFFECT_UNUSED_A3] = 1,
|
|
|
|
[EFFECT_HAIL] = 4,
|
|
|
|
[EFFECT_TORMENT] = 7,
|
|
|
|
[EFFECT_FLATTER] = 7,
|
|
|
|
[EFFECT_WILL_O_WISP] = 5,
|
|
|
|
[EFFECT_MEMENTO] = 7,
|
|
|
|
[EFFECT_FACADE] = 1,
|
|
|
|
[EFFECT_FOCUS_PUNCH] = 7,
|
|
|
|
[EFFECT_SMELLINGSALT] = 1,
|
|
|
|
[EFFECT_FOLLOW_ME] = 5,
|
|
|
|
[EFFECT_NATURE_POWER] = 0,
|
|
|
|
[EFFECT_CHARGE] = 4,
|
|
|
|
[EFFECT_TAUNT] = 4,
|
|
|
|
[EFFECT_HELPING_HAND] = 4,
|
|
|
|
[EFFECT_TRICK] = 4,
|
|
|
|
[EFFECT_ROLE_PLAY] = 4,
|
|
|
|
[EFFECT_WISH] = 2,
|
|
|
|
[EFFECT_ASSIST] = 2,
|
|
|
|
[EFFECT_INGRAIN] = 6,
|
|
|
|
[EFFECT_SUPERPOWER] = 3,
|
|
|
|
[EFFECT_MAGIC_COAT] = 6,
|
|
|
|
[EFFECT_RECYCLE] = 4,
|
|
|
|
[EFFECT_REVENGE] = 4,
|
|
|
|
[EFFECT_BRICK_BREAK] = 2,
|
|
|
|
[EFFECT_YAWN] = 5,
|
|
|
|
[EFFECT_KNOCK_OFF] = 2,
|
|
|
|
[EFFECT_ENDEAVOR] = 1,
|
|
|
|
[EFFECT_ERUPTION] = 1,
|
|
|
|
[EFFECT_SKILL_SWAP] = 6,
|
|
|
|
[EFFECT_IMPRISON] = 6,
|
|
|
|
[EFFECT_REFRESH] = 6,
|
|
|
|
[EFFECT_GRUDGE] = 1,
|
|
|
|
[EFFECT_SNATCH] = 1,
|
|
|
|
[EFFECT_LOW_KICK] = 1,
|
|
|
|
[EFFECT_SECRET_POWER] = 1,
|
|
|
|
[EFFECT_RECOIL_33] = 2,
|
|
|
|
[EFFECT_TEETER_DANCE] = 6,
|
|
|
|
// [EFFECT_BLAZE_KICK] = 1,
|
|
|
|
[EFFECT_MUD_SPORT] = 4,
|
|
|
|
[EFFECT_POISON_FANG] = 1,
|
|
|
|
[EFFECT_WEATHER_BALL] = 1,
|
|
|
|
[EFFECT_OVERHEAT] = 3,
|
|
|
|
[EFFECT_TICKLE] = 1,
|
|
|
|
[EFFECT_COSMIC_POWER] = 1,
|
|
|
|
[EFFECT_SKY_UPPERCUT] = 1,
|
|
|
|
[EFFECT_BULK_UP] = 1,
|
|
|
|
// [EFFECT_POISON_TAIL] = 1,
|
|
|
|
[EFFECT_WATER_SPORT] = 4,
|
|
|
|
[EFFECT_CALM_MIND] = 1,
|
|
|
|
[EFFECT_DRAGON_DANCE] = 1,
|
|
|
|
[EFFECT_CAMOUFLAGE] = 3,
|
|
|
|
[EFFECT_PLEDGE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FLING] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_NATURAL_GIFT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_WAKE_UP_SLAP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_WRING_OUT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_HEX] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ASSURANCE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TRUMP_CARD] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ACROBATICS] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_HEAT_CRASH] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_PUNISHMENT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_STORED_POWER] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ELECTRO_BALL] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GYRO_BALL] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ECHOED_VOICE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_PAYBACK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ROUND] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BRINE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_VENOSHOCK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_RETALIATE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BULLDOZE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FOUL_PLAY] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_PSYSHOCK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ROOST] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GRAVITY] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_MIRACLE_EYE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TAILWIND] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_EMBARGO] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_AQUA_RING] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TRICK_ROOM] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_WONDER_ROOM] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_MAGIC_ROOM] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_MAGNET_RISE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TOXIC_SPIKES] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GASTRO_ACID] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_STEALTH_ROCK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TELEKINESIS] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_POWER_SWAP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GUARD_SWAP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_HEART_SWAP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_POWER_SPLIT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GUARD_SPLIT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_STICKY_WEB] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_METAL_BURST] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_LUCKY_CHANT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SUCKER_PUNCH] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SPECIAL_DEFENSE_DOWN_HIT_2] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SIMPLE_BEAM] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ENTRAINMENT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_HEAL_PULSE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_QUASH] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ION_DELUGE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FREEZE_DRY] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TOPSY_TURVY] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_MISTY_TERRAIN] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GRASSY_TERRAIN] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ELECTRIC_TERRAIN] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_PSYCHIC_TERRAIN] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ATTACK_ACCURACY_UP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ATTACK_SPATK_UP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_HURRICANE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TWO_TYPED_MOVE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ME_FIRST] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SPEED_UP_HIT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_QUIVER_DANCE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_COIL] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ELECTRIFY] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_REFLECT_TYPE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SOAK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GROWTH] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_CLOSE_COMBAT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_LAST_RESORT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_RECOIL_33_STATUS] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FLINCH_STATUS] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_RECOIL_50] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SHELL_SMASH] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SHIFT_GEAR] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_DEFENSE_UP_3] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_NOBLE_ROAR] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_VENOM_DRENCH] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TOXIC_THREAD] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_CLEAR_SMOG] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_HIT_SWITCH_TARGET] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FINAL_GAMBIT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_CHANGE_TYPE_ON_ITEM] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_AUTOTOMIZE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_COPYCAT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_DEFOG] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_HIT_ENEMY_HEAL_ALLY] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SMACK_DOWN] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SYNCHRONOISE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_PSYCHO_SHIFT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_POWER_TRICK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FLAME_BURST] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_AFTER_YOU] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BESTOW] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ROTOTILLER] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FLOWER_SHIELD] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_HIT_PREVENT_ESCAPE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SPEED_SWAP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_DEFENSE_UP2_HIT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_REVELATION_DANCE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_AURORA_VEIL] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_THIRD_TYPE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FEINT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SPARKLING_ARIA] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ACUPRESSURE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_AROMATIC_MIST] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_POWDER] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SP_ATTACK_UP_HIT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BELCH] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_PARTING_SHOT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SPECTRAL_THIEF] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_V_CREATE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_MAT_BLOCK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_STOMPING_TANTRUM] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_CORE_ENFORCER] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_INSTRUCT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_THROAT_CHOP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_LASER_FOCUS] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_MAGNETIC_FLUX] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GEAR_UP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_INCINERATE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BUG_BITE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_STRENGTH_SAP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_MIND_BLOWN] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_PURIFY] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BURN_UP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SHORE_UP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GEOMANCY] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FAIRY_LOCK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ALLY_SWITCH] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_RELIC_SONG] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_ATTACKER_DEFENSE_DOWN_HIT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BODY_PRESS] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_EERIE_SPELL] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_JUNGLE_HEALING] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_COACHING] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_LASH_OUT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GRASSY_GLIDE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_REMOVE_TERRAIN] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_DYNAMAX_DOUBLE_DMG] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_DECORATE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SNIPE_SHOT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_RECOIL_HP_25] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_STUFF_CHEEKS] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GRAV_APPLE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_EVASION_UP_HIT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_GLITZY_GLOW] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BADDY_BAD] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SAPPY_SEED] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_FREEZY_FROST] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SPARKLY_SWIRL] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_PLASMA_FISTS] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_HYPERSPACE_FURY] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_AURA_WHEEL] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_PHOTON_GEYSER] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SHELL_SIDE_ARM] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TERRAIN_PULSE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_JAW_LOCK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_NO_RETREAT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_TAR_SHOT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_POLTERGEIST] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_OCTOLOCK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_CLANGOROUS_SOUL] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BOLT_BEAK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SKY_DROP] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_EXPANDING_FORCE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SCALE_SHOT] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_METEOR_BEAM] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_RISING_VOLTAGE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_BEAK_BLAST] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_COURT_CHANGE] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_STEEL_BEAM] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_EXTREME_EVOBOOST] = 0, // TODO: Assign points
|
2022-12-29 01:32:24 -03:00
|
|
|
[EFFECT_HIT_SET_REMOVE_TERRAIN] = 0, // TODO: Assign points
|
2022-12-04 21:23:45 +01:00
|
|
|
[EFFECT_DARK_VOID] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SLEEP_HIT] = 1,
|
|
|
|
[EFFECT_DOUBLE_SHOCK] = 0, // TODO: Assign points
|
|
|
|
[EFFECT_SPECIAL_ATTACK_UP_HIT] = 1,
|
|
|
|
[EFFECT_VICTORY_DANCE] = 0, // TODO: Assign points
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
|
|
|
|
static const u16 sPoints_Effectiveness[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
4, // Super Effective
|
|
|
|
-3, // Not Very Effective
|
|
|
|
-6 // No Effect
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_SetUp[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
4, // Future Sight
|
|
|
|
4, // Doom Desire
|
2021-08-24 19:59:32 -03:00
|
|
|
6,
|
2021-01-14 06:29:59 -05:00
|
|
|
6, // Wish
|
|
|
|
7, // Grudge
|
2021-08-24 19:59:32 -03:00
|
|
|
6,
|
2021-01-14 06:29:59 -05:00
|
|
|
2 // Ingrain
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_RainMoves[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_BUBBLE, 3,
|
|
|
|
MOVE_WHIRLPOOL, 3,
|
|
|
|
MOVE_OCTAZOOKA, 3,
|
|
|
|
MOVE_CLAMP, 3,
|
|
|
|
MOVE_WITHDRAW, 3,
|
|
|
|
MOVE_CRABHAMMER, 3,
|
|
|
|
MOVE_WATER_SPOUT, 3,
|
2021-01-14 06:29:59 -05:00
|
|
|
MOVE_DIVE, 3,
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_WATERFALL, 3,
|
|
|
|
MOVE_MUDDY_WATER, 3,
|
|
|
|
MOVE_SURF, 3,
|
|
|
|
MOVE_HYDRO_CANNON, 3,
|
|
|
|
MOVE_HYDRO_PUMP, 3,
|
|
|
|
MOVE_BUBBLE_BEAM, 3,
|
2021-01-14 06:29:59 -05:00
|
|
|
MOVE_WATER_SPORT, 0, // Unnecessary, unlisted moves are already given 0 points
|
|
|
|
MOVE_WATER_GUN, 3,
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_WATER_PULSE, 3,
|
|
|
|
MOVE_WEATHER_BALL, 3,
|
|
|
|
MOVE_THUNDER, 3,
|
|
|
|
MOVE_SOLAR_BEAM, -4,
|
|
|
|
MOVE_OVERHEAT, -4,
|
|
|
|
MOVE_FLAME_WHEEL, -4,
|
|
|
|
MOVE_FLAMETHROWER, -4,
|
2021-01-14 06:29:59 -05:00
|
|
|
MOVE_SACRED_FIRE, -4,
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_FIRE_BLAST, -4,
|
|
|
|
MOVE_HEAT_WAVE, -4,
|
|
|
|
MOVE_EMBER, -4,
|
|
|
|
MOVE_BLAST_BURN, -4,
|
|
|
|
MOVE_BLAZE_KICK, -4,
|
|
|
|
MOVE_ERUPTION, -4,
|
|
|
|
MOVE_FIRE_SPIN, -4,
|
2021-01-14 06:29:59 -05:00
|
|
|
MOVE_FIRE_PUNCH, -4,
|
|
|
|
MOVE_SOLAR_BEAM, -4, // Repeated
|
|
|
|
TABLE_END, 0
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_SunMoves[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_OVERHEAT, 3,
|
|
|
|
MOVE_FLAME_WHEEL, 3,
|
|
|
|
MOVE_FLAMETHROWER, 3,
|
|
|
|
MOVE_SACRED_FIRE, 3,
|
|
|
|
MOVE_FIRE_BLAST, 3,
|
|
|
|
MOVE_HEAT_WAVE, 3,
|
|
|
|
MOVE_EMBER, 3,
|
2021-01-14 06:29:59 -05:00
|
|
|
MOVE_BLAST_BURN, 3,
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_BLAZE_KICK, 3,
|
|
|
|
MOVE_ERUPTION, 3,
|
|
|
|
MOVE_FIRE_SPIN, 3,
|
|
|
|
MOVE_FIRE_PUNCH, 3,
|
|
|
|
MOVE_SOLAR_BEAM, 5,
|
|
|
|
MOVE_SYNTHESIS, 3,
|
|
|
|
MOVE_MORNING_SUN, 3,
|
2021-01-14 06:29:59 -05:00
|
|
|
MOVE_MOONLIGHT, 3,
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_WEATHER_BALL, 3,
|
2021-01-14 06:29:59 -05:00
|
|
|
TABLE_END, 0
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_SandstormMoves[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_WEATHER_BALL, 3,
|
|
|
|
MOVE_SOLAR_BEAM, -3,
|
2021-01-14 06:29:59 -05:00
|
|
|
TABLE_END, 0
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_HailMoves[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_WEATHER_BALL, 3,
|
|
|
|
MOVE_SOLAR_BEAM, -3,
|
2021-01-14 06:29:59 -05:00
|
|
|
TABLE_END, 0
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_ElectricMoves[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_THUNDERBOLT, 3,
|
|
|
|
MOVE_THUNDER_PUNCH, 3,
|
|
|
|
MOVE_SPARK, 3,
|
|
|
|
MOVE_THUNDER_SHOCK, 3,
|
|
|
|
MOVE_ZAP_CANNON, 3,
|
|
|
|
MOVE_SHOCK_WAVE, 3,
|
2021-01-14 06:29:59 -05:00
|
|
|
MOVE_THUNDER_WAVE, 0, // Unnecessary, unlisted moves are already given 0 points
|
|
|
|
MOVE_THUNDER, 3,
|
2021-08-24 19:59:32 -03:00
|
|
|
MOVE_VOLT_TACKLE, 3,
|
2021-01-14 06:29:59 -05:00
|
|
|
TABLE_END, 0
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_StatusDmg[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
5, // Curse
|
|
|
|
3, // Leech Seed
|
|
|
|
3, // Poison
|
|
|
|
3, // Toxic
|
2021-08-24 19:59:32 -03:00
|
|
|
3, // Burn
|
2021-01-14 06:29:59 -05:00
|
|
|
3, // Nightmare
|
|
|
|
3 // Wrap (Trapping move)
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_Status[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
5, // Attraction
|
|
|
|
5, // Confusion
|
|
|
|
5, // Paralysis
|
|
|
|
5, // Sleep
|
|
|
|
5 // Freeze
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
|
|
|
|
static const u16 sPoints_Spikes[] = { 4 };
|
|
|
|
static const u16 sPoints_WaterSport[] = { 5 };
|
|
|
|
static const u16 sPoints_MudSport[] = { 5 };
|
|
|
|
static const u16 sPoints_Reflect[] = { 3 };
|
|
|
|
static const u16 sPoints_LightScreen[] = { 3 };
|
|
|
|
static const u16 sPoints_Safeguard[] = { 4 };
|
|
|
|
static const u16 sPoints_Mist[] = { 3 };
|
|
|
|
static const u16 sPoints_BreakWall[] = { 6 };
|
|
|
|
static const u16 sPoints_CriticalHit[] = { 6 };
|
|
|
|
static const u16 sPoints_Faint[] = { 6 };
|
|
|
|
static const u16 sPoints_Flinched[] = { 4 };
|
|
|
|
|
|
|
|
static const u16 sPoints_StatIncrease1[NUM_BATTLE_STATS - 1] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
[STAT_ATK - 1] = 2,
|
|
|
|
[STAT_DEF - 1] = 2,
|
|
|
|
[STAT_SPEED - 1] = 2,
|
|
|
|
[STAT_SPATK - 1] = 2,
|
|
|
|
[STAT_SPDEF - 1] = 2,
|
|
|
|
[STAT_ACC - 1] = 2,
|
2021-01-14 06:29:59 -05:00
|
|
|
[STAT_EVASION - 1] = 2
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_StatIncrease2[NUM_BATTLE_STATS - 1] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
[STAT_ATK - 1] = 4,
|
|
|
|
[STAT_DEF - 1] = 4,
|
|
|
|
[STAT_SPEED - 1] = 4,
|
|
|
|
[STAT_SPATK - 1] = 4,
|
|
|
|
[STAT_SPDEF - 1] = 4,
|
|
|
|
[STAT_ACC - 1] = 4,
|
2021-01-14 06:29:59 -05:00
|
|
|
[STAT_EVASION - 1] = 4
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_StatDecreaseSelf[NUM_BATTLE_STATS - 1] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
[STAT_ATK - 1] = -1,
|
|
|
|
[STAT_DEF - 1] = -1,
|
|
|
|
[STAT_SPEED - 1] = -1,
|
|
|
|
[STAT_SPATK - 1] = -1,
|
|
|
|
[STAT_SPDEF - 1] = -1,
|
|
|
|
[STAT_ACC - 1] = -1,
|
2021-01-14 06:29:59 -05:00
|
|
|
[STAT_EVASION - 1] = -1
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_StatDecrease1[NUM_BATTLE_STATS - 1] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
[STAT_ATK - 1] = 2,
|
|
|
|
[STAT_DEF - 1] = 2,
|
|
|
|
[STAT_SPEED - 1] = 2,
|
|
|
|
[STAT_SPATK - 1] = 2,
|
|
|
|
[STAT_SPDEF - 1] = 2,
|
|
|
|
[STAT_ACC - 1] = 2,
|
2021-01-14 06:29:59 -05:00
|
|
|
[STAT_EVASION - 1] = 2
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_StatDecrease2[NUM_BATTLE_STATS - 1] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
[STAT_ATK - 1] = 4,
|
|
|
|
[STAT_DEF - 1] = 4,
|
|
|
|
[STAT_SPEED - 1] = 4,
|
|
|
|
[STAT_SPATK - 1] = 4,
|
|
|
|
[STAT_SPDEF - 1] = 4,
|
|
|
|
[STAT_ACC - 1] = 4,
|
2021-01-14 06:29:59 -05:00
|
|
|
[STAT_EVASION - 1] = 4
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
2021-01-14 06:29:59 -05:00
|
|
|
static const u16 sPoints_StatIncreaseNotSelf[NUM_BATTLE_STATS - 1] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-08-24 19:59:32 -03:00
|
|
|
[STAT_ATK - 1] = -2,
|
|
|
|
[STAT_DEF - 1] = -2,
|
|
|
|
[STAT_SPEED - 1] = -2,
|
2021-01-14 06:29:59 -05:00
|
|
|
[STAT_SPATK - 1] = -2,
|
2021-08-24 19:59:32 -03:00
|
|
|
[STAT_SPDEF - 1] = -2,
|
|
|
|
[STAT_ACC - 1] = -2,
|
2021-01-14 06:29:59 -05:00
|
|
|
[STAT_EVASION - 1] = -2
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const u16 *const sPointsArray[] =
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
[PTS_MOVE_EFFECT] = sPoints_MoveEffect,
|
|
|
|
[PTS_EFFECTIVENESS] = sPoints_Effectiveness,
|
|
|
|
[PTS_SET_UP] = sPoints_SetUp,
|
|
|
|
[PTS_RAIN] = sPoints_RainMoves,
|
|
|
|
[PTS_SUN] = sPoints_SunMoves,
|
|
|
|
[PTS_SANDSTORM] = sPoints_SandstormMoves,
|
|
|
|
[PTS_HAIL] = sPoints_HailMoves,
|
|
|
|
[PTS_ELECTRIC] = sPoints_ElectricMoves,
|
|
|
|
[PTS_STATUS_DMG] = sPoints_StatusDmg,
|
|
|
|
[PTS_STATUS] = sPoints_Status,
|
|
|
|
[PTS_SPIKES] = sPoints_Spikes,
|
|
|
|
[PTS_WATER_SPORT] = sPoints_WaterSport,
|
|
|
|
[PTS_MUD_SPORT] = sPoints_MudSport,
|
|
|
|
[PTS_REFLECT] = sPoints_Reflect,
|
|
|
|
[PTS_LIGHT_SCREEN] = sPoints_LightScreen,
|
|
|
|
[PTS_SAFEGUARD] = sPoints_Safeguard,
|
|
|
|
[PTS_MIST] = sPoints_Mist,
|
|
|
|
[PTS_BREAK_WALL] = sPoints_BreakWall,
|
|
|
|
[PTS_CRITICAL_HIT] = sPoints_CriticalHit,
|
|
|
|
[PTS_FAINT] = sPoints_Faint,
|
|
|
|
[PTS_FAINT_SET_UP] = sPoints_Faint,
|
|
|
|
[PTS_FLINCHED] = sPoints_Flinched,
|
|
|
|
[PTS_STAT_INCREASE_1] = sPoints_StatIncrease1,
|
|
|
|
[PTS_STAT_INCREASE_2] = sPoints_StatIncrease2,
|
|
|
|
[PTS_STAT_DECREASE_SELF] = sPoints_StatDecreaseSelf,
|
|
|
|
[PTS_STAT_DECREASE_1] = sPoints_StatDecrease1,
|
|
|
|
[PTS_STAT_DECREASE_2] = sPoints_StatDecrease2,
|
|
|
|
[PTS_STAT_INCREASE_NOT_SELF] = sPoints_StatIncreaseNotSelf
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
// Points will always be calculated for these messages
|
|
|
|
// even if current pokemon does not have corresponding move
|
|
|
|
static const u16 sSpecialBattleStrings[] =
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
STRINGID_PKMNPERISHCOUNTFELL, STRINGID_PKMNWISHCAMETRUE, STRINGID_PKMNLOSTPPGRUDGE,
|
|
|
|
STRINGID_PKMNTOOKFOE, STRINGID_PKMNABSORBEDNUTRIENTS, STRINGID_PKMNANCHOREDITSELF,
|
|
|
|
STRINGID_PKMNAFFLICTEDBYCURSE, STRINGID_PKMNSAPPEDBYLEECHSEED, STRINGID_PKMNLOCKEDINNIGHTMARE,
|
|
|
|
STRINGID_PKMNHURTBY, STRINGID_PKMNHURTBYBURN, STRINGID_PKMNHURTBYPOISON,
|
|
|
|
STRINGID_PKMNHURTBYSPIKES, STRINGID_ATTACKERFAINTED, STRINGID_TARGETFAINTED,
|
2021-01-14 06:29:59 -05:00
|
|
|
STRINGID_PKMNHITWITHRECOIL, STRINGID_PKMNCRASHED, TABLE_END
|
2018-02-27 20:40:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// code
|
|
|
|
void BattleTv_SetDataBasedOnString(u16 stringId)
|
|
|
|
{
|
|
|
|
struct BattleTv *tvPtr;
|
|
|
|
u32 atkSide, defSide, effSide, scriptingSide;
|
|
|
|
struct Pokemon *atkMon, *defMon;
|
|
|
|
u8 moveSlot;
|
|
|
|
u32 atkFlank, defFlank, effFlank;
|
|
|
|
u8 *perishCount;
|
|
|
|
u16 *statStringId, *finishedMoveId;
|
|
|
|
|
|
|
|
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && stringId != STRINGID_ITDOESNTAFFECT && stringId != STRINGID_NOTVERYEFFECTIVE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
tvPtr = &gBattleStruct->tv;
|
|
|
|
|
|
|
|
atkSide = GetBattlerSide(gBattlerAttacker);
|
|
|
|
defSide = GetBattlerSide(gBattlerTarget);
|
|
|
|
effSide = GetBattlerSide(gEffectBattler);
|
2018-06-30 15:35:54 +02:00
|
|
|
scriptingSide = GetBattlerSide(gBattleMsgDataPtr->scrActive);
|
2018-02-27 20:40:09 +01:00
|
|
|
|
|
|
|
if (atkSide == B_SIDE_PLAYER)
|
|
|
|
atkMon = &gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]];
|
|
|
|
else
|
|
|
|
atkMon = &gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]];
|
|
|
|
|
|
|
|
if (defSide == B_SIDE_PLAYER)
|
|
|
|
defMon = &gPlayerParty[gBattlerPartyIndexes[gBattlerTarget]];
|
|
|
|
else
|
|
|
|
defMon = &gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]];
|
|
|
|
|
2018-06-30 15:35:54 +02:00
|
|
|
moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, gBattleMsgDataPtr->currentMove);
|
2018-02-27 20:40:09 +01:00
|
|
|
|
2022-03-10 10:33:23 -05:00
|
|
|
if (moveSlot >= MAX_MON_MOVES && IsNotSpecialBattleString(stringId) && stringId > BATTLESTRINGS_TABLE_START)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[atkSide].faintCause = FNT_OTHER;
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
perishCount = (u8 *)(gBattleTextBuff1 + 4);
|
|
|
|
statStringId = (u16 *)(gBattleTextBuff2 + 2);
|
|
|
|
finishedMoveId = (u16 *)(gBattleTextBuff1 + 2);
|
|
|
|
|
|
|
|
atkFlank = GetBattlerPosition(gBattlerAttacker) / 2;
|
|
|
|
defFlank = GetBattlerPosition(gBattlerTarget) / 2;
|
|
|
|
effFlank = GetBattlerPosition(gEffectBattler) / 2;
|
|
|
|
|
|
|
|
switch (stringId)
|
|
|
|
{
|
|
|
|
case STRINGID_ITDOESNTAFFECT:
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_EFFECTIVENESS, moveSlot, 2, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK))
|
|
|
|
TrySetBattleSeminarShow();
|
|
|
|
break;
|
|
|
|
case STRINGID_NOTVERYEFFECTIVE:
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_EFFECTIVENESS, moveSlot, 1, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && GetMonData(defMon, MON_DATA_HP, NULL) != 0)
|
|
|
|
TrySetBattleSeminarShow();
|
|
|
|
break;
|
|
|
|
case STRINGID_SUPEREFFECTIVE:
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_EFFECTIVENESS, moveSlot, 0, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNFORESAWATTACK:
|
|
|
|
tvPtr->side[atkSide].futureSightMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].futureSightMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNCHOSEXASDESTINY:
|
|
|
|
tvPtr->side[atkSide].doomDesireMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].doomDesireMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_FAINTINTHREE:
|
|
|
|
tvPtr->side[atkSide].perishSongMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].perishSongMoveSlot = moveSlot;
|
|
|
|
tvPtr->side[atkSide].perishSong = 1;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNPERISHCOUNTFELL:
|
|
|
|
if (*perishCount == 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[atkSide].faintCause = FNT_PERISH_SONG;
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNWISHCAMETRUE:
|
|
|
|
if (tvPtr->side[defSide].wishMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SET_UP, 3, defSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[defSide].wishMonId - 1) * 4 + tvPtr->side[defSide].wishMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNWANTSGRUDGE:
|
|
|
|
tvPtr->side[atkSide].grudgeMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].grudgeMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNLOSTPPGRUDGE:
|
|
|
|
if (tvPtr->side[defSide].grudgeMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SET_UP, 4, defSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[defSide].grudgeMonId - 1) * 4 + tvPtr->side[defSide].grudgeMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNTRYINGTOTAKEFOE:
|
|
|
|
tvPtr->side[atkSide].destinyBondMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].destinyBondMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNTOOKFOE:
|
|
|
|
if (tvPtr->side[defSide].destinyBondMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[atkSide].faintCause = FNT_DESTINY_BOND;
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNPLANTEDROOTS:
|
|
|
|
tvPtr->pos[atkSide][atkFlank].ingrainMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[atkSide][atkFlank].ingrainMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNABSORBEDNUTRIENTS:
|
|
|
|
if (tvPtr->pos[atkSide][atkFlank].ingrainMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SET_UP, 6, atkSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->pos[atkSide][atkFlank].ingrainMonId - 1) * 4 + tvPtr->pos[atkSide][atkFlank].ingrainMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNANCHOREDITSELF:
|
|
|
|
if (tvPtr->pos[defSide][defFlank].ingrainMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SET_UP, 6, defSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->pos[defSide][defFlank].ingrainMonId - 1) * 4 + tvPtr->pos[defSide][defFlank].ingrainMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNTRANSFORMEDINTO:
|
|
|
|
gBattleStruct->anyMonHasTransformed = TRUE;
|
|
|
|
break;
|
|
|
|
case STRINGID_CRITICALHIT:
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_CRITICAL_HIT, moveSlot, 0, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
2021-04-02 02:27:12 -04:00
|
|
|
case STRINGID_ATTACKERSSTATROSE:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (gBattleTextBuff1[2] != 0)
|
|
|
|
{
|
|
|
|
if (*statStringId == STRINGID_STATSHARPLY)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STAT_INCREASE_2, moveSlot, gBattleTextBuff1[2] - 1, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
else
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STAT_INCREASE_1, moveSlot, gBattleTextBuff1[2] - 1, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
break;
|
2021-04-02 02:27:12 -04:00
|
|
|
case STRINGID_DEFENDERSSTATROSE:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (gBattleTextBuff1[2] != 0)
|
|
|
|
{
|
|
|
|
if (gBattlerAttacker == gBattlerTarget)
|
|
|
|
{
|
|
|
|
if (*statStringId == STRINGID_STATSHARPLY)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STAT_INCREASE_2, moveSlot, gBattleTextBuff1[2] - 1, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
else
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STAT_INCREASE_1, moveSlot, gBattleTextBuff1[2] - 1, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STAT_INCREASE_NOT_SELF, moveSlot, gBattleTextBuff1[2] - 1, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2021-04-02 02:27:12 -04:00
|
|
|
case STRINGID_ATTACKERSSTATFELL:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (gBattleTextBuff1[2] != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STAT_DECREASE_SELF, moveSlot, gBattleTextBuff1[2] - 1, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
2021-04-02 02:27:12 -04:00
|
|
|
case STRINGID_DEFENDERSSTATFELL:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (gBattleTextBuff1[2] != 0)
|
|
|
|
{
|
|
|
|
if (*statStringId == STRINGID_STATHARSHLY)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STAT_DECREASE_2, moveSlot, gBattleTextBuff1[2] - 1, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
else
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STAT_DECREASE_1, moveSlot, gBattleTextBuff1[2] - 1, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNLAIDCURSE:
|
|
|
|
tvPtr->pos[defSide][defFlank].curseMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[defSide][defFlank].curseMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNAFFLICTEDBYCURSE:
|
|
|
|
if (GetMonData(atkMon, MON_DATA_HP, NULL)
|
|
|
|
&& tvPtr->pos[atkSide][atkFlank].curseMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS_DMG, 0, tvPtr->pos[atkSide][atkFlank].curseMonId - 1, tvPtr->pos[atkSide][atkFlank].curseMoveSlot);
|
|
|
|
tvPtr->side[atkSide].faintCause = FNT_CURSE;
|
2018-02-27 20:40:09 +01:00
|
|
|
tvPtr->side[atkSide].faintCauseMonId = atkFlank;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNSEEDED:
|
|
|
|
tvPtr->pos[defSide][defFlank].leechSeedMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[defSide][defFlank].leechSeedMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNSAPPEDBYLEECHSEED:
|
|
|
|
if (tvPtr->pos[atkSide][atkFlank].leechSeedMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS_DMG, 1, tvPtr->pos[atkSide][atkFlank].leechSeedMonId - 1, tvPtr->pos[atkSide][atkFlank].leechSeedMoveSlot);
|
|
|
|
tvPtr->side[atkSide].faintCause = FNT_LEECH_SEED;
|
2018-02-27 20:40:09 +01:00
|
|
|
tvPtr->side[atkSide].faintCauseMonId = atkFlank;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNFELLINTONIGHTMARE:
|
|
|
|
tvPtr->pos[defSide][defFlank].nightmareMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[defSide][defFlank].nightmareMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNLOCKEDINNIGHTMARE:
|
|
|
|
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0
|
|
|
|
&& tvPtr->pos[atkSide][atkFlank].nightmareMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS_DMG, 5, tvPtr->pos[atkSide][atkFlank].nightmareMonId - 1, tvPtr->pos[atkSide][atkFlank].nightmareMoveSlot);
|
|
|
|
tvPtr->side[atkSide].faintCause = FNT_NIGHTMARE;
|
2018-02-27 20:40:09 +01:00
|
|
|
tvPtr->side[atkSide].faintCauseMonId = atkFlank;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNSQUEEZEDBYBIND:
|
|
|
|
case STRINGID_PKMNTRAPPEDINVORTEX:
|
|
|
|
case STRINGID_PKMNWRAPPEDBY:
|
|
|
|
case STRINGID_PKMNCLAMPED:
|
|
|
|
case STRINGID_PKMNTRAPPEDBYSANDTOMB:
|
|
|
|
tvPtr->pos[defSide][defFlank].wrapMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[defSide][defFlank].wrapMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNHURTBY:
|
|
|
|
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0
|
|
|
|
&& tvPtr->pos[atkSide][atkFlank].wrapMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS_DMG, 6, tvPtr->pos[atkSide][atkFlank].wrapMonId - 1, tvPtr->pos[atkSide][atkFlank].wrapMoveSlot);
|
|
|
|
tvPtr->side[atkSide].faintCause = FNT_WRAP;
|
2018-02-27 20:40:09 +01:00
|
|
|
tvPtr->side[atkSide].faintCauseMonId = atkFlank;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNWASBURNED:
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].brnMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].brnMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNHURTBYBURN:
|
|
|
|
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0)
|
|
|
|
{
|
|
|
|
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS_DMG, 4, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMoveSlot);
|
|
|
|
tvPtr->side[atkSide].faintCause = FNT_BURN;
|
2018-02-27 20:40:09 +01:00
|
|
|
tvPtr->side[atkSide].faintCauseMonId = gBattlerPartyIndexes[gBattlerAttacker];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNWASPOISONED:
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].psnMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].psnMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNBADLYPOISONED:
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].badPsnMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].badPsnMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNHURTBYPOISON:
|
|
|
|
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0)
|
|
|
|
{
|
|
|
|
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS_DMG, 2, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMoveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS_DMG, 3, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMoveSlot);
|
|
|
|
tvPtr->side[atkSide].faintCause = FNT_POISON;
|
2018-02-27 20:40:09 +01:00
|
|
|
tvPtr->side[atkSide].faintCauseMonId = gBattlerPartyIndexes[gBattlerAttacker];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNFELLINLOVE:
|
|
|
|
tvPtr->pos[defSide][defFlank].attractMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[defSide][defFlank].attractMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNIMMOBILIZEDBYLOVE:
|
|
|
|
if (tvPtr->pos[atkSide][atkFlank].attractMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS, 0, tvPtr->pos[atkSide][atkFlank].attractMonId - 1, tvPtr->pos[atkSide][atkFlank].attractMoveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNWASPARALYZED:
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].prlzMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].prlzMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNISPARALYZED:
|
|
|
|
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS, 2, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMoveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNFELLASLEEP:
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].slpMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].slpMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNFASTASLEEP:
|
|
|
|
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMonId != 0
|
2018-06-30 15:35:54 +02:00
|
|
|
&& gBattleMsgDataPtr->currentMove != MOVE_SNORE
|
|
|
|
&& gBattleMsgDataPtr->currentMove != MOVE_SLEEP_TALK)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS, 3, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMoveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNWASFROZEN:
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].frzMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].frzMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNISFROZEN:
|
|
|
|
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS, 4, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMoveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNWASCONFUSED:
|
|
|
|
tvPtr->pos[effSide][effFlank].confusionMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[effSide][effFlank].confusionMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_ITHURTCONFUSION:
|
|
|
|
if (tvPtr->pos[atkSide][atkFlank].confusionMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_STATUS, 1, tvPtr->pos[atkSide][atkFlank].confusionMonId - 1, tvPtr->pos[atkSide][atkFlank].confusionMoveSlot);
|
|
|
|
tvPtr->side[atkSide].faintCause = FNT_CONFUSION;
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_SPIKESSCATTERED:
|
|
|
|
tvPtr->side[defSide].spikesMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[defSide].spikesMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNHURTBYSPIKES:
|
|
|
|
if (tvPtr->side[scriptingSide].spikesMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SPIKES, scriptingSide ^ BIT_SIDE, tvPtr->side[scriptingSide].spikesMonId - 1, tvPtr->side[scriptingSide].spikesMoveSlot);
|
|
|
|
tvPtr->side[scriptingSide].faintCause = FNT_SPIKES;
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNBLEWAWAYSPIKES:
|
|
|
|
tvPtr->side[atkSide].spikesMonId = 0;
|
|
|
|
tvPtr->side[atkSide].spikesMoveSlot = 0;
|
|
|
|
break;
|
|
|
|
case STRINGID_FIREWEAKENED:
|
|
|
|
tvPtr->pos[atkSide][atkFlank].waterSportMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[atkSide][atkFlank].waterSportMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_ELECTRICITYWEAKENED:
|
|
|
|
tvPtr->pos[atkSide][atkFlank].mudSportMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[atkSide][atkFlank].mudSportMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_ATTACKERFAINTED:
|
|
|
|
AddPointsOnFainting(FALSE);
|
|
|
|
case STRINGID_RETURNMON:
|
|
|
|
if (tvPtr->pos[atkSide][atkFlank].waterSportMonId != 0)
|
|
|
|
{
|
|
|
|
tvPtr->pos[atkSide][atkFlank].waterSportMonId = 0;
|
|
|
|
tvPtr->pos[atkSide][atkFlank].waterSportMoveSlot = 0;
|
|
|
|
}
|
|
|
|
if (tvPtr->pos[atkSide][atkFlank].mudSportMonId != 0)
|
|
|
|
{
|
|
|
|
tvPtr->pos[atkSide][atkFlank].mudSportMonId = 0;
|
|
|
|
tvPtr->pos[atkSide][atkFlank].mudSportMoveSlot = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_TARGETFAINTED:
|
|
|
|
AddPointsOnFainting(TRUE);
|
|
|
|
if (tvPtr->pos[atkSide][defFlank].waterSportMonId != 0)
|
|
|
|
{
|
|
|
|
tvPtr->pos[atkSide][defFlank].waterSportMonId = 0;
|
|
|
|
tvPtr->pos[atkSide][defFlank].waterSportMoveSlot = 0;
|
|
|
|
}
|
|
|
|
if (tvPtr->pos[atkSide][defFlank].mudSportMonId != 0)
|
|
|
|
{
|
|
|
|
tvPtr->pos[atkSide][defFlank].mudSportMonId = 0;
|
|
|
|
tvPtr->pos[atkSide][defFlank].mudSportMoveSlot = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNRAISEDDEF:
|
|
|
|
case STRINGID_PKMNRAISEDDEFALITTLE:
|
|
|
|
tvPtr->side[atkSide].reflectMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].reflectMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNRAISEDSPDEF:
|
|
|
|
case STRINGID_PKMNRAISEDSPDEFALITTLE:
|
|
|
|
tvPtr->side[atkSide].lightScreenMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].lightScreenMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNSXWOREOFF:
|
|
|
|
if (*finishedMoveId == MOVE_REFLECT)
|
|
|
|
{
|
|
|
|
tvPtr->side[atkSide].reflectMonId = 0;
|
|
|
|
tvPtr->side[atkSide].reflectMoveSlot = 0;
|
|
|
|
}
|
|
|
|
if (*finishedMoveId == MOVE_LIGHT_SCREEN)
|
|
|
|
{
|
|
|
|
tvPtr->side[atkSide].lightScreenMonId = 0;
|
|
|
|
tvPtr->side[atkSide].lightScreenMoveSlot = 0;
|
|
|
|
}
|
|
|
|
if (*finishedMoveId == MOVE_MIST)
|
|
|
|
{
|
|
|
|
tvPtr->side[atkSide].mistMonId = 0;
|
|
|
|
tvPtr->side[atkSide].mistMoveSlot = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNCOVEREDBYVEIL:
|
|
|
|
tvPtr->side[atkSide].safeguardMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].safeguardMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNUSEDSAFEGUARD:
|
|
|
|
if (tvPtr->side[defSide].safeguardMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SAFEGUARD, 0, tvPtr->side[defSide].safeguardMonId - 1, tvPtr->side[defSide].safeguardMoveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNSAFEGUARDEXPIRED:
|
|
|
|
tvPtr->side[atkSide].safeguardMonId = 0;
|
|
|
|
tvPtr->side[atkSide].safeguardMoveSlot = 0;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNSHROUDEDINMIST:
|
|
|
|
tvPtr->side[atkSide].mistMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].mistMoveSlot = moveSlot;
|
|
|
|
break;
|
|
|
|
case STRINGID_PKMNPROTECTEDBYMIST:
|
|
|
|
if (tvPtr->side[defSide].mistMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_MIST, 0, tvPtr->side[defSide].mistMonId - 1, tvPtr->side[defSide].mistMoveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_THEWALLSHATTERED:
|
|
|
|
tvPtr->side[defSide].reflectMonId = 0;
|
|
|
|
tvPtr->side[defSide].reflectMoveSlot = 0;
|
|
|
|
tvPtr->side[defSide].lightScreenMonId = 0;
|
|
|
|
tvPtr->side[defSide].lightScreenMoveSlot = 0;
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_BREAK_WALL, 0, gBattlerPartyIndexes[gBattlerAttacker], moveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNFLINCHED:
|
|
|
|
if (tvPtr->pos[atkSide][0].attackedByMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FLINCHED, 0, tvPtr->pos[atkSide][0].attackedByMonId - 1, tvPtr->pos[atkSide][0].attackedByMoveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->pos[atkSide][1].attackedByMonId != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FLINCHED, 0, tvPtr->pos[atkSide][1].attackedByMonId - 1, tvPtr->pos[atkSide][1].attackedByMoveSlot);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
case STRINGID_PKMNCRASHED:
|
|
|
|
case STRINGID_PKMNHITWITHRECOIL:
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[atkSide].faintCause = FNT_RECOIL;
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
static bool8 IsNotSpecialBattleString(u16 stringId)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
s32 i = 0;
|
|
|
|
|
2018-03-01 01:05:34 +01:00
|
|
|
do
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
if (sSpecialBattleStrings[i] == stringId)
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
i++;
|
2021-01-14 06:29:59 -05:00
|
|
|
} while (sSpecialBattleStrings[i] != TABLE_END);
|
2018-02-27 20:40:09 +01:00
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
if (sSpecialBattleStrings[i] == TABLE_END)
|
2018-02-27 20:40:09 +01:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BattleTv_SetDataBasedOnMove(u16 move, u16 weatherFlags, struct DisableStruct *disableStructPtr)
|
|
|
|
{
|
|
|
|
struct BattleTv *tvPtr;
|
|
|
|
u32 atkSide, defSide;
|
|
|
|
u8 moveSlot;
|
|
|
|
|
|
|
|
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK))
|
|
|
|
return;
|
|
|
|
|
|
|
|
tvPtr = &gBattleStruct->tv;
|
|
|
|
|
|
|
|
atkSide = GetBattlerSide(gBattlerAttacker);
|
|
|
|
defSide = GetBattlerSide(gBattlerTarget);
|
|
|
|
moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, move);
|
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
if (moveSlot >= MAX_MON_MOVES)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[atkSide].faintCause = FNT_OTHER;
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
tvPtr->pos[defSide][GetBattlerPosition(gBattlerAttacker) / 2].attackedByMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->pos[defSide][GetBattlerPosition(gBattlerAttacker) / 2].attackedByMoveSlot = moveSlot;
|
|
|
|
tvPtr->side[atkSide].usedMoveSlot = moveSlot;
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_MOVE_EFFECT, moveSlot, gBattleMoves[move].effect, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
AddPointsBasedOnWeather(weatherFlags, move, moveSlot);
|
2018-10-14 18:37:52 +02:00
|
|
|
if (disableStructPtr->chargeTimer != 0)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_ELECTRIC, move, moveSlot, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
|
|
|
|
if (move == MOVE_WISH)
|
|
|
|
{
|
|
|
|
tvPtr->side[atkSide].wishMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide].wishMoveSlot = moveSlot;
|
|
|
|
}
|
|
|
|
if (move == MOVE_SELF_DESTRUCT || move == MOVE_EXPLOSION)
|
|
|
|
{
|
|
|
|
tvPtr->side[atkSide ^ BIT_SIDE].explosionMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1;
|
|
|
|
tvPtr->side[atkSide ^ BIT_SIDE].explosionMoveSlot = moveSlot;
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[atkSide ^ BIT_SIDE].faintCause = FNT_EXPLOSION;
|
|
|
|
tvPtr->side[atkSide ^ BIT_SIDE].explosion = TRUE;
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
|
2021-08-11 16:33:10 -07:00
|
|
|
AddMovePoints(PTS_REFLECT, move, gBattleMoves[move].power, 0);
|
|
|
|
AddMovePoints(PTS_LIGHT_SCREEN, move, gBattleMoves[move].power, 0);
|
|
|
|
AddMovePoints(PTS_WATER_SPORT, move, 0, 0);
|
|
|
|
AddMovePoints(PTS_MUD_SPORT, move, 0, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void BattleTv_SetDataBasedOnAnimation(u8 animationId)
|
|
|
|
{
|
|
|
|
struct BattleTv *tvPtr;
|
|
|
|
u32 atkSide;
|
|
|
|
|
|
|
|
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK))
|
|
|
|
return;
|
|
|
|
|
|
|
|
tvPtr = &gBattleStruct->tv;
|
|
|
|
atkSide = GetBattlerSide(gBattlerAttacker);
|
|
|
|
switch (animationId)
|
|
|
|
{
|
|
|
|
case B_ANIM_FUTURE_SIGHT_HIT:
|
|
|
|
if (tvPtr->side[atkSide].futureSightMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SET_UP, 0, atkSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide].futureSightMonId - 1) * 4 + tvPtr->side[atkSide].futureSightMoveSlot);
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[atkSide].faintCause = FNT_FUTURE_SIGHT;
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case B_ANIM_DOOM_DESIRE_HIT:
|
|
|
|
if (tvPtr->side[atkSide].doomDesireMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SET_UP, 1, atkSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide].doomDesireMonId - 1) * 4 + tvPtr->side[atkSide].doomDesireMoveSlot);
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[atkSide].faintCause = FNT_DOOM_DESIRE;
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TryPutLinkBattleTvShowOnAir(void)
|
|
|
|
{
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 04:22:50 -03:00
|
|
|
u16 playerBestSpecies = 0, opponentBestSpecies = 0;
|
|
|
|
s16 playerBestSum = 0, opponentBestSum = SHRT_MAX;
|
2018-02-27 20:40:09 +01:00
|
|
|
u8 playerBestMonId = 0, opponentBestMonId = 0;
|
|
|
|
struct BattleTvMovePoints *movePoints = NULL;
|
|
|
|
u8 countPlayer = 0, countOpponent = 0;
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 04:22:50 -03:00
|
|
|
s16 sum = 0;
|
|
|
|
u16 species = 0;
|
|
|
|
u16 moveId = 0;
|
2018-02-27 20:40:09 +01:00
|
|
|
s32 i, j;
|
2020-10-23 21:04:28 -04:00
|
|
|
int zero = 0, one = 1; //needed for matching
|
2020-09-02 14:14:29 -04:00
|
|
|
|
2018-02-27 20:40:09 +01:00
|
|
|
if (gBattleStruct->anyMonHasTransformed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
movePoints = &gBattleStruct->tvMovePoints;
|
|
|
|
for (i = 0; i < PARTY_SIZE; i++)
|
|
|
|
{
|
|
|
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
|
|
|
countPlayer++;
|
|
|
|
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
|
|
|
countOpponent++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) || countPlayer != countOpponent)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < PARTY_SIZE; i++)
|
|
|
|
{
|
|
|
|
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
|
|
|
|
if (species != SPECIES_NONE && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG, NULL))
|
|
|
|
{
|
2018-12-25 12:50:15 -05:00
|
|
|
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
2020-09-02 14:14:29 -04:00
|
|
|
sum += movePoints->points[zero][i * 4 + j];
|
2018-02-27 20:40:09 +01:00
|
|
|
|
|
|
|
if (playerBestSum < sum)
|
|
|
|
{
|
|
|
|
playerBestMonId = i;
|
|
|
|
playerBestSum = sum;
|
|
|
|
playerBestSpecies = species;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES, NULL);
|
|
|
|
if (species != SPECIES_NONE && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG, NULL))
|
|
|
|
{
|
2018-12-25 12:50:15 -05:00
|
|
|
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
2020-09-02 14:14:29 -04:00
|
|
|
sum += movePoints->points[one][i * 4 + j];
|
2018-02-27 20:40:09 +01:00
|
|
|
|
|
|
|
if (opponentBestSum == sum)
|
|
|
|
{
|
|
|
|
if (GetMonData(&gEnemyParty[i], MON_DATA_EXP, NULL) > GetMonData(&gEnemyParty[opponentBestMonId], MON_DATA_EXP, NULL))
|
|
|
|
{
|
|
|
|
opponentBestMonId = i;
|
|
|
|
opponentBestSum = sum;
|
|
|
|
opponentBestSpecies = species;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (opponentBestSum > sum)
|
|
|
|
{
|
|
|
|
opponentBestMonId = i;
|
|
|
|
opponentBestSum = sum;
|
|
|
|
opponentBestSpecies = species;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-25 12:50:15 -05:00
|
|
|
for (sum = 0, i = 0, j = 0; j < MAX_MON_MOVES; j++)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2020-09-02 14:14:29 -04:00
|
|
|
if (sum < movePoints->points[zero][playerBestMonId * 4 + j])
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2020-09-02 14:14:29 -04:00
|
|
|
sum = movePoints->points[zero][playerBestMonId * 4 + j];
|
2018-02-27 20:40:09 +01:00
|
|
|
i = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
moveId = GetMonData(&gPlayerParty[playerBestMonId], MON_DATA_MOVE1 + i, NULL);
|
|
|
|
if (playerBestSum == 0 || moveId == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
|
|
|
{
|
2021-10-02 23:48:12 -04:00
|
|
|
if ((playerBestMonId < MULTI_PARTY_SIZE && !GetLinkTrainerFlankId(gBattleScripting.multiplayerId))
|
|
|
|
|| (playerBestMonId >= MULTI_PARTY_SIZE && GetLinkTrainerFlankId(gBattleScripting.multiplayerId)))
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
2021-10-02 23:48:12 -04:00
|
|
|
j = (opponentBestMonId < MULTI_PARTY_SIZE) ? FALSE : TRUE;
|
|
|
|
PutBattleUpdateOnTheAir(GetOpposingLinkMultiBattlerId(j, gBattleScripting.multiplayerId), moveId, playerBestSpecies, opponentBestSpecies);
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PutBattleUpdateOnTheAir(gBattleScripting.multiplayerId ^ 1, moveId, playerBestSpecies, opponentBestSpecies);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3)
|
|
|
|
{
|
|
|
|
struct BattleTvMovePoints *movePoints = &gBattleStruct->tvMovePoints;
|
|
|
|
struct BattleTv *tvPtr = &gBattleStruct->tv;
|
|
|
|
u32 atkSide = GetBattlerSide(gBattlerAttacker);
|
|
|
|
u32 defSide = GetBattlerSide(gBattlerTarget);
|
|
|
|
const u16 *ptr;
|
|
|
|
s32 i;
|
|
|
|
|
|
|
|
switch (caseId)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
case PTS_MOVE_EFFECT:
|
|
|
|
case PTS_EFFECTIVENESS:
|
|
|
|
case PTS_CRITICAL_HIT:
|
|
|
|
case PTS_STAT_INCREASE_1:
|
|
|
|
case PTS_STAT_INCREASE_2:
|
|
|
|
case PTS_STAT_DECREASE_SELF:
|
|
|
|
case PTS_STAT_DECREASE_1:
|
|
|
|
case PTS_STAT_DECREASE_2:
|
|
|
|
case PTS_STAT_INCREASE_NOT_SELF:
|
2018-02-27 20:40:09 +01:00
|
|
|
movePoints->points[atkSide][gBattlerPartyIndexes[gBattlerAttacker] * 4 + arg1] += sPointsArray[caseId][arg2];
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
|
|
|
|
#define move arg1
|
|
|
|
case PTS_RAIN:
|
|
|
|
case PTS_SUN:
|
|
|
|
case PTS_SANDSTORM:
|
|
|
|
case PTS_HAIL:
|
|
|
|
case PTS_ELECTRIC:
|
2018-02-27 20:40:09 +01:00
|
|
|
i = 0;
|
|
|
|
ptr = sPointsArray[caseId];
|
|
|
|
do
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
if (move == ptr[i])
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
movePoints->points[atkSide][gBattlerPartyIndexes[gBattlerAttacker] * 4 + arg2] += ptr[i+1];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
i += 2;
|
2021-01-14 06:29:59 -05:00
|
|
|
} while (ptr[i] != TABLE_END);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
#undef move
|
|
|
|
|
|
|
|
case PTS_FAINT:
|
|
|
|
tvPtr->side[arg2 ^ 1].faintCause = FNT_NONE;
|
2018-02-27 20:40:09 +01:00
|
|
|
movePoints->points[arg2][0 * 4 + arg3] += sPointsArray[caseId][arg1];
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case PTS_FAINT_SET_UP:
|
|
|
|
tvPtr->side[arg2].faintCause = FNT_NONE;
|
|
|
|
// fallthrough
|
|
|
|
case PTS_SET_UP:
|
2018-02-27 20:40:09 +01:00
|
|
|
movePoints->points[arg2][0 * 4 + arg3] += sPointsArray[caseId][arg1];
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case PTS_BREAK_WALL:
|
2018-02-27 20:40:09 +01:00
|
|
|
movePoints->points[atkSide][arg2 * 4 + arg3] += sPointsArray[caseId][arg1];
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case PTS_STATUS_DMG:
|
|
|
|
case PTS_STATUS:
|
|
|
|
case PTS_SAFEGUARD:
|
|
|
|
case PTS_MIST:
|
|
|
|
case PTS_FLINCHED:
|
2018-02-27 20:40:09 +01:00
|
|
|
movePoints->points[atkSide ^ BIT_SIDE][arg2 * 4 + arg3] += sPointsArray[caseId][arg1];
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case PTS_SPIKES:
|
2018-02-27 20:40:09 +01:00
|
|
|
movePoints->points[arg1][arg2 * 4 + arg3] += sPointsArray[caseId][0];
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
|
2021-08-11 16:33:10 -07:00
|
|
|
#define move arg1
|
2021-01-14 06:29:59 -05:00
|
|
|
#define power arg2
|
|
|
|
case PTS_WATER_SPORT:
|
|
|
|
// If used fire move during Water Sport
|
2021-08-11 16:33:10 -07:00
|
|
|
if (tvPtr->pos[defSide][0].waterSportMonId != -(tvPtr->pos[defSide][1].waterSportMonId) && gBattleMoves[move].type == TYPE_FIRE)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
if (tvPtr->pos[defSide][0].waterSportMonId != 0)
|
|
|
|
{
|
|
|
|
u32 id = (tvPtr->pos[defSide][0].waterSportMonId - 1) * 4;
|
|
|
|
movePoints->points[defSide][id + tvPtr->pos[defSide][0].waterSportMoveSlot] += sPointsArray[caseId][0];
|
|
|
|
}
|
|
|
|
if (tvPtr->pos[defSide][1].waterSportMonId != 0)
|
|
|
|
{
|
|
|
|
u32 id = (tvPtr->pos[defSide][1].waterSportMonId - 1) * 4;
|
|
|
|
movePoints->points[defSide][id + tvPtr->pos[defSide][1].waterSportMoveSlot] += sPointsArray[caseId][0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case PTS_MUD_SPORT:
|
|
|
|
// If used Electric move during Mud Sport
|
2021-08-11 16:33:10 -07:00
|
|
|
if (tvPtr->pos[defSide][0].mudSportMonId != -(tvPtr->pos[defSide][1].mudSportMonId) && gBattleMoves[move].type == TYPE_ELECTRIC)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
if (tvPtr->pos[defSide][0].mudSportMonId != 0)
|
|
|
|
{
|
|
|
|
u32 id = (tvPtr->pos[defSide][0].mudSportMonId - 1) * 4;
|
|
|
|
movePoints->points[defSide][id + tvPtr->pos[defSide][0].mudSportMoveSlot] += sPointsArray[caseId][0];
|
|
|
|
}
|
|
|
|
if (tvPtr->pos[defSide][1].mudSportMonId != 0)
|
|
|
|
{
|
|
|
|
u32 id = (tvPtr->pos[defSide][1].mudSportMonId - 1) * 4;
|
|
|
|
movePoints->points[defSide][id + tvPtr->pos[defSide][1].mudSportMoveSlot] += sPointsArray[caseId][0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case PTS_REFLECT:
|
|
|
|
// If hit Reflect with damaging physical move
|
2021-08-11 16:33:10 -07:00
|
|
|
if (IS_MOVE_PHYSICAL(move) && power != 0 && tvPtr->side[defSide].reflectMonId != 0)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
u32 id = (tvPtr->side[defSide].reflectMonId - 1) * 4;
|
|
|
|
movePoints->points[defSide][id + tvPtr->side[defSide].reflectMoveSlot] += sPointsArray[caseId][0];
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case PTS_LIGHT_SCREEN:
|
|
|
|
// If hit Light Screen with damaging special move
|
2021-08-11 16:33:10 -07:00
|
|
|
if (IS_MOVE_SPECIAL(move) && power != 0 && tvPtr->side[defSide].lightScreenMonId != 0)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
u32 id = (tvPtr->side[defSide].lightScreenMonId - 1) * 4;
|
|
|
|
movePoints->points[defSide][id + tvPtr->side[defSide].lightScreenMoveSlot] += sPointsArray[caseId][0];
|
|
|
|
}
|
|
|
|
break;
|
2021-08-11 16:33:10 -07:00
|
|
|
#undef move
|
2021-01-14 06:29:59 -05:00
|
|
|
#undef power
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void AddPointsOnFainting(bool8 targetFainted)
|
|
|
|
{
|
|
|
|
struct BattleTv *tvPtr = &gBattleStruct->tv;
|
|
|
|
u32 atkSide = GetBattlerSide(gBattlerAttacker);
|
|
|
|
u32 defSide = GetBattlerSide(gBattlerTarget);
|
|
|
|
u32 atkArrId = tvPtr->side[atkSide].faintCauseMonId;
|
|
|
|
s32 i;
|
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
if (tvPtr->side[atkSide].faintCause != FNT_NONE)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
switch (tvPtr->side[atkSide].faintCause)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_CURSE:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->pos[atkSide][atkArrId].curseMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->pos[atkSide][atkArrId].curseMonId - 1) * 4 + tvPtr->pos[atkSide][atkArrId].curseMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_LEECH_SEED:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->pos[atkSide][atkArrId].leechSeedMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->pos[atkSide][atkArrId].leechSeedMonId - 1) * 4 + tvPtr->pos[atkSide][atkArrId].leechSeedMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_POISON:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->mon[atkSide][atkArrId].psnMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->mon[atkSide][atkArrId].psnMonId - 1) * 4 + tvPtr->mon[atkSide][atkArrId].psnMoveSlot);
|
|
|
|
}
|
|
|
|
if (tvPtr->mon[atkSide][atkArrId].badPsnMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->mon[atkSide][atkArrId].badPsnMonId - 1) * 4 + tvPtr->mon[atkSide][atkArrId].badPsnMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_BURN:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->mon[atkSide][atkArrId].brnMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->mon[atkSide][atkArrId].brnMonId - 1) * 4 + tvPtr->mon[atkSide][atkArrId].brnMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_NIGHTMARE:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->pos[atkSide][atkArrId].nightmareMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->pos[atkSide][atkArrId].nightmareMonId - 1) * 4 + tvPtr->pos[atkSide][atkArrId].nightmareMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_WRAP:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->pos[atkSide][atkArrId].wrapMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->pos[atkSide][atkArrId].wrapMonId - 1) * 4 + tvPtr->pos[atkSide][atkArrId].wrapMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_SPIKES:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->side[atkSide].spikesMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide].spikesMonId - 1) * 4 + tvPtr->side[atkSide].spikesMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_FUTURE_SIGHT:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->side[atkSide].futureSightMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT_SET_UP, 0, atkSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide].futureSightMonId - 1) * 4 + tvPtr->side[atkSide].futureSightMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_DOOM_DESIRE:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->side[atkSide].doomDesireMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT_SET_UP, 0, atkSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide].doomDesireMonId - 1) * 4 + tvPtr->side[atkSide].doomDesireMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_PERISH_SONG:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->side[atkSide].perishSong
|
|
|
|
&& tvPtr->side[atkSide].perishSongMonId - 1 != gBattlerPartyIndexes[gBattlerAttacker])
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide].perishSongMonId - 1) * 4 + tvPtr->side[atkSide].perishSongMoveSlot);
|
|
|
|
}
|
|
|
|
if (tvPtr->side[atkSide ^ BIT_SIDE].perishSong)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide ^ BIT_SIDE].perishSongMonId - 1) * 4 + tvPtr->side[atkSide ^ BIT_SIDE].perishSongMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_DESTINY_BOND:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->side[atkSide ^ BIT_SIDE].destinyBondMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide ^ BIT_SIDE].destinyBondMonId - 1) * 4 + tvPtr->side[atkSide ^ BIT_SIDE].destinyBondMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_CONFUSION:
|
2018-02-27 20:40:09 +01:00
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
|
|
|
if (tvPtr->pos[atkSide][i].confusionMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->pos[atkSide][i].confusionMonId - 1) * 4 + tvPtr->pos[atkSide][i].confusionMoveSlot);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_EXPLOSION:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (tvPtr->side[atkSide].explosion)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide].explosionMonId - 1) * 4 + tvPtr->side[atkSide].explosionMoveSlot);
|
|
|
|
}
|
|
|
|
if (tvPtr->side[atkSide ^ BIT_SIDE].explosion)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[atkSide ^ BIT_SIDE].explosionMonId - 1) * 4 + tvPtr->side[atkSide ^ BIT_SIDE].explosionMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_RECOIL:
|
2018-02-27 20:40:09 +01:00
|
|
|
if (targetFainted == TRUE)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT_SET_UP, 0, atkSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(gBattlerPartyIndexes[gBattlerAttacker]) * 4 + tvPtr->side[atkSide].usedMoveSlot);
|
|
|
|
}
|
|
|
|
break;
|
2021-01-14 06:29:59 -05:00
|
|
|
case FNT_OTHER:
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
if (tvPtr->side[defSide].faintCause == FNT_SPIKES)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
if (tvPtr->side[defSide].spikesMonId != 0)
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT, 0, defSide ^ BIT_SIDE,
|
2018-02-27 20:40:09 +01:00
|
|
|
(tvPtr->side[defSide].spikesMonId - 1) * 4 + tvPtr->side[defSide].spikesMoveSlot);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_FAINT_SET_UP, 0, atkSide,
|
2018-02-27 20:40:09 +01:00
|
|
|
(gBattlerPartyIndexes[gBattlerAttacker]) * 4 + tvPtr->side[atkSide].usedMoveSlot);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void TrySetBattleSeminarShow(void)
|
|
|
|
{
|
|
|
|
s32 i;
|
2021-01-14 06:29:59 -05:00
|
|
|
s32 dmgByMove[MAX_MON_MOVES];
|
2018-02-27 20:40:09 +01:00
|
|
|
u16 powerOverride;
|
|
|
|
u16 currMoveSaved;
|
|
|
|
|
2021-01-13 15:17:32 -05:00
|
|
|
if (gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK))
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
2018-03-01 01:05:34 +01:00
|
|
|
else if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT)
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
2020-08-04 20:33:05 -04:00
|
|
|
else if (gBattleMons[gBattlerAttacker].statStages[STAT_ACC] < DEFAULT_STAT_STAGE)
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
2020-08-04 20:33:05 -04:00
|
|
|
else if (gBattleMons[gBattlerTarget].statStages[STAT_EVASION] > DEFAULT_STAT_STAGE)
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
2018-03-01 01:05:34 +01:00
|
|
|
else if (gCurrentMove == MOVE_HIDDEN_POWER || gCurrentMove == MOVE_WEATHER_BALL)
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
2018-03-01 01:05:34 +01:00
|
|
|
else if (gBattleTypeFlags & (BATTLE_TYPE_PALACE | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID))
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
2022-08-23 22:38:35 -04:00
|
|
|
else if (IS_MOVE_STATUS(gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]]))
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
currMoveSaved = gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]];
|
2018-03-01 01:05:34 +01:00
|
|
|
do
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
if (currMoveSaved == sVariableDmgMoves[i])
|
|
|
|
break;
|
|
|
|
i++;
|
2021-01-14 06:29:59 -05:00
|
|
|
} while (sVariableDmgMoves[i] != TABLE_END);
|
2018-02-27 20:40:09 +01:00
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
if (sVariableDmgMoves[i] != TABLE_END)
|
2018-02-27 20:40:09 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
dmgByMove[gMoveSelectionCursor[gBattlerAttacker]] = gBattleMoveDamage;
|
|
|
|
currMoveSaved = gCurrentMove;
|
2018-12-25 12:50:15 -05:00
|
|
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
gCurrentMove = gBattleMons[gBattlerAttacker].moves[i];
|
|
|
|
powerOverride = 0;
|
|
|
|
if (ShouldCalculateDamage(gCurrentMove, &dmgByMove[i], &powerOverride))
|
|
|
|
{
|
2019-04-02 00:14:01 +02:00
|
|
|
gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, gBattleMoves[gCurrentMove].type, powerOverride, FALSE, FALSE, FALSE);
|
2018-02-27 20:40:09 +01:00
|
|
|
dmgByMove[i] = gBattleMoveDamage;
|
2018-07-24 20:13:02 +02:00
|
|
|
if (dmgByMove[i] == 0 && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
2018-02-27 20:40:09 +01:00
|
|
|
dmgByMove[i] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-25 12:50:15 -05:00
|
|
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
if (i != gMoveSelectionCursor[gBattlerAttacker] && dmgByMove[i] > dmgByMove[gMoveSelectionCursor[gBattlerAttacker]])
|
|
|
|
{
|
|
|
|
u16 opponentSpecies, playerSpecies;
|
|
|
|
s32 bestMoveId;
|
|
|
|
|
|
|
|
if (gMoveSelectionCursor[gBattlerAttacker] != 0)
|
|
|
|
bestMoveId = 0;
|
|
|
|
else
|
|
|
|
bestMoveId = 1;
|
|
|
|
|
2018-12-25 12:50:15 -05:00
|
|
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
if (i != gMoveSelectionCursor[gBattlerAttacker] && dmgByMove[i] > dmgByMove[bestMoveId])
|
|
|
|
bestMoveId = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
opponentSpecies = GetMonData(&gEnemyParty [gBattlerPartyIndexes[gBattlerTarget]], MON_DATA_SPECIES, NULL);
|
|
|
|
playerSpecies = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]], MON_DATA_SPECIES, NULL);
|
2021-01-14 06:29:59 -05:00
|
|
|
TryPutBattleSeminarOnAir(opponentSpecies, playerSpecies, gMoveSelectionCursor[gBattlerAttacker], gBattleMons[gBattlerAttacker].moves, gBattleMons[gBattlerAttacker].moves[bestMoveId]);
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gBattleMoveDamage = dmgByMove[gMoveSelectionCursor[gBattlerAttacker]];
|
|
|
|
gCurrentMove = currMoveSaved;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride)
|
|
|
|
{
|
2022-08-23 22:38:35 -04:00
|
|
|
if (IS_MOVE_STATUS(moveId))
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
*dmg = 0;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s32 i = 0;
|
2018-03-01 01:05:34 +01:00
|
|
|
do
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
if (moveId == sVariableDmgMoves[i])
|
|
|
|
break;
|
|
|
|
i++;
|
2021-01-14 06:29:59 -05:00
|
|
|
} while (sVariableDmgMoves[i] != TABLE_END);
|
2018-02-27 20:40:09 +01:00
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
if (sVariableDmgMoves[i] != TABLE_END)
|
2018-02-27 20:40:09 +01:00
|
|
|
{
|
|
|
|
*dmg = 0;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (moveId == MOVE_PSYWAVE)
|
|
|
|
{
|
|
|
|
*dmg = gBattleMons[gBattlerAttacker].level;
|
|
|
|
*dmg /= 2;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (moveId == MOVE_MAGNITUDE)
|
|
|
|
{
|
|
|
|
*powerOverride = 10;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BattleTv_ClearExplosionFaintCause(void)
|
|
|
|
{
|
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
|
|
|
{
|
|
|
|
struct BattleTv *tvPtr = &gBattleStruct->tv;
|
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[B_SIDE_PLAYER].faintCause = FNT_NONE;
|
|
|
|
tvPtr->side[B_SIDE_OPPONENT].faintCause = FNT_NONE;
|
2018-02-27 20:40:09 +01:00
|
|
|
|
|
|
|
tvPtr->side[B_SIDE_PLAYER].faintCauseMonId = 0;
|
|
|
|
tvPtr->side[B_SIDE_OPPONENT].faintCauseMonId = 0;
|
|
|
|
|
|
|
|
tvPtr->side[B_SIDE_PLAYER].explosionMonId = 0;
|
|
|
|
tvPtr->side[B_SIDE_OPPONENT].explosionMonId = 0;
|
|
|
|
|
|
|
|
tvPtr->side[B_SIDE_PLAYER].explosionMoveSlot = 0;
|
|
|
|
tvPtr->side[B_SIDE_OPPONENT].explosionMoveSlot = 0;
|
|
|
|
|
2021-01-14 06:29:59 -05:00
|
|
|
tvPtr->side[B_SIDE_PLAYER].explosion = FALSE;
|
|
|
|
tvPtr->side[B_SIDE_OPPONENT].explosion = FALSE;
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
u8 GetBattlerMoveSlotId(u8 battlerId, u16 moveId)
|
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
struct Pokemon *party;
|
|
|
|
|
|
|
|
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
|
|
|
party = gPlayerParty;
|
|
|
|
else
|
|
|
|
party = gEnemyParty;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (1)
|
|
|
|
{
|
2018-12-25 12:50:15 -05:00
|
|
|
if (i >= MAX_MON_MOVES)
|
2018-02-27 20:40:09 +01:00
|
|
|
break;
|
|
|
|
if (GetMonData(&party[gBattlerPartyIndexes[battlerId]], MON_DATA_MOVE1 + i, NULL) == moveId)
|
|
|
|
break;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void AddPointsBasedOnWeather(u16 weatherFlags, u16 moveId, u8 moveSlot)
|
|
|
|
{
|
2021-09-30 12:08:20 +02:00
|
|
|
if (weatherFlags & B_WEATHER_RAIN)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_RAIN, moveId, moveSlot, 0);
|
2021-09-30 12:08:20 +02:00
|
|
|
else if (weatherFlags & B_WEATHER_SUN)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SUN, moveId, moveSlot, 0);
|
2021-09-30 12:08:20 +02:00
|
|
|
else if (weatherFlags & B_WEATHER_SANDSTORM)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_SANDSTORM, moveId, moveSlot, 0);
|
2021-09-30 12:08:20 +02:00
|
|
|
else if (weatherFlags & B_WEATHER_HAIL)
|
2021-01-14 06:29:59 -05:00
|
|
|
AddMovePoints(PTS_HAIL, moveId, moveSlot, 0);
|
2018-02-27 20:40:09 +01:00
|
|
|
}
|