engine/battle/trainer_ai.asm

This commit is contained in:
luckytyphlosion 2015-12-06 16:08:20 -05:00
parent c3911c80cf
commit 6ddc025942
27 changed files with 342 additions and 342 deletions

View File

@ -1,10 +1,9 @@
; yellow has its own format.
; entry trainerclass, trainerid, moveset+, 0
; moveset ≔ partymon, partymon'smove, moveid
; entry = trainerclass, trainerid, moveset+, 0
; moveset = partymon location, partymon's move, moveid
LoneMoves:
TeamMoves:
SpecialTrainerMoves: ; 39c6b (e:5c6b)
db BUG_CATCHER,$f
db 2,2,TACKLE
db 2,3,STRING_SHOT

View File

@ -1,14 +1,51 @@
TrainerDataPointers: ; 39d3b (e:5d3b)
dw YoungsterData,BugCatcherData,LassData,SailorData,JrTrainerMData
dw JrTrainerFData,PokemaniacData,SuperNerdData,HikerData,BikerData
dw BurglarData,EngineerData,Juggler1Data,FisherData,SwimmerData
dw CueBallData,GamblerData,BeautyData,PsychicData,RockerData
dw JugglerData,TamerData,BirdKeeperData,BlackbeltData,Green1Data
dw ProfOakData,ChiefData,ScientistData,GiovanniData,RocketData
dw CooltrainerMData,CooltrainerFData,BrunoData,BrockData,MistyData
dw LtSurgeData,ErikaData,KogaData,BlaineData,SabrinaData
dw GentlemanData,Green2Data,Green3Data,LoreleiData,ChannelerData
dw AgathaData,LanceData
TrainerDataPointers: ; 39dd1 (e:5dd1)
dw YoungsterData
dw BugCatcherData
dw LassData
dw SailorData
dw JrTrainerMData
dw JrTrainerFData
dw PokemaniacData
dw SuperNerdData
dw HikerData
dw BikerData
dw BurglarData
dw EngineerData
dw Juggler1Data
dw FisherData
dw SwimmerData
dw CueBallData
dw GamblerData
dw BeautyData
dw PsychicData
dw RockerData
dw JugglerData
dw TamerData
dw BirdKeeperData
dw BlackbeltData
dw Green1Data
dw ProfOakData
dw ChiefData
dw ScientistData
dw GiovanniData
dw RocketData
dw CooltrainerMData
dw CooltrainerFData
dw BrunoData
dw BrockData
dw MistyData
dw LtSurgeData
dw ErikaData
dw KogaData
dw BlaineData
dw SabrinaData
dw GentlemanData
dw Green2Data
dw Green3Data
dw LoreleiData
dw ChannelerData
dw AgathaData
dw LanceData
; if first byte != FF, then
; first byte is level (of all pokemon on this team)
@ -19,7 +56,7 @@ TrainerDataPointers: ; 39d3b (e:5d3b)
; every next two bytes are a level and species
; null-terminated
YoungsterData: ; 39d99 (e:5d99)
YoungsterData:
db 11,RATTATA,EKANS,0
db 14,SPEAROW,0
db 10,RATTATA,RATTATA,ZUBAT,0
@ -34,7 +71,7 @@ YoungsterData: ; 39d99 (e:5d99)
db 18,NIDORAN_M,NIDORINO,0
db 17,SPEAROW,RATTATA,RATTATA,SPEAROW,0
db 24,SANDSHREW,0
BugCatcherData: ; 39dce (e:5dce)
BugCatcherData:
db 7,CATERPIE,CATERPIE,0
db 6,METAPOD,CATERPIE,METAPOD,0
db 10,CATERPIE,0
@ -50,7 +87,7 @@ BugCatcherData: ; 39dce (e:5dce)
db 19,BEEDRILL,BEEDRILL,0
db 20,CATERPIE,WEEDLE,VENONAT,0
db 8,CATERPIE,METAPOD,0
LassData: ; 39e0c (e:5e0c)
LassData:
db 9,PIDGEY,PIDGEY,0
db 10,RATTATA,NIDORAN_M,0
db 14,JIGGLYPUFF,0
@ -70,7 +107,7 @@ LassData: ; 39e0c (e:5e0c)
db 23,BELLSPROUT,WEEPINBELL,0
db 23,ODDISH,GLOOM,0
db 6,NIDORAN_F,NIDORAN_M,0
SailorData: ; 39e58 (e:5e58)
SailorData:
db 18,MACHOP,SHELLDER,0
db 17,MACHOP,TENTACOOL,0
db 21,SHELLDER,0
@ -79,7 +116,7 @@ SailorData: ; 39e58 (e:5e58)
db 17,HORSEA,HORSEA,HORSEA,0
db 20,MACHOP,0
db 24,MAGNEMITE,0
JrTrainerMData: ; 39e78 (e:5e78)
JrTrainerMData:
db 9,DIGLETT,SANDSHREW,0
db 14,RATTATA,EKANS,0
db 18,MANKEY,0
@ -90,7 +127,7 @@ JrTrainerMData: ; 39e78 (e:5e78)
db 19,RATTATA,DIGLETT,EKANS,SANDSHREW,0
db 29,NIDORAN_M,NIDORINO,0
db 16,WEEPINBELL,0
JrTrainerFData: ; 39e9d (e:5e9d)
JrTrainerFData:
db 19,GOLDEEN,0
db 16,ODDISH,BELLSPROUT,0
db 16,PIDGEY,PIDGEY,PIDGEY,0
@ -116,7 +153,7 @@ JrTrainerFData: ; 39e9d (e:5e9d)
db 29,BELLSPROUT,ODDISH,TANGELA,0
db 30,TENTACOOL,HORSEA,SEEL,0
db 20,CUBONE,0
PokemaniacData: ; 39f09 (e:5f09)
PokemaniacData:
db 30,RHYHORN,LICKITUNG,0
db 20,CUBONE,SLOWPOKE,0
db 20,SLOWPOKE,SLOWPOKE,SLOWPOKE,0
@ -124,7 +161,7 @@ PokemaniacData: ; 39f09 (e:5f09)
db 25,SLOWPOKE,0
db 40,CHARMELEON,LAPRAS,LICKITUNG,0
db 23,CUBONE,SLOWPOKE,0
SuperNerdData: ; 39f26 (e:5f26)
SuperNerdData:
db 11,MAGNEMITE,VOLTORB,0
db 12,GRIMER,VOLTORB,KOFFING,0
db 20,VOLTORB,KOFFING,VOLTORB,MAGNEMITE,0
@ -137,7 +174,7 @@ SuperNerdData: ; 39f26 (e:5f26)
db 34,PONYTA,CHARMANDER,VULPIX,GROWLITHE,0
db 41,RAPIDASH,0
db 37,GROWLITHE,VULPIX,0
HikerData: ; 39f5e (e:5f5e)
HikerData:
db 10,GEODUDE,GEODUDE,ONIX,0
db 15,MACHOP,GEODUDE,0
db 13,GEODUDE,GEODUDE,MACHOP,GEODUDE,0
@ -152,7 +189,7 @@ HikerData: ; 39f5e (e:5f5e)
db 19,GEODUDE,MACHOP,GEODUDE,GEODUDE,0
db 20,ONIX,ONIX,GEODUDE,0
db 21,GEODUDE,GRAVELER,0
BikerData: ; 39f9c (e:5f9c)
BikerData:
db 28,KOFFING,KOFFING,KOFFING,0
db 29,KOFFING,GRIMER,0
db 25,KOFFING,KOFFING,WEEZING,KOFFING,GRIMER,0
@ -168,7 +205,7 @@ BikerData: ; 39f9c (e:5f9c)
db 26,KOFFING,KOFFING,GRIMER,KOFFING,0
db 28,GRIMER,GRIMER,KOFFING,0
db 29,KOFFING,MUK,0
BurglarData: ; 39fe4 (e:5fe4)
BurglarData:
db 29,GROWLITHE,VULPIX,0
db 33,GROWLITHE,0
db 28,VULPIX,CHARMANDER,PONYTA,0
@ -178,13 +215,13 @@ BurglarData: ; 39fe4 (e:5fe4)
db 34,CHARMANDER,CHARMELEON,0
db 38,NINETALES,0
db 34,GROWLITHE,PONYTA,0
EngineerData: ; 3a007 (e:6007)
EngineerData:
db 21,VOLTORB,MAGNEMITE,0
db 21,MAGNEMITE,0
db 18,MAGNEMITE,MAGNEMITE,MAGNETON,0
Juggler1Data: ; 3a013 (e:6013)
Juggler1Data:
; none
FisherData: ; 3a013 (e:6013)
FisherData:
db 17,GOLDEEN,TENTACOOL,GOLDEEN,0
db 17,TENTACOOL,STARYU,SHELLDER,0
db 22,GOLDEEN,POLIWAG,GOLDEEN,0
@ -196,7 +233,7 @@ FisherData: ; 3a013 (e:6013)
db 27,MAGIKARP,MAGIKARP,MAGIKARP,MAGIKARP,MAGIKARP,MAGIKARP,0
db 33,SEAKING,GOLDEEN,0
db 24,MAGIKARP,MAGIKARP,0
SwimmerData: ; 3a049 (e:6049)
SwimmerData:
db 16,HORSEA,SHELLDER,0
db 30,TENTACOOL,SHELLDER,0
db 29,GOLDEEN,HORSEA,STARYU,0
@ -212,7 +249,7 @@ SwimmerData: ; 3a049 (e:6049)
db 37,STARMIE,0
db 33,STARYU,WARTORTLE,0
db 32,POLIWHIRL,TENTACOOL,SEADRA,0
CueBallData: ; 3a08d (e:608d)
CueBallData:
db 28,MACHOP,MANKEY,MACHOP,0
db 29,MANKEY,MACHOP,0
db 33,MACHOP,0
@ -222,7 +259,7 @@ CueBallData: ; 3a08d (e:608d)
db 26,MANKEY,MANKEY,MACHOKE,MACHOP,0
db 29,PRIMEAPE,MACHOKE,0
db 31,TENTACOOL,TENTACOOL,TENTACRUEL,0
GamblerData: ; 3a0b3 (e:60b3)
GamblerData:
db 18,POLIWAG,HORSEA,0
db 18,BELLSPROUT,ODDISH,0
db 18,VOLTORB,MAGNEMITE,0
@ -230,7 +267,7 @@ GamblerData: ; 3a0b3 (e:60b3)
db 22,POLIWAG,POLIWAG,POLIWHIRL,0
db 22,ONIX,GEODUDE,GRAVELER,0
db 24,GROWLITHE,VULPIX,0
BeautyData: ; 3a0d1 (e:60d1)
BeautyData:
db 21,ODDISH,BELLSPROUT,ODDISH,BELLSPROUT,0
db 24,BELLSPROUT,BELLSPROUT,0
db 26,EXEGGCUTE,0
@ -246,15 +283,15 @@ BeautyData: ; 3a0d1 (e:60d1)
db 30,GOLDEEN,SEAKING,0
db 29,STARYU,STARYU,STARYU,0
db 30,SEADRA,HORSEA,SEADRA,0
PsychicData: ; 3a115 (e:6115)
PsychicData:
db 31,KADABRA,SLOWPOKE,MR_MIME,KADABRA,0
db 34,MR_MIME,KADABRA,0
db 33,SLOWPOKE,SLOWPOKE,SLOWBRO,0
db 38,SLOWBRO,0
RockerData: ; 3a127 (e:6127)
RockerData:
db 20,VOLTORB,VOLTORB,VOLTORB,0
db 29,VOLTORB,ELECTRODE,0
JugglerData: ; 3a130 (e:6130)
JugglerData:
db 29,KADABRA,MR_MIME,0
db 41,DROWZEE,HYPNO,KADABRA,KADABRA,0
db 31,DROWZEE,DROWZEE,KADABRA,DROWZEE,0
@ -263,14 +300,14 @@ JugglerData: ; 3a130 (e:6130)
db 33,HYPNO,0
db 38,HYPNO,0
db 34,DROWZEE,KADABRA,0
TamerData: ; 3a151 (e:6151)
TamerData:
db 34,SANDSLASH,ARBOK,0
db 33,ARBOK,SANDSLASH,ARBOK,0
db 43,RHYHORN,0
db 39,ARBOK,TAUROS,0
db 44,PERSIAN,GOLDUCK,0
db 42,RHYHORN,PRIMEAPE,ARBOK,TAUROS,0
BirdKeeperData: ; 3a16b (e:616b)
BirdKeeperData:
db 29,PIDGEY,PIDGEOTTO,0
db 25,SPEAROW,PIDGEY,PIDGEY,SPEAROW,SPEAROW,0
db 26,PIDGEY,PIDGEOTTO,SPEAROW,FEAROW,0
@ -288,7 +325,7 @@ BirdKeeperData: ; 3a16b (e:616b)
db 26,PIDGEY,SPEAROW,PIDGEY,FEAROW,0
db 29,PIDGEOTTO,FEAROW,0
db 28,SPEAROW,DODUO,FEAROW,0
BlackbeltData: ; 3a1be (e:61be)
BlackbeltData:
db 37,HITMONLEE,HITMONCHAN,0
db 31,MANKEY,MANKEY,PRIMEAPE,0
db 32,MACHOP,MACHOKE,0
@ -298,17 +335,17 @@ BlackbeltData: ; 3a1be (e:61be)
db 43,MACHOKE,0
db 38,MACHOKE,MACHOP,MACHOKE,0
db 43,MACHOKE,MACHOP,MACHOKE,0
Green1Data: ; 3a1e4 (e:61e4)
Green1Data:
db 5,EEVEE,0
db $FF,9,SPEAROW,8,EEVEE,0
db $FF,18,SPEAROW,15,SANDSHREW,15,RATTATA,17,EEVEE,0
ProfOakData: ; 3a21d (e:621d)
ProfOakData:
db $FF,66,TAUROS,67,EXEGGUTOR,68,ARCANINE,69,BLASTOISE,70,GYARADOS,0
db $FF,66,TAUROS,67,EXEGGUTOR,68,ARCANINE,69,VENUSAUR,70,GYARADOS,0
db $FF,66,TAUROS,67,EXEGGUTOR,68,ARCANINE,69,CHARIZARD,70,GYARADOS,0
ChiefData: ; 3a241 (e:6241)
ChiefData:
; none
ScientistData: ; 3a241 (e:6241)
ScientistData:
db 34,KOFFING,VOLTORB,0
db 26,GRIMER,WEEZING,KOFFING,WEEZING,0
db 28,MAGNEMITE,VOLTORB,MAGNETON,0
@ -322,11 +359,11 @@ ScientistData: ; 3a241 (e:6241)
db 29,MAGNEMITE,KOFFING,0
db 33,MAGNEMITE,MAGNETON,VOLTORB,0
db 34,MAGNEMITE,ELECTRODE,0
GiovanniData: ; 3a27e (e:627e)
GiovanniData:
db $FF,25,ONIX,24,RHYHORN,29,PERSIAN,0
db $FF,37,NIDORINO,35,PERSIAN,37,RHYHORN,41,NIDOQUEEN,0
db $FF,50,DUGTRIO,53,PERSIAN,53,NIDOQUEEN,55,NIDOKING,55,RHYDON,0
RocketData: ; 3a29c (e:629c)
RocketData:
db 13,RATTATA,ZUBAT,0
db 11,SANDSHREW,RATTATA,ZUBAT,0
db 12,ZUBAT,EKANS,0
@ -377,7 +414,7 @@ JessieJamesData:
db 27,KOFFING,0
db 29,WEEZING,0
db 33,WEEZING,0
CooltrainerMData: ; 3a35a (e:635a)
CooltrainerMData:
db 39,NIDORINO,NIDOKING,0
db 43,EXEGGUTOR,CLOYSTER,ARCANINE,0
db 43,KINGLER,TENTACRUEL,BLASTOISE,0
@ -388,7 +425,7 @@ CooltrainerMData: ; 3a35a (e:635a)
db 44,KINGLER,CLOYSTER,0
db 39,SANDSLASH,DUGTRIO,0
db 43,RHYHORN,0
CooltrainerFData: ; 3a385 (e:6385)
CooltrainerFData:
db 24,WEEPINBELL,GLOOM,IVYSAUR,0
db 43,BELLSPROUT,WEEPINBELL,VICTREEBEL,0
db 43,PARASECT,DEWGONG,CHANSEY,0
@ -397,29 +434,29 @@ CooltrainerFData: ; 3a385 (e:6385)
db 45,IVYSAUR,VENUSAUR,0
db 45,NIDORINA,NIDOQUEEN,0
db 43,PERSIAN,NINETALES,RAICHU,0
BrunoData: ; 3a3a9 (e:63a9)
BrunoData:
db $FF,53,ONIX,55,HITMONCHAN,55,HITMONLEE,56,ONIX,58,MACHAMP,0
BrockData: ; 3a3b5 (e:63b5)
BrockData:
db $FF,10,GEODUDE,12,ONIX,0
MistyData: ; 3a3bb (e:63bb)
MistyData:
db $FF,18,STARYU,21,STARMIE,0
LtSurgeData: ; 3a3c1 (e:63c1)
LtSurgeData:
db $FF,28,RAICHU,0
ErikaData: ; 3a3c9 (e:63c9)
ErikaData:
db $FF,30,TANGELA,32,WEEPINBELL,32,GLOOM,0
KogaData: ; 3a3d1 (e:63d1)
KogaData:
db $FF,44,VENONAT,46,VENONAT,48,VENONAT,50,VENOMOTH,0
BlaineData: ; 3a3db (e:63db)
BlaineData:
db $FF,48,NINETALES,50,RAPIDASH,54,ARCANINE,0
SabrinaData: ; 3a3e5 (e:63e5)
SabrinaData:
db $FF,50,ABRA,50,KADABRA,50,ALAKAZAM,0
GentlemanData: ; 3a3ef (e:63ef)
GentlemanData:
db 18,GROWLITHE,GROWLITHE,0
db 19,NIDORAN_M,NIDORAN_F,0
db 22,VOLTORB,MAGNEMITE,0
db 48,PRIMEAPE,0
db 17,GROWLITHE,PONYTA,0
Green2Data: ; 3a401 (e:6401)
Green2Data:
db $FF,19,SPEAROW,16,RATTATA,18,SANDSHREW,20,EEVEE,0
db $FF,25,FEAROW,23,SHELLDER,22,VULPIX,20,SANDSHREW,25,EEVEE,0
db $FF,25,FEAROW,23,MAGNEMITE,22,SHELLDER,20,SANDSHREW,25,EEVEE,0
@ -430,13 +467,13 @@ Green2Data: ; 3a401 (e:6401)
db $FF,47,SANDSLASH,45,EXEGGCUTE,45,NINETALES,47,CLOYSTER,50,KADABRA,53,JOLTEON,0
db $FF,47,SANDSLASH,45,EXEGGCUTE,45,CLOYSTER,47,MAGNETON,50,KADABRA,53,FLAREON,0
db $FF,47,SANDSLASH,45,EXEGGCUTE,45,MAGNETON,47,NINETALES,50,KADABRA,53,VAPOREON,0
Green3Data: ; 3a491 (e:6491)
Green3Data:
db $FF,61,SANDSLASH,59,ALAKAZAM,61,EXEGGUTOR,61,CLOYSTER,63,NINETALES,65,JOLTEON,0
db $FF,61,SANDSLASH,59,ALAKAZAM,61,EXEGGUTOR,61,MAGNETON,63,CLOYSTER,65,FLAREON,0
db $FF,61,SANDSLASH,59,ALAKAZAM,61,EXEGGUTOR,61,NINETALES,63,MAGNETON,65,VAPOREON,0
LoreleiData: ; 3a4bb (e:64bb)
LoreleiData:
db $FF,54,DEWGONG,53,CLOYSTER,54,SLOWBRO,56,JYNX,56,LAPRAS,0
ChannelerData: ; 3a4c7 (e:64c7)
ChannelerData:
db 22,GASTLY,0
db 24,GASTLY,0
db 23,GASTLY,GASTLY,0
@ -461,7 +498,7 @@ ChannelerData: ; 3a4c7 (e:64c7)
db 34,GASTLY,HAUNTER,0
db 38,HAUNTER,0
db 33,GASTLY,GASTLY,HAUNTER,0
AgathaData: ; 3a516 (e:6516)
AgathaData:
db $FF,56,GENGAR,56,GOLBAT,55,HAUNTER,58,ARBOK,60,GENGAR,0
LanceData: ; 3a522 (e:6522)
LanceData:
db $FF,58,GYARADOS,56,DRAGONAIR,56,DRAGONAIR,60,AERODACTYL,62,DRAGONITE,0

