This commit is contained in:
dannye 2015-07-26 23:23:05 -05:00
commit d7c5c8cf22
10 changed files with 65 additions and 59 deletions

View file

@ -1,13 +1,17 @@
MAX_LEVEL EQU 100 MAX_LEVEL EQU 100
NUM_MOVES EQU 4
NUM_MOVES EQU 4
NUM_STATS EQU 5
NUM_STAT_MODS EQU 8
NUM_DVS EQU 2
PARTY_LENGTH EQU 6 PARTY_LENGTH EQU 6
MONS_PER_BOX EQU 20 MONS_PER_BOX EQU 20
NUM_BOXES EQU 12 NUM_BOXES EQU 12
HOF_MON EQU $10 HOF_MON EQU $10
HOF_TEAM EQU PARTY_LENGTH * HOF_MON HOF_TEAM EQU PARTY_LENGTH * HOF_MON
HOF_TEAM_CAPACITY EQU 50 HOF_TEAM_CAPACITY EQU 50
A_BUTTON EQU %00000001 A_BUTTON EQU %00000001

View file

@ -16,7 +16,7 @@ const_value = $D8
const SE_SPIRAL_BALLS_INWARD ; $E2 used in Growth/Focus Energy/Hyper Beam etc. const SE_SPIRAL_BALLS_INWARD ; $E2 used in Growth/Focus Energy/Hyper Beam etc.
const SE_SHAKE_ENEMY_HUD_2 ; $E3 unused const SE_SHAKE_ENEMY_HUD_2 ; $E3 unused
const SE_SHAKE_ENEMY_HUD ; $E4 const SE_SHAKE_ENEMY_HUD ; $E4
const SE_SLIDE_MON_HALF_OFF ; $E5 used in Softboiled const SE_SLIDE_MON_HALF_OFF ; $E5 used in Softboiled
const SE_PETALS_FALLING ; $E6 used in Petal Dance const SE_PETALS_FALLING ; $E6 used in Petal Dance
const SE_LEAVES_FALLING ; $E7 used in Razor Leaf const SE_LEAVES_FALLING ; $E7 used in Razor Leaf
const SE_TRANSFORM_MON ; $E8 used in Transform const SE_TRANSFORM_MON ; $E8 used in Transform

View file

@ -1,3 +1,4 @@
MonBaseStats:
RhydonBaseStats: ; 39002 (e:5002) RhydonBaseStats: ; 39002 (e:5002)
db DEX_RHYDON ; pokedex id db DEX_RHYDON ; pokedex id
db 105 ; base hp db 105 ; base hp
@ -27,3 +28,4 @@ db %10100010
db %10001000 db %10001000
db %00110010 db %00110010
db 0 ; padding db 0 ; padding
MonBaseStatsEnd:

View file

