Skip to content

Commit

Permalink
Merge pull request #128 from lhearachel/trainer_ai
Browse files Browse the repository at this point in the history
First pass at labelling AI script commands
  • Loading branch information
lhearachel authored Jan 27, 2024
2 parents 7e1574a + 9535a09 commit 8f8326c
Show file tree
Hide file tree
Showing 6 changed files with 1,507 additions and 1,672 deletions.
1 change: 1 addition & 0 deletions consts/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ consts_manifests = files(
'battle.json',
'global.json',
'narc_files.json',
'trainer_ai.json',
)

gen_consts_root = meson.current_build_dir() / 'generated'
Expand Down
52 changes: 52 additions & 0 deletions consts/trainer_ai.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"targets": {
"trainer_ai": [
"@LoadTypeTarget",
"@AIWeather",
"@CheckEffect",
"@CheckLevel"
]
},
"definitions": {
"@LoadTypeTarget": {
"type": "enum",
"values": [
"LOAD_DEFENDER_TYPE_1",
"LOAD_ATTACKER_TYPE_1",
"LOAD_DEFENDER_TYPE_2",
"LOAD_ATTACKER_TYPE_2",
"LOAD_MOVE_TYPE",
"LOAD_DEFENDER_PARTNER_TYPE_1",
"LOAD_ATTACKER_PARTNER_TYPE_1",
"LOAD_DEFENDER_PARTNER_TYPE_2",
"LOAD_ATTACKER_PARTNER_TYPE_2"
]
},
"@AIWeather": {
"type": "enum",
"values": [
"AI_WEATHER_CLEAR",
"AI_WEATHER_SUNNY",
"AI_WEATHER_RAINING",
"AI_WEATHER_SANDSTORM",
"AI_WEATHER_HAILING",
"AI_WEATHER_DEEP_FOG"
]
},
"@CheckEffect": {
"type": "enum",
"values": [
"CHECK_DISABLE",
"CHECK_ENCORE"
]
},
"@CheckLevel": {
"type": "enum",
"values": [
"CHECK_HIGHER_THAN_TARGET",
"CHECK_LOWER_THAN_TARGET",
"CHECK_EQUAL_TO_TARGET"
]
}
}
}
1 change: 1 addition & 0 deletions include/battle/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
#define WEATHER_IS_SAND (battleCtx->fieldConditionsMask & FIELD_CONDITION_SANDSTORM)
#define WEATHER_IS_SUN (battleCtx->fieldConditionsMask & FIELD_CONDITION_SUNNY)
#define WEATHER_IS_HAIL (battleCtx->fieldConditionsMask & FIELD_CONDITION_HAILING)
#define WEATHER_IS_FOG (battleCtx->fieldConditionsMask & FIELD_CONDITION_DEEP_FOG)

#define FLAG_NEGATE(flag) ((flag) ^ 0xFFFFFFFF)

Expand Down
1 change: 1 addition & 0 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ enum BattlerBootState {
#define TYPE_MULTI_QUARTER_DAMAGE 10
#define TYPE_MULTI_HALF_DAMAGE 20
#define TYPE_MULTI_BASE_DAMAGE 40
#define TYPE_MULTI_STAB_DAMAGE 60
#define TYPE_MULTI_DOUBLE_DAMAGE 80
#define TYPE_MULTI_QUADRUPLE_DAMAGE 160

Expand Down
17 changes: 17 additions & 0 deletions include/constants/battle/trainer_ai.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define POKEPLATINUM_CONSTANTS_BATTLE_TRAINER_AI_H

#ifndef __ASM_PM_
#include "consts/generated/c/trainer_ai.h"

enum AIActionChoice {
AI_ENEMY_ATTACK_1 = 0,
AI_ENEMY_ATTACK_2,
Expand All @@ -27,6 +29,8 @@ enum AIActionChoice {
#define AI_FLAG_WEATHER (1 << 9)
#define AI_FLAG_HARRASSMENT (1 << 10)
#define AI_FLAG_ROAMING_POKEMON (1 << 29)
#define AI_FLAG_SAFARI (1 << 30)
#define AI_FLAG_CATCH_TUTORIAL (1 << 31)

#define AI_INIT_SCORE_MOVE_1 (1 << 0)
#define AI_INIT_SCORE_MOVE_2 (1 << 1)
Expand Down Expand Up @@ -54,4 +58,17 @@ enum AIActionChoice {

#define AI_MAX_STACK_SIZE 8

#define AI_NO_COMPARISON_MADE 0
#define AI_NOT_HIGHEST_DAMAGE 1
#define AI_MOVE_IS_HIGHEST_DAMAGE 2

#define AI_NOT_HAVE 0
#define AI_HAVE 1
#define AI_UNKNOWN 2

// for the script only; readable flags for commands that accept a boolean
// flag determining if they roll for damage or not
#define USE_MAX_DAMAGE 0
#define ROLL_FOR_DAMAGE 1

#endif
Loading

0 comments on commit 8f8326c

Please sign in to comment.