View File

@ -32,7 +32,7 @@ asm_f601d: ; f601d (f:601d)
ld a, [wEnemyMonSpecies2]
sub $c8
jp c, InitWildBattle
ld [W_TRAINERCLASS], a
ld [wTrainerClass], a
call GetTrainerInformation
callab ReadTrainer
callab DoBattleTransitionAndInitBattleVariables
@ -100,7 +100,7 @@ InitWildBattle: ; f607c (3d:607c)
call LoadMonFrontSprite ; load mon sprite
.spriteLoaded
xor a
ld [W_TRAINERCLASS], a
ld [wTrainerClass], a
ld [$ffe1], a
coord hl, 12, 0
predef CopyUncompressedPicToTilemap

View File

@ -1,5 +1,5 @@
; formats a string at wMovesString that lists the moves at wMoves
FormatMovesString: ; 39b87 (e:5b87)
FormatMovesString: ; 39b06 (e:5b06)
ld hl, wMoves
ld de, wMovesString
ld b, $0
@ -52,7 +52,7 @@ FormatMovesString: ; 39b87 (e:5b87)
ret
; XXX this is called in a few places, but it doesn't appear to do anything useful
InitList: ; 39bd5 (e:5bd5)
InitList: ; 39b53 (e:5b53)
ld a, [wInitListType]
cp INIT_ENEMYOT_LIST
jr nz, .notEnemy
@ -100,23 +100,4 @@ InitList: ; 39bd5 (e:5bd5)
ld [wItemPrices], a
ld a, b
ld [wItemPrices + 1], a
ret
; get species of mon e in list [wMonDataLocation] for LoadMonData
GetMonSpecies: ; 39c37 (e:5c37)
ld hl, wPartySpecies
ld a, [wMonDataLocation]
and a
jr z, .getSpecies
dec a
jr z, .enemyParty
ld hl, wBoxSpecies
jr .getSpecies
.enemyParty
ld hl, wEnemyPartyMons
.getSpecies
ld d, 0
add hl, de
ld a, [hl]
ld [wcf91], a
ret
ret

