Skip to content

Commit

Permalink
Merge pull request #100 from lhearachel/battle-dev
Browse files Browse the repository at this point in the history
Document battle script commands 0x44, 0xBB - 0xDE
  • Loading branch information
lhearachel authored Nov 1, 2023
2 parents d2df666 + 1e58ed2 commit e651833
Show file tree
Hide file tree
Showing 31 changed files with 1,555 additions and 1,216 deletions.
11 changes: 11 additions & 0 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#ifndef POKEPLATINUM_CONSTANTS_BATTLE_H
#define POKEPLATINUM_CONSTANTS_BATTLE_H

#include "constants/battle/battle_effects.h"
#include "constants/battle/condition.h"
#include "constants/battle/message_tags.h"
#include "constants/battle/moves.h"
#include "constants/battle/scripts.h"
#include "constants/battle/side_effects.h"
#include "constants/battle/system_control.h"
#include "constants/battle/terrain.h"
#include "constants/battle/turn_flags.h"

#define BATTLE_TYPE_SINGLES (0 << 0)
#define BATTLE_TYPE_WILD_MON (0 << 0)
#define BATTLE_TYPE_TRAINER (1 << 0)
Expand Down Expand Up @@ -33,6 +43,7 @@
#define BATTLE_TYPE_2vs2_TAG (BATTLE_TYPE_2vs2 | BATTLE_TYPE_TAG)
#define BATTLE_TYPE_ALWAYS_CATCH (BATTLE_TYPE_PAL_PARK | BATTLE_TYPE_CATCH_TUTORIAL)
#define BATTLE_TYPE_RESTORE_ITEMS_AFTER (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER)
#define BATTLE_TYPE_2vs2_AI_DOUBLES (BATTLE_TYPE_DOUBLES | BATTLE_TYPE_2vs2 | BATTLE_TYPE_AI)

