Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document non-command routines for trainer AI #125

Merged
merged 6 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/battle/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#define BATTLER_US 0
#define BATTLER_THEM 1

#define BATTLER_OPP(battler) (battler ^ 1)

#define CALC_SELF_HIT(move, power) (BattleSystem_CalcMoveDamage(\
battleSys,\
battleCtx,\
Expand Down
29 changes: 20 additions & 9 deletions include/constants/battle/trainer_ai.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#ifndef POKEPLATINUM_CONSTANTS_BATTLE_TRAINER_AI_H
#define POKEPLATINUM_CONSTANTS_BATTLE_TRAINER_AI_H

#ifndef __ASM_PM_
enum AIActionChoice {
AI_ENEMY_ATTACK_1 = 0,
AI_ENEMY_ATTACK_2,
AI_ENEMY_ATTACK_3,
AI_ENEMY_ATTACK_4,
AI_ENEMY_ESCAPE,
AI_ENEMY_SAFARI,
AI_ENEMY_SWITCH,
};

#define AI_CONTEXT (battleCtx->aiContext)
#endif

#define AI_FLAG_BASIC (1 << 0)
#define AI_FLAG_EVAL_ATTACK (1 << 1)
#define AI_FLAG_EXPERT (1 << 2)
Expand Down Expand Up @@ -33,14 +47,11 @@
#define AI_STATUS_FLAG_BREAK_OFF (AI_STATUS_FLAG_BREAK ^ 0xFF)
#define AI_STATUS_FLAG_CONTINUE_OFF (AI_STATUS_FLAG_CONTINUE ^ 0xFF)

enum {
AI_ENEMY_ATTACK_1 = 0,
AI_ENEMY_ATTACK_2,
AI_ENEMY_ATTACK_3,
AI_ENEMY_ATTACK_4,
AI_ENEMY_ESCAPE,
AI_ENEMY_SAFARI,
AI_ENEMY_SWITCH,
};
#define AI_BATTLER_DEFENDER 0
#define AI_BATTLER_ATTACKER 1
#define AI_BATTLER_DEFENDER_PARTNER (AI_BATTLER_DEFENDER ^ 2)
#define AI_BATTLER_ATTACKER_PARTNER (AI_BATTLER_ATTACKER ^ 2)

#define AI_MAX_STACK_SIZE 8

#endif
8 changes: 8 additions & 0 deletions include/data/battle/weight_to_power.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
static const u16 sWeightToPower[][2] = {
{ 100, 20 },
{ 250, 40 },
{ 500, 60 },
{ 1000, 80 },
{ 2000, 100 },
{ 0xFFFF, 0xFFFF },
};
Loading
Loading