View File

@ -851,7 +851,7 @@ FaintEnemyPokemon: ; 0x3c567
ld [hli], a
ld [hli], a
ld [hl], a
ld [W_ENEMYDISABLEDMOVE], a
ld [wEnemyDisabledMove], a
ld [wEnemyDisabledMoveNumber], a
ld [wEnemyMonMinimized], a
ld hl, wPlayerUsedMove
@ -994,7 +994,7 @@ ReplaceFaintedEnemyMon: ; 3c664 (f:4664)
.notLinkBattle
call EnemySendOut
xor a
ld [W_ENEMYMOVENUM], a
ld [wEnemyMoveNum], a
ld [wActionResultOrTookBattleTurn], a
ld [wAILayer2Encouragement], a
inc a ; reset Z flag
@ -1008,7 +1008,7 @@ TrainerBattleVictory: ; 3c696 (f:4696)
jr nz, .gymleader
ld b, MUSIC_DEFEATED_TRAINER
.gymleader
ld a, [W_TRAINERCLASS]
ld a, [wTrainerClass]
cp SONY3 ; final battle against rival
jr nz, .notrival
ld b, MUSIC_DEFEATED_GYM_LEADER
@ -1384,7 +1384,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
ld [hli],a
ld [hli],a
ld [hl],a
ld [W_ENEMYDISABLEDMOVE],a
ld [wEnemyDisabledMove],a
ld [wEnemyDisabledMoveNumber],a
ld [wEnemyMonMinimized],a
ld hl,wPlayerUsedMove
@ -3034,7 +3034,7 @@ SelectEnemyMove: ; 3d564 (f:5564)
ld a, [hld]
and a
jr nz, .atLeastTwoMovesAvailable
ld a, [W_ENEMYDISABLEDMOVE]
ld a, [wEnemyDisabledMove]
and a
ld a, STRUGGLE ; struggle if the only move is disabled
jr nz, .done
@ -3063,7 +3063,7 @@ SelectEnemyMove: ; 3d564 (f:5564)
ld a, b
dec a
ld [wEnemyMoveListIndex], a
ld a, [W_ENEMYDISABLEDMOVE]
ld a, [wEnemyDisabledMove]
swap a
and $f
cp b
@ -3786,7 +3786,7 @@ MonName1Text: ; 3dafb (f:5afb)
ld a, [W_PLAYERMOVENUM]
ld hl, wPlayerUsedMove
jr z, .asm_3db11
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
ld hl, wEnemyUsedMove
.asm_3db11
ld [hl], a
@ -3921,7 +3921,7 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2)
ld a, [H_WHOSETURN]
and a
jr z, .playersTurn
ld de, W_ENEMYMOVEEFFECT
ld de, wEnemyMoveEffect
.playersTurn
ld hl, DoesntAffectMonText
ld a, [wDamageMultipliers]
@ -4351,7 +4351,7 @@ GetDamageVarsForEnemyAttack: ; 3de75 (f:5e75)
ld d, a ; d = move power
and a
ret z ; return if move power is zero
ld a, [hl] ; a = [W_ENEMYMOVETYPE]
ld a, [hl] ; a = [wEnemyMoveType]
cp FIRE ; types >= FIRE are all special
jr nc, .specialAttack
.physicalAttack
@ -4508,7 +4508,7 @@ CalculateDamage: ; 3df65 (f:5f65)
and a
ld a, [W_PLAYERMOVEEFFECT]
jr z, .effect
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
.effect
; EXPLODE_EFFECT halves defense.
@ -4938,7 +4938,7 @@ ApplyAttackToEnemyPokemonDone: ; 3e19d (f:619d)
jp DrawHUDsAndHPBars
ApplyAttackToPlayerPokemon: ; 3e1a0 (f:61a0)
ld a,[W_ENEMYMOVEEFFECT]
ld a,[wEnemyMoveEffect]
cp a,OHKO_EFFECT
jr z,ApplyDamageToPlayerPokemon
cp a,SUPER_FANG_EFFECT
@ -4971,7 +4971,7 @@ ApplyAttackToPlayerPokemon: ; 3e1a0 (f:61a0)
ld hl,wEnemyMonLevel
ld a,[hl]
ld b,a
ld a,[W_ENEMYMOVENUM]
ld a,[wEnemyMoveNum]
cp a,SEISMIC_TOSS
jr z,.storeDamage
cp a,NIGHT_SHADE
@ -5104,7 +5104,7 @@ AttackSubstitute: ; 3e25e (f:625e)
ld hl,W_PLAYERMOVEEFFECT ; value for player's turn
and a
jr z,.nullifyEffect
ld hl,W_ENEMYMOVEEFFECT ; value for enemy's turn
ld hl,wEnemyMoveEffect ; value for enemy's turn
.nullifyEffect
xor a
ld [hl],a ; zero the effect of the attacker's move
@ -5123,7 +5123,7 @@ HandleBuildingRage: ; 3e2b6 (f:62b6)
; values for the player turn
ld hl,wEnemyBattleStatus2
ld de,wEnemyMonStatMods
ld bc,W_ENEMYMOVENUM
ld bc,wEnemyMoveNum
ld a,[H_WHOSETURN]
and a
jr z,.next
@ -5183,7 +5183,7 @@ MirrorMoveCopyMove: ; 3e2fd (f:62fd)
jr z,.next
; values for enemy turn
ld a,[wPlayerUsedMove]
ld de,W_ENEMYMOVENUM
ld de,wEnemyMoveNum
ld hl,wEnemySelectedMove
.next
ld [hl],a
@ -5231,7 +5231,7 @@ MetronomePickMove: ; 3e348 (f:6348)
and a
jr z,.pickMoveLoop
; values for enemy turn
ld de,W_ENEMYMOVENUM
ld de,wEnemyMoveNum
ld hl,wEnemySelectedMove
; loop to pick a random number in the range [1, $a5) to be the move used by Metronome
.pickMoveLoop
@ -5304,7 +5304,7 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5)
ld a,[hli]
ld d,a ; d = type 1 of defender
ld e,[hl] ; e = type 2 of defender
ld a,[W_ENEMYMOVETYPE]
ld a,[wEnemyMoveType]
ld [wMoveType],a
.next
ld a,[wMoveType]
@ -5400,7 +5400,7 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5)
; ($05 is not very effective, $10 is neutral, $14 is super effective)
; as far is can tell, this is only used once in some AI code to help decide which move to use
AIGetTypeEffectiveness: ; 3e449 (f:6449)
ld a,[W_ENEMYMOVETYPE]
ld a,[wEnemyMoveType]
ld d,a ; d = type of enemy move
ld hl,wBattleMonType
ld b,[hl] ; b = type 1 of player's pokemon
@ -5444,7 +5444,7 @@ MoveHitTest: ; 3e56b (f:656b)
jr z,.dreamEaterCheck
; enemy's turn
ld hl,wPlayerBattleStatus1
ld de,W_ENEMYMOVEEFFECT
ld de,wEnemyMoveEffect
ld bc,wBattleMonStatus
.dreamEaterCheck
ld a,[de]
@ -5499,7 +5499,7 @@ MoveHitTest: ; 3e56b (f:656b)
ret nz ; if so, always hit regardless of accuracy/evasion
jr .calcHitChance
.enemyTurn
ld a,[W_ENEMYMOVEEFFECT]
ld a,[wEnemyMoveEffect]
cp a,ATTACK_DOWN1_EFFECT
jr c,.skipPlayerMistCheck
cp a,HAZE_EFFECT + 1
@ -5696,7 +5696,7 @@ ExecuteEnemyMove: ; 3e6bc (f:66bc)
call GetCurrentMove
CheckIfEnemyNeedsToChargeUp: ; 3e6fc (f:66fc)
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp CHARGE_EFFECT
jp z, JumpMoveEffect
cp FLY_EFFECT
@ -5706,7 +5706,7 @@ EnemyCanExecuteChargingMove: ; 3e70b (f:670b)
ld hl, wEnemyBattleStatus1
res ChargingUp, [hl] ; no longer charging up for attack
res Invulnerable, [hl] ; no longer invulnerable to typical attacks
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
ld [wd0b5], a
ld a, BANK(MoveNames)
ld [wPredefBank], a
@ -5719,19 +5719,19 @@ EnemyCanExecuteMove: ; 3e72b (f:672b)
xor a
ld [wMonIsDisobedient], a
call PrintMonName1Text
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
ld hl, ResidualEffects1
ld de, $1
call IsInArray
jp c, JumpMoveEffect
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
ld hl, SpecialEffectsCont
ld de, $1
call IsInArray
call c, JumpMoveEffect
EnemyCalcMoveDamage: ; 3e750 (f:6750)
call SwapPlayerAndEnemyLevels
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
ld hl, SetDamageEffects
ld de, $1
call IsInArray
@ -5753,7 +5753,7 @@ handleIfEnemyMoveMissed: ; 3e782 (f:6782)
ld a, [wMoveMissed]
and a
jr z, .asm_3e791
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp EXPLODE_EFFECT
jr z, asm_3e7a0
jr EnemyCheckIfFlyOrChargeEffect
@ -5761,7 +5761,7 @@ handleIfEnemyMoveMissed: ; 3e782 (f:6782)
call SwapPlayerAndEnemyLevels
GetEnemyAnimationType: ; 3e794 (f:6794)
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
and a
ld a, $1
jr z, playEnemyMoveAnimation
@ -5779,7 +5779,7 @@ playEnemyMoveAnimation: ; 3e7a4 (f:67a4)
call nz, Bankswitch
pop af
ld [wAnimationType], a
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
call PlayMoveAnimation
call HandleExplodingAnimation
call DrawEnemyHUDAndHPBar
@ -5794,7 +5794,7 @@ EnemyCheckIfFlyOrChargeEffect: ; 3e7d1 (f:67d1)
call SwapPlayerAndEnemyLevels
ld c, 30
call DelayFrames
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp FLY_EFFECT
jr z, .playAnim
cp CHARGE_EFFECT
@ -5806,7 +5806,7 @@ EnemyCheckIfFlyOrChargeEffect: ; 3e7d1 (f:67d1)
ld a,STATUS_AFFECTED_ANIM
call PlayMoveAnimation
EnemyCheckIfMirrorMoveEffect: ; 3e7ef (f:67ef)
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp MIRROR_MOVE_EFFECT
jr nz, .notMirrorMoveEffect
call MirrorMoveCopyMove
@ -5818,7 +5818,7 @@ EnemyCheckIfMirrorMoveEffect: ; 3e7ef (f:67ef)
call MetronomePickMove
jp CheckIfEnemyNeedsToChargeUp
.notMetronomeEffect
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
ld hl, ResidualEffects2
ld de, $1
call IsInArray
@ -5827,7 +5827,7 @@ EnemyCheckIfMirrorMoveEffect: ; 3e7ef (f:67ef)
and a
jr z, .asm_3e82b
call PrintMoveFailureText
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp EXPLODE_EFFECT
jr z, .asm_3e83e
jp ExecuteEnemyMoveDone
@ -5838,7 +5838,7 @@ EnemyCheckIfMirrorMoveEffect: ; 3e7ef (f:67ef)
ld a, 1
ld [wMoveDidntMiss], a
.asm_3e83e
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
ld hl, AlwaysHappenSideEffects
ld de, $1
call IsInArray
@ -5863,7 +5863,7 @@ EnemyCheckIfMirrorMoveEffect: ; 3e7ef (f:67ef)
xor a
ld [wEnemyNumHits], a
.asm_3e873
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
and a
jr z, ExecuteEnemyMoveDone
ld hl, SpecialEffects
@ -5942,7 +5942,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld hl, ExecuteEnemyMoveDone ; enemy can't move this turn
jp .enemyReturnToHL
.checkIfAnyMoveDisabled
ld hl, W_ENEMYDISABLEDMOVE
ld hl, wEnemyDisabledMove
ld a, [hl]
and a
jr z, .checkIfConfused
@ -5991,7 +5991,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld [hli], a
ld a, [wEnemyMonDefense + 1]
ld [hl], a
ld hl, W_ENEMYMOVEEFFECT
ld hl, wEnemyMoveEffect
push hl
ld a, [hl]
push af
@ -6047,7 +6047,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
; clear bide, thrashing about, charging up, and multi-turn moves such as warp
and $ff ^ ((1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << ChargingUp) | (1 << UsingTrappingMove))
ld [hl], a
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp FLY_EFFECT
jr z, .flyOrChargeEffect
cp CHARGE_EFFECT
@ -6066,7 +6066,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
bit StoringEnergy, [hl] ; is mon using bide?
jr z, .checkIfThrashingAbout
xor a
ld [W_ENEMYMOVENUM], a
ld [wEnemyMoveNum], a
ld hl, wDamage
ld a, [hli]
ld b, a
@ -6107,7 +6107,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld [hli], a
ld [hl], a
ld a, BIDE
ld [W_ENEMYMOVENUM], a
ld [wEnemyMoveNum], a
call SwapPlayerAndEnemyLevels
ld hl, handleIfEnemyMoveMissed ; skip damage calculation, DecrementPP and MoveHitTest
jp .enemyReturnToHL
@ -6115,7 +6115,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
bit ThrashingAbout, [hl] ; is mon using thrash or petal dance?
jr z, .checkIfUsingMultiturnMove
ld a, THRASH
ld [W_ENEMYMOVENUM], a
ld [wEnemyMoveNum], a
ld hl, ThrashingAboutText
call PrintText
ld hl, wEnemyNumAttacksLeft
@ -6153,7 +6153,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
call GetMoveName
call CopyStringToCF4B
xor a
ld [W_ENEMYMOVEEFFECT], a
ld [wEnemyMoveEffect], a
ld hl, EnemyCanExecuteMove
jp .enemyReturnToHL
.enemyReturnToHL
@ -6168,7 +6168,7 @@ GetCurrentMove: ; 3eabe (f:6abe)
ld a, [H_WHOSETURN]
and a
jp z, .player
ld de, W_ENEMYMOVENUM
ld de, wEnemyMoveNum
ld a, [wEnemySelectedMove]
jr .selected
.player
@ -6805,7 +6805,7 @@ HandleExplodingAnimation: ; 3eed3 (f:6ed3)
jr z, .asm_3eeea
ld hl, wBattleMonType1
ld de, wEnemyBattleStatus1
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
.asm_3eeea
cp SELFDESTRUCT
jr z, .asm_3eef1
@ -6849,7 +6849,7 @@ _JumpMoveEffect: ; 3f138 (f:7138)
and a
ld a, [W_PLAYERMOVEEFFECT]
jr z, .next1
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
.next1
dec a ; subtract 1, there is no special effect for 00
add a ; x2, 16bit pointers
@ -7009,7 +7009,7 @@ PoisonEffect: ; 3f24f (f:724f)
and a
jr z, .poisonEffect
ld hl, wBattleMonStatus
ld de, W_ENEMYMOVEEFFECT
ld de, wEnemyMoveEffect
.poisonEffect
call CheckTargetSubstitute
jr nz, .noEffect ; can't posion a substitute target
@ -7181,7 +7181,7 @@ opponentAttacker: ; 3f382 (f:7382)
ld a, [wBattleMonStatus] ; mostly same as above with addresses swapped for opponent
and a
jp nz, CheckDefrost
ld a, [W_ENEMYMOVETYPE]
ld a, [wEnemyMoveType]
ld b, a
ld a, [wBattleMonType1]
cp b
@ -7189,7 +7189,7 @@ opponentAttacker: ; 3f382 (f:7382)
ld a, [wBattleMonType2]
cp b
ret z
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp a, PARALYZE_SIDE_EFFECT1 + 1
ld b, $1a
jr c, .next1
@ -7252,7 +7252,7 @@ CheckDefrost: ; 3f3e2 (f:73e2)
ld hl, FireDefrostedText
jr .common
.opponent
ld a, [W_ENEMYMOVETYPE] ; same as above with addresses swapped
ld a, [wEnemyMoveType] ; same as above with addresses swapped
sub a, FIRE
ret nz
ld [wBattleMonStatus], a
@ -7277,7 +7277,7 @@ StatModifierUpEffect: ; 3f428 (f:7428)
and a
jr z, .statModifierUpEffect
ld hl, wEnemyMonStatMods
ld de, W_ENEMYMOVEEFFECT
ld de, wEnemyMoveEffect
.statModifierUpEffect
ld a, [de]
sub ATTACK_UP1_EFFECT
@ -7386,7 +7386,7 @@ UpdateStatDone: ; 3f4ca (f:74ca)
and a
jr z, .asm_3f4e6
ld hl, wEnemyBattleStatus2
ld de, W_ENEMYMOVENUM
ld de, wEnemyMoveNum
ld bc, wEnemyMonMinimized
.asm_3f4e6
ld a, [de]
@ -7442,7 +7442,7 @@ MonsStatsRoseText: ; 3f528 (f:7528)
and a
ld a, [W_PLAYERMOVEEFFECT]
jr z, .asm_3f53b
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
.asm_3f53b
cp ATTACK_DOWN1_EFFECT
ret nc
@ -7465,7 +7465,7 @@ StatModifierDownEffect: ; 3f54c (f:754c)
and a
jr z, .statModifierDownEffect
ld hl, wPlayerMonStatMods
ld de, W_ENEMYMOVEEFFECT
ld de, wEnemyMoveEffect
ld bc, wPlayerBattleStatus1
ld a, [wLinkState]
cp LINK_STATE_BATTLING
@ -7644,7 +7644,7 @@ MonsStatsFellText: ; 3f661 (f:7661)
and a
ld a, [W_PLAYERMOVEEFFECT]
jr z, .asm_3f674
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
.asm_3f674
cp $1a
ret c
@ -7718,7 +7718,7 @@ BideEffect: ; 3f6e5 (f:76e5)
inc de
ld [de], a
ld [W_PLAYERMOVEEFFECT], a
ld [W_ENEMYMOVEEFFECT], a
ld [wEnemyMoveEffect], a
call BattleRandom
and $1
inc a
@ -7814,7 +7814,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
jr nc, .asm_3f7c1
ld c, 50
call DelayFrames
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
cp TELEPORT
jp nz, PrintDidntAffectText
jp PrintButItFailedText_
@ -7824,13 +7824,13 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
ld [wAnimationType], a
inc a
ld [wEscapedFromBattle], a
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
jr .asm_3f7e4
.asm_3f7d1
ld c, 50
call DelayFrames
ld hl, IsUnaffectedText
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
cp TELEPORT
jp nz, PrintText
jp ConditionalPrintButItFailed
@ -7880,7 +7880,7 @@ TwoToFiveAttacksEffect: ; 3f811 (f:7811)
ld a, [H_WHOSETURN]
and a
jr z, .setNumberOfHits
ld hl, W_ENEMYMOVEEFFECT
ld hl, wEnemyMoveEffect
.setNumberOfHits
ld a, [hl]
cp TWINEEDLE_EFFECT
@ -7916,7 +7916,7 @@ FlinchSideEffect: ; 3f85b (f:785b)
and a
jr z, .flinchSideEffect
ld hl, wPlayerBattleStatus1
ld de, W_ENEMYMOVEEFFECT
ld de, wEnemyMoveEffect
.flinchSideEffect
ld a, [de]
cp FLINCH_SIDE_EFFECT1
@ -7942,7 +7942,7 @@ ChargeEffect: ; 3f88c (f:788c)
ld b, XSTATITEM_ANIM
jr z, .chargeEffect
ld hl, wEnemyBattleStatus1
ld de, W_ENEMYMOVEEFFECT
ld de, wEnemyMoveEffect
ld b, ANIM_AF
.chargeEffect
set ChargingUp, [hl]
@ -8073,7 +8073,7 @@ ConfusionSideEffectSuccess: ; 3f96f (f:796f)
jr z, .confuseTarget
ld hl, wPlayerBattleStatus1
ld bc, W_PLAYERCONFUSEDCOUNTER
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
.confuseTarget
bit Confused, [hl] ; is mon confused?
jr nz, ConfusionEffectFailed
@ -8227,7 +8227,7 @@ DisableEffect: ; 3fa8a (f:7a8a)
ld a, [wMoveMissed]
and a
jr nz, .moveMissed
ld de, W_ENEMYDISABLEDMOVE
ld de, wEnemyDisabledMove
ld hl, wEnemyMonMoves
ld a, [H_WHOSETURN]
and a
@ -8286,7 +8286,7 @@ DisableEffect: ; 3fa8a (f:7a8a)
inc a ; 1-8 turns disabled
inc c ; move 1-4 will be disabled
swap c
add c ; map disabled move to high nibble of W_ENEMYDISABLEDMOVE / W_PLAYERDISABLEDMOVE
add c ; map disabled move to high nibble of wEnemyDisabledMove / W_PLAYERDISABLEDMOVE
ld [de], a
call PlayCurrentMoveAnimation2
ld hl, wPlayerDisabledMoveNumber
@ -8391,7 +8391,7 @@ PlayCurrentMoveAnimation2: ; 3fb89 (f:7b89)
and a
ld a, [W_PLAYERMOVENUM]
jr z, .notEnemyTurn
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
.notEnemyTurn
and a
ret z
@ -8417,7 +8417,7 @@ PlayCurrentMoveAnimation: ; 3fba8 (f:7ba8)
and a
ld a, [W_PLAYERMOVENUM]
jr z, .notEnemyTurn
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
.notEnemyTurn
and a
ret z

