summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/battle_ai_scripts.s1
-rw-r--r--data/battle_scripts_1.s1
-rw-r--r--data/btl_attrs.s1
-rw-r--r--data/event_scripts.s140
-rw-r--r--data/scripts/cable_club.inc4
-rw-r--r--data/scripts/trainer_battle.inc136
-rw-r--r--data/specials.inc14
7 files changed, 150 insertions, 147 deletions
diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s
index ab83f2bf8..9a2714a0e 100644
--- a/data/battle_ai_scripts.s
+++ b/data/battle_ai_scripts.s
@@ -3,6 +3,7 @@
#include "constants/hold_effects.h"
#include "constants/items.h"
#include "constants/moves.h"
+#include "constants/pokemon.h"
.include "include/macros.inc"
.include "constants/constants.inc"
.include "include/macros/battle_ai_script.inc"
diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s
index 00f0fd97b..a62b74fe5 100644
--- a/data/battle_scripts_1.s
+++ b/data/battle_scripts_1.s
@@ -2,6 +2,7 @@
#include "constants/battle.h"
#include "constants/moves.h"
#include "constants/songs.h"
+#include "constants/pokemon.h"
.include "include/macros.inc"
.include "include/macros/battle_script.inc"
.include "constants/constants.inc"
diff --git a/data/btl_attrs.s b/data/btl_attrs.s
index 06ab16430..3cee4e1c8 100644
--- a/data/btl_attrs.s
+++ b/data/btl_attrs.s
@@ -3,6 +3,7 @@
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/species.h"
+#include "constants/pokemon.h"
.include "include/macros.inc"
.include "constants/constants.inc"
diff --git a/data/event_scripts.s b/data/event_scripts.s
index 268d0f3f8..9e1b02e2d 100644
--- a/data/event_scripts.s
+++ b/data/event_scripts.s
@@ -15,6 +15,7 @@
#include "constants/metatile_labels.h"
#include "constants/battle_setup.h"
#include "constants/map_scripts.h"
+#include "constants/pokemon.h"
.include "include/macros.inc"
.include "include/macros/event.inc"
.include "constants/constants.inc"
@@ -710,144 +711,7 @@ UnknownString_819C21F: @ 819C21F
.include "data/maps/Route124_DivingTreasureHuntersHouse/text.inc"
.include "data/scripts/std_msgbox.inc"
-
-gUnknown_0819F80B:: @ 819F80B
- lock
- special PlayTrainerEncounterMusic
- special ScrSpecial_EndTrainerApproach
- waitstate
- goto EventScript_19F8F2
-
-gUnknown_0819F818:: @ 819F818
- lock
- faceplayer
- applymovement VAR_LAST_TALKED, Movement_19F8F0
- waitmovement 0
- specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought
- compare VAR_RESULT, 0
- goto_if_ne EventScript_19F83F
- special PlayTrainerEncounterMusic
- special sub_8082524
- goto EventScript_19F8F2
-
-EventScript_19F83F:
- gotopostbattlescript
-
-gUnknown_0819F840:: @ 819F840
- lock
- faceplayer
- call EventScript_19F8E5
- specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought
- compare VAR_RESULT, 0
- goto_if_ne EventScript_19F877
- special CheckForAlivePartyMons
- compare VAR_RESULT, 0
- goto_if_ne EventScript_19F870
- special PlayTrainerEncounterMusic
- special sub_8082524
- goto EventScript_19F8F2
-
-EventScript_19F870:
- special ScrSpecial_ShowTrainerNonBattlingSpeech
- waitmessage
- waitbuttonpress
- release
- end
-
-EventScript_19F877:
- gotopostbattlescript
-
-gUnknown_0819F878:: @ 819F878
- applymovement VAR_LAST_TALKED, Movement_19F8F0
- waitmovement 0
- special PlayTrainerEncounterMusic
- trainerbattlebegin
- gotopostbattlescript
-
-gUnknown_0819F887:: @ 819F887
- call EventScript_19F8E5
- specialvar VAR_RESULT, ScrSpecial_GetTrainerEyeRematchFlag
- compare VAR_RESULT, 0
- goto_if_eq EventScript_19F8AD
- special PlayTrainerEncounterMusic
- special sub_8082524
- special ScrSpecial_ShowTrainerIntroSpeech
- waitmessage
- waitbuttonpress
- special ScrSpecial_StartTrainerEyeRematch
- waitstate
- releaseall
- end
-
-EventScript_19F8AD:
- gotopostbattlescript
-
-gUnknown_0819F8AE:: @ 819F8AE
- specialvar VAR_RESULT, ScrSpecial_GetTrainerEyeRematchFlag
- compare VAR_RESULT, 0
- goto_if_eq EventScript_19F8DD
- special CheckForAlivePartyMons
- compare VAR_RESULT, 0
- goto_if_ne EventScript_19F8DE
- special PlayTrainerEncounterMusic
- special sub_8082524
- special ScrSpecial_ShowTrainerIntroSpeech
- waitmessage
- waitbuttonpress
- special ScrSpecial_StartTrainerEyeRematch
- waitstate
- releaseall
- end
-
-EventScript_19F8DD:
- gotopostbattlescript
-
-EventScript_19F8DE:
- special ScrSpecial_ShowTrainerNonBattlingSpeech
- waitmessage
- waitbuttonpress
- release
- end
-
-EventScript_19F8E5:
- applymovement VAR_LAST_TALKED, Movement_19F8F0
- waitmovement 0
- return
-
-Movement_19F8F0::
- reveal_trainer
- end_movement
-
-EventScript_19F8F2:
- special ScrSpecial_ShowTrainerIntroSpeech
- waitmessage
- waitbuttonpress
- trainerbattlebegin
- specialvar VAR_RESULT, ScrSpecial_GetTrainerBattleMode
- compare VAR_RESULT, 0
- goto_if_eq EventScript_19F934
- compare VAR_RESULT, 2
- goto_if_eq EventScript_19F936
- compare VAR_RESULT, 1
- goto_if_eq EventScript_19F936
- compare VAR_RESULT, 6
- goto_if_eq EventScript_19F936
- compare VAR_RESULT, 8
- goto_if_eq EventScript_19F936
-
-EventScript_19F934:
- releaseall
- end
-
-EventScript_19F936:
- gotobeatenscript
-
-Std_MsgboxAutoclose::
- message 0x0
- waitmessage
- waitbuttonpress
- release
- return
+ .include "data/scripts/trainer_battle.inc"
Event_ResetBerryTrees: @ 19F940
setberrytree 2, 7, 5
diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc
index 1da7d0dda..caf02fe7b 100644
--- a/data/scripts/cable_club.inc
+++ b/data/scripts/cable_club.inc
@@ -279,8 +279,8 @@ OldaleTown_PokemonCenter_2F_EventScript_1A403C:: @ 81A403C
return
OldaleTown_PokemonCenter_2F_EventScript_1A4042:: @ 81A4042
- special CheckForAlivePartyMons
- compare VAR_RESULT, 0
+ special HasEnoughMonsForDoubleBattle
+ compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS
goto_if_ne OldaleTown_PokemonCenter_2F_EventScript_1A4056
setvar VAR_0x8004, 2
return
diff --git a/data/scripts/trainer_battle.inc b/data/scripts/trainer_battle.inc
new file mode 100644
index 000000000..95dc54c88
--- /dev/null
+++ b/data/scripts/trainer_battle.inc
@@ -0,0 +1,136 @@
+EventScript_StartTrainerBattle:: @ 819F80B
+ lock
+ special PlayTrainerEncounterMusic
+ special EndTrainerApproach
+ waitstate
+ goto EventScript_DoTrainerBattle
+
+EventScript_TryDoNormalTrainerBattle:: @ 819F818
+ lock
+ faceplayer
+ applymovement VAR_LAST_TALKED, Movement_RevealTrainer
+ waitmovement 0
+ specialvar VAR_RESULT, GetTrainerFlag
+ compare VAR_RESULT, 0
+ goto_if_ne EventScript_NoNormalTrainerBattle
+ special PlayTrainerEncounterMusic
+ special SetUpTrainerMovement
+ goto EventScript_DoTrainerBattle
+
+EventScript_NoNormalTrainerBattle:
+ gotopostbattlescript
+
+EventScript_TryDoDoubleTrainerBattle:: @ 819F840
+ lock
+ faceplayer
+ call EventScript_RevealTrainer
+ specialvar VAR_RESULT, GetTrainerFlag
+ compare VAR_RESULT, 0
+ goto_if_ne EventScript_NoDoubleTrainerBattle
+ special HasEnoughMonsForDoubleBattle
+ compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS
+ goto_if_ne EventScript_NotEnoughMonsForDoubleBattle
+ special PlayTrainerEncounterMusic
+ special SetUpTrainerMovement
+ goto EventScript_DoTrainerBattle
+
+EventScript_NotEnoughMonsForDoubleBattle:
+ special ScrSpecial_ShowTrainerNonBattlingSpeech
+ waitmessage
+ waitbuttonpress
+ release
+ end
+
+EventScript_NoDoubleTrainerBattle:
+ gotopostbattlescript
+
+EventScript_DoNoIntroTrainerBattle:: @ 819F878
+ applymovement VAR_LAST_TALKED, Movement_RevealTrainer
+ waitmovement 0
+ special PlayTrainerEncounterMusic
+ trainerbattlebegin
+ gotopostbattlescript
+
+EventScript_TryDoRematchBattle:: @ 819F887
+ call EventScript_RevealTrainer
+ specialvar VAR_RESULT, IsTrainerReadyForRematch
+ compare VAR_RESULT, FALSE
+ goto_if_eq EventScript_NoRematchTrainerBattle
+ special PlayTrainerEncounterMusic
+ special SetUpTrainerMovement
+ special ShowTrainerIntroSpeech
+ waitmessage
+ waitbuttonpress
+ special BattleSetup_StartRematchBattle
+ waitstate
+ releaseall
+ end
+
+EventScript_NoRematchTrainerBattle:
+ gotopostbattlescript
+
+EventScript_TryDoDoubleRematchBattle:: @ 819F8AE
+ specialvar VAR_RESULT, IsTrainerReadyForRematch
+ compare VAR_RESULT, FALSE
+ goto_if_eq EventScript_NoDoubleRematchTrainerBattle
+ special HasEnoughMonsForDoubleBattle
+ compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS
+ goto_if_ne EventScript_NotEnoughMonsForDoubleRematchBattle
+ special PlayTrainerEncounterMusic
+ special SetUpTrainerMovement
+ special ShowTrainerIntroSpeech
+ waitmessage
+ waitbuttonpress
+ special BattleSetup_StartRematchBattle
+ waitstate
+ releaseall
+ end
+
+EventScript_NoDoubleRematchTrainerBattle:
+ gotopostbattlescript
+
+EventScript_NotEnoughMonsForDoubleRematchBattle:
+ special ScrSpecial_ShowTrainerNonBattlingSpeech
+ waitmessage
+ waitbuttonpress
+ release
+ end
+
+EventScript_RevealTrainer:
+ applymovement VAR_LAST_TALKED, Movement_RevealTrainer
+ waitmovement 0
+ return
+
+Movement_RevealTrainer::
+ reveal_trainer
+ end_movement
+
+EventScript_DoTrainerBattle:
+ special ShowTrainerIntroSpeech
+ waitmessage
+ waitbuttonpress
+ trainerbattlebegin
+ specialvar VAR_RESULT, ScrSpecial_GetTrainerBattleMode
+ compare VAR_RESULT, TRAINER_BATTLE_SINGLE
+ goto_if_eq EventScript_EndTrainerBattle
+ compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT
+ goto_if_eq EventScript_GoToBeatenScript
+ compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC
+ goto_if_eq EventScript_GoToBeatenScript
+ compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE
+ goto_if_eq EventScript_GoToBeatenScript
+ compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC
+ goto_if_eq EventScript_GoToBeatenScript
+EventScript_EndTrainerBattle:
+ releaseall
+ end
+
+EventScript_GoToBeatenScript:
+ gotobeatenscript
+
+Std_MsgboxAutoclose::
+ message 0x0
+ waitmessage
+ waitbuttonpress
+ release
+ return
diff --git a/data/specials.inc b/data/specials.inc
index 6988d90c4..07187eb47 100644
--- a/data/specials.inc
+++ b/data/specials.inc
@@ -60,16 +60,16 @@ gSpecials::
def_special PlayerHasBerries
def_special IsEnigmaBerryValid
def_special ScrSpecial_GetTrainerBattleMode
- def_special ScrSpecial_ShowTrainerIntroSpeech
+ def_special ShowTrainerIntroSpeech
def_special ScrSpecial_ShowTrainerNonBattlingSpeech
- def_special ScrSpecial_HasTrainerBeenFought
- def_special ScrSpecial_EndTrainerApproach
+ def_special GetTrainerFlag
+ def_special EndTrainerApproach
def_special PlayTrainerEncounterMusic
def_special ShouldTryRematchBattle
- def_special ScrSpecial_GetTrainerEyeRematchFlag
- def_special ScrSpecial_StartTrainerEyeRematch
+ def_special IsTrainerReadyForRematch
+ def_special BattleSetup_StartRematchBattle
def_special ShowPokemonStorageSystem
- def_special CheckForAlivePartyMons
+ def_special HasEnoughMonsForDoubleBattle
def_special TurnOffTVScreen
def_special DoTVShow
def_special DoPokeNews
@@ -322,7 +322,7 @@ gSpecials::
def_special ScrSpecial_StartGroudonKyogreBattle
def_special ScrSpecial_StartRayquazaBattle
def_special ScrSpecial_StartRegiBattle
- def_special sub_8082524
+ def_special SetUpTrainerMovement
def_special DoSealedChamberShakingEffect2
def_special FoundBlackGlasses
def_special sub_807E25C