@ -1696,19 +1696,19 @@ GotAwayText: ; 3cba1 (f:4ba1)
; copies from party data to battle mon data when sending out a new player mon ; copies from party data to battle mon data when sending out a new player mon
LoadBattleMonFromParty: ; 3cba6 (f:4ba6) LoadBattleMonFromParty: ; 3cba6 (f:4ba6)
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
ld bc, $2c ld bc, wPartyMon2 - wPartyMon1
ld hl, wPartyMon1Species ld hl, wPartyMon1Species
call AddNTimes call AddNTimes
ld de, wBattleMonSpecies ld de, wBattleMonSpecies
ld bc, $c ld bc, wBattleMonDVs - wBattleMonSpecies
call CopyData call CopyData
ld bc, $f ld bc, wPartyMon1DVs - wPartyMon1OTID
add hl, bc add hl, bc
ld de, wBattleMonDVs ld de, wBattleMonDVs
ld bc, $2 ld bc, NUM_DVS
call CopyData call CopyData
ld de, wBattleMonPP ld de, wBattleMonPP
ld bc, $4 ld bc, NUM_MOVES
call CopyData call CopyData
ld de, wBattleMonLevel ld de, wBattleMonLevel
ld bc, $b ld bc, $b
@ -1724,12 +1724,12 @@ LoadBattleMonFromParty: ; 3cba6 (f:4ba6)
call CopyData call CopyData
ld hl, wBattleMonLevel ld hl, wBattleMonLevel
ld de, wPlayerMonUnmodifiedLevel ; block of memory used for unmodified stats ld de, wPlayerMonUnmodifiedLevel ; block of memory used for unmodified stats
ld bc, $b ld bc, 1 + NUM_STATS * 2
call CopyData call CopyData
call ApplyBurnAndParalysisPenaltiesToPlayer call ApplyBurnAndParalysisPenaltiesToPlayer
call ApplyBadgeStatBoosts call ApplyBadgeStatBoosts
ld a, $7 ; default stat modifier ld a, $7 ; default stat modifier
ld b, $8 ld b, NUM_STAT_MODS
ld hl, wPlayerMonAttackMod ld hl, wPlayerMonAttackMod
.statModLoop .statModLoop
ld [hli], a ld [hli], a
@ -1740,19 +1740,19 @@ LoadBattleMonFromParty: ; 3cba6 (f:4ba6)
; copies from enemy party data to current enemy mon data when sending out a new enemy mon ; copies from enemy party data to current enemy mon data when sending out a new enemy mon
LoadEnemyMonFromParty: ; 3cc13 (f:4c13) LoadEnemyMonFromParty: ; 3cc13 (f:4c13)
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
ld bc, $2c ld bc, wEnemyMon2 - wEnemyMon1
ld hl, wEnemyMons ld hl, wEnemyMons
call AddNTimes call AddNTimes
ld de, wEnemyMonSpecies ld de, wEnemyMonSpecies
ld bc, $c ld bc, wEnemyMonDVs - wEnemyMonSpecies
call CopyData call CopyData
ld bc, $f ld bc, wEnemyMon1DVs - wEnemyMon1OTID
add hl, bc add hl, bc
ld de, wEnemyMonDVs ld de, wEnemyMonDVs
ld bc, $2 ld bc, NUM_DVS
call CopyData call CopyData
ld de, wEnemyMonPP ld de, wEnemyMonPP
ld bc, $4 ld bc, NUM_MOVES
call CopyData call CopyData
ld de, wEnemyMonLevel ld de, wEnemyMonLevel
ld bc, $b ld bc, $b
@ -1768,12 +1768,12 @@ LoadEnemyMonFromParty: ; 3cc13 (f:4c13)
call CopyData call CopyData
ld hl, wEnemyMonLevel ld hl, wEnemyMonLevel
ld de, wEnemyMonUnmodifiedLevel ; block of memory used for unmodified stats ld de, wEnemyMonUnmodifiedLevel ; block of memory used for unmodified stats
ld bc, $b ld bc, 1 + NUM_STATS * 2
call CopyData call CopyData
call ApplyBurnAndParalysisPenaltiesToEnemy call ApplyBurnAndParalysisPenaltiesToEnemy
ld hl, W_MONHBASESTATS ld hl, W_MONHBASESTATS
ld de, wEnemyMonBaseStats ld de, wEnemyMonBaseStats
ld b, $5 ld b, NUM_STATS
.copyBaseStatsLoop .copyBaseStatsLoop
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
@ -1781,7 +1781,7 @@ LoadEnemyMonFromParty: ; 3cc13 (f:4c13)
dec b dec b
jr nz, .copyBaseStatsLoop jr nz, .copyBaseStatsLoop
ld a, $7 ; default stat modifier ld a, $7 ; default stat modifier
ld b, $8 ld b, NUM_STAT_MODS
ld hl, wEnemyMonStatMods ld hl, wEnemyMonStatMods
.statModLoop .statModLoop
ld [hli], a ld [hli], a
@ -6300,7 +6300,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01)
predef LoadMovePPs predef LoadMovePPs
ld hl, W_MONHBASESTATS ld hl, W_MONHBASESTATS
ld de, wEnemyMonBaseStats ld de, wEnemyMonBaseStats
ld b, $5 ld b, NUM_STATS
.copyBaseStatsLoop .copyBaseStatsLoop
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
@ -6331,10 +6331,10 @@ LoadEnemyMonData: ; 3eb01 (f:6b01)
predef FlagActionPredef ; mark this mon as seen in the pokedex predef FlagActionPredef ; mark this mon as seen in the pokedex
ld hl, wEnemyMonLevel ld hl, wEnemyMonLevel
ld de, wEnemyMonUnmodifiedLevel ld de, wEnemyMonUnmodifiedLevel
ld bc, $b ld bc, 1 + NUM_STATS * 2
call CopyData call CopyData
ld a, $7 ; default stat mod ld a, $7 ; default stat mod
ld b, $8 ; number of stat mods ld b, NUM_STAT_MODS ; number of stat mods
ld hl, wEnemyMonStatMods ld hl, wEnemyMonStatMods
.statModLoop .statModLoop
ld [hli], a ld [hli], a
@ -6561,7 +6561,7 @@ CalculateModifiedStats: ; 3ed99 (f:6d99)
call CalculateModifiedStat call CalculateModifiedStat
inc c inc c
ld a, c ld a, c
cp 4 cp NUM_STATS - 1
jr nz, .loop jr nz, .loop
ret ret

