Consolidated Frontier teams into battle_frontier_trainers.h (#5892)
This commit is contained in:
parent
a2ad5d2ca3
commit
3be1d1d91e
44
migration_scripts/1.11/convert_battle_frontier_trainers.py
Normal file
44
migration_scripts/1.11/convert_battle_frontier_trainers.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import glob
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
|
if not os.path.exists("Makefile"):
|
||||||
|
print("Please run this script from your root folder.")
|
||||||
|
quit()
|
||||||
|
|
||||||
|
# Read battle_frontier_trainer_mons.h and extract the party information
|
||||||
|
for file in glob.glob('./src/data/battle_frontier/battle_frontier_trainer_mons.h'):
|
||||||
|
with open(file, 'r') as f:
|
||||||
|
source_content = f.read()
|
||||||
|
|
||||||
|
# Extract party info from battle_frontier_trainer_mons.h
|
||||||
|
source_pattern = re.compile(r'gBattleFrontierTrainerMons_(.*)\[\]\s*=\s*\n\{\n\s*(FRONTIER.*)')
|
||||||
|
source_data = {}
|
||||||
|
for match in source_pattern.findall(source_content):
|
||||||
|
if len(match) == 2:
|
||||||
|
trainer_name, party_group = match
|
||||||
|
source_data[trainer_name] = (party_group)
|
||||||
|
|
||||||
|
# Read battle_frontier_trainers.h content
|
||||||
|
for file in glob.glob('./src/data/battle_frontier/battle_frontier_trainers.h'):
|
||||||
|
with open(file, 'r') as f:
|
||||||
|
destination_content = f.read()
|
||||||
|
|
||||||
|
# Modify battle_frontier_trainers.h content
|
||||||
|
def add_party_data(match):
|
||||||
|
trainer_name = match.group(1)
|
||||||
|
if trainer_name in source_data:
|
||||||
|
party_group = source_data[trainer_name]
|
||||||
|
print(f"Updating {trainer_name}: adding {party_group}")
|
||||||
|
return f'(const u16[]){{{party_group}}}'
|
||||||
|
else:
|
||||||
|
return match.group(0)
|
||||||
|
|
||||||
|
destination_pattern = re.compile(r'gBattleFrontierTrainerMons_(.*)')
|
||||||
|
modified_content = destination_pattern.sub(add_party_data, destination_content)
|
||||||
|
|
||||||
|
# Write the modified content back to battle_frontier_trainers.h
|
||||||
|
for file in glob.glob('./src/data/battle_frontier/battle_frontier_trainers.h'):
|
||||||
|
with open(file, 'w') as f:
|
||||||
|
f.write(modified_content)
|
||||||
|
print("battle_frontier_trainers.h has been updated")
|
||||||
@ -19,7 +19,7 @@ python3 migration_scripts/*.py ; #run the migration script
|
|||||||
|
|
||||||
## 1.10.x to 1.11.x+
|
## 1.10.x to 1.11.x+
|
||||||
|
|
||||||
### Battle Frontier Trainers
|
### Contest Opponents
|
||||||
|
|
||||||
* Filepath [`migration_scripts/1.11/consolidate_contest_opponent_filters.py`](1.11/consolidate_contest_opponent_filters.py)
|
* Filepath [`migration_scripts/1.11/consolidate_contest_opponent_filters.py`](1.11/consolidate_contest_opponent_filters.py)
|
||||||
* Introduced in [Consolidated contest opponent filters into gContestOpponents #6119](https://github.com/rh-hideout/pokeemerald-expansion/pull/6119)
|
* Introduced in [Consolidated contest opponent filters into gContestOpponents #6119](https://github.com/rh-hideout/pokeemerald-expansion/pull/6119)
|
||||||
@ -38,6 +38,27 @@ const struct ContestPokemon gContestOpponents[] =
|
|||||||
- [CONTEST_OPPONENT_JIMMY] = CONTEST_FILTER_NONE,
|
- [CONTEST_OPPONENT_JIMMY] = CONTEST_FILTER_NONE,
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Battle Frontier Trainers
|
||||||
|
|
||||||
|
* Filepath [`migration_scripts/1.11/convert_battle_frontier_trainers.py`](1.11/convert_battle_frontier_trainers.py)
|
||||||
|
* Introduced in [Consolidated Frontier teams into battle_frontier_trainers.h #5892](https://github.com/rh-hideout/pokeemerald-expansion/pull/5892)
|
||||||
|
|
||||||
|
Moves the Battle Frontier trainer parties from battle_frontier_trainer_mons.h to battle_frontier_trainers.h
|
||||||
|
|
||||||
|
#### [src/data/battle_frontier/battle_frontier_trainer_mons.h](../src/data/battle_frontier/battle_frontier_trainer_mons.h)
|
||||||
|
```diff
|
||||||
|
- const u16 gBattleFrontierTrainerMons_Brady[] =
|
||||||
|
- {
|
||||||
|
- FRONTIER_MONS_YOUNGSTER_LASS_1
|
||||||
|
- };
|
||||||
|
```
|
||||||
|
|
||||||
|
#### [src/data/battle_frontier/battle_frontier_trainers.h](../src/data/battle_frontier/battle_frontier_trainers.h)
|
||||||
|
```diff
|
||||||
|
- .monSet = gBattleFrontierTrainerMons_Brady
|
||||||
|
+ .monSet = (const u16[]){FRONTIER_MONS_YOUNGSTER_LASS_1}
|
||||||
|
```
|
||||||
|
|
||||||
## 1.8.x to 1.9.x+
|
## 1.8.x to 1.9.x+
|
||||||
|
|
||||||
### Battle Anim Moves
|
### Battle Anim Moves
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user