View File

@ -4,7 +4,7 @@ GetTrainerName_: ; f67a5 (3d:67a5)
and a
jr nz, .foundName
ld hl, wRivalName
ld a, [W_TRAINERCLASS]
ld a, [wTrainerClass]
cp SONY1
jr z, .foundName
cp SONY2

View File

@ -87,7 +87,7 @@ DrainHPEffect_: ; 76e7 (1:76e7)
and a
ld a, [W_PLAYERMOVEEFFECT]
jr z, .next3
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
.next3
cp DREAM_EATER_EFFECT
jr nz, .printText

View File

@ -32,7 +32,7 @@ HazeEffect_: ; 139a4 (4:79a4)
.cureVolatileStatuses
xor a
ld [W_PLAYERDISABLEDMOVE], a
ld [W_ENEMYDISABLEDMOVE], a
ld [wEnemyDisabledMove], a
ld hl, wPlayerDisabledMoveNumber
ld [hli], a
ld [hl], a

View File

@ -7,7 +7,7 @@ HealEffect_: ; f62ba (3d:62ba)
jr z, .healEffect
ld de, wEnemyMonHP
ld hl, wEnemyMonMaxHP
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
.healEffect
ld b, a
ld a, [de]

View File

@ -5,7 +5,7 @@ ParalyzeEffect_: ; f6562 (3d:6562)
and a
jp z, .next
ld hl, wBattleMonStatus
ld de, W_ENEMYMOVETYPE
ld de, wEnemyMoveType
.next
ld a, [hl]
and a ; does the target already have a status ailment?

