Clearer Battle Tower code

This commit is contained in:
Remy Oukaour 2018-01-09 16:55:11 -05:00
parent 11556196ba
commit ce50d1b2cb
4 changed files with 93 additions and 86 deletions

View File

@ -42,10 +42,10 @@
const BATTLETOWER_RECEIVED_REWARD
BATTLETOWER_NROFPKMNS EQU 3
BATTLETOWER_TRAINERDATALENGTH EQU $24
BATTLETOWER_NROFTRAINERS EQU 7
BATTLETOWER_NRMONSPERLEVELBRACKET EQU BATTLETOWER_NROFPKMNS * BATTLETOWER_NROFTRAINERS
BATTLE_TOWER_STRUCT_LENGTH EQU $e0 ; NAME_LENGTH + 3 * (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
BATTLETOWER_TRAINERDATALENGTH EQU $24
BATTLE_TOWER_STRUCT_LENGTH EQU $e0 ; NAME_LENGTH + BATTLETOWER_NROFPKMNS * (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
; return value from BattleTowerAction(BATTLETOWERACTION_CHECKMOBILEEVENT)
MOBILE_EVENT_OBJECT_GS_BALL EQU $b

View File

@ -0,0 +1,82 @@
BattleTowerTrainers: ; 1f814e
; The trainer class is not used in Crystal 1.0 due to a bug.
; Instead, the sixth character in the trainer's name is used.
; See BattleTowerText in engine/events/battle_tower/trainer_text.asm.
db "HANSON@@@@", FISHER
db "SAWYER@@@@", POKEMANIAC
db "MASUDA@@@@", GUITARIST
db "NICKEL@@@@", SCIENTIST
db "OLSON@@@@@", POKEFANM
db "ZABOROWSKI", LASS
db "WRIGHT@@@@", YOUNGSTER
db "ALEXANDER@", HIKER
db "KAWAKAMI@@", TEACHER
db "BICKETT@@@", POKEFANM
db "SAITO@@@@@", KIMONO_GIRL
db "CRAWFORD@@", BOARDER
db "DIAZ@@@@@@", PICNICKER
db "ERICKSON@@", BIKER
db "FAIRFIELD@", JUGGLER
db "HUNTER@@@@", POKEFANF
db "HILL@@@@@@", FIREBREATHER
db "JAVIER@@@@", SWIMMERF
db "KAUFMAN@@@", SWIMMERM
db "LANCASTER@", SKIER
db "McMAHILL@@", CAMPER
if !DEF(CRYSTAL11)
BattleTowerTrainersEnd:
endc
; The following can only be sampled in Crystal 1.1.
db "OBRIEN@@@@", GENTLEMAN
db "FROST@@@@@", BEAUTY
db "MORSE@@@@@", SUPER_NERD
db "YUFUNE@@@@", BLACKBELT_T
db "RAJAN@@@@@", COOLTRAINERF
db "RODRIGUEZ@", OFFICER
db "SANTIAGO@@", PSYCHIC_T
db "STOCK@@@@@", POKEFANM
db "THURMAN@@@", SCIENTIST
db "VALENTINO@", BEAUTY
db "WAGNER@@@@", CAMPER
db "YATES@@@@@", BIRD_KEEPER
db "ANDREWS@@@", PICNICKER
db "BAHN@@@@@@", POKEMANIAC
db "MORI@@@@@@", SCIENTIST
db "BUCKMAN@@@", SAGE
db "COBB@@@@@@", SCHOOLBOY
db "HUGHES@@@@", FISHER
db "ARITA@@@@@", KIMONO_GIRL
db "EASTON@@@@", PSYCHIC_T
db "FREEMAN@@@", CAMPER
db "GIESE@@@@@", LASS
db "HATCHER@@@", GENTLEMAN
db "JACKSON@@@", POKEFANF
db "KAHN@@@@@@", POKEMANIAC
db "LEONG@@@@@", YOUNGSTER
db "MARINO@@@@", TEACHER
db "NEWMAN@@@@", SAILOR
db "NGUYEN@@@@", BLACKBELT_T
db "OGDEN@@@@@", SUPER_NERD
db "PARK@@@@@@", COOLTRAINERF
db "RAINE@@@@@", SWIMMERM
db "SELLS@@@@@", BIRD_KEEPER
db "ROCKWELL@@", BOARDER
db "THORNTON@@", LASS
db "TURNER@@@@", OFFICER
db "VAN DYKE@@", SKIER
db "WALKER@@@@", SCHOOLBOY
db "MEYER@@@@@", SWIMMERF
db "JOHNSON@@@", YOUNGSTER
db "ADAMS@@@@@", GUITARIST
db "SMITH@@@@@", BUG_CATCHER
db "TAJIRI@@@@", BUG_CATCHER
db "BAKER@@@@@", POKEMANIAC
db "COLLINS@@@", SCIENTIST
db "SMART@@@@@", SUPER_NERD
db "DYKSTRA@@@", SWIMMERF
db "EATON@@@@@", BIKER
db "WONG@@@@@@", FIREBREATHER
if DEF(CRYSTAL11)
BattleTowerTrainersEnd:
endc
; 1f8450

View File

@ -1,83 +1,7 @@
BattleTowerTrainers: ; 1f814e
; The trainer class is not used in Crystal 1.0 due to a bug.
; Instead, the sixth character in the trainer's name is used.
; See mobile/battle_tower_47.asm
db "HANSON@@@@", FISHER
db "SAWYER@@@@", POKEMANIAC
db "MASUDA@@@@", GUITARIST
db "NICKEL@@@@", SCIENTIST
db "OLSON@@@@@", POKEFANM
db "ZABOROWSKI", LASS
db "WRIGHT@@@@", YOUNGSTER
db "ALEXANDER@", HIKER
db "KAWAKAMI@@", TEACHER
db "BICKETT@@@", POKEFANM
db "SAITO@@@@@", KIMONO_GIRL
db "CRAWFORD@@", BOARDER
db "DIAZ@@@@@@", PICNICKER
db "ERICKSON@@", BIKER
db "FAIRFIELD@", JUGGLER
db "HUNTER@@@@", POKEFANF
db "HILL@@@@@@", FIREBREATHER
db "JAVIER@@@@", SWIMMERF
db "KAUFMAN@@@", SWIMMERM
db "LANCASTER@", SKIER
db "McMAHILL@@", CAMPER
; The following can only be sampled in Crystal 1.1.
db "OBRIEN@@@@", GENTLEMAN
db "FROST@@@@@", BEAUTY
db "MORSE@@@@@", SUPER_NERD
db "YUFUNE@@@@", BLACKBELT_T
db "RAJAN@@@@@", COOLTRAINERF
db "RODRIGUEZ@", OFFICER
db "SANTIAGO@@", PSYCHIC_T
db "STOCK@@@@@", POKEFANM
db "THURMAN@@@", SCIENTIST
db "VALENTINO@", BEAUTY
db "WAGNER@@@@", CAMPER
db "YATES@@@@@", BIRD_KEEPER
db "ANDREWS@@@", PICNICKER
db "BAHN@@@@@@", POKEMANIAC
db "MORI@@@@@@", SCIENTIST
db "BUCKMAN@@@", SAGE
db "COBB@@@@@@", SCHOOLBOY
db "HUGHES@@@@", FISHER
db "ARITA@@@@@", KIMONO_GIRL
db "EASTON@@@@", PSYCHIC_T
db "FREEMAN@@@", CAMPER
db "GIESE@@@@@", LASS
db "HATCHER@@@", GENTLEMAN
db "JACKSON@@@", POKEFANF
db "KAHN@@@@@@", POKEMANIAC
db "LEONG@@@@@", YOUNGSTER
db "MARINO@@@@", TEACHER
db "NEWMAN@@@@", SAILOR
db "NGUYEN@@@@", BLACKBELT_T
db "OGDEN@@@@@", SUPER_NERD
db "PARK@@@@@@", COOLTRAINERF
db "RAINE@@@@@", SWIMMERM
db "SELLS@@@@@", BIRD_KEEPER
db "ROCKWELL@@", BOARDER
db "THORNTON@@", LASS
db "TURNER@@@@", OFFICER
db "VAN DYKE@@", SKIER
db "WALKER@@@@", SCHOOLBOY
db "MEYER@@@@@", SWIMMERF
db "JOHNSON@@@", YOUNGSTER
db "ADAMS@@@@@", GUITARIST
db "SMITH@@@@@", BUG_CATCHER
db "TAJIRI@@@@", BUG_CATCHER
db "BAKER@@@@@", POKEMANIAC
db "COLLINS@@@", SCIENTIST
db "SMART@@@@@", SUPER_NERD
db "DYKSTRA@@@", SWIMMERF
db "EATON@@@@@", BIKER
db "WONG@@@@@@", FIREBREATHER
; 1f8450
BattleTowerMons: ; 1f8450
; 10 groups of 21 mons.
BattleTowerMons1:
db JOLTEON

View File

@ -27,12 +27,11 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000
add b
ld b, a ; b contains the nr of the trainer
if DEF(CRYSTAL11)
and (1 << 7) - 1
cp 70
and $7f
else
and (1 << 5) - 1
cp 21
and $1f
endc
cp (BattleTowerTrainersEnd - BattleTowerTrainers) / NAME_LENGTH
jr nc, .resample
ld b, a
@ -114,7 +113,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
add b
ld b, a
and $1f
cp BATTLETOWER_NRMONSPERLEVELBRACKET
cp BATTLETOWER_NROFPKMNS * BATTLETOWER_NROFTRAINERS
jr nc, .resample
; in register 'a' is the chosen Pkmn of the LevelGroup
@ -207,4 +206,6 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
ret
; 1f814e
INCLUDE "data/battle_tower/classes.asm"
INCLUDE "data/battle_tower/parties.asm"