View file

@ -26,7 +26,7 @@ GainExperience: ; 5524f (15:524f)
ld d, h ld d, h
ld e, l ld e, l
ld hl, wEnemyMonBaseStats ld hl, wEnemyMonBaseStats
ld c, $5 ld c, NUM_STATS
.gainStatExpLoop .gainStatExpLoop
ld a, [hli] ld a, [hli]
ld b, a ; enemy mon base stat ld b, a ; enemy mon base stat
@ -66,7 +66,7 @@ GainExperience: ; 5524f (15:524f)
ld [H_DIVISOR], a ld [H_DIVISOR], a
ld b, 4 ld b, 4
call Divide call Divide
ld hl, -((wPartyMon1HPExp + 1) - wPartyMon1OTID + 4 * 2) ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1)
add hl, de add hl, de
ld b, [hl] ; party mon OTID ld b, [hl] ; party mon OTID
inc hl inc hl
@ -220,7 +220,7 @@ GainExperience: ; 5524f (15:524f)
add hl, bc add hl, bc
push hl push hl
ld de, wBattleMonLevel ld de, wBattleMonLevel
ld bc, $b ; size of stats ld bc, 1 + NUM_STATS * 2 ; size of stats
call CopyData call CopyData
pop hl pop hl
ld a, [W_PLAYERBATTSTATUS3] ld a, [W_PLAYERBATTSTATUS3]
@ -228,7 +228,7 @@ GainExperience: ; 5524f (15:524f)
jr nz, .recalcStatChanges jr nz, .recalcStatChanges
; the mon is not transformed, so update the unmodified stats ; the mon is not transformed, so update the unmodified stats
ld de, wPlayerMonUnmodifiedLevel ld de, wPlayerMonUnmodifiedLevel
ld bc, $b ld bc, 1 + NUM_STATS * 2
call CopyData call CopyData
.recalcStatChanges .recalcStatChanges
xor a xor a
@ -308,7 +308,7 @@ DivideExpDataByNumMonsGainingExp: ; 5546c (15:546c)
ret c ; return if only one mon is gaining exp ret c ; return if only one mon is gaining exp
ld [wd11e], a ; store number of mons gaining exp ld [wd11e], a ; store number of mons gaining exp
ld hl, wEnemyMonBaseStats ld hl, wEnemyMonBaseStats
ld c, $7 ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats
.divideLoop .divideLoop
xor a xor a
ld [H_DIVIDEND], a ld [H_DIVIDEND], a

View file

@ -161,7 +161,7 @@ Evolution_PartyMonLoop: ; loop over party mons
ld a, [wd11e] ld a, [wd11e]
dec a dec a
ld hl, BaseStats ld hl, BaseStats
ld bc, $1c ld bc, MonBaseStatsEnd - MonBaseStats
call AddNTimes call AddNTimes
ld de, W_MONHEADER ld de, W_MONHEADER
call CopyData call CopyData

View file