View File

@ -4,7 +4,7 @@ RecoilEffect_: ; 138f6 (4:78f6)
ld a, [W_PLAYERMOVENUM]
ld hl, wBattleMonMaxHP
jr z, .recoilEffect
ld a, [W_ENEMYMOVENUM]
ld a, [wEnemyMoveNum]
ld hl, wEnemyMonMaxHP
.recoilEffect
ld d, a

View File

@ -5,7 +5,7 @@ ReflectLightScreenEffect_: ; f645d (3d:645d)
and a
jr z, .reflectLightScreenEffect
ld hl, wEnemyBattleStatus3
ld de, W_ENEMYMOVEEFFECT
ld de, wEnemyMoveEffect
.reflectLightScreenEffect
ld a, [de]
cp LIGHT_SCREEN_EFFECT

View File

@ -1,4 +1,4 @@
ReadTrainer: ; 39c53 (e:5c53)
ReadTrainer: ; 39bb6 (e:5bb6)
; don't change any moves in a link battle
ld a,[wLinkState]
@ -15,9 +15,9 @@ ReadTrainer: ; 39c53 (e:5c53)
ld [hl],a
; get the pointer to trainer data for this class
ld a,[wCurOpponent]
sub $C9 ; convert value from pokemon to trainer
add a,a
ld a,[wTrainerClass] ; get trainer class
dec a
add a
ld hl,TrainerDataPointers
ld c,a
ld b,0
@ -25,7 +25,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld a,[hli]
ld h,[hl]
ld l,a
ld a,[W_TRAINERNO]
ld a,[wTrainerNo]
ld b,a
; At this point b contains the trainer number,
; and hl points to the trainer class.
@ -53,7 +53,7 @@ ReadTrainer: ; 39c53 (e:5c53)
.LoopTrainerData
ld a,[hli]
and a ; have we reached the end of the trainer data?
jr z,.FinishUp
jp z, .AddAdditionalMoveData
ld [wcf91],a ; write species somewhere (XXX why?)
ld a,ENEMY_PARTY_DATA
ld [wMonDataLocation],a
@ -68,7 +68,7 @@ ReadTrainer: ; 39c53 (e:5c53)
; - if [wLoneAttackNo] != 0, one pokemon on the team has a special move
ld a,[hli]
and a ; have we reached the end of the trainer data?
jr z,.AddLoneMove
jr z,.AddAdditionalMoveData
ld [wCurEnemyLVL],a
ld a,[hli]
ld [wcf91],a
@ -78,69 +78,48 @@ ReadTrainer: ; 39c53 (e:5c53)
call AddPartyMon
pop hl
jr .SpecialTrainer
.AddLoneMove
; does the trainer have a single monster with a different move
ld a,[wLoneAttackNo] ; Brock is 01, Misty is 02, Erika is 04, etc
and a
jr z,.AddTeamMove
dec a
add a,a
ld c,a
ld b,0
ld hl,LoneMoves
add hl,bc
ld a,[hli]
ld d,[hl]
ld hl,wEnemyMon1Moves + 2
ld bc,wEnemyMon2 - wEnemyMon1
call AddNTimes
ld [hl],d
jr .FinishUp
.AddTeamMove
; check if our trainer's team has special moves
; get trainer class number
ld a,[wCurOpponent]
sub 200
ld b,a
ld hl,TeamMoves
; iterate through entries in TeamMoves, checking each for our trainer class
.IterateTeamMoves
ld a,[hli]
.AddAdditionalMoveData
; does the trainer have additional move data?
ld a, [wTrainerClass]
ld b, a
ld a, [wTrainerNo]
ld c, a
ld hl, SpecialTrainerMoves
.loopAdditionalMoveData
ld a, [hli]
cp $ff
jr z, .FinishUp
cp b
jr z,.GiveTeamMoves ; is there a match?
inc hl ; if not, go to the next entry
inc a
jr nz,.IterateTeamMoves
; no matches found. is this trainer champion rival?
ld a,b
cp SONY3
jr z,.ChampionRival
jr .FinishUp ; nope
.GiveTeamMoves
ld a,[hl]
ld [wEnemyMon5Moves + 2],a
jr .FinishUp
.ChampionRival ; give moves to his team
; pidgeot
ld a,SKY_ATTACK
ld [wEnemyMon1Moves + 2],a
; starter
ld a,[W_RIVALSTARTER]
cp STARTER3
ld b,MEGA_DRAIN
jr z,.GiveStarterMove
cp STARTER1
ld b,FIRE_BLAST
jr z,.GiveStarterMove
ld b,BLIZZARD ; must be squirtle
.GiveStarterMove
ld a,b
ld [wEnemyMon6Moves + 2],a
jr nz, .asm_39c46
ld a, [hli]
cp c
jr nz, .asm_39c46
ld d, h
ld e, l
.writeAdditionalMoveDataLoop
ld a, [de]
inc de
and a
jp z, .FinishUp
dec a
ld hl, wEnemyMon1Moves
ld bc, wEnemyMon2 - wEnemyMon1
call AddNTimes
ld a, [de]
inc de
dec a
ld c, a
ld b, 0
add hl,bc
ld a, [de]
inc de
ld [hl], a
jr .writeAdditionalMoveDataLoop
.asm_39c46
ld a, [hli]
and a
jr nz, .asm_39c46
jr .loopAdditionalMoveData
.FinishUp
; clear wAmountMoneyWon addresses
xor a