#define MAX_LINK_BATTLERS 4
#define MAX_BATTLERS 4
Expand Down
2 changes: 1 addition & 1 deletion include/constants/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ enum PokemonDataParam {
MON_DATA_149,
MON_DATA_150,
MON_DATA_151,
MON_DATA_152,
MON_DATA_MET_LOCATION,
MON_DATA_153,
MON_DATA_POKERUS,
MON_DATA_POKEBALL,
Expand Down
63 changes: 63 additions & 0 deletions include/data/pickup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "constants/items.h"

#define COMMON_PICKUP_ENTRIES 9

static const u16 sCommonPickupItems[] = {
ITEM_POTION,
ITEM_ANTIDOTE,
ITEM_SUPER_POTION,
ITEM_GREAT_BALL,
ITEM_REPEL,
ITEM_ESCAPE_ROPE,
ITEM_FULL_HEAL,
ITEM_HYPER_POTION,
ITEM_ULTRA_BALL,
ITEM_REVIVE,
ITEM_RARE_CANDY,
ITEM_DUSK_STONE,
ITEM_SHINY_STONE,
ITEM_DAWN_STONE,
ITEM_FULL_RESTORE,
ITEM_MAX_REVIVE,
ITEM_PP_UP,
ITEM_MAX_ELIXIR,
};

static const u16 sRarePickupItems[] = {
ITEM_HYPER_POTION,
ITEM_NUGGET,
ITEM_KINGS_ROCK,
ITEM_FULL_RESTORE,
ITEM_ETHER,
ITEM_WHITE_HERB,
ITEM_TM44,
ITEM_ELIXIR,
ITEM_TM01,
ITEM_LEFTOVERS,
ITEM_TM26,
};

static const u8 sCommonPickupRate[] = {
30,
40,
50,
60,
70,
80,
90,
94,
98,
};

static const u8 sHoneyGatherRate[] = {
5,
10,
15,
20,
25,
30,
35,
40,
45,
50,
};
18 changes: 18 additions & 0 deletions include/data/terrain/to_move.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "constants/battle/terrain.h"
#include "constants/moves.h"

static const u16 sTerrainMove[] = {
[TERRAIN_PLAIN] = MOVE_EARTHQUAKE,
[TERRAIN_SAND] = MOVE_EARTHQUAKE,
[TERRAIN_GRASS] = MOVE_SEED_BOMB,
[TERRAIN_PUDDLE] = MOVE_SEED_BOMB,
[TERRAIN_MOUNTAIN] = MOVE_ROCK_SLIDE,
[TERRAIN_CAVE] = MOVE_ROCK_SLIDE,
[TERRAIN_SNOW] = MOVE_BLIZZARD,
[TERRAIN_WATER] = MOVE_HYDRO_PUMP,
[TERRAIN_ICE] = MOVE_ICE_BEAM,
[TERRAIN_BUILDING] = MOVE_TRI_ATTACK,
[TERRAIN_GREAT_MARSH] = MOVE_MUD_BOMB,
[TERRAIN_BRIDGE] = MOVE_AIR_SLASH,
[TERRAIN_SPECIAL] = MOVE_TRI_ATTACK,
};
18 changes: 18 additions & 0 deletions include/data/terrain/to_secondary_effect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "constants/battle/side_effects.h"
#include "constants/battle/terrain.h"

static const u32 sTerrainSideEffect[] = {
[TERRAIN_PLAIN] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_ACCURACY_DOWN_1_STAGE,
[TERRAIN_SAND] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_ACCURACY_DOWN_1_STAGE,
[TERRAIN_GRASS] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_SLEEP,
[TERRAIN_PUDDLE] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_SLEEP,
[TERRAIN_MOUNTAIN] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_FLINCH,
[TERRAIN_CAVE] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_FLINCH,
[TERRAIN_SNOW] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_FREEZE,
[TERRAIN_WATER] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_ATTACK_DOWN_1_STAGE,
[TERRAIN_ICE] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_FREEZE,
[TERRAIN_BUILDING] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_PARALYZE,
[TERRAIN_GREAT_MARSH] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_SPEED_DOWN_1_STAGE,
[TERRAIN_BRIDGE] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_EVASION_DOWN_1_STAGE,
[TERRAIN_SPECIAL] = MOVE_SIDE_EFFECT_TO_DEFENDER | MOVE_SIDE_EFFECT_PARALYZE,
};
18 changes: 18 additions & 0 deletions include/data/terrain/to_type.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "constants/battle/terrain.h"
#include "constants/pokemon.h"

static const u8 sTerrainCamouflageType[] = {
[TERRAIN_PLAIN] = TYPE_GROUND,
[TERRAIN_SAND] = TYPE_GROUND,
[TERRAIN_GRASS] = TYPE_GRASS,
[TERRAIN_PUDDLE] = TYPE_GRASS,
[TERRAIN_MOUNTAIN] = TYPE_ROCK,
[TERRAIN_CAVE] = TYPE_ROCK,
[TERRAIN_SNOW] = TYPE_ICE,
[TERRAIN_WATER] = TYPE_WATER,
[TERRAIN_ICE] = TYPE_ICE,
[TERRAIN_BUILDING] = TYPE_NORMAL,
[TERRAIN_GREAT_MARSH] = TYPE_GROUND,
[TERRAIN_BRIDGE] = TYPE_FLYING,
[TERRAIN_SPECIAL] = TYPE_NORMAL,
};
109 changes: 109 additions & 0 deletions include/data/trainer_class_prize_mul.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#include "constants/trainer.h"

static u8 sTrainerClassPrizeMul[] = {
[TRAINER_CLASS_PLAYER_MALE] = 0,
[TRAINER_CLASS_PLAYER_FEMALE] = 0,
[TRAINER_CLASS_YOUNGSTER] = 4,
[TRAINER_CLASS_LASS] = 4,
[TRAINER_CLASS_CAMPER] = 4,
[TRAINER_CLASS_PICNICKER] = 4,
[TRAINER_CLASS_BUG_CATCHER] = 4,
[TRAINER_CLASS_AROMA_LADY] = 8,
[TRAINER_CLASS_TWINS] = 4,
[TRAINER_CLASS_HIKER] = 8,
[TRAINER_CLASS_BATTLE_GIRL] = 4,
[TRAINER_CLASS_FISHERMAN] = 8,
[TRAINER_CLASS_CYCLIST_MALE] = 8,
[TRAINER_CLASS_CYCLIST_FEMALE] = 8,
[TRAINER_CLASS_BLACK_BELT] = 6,
[TRAINER_CLASS_ARTIST] = 12,
[TRAINER_CLASS_BREEDER_MALE] = 12,
[TRAINER_CLASS_BREEDER_FEMALE] = 12,
[TRAINER_CLASS_COWGIRL] = 4,
[TRAINER_CLASS_JOGGER] = 8,
[TRAINER_CLASS_POKEFAN_MALE] = 16,
[TRAINER_CLASS_POKEFAN_FEMALE] = 16,
[TRAINER_CLASS_POKE_KID] = 2,
[TRAINER_CLASS_YOUNG_COUPLE] = 16,
[TRAINER_CLASS_ACE_TRAINER_MALE] = 15,
[TRAINER_CLASS_ACE_TRAINER_FEMALE] = 15,
[TRAINER_CLASS_WAITRESS] = 8,
[TRAINER_CLASS_VETERAN] = 20,
[TRAINER_CLASS_NINJA_BOY] = 2,
[TRAINER_CLASS_DRAGON_TAMER] = 8,
[TRAINER_CLASS_BIRD_KEEPER] = 8,
[TRAINER_CLASS_DOUBLE_TEAM] = 30,
[TRAINER_CLASS_RICH_BOY] = 40,
[TRAINER_CLASS_LADY] = 40,
[TRAINER_CLASS_GENTLEMAN] = 50,
[TRAINER_CLASS_SOCIALITE] = 50,
[TRAINER_CLASS_BEAUTY] = 14,
[TRAINER_CLASS_COLLECTOR] = 16,
[TRAINER_CLASS_POLICEMAN] = 10,
[TRAINER_CLASS_RANGER_MALE] = 15,
[TRAINER_CLASS_RANGER_FEMALE] = 15,
[TRAINER_CLASS_SCIENTIST] = 12,
[TRAINER_CLASS_SWIMMER_MALE] = 4,
[TRAINER_CLASS_SWIMMER_FEMALE] = 4,
[TRAINER_CLASS_TUBER_MALE] = 1,
[TRAINER_CLASS_TUBER_FEMALE] = 1,
[TRAINER_CLASS_SAILOR] = 8,
[TRAINER_CLASS_SIS_AND_BRO] = 5,
[TRAINER_CLASS_RUIN_MANIAC] = 12,
[TRAINER_CLASS_PSYCHIC_MALE] = 8,
[TRAINER_CLASS_PSYCHIC_FEMALE] = 8,
[TRAINER_CLASS_PI] = 30,
[TRAINER_CLASS_GUITARIST] = 6,
[TRAINER_CLASS_ACE_TRAINER_SNOW_MALE] = 15,
[TRAINER_CLASS_ACE_TRAINER_SNOW_FEMALE] = 15,
[TRAINER_CLASS_SKIER_MALE] = 8,
[TRAINER_CLASS_SKIER_FEMALE] = 8,
[TRAINER_CLASS_ROUGHNECK] = 6,
[TRAINER_CLASS_CLOWN] = 6,
[TRAINER_CLASS_WORKER] = 10,
[TRAINER_CLASS_SCHOOL_KID_MALE] = 5,
[TRAINER_CLASS_SCHOOL_KID_FEMALE] = 5,
[TRAINER_CLASS_LEADER_ROARK] = 30,
[TRAINER_CLASS_RIVAL] = 25,
[TRAINER_CLASS_LEADER_BYRON] = 30,
[TRAINER_CLASS_ELITE_FOUR_AARON] = 30,
[TRAINER_CLASS_ELITE_FOUR_BERTHA] = 30,
[TRAINER_CLASS_ELITE_FOUR_FLINT] = 30,
[TRAINER_CLASS_ELITE_FOUR_LUCIAN] = 30,
[TRAINER_CLASS_CHAMPION_CYNTHIA] = 50,
[TRAINER_CLASS_BELLE_AND_PA] = 14,
[TRAINER_CLASS_RANCHER] = 10,
[TRAINER_CLASS_COMMANDER_MARS] = 20,
[TRAINER_CLASS_GALACTIC_GRUNT_MALE] = 10,
[TRAINER_CLASS_LEADER_GARDENIA] = 30,
[TRAINER_CLASS_LEADER_WAKE] = 30,
[TRAINER_CLASS_LEADER_MAYLENE] = 30,
[TRAINER_CLASS_LEADER_FANTINA] = 30,
[TRAINER_CLASS_LEADER_CANDICE] = 30,
[TRAINER_CLASS_LEADER_VOLKNER] = 30,
[TRAINER_CLASS_PARASOL_LADY] = 8,
[TRAINER_CLASS_WAITER] = 8,
[TRAINER_CLASS_INTERVIEWERS] = 18,
[TRAINER_CLASS_CAMERAMAN] = 8,
[TRAINER_CLASS_REPORTERS] = 10,
[TRAINER_CLASS_IDOL] = 18,
[TRAINER_CLASS_GALACTIC_BOSS] = 45,
[TRAINER_CLASS_COMMANDER_JUPITER] = 20,
[TRAINER_CLASS_COMMANDER_SATURN] = 20,
[TRAINER_CLASS_GALACTIC_GRUNT_FEMALE] = 10,
[TRAINER_CLASS_TRAINER_CHERYL] = 30,
[TRAINER_CLASS_TRAINER_RILEY] = 30,
[TRAINER_CLASS_TRAINER_MARLEY] = 30,
[TRAINER_CLASS_TRAINER_BUCK] = 30,
[TRAINER_CLASS_TRAINER_MIRA] = 30,
[TRAINER_CLASS_DP_PLAYER_MALE] = 25,
[TRAINER_CLASS_DP_PLAYER_FEMALE] = 25,
[TRAINER_CLASS_TOWER_TYCOON] = 0,
[TRAINER_CLASS_MAID] = 10,
[TRAINER_CLASS_HALL_MATRON] = 0,
[TRAINER_CLASS_FACTORY_HEAD] = 0,
[TRAINER_CLASS_ARCADE_STAR] = 0,
[TRAINER_CLASS_CASTLE_VALET] = 0,
[TRAINER_CLASS_DP_PLAYER_MALE_2] = 0,
[TRAINER_CLASS_DP_PLAYER_FEMALE_2] = 0,
};
25 changes: 23 additions & 2 deletions include/overlay016/ov16_0223DF00.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,18 @@ int BattleSystem_Partner(BattleSystem * param0, int param1);
* @return Battler who is an enemy and in the given slot on the enemy team.
*/
int BattleSystem_EnemyInSlot(BattleSystem *battleSys, int attacker, int slot);
BOOL ov16_0223E30C(BattleSystem * param0, int param1, int param2, int param3, int param4);

/**
* @brief Use an item from the bag on the given battler.
*
* @param battleSys
* @param battler The battler who is using the item
* @param partySlot The party slot the battler is targeting with the item
* @param moveSlot Optional parameter for PP-restoring items
* @param item The item being used
* @return TRUE if the item has an effect; FALSE otherwise
*/
BOOL BattleSystem_UseBagItem(BattleSystem *battleSys, int battler, int partySlot, int moveSlot, int item);
u32 BattleSystem_BattleStatus(BattleSystem * param0);

/**
Expand Down Expand Up @@ -248,7 +259,17 @@ void ov16_0223F858(BattleSystem * param0, u8 * param1);
void ov16_0223F87C(BattleSystem * param0, u8 * param1);
void ov16_0223F8AC(BattleSystem * param0, UnkStruct_02007C7C ** param1);
void BattleSystem_SetGaugePriority(BattleSystem * param0, int param1);
u32 ov16_0223F904(Party * param0, TrainerInfo * param1);

/**
* @brief Calculate the money penalty for losing a battle.
*
* @param party The player's party; used to scale the penalty with the
* highest-level member
* @param trainerInfo The player's state; used to scale the penalty with the
* number of badges obtained
* @return The total amount of money to be deducted from the player
*/
u32 BattleSystem_CalcMoneyPenalty(Party *party, TrainerInfo *trainerInfo);
void BattleSystem_DexFlagSeen(BattleSystem * param0, int param1);
void ov16_0223F9A0(BattleSystem * param0, int param1);

Expand Down
Loading

0 comments on commit e651833

Please sign in to comment.