Skip to content

Commit

Permalink
Merge pull request #125 from lhearachel/trainer_ai
Browse files Browse the repository at this point in the history
Document non-command routines for trainer AI
  • Loading branch information
lhearachel authored Jan 25, 2024
2 parents e90979f + edbdf71 commit fcfa720
Show file tree
Hide file tree
Showing 5 changed files with 1,421 additions and 972 deletions.
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

0 comments on commit fcfa720

Please sign in to comment.