@ -2417,11 +2417,11 @@ GetMaxPP: ; e677 (3:6677)
ld b,a ; b = normal max PP ld b,a ; b = normal max PP
pop hl pop hl
push bc push bc
ld bc,21 ; PP offset if not player's in-battle pokemon data ld bc,wPartyMon1PP - wPartyMon1Moves ; PP offset if not player's in-battle pokemon data
ld a,[wMonDataLocation] ld a,[wMonDataLocation]
cp a,4 ; player's in-battle pokemon? cp a,4 ; player's in-battle pokemon?
jr nz,.addPPOffset jr nz,.addPPOffset
ld bc,17 ; PP offset if player's in-battle pokemon data ld bc,wBattleMonPP - wBattleMonMoves ; PP offset if player's in-battle pokemon data
.addPPOffset .addPPOffset
add hl,bc add hl,bc
ld a,[hl] ; a = current PP ld a,[hl] ; a = current PP
@ -2601,7 +2601,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
pop hl pop hl
ld d, h ld d, h
ld e, l ld e, l
ld bc, $fff5 ld bc, -$b
add hl, bc add hl, bc
pop bc pop bc
dec b dec b
@ -2635,7 +2635,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
pop hl pop hl
ld d, h ld d, h
ld e, l ld e, l
ld bc, $fff5 ld bc, -$b
add hl, bc add hl, bc
pop bc pop bc
dec b dec b
@ -2669,7 +2669,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
pop hl pop hl
ld d, h ld d, h
ld e, l ld e, l
ld bc, $ffdf ld bc, wBoxMon1 - wBoxMon2
add hl, bc add hl, bc
pop bc pop bc
dec b dec b
@ -2679,7 +2679,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
ld [wEnemyMonBoxLevel], a ld [wEnemyMonBoxLevel], a
ld hl, wEnemyMon ld hl, wEnemyMon
ld de, wBoxMon1 ld de, wBoxMon1
ld bc, $c ld bc, wEnemyMonDVs - wEnemyMon
call CopyData call CopyData
ld hl, wPlayerID ld hl, wPlayerID
ld a, [hli] ld a, [hli]
@ -2703,7 +2703,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
ld [de], a ld [de], a
inc de inc de
xor a xor a
ld b, $a ld b, NUM_STATS * 2
.asm_e89f .asm_e89f
ld [de], a ld [de], a
inc de inc de
@ -2716,7 +2716,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
ld hl, wEnemyMonPP ld hl, wEnemyMonPP
ld b, $4 ld b, NUM_MOVES
.asm_e8b1 .asm_e8b1
ld a, [hli] ld a, [hli]
inc de inc de

View file

@ -10,12 +10,12 @@ LearnMove: ; 6e43 (1:6e43)
DontAbandonLearning: ; 6e5b (1:6e5b) DontAbandonLearning: ; 6e5b (1:6e5b)
ld hl, wPartyMon1Moves ld hl, wPartyMon1Moves
ld bc, $2c ld bc, wPartyMon2Moves - wPartyMon1Moves
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
call AddNTimes call AddNTimes
ld d, h ld d, h
ld e, l ld e, l
ld b, $4 ld b, NUM_MOVES
.asm_6e6b .asm_6e6b
ld a, [hl] ld a, [hl]
and a and a
@ -38,7 +38,7 @@ DontAbandonLearning: ; 6e5b (1:6e5b)
.asm_6e8b .asm_6e8b
ld a, [wMoveNum] ld a, [wMoveNum]
ld [hl], a ld [hl], a
ld bc, $15 ld bc, wPartyMon1PP - wPartyMon1Moves
add hl, bc add hl, bc
push hl push hl
push de push de
@ -66,10 +66,10 @@ DontAbandonLearning: ; 6e5b (1:6e5b)
ld de, wBattleMonMoves ld de, wBattleMonMoves
ld bc, NUM_MOVES ld bc, NUM_MOVES
call CopyData call CopyData
ld bc, $11 ld bc, wPartyMon1PP - wPartyMon1OTID
add hl, bc add hl, bc
ld de, wBattleMonPP ld de, wBattleMonPP
ld bc, $4 ld bc, NUM_MOVES
call CopyData call CopyData
jp PrintLearnedMove jp PrintLearnedMove
@ -108,7 +108,7 @@ TryingToLearn: ; 6f07 (1:6f07)
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
rra rra
ret c ret c
ld bc, $fffc ld bc, - NUM_MOVES
add hl, bc add hl, bc
push hl push hl
ld de, wMoves ld de, wMoves

View file