View File

@ -1,6 +1,6 @@
SaveTrainerName: ; 27dff (9:7dff)
ld hl,TrainerNamePointers
ld a,[W_TRAINERCLASS]
ld a,[wTrainerClass]
dec a
ld c,a
ld b,0

View File

@ -1,13 +1,13 @@
; creates a set of moves that may be used and returns its address in hl
; unused slots are filled with 0, all used slots may be chosen with equal probability
AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
AIEnemyTrainerChooseMoves: ; 3969c (e:569c)
ld a, $a
ld hl, wBuffer ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end
ld [hli], a ; move 1
ld [hli], a ; move 2
ld [hli], a ; move 3
ld [hl], a ; move 4
ld a, [W_ENEMYDISABLEDMOVE] ; forbid disabled move (if any)
ld a, [wEnemyDisabledMove] ; forbid disabled move (if any)
swap a
and $f
jr z, .noMoveDisabled
@ -19,7 +19,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
ld [hl], $50 ; forbid (highly discourage) disabled move
.noMoveDisabled
ld hl, TrainerClassMoveChoiceModifications
ld a, [W_TRAINERCLASS]
ld a, [wTrainerClass]
ld b, a
.loopTrainerClasses
dec b
@ -103,14 +103,14 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
ld hl, wEnemyMonMoves ; use original move set
ret
AIMoveChoiceModificationFunctionPointers: ; 397a3 (e:57a3)
AIMoveChoiceModificationFunctionPointers: ; 39726 (e:5726)
dw AIMoveChoiceModification1
dw AIMoveChoiceModification2
dw AIMoveChoiceModification3
dw AIMoveChoiceModification4 ; unused, does nothing
; discourages moves that cause no damage but only a status ailment if player's mon already has one
AIMoveChoiceModification1: ; 397ab (e:57ab)
AIMoveChoiceModification1: ; 3972e (e:572e)
ld a, [wBattleMonStatus]
and a
ret z ; return if no status ailment on player's mon
@ -129,7 +129,7 @@ AIMoveChoiceModification1: ; 397ab (e:57ab)
ld a, [W_ENEMYMOVEPOWER]
and a
jr nz, .nextMove
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
push hl
push de
push bc
@ -145,7 +145,7 @@ AIMoveChoiceModification1: ; 397ab (e:57ab)
ld [hl], a
jr .nextMove
StatusAilmentMoveEffects: ; 57e2
StatusAilmentMoveEffects: ; 39765 (e:5765)
db $01 ; unused sleep effect
db SLEEP_EFFECT
db POISON_EFFECT
@ -155,7 +155,7 @@ StatusAilmentMoveEffects: ; 57e2
; slightly encourage moves with specific effects.
; in particular, stat-modifying moves and other move effects
; that fall in-bewteen
AIMoveChoiceModification2: ; 397e7 (e:57e7)
AIMoveChoiceModification2: ; 3976a (e:576a)
ld a, [wAILayer2Encouragement]
cp $1
ret nz
@ -171,7 +171,7 @@ AIMoveChoiceModification2: ; 397e7 (e:57e7)
ret z ; no more moves in move set
inc de
call ReadMove
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp ATTACK_UP1_EFFECT
jr c, .nextMove
cp BIDE_EFFECT
@ -182,13 +182,13 @@ AIMoveChoiceModification2: ; 397e7 (e:57e7)
jr c, .preferMove
jr .nextMove
.preferMove
dec [hl] ; sligthly encourage this move
dec [hl] ; slightly encourage this move
jr .nextMove
; encourages moves that are effective against the player's mon (even if non-damaging).
; discourage damaging moves that are ineffective or not very effective against the player's mon,
; unless there's no damaging move that deals at least neutral damage
AIMoveChoiceModification3: ; 39817 (e:5817)
AIMoveChoiceModification3: ; 3979a (e:579a)
ld hl, wBuffer - 1 ; temp move selection array (-1 byte offset)
ld de, wEnemyMonMoves ; enemy moves
ld b, NUM_MOVES + 1
@ -218,7 +218,7 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
push hl
push de
push bc
ld a, [W_ENEMYMOVETYPE]
ld a, [wEnemyMoveType]
ld d, a
ld hl, wEnemyMonMoves ; enemy moves
ld b, NUM_MOVES + 1
@ -230,14 +230,14 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
and a
jr z, .done
call ReadMove
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp SUPER_FANG_EFFECT
jr z, .betterMoveFound ; Super Fang is considered to be a better move
cp SPECIAL_DAMAGE_EFFECT
jr z, .betterMoveFound ; any special damage moves are considered to be better moves
cp FLY_EFFECT
jr z, .betterMoveFound ; Fly is considered to be a better move
ld a, [W_ENEMYMOVETYPE]
ld a, [wEnemyMoveType]
cp d
jr z, .loopMoves
ld a, [W_ENEMYMOVEPOWER]
@ -255,10 +255,10 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
jr z, .nextMove
inc [hl] ; sligthly discourage this move
jr .nextMove
AIMoveChoiceModification4: ; 39883 (e:5883)
AIMoveChoiceModification4: ; 39806 (e:5806)
ret
ReadMove: ; 39884 (e:5884)
ReadMove: ; 39807 (e:5807)
push hl
push de
push bc
@ -266,7 +266,7 @@ ReadMove: ; 39884 (e:5884)
ld hl,Moves
ld bc,MoveEnd - Moves
call AddNTimes
ld de,W_ENEMYMOVENUM
ld de,wEnemyMoveNum
call CopyData
pop bc
pop de
@ -275,7 +275,7 @@ ReadMove: ; 39884 (e:5884)
; move choice modification methods that are applied for each trainer class
; 0 is sentinel value
TrainerClassMoveChoiceModifications: ; 3989b (e:589b)
TrainerClassMoveChoiceModifications: ; 3981e (e:581e)
db 0 ; YOUNGSTER
db 1,0 ; BUG CATCHER
db 1,0 ; LASS
@ -295,7 +295,7 @@ TrainerClassMoveChoiceModifications: ; 3989b (e:589b)
db 1,0 ; GAMBLER
db 1,3,0 ; BEAUTY
db 1,2,0 ; PSYCHIC_TR
db 1,3,0 ; ROCKER
db 1,0 ; ROCKER
db 1,0 ; JUGGLER
db 1,0 ; TAMER
db 1,0 ; BIRD_KEEPER
@ -311,11 +311,11 @@ TrainerClassMoveChoiceModifications: ; 3989b (e:589b)
db 1,0 ; BRUNO
db 1,0 ; BROCK
db 1,3,0 ; MISTY
db 1,3,0 ; LT__SURGE
db 1,0 ; LT__SURGE
db 1,3,0 ; ERIKA
db 1,3,0 ; KOGA
db 1,3,0 ; BLAINE
db 1,3,0 ; SABRINA
db 1,0 ; BLAINE
db 1,0 ; SABRINA
db 1,2,0 ; GENTLEMAN
db 1,3,0 ; SONY2
db 1,3,0 ; SONY3
@ -336,15 +336,21 @@ INCLUDE "data/trainer_moves.asm"
INCLUDE "data/trainer_parties.asm"
TrainerAI: ; 3a52e (e:652e)
and a
TrainerAI: ; 3a5b2 (e:65b2)
ld a,[wIsInBattle]
dec a
ret z ; if not a trainer, we're done here
jr z, .done ; if not a trainer, we're done here
ld a,[wLinkState]
cp LINK_STATE_BATTLING
ret z
ld a,[W_TRAINERCLASS] ; what trainer class is this?
jr z, .done ; if in a link battle, we're done as well
ld a, [wEnemyBattleStatus1]
and 1 << ChargingUp | 1 << ThrashingAbout | 1 << StoringEnergy ; %10011
jr nz, .done ; don't follow trainer ai if opponent is in a locked state
ld a, [wEnemyBattleStatus2]
and 1 << UsingRage ; %1000000
jr nz, .done ; don't follow trainer ai if opponent is locked in rage
; note that this doesn't check for hyper beam recharge which can cause problems
ld a,[wTrainerClass] ; what trainer class is this?
dec a
ld c,a
ld b,0
@ -354,7 +360,7 @@ TrainerAI: ; 3a52e (e:652e)
add hl,bc
ld a,[wAICount]
and a
ret z ; if no AI uses left, we're done here
jr z, .done; if no AI uses left, we're done here
inc hl
inc a
jr nz,.getpointer
@ -367,8 +373,11 @@ TrainerAI: ; 3a52e (e:652e)
ld l,a
call Random
jp [hl]
.done
and a
ret
TrainerAIPointers: ; 3a55c (e:655c)
TrainerAIPointers: ; 3a5f2 (e:65f2)
; one entry per trainer class
; first byte, number of times (per Pokémon) it can occur
; next two bytes, pointer to AI subroutine for trainer class
@ -420,27 +429,27 @@ TrainerAIPointers: ; 3a55c (e:655c)
dbw 2,AgathaAI ; agatha
dbw 1,LanceAI ; lance
JugglerAI: ; 3a5e9 (e:65e9)
JugglerAI: ; 3a67f (e:667f)
cp $40
ret nc
jp AISwitchIfEnoughMons
BlackbeltAI: ; 3a5ef (e:65ef)
BlackbeltAI: ; 3a685 (e:6685)
cp $20
ret nc
jp AIUseXAttack
GiovanniAI: ; 3a5f5 (e:65f5)
GiovanniAI: ; 3a68b (e:668b)
cp $40
ret nc
jp AIUseGuardSpec
CooltrainerMAI: ; 3a5fb (e:65fb)
CooltrainerMAI: ; 3a691 (e:6691)
cp $40
ret nc
jp AIUseXAttack
CooltrainerFAI: ; 3a601 (e:6601)
CooltrainerFAI: ; 3a697 (e:6697)
cp $40
ld a,$A
call AICheckIfHPBelowFraction
@ -450,24 +459,24 @@ CooltrainerFAI: ; 3a601 (e:6601)
ret nc
jp AISwitchIfEnoughMons
BrockAI: ; 3a614 (e:6614)
BrockAI: ; 3a6aa (e:66aa)
; if his active monster has a status condition, use a full heal
ld a,[wEnemyMonStatus]
and a
ret z
jp AIUseFullHeal
MistyAI: ; 3a61c (e:661c)
MistyAI: ; 3a6b2 (e:66b2)
cp $40
ret nc
jp AIUseXDefend
LtSurgeAI: ; 3a622 (e:6622)
LtSurgeAI: ; 3a6b8 (e:66b8)
cp $40
ret nc
jp AIUseXSpeed
ErikaAI: ; 3a628 (e:6628)
ErikaAI: ; 3a6be (e:66be)
cp $80
ret nc
ld a,$A
@ -475,25 +484,25 @@ ErikaAI: ; 3a628 (e:6628)
ret nc
jp AIUseSuperPotion
KogaAI: ; 3a634 (e:6634)
cp $40
KogaAI: ; 3a6ca (e:66ca)
cp $20
ret nc
jp AIUseXAttack
BlaineAI: ; 3a63a (e:663a)
cp $40
ret nc
jp AIUseSuperPotion
SabrinaAI: ; 3a640 (e:6640)
BlaineAI: ; 3a6d0 (e:66d0)
cp $40
ret nc
ld a,$A
call AICheckIfHPBelowFraction
ret nc
jp AIUseHyperPotion
jp AIUseSuperPotion
Sony2AI: ; 3a64c (e:664c)
SabrinaAI: ; 3a6dc (e:66dc)
cp $40
ret nc
jp AIUseXDefend
Sony2AI: ; 3a6e2 (e:66e2)
cp $20
ret nc
ld a,5
@ -501,7 +510,7 @@ Sony2AI: ; 3a64c (e:664c)
ret nc
jp AIUsePotion
Sony3AI: ; 3a658 (e:6658)
Sony3AI: ; 3a6ee (e:66ee)
cp $20
ret nc
ld a,5
@ -509,7 +518,7 @@ Sony3AI: ; 3a658 (e:6658)
ret nc
jp AIUseFullRestore
LoreleiAI: ; 3a664 (e:6664)
LoreleiAI: ; 3a6fa (e:66fa)
cp $80
ret nc
ld a,5
@ -517,12 +526,12 @@ LoreleiAI: ; 3a664 (e:6664)
ret nc
jp AIUseSuperPotion
BrunoAI: ; 3a670 (e:6670)
BrunoAI: ; 3a706 (e:6706)
cp $40
ret nc
jp AIUseXDefend
AgathaAI: ; 3a676 (e:6676)
AgathaAI: ; 3a70c (e:670c)
cp $14
jp c,AISwitchIfEnoughMons
cp $80
@ -532,7 +541,7 @@ AgathaAI: ; 3a676 (e:6676)
ret nc
jp AIUseSuperPotion
LanceAI: ; 3a687 (e:6687)
LanceAI: ; 3a71d (e:671d)
cp $80
ret nc
ld a,5
@ -540,23 +549,23 @@ LanceAI: ; 3a687 (e:6687)
ret nc
jp AIUseHyperPotion
GenericAI: ; 3a693 (e:6693)
GenericAI: ; 3a729 (e:6729)
and a ; clear carry
ret
; end of individual trainer AI routines
DecrementAICount: ; 3a695 (e:6695)
DecrementAICount: ; 3a72b (e:672b)
ld hl,wAICount
dec [hl]
scf
ret
AIPlayRestoringSFX: ; 3a69b (e:669b)
AIPlayRestoringSFX: ; 3a731 (e:6731)
ld a,SFX_HEAL_AILMENT
jp PlaySoundWaitForCurrent
AIUseFullRestore: ; 3a6a0 (e:66a0)
AIUseFullRestore: ; 3a736 (e:6736)
call AICureStatus
ld a,FULL_RESTORE
ld [wAIItem],a
@ -580,25 +589,25 @@ AIUseFullRestore: ; 3a6a0 (e:66a0)
ld [wEnemyMonHP],a
jr AIPrintItemUseAndUpdateHPBar
AIUsePotion: ; 3a6ca (e:66ca)
AIUsePotion: ; 3a760 (e:6760)
; enemy trainer heals his monster with a potion
ld a,POTION
ld b,20
jr AIRecoverHP
AIUseSuperPotion: ; 3a6d0 (e:66d0)
AIUseSuperPotion: ; 3a766 (e:6766)
; enemy trainer heals his monster with a super potion
ld a,SUPER_POTION
ld b,50
jr AIRecoverHP
AIUseHyperPotion: ; 3a6d6 (e:66d6)
AIUseHyperPotion: ; 3a76c (e:676c)
; enemy trainer heals his monster with a hyper potion
ld a,HYPER_POTION
ld b,200
; fallthrough
AIRecoverHP: ; 3a6da (e:66da)
AIRecoverHP: ; 3a770 (e:6770)
; heal b HP and print "trainer used $(a) on pokemon!"
ld [wAIItem],a
ld hl,wEnemyMonHP + 1
@ -639,7 +648,7 @@ AIRecoverHP: ; 3a6da (e:66da)
ld [wHPBarNewHP+1],a
; fallthrough
AIPrintItemUseAndUpdateHPBar: ; 3a718 (e:6718)
AIPrintItemUseAndUpdateHPBar: ; 3a7ae (e:67ae)
call AIPrintItemUse_
coord hl, 2, 2
xor a
@ -647,7 +656,7 @@ AIPrintItemUseAndUpdateHPBar: ; 3a718 (e:6718)
predef UpdateHPBar2
jp DecrementAICount
AISwitchIfEnoughMons: ; 3a72a (e:672a)
AISwitchIfEnoughMons: ; 3a7c0 (e:67c0)
; enemy trainer switches if there are 3 or more unfainted mons in party
ld a,[wEnemyPartyCount]
ld c,a
@ -677,7 +686,7 @@ AISwitchIfEnoughMons: ; 3a72a (e:672a)
and a
ret
SwitchEnemyMon: ; 3a74b (e:674b)
SwitchEnemyMon: ; 3a7e1 (e:67e1)
; prepare to withdraw the active monster: copy hp, number, and status to roster
@ -708,17 +717,17 @@ SwitchEnemyMon: ; 3a74b (e:674b)
scf
ret
AIBattleWithdrawText: ; 3a781 (e:6781)
AIBattleWithdrawText: ; 3a817 (e:6817)
TX_FAR _AIBattleWithdrawText
db "@"
AIUseFullHeal: ; 3a786 (e:6786)
AIUseFullHeal: ; 3a81c (e:681c)
call AIPlayRestoringSFX
call AICureStatus
ld a,FULL_HEAL
jp AIPrintItemUse
AICureStatus: ; 3a791 (e:6791)
AICureStatus: ; 3a827 (e:6827)
; cures the status of enemy's active pokemon
ld a,[wEnemyMonPartyPos]
ld hl,wEnemyMon1Status
@ -731,28 +740,30 @@ AICureStatus: ; 3a791 (e:6791)
res 0,[hl]
ret
AIUseXAccuracy: ; 0x3a7a8 unused
AIUseXAccuracy: ; 3a83e (e:683e)
; unused
call AIPlayRestoringSFX
ld hl,wEnemyBattleStatus2
set 0,[hl]
ld a,X_ACCURACY
jp AIPrintItemUse
AIUseGuardSpec: ; 3a7b5 (e:67b5)
AIUseGuardSpec: ; 3a84b (e:684b)
call AIPlayRestoringSFX
ld hl,wEnemyBattleStatus2
set 1,[hl]
ld a,GUARD_SPEC_
jp AIPrintItemUse
AIUseDireHit: ; 0x3a7c2 unused
AIUseDireHit: ; 3a858 (e:6858)
; unused
call AIPlayRestoringSFX
ld hl,wEnemyBattleStatus2
set 2,[hl]
ld a,DIRE_HIT
jp AIPrintItemUse
AICheckIfHPBelowFraction: ; 3a7cf (e:67cf)
AICheckIfHPBelowFraction: ; 3a865 (e:6865)
; return carry if enemy trainer's current HP is below 1 / a of the maximum
ld [H_DIVISOR],a
ld hl,wEnemyMonMaxHP
@ -778,32 +789,32 @@ AICheckIfHPBelowFraction: ; 3a7cf (e:67cf)
sub c
ret
AIUseXAttack: ; 3a7f2 (e:67f2)
AIUseXAttack: ; 3a888 (e:6888)
ld b,$A
ld a,X_ATTACK
jr AIIncreaseStat
AIUseXDefend: ; 3a7f8 (e:67f8)
AIUseXDefend: ; 3a88e (e:688e)
ld b,$B
ld a,X_DEFEND
jr AIIncreaseStat
AIUseXSpeed: ; 3a7fe (e:67fe)
AIUseXSpeed: ; 3a894 (e:6894)
ld b,$C
ld a,X_SPEED
jr AIIncreaseStat
AIUseXSpecial: ; 3a804 (e:6804)
AIUseXSpecial: ; 3a89a (e:689a)
ld b,$D
ld a,X_SPECIAL
; fallthrough
AIIncreaseStat: ; 3a808 (e:6808)
AIIncreaseStat: ; 3a89e (e:689e)
ld [wAIItem],a
push bc
call AIPrintItemUse_
pop bc
ld hl,W_ENEMYMOVEEFFECT
ld hl,wEnemyMoveEffect
ld a,[hld]
push af
ld a,[hl]
@ -820,12 +831,12 @@ AIIncreaseStat: ; 3a808 (e:6808)
ld [hl],a
jp DecrementAICount
AIPrintItemUse: ; 3a82c (e:682c)
AIPrintItemUse: ; 3a8c2 (e:68c2)
ld [wAIItem],a
call AIPrintItemUse_
jp DecrementAICount
AIPrintItemUse_: ; 3a835 (e:6835)
AIPrintItemUse_: ; 3a8cb (e:68cb)
; print "x used [wAIItem] on z!"
ld a,[wAIItem]
ld [wd11e],a
@ -833,6 +844,6 @@ AIPrintItemUse_: ; 3a835 (e:6835)
ld hl, AIBattleUseItemText
jp PrintText
AIBattleUseItemText: ; 3a844 (e:6844)
AIBattleUseItemText: ; 3a8da (e:68da)
TX_FAR _AIBattleUseItemText
db "@"