@ -583,11 +583,11 @@ GetMonHeader:: ; 1537 (0:1537)
predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number
ld a,[wd11e] ld a,[wd11e]
dec a dec a
ld bc,28 ld bc,MonBaseStatsEnd - MonBaseStats
ld hl,BaseStats ld hl,BaseStats
call AddNTimes call AddNTimes
ld de,W_MONHEADER ld de,W_MONHEADER
ld bc,28 ld bc,MonBaseStatsEnd - MonBaseStats
call CopyData call CopyData
jr .done jr .done
.specialID .specialID
@ -601,7 +601,7 @@ GetMonHeader:: ; 1537 (0:1537)
.mew .mew
ld hl,MewBaseStats ld hl,MewBaseStats
ld de,W_MONHEADER ld de,W_MONHEADER
ld bc,28 ld bc,MonBaseStatsEnd - MonBaseStats
ld a,BANK(MewBaseStats) ld a,BANK(MewBaseStats)
call FarCopyData call FarCopyData
.done .done
@ -3611,7 +3611,7 @@ CalcStats:: ; 3936 (0:3936)
ld [de], a ld [de], a
inc de inc de
ld a, c ld a, c
cp $5 cp NUM_STATS
jr nz, .statsLoop jr nz, .statsLoop
ret ret
@ -3662,7 +3662,7 @@ CalcStat:: ; 394a (0:394a)
srl c srl c
pop hl pop hl
push bc push bc
ld bc, $b ; skip to stat IV values ld bc, wPartyMon1DVs - (wPartyMon1HPExp - 1) ; also wEnemyMonDVs - wEnemyMonHP
add hl, bc add hl, bc
pop bc pop bc
ld a, c ld a, c
@ -3756,7 +3756,7 @@ CalcStat:: ; 394a (0:394a)
call Divide ; (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 call Divide ; (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100
ld a, c ld a, c
cp $1 cp $1
ld a, $5 ld a, 5 ; + 5 for non-HP stat
jr nz, .notHPStat jr nz, .notHPStat
ld a, [W_CURENEMYLVL] ld a, [W_CURENEMYLVL]
ld b, a ld b, a
@ -3768,7 +3768,7 @@ CalcStat:: ; 394a (0:394a)
inc a inc a
ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level
.noCarry3 .noCarry3
ld a, $a ld a, 10 ; +10 for HP stat
.notHPStat .notHPStat
ld b, a ld b, a
ld a, [H_MULTIPLICAND+2] ld a, [H_MULTIPLICAND+2]
@ -3780,17 +3780,17 @@ CalcStat:: ; 394a (0:394a)
ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10 ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10
.noCarry4 .noCarry4
ld a, [H_MULTIPLICAND+1] ; check for overflow (>999) ld a, [H_MULTIPLICAND+1] ; check for overflow (>999)
cp $4 cp 999 / $100 + 1
jr nc, .overflow jr nc, .overflow
cp $3 cp 999 / $100
jr c, .noOverflow jr c, .noOverflow
ld a, [H_MULTIPLICAND+2] ld a, [H_MULTIPLICAND+2]
cp $e8 cp 999 % $100 + 1
jr c, .noOverflow jr c, .noOverflow
.overflow .overflow
ld a, $3 ; overflow: cap at 999 ld a, 999 / $100 ; overflow: cap at 999
ld [H_MULTIPLICAND+1], a ld [H_MULTIPLICAND+1], a
ld a, $e7 ld a, 999 % $100
ld [H_MULTIPLICAND+2], a ld [H_MULTIPLICAND+2], a
.noOverflow .noOverflow
pop bc pop bc

View file

@ -3691,7 +3691,7 @@ _AddPartyMon: ; f2e5 (3:72e5)
inc de inc de
jr .copyMonTypesAndMoves jr .copyMonTypesAndMoves
.copyEnemyMonData .copyEnemyMonData
ld bc, wPartyMon1DVs - wPartyMon1 ld bc, wEnemyMon1DVs - wEnemyMon1
add hl, bc add hl, bc
ld a, [wEnemyMonDVs] ; copy IVs from cur enemy mon ld a, [wEnemyMonDVs] ; copy IVs from cur enemy mon
ld [hli], a ld [hli], a
@ -3762,7 +3762,7 @@ _AddPartyMon: ; f2e5 (3:72e5)
ld a, [hExperience + 2] ld a, [hExperience + 2]
ld [de], a ld [de], a
xor a xor a
ld b, $a ld b, NUM_STATS * 2
.writeEVsLoop ; set all EVs to 0 .writeEVsLoop ; set all EVs to 0
inc de inc de
ld [de], a ld [de], a
@ -3786,7 +3786,7 @@ _AddPartyMon: ; f2e5 (3:72e5)
jr .done jr .done
.calcFreshStats .calcFreshStats
pop hl pop hl
ld bc, $10 ld bc, wPartyMon1HPExp - 1 - wPartyMon1
add hl, bc add hl, bc
ld b, $0 ld b, $0
call CalcStats ; calculate fresh set of stats call CalcStats ; calculate fresh set of stats
@ -3798,7 +3798,7 @@ LoadMovePPs: ; f473 (3:7473)
call GetPredefRegisters call GetPredefRegisters
; fallthrough ; fallthrough
AddPartyMon_WriteMovePP: ; f476 (3:7476) AddPartyMon_WriteMovePP: ; f476 (3:7476)
ld b, $4 ld b, NUM_MOVES
.pploop .pploop
ld a, [hli] ; read move ID ld a, [hli] ; read move ID
and a and a