View File

@ -1,4 +1,4 @@
TrainerPicAndMoneyPointers: ; 39914 (e:5914)
TrainerPicAndMoneyPointers: ; 39893 (e:5893)
; trainer pic pointers and base money.
; money received after battle = base money × level of highest-level enemy mon
dw YoungsterPic

View File

@ -2690,7 +2690,7 @@ InitBattleEnemyParameters:: ; 3273 (0:3273)
cp 200
ld a, [wEngagedTrainerSet]
jr c, .noTrainer
ld [W_TRAINERNO], a
ld [wTrainerNo], a
ret
.noTrainer
ld [wCurEnemyLVL], a
@ -3214,7 +3214,7 @@ GetTrainerInformation:: ; 3563 (0:3563)
jr nz, .linkBattle
ld a, BANK(TrainerPicAndMoneyPointers)
call BankswitchHome
ld a, [W_TRAINERCLASS]
ld a, [wTrainerClass]
dec a
ld hl, TrainerPicAndMoneyPointers
ld bc, $5
@ -3242,10 +3242,10 @@ GetTrainerInformation:: ; 3563 (0:3563)
ret
IsFightingJessieJames:: ; 359e (0:359e)
ld a,[W_TRAINERCLASS]
ld a,[wTrainerClass]
cp ROCKET
ret nz
ld a,[W_TRAINERNO]
ld a,[wTrainerNo]
cp $2a
ret c
ld de,JessieJamesPic

View File

@ -151,7 +151,7 @@ CeruleanCityScript1: ; 19567 (6:5567)
.Charmander
ld a, $9
.done
ld [W_TRAINERNO], a
ld [wTrainerNo], a
xor a
ld [hJoyHeld], a

View File

@ -81,7 +81,7 @@ GaryScript2: ; 75f6a (1d:5f6a)
.Charmander
ld a, $3
.done
ld [W_TRAINERNO], a
ld [wTrainerNo], a
xor a
ld [hJoyHeld], a

View File

@ -396,7 +396,7 @@ OaksLabScript11: ; 1cdb9 (7:4db9)
.Charmander
ld a, $3
.done
ld [W_TRAINERNO], a
ld [wTrainerNo], a
ld a, $1
ld [wSpriteIndex], a
call GetSpritePosition1

View File

@ -159,7 +159,7 @@ PokemonTower2Text1: ; 605df (18:45df)
.Charmander
ld a, $6
.done
ld [W_TRAINERNO], a
ld [wTrainerNo], a
ld a, $1
ld [W_POKEMONTOWER2CURSCRIPT], a

View File

@ -32,7 +32,7 @@ Route22Script_50ed6: ; 50ed6 (14:4ed6)
jr .asm_50eda
.asm_50ee1
ld a, [hl]
ld [W_TRAINERNO], a
ld [wTrainerNo], a
ret
Route22MoveRivalSprite: ; 50ee6 (14:4ee6)

View File

@ -198,7 +198,7 @@ SilphCo7Script3: ; 51c82 (14:5c82)
.asm_51cbe
ld a, $9
.asm_51cc0
ld [W_TRAINERNO], a
ld [wTrainerNo], a
ld a, $4
jp SilphCo7Text_51c10

View File

@ -114,7 +114,7 @@ SSAnne2Script1: ; 61430 (18:5430)
.Charmander
ld a, $3
.done
ld [W_TRAINERNO], a
ld [wTrainerNo], a
call SSAnne2Script_61416
ld a, $2

View File

@ -1,4 +1,4 @@
TrainerNames: ; 399ff (e:59ff)
TrainerNames: ; 3997e (e:597e)
db "YOUNGSTER@"
db "BUG CATCHER@"
db "LASS@"

View File

@ -1484,13 +1484,13 @@ wUpdateSpritesEnabled:: ; cfcb
; other values aren't used
ds 1
W_ENEMYMOVENUM:: ; cfcc
wEnemyMoveNum:: ; cfcc
ds 1
W_ENEMYMOVEEFFECT:: ; cfcd
wEnemyMoveEffect:: ; cfcd
ds 1
W_ENEMYMOVEPOWER:: ; cfce
ds 1
W_ENEMYMOVETYPE:: ; cfcf
wEnemyMoveType:: ; cfcf
ds 1
W_ENEMYMOVEACCURACY:: ; cfd0
ds 1
@ -1557,7 +1557,7 @@ wBattleMonNick:: ds NAME_LENGTH ; d009
wBattleMon:: battle_struct wBattleMon ; d014
W_TRAINERCLASS:: ; d031
wTrainerClass:: ; d031
ds 1
ds 1
@ -1624,7 +1624,7 @@ wLoneAttackNo:: ; d05c
wGymLeaderNo:: ; d05c
; it's actually the same thing as ^
ds 1
W_TRAINERNO:: ; d05d
wTrainerNo:: ; d05d
; which instance of [youngster, lass, etc] is this?
ds 1
@ -1714,7 +1714,7 @@ W_ENEMYCONFUSEDCOUNTER:: ; d070
W_ENEMYTOXICCOUNTER:: ; d071
ds 1
W_ENEMYDISABLEDMOVE:: ; d072
wEnemyDisabledMove:: ; d072
; high nibble: which move is disabled (1-4)
; low nibble: disable turns left
ds 1

View File

@ -4005,18 +4005,9 @@ SECTION "bank0E",ROMX,BANK[$0E]
INCLUDE "data/moves.asm"
BaseStats: INCLUDE "data/base_stats.asm"
INCLUDE "data/cries.asm"
dr $3969c,$39893
TrainerPicAndMoneyPointers: ; 39893 (e:5893)
dr $39893,$3997e
TrainerNames: ; 3997e (e:597e)
dr $3997e,$39b06
FormatMovesString: ; 39b06 (e:5b06)
dr $39b06,$39b54
InitList: ; 39b54 (e:5b54)
dr $39b54,$39bb6
ReadTrainer: ; 39bb6 (e:5bb6)
dr $39bb6,$3a8df
INCLUDE "data/cries.asm"
INCLUDE "engine/battle/trainer_ai.asm"
DrawAllPokeballs: ; 3a8df (e:68df)
dr $3a8df,$3a9e9
SetupPlayerAndEnemyPokeballs: ; 3a9e9 (e:69e9)
@ -4050,7 +4041,9 @@ SECTION "bank0F",ROMX,BANK[$0F]
SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c)
dr $3c04c,$3c127
StartBattle: ; 3c127 (f:4127)
dr $3c127,$3cae8
dr $3c127,$3c973
EnemySendOut: ; 3c973 (f:4973)
dr $3c973,$3cae8
AnyPartyAlive: ; 3cae8 (f:4ae8)
dr $3cae8,$3ce08
ReadPlayerMonCurHPAndStatus: ; 3ce08 (f:4e08)
@ -4067,7 +4060,7 @@ PrintDoesntAffectText: ; 3ddc3 (f:5dc3)
dr $3ddc3,$3e5bb
AIGetTypeEffectiveness: ; 3e5bb (f:65bb)
ld a,[W_ENEMYMOVETYPE]
ld a,[wEnemyMoveType]
ld d,a ; d = type of enemy move
ld hl,wBattleMonType
ld b,[hl] ; b = type 1 of player's pokemon
@ -4095,7 +4088,7 @@ AIGetTypeEffectiveness: ; 3e5bb (f:65bb)
jr .loop
.done
ld a, [W_TRAINERCLASS]
ld a, [wTrainerClass]
cp LORELEI
jr nz, .ok
ld a, [wEnemyMonSpecies]