mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-04-03 18:11:42 +13:00
Merge pull request #90 from xCrystal/master
Rename/split battle and move effect files. Battle functions, AI, and attack animations
This commit is contained in:
commit
c2efe700ac
45 changed files with 2092 additions and 2035 deletions
|
|
@ -1,77 +0,0 @@
|
|||
; returns whether the player is one tile outside the map in Z
|
||||
IsPlayerJustOutsideMap: ; 128d8 (4:68d8)
|
||||
ld a, [W_YCOORD]
|
||||
ld b, a
|
||||
ld a, [W_CURMAPHEIGHT]
|
||||
call .compareCoordWithMapDimension
|
||||
ret z
|
||||
ld a, [W_XCOORD]
|
||||
ld b, a
|
||||
ld a, [W_CURMAPWIDTH]
|
||||
.compareCoordWithMapDimension
|
||||
add a
|
||||
cp b
|
||||
ret z
|
||||
inc b
|
||||
ret
|
||||
|
||||
DrawHP: ; 128ef (4:68ef)
|
||||
call GetPredefRegisters
|
||||
ld a, $1
|
||||
jr DrawHP_
|
||||
|
||||
DrawHP2: ; 128f6 (4:68f6)
|
||||
call GetPredefRegisters
|
||||
ld a, $2
|
||||
|
||||
DrawHP_: ; 128fb (4:68fb)
|
||||
ld [wHPBarType], a
|
||||
push hl
|
||||
ld a, [wLoadedMonHP]
|
||||
ld b, a
|
||||
ld a, [wLoadedMonHP + 1]
|
||||
ld c, a
|
||||
or b
|
||||
jr nz, .nonzeroHP
|
||||
xor a
|
||||
ld c, a
|
||||
ld e, a
|
||||
ld a, $6
|
||||
ld d, a
|
||||
jp .drawHPBarAndPrintFraction
|
||||
.nonzeroHP
|
||||
ld a, [wLoadedMonMaxHP]
|
||||
ld d, a
|
||||
ld a, [wLoadedMonMaxHP + 1]
|
||||
ld e, a
|
||||
predef HPBarLength
|
||||
ld a, $6
|
||||
ld d, a
|
||||
ld c, a
|
||||
.drawHPBarAndPrintFraction
|
||||
pop hl
|
||||
push de
|
||||
push hl
|
||||
push hl
|
||||
call DrawHPBar
|
||||
pop hl
|
||||
ld a, [hFlags_0xFFF6]
|
||||
bit 0, a
|
||||
jr z, .printFractionBelowBar
|
||||
ld bc, $9 ; right of bar
|
||||
jr .printFraction
|
||||
.printFractionBelowBar
|
||||
ld bc, SCREEN_WIDTH + 1 ; below bar
|
||||
.printFraction
|
||||
add hl, bc
|
||||
ld de, wLoadedMonHP
|
||||
ld bc, $203
|
||||
call PrintNumber
|
||||
ld a, "/"
|
||||
ld [hli], a
|
||||
ld de, wLoadedMonMaxHP
|
||||
ld bc, $203
|
||||
call PrintNumber
|
||||
pop hl
|
||||
pop de
|
||||
ret
|
||||
|
|
@ -1,413 +0,0 @@
|
|||
EndOfBattle: ; 137aa (4:77aa)
|
||||
ld a, [wLinkState]
|
||||
cp LINK_STATE_BATTLING
|
||||
jr nz, .notLinkBattle
|
||||
; link battle
|
||||
ld a, [wEnemyMonPartyPos]
|
||||
ld hl, wEnemyMon1Status
|
||||
ld bc, wEnemyMon2 - wEnemyMon1
|
||||
call AddNTimes
|
||||
ld a, [wEnemyMonStatus]
|
||||
ld [hl], a
|
||||
call ClearScreen
|
||||
callab DisplayLinkBattleVersusTextBox
|
||||
ld a, [wBattleResult]
|
||||
cp $1
|
||||
ld de, YouWinText
|
||||
jr c, .placeWinOrLoseString
|
||||
ld de, YouLoseText
|
||||
jr z, .placeWinOrLoseString
|
||||
ld de, DrawText
|
||||
.placeWinOrLoseString
|
||||
hlCoord 6, 8
|
||||
call PlaceString
|
||||
ld c, $c8
|
||||
call DelayFrames
|
||||
jr .evolution
|
||||
.notLinkBattle
|
||||
ld a, [wBattleResult]
|
||||
and a
|
||||
jr nz, .resetVariables
|
||||
ld hl, wTotalPayDayMoney
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
inc hl
|
||||
or [hl]
|
||||
jr z, .evolution ; if pay day money is 0, jump
|
||||
ld de, wPlayerMoney + 2
|
||||
ld c, $3
|
||||
predef AddBCDPredef
|
||||
ld hl, PickUpPayDayMoneyText
|
||||
call PrintText
|
||||
.evolution
|
||||
xor a
|
||||
ld [wccd4], a
|
||||
predef EvolutionAfterBattle
|
||||
.resetVariables
|
||||
xor a
|
||||
ld [wLowHealthAlarm], a ;disable low health alarm
|
||||
ld [wc02a], a
|
||||
ld [W_ISINBATTLE], a
|
||||
ld [W_BATTLETYPE], a
|
||||
ld [W_MOVEMISSED], a
|
||||
ld [W_CUROPPONENT], a
|
||||
ld [wd11f], a
|
||||
ld [wNumRunAttempts], a
|
||||
ld [wEscapedFromBattle], a
|
||||
ld hl, wcc2b
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld [wListScrollOffset], a
|
||||
ld hl, wPlayerStatsToDouble
|
||||
ld b, $18
|
||||
.loop
|
||||
ld [hli], a
|
||||
dec b
|
||||
jr nz, .loop
|
||||
ld hl, wd72c
|
||||
set 0, [hl]
|
||||
call WaitForSoundToFinish
|
||||
call GBPalWhiteOut
|
||||
ld a, $ff
|
||||
ld [wDestinationWarpID], a
|
||||
ret
|
||||
|
||||
YouWinText: ; 13853 (4:7853)
|
||||
db "YOU WIN@"
|
||||
|
||||
YouLoseText: ; 1385b (4:785b)
|
||||
db "YOU LOSE@"
|
||||
|
||||
DrawText: ; 13864 (4:7864)
|
||||
db " DRAW@"
|
||||
|
||||
PickUpPayDayMoneyText: ; 1386b (4:786b)
|
||||
TX_FAR _PickUpPayDayMoneyText
|
||||
db "@"
|
||||
|
||||
; try to initiate a wild pokemon encounter
|
||||
; returns success in Z
|
||||
TryDoWildEncounter: ; 13870 (4:7870)
|
||||
ld a, [wNPCMovementScriptPointerTableNum]
|
||||
and a
|
||||
ret nz
|
||||
ld a, [wd736]
|
||||
and a
|
||||
ret nz
|
||||
callab IsPlayerStandingOnDoorTileOrWarpTile
|
||||
jr nc, .notStandingOnDoorOrWarpTile
|
||||
.CantEncounter
|
||||
ld a, $1
|
||||
and a
|
||||
ret
|
||||
.notStandingOnDoorOrWarpTile
|
||||
callab IsPlayerJustOutsideMap
|
||||
jr z, .CantEncounter
|
||||
ld a, [wRepelRemainingSteps]
|
||||
and a
|
||||
jr z, .asm_1389e
|
||||
dec a
|
||||
jr z, .lastRepelStep
|
||||
ld [wRepelRemainingSteps], a
|
||||
.asm_1389e
|
||||
; determine if wild pokémon can appear in the half-block we’re standing in
|
||||
; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile?
|
||||
hlCoord 9, 9
|
||||
ld c, [hl]
|
||||
ld a, [W_GRASSTILE]
|
||||
cp c
|
||||
ld a, [W_GRASSRATE]
|
||||
jr z, .CanEncounter
|
||||
ld a, $14 ; in all tilesets with a water tile, this is its id
|
||||
cp c
|
||||
ld a, [W_WATERRATE]
|
||||
jr z, .CanEncounter
|
||||
; even if not in grass/water, standing anywhere we can encounter pokémon
|
||||
; so long as the map is “indoor” and has wild pokémon defined.
|
||||
; …as long as it’s not Viridian Forest or Safari Zone.
|
||||
ld a, [W_CURMAP]
|
||||
cp REDS_HOUSE_1F ; is this an indoor map?
|
||||
jr c, .CantEncounter2
|
||||
ld a, [W_CURMAPTILESET]
|
||||
cp FOREST ; Viridian Forest/Safari Zone
|
||||
jr z, .CantEncounter2
|
||||
ld a, [W_GRASSRATE]
|
||||
.CanEncounter
|
||||
; compare encounter chance with a random number to determine if there will be an encounter
|
||||
ld b, a
|
||||
ld a, [hRandomAdd]
|
||||
cp b
|
||||
jr nc, .CantEncounter2
|
||||
ld a, [hRandomSub]
|
||||
ld b, a
|
||||
ld hl, WildMonEncounterSlotChances
|
||||
.determineEncounterSlot
|
||||
ld a, [hli]
|
||||
cp b
|
||||
jr nc, .gotEncounterSlot
|
||||
inc hl
|
||||
jr .determineEncounterSlot
|
||||
.gotEncounterSlot
|
||||
; determine which wild pokémon (grass or water) can appear in the half-block we’re standing in
|
||||
ld c, [hl]
|
||||
ld hl, W_GRASSMONS
|
||||
aCoord 8, 9
|
||||
cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile?
|
||||
jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default
|
||||
ld hl, W_WATERMONS
|
||||
; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not,
|
||||
; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters.
|
||||
.gotWildEncounterType
|
||||
ld b, $0
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
ld [W_CURENEMYLVL], a
|
||||
ld a, [hl]
|
||||
ld [wcf91], a
|
||||
ld [wEnemyMonSpecies2], a
|
||||
ld a, [wRepelRemainingSteps]
|
||||
and a
|
||||
jr z, .willEncounter
|
||||
ld a, [wPartyMon1Level]
|
||||
ld b, a
|
||||
ld a, [W_CURENEMYLVL]
|
||||
cp b
|
||||
jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon
|
||||
jr .willEncounter
|
||||
.lastRepelStep
|
||||
ld [wRepelRemainingSteps], a
|
||||
ld a, $d2
|
||||
ld [H_DOWNARROWBLINKCNT2], a
|
||||
call EnableAutoTextBoxDrawing
|
||||
call DisplayTextID
|
||||
.CantEncounter2
|
||||
ld a, $1
|
||||
and a
|
||||
ret
|
||||
.willEncounter
|
||||
xor a
|
||||
ret
|
||||
|
||||
WildMonEncounterSlotChances: ; 13918 (4:7918)
|
||||
; There are 10 slots for wild pokemon, and this is the table that defines how common each of
|
||||
; those 10 slots is. A random number is generated and then the first byte of each pair in this
|
||||
; table is compared against that random number. If the random number is less than or equal
|
||||
; to the first byte, then that slot is chosen. The second byte is double the slot number.
|
||||
db $32, $00 ; 51/256 = 19.9% chance of slot 0
|
||||
db $65, $02 ; 51/256 = 19.9% chance of slot 1
|
||||
db $8C, $04 ; 39/256 = 15.2% chance of slot 2
|
||||
db $A5, $06 ; 25/256 = 9.8% chance of slot 3
|
||||
db $BE, $08 ; 25/256 = 9.8% chance of slot 4
|
||||
db $D7, $0A ; 25/256 = 9.8% chance of slot 5
|
||||
db $E4, $0C ; 13/256 = 5.1% chance of slot 6
|
||||
db $F1, $0E ; 13/256 = 5.1% chance of slot 7
|
||||
db $FC, $10 ; 11/256 = 4.3% chance of slot 8
|
||||
db $FF, $12 ; 3/256 = 1.2% chance of slot 9
|
||||
|
||||
RecoilEffect_: ; 1392c (4:792c)
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [W_PLAYERMOVENUM]
|
||||
ld hl, wBattleMonMaxHP
|
||||
jr z, .asm_1393d
|
||||
ld a, [W_ENEMYMOVENUM]
|
||||
ld hl, wEnemyMonMaxHP
|
||||
.asm_1393d
|
||||
ld d, a
|
||||
ld a, [W_DAMAGE]
|
||||
ld b, a
|
||||
ld a, [W_DAMAGE + 1]
|
||||
ld c, a
|
||||
srl b
|
||||
rr c
|
||||
ld a, d
|
||||
cp STRUGGLE
|
||||
jr z, .asm_13953
|
||||
srl b
|
||||
rr c
|
||||
.asm_13953
|
||||
ld a, b
|
||||
or c
|
||||
jr nz, .asm_13958
|
||||
inc c
|
||||
.asm_13958
|
||||
ld a, [hli]
|
||||
ld [wHPBarMaxHP+1], a
|
||||
ld a, [hl]
|
||||
ld [wHPBarMaxHP], a
|
||||
push bc
|
||||
ld bc, $fff2
|
||||
add hl, bc
|
||||
pop bc
|
||||
ld a, [hl]
|
||||
ld [wHPBarOldHP], a
|
||||
sub c
|
||||
ld [hld], a
|
||||
ld [wHPBarNewHP], a
|
||||
ld a, [hl]
|
||||
ld [wHPBarOldHP+1], a
|
||||
sbc b
|
||||
ld [hl], a
|
||||
ld [wHPBarNewHP+1], a
|
||||
jr nc, .asm_13982
|
||||
xor a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld hl, wHPBarNewHP
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
.asm_13982
|
||||
hlCoord 10, 9
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, $1
|
||||
jr z, .asm_13990
|
||||
hlCoord 2, 2
|
||||
xor a
|
||||
.asm_13990
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2
|
||||
ld hl, HitWithRecoilText
|
||||
jp PrintText
|
||||
HitWithRecoilText: ; 1399e (4:799e)
|
||||
TX_FAR _HitWithRecoilText
|
||||
db "@"
|
||||
|
||||
ConversionEffect_: ; 139a3 (4:79a3)
|
||||
ld hl, wEnemyMonType1
|
||||
ld de, wBattleMonType1
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [W_ENEMYBATTSTATUS1]
|
||||
jr z, .asm_139b8
|
||||
push hl
|
||||
ld h, d
|
||||
ld l, e
|
||||
pop de
|
||||
ld a, [W_PLAYERBATTSTATUS1]
|
||||
.asm_139b8
|
||||
bit Invulnerable, a ; is mon immune to typical attacks (dig/fly)
|
||||
jr nz, PrintButItFailedText
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call CallBankF
|
||||
ld hl, ConvertedTypeText
|
||||
jp PrintText
|
||||
|
||||
ConvertedTypeText: ; 139cd (4:79cd)
|
||||
TX_FAR _ConvertedTypeText
|
||||
db "@"
|
||||
|
||||
PrintButItFailedText: ; 139d2 (4:79d2)
|
||||
ld hl, PrintButItFailedText_
|
||||
CallBankF: ; 139d5 (4:79d5)
|
||||
ld b, BANK(PrintButItFailedText_)
|
||||
jp Bankswitch
|
||||
|
||||
HazeEffect_: ; 139da (4:79da)
|
||||
ld a, $7
|
||||
ld hl, wPlayerMonAttackMod
|
||||
call ResetStatMods
|
||||
ld hl, wEnemyMonAttackMod
|
||||
call ResetStatMods
|
||||
ld hl, wPlayerMonUnmodifiedAttack
|
||||
ld de, wBattleMonAttack
|
||||
call ResetStats
|
||||
ld hl, wEnemyMonUnmodifiedAttack
|
||||
ld de, wEnemyMonAttack
|
||||
call ResetStats
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, wEnemySelectedMove
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_13a09
|
||||
ld hl, wBattleMonStatus
|
||||
dec de
|
||||
|
||||
.asm_13a09
|
||||
ld a, [hl]
|
||||
ld [hl], $0
|
||||
and $27
|
||||
jr z, .asm_13a13
|
||||
ld a, $ff
|
||||
ld [de], a
|
||||
|
||||
.asm_13a13
|
||||
xor a
|
||||
ld [W_PLAYERDISABLEDMOVE], a
|
||||
ld [W_ENEMYDISABLEDMOVE], a
|
||||
ld hl, wccee
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld hl, W_PLAYERBATTSTATUS1
|
||||
call CureStatuses
|
||||
ld hl, W_ENEMYBATTSTATUS1
|
||||
call CureStatuses
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call CallBankF
|
||||
ld hl, StatusChangesEliminatedText
|
||||
jp PrintText
|
||||
|
||||
CureStatuses: ; 13a37 (4:7a37)
|
||||
res Confused, [hl]
|
||||
inc hl ; BATTSTATUS2
|
||||
ld a, [hl]
|
||||
and (1 << UsingRage) | (1 << NeedsToRecharge) | (1 << HasSubstituteUp) | (1 << 3) ; clear all but these from BATTSTATUS2
|
||||
ld [hli], a ; BATTSTATUS3
|
||||
ld a, [hl]
|
||||
and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
ResetStatMods: ; 13a43 (4:7a43)
|
||||
ld b, $8
|
||||
.loop
|
||||
ld [hli], a
|
||||
dec b
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
ResetStats: ; 13a4a (4:7a4a)
|
||||
ld b, $8
|
||||
.loop
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
StatusChangesEliminatedText: ; 13a53 (4:7a53)
|
||||
TX_FAR _StatusChangesEliminatedText
|
||||
db "@"
|
||||
|
||||
GetTrainerName_: ; 13a58 (4:7a58)
|
||||
ld hl, W_GRASSRATE
|
||||
ld a, [wLinkState]
|
||||
and a
|
||||
jr nz, .rival
|
||||
ld hl, W_RIVALNAME
|
||||
ld a, [W_TRAINERCLASS]
|
||||
cp SONY1
|
||||
jr z, .rival
|
||||
cp SONY2
|
||||
jr z, .rival
|
||||
cp SONY3
|
||||
jr z, .rival
|
||||
ld [wd0b5], a
|
||||
ld a, TRAINER_NAME
|
||||
ld [wNameListType], a
|
||||
ld a, BANK(TrainerNames)
|
||||
ld [wPredefBank], a
|
||||
call GetName
|
||||
ld hl, wcd6d
|
||||
.rival
|
||||
ld de, W_TRAINERNAME
|
||||
ld bc, $d
|
||||
jp CopyData
|
||||
|
|
@ -407,7 +407,7 @@ MoveAnimation: ; 78d5e (1e:4d5e)
|
|||
ld c,30
|
||||
call DelayFrames
|
||||
.next4
|
||||
call Func_78dbd ; reload pic and flash the pic in and out (to show damage)
|
||||
call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage)
|
||||
.AnimationFinished
|
||||
call WaitForSoundToFinish
|
||||
xor a
|
||||
|
|
@ -445,56 +445,58 @@ ShareMoveAnimations: ; 78da6 (1e:4da6)
|
|||
ld [W_ANIMATIONID],a
|
||||
ret
|
||||
|
||||
Func_78dbd: ; 78dbd (1e:4dbd)
|
||||
ld a,[wcc5b]
|
||||
PlayApplyingAttackAnimation: ; 78dbd (1e:4dbd)
|
||||
; Generic animation that shows after the move's individual animation
|
||||
; Different animation depending on whether the move has an additional effect and on whose turn it is
|
||||
ld a,[wAnimationType]
|
||||
and a
|
||||
ret z
|
||||
dec a
|
||||
add a
|
||||
ld c,a
|
||||
ld b,0
|
||||
ld hl,PointerTable_78dcf
|
||||
ld hl,AnimationTypePointerTable
|
||||
add hl,bc
|
||||
ld a,[hli]
|
||||
ld h,[hl]
|
||||
ld l,a
|
||||
jp [hl]
|
||||
|
||||
PointerTable_78dcf: ; 78dcf (1e:4dcf)
|
||||
dw Func_78ddb
|
||||
dw Func_78de3
|
||||
dw Func_78deb
|
||||
dw Func_78df0
|
||||
dw Func_78df6
|
||||
dw Func_78dfe
|
||||
AnimationTypePointerTable: ; 78dcf (1e:4dcf)
|
||||
dw ShakeScreenVertically ; enemy mon has used a damaging move without a side effect
|
||||
dw ShakeScreenHorizontallyHeavy ; enemy mon has used a damaging move with a side effect
|
||||
dw ShakeScreenHorizontallySlow ; enemy mon has used a non-damaging move
|
||||
dw BlinkEnemyMonSprite ; player mon has used a damaging move without a side effect
|
||||
dw ShakeScreenHorizontallyLight ; player mon has used a damaging move with a side effect
|
||||
dw ShakeScreenHorizontallySlow2 ; player mon has used a non-damaging move
|
||||
|
||||
Func_78ddb: ; 78ddb (1e:4ddb)
|
||||
call Func_79e6a
|
||||
ShakeScreenVertically: ; 78ddb (1e:4ddb)
|
||||
call PlayApplyingAttackSound
|
||||
ld b, $8
|
||||
jp Func_79209
|
||||
jp AnimationShakeScreenVertically
|
||||
|
||||
Func_78de3: ; 78de3 (1e:4de3)
|
||||
call Func_79e6a
|
||||
ShakeScreenHorizontallyHeavy: ; 78de3 (1e:4de3)
|
||||
call PlayApplyingAttackSound
|
||||
ld b, $8
|
||||
jp Func_79210
|
||||
jp AnimationShakeScreenHorizontallyFast
|
||||
|
||||
Func_78deb: ; 78deb (1e:4deb)
|
||||
ShakeScreenHorizontallySlow: ; 78deb (1e:4deb)
|
||||
ld bc, $602
|
||||
jr Func_78e01
|
||||
jr AnimationShakeScreenHorizontallySlow
|
||||
|
||||
Func_78df0: ; 78df0 (1e:4df0)
|
||||
call Func_79e6a
|
||||
BlinkEnemyMonSprite: ; 78df0 (1e:4df0)
|
||||
call PlayApplyingAttackSound
|
||||
jp AnimationBlinkEnemyMon
|
||||
|
||||
Func_78df6: ; 78df6 (1e:4df6)
|
||||
call Func_79e6a
|
||||
ShakeScreenHorizontallyLight: ; 78df6 (1e:4df6)
|
||||
call PlayApplyingAttackSound
|
||||
ld b, $2
|
||||
jp Func_79210
|
||||
jp AnimationShakeScreenHorizontallyFast
|
||||
|
||||
Func_78dfe: ; 78dfe (1e:4dfe)
|
||||
ShakeScreenHorizontallySlow2: ; 78dfe (1e:4dfe)
|
||||
ld bc, $302
|
||||
|
||||
Func_78e01: ; 78e01 (1e:4e01)
|
||||
AnimationShakeScreenHorizontallySlow: ; 78e01 (1e:4e01)
|
||||
push bc
|
||||
push bc
|
||||
.asm_78e03
|
||||
|
|
@ -516,7 +518,7 @@ Func_78e01: ; 78e01 (1e:4e01)
|
|||
jr nz, .asm_78e11
|
||||
pop bc
|
||||
dec c
|
||||
jr nz, Func_78e01
|
||||
jr nz, AnimationShakeScreenHorizontallySlow
|
||||
ret
|
||||
|
||||
Func_78e23: ; 78e23 (1e:4e23)
|
||||
|
|
@ -1225,14 +1227,14 @@ Func_791fc: ; 791fc (1e:51fc)
|
|||
|
||||
ld b, $5
|
||||
|
||||
Func_79209: ; 79209 (1e:5209)
|
||||
AnimationShakeScreenVertically: ; 79209 (1e:5209)
|
||||
predef_jump Func_480ff
|
||||
|
||||
AnimationShakeScreen: ; 7920e (1e:520e)
|
||||
; Shakes the screen for a while. Used in Earthquake/Fissure/etc. animations.
|
||||
ld b, $8
|
||||
|
||||
Func_79210: ; 79210 (1e:5210)
|
||||
AnimationShakeScreenHorizontallyFast: ; 79210 (1e:5210)
|
||||
predef_jump Func_48125
|
||||
|
||||
AnimationWaterDropletsEverywhere: ; 79215 (1e:5215)
|
||||
|
|
@ -2929,9 +2931,11 @@ TossBallAnimation: ; 79e16 (1e:5e16)
|
|||
ld [W_ANIMATIONID],a
|
||||
jp PlayAnimation
|
||||
|
||||
Func_79e6a: ; 79e6a (1e:5e6a)
|
||||
PlayApplyingAttackSound: ; 79e6a (1e:5e6a)
|
||||
; play a different sound depending if move is not very effective, neutral, or super-effective
|
||||
; don't play any sound at all if move is ineffective
|
||||
call WaitForSoundToFinish
|
||||
ld a, [wd05b]
|
||||
ld a, [wDamageMultipliers]
|
||||
and $7f
|
||||
ret z
|
||||
cp $a
|
||||
|
|
|
|||
122
engine/battle/bank_e_misc.asm
Normal file
122
engine/battle/bank_e_misc.asm
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
; formats a string at wMovesString that lists the moves at wMoves
|
||||
FormatMovesString: ; 39b87 (e:5b87)
|
||||
ld hl, wMoves
|
||||
ld de, wMovesString
|
||||
ld b, $0
|
||||
.printMoveNameLoop
|
||||
ld a, [hli]
|
||||
and a ; end of move list?
|
||||
jr z, .printDashLoop ; print dashes when no moves are left
|
||||
push hl
|
||||
ld [wd0b5], a
|
||||
ld a, BANK(MoveNames)
|
||||
ld [wPredefBank], a
|
||||
ld a, MOVE_NAME
|
||||
ld [wNameListType], a
|
||||
call GetName
|
||||
ld hl, wcd6d
|
||||
.copyNameLoop
|
||||
ld a, [hli]
|
||||
cp $50
|
||||
jr z, .doneCopyingName
|
||||
ld [de], a
|
||||
inc de
|
||||
jr .copyNameLoop
|
||||
.doneCopyingName
|
||||
ld a, b
|
||||
ld [wcd6c], a
|
||||
inc b
|
||||
ld a, $4e ; line break
|
||||
ld [de], a
|
||||
inc de
|
||||
pop hl
|
||||
ld a, b
|
||||
cp NUM_MOVES
|
||||
jr z, .done
|
||||
jr .printMoveNameLoop
|
||||
.printDashLoop
|
||||
ld a, "-"
|
||||
ld [de], a
|
||||
inc de
|
||||
inc b
|
||||
ld a, b
|
||||
cp NUM_MOVES
|
||||
jr z, .done
|
||||
ld a, $4e ; line break
|
||||
ld [de], a
|
||||
inc de
|
||||
jr .printDashLoop
|
||||
.done
|
||||
ld a, "@"
|
||||
ld [de], a
|
||||
ret
|
||||
|
||||
; XXX this is called in a few places, but it doesn't appear to do anything useful
|
||||
Func_39bd5: ; 39bd5 (e:5bd5)
|
||||
ld a, [wd11b]
|
||||
cp $1
|
||||
jr nz, .asm_39be6
|
||||
ld hl, wEnemyPartyCount
|
||||
ld de, wEnemyMonOT
|
||||
ld a, ENEMYOT_NAME
|
||||
jr .asm_39c18
|
||||
.asm_39be6
|
||||
cp $4
|
||||
jr nz, .calcAttackStat4
|
||||
ld hl, wPartyCount
|
||||
ld de, wPartyMonOT
|
||||
ld a, PLAYEROT_NAME
|
||||
jr .asm_39c18
|
||||
.calcAttackStat4
|
||||
cp $5
|
||||
jr nz, .asm_39c02
|
||||
ld hl, wStringBuffer2 + 11
|
||||
ld de, MonsterNames
|
||||
ld a, MONSTER_NAME
|
||||
jr .asm_39c18
|
||||
.asm_39c02
|
||||
cp $2
|
||||
jr nz, .asm_39c10
|
||||
ld hl, wNumBagItems
|
||||
ld de, ItemNames
|
||||
ld a, ITEM_NAME
|
||||
jr .asm_39c18
|
||||
.asm_39c10
|
||||
ld hl, wStringBuffer2 + 11
|
||||
ld de, ItemNames
|
||||
ld a, ITEM_NAME
|
||||
.asm_39c18
|
||||
ld [wNameListType], a
|
||||
ld a, l
|
||||
ld [wList], a
|
||||
ld a, h
|
||||
ld [wList + 1], a
|
||||
ld a, e
|
||||
ld [wcf8d], a
|
||||
ld a, d
|
||||
ld [wcf8e], a
|
||||
ld bc, ItemPrices
|
||||
ld a, c
|
||||
ld [wItemPrices], a
|
||||
ld a, b
|
||||
ld [wItemPrices + 1], a
|
||||
ret
|
||||
|
||||
; get species of mon e in list [wcc49] for LoadMonData
|
||||
GetMonSpecies: ; 39c37 (e:5c37)
|
||||
ld hl, wPartySpecies
|
||||
ld a, [wcc49]
|
||||
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
|
||||
90
engine/battle/1c.asm → engine/battle/battle_transitions.asm
Executable file → Normal file
90
engine/battle/1c.asm → engine/battle/battle_transitions.asm
Executable file → Normal file
|
|
@ -1,93 +1,3 @@
|
|||
MarowakAnim: ; 708ca (1c:48ca)
|
||||
; animate the ghost being unveiled as a Marowak
|
||||
ld a, $e4
|
||||
ld [rOBP1], a
|
||||
call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same
|
||||
; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap
|
||||
hlCoord 12, 0
|
||||
ld bc, $707
|
||||
call ClearScreenArea
|
||||
call Delay3
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a ; disable BG transfer so we don't see the Marowak too soon
|
||||
; replace ghost pic with Marowak in BG
|
||||
ld a, MAROWAK
|
||||
ld [wHPBarMaxHP], a
|
||||
ld a, $1
|
||||
ld [H_WHOSETURN], a
|
||||
callab Func_79793
|
||||
; alternate between black and light grey 8 times.
|
||||
; this makes the ghost's body appear to flash
|
||||
ld d, $80
|
||||
call FlashSprite8Times
|
||||
.fadeOutGhostLoop
|
||||
ld c, 10
|
||||
call DelayFrames
|
||||
ld a, [rOBP1]
|
||||
sla a
|
||||
sla a
|
||||
ld [rOBP1], a
|
||||
jr nz, .fadeOutGhostLoop
|
||||
call ClearSprites
|
||||
call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM
|
||||
ld b, $e4
|
||||
.fadeInMarowakLoop
|
||||
ld c, 10
|
||||
call DelayFrames
|
||||
ld a, [rOBP1]
|
||||
srl b
|
||||
rra
|
||||
srl b
|
||||
rra
|
||||
ld [rOBP1], a
|
||||
ld a, b
|
||||
and a
|
||||
jr nz, .fadeInMarowakLoop
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
|
||||
call Delay3
|
||||
jp ClearSprites
|
||||
|
||||
; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM
|
||||
CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a)
|
||||
ld de, vFrontPic
|
||||
ld hl, vSprites
|
||||
ld bc, 7 * 7
|
||||
call CopyVideoData
|
||||
ld a, $10
|
||||
ld [W_BASECOORDY], a
|
||||
ld a, $70
|
||||
ld [W_BASECOORDX], a
|
||||
ld hl, wOAMBuffer
|
||||
ld bc, $606
|
||||
ld d, $8
|
||||
.oamLoop
|
||||
push bc
|
||||
ld a, [W_BASECOORDY]
|
||||
ld e, a
|
||||
.oamInnerLoop
|
||||
ld a, e
|
||||
add $8
|
||||
ld e, a
|
||||
ld [hli], a
|
||||
ld a, [W_BASECOORDX]
|
||||
ld [hli], a
|
||||
ld a, d
|
||||
ld [hli], a
|
||||
ld a, $10 ; use OBP1
|
||||
ld [hli], a
|
||||
inc d
|
||||
dec c
|
||||
jr nz, .oamInnerLoop
|
||||
inc d
|
||||
ld a, [W_BASECOORDX]
|
||||
add $8
|
||||
ld [W_BASECOORDX], a
|
||||
pop bc
|
||||
dec b
|
||||
jr nz, .oamLoop
|
||||
ret
|
||||
|
||||
BattleTransition: ; 7096d (1c:496d)
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
0
engine/battle/16.asm → engine/battle/common_text.asm
Executable file → Normal file
0
engine/battle/16.asm → engine/battle/common_text.asm
Executable file → Normal file
|
|
@ -454,7 +454,8 @@ MainInBattleLoop: ; 3c233 (f:4233)
|
|||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp METRONOME ; a MIRROR MOVE check is missing, might lead to a desync in link battles when combined with multi-turn moves
|
||||
cp METRONOME ; a MIRROR MOVE check is missing, might lead to a desync in link battles
|
||||
; when combined with multi-turn moves
|
||||
jr nz, .asm_3c2dd
|
||||
ld [wPlayerSelectedMove], a
|
||||
.asm_3c2dd
|
||||
|
|
@ -581,7 +582,7 @@ HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd)
|
|||
.poisoned
|
||||
call PrintText
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld a,BURN_PSN_ANIM
|
||||
call PlayMoveAnimation ; play burn/poison animation
|
||||
pop hl
|
||||
|
|
@ -602,7 +603,7 @@ HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd)
|
|||
xor $1
|
||||
ld [H_WHOSETURN], a
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld a,ABSORB
|
||||
call PlayMoveAnimation ; play leech seed animation (from opposing mon)
|
||||
pop af
|
||||
|
|
@ -874,7 +875,7 @@ FaintEnemyPokemon ; 0x3c567
|
|||
call WaitForSoundToFinish
|
||||
jr .sfxplayed
|
||||
.wild_win
|
||||
call Func_3c643
|
||||
call EndLowHealthAlarm
|
||||
ld a, MUSIC_DEFEATED_WILD_MON
|
||||
call PlayBattleVictoryMusic
|
||||
.sfxplayed
|
||||
|
|
@ -918,7 +919,7 @@ FaintEnemyPokemon ; 0x3c567
|
|||
; if exp all is in the bag, this will be only be half of the stat exp and normal exp, due to the above loop
|
||||
.giveExpToMonsThatFought
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wBoostExpByExpAll], a
|
||||
callab GainExperience
|
||||
pop af
|
||||
ret z ; return if no exp all
|
||||
|
|
@ -927,7 +928,7 @@ FaintEnemyPokemon ; 0x3c567
|
|||
; now, set the gain exp flag for every party member
|
||||
; half of the total stat exp and normal exp will divided evenly amongst every party member
|
||||
ld a, $1
|
||||
ld [wcc5b], a
|
||||
ld [wBoostExpByExpAll], a
|
||||
ld a, [wPartyCount]
|
||||
ld b, 0
|
||||
.gainExpFlagsLoop
|
||||
|
|
@ -945,7 +946,7 @@ EnemyMonFaintedText: ; 0x3c63e
|
|||
TX_FAR _EnemyMonFaintedText
|
||||
db "@"
|
||||
|
||||
Func_3c643: ; 3c643 (f:4643)
|
||||
EndLowHealthAlarm: ; 3c643 (f:4643)
|
||||
xor a
|
||||
ld [wLowHealthAlarm], a ;disable low health alarm
|
||||
ld [wc02a], a
|
||||
|
|
@ -990,12 +991,12 @@ ReplaceFaintedEnemyMon: ; 3c664 (f:4664)
|
|||
xor a
|
||||
ld [W_ENEMYMOVENUM], a
|
||||
ld [wcd6a], a
|
||||
ld [wccd5], a
|
||||
ld [wAILayer2Encouragement], a
|
||||
inc a ; reset Z flag
|
||||
ret
|
||||
|
||||
TrainerBattleVictory: ; 3c696 (f:4696)
|
||||
call Func_3c643
|
||||
call EndLowHealthAlarm
|
||||
ld b, MUSIC_DEFEATED_GYM_LEADER
|
||||
ld a, [W_GYMLEADERNO]
|
||||
and a
|
||||
|
|
@ -1640,7 +1641,8 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
|
|||
ld b, a
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
cp b
|
||||
jr nc, .canEscape ; if the random value was less than or equal to the quotient plus 30 times the number of attempts, the player can escape
|
||||
jr nc, .canEscape ; if the random value was less than or equal to the quotient
|
||||
; plus 30 times the number of attempts, the player can escape
|
||||
; can't escape
|
||||
ld a, $1
|
||||
ld [wcd6a], a
|
||||
|
|
@ -1809,8 +1811,8 @@ SendOutMon: ; 3cc91 (f:4c91)
|
|||
ld hl, wcc2d
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld [wcc5b], a
|
||||
ld [wd05b], a
|
||||
ld [wBoostExpByExpAll], a
|
||||
ld [wDamageMultipliers], a
|
||||
ld [W_PLAYERMOVENUM], a
|
||||
ld hl, wPlayerUsedMove
|
||||
ld [hli], a
|
||||
|
|
@ -2046,8 +2048,10 @@ GetBattleHealthBarColor: ; 3ce90 (f:4e90)
|
|||
jp GoPAL_SET
|
||||
|
||||
; center's mon's name on the battle screen
|
||||
; if the name is 1 or 2 letters long, it is printed 2 spaces more to the right than usual (i.e. for names longer than 4 letters)
|
||||
; if the name is 3 or 4 letters long, it is printed 1 space more to the right than usual (i.e. for names longer than 4 letters)
|
||||
; if the name is 1 or 2 letters long, it is printed 2 spaces more to the right than usual
|
||||
; (i.e. for names longer than 4 letters)
|
||||
; if the name is 3 or 4 letters long, it is printed 1 space more to the right than usual
|
||||
; (i.e. for names longer than 4 letters)
|
||||
CenterMonName: ; 3ce9c (f:4e9c)
|
||||
push de
|
||||
inc hl
|
||||
|
|
@ -2204,7 +2208,8 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3)
|
|||
ld [wcc2d], a
|
||||
jr z, .handleMenuSelection
|
||||
; not Safari battle
|
||||
; swap the IDs of the item menu and party menu (this is probably because they swapped the positions of these menu items in first generation English versions)
|
||||
; swap the IDs of the item menu and party menu (this is probably because they swapped the positions
|
||||
; of these menu items in first generation English versions)
|
||||
cp $1 ; was the item menu selected?
|
||||
jr nz, .notItemMenu
|
||||
; item menu was selected
|
||||
|
|
@ -3123,10 +3128,10 @@ ExecutePlayerMove: ; 3d65e (f:565e)
|
|||
jp z, ExecutePlayerMoveDone ; for selected move = FF, skip most of player's turn
|
||||
xor a
|
||||
ld [W_MOVEMISSED], a
|
||||
ld [wcced], a
|
||||
ld [wccf4], a
|
||||
ld [wMonIsDisobedient], a
|
||||
ld [wMoveDidntMiss], a
|
||||
ld a, $a
|
||||
ld [wd05b], a
|
||||
ld [wDamageMultipliers], a
|
||||
ld a, [wcd6a]
|
||||
and a
|
||||
jp nz, ExecutePlayerMoveDone
|
||||
|
|
@ -3155,8 +3160,8 @@ CheckIfPlayerNeedsToChargeUp: ; 3d69a (f:569a)
|
|||
PlayerCanExecuteChargingMove: ; 3d6a9 (f:56a9)
|
||||
ld hl,W_PLAYERBATTSTATUS1
|
||||
res ChargingUp,[hl] ; reset charging up and invulnerability statuses if mon was charging up for an attack
|
||||
; being fully paralyzed or hurting oneself in confusion removes charging up status
|
||||
; resulting in the Pokemon being invulnerable for the whole battle
|
||||
; being fully paralyzed or hurting oneself in confusion removes charging up status
|
||||
; resulting in the Pokemon being invulnerable for the whole battle
|
||||
res Invulnerable,[hl]
|
||||
PlayerCanExecuteMove: ; 3d6b0 (f:56b0)
|
||||
call PrintMonName1Text
|
||||
|
|
@ -3183,30 +3188,30 @@ PlayerCalcMoveDamage: ; 3d6dc (f:56dc)
|
|||
jp c,.moveHitTest ; SetDamageEffects moves (e.g. Seismic Toss and Super Fang) skip damage calculation
|
||||
call CriticalHitTest
|
||||
call HandleCounterMove
|
||||
jr z,asm_3d705
|
||||
jr z,handleIfPlayerMoveMissed
|
||||
call GetDamageVarsForPlayerAttack
|
||||
call CalculateDamage
|
||||
jp z,asm_3d74b ; for moves with 0 BP, skip any further damage calculation and, for now, skip MoveHitTest
|
||||
jp z,playerCheckIfFlyOrChargeEffect ; for moves with 0 BP, skip any further damage calculation and, for now, skip MoveHitTest
|
||||
; for these moves, accuracy tests will only occur if they are called as part of the effect itself
|
||||
call AdjustDamageForMoveType
|
||||
call RandomizeDamage
|
||||
.moveHitTest
|
||||
call MoveHitTest
|
||||
asm_3d705
|
||||
handleIfPlayerMoveMissed
|
||||
ld a,[W_MOVEMISSED]
|
||||
and a
|
||||
jr z,asm_3d714
|
||||
jr z,getPlayerAnimationType
|
||||
ld a,[W_PLAYERMOVEEFFECT]
|
||||
sub a,EXPLODE_EFFECT
|
||||
jr z,asm_3d71e ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT
|
||||
jr asm_3d74b
|
||||
asm_3d714
|
||||
jr z,playPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT
|
||||
jr playerCheckIfFlyOrChargeEffect
|
||||
getPlayerAnimationType
|
||||
ld a,[W_PLAYERMOVEEFFECT]
|
||||
and a
|
||||
ld a,4
|
||||
jr z,asm_3d71e
|
||||
ld a,5
|
||||
asm_3d71e
|
||||
ld a,4 ; move has no effect other than dealing damage
|
||||
jr z,playPlayerMoveAnimation
|
||||
ld a,5 ; move has effect
|
||||
playPlayerMoveAnimation
|
||||
push af
|
||||
ld a,[W_PLAYERBATTSTATUS2]
|
||||
bit 4,a
|
||||
|
|
@ -3214,7 +3219,7 @@ asm_3d71e
|
|||
ld b,BANK(Func_79747)
|
||||
call nz,Bankswitch
|
||||
pop af
|
||||
ld [wcc5b],a
|
||||
ld [wAnimationType],a
|
||||
ld a,[W_PLAYERMOVENUM]
|
||||
call PlayMoveAnimation
|
||||
call HandleExplodingAnimation
|
||||
|
|
@ -3225,7 +3230,7 @@ asm_3d71e
|
|||
ld b,BANK(Func_79771)
|
||||
call nz,Bankswitch
|
||||
jr MirrorMoveCheck
|
||||
asm_3d74b
|
||||
playerCheckIfFlyOrChargeEffect
|
||||
ld c,$1E
|
||||
call DelayFrames
|
||||
ld a,[W_PLAYERMOVEEFFECT]
|
||||
|
|
@ -3236,7 +3241,7 @@ asm_3d74b
|
|||
jr MirrorMoveCheck
|
||||
.playAnim
|
||||
xor a
|
||||
ld [wcc5b],a
|
||||
ld [wAnimationType],a
|
||||
ld a,STATUS_AFFECTED_ANIM
|
||||
call PlayMoveAnimation
|
||||
MirrorMoveCheck
|
||||
|
|
@ -3246,7 +3251,7 @@ MirrorMoveCheck
|
|||
call MirrorMoveCopyMove
|
||||
jp z,ExecutePlayerMoveDone
|
||||
xor a
|
||||
ld [wcced],a
|
||||
ld [wMonIsDisobedient],a
|
||||
jp CheckIfPlayerNeedsToChargeUp ; if Mirror Move was successful go back to damage calculation for copied move
|
||||
.metronomeCheck
|
||||
cp a,METRONOME_EFFECT
|
||||
|
|
@ -3272,7 +3277,7 @@ MirrorMoveCheck
|
|||
call PrintCriticalOHKOText
|
||||
callab DisplayEffectiveness
|
||||
ld a,1
|
||||
ld [wccf4],a
|
||||
ld [wMoveDidntMiss],a
|
||||
.notDone
|
||||
ld a,[W_PLAYERMOVEEFFECT]
|
||||
ld hl,AlwaysHappenSideEffects
|
||||
|
|
@ -3292,8 +3297,8 @@ MirrorMoveCheck
|
|||
ld a,[wPlayerNumAttacksLeft]
|
||||
dec a
|
||||
ld [wPlayerNumAttacksLeft],a
|
||||
jp nz,asm_3d714 ; for multi-hit moves, apply attack until PlayerNumAttacksLeft hits 0 or the enemy faints.
|
||||
; damage calculation and accuracy tests only happen for the first hit
|
||||
jp nz,getPlayerAnimationType ; for multi-hit moves, apply attack until PlayerNumAttacksLeft hits 0 or the enemy faints.
|
||||
; damage calculation and accuracy tests only happen for the first hit
|
||||
res AttackingMultipleTimes,[hl] ; clear attacking multiple times status when all attacks are over
|
||||
ld hl,MultiHitText
|
||||
call PrintText
|
||||
|
|
@ -3307,9 +3312,9 @@ MirrorMoveCheck
|
|||
ld de,1
|
||||
call IsInArray
|
||||
call nc,JumpMoveEffect ; move effects not included in SpecialEffects or in either of the ResidualEffect arrays,
|
||||
; which are the effects not covered yet. Rage's effect will be executed for a second time (although it's irrelevant).
|
||||
; Includes side effects that only need to be called if the target didn't faint.
|
||||
; Responsible for executing Twineedle's second effect (poison)
|
||||
; which are the effects not covered yet. Rage effect will be executed for a second time (though it's irrelevant).
|
||||
; Includes side effects that only need to be called if the target didn't faint.
|
||||
; Responsible for executing Twineedle's second side effect (poison).
|
||||
jp ExecutePlayerMoveDone
|
||||
|
||||
MultiHitText: ; 3d805 (f:5805)
|
||||
|
|
@ -3381,7 +3386,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
|
|||
jr z,.WakeUp ; if the number of turns hit 0, wake up
|
||||
; fast asleep
|
||||
xor a
|
||||
ld [wcc5b],a
|
||||
ld [wAnimationType],a
|
||||
ld a,SLP_ANIM - 1
|
||||
call PlayMoveAnimation
|
||||
ld hl,FastAsleepText
|
||||
|
|
@ -3465,7 +3470,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
|
|||
ld hl,IsConfusedText
|
||||
call PrintText
|
||||
xor a
|
||||
ld [wcc5b],a
|
||||
ld [wAnimationType],a
|
||||
ld a,CONF_ANIM - 1
|
||||
call PlayMoveAnimation
|
||||
call BattleRandom
|
||||
|
|
@ -3514,7 +3519,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
|
|||
|
||||
.FlyOrChargeEffect
|
||||
xor a
|
||||
ld [wcc5b],a
|
||||
ld [wAnimationType],a
|
||||
ld a,STATUS_AFFECTED_ANIM
|
||||
call PlayMoveAnimation
|
||||
.NotFlyOrChargeEffect
|
||||
|
|
@ -3568,7 +3573,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
|
|||
ld [hl],a
|
||||
ld a,BIDE
|
||||
ld [W_PLAYERMOVENUM],a
|
||||
ld hl,asm_3d705 ; skip damage calculation, DecrementPP and MoveHitTest
|
||||
ld hl,handleIfPlayerMoveMissed ; skip damage calculation, DecrementPP and MoveHitTest
|
||||
jp .returnToHL
|
||||
|
||||
.ThrashingAboutCheck
|
||||
|
|
@ -3602,7 +3607,8 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
|
|||
ld a,[wPlayerNumAttacksLeft]
|
||||
dec a ; did multi-turn move end?
|
||||
ld [wPlayerNumAttacksLeft],a
|
||||
ld hl,asm_3d714 ; if it didn't, skip damage calculation (deal damage equal to last hit), DecrementPP and MoveHitTest
|
||||
ld hl,getPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit),
|
||||
; DecrementPP and MoveHitTest
|
||||
jp nz,.returnToHL
|
||||
jp .returnToHL
|
||||
|
||||
|
|
@ -3734,7 +3740,8 @@ HandleSelfConfusionDamage: ; 3daad (f:5aad)
|
|||
xor a
|
||||
ld [hl], a
|
||||
call GetDamageVarsForPlayerAttack
|
||||
call CalculateDamage ; ignores AdjustDamageForMoveType (type-less damage), RandomizeDamage, and MoveHitTest (always hits)
|
||||
call CalculateDamage ; ignores AdjustDamageForMoveType (type-less damage), RandomizeDamage,
|
||||
; and MoveHitTest (always hits)
|
||||
pop af
|
||||
pop hl
|
||||
ld [hl], a
|
||||
|
|
@ -3744,7 +3751,7 @@ HandleSelfConfusionDamage: ; 3daad (f:5aad)
|
|||
pop af
|
||||
ld [hl], a
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
inc a
|
||||
ld [H_WHOSETURN], a
|
||||
call PlayMoveAnimation
|
||||
|
|
@ -3771,12 +3778,12 @@ MonName1Text: ; 3dafb (f:5afb)
|
|||
ld [hl], a
|
||||
ld [wd11e], a
|
||||
call Func_3db85
|
||||
ld a, [wcced]
|
||||
ld a, [wMonIsDisobedient]
|
||||
and a
|
||||
ld hl, Used2Text
|
||||
ret nz
|
||||
ld a, [wd11e]
|
||||
cp DOUBLESLAP
|
||||
cp 3
|
||||
ld hl, Used2Text
|
||||
ret c
|
||||
ld hl, Used1Text
|
||||
|
|
@ -3792,7 +3799,7 @@ Used2Text: ; 3db34 (f:5b34)
|
|||
db $08 ; asm
|
||||
|
||||
PrintInsteadText: ; 3db39 (f:5b39)
|
||||
ld a, [wcced]
|
||||
ld a, [wMonIsDisobedient]
|
||||
and a
|
||||
jr z, PrintCF4BText
|
||||
ld hl, InsteadText
|
||||
|
|
@ -3894,7 +3901,7 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2)
|
|||
ld de, W_ENEMYMOVEEFFECT
|
||||
.playersTurn
|
||||
ld hl, DoesntAffectMonText
|
||||
ld a, [wd05b]
|
||||
ld a, [wDamageMultipliers]
|
||||
and $7f
|
||||
jr z, .gotTextToPrint
|
||||
ld hl, AttackMissedText
|
||||
|
|
@ -3914,7 +3921,8 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2)
|
|||
|
||||
; if you get here, the mon used jump kick or hi jump kick and missed
|
||||
ld hl, W_DAMAGE ; since the move missed, W_DAMAGE will always contain 0 at this point.
|
||||
; Thus, recoil damage will always be equal to 1 even if it was intended to be potential damage/8.
|
||||
; Thus, recoil damage will always be equal to 1
|
||||
; even if it was intended to be potential damage/8.
|
||||
ld a, [hli]
|
||||
ld b, [hl]
|
||||
srl a
|
||||
|
|
@ -3999,7 +4007,7 @@ OHKOText: ; 3dc83 (f:5c83)
|
|||
; stores whether the mon will use a move in Z flag
|
||||
CheckForDisobedience: ; 3dc88 (f:5c88)
|
||||
xor a
|
||||
ld [wcced], a
|
||||
ld [wMonIsDisobedient], a
|
||||
ld a, [wLinkState]
|
||||
cp LINK_STATE_BATTLING
|
||||
jr nz, .checkIfMonIsTraded
|
||||
|
|
@ -4140,7 +4148,7 @@ CheckForDisobedience: ; 3dc88 (f:5c88)
|
|||
cp b
|
||||
jr z, .monDoesNothing ; mon will not use move if only one move has remaining PP
|
||||
ld a, $1
|
||||
ld [wcced], a
|
||||
ld [wMonIsDisobedient], a
|
||||
ld a, [wMaxMenuItem]
|
||||
ld b, a
|
||||
ld a, [wCurrentMenuItem]
|
||||
|
|
@ -4296,7 +4304,8 @@ GetDamageVarsForPlayerAttack: ; 3ddcf (f:5dcf)
|
|||
jr nz, .next
|
||||
inc l ; if the player's offensive stat is 0, bump it up to 1
|
||||
.next
|
||||
ld b, l ; b = player's offensive stat (possibly scaled) (c already contains enemy's defensive stat (possibly scaled))
|
||||
ld b, l ; b = player's offensive stat (possibly scaled)
|
||||
; (c already contains enemy's defensive stat (possibly scaled))
|
||||
ld a, [wBattleMonLevel]
|
||||
ld e, a ; e = level
|
||||
ld a, [wCriticalHitOrOHKO]
|
||||
|
|
@ -4408,7 +4417,8 @@ GetDamageVarsForEnemyAttack: ; 3de75 (f:5e75)
|
|||
jr nz, .next
|
||||
inc l ; if the enemy's offensive stat is 0, bump it up to 1
|
||||
.next
|
||||
ld b, l ; b = enemy's offensive stat (possibly scaled) (c already contains player's defensive stat (possibly scaled))
|
||||
ld b, l ; b = enemy's offensive stat (possibly scaled)
|
||||
; (c already contains player's defensive stat (possibly scaled))
|
||||
ld a, [wEnemyMonLevel]
|
||||
ld e, a
|
||||
ld a, [wCriticalHitOrOHKO]
|
||||
|
|
@ -4471,7 +4481,7 @@ CalculateDamage: ; 3df65 (f:5f65)
|
|||
; d: base power
|
||||
; e: level
|
||||
|
||||
ld a, [$fff3] ; whose turn?
|
||||
ld a, [H_WHOSETURN] ; whose turn?
|
||||
and a
|
||||
ld a, [W_PLAYERMOVEEFFECT]
|
||||
jr z, .effect
|
||||
|
|
@ -4494,7 +4504,7 @@ CalculateDamage: ; 3df65 (f:5f65)
|
|||
|
||||
; Calculate OHKO damage based on remaining HP.
|
||||
cp a, OHKO_EFFECT
|
||||
jp z, Func_3e016
|
||||
jp z, JumpToOHKOMoveEffect
|
||||
|
||||
; Don't calculate damage for moves that don't do any.
|
||||
ld a, d ; base power
|
||||
|
|
@ -4626,7 +4636,7 @@ CalculateDamage: ; 3df65 (f:5f65)
|
|||
and a
|
||||
ret
|
||||
|
||||
Func_3e016: ; 3e016 (f:6016)
|
||||
JumpToOHKOMoveEffect: ; 3e016 (f:6016)
|
||||
call JumpMoveEffect
|
||||
ld a, [W_MOVEMISSED]
|
||||
dec a
|
||||
|
|
@ -5025,8 +5035,10 @@ ApplyAttackToPlayerPokemonDone
|
|||
AttackSubstitute: ; 3e25e (f:625e)
|
||||
; Unlike the two ApplyAttackToPokemon functions, Attack Substitute is shared by player and enemy.
|
||||
; Self-confusion damage as well as Hi-Jump Kick and Jump Kick recoil cause a momentary turn swap before being applied.
|
||||
; If the user has a Substitute up and would take damage because of that, damage will be applied to the other player's Substitute.
|
||||
; Normal recoil such as from Double-Edge isn't affected by this glitch, because this function is never called in that case.
|
||||
; If the user has a Substitute up and would take damage because of that,
|
||||
; damage will be applied to the other player's Substitute.
|
||||
; Normal recoil such as from Double-Edge isn't affected by this glitch,
|
||||
; because this function is never called in that case.
|
||||
|
||||
ld hl,SubstituteTookDamageText
|
||||
call PrintText
|
||||
|
|
@ -5050,10 +5062,11 @@ AttackSubstitute: ; 3e25e (f:625e)
|
|||
ld [de],a
|
||||
ret nc
|
||||
.substituteBroke
|
||||
; If the target's Substitute breaks, W_DAMAGE isn't updated with the amount of HP the Substitute had before being attacked.
|
||||
; If the target's Substitute breaks, W_DAMAGE isn't updated with the amount of HP
|
||||
; the Substitute had before being attacked.
|
||||
ld h,b
|
||||
ld l,c
|
||||
res 4,[hl] ; unset the substitute bit
|
||||
res HasSubstituteUp,[hl] ; unset the substitute bit
|
||||
ld hl,SubstituteBrokeText
|
||||
call PrintText
|
||||
; flip whose turn it is for the next function call
|
||||
|
|
@ -5185,7 +5198,7 @@ ReloadMoveData: ; 3e329 (f:6329)
|
|||
; function that picks a random move for metronome
|
||||
MetronomePickMove: ; 3e348 (f:6348)
|
||||
xor a
|
||||
ld [wcc5b],a
|
||||
ld [wAnimationType],a
|
||||
ld a,METRONOME
|
||||
call PlayMoveAnimation ; play Metronome's animation
|
||||
; values for player turn
|
||||
|
|
@ -5293,7 +5306,7 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5)
|
|||
ld [W_DAMAGE],a
|
||||
ld a,l
|
||||
ld [W_DAMAGE + 1],a
|
||||
ld hl,wd05b
|
||||
ld hl,wDamageMultipliers
|
||||
set 7,[hl]
|
||||
.skipSameTypeAttackBonus
|
||||
ld a,[wd11e]
|
||||
|
|
@ -5316,13 +5329,13 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5)
|
|||
push hl
|
||||
push bc
|
||||
inc hl
|
||||
ld a,[wd05b]
|
||||
ld a,[wDamageMultipliers]
|
||||
and a,$80
|
||||
ld b,a
|
||||
ld a,[hl] ; a = damage multiplier
|
||||
ld [H_MULTIPLIER],a
|
||||
add b
|
||||
ld [wd05b],a
|
||||
ld [wDamageMultipliers],a
|
||||
xor a
|
||||
ld [H_MULTIPLICAND],a
|
||||
ld hl,W_DAMAGE
|
||||
|
|
@ -5536,7 +5549,8 @@ CalcHitChance: ; 3e624 (f:6624)
|
|||
.next
|
||||
ld a,$0e
|
||||
sub c
|
||||
ld c,a ; c = 14 - EVASIONMOD (this "reflects" the value over 7, so that an increase in the target's evasion decreases the hit chance instead of increasing the hit chance)
|
||||
ld c,a ; c = 14 - EVASIONMOD (this "reflects" the value over 7, so that an increase in the target's evasion
|
||||
; decreases the hit chance instead of increasing the hit chance)
|
||||
; zero the high bytes of the multiplicand
|
||||
xor a
|
||||
ld [H_MULTIPLICAND],a
|
||||
|
|
@ -5545,7 +5559,8 @@ CalcHitChance: ; 3e624 (f:6624)
|
|||
ld [H_MULTIPLICAND + 2],a ; set multiplicand to move accuracy
|
||||
push hl
|
||||
ld d,$02 ; loop has two iterations
|
||||
; loop to do the calculations, the first iteration multiplies by the accuracy ratio and the second iteration multiplies by the evasion ratio
|
||||
; loop to do the calculations, the first iteration multiplies by the accuracy ratio and
|
||||
; the second iteration multiplies by the evasion ratio
|
||||
.loop
|
||||
push bc
|
||||
ld hl, StatModifierRatios ; $76cb ; stat modifier ratios
|
||||
|
|
@ -5559,7 +5574,8 @@ CalcHitChance: ; 3e624 (f:6624)
|
|||
ld [H_MULTIPLIER],a ; set multiplier to the numerator of the ratio
|
||||
call Multiply
|
||||
ld a,[hl]
|
||||
ld [H_DIVISOR],a ; set divisor to the the denominator of the ratio (the dividend is the product of the previous multiplication)
|
||||
ld [H_DIVISOR],a ; set divisor to the the denominator of the ratio
|
||||
; (the dividend is the product of the previous multiplication)
|
||||
ld b,$04 ; number of bytes in the dividend
|
||||
call Divide
|
||||
ld a,[H_QUOTIENT + 3]
|
||||
|
|
@ -5623,6 +5639,7 @@ RandomizeDamage: ; 3e687 (f:6687)
|
|||
ld [hl], a
|
||||
ret
|
||||
|
||||
; for more detailed commentary, see equivalent function for player side (ExecutePlayerMove)
|
||||
ExecuteEnemyMove: ; 3e6bc (f:66bc)
|
||||
ld a, [wEnemySelectedMove]
|
||||
inc a
|
||||
|
|
@ -5639,13 +5656,13 @@ ExecuteEnemyMove: ; 3e6bc (f:66bc)
|
|||
cp $4
|
||||
ret nc
|
||||
.executeEnemyMove
|
||||
ld hl, wccd5
|
||||
ld hl, wAILayer2Encouragement
|
||||
inc [hl]
|
||||
xor a
|
||||
ld [W_MOVEMISSED], a
|
||||
ld [wccf4], a
|
||||
ld [wMoveDidntMiss], a
|
||||
ld a, $a
|
||||
ld [wd05b], a
|
||||
ld [wDamageMultipliers], a
|
||||
call CheckEnemyStatusConditions
|
||||
jr nz, .enemyHasNoSpecialConditions
|
||||
jp [hl]
|
||||
|
|
@ -5677,7 +5694,7 @@ EnemyCanExecuteChargingMove: ; 3e70b (f:670b)
|
|||
call CopyStringToCF4B
|
||||
EnemyCanExecuteMove: ; 3e72b (f:672b)
|
||||
xor a
|
||||
ld [wcced], a
|
||||
ld [wMonIsDisobedient], a
|
||||
call PrintMonName1Text
|
||||
ld a, [W_ENEMYMOVEEFFECT]
|
||||
ld hl, ResidualEffects1
|
||||
|
|
@ -5695,42 +5712,42 @@ EnemyCalcMoveDamage: ; 3e750 (f:6750)
|
|||
ld hl, SetDamageEffects
|
||||
ld de, $1
|
||||
call IsInArray
|
||||
jp c, Func_3e77f
|
||||
jp c, EnemyMoveHitTest
|
||||
call CriticalHitTest
|
||||
call HandleCounterMove
|
||||
jr z, asm_3e782
|
||||
jr z, handleIfEnemyMoveMissed
|
||||
call SwapPlayerAndEnemyLevels
|
||||
call GetDamageVarsForEnemyAttack
|
||||
call SwapPlayerAndEnemyLevels
|
||||
call CalculateDamage
|
||||
jp z, Func_3e7d1
|
||||
jp z, EnemyCheckIfFlyOrChargeEffect
|
||||
call AdjustDamageForMoveType
|
||||
call RandomizeDamage
|
||||
|
||||
Func_3e77f: ; 3e77f (f:677f)
|
||||
EnemyMoveHitTest: ; 3e77f (f:677f)
|
||||
call MoveHitTest
|
||||
asm_3e782: ; 3e782 (f:6782)
|
||||
handleIfEnemyMoveMissed: ; 3e782 (f:6782)
|
||||
ld a, [W_MOVEMISSED]
|
||||
and a
|
||||
jr z, .asm_3e791
|
||||
ld a, [W_ENEMYMOVEEFFECT]
|
||||
cp EXPLODE_EFFECT
|
||||
jr z, asm_3e7a0
|
||||
jr Func_3e7d1
|
||||
jr EnemyCheckIfFlyOrChargeEffect
|
||||
.asm_3e791
|
||||
call SwapPlayerAndEnemyLevels
|
||||
|
||||
Func_3e794: ; 3e794 (f:6794)
|
||||
GetEnemyAnimationType: ; 3e794 (f:6794)
|
||||
ld a, [W_ENEMYMOVEEFFECT]
|
||||
and a
|
||||
ld a, $1
|
||||
jr z, asm_3e7a4
|
||||
jr z, playEnemyMoveAnimation
|
||||
ld a, $2
|
||||
jr asm_3e7a4
|
||||
jr playEnemyMoveAnimation
|
||||
asm_3e7a0: ; 3e7a0 (f:67a0)
|
||||
call SwapPlayerAndEnemyLevels
|
||||
xor a
|
||||
asm_3e7a4: ; 3e7a4 (f:67a4)
|
||||
playEnemyMoveAnimation: ; 3e7a4 (f:67a4)
|
||||
push af
|
||||
ld a, [W_ENEMYBATTSTATUS2]
|
||||
bit HasSubstituteUp, a ; does mon have a substitute?
|
||||
|
|
@ -5738,7 +5755,7 @@ asm_3e7a4: ; 3e7a4 (f:67a4)
|
|||
ld b, BANK(Func_79747)
|
||||
call nz, Bankswitch
|
||||
pop af
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld a, [W_ENEMYMOVENUM]
|
||||
call PlayMoveAnimation
|
||||
call HandleExplodingAnimation
|
||||
|
|
@ -5748,24 +5765,24 @@ asm_3e7a4: ; 3e7a4 (f:67a4)
|
|||
ld hl, Func_79771
|
||||
ld b, BANK(Func_79771)
|
||||
call nz, Bankswitch ; slide the substitute's sprite out
|
||||
jr asm_3e7ef
|
||||
jr EnemyCheckIfMirrorMoveEffect
|
||||
|
||||
Func_3e7d1: ; 3e7d1 (f:67d1)
|
||||
EnemyCheckIfFlyOrChargeEffect: ; 3e7d1 (f:67d1)
|
||||
call SwapPlayerAndEnemyLevels
|
||||
ld c, $1e
|
||||
call DelayFrames
|
||||
ld a, [W_ENEMYMOVEEFFECT]
|
||||
cp FLY_EFFECT
|
||||
jr z, .asm_3e7e6
|
||||
jr z, .playAnim
|
||||
cp CHARGE_EFFECT
|
||||
jr z, .asm_3e7e6
|
||||
jr asm_3e7ef
|
||||
.asm_3e7e6
|
||||
jr z, .playAnim
|
||||
jr EnemyCheckIfMirrorMoveEffect
|
||||
.playAnim
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld a,STATUS_AFFECTED_ANIM
|
||||
call PlayMoveAnimation
|
||||
asm_3e7ef: ; 3e7ef (f:67ef)
|
||||
EnemyCheckIfMirrorMoveEffect: ; 3e7ef (f:67ef)
|
||||
ld a, [W_ENEMYMOVEEFFECT]
|
||||
cp MIRROR_MOVE_EFFECT
|
||||
jr nz, .notMirrorMoveEffect
|
||||
|
|
@ -5796,7 +5813,7 @@ asm_3e7ef: ; 3e7ef (f:67ef)
|
|||
call PrintCriticalOHKOText
|
||||
callab DisplayEffectiveness
|
||||
ld a, 1
|
||||
ld [wccf4], a
|
||||
ld [wMoveDidntMiss], a
|
||||
.asm_3e83e
|
||||
ld a, [W_ENEMYMOVEEFFECT]
|
||||
ld hl, AlwaysHappenSideEffects
|
||||
|
|
@ -5816,7 +5833,7 @@ asm_3e7ef: ; 3e7ef (f:67ef)
|
|||
ld hl, wEnemyNumAttacksLeft
|
||||
dec [hl]
|
||||
pop hl
|
||||
jp nz, Func_3e794
|
||||
jp nz, GetEnemyAnimationType
|
||||
res AttackingMultipleTimes, [hl] ; mon is no longer hitting multiple times
|
||||
ld hl, HitXTimesText
|
||||
call PrintText
|
||||
|
|
@ -5854,7 +5871,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
|
|||
ld hl, FastAsleepText
|
||||
call PrintText
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld a,SLP_ANIM
|
||||
call PlayMoveAnimation
|
||||
jr .next1
|
||||
|
|
@ -5930,7 +5947,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
|
|||
ld hl, IsConfusedText
|
||||
call PrintText
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld a,CONF_ANIM
|
||||
call PlayMoveAnimation
|
||||
call BattleRandom
|
||||
|
|
@ -5973,7 +5990,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
|
|||
pop af
|
||||
ld [hl], a
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld [H_WHOSETURN], a
|
||||
ld a, POUND
|
||||
call PlayMoveAnimation
|
||||
|
|
@ -6014,7 +6031,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
|
|||
jr .notFlyOrChargeEffect
|
||||
.flyOrChargeEffect
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld a, STATUS_AFFECTED_ANIM
|
||||
call PlayMoveAnimation
|
||||
.notFlyOrChargeEffect
|
||||
|
|
@ -6068,7 +6085,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
|
|||
ld a, BIDE
|
||||
ld [W_ENEMYMOVENUM], a
|
||||
call SwapPlayerAndEnemyLevels
|
||||
ld hl, asm_3e782
|
||||
ld hl, handleIfEnemyMoveMissed
|
||||
jp .enemyReturnToHL
|
||||
.checkIfThrashingAbout
|
||||
bit ThrashingAbout, [hl] ; is mon using thrash or petal dance?
|
||||
|
|
@ -6099,7 +6116,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
|
|||
call PrintText
|
||||
ld hl, wEnemyNumAttacksLeft
|
||||
dec [hl]
|
||||
ld hl, Func_3e794
|
||||
ld hl, GetEnemyAnimationType
|
||||
jp nz, .enemyReturnToHL
|
||||
jp .enemyReturnToHL
|
||||
.checkIfUsingRage
|
||||
|
|
@ -6787,7 +6804,7 @@ HandleExplodingAnimation: ; 3eed3 (f:6ed3)
|
|||
and a
|
||||
ret nz
|
||||
ld a, 5
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
|
||||
PlayMoveAnimation: ; 3ef07 (f:6f07)
|
||||
ld [W_ANIMATIONID],a
|
||||
|
|
@ -6955,6 +6972,7 @@ _LoadTrainerPic: ; 3f04b (f:704b)
|
|||
ld c, a
|
||||
jp LoadUncompressedSpriteData
|
||||
|
||||
; unreferenced
|
||||
Func_3f069: ; 3f069 (f:7069)
|
||||
xor a
|
||||
ld [wc0f1], a
|
||||
|
|
@ -7030,6 +7048,7 @@ asm_3f0d0: ; 3f0d0 (f:70d0)
|
|||
dec b
|
||||
jr nz, .asm_3f0de
|
||||
ret
|
||||
|
||||
.asm_3f0ed
|
||||
push bc
|
||||
ld b, $0
|
||||
|
|
@ -7053,7 +7072,7 @@ asm_3f0d0: ; 3f0d0 (f:70d0)
|
|||
jr nz, .asm_3f0f4
|
||||
ret
|
||||
|
||||
LoadMonBackPic:
|
||||
LoadMonBackPic: ; 3f103 (f:7103)
|
||||
; Assumes the monster's attributes have
|
||||
; been loaded with GetMonHeader.
|
||||
ld a, [wBattleMonSpecies2]
|
||||
|
|
@ -7080,14 +7099,14 @@ JumpMoveEffect: ; 3f132 (f:7132)
|
|||
ret
|
||||
|
||||
_JumpMoveEffect: ; 3f138 (f:7138)
|
||||
ld a, [$fff3] ;whose turn?
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [W_PLAYERMOVEEFFECT]
|
||||
jr z, .next1
|
||||
ld a, [W_ENEMYMOVEEFFECT]
|
||||
.next1
|
||||
dec a ;subtract 1, there is no special effect for 00
|
||||
add a ;x2, 16bit pointers
|
||||
dec a ; subtract 1, there is no special effect for 00
|
||||
add a ; x2, 16bit pointers
|
||||
ld hl, MoveEffectPointerTable
|
||||
ld b, 0
|
||||
ld c, a
|
||||
|
|
@ -7095,7 +7114,7 @@ _JumpMoveEffect: ; 3f138 (f:7138)
|
|||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
jp [hl] ;jump to special effect handler
|
||||
jp [hl] ; jump to special effect handler
|
||||
|
||||
MoveEffectPointerTable: ; 3f150 (f:7150)
|
||||
dw SleepEffect ; unused effect
|
||||
|
|
@ -7223,7 +7242,7 @@ SleepEffect: ; 3f1fc (f:71fc)
|
|||
and $7
|
||||
jr z, .setSleepCounter
|
||||
ld [de], a
|
||||
call Func_3fb89
|
||||
call PlayCurrentMoveAnimation2
|
||||
ld hl, FellAsleepText
|
||||
jp PrintText
|
||||
.didntAffect
|
||||
|
|
@ -7309,10 +7328,10 @@ PoisonEffect: ; 3f24f (f:724f)
|
|||
cp POISON_EFFECT
|
||||
jr z, .asm_3f2cd
|
||||
ld a, b
|
||||
call Func_3fb96
|
||||
call PlayBattleAnimation2
|
||||
jp PrintText
|
||||
.asm_3f2cd
|
||||
call Func_3fb89
|
||||
call PlayCurrentMoveAnimation2
|
||||
jp PrintText
|
||||
.noEffect
|
||||
ld a, [de]
|
||||
|
|
@ -7357,10 +7376,10 @@ ExplodeEffect: ; 3f2f1 (f:72f1)
|
|||
|
||||
FreezeBurnParalyzeEffect: ; 3f30c (f:730c)
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag]
|
||||
ret nz ; return if they have a substitute, can't effect them
|
||||
ld a, [$fff3]
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jp nz, opponentAttacker
|
||||
ld a, [wEnemyMonStatus]
|
||||
|
|
@ -7472,7 +7491,7 @@ CheckDefrost: ; 3f3e2 (f:73e2)
|
|||
; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target
|
||||
and a, 1 << FRZ ; are they frozen?
|
||||
ret z ; return if so
|
||||
ld a, [$fff3]
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr nz, .opponent
|
||||
;player [attacker]
|
||||
|
|
@ -7568,7 +7587,7 @@ StatModifierUpEffect: ; 3f428 (f:7428)
|
|||
jr nz, .recalculateStat
|
||||
ld a, [hl]
|
||||
sbc 999 / $100
|
||||
jp z, Func_3f520
|
||||
jp z, RestoreOriginalStatModifier
|
||||
.recalculateStat ; recalculate affected stat
|
||||
; paralysis and burn penalties, as well as badge boosts are ignored
|
||||
push hl
|
||||
|
|
@ -7661,7 +7680,7 @@ UpdateStatDone: ; 3f4ca (f:74ca)
|
|||
call QuarterSpeedDueToParalysis ; apply speed penalty to the player whose turn is not, if it's paralyzed
|
||||
jp HalveAttackDueToBurn ; apply attack penalty to the player whose turn is not, if it's burned
|
||||
|
||||
Func_3f520: ; 3f520 (f:7520)
|
||||
RestoreOriginalStatModifier: ; 3f520 (f:7520)
|
||||
pop hl
|
||||
dec [hl]
|
||||
|
||||
|
|
@ -7838,7 +7857,7 @@ UpdateLoweredStatDone: ; 3f62c (f:762c)
|
|||
ld a, [de]
|
||||
cp $44
|
||||
jr nc, .ApplyBadgeBoostsAndStatusPenalties
|
||||
call Func_3fb89
|
||||
call PlayCurrentMoveAnimation2
|
||||
.ApplyBadgeBoostsAndStatusPenalties
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
|
|
@ -7869,7 +7888,7 @@ MoveMissed: ; 3f65a (f:765a)
|
|||
ld a, [de]
|
||||
cp $44
|
||||
ret nc
|
||||
jp Func_3fb4e
|
||||
jp ConditionalPrintButItFailed
|
||||
|
||||
MonsStatsFellText: ; 3f661 (f:7661)
|
||||
TX_FAR _MonsStatsFellText
|
||||
|
|
@ -7961,7 +7980,7 @@ BideEffect: ; 3f6e5 (f:76e5)
|
|||
ld [bc], a ; set Bide counter to 2 or 3 at random
|
||||
ld a, [H_WHOSETURN]
|
||||
add XSTATITEM_ANIM
|
||||
jp Func_3fb96
|
||||
jp PlayBattleAnimation2
|
||||
|
||||
ThrashPetalDanceEffect: ; 3f717 (f:7717)
|
||||
ld hl, W_PLAYERBATTSTATUS1
|
||||
|
|
@ -7980,7 +7999,7 @@ ThrashPetalDanceEffect: ; 3f717 (f:7717)
|
|||
ld [de], a ; set thrash/petal dance counter to 2 or 3 at random
|
||||
ld a, [H_WHOSETURN]
|
||||
add ANIM_B0
|
||||
jp Func_3fb96
|
||||
jp PlayBattleAnimation2
|
||||
|
||||
SwitchAndTeleportEffect: ; 3f739 (f:7739)
|
||||
ld a, [H_WHOSETURN]
|
||||
|
|
@ -8014,7 +8033,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
|
|||
.asm_3f76e
|
||||
call ReadPlayerMonCurHPAndStatus
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
inc a
|
||||
ld [wEscapedFromBattle], a
|
||||
ld a, [W_PLAYERMOVENUM]
|
||||
|
|
@ -8056,7 +8075,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
|
|||
.asm_3f7c1
|
||||
call ReadPlayerMonCurHPAndStatus
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
inc a
|
||||
ld [wEscapedFromBattle], a
|
||||
ld a, [W_ENEMYMOVENUM]
|
||||
|
|
@ -8068,7 +8087,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
|
|||
ld a, [W_ENEMYMOVENUM]
|
||||
cp TELEPORT
|
||||
jp nz, PrintText
|
||||
jp Func_3fb4e
|
||||
jp ConditionalPrintButItFailed
|
||||
.asm_3f7e4
|
||||
push af
|
||||
call PlayBattleAnimation
|
||||
|
|
@ -8197,7 +8216,7 @@ ChargeEffect: ; 3f88c (f:788c)
|
|||
ld b, ANIM_C0
|
||||
.notDigOrFly
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld a, b
|
||||
call PlayBattleAnimation
|
||||
ld a, [de]
|
||||
|
|
@ -8329,7 +8348,7 @@ ConfusionSideEffectSuccess: ; 3f96f (f:796f)
|
|||
ld [bc], a ; confusion status will last 2-5 turns
|
||||
pop af
|
||||
cp CONFUSION_SIDE_EFFECT
|
||||
call nz, Func_3fb89
|
||||
call nz, PlayCurrentMoveAnimation2
|
||||
ld hl, BecameConfusedText
|
||||
jp PrintText
|
||||
|
||||
|
|
@ -8342,7 +8361,7 @@ ConfusionEffectFailed: ; 3f9a6 (f:79a6)
|
|||
ret z
|
||||
ld c, $32
|
||||
call DelayFrames
|
||||
jp Func_3fb4e
|
||||
jp ConditionalPrintButItFailed
|
||||
|
||||
ParalyzeEffect: ; 3f9b1 (f:79b1)
|
||||
ld hl, ParalyzeEffect_
|
||||
|
|
@ -8350,8 +8369,8 @@ ParalyzeEffect: ; 3f9b1 (f:79b1)
|
|||
jp Bankswitch
|
||||
|
||||
SubstituteEffect: ; 3f9b9 (f:79b9)
|
||||
ld hl, SubstituteEffectHandler
|
||||
ld b, BANK(SubstituteEffectHandler)
|
||||
ld hl, SubstituteEffect_
|
||||
ld b, BANK(SubstituteEffect_)
|
||||
jp Bankswitch
|
||||
|
||||
HyperBeamEffect: ; 3f9c1 (f:79c1)
|
||||
|
|
@ -8534,7 +8553,7 @@ DisableEffect: ; 3fa8a (f:7a8a)
|
|||
swap c
|
||||
add c
|
||||
ld [de], a
|
||||
call Func_3fb89
|
||||
call PlayCurrentMoveAnimation2
|
||||
ld hl, wccee
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
|
|
@ -8597,10 +8616,10 @@ NoEffectText: ; 3fb49 (f:7b49)
|
|||
TX_FAR _NoEffectText
|
||||
db "@"
|
||||
|
||||
Func_3fb4e: ; 3fb4e (f:7b4e)
|
||||
ld a, [wccf4]
|
||||
ConditionalPrintButItFailed: ; 3fb4e (f:7b4e)
|
||||
ld a, [wMoveDidntMiss]
|
||||
and a
|
||||
ret nz
|
||||
ret nz ; return if the side effect failed, yet the attack was successful
|
||||
|
||||
PrintButItFailedText_: ; 3fb53 (f:7b53)
|
||||
ld hl, ButItFailedText
|
||||
|
|
@ -8642,30 +8661,35 @@ CheckTargetSubstitute: ; 3fb79 (f:7b79)
|
|||
pop hl
|
||||
ret
|
||||
|
||||
Func_3fb89: ; 3fb89 (f:7b89)
|
||||
PlayCurrentMoveAnimation2: ; 3fb89 (f:7b89)
|
||||
; animation at MOVENUM will be played unless MOVENUM is 0
|
||||
; plays wAnimationType 3 or 6
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [W_PLAYERMOVENUM]
|
||||
jr z, .asm_3fb94
|
||||
jr z, .notEnemyTurn
|
||||
ld a, [W_ENEMYMOVENUM]
|
||||
.asm_3fb94
|
||||
.notEnemyTurn
|
||||
and a
|
||||
ret z
|
||||
|
||||
Func_3fb96: ; 3fb96 (f:7b96)
|
||||
PlayBattleAnimation2: ; 3fb96 (f:7b96)
|
||||
; play animation ID at a and animation type 6 or 3
|
||||
ld [W_ANIMATIONID], a
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, $6
|
||||
jr z, .asm_3fba2
|
||||
jr z, .storeAnimationType
|
||||
ld a, $3
|
||||
.asm_3fba2
|
||||
ld [wcc5b], a
|
||||
jp Func_3fbbc
|
||||
.storeAnimationType
|
||||
ld [wAnimationType], a
|
||||
jp PlayBattleAnimationGotID
|
||||
|
||||
PlayCurrentMoveAnimation: ; 3fba8 (f:7ba8)
|
||||
; animation at MOVENUM will be played unless MOVENUM is 0
|
||||
; resets wAnimationType
|
||||
xor a
|
||||
ld [wcc5b], a
|
||||
ld [wAnimationType], a
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [W_PLAYERMOVENUM]
|
||||
|
|
@ -8676,9 +8700,11 @@ PlayCurrentMoveAnimation: ; 3fba8 (f:7ba8)
|
|||
ret z
|
||||
|
||||
PlayBattleAnimation: ; 3fbb9 (f:7bb9)
|
||||
; play animation ID at a and predefined animation type
|
||||
ld [W_ANIMATIONID], a
|
||||
|
||||
Func_3fbbc: ; 3fbbc (f:7bbc)
|
||||
PlayBattleAnimationGotID: ; 3fbbc (f:7bbc)
|
||||
; play animation at W_ANIMATIONID
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
|
|
|
|||
0
engine/battle/1a.asm → engine/battle/decrement_pp.asm
Executable file → Normal file
0
engine/battle/1a.asm → engine/battle/decrement_pp.asm
Executable file → Normal file
2
engine/battle/b.asm → engine/battle/display_effectiveness.asm
Executable file → Normal file
2
engine/battle/b.asm → engine/battle/display_effectiveness.asm
Executable file → Normal file
|
|
@ -1,5 +1,5 @@
|
|||
DisplayEffectiveness: ; 2fb7b (b:7b7b)
|
||||
ld a, [wd05b]
|
||||
ld a, [wDamageMultipliers]
|
||||
and a, $7F
|
||||
cp a, $0A
|
||||
ret z
|
||||
191
engine/battle/draw_hud_pokeball_gfx.asm
Normal file
191
engine/battle/draw_hud_pokeball_gfx.asm
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
DrawAllPokeballs: ; 3a849 (e:6849)
|
||||
call LoadPartyPokeballGfx
|
||||
call SetupOwnPartyPokeballs
|
||||
ld a, [W_ISINBATTLE] ; W_ISINBATTLE
|
||||
dec a
|
||||
ret z ; return if wild pokémon
|
||||
jp SetupEnemyPartyPokeballs
|
||||
|
||||
DrawEnemyPokeballs: ; 0x3a857
|
||||
call LoadPartyPokeballGfx
|
||||
jp SetupEnemyPartyPokeballs
|
||||
|
||||
LoadPartyPokeballGfx: ; 3a85d (e:685d)
|
||||
ld de, PokeballTileGraphics ; $697e
|
||||
ld hl, vSprites + $310
|
||||
ld bc, (BANK(PokeballTileGraphics) << 8) + $04
|
||||
jp CopyVideoData
|
||||
|
||||
SetupOwnPartyPokeballs: ; 3a869 (e:6869)
|
||||
call PlacePlayerHUDTiles
|
||||
ld hl, wPartyMon1
|
||||
ld de, wPartyCount ; wPartyCount
|
||||
call SetupPokeballs
|
||||
ld a, $60
|
||||
ld hl, W_BASECOORDX ; wd081
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld a, $8
|
||||
ld [wTrainerEngageDistance], a
|
||||
ld hl, wOAMBuffer
|
||||
jp WritePokeballOAMData
|
||||
|
||||
SetupEnemyPartyPokeballs: ; 3a887 (e:6887)
|
||||
call PlaceEnemyHUDTiles
|
||||
ld hl, wEnemyMons
|
||||
ld de, wEnemyPartyCount ; wEnemyPartyCount
|
||||
call SetupPokeballs
|
||||
ld hl, W_BASECOORDX ; wd081
|
||||
ld a, $48
|
||||
ld [hli], a
|
||||
ld [hl], $20
|
||||
ld a, $f8
|
||||
ld [wTrainerEngageDistance], a
|
||||
ld hl, wOAMBuffer + PARTY_LENGTH * 4
|
||||
jp WritePokeballOAMData
|
||||
|
||||
SetupPokeballs: ; 0x3a8a6
|
||||
ld a, [de]
|
||||
push af
|
||||
ld de, wBuffer
|
||||
ld c, PARTY_LENGTH
|
||||
ld a, $34 ; empty pokeball
|
||||
.emptyloop
|
||||
ld [de], a
|
||||
inc de
|
||||
dec c
|
||||
jr nz, .emptyloop
|
||||
pop af
|
||||
ld de, wBuffer
|
||||
.monloop
|
||||
push af
|
||||
call PickPokeball
|
||||
inc de
|
||||
pop af
|
||||
dec a
|
||||
jr nz, .monloop
|
||||
ret
|
||||
|
||||
PickPokeball: ; 3a8c2 (e:68c2)
|
||||
inc hl
|
||||
ld a, [hli]
|
||||
and a
|
||||
jr nz, .alive
|
||||
ld a, [hl]
|
||||
and a
|
||||
ld b, $33 ; crossed ball (fainted)
|
||||
jr z, .done_fainted
|
||||
.alive
|
||||
inc hl
|
||||
inc hl
|
||||
ld a, [hl] ; status
|
||||
and a
|
||||
ld b, $32 ; black ball (status)
|
||||
jr nz, .done
|
||||
dec b ; regular ball
|
||||
jr .done
|
||||
.done_fainted
|
||||
inc hl
|
||||
inc hl
|
||||
.done
|
||||
ld a, b
|
||||
ld [de], a
|
||||
ld bc, $0028 ; rest of mon struct
|
||||
add hl, bc
|
||||
ret
|
||||
|
||||
WritePokeballOAMData: ; 3a8e1 (e:68e1)
|
||||
ld de, wBuffer
|
||||
ld c, PARTY_LENGTH
|
||||
.loop
|
||||
ld a, [W_BASECOORDY] ; wd082
|
||||
ld [hli], a
|
||||
ld a, [W_BASECOORDX] ; wd081
|
||||
ld [hli], a
|
||||
ld a, [de]
|
||||
ld [hli], a
|
||||
xor a
|
||||
ld [hli], a
|
||||
ld a, [W_BASECOORDX] ; wd081
|
||||
ld b, a
|
||||
ld a, [wTrainerEngageDistance]
|
||||
add b
|
||||
ld [W_BASECOORDX], a ; wd081
|
||||
inc de
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
PlacePlayerHUDTiles: ; 3a902 (e:6902)
|
||||
ld hl, PlayerBattleHUDGraphicsTiles ; $6916
|
||||
ld de, wTrainerFacingDirection
|
||||
ld bc, $3
|
||||
call CopyData
|
||||
hlCoord 18, 10
|
||||
ld de, rIE ; $ffff
|
||||
jr PlaceHUDTiles
|
||||
|
||||
PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916)
|
||||
; The tile numbers for specific parts of the battle display for the player's pokemon
|
||||
db $73 ; unused ($73 is hardcoded into the routine that uses these bytes)
|
||||
db $77 ; lower-right corner tile of the HUD
|
||||
db $6F ; lower-left triangle tile of the HUD
|
||||
|
||||
PlaceEnemyHUDTiles: ; 3a919 (e:6919)
|
||||
ld hl, EnemyBattleHUDGraphicsTiles ; $692d
|
||||
ld de, wTrainerFacingDirection
|
||||
ld bc, $3
|
||||
call CopyData
|
||||
hlCoord 1, 2
|
||||
ld de, $1
|
||||
jr PlaceHUDTiles
|
||||
|
||||
EnemyBattleHUDGraphicsTiles: ; 3a92d (e:692d)
|
||||
; The tile numbers for specific parts of the battle display for the enemy
|
||||
db $73 ; unused ($73 is hardcoded in the routine that uses these bytes)
|
||||
db $74 ; lower-left corner tile of the HUD
|
||||
db $78 ; lower-right triangle tile of the HUD
|
||||
|
||||
PlaceHUDTiles: ; 3a930 (e:6930)
|
||||
ld [hl], $73
|
||||
ld bc, $14
|
||||
add hl, bc
|
||||
ld a, [wTrainerScreenY]
|
||||
ld [hl], a
|
||||
ld a, $8
|
||||
.asm_3a93c
|
||||
add hl, de
|
||||
ld [hl], $76
|
||||
dec a
|
||||
jr nz, .asm_3a93c
|
||||
add hl, de
|
||||
ld a, [wTrainerScreenX]
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948)
|
||||
call LoadPartyPokeballGfx
|
||||
ld hl, wPartyMon1Species ; wPartyMon1Species (aliases: wPartyMon1)
|
||||
ld de, wPartyCount ; wPartyCount
|
||||
call SetupPokeballs
|
||||
ld hl, W_BASECOORDX ; wd081
|
||||
ld a, $50
|
||||
ld [hli], a
|
||||
ld [hl], $40
|
||||
ld a, $8
|
||||
ld [wTrainerEngageDistance], a
|
||||
ld hl, wOAMBuffer
|
||||
call WritePokeballOAMData
|
||||
ld hl, wEnemyMons ; wEnemyMon1Species
|
||||
ld de, wEnemyPartyCount ; wEnemyPartyCount
|
||||
call SetupPokeballs
|
||||
ld hl, W_BASECOORDX ; wd081
|
||||
ld a, $50
|
||||
ld [hli], a
|
||||
ld [hl], $68
|
||||
ld hl, wOAMBuffer + $18
|
||||
jp WritePokeballOAMData
|
||||
|
||||
; four tiles: pokeball, black pokeball (status ailment), crossed out pokeball (faited) and pokeball slot (no mon)
|
||||
PokeballTileGraphics:: ; 3a97e (e:697e)
|
||||
INCBIN "gfx/pokeball.2bpp"
|
||||
|
|
@ -1,301 +0,0 @@
|
|||
HealEffect_: ; 3b9ec (e:79ec)
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld de, wBattleMonHP
|
||||
ld hl, wBattleMonMaxHP
|
||||
ld a, [W_PLAYERMOVENUM]
|
||||
jr z, .asm_3ba03
|
||||
ld de, wEnemyMonHP
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [W_ENEMYMOVENUM]
|
||||
.asm_3ba03
|
||||
ld b, a
|
||||
ld a, [de]
|
||||
cp [hl]
|
||||
inc de
|
||||
inc hl
|
||||
ld a, [de]
|
||||
sbc [hl]
|
||||
jp z, .failed
|
||||
ld a, b
|
||||
cp REST
|
||||
jr nz, .asm_3ba37
|
||||
push hl
|
||||
push de
|
||||
push af
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
ld hl, wBattleMonStatus
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3ba25
|
||||
ld hl, wEnemyMonStatus
|
||||
.asm_3ba25
|
||||
ld a, [hl]
|
||||
and a
|
||||
ld [hl], 2 ; Number of turns from Rest
|
||||
ld hl, StartedSleepingEffect
|
||||
jr z, .asm_3ba31
|
||||
ld hl, FellAsleepBecameHealthyText
|
||||
.asm_3ba31
|
||||
call PrintText
|
||||
pop af
|
||||
pop de
|
||||
pop hl
|
||||
.asm_3ba37
|
||||
ld a, [hld]
|
||||
ld [wHPBarMaxHP], a
|
||||
ld c, a
|
||||
ld a, [hl]
|
||||
ld [wHPBarMaxHP+1], a
|
||||
ld b, a
|
||||
jr z, .asm_3ba47
|
||||
srl b
|
||||
rr c
|
||||
.asm_3ba47
|
||||
ld a, [de]
|
||||
ld [wHPBarOldHP], a
|
||||
add c
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP], a
|
||||
dec de
|
||||
ld a, [de]
|
||||
ld [wHPBarOldHP+1], a
|
||||
adc b
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP+1], a
|
||||
inc hl
|
||||
inc de
|
||||
ld a, [de]
|
||||
dec de
|
||||
sub [hl]
|
||||
dec hl
|
||||
ld a, [de]
|
||||
sbc [hl]
|
||||
jr c, .asm_3ba6f
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP+1], a
|
||||
inc de
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP], a
|
||||
.asm_3ba6f
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call BankswitchEtoF
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
hlCoord 10, 9
|
||||
ld a, $1
|
||||
jr z, .asm_3ba83
|
||||
hlCoord 2, 2
|
||||
xor a
|
||||
.asm_3ba83
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2
|
||||
ld hl, DrawHUDsAndHPBars
|
||||
call BankswitchEtoF
|
||||
ld hl, RegainedHealthText
|
||||
jp PrintText
|
||||
.failed
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
ld hl, PrintButItFailedText_
|
||||
jp BankswitchEtoF
|
||||
|
||||
StartedSleepingEffect: ; 3baa2 (e:7aa2)
|
||||
TX_FAR _StartedSleepingEffect
|
||||
db "@"
|
||||
|
||||
FellAsleepBecameHealthyText: ; 3baa7 (e:7aa7)
|
||||
TX_FAR _FellAsleepBecameHealthyText
|
||||
db "@"
|
||||
|
||||
RegainedHealthText: ; 3baac (e:7aac)
|
||||
TX_FAR _RegainedHealthText
|
||||
db "@"
|
||||
|
||||
TransformEffect_: ; 3bab1 (e:7ab1)
|
||||
ld hl, wBattleMonSpecies
|
||||
ld de, wEnemyMonSpecies
|
||||
ld bc, W_ENEMYBATTSTATUS3
|
||||
ld a, [W_ENEMYBATTSTATUS1]
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr nz, .asm_3bad1
|
||||
ld hl, wEnemyMonSpecies
|
||||
ld de, wBattleMonSpecies
|
||||
ld bc, W_PLAYERBATTSTATUS3
|
||||
ld [wPlayerMoveListIndex], a
|
||||
ld a, [W_PLAYERBATTSTATUS1]
|
||||
.asm_3bad1
|
||||
bit Invulnerable, a ; is mon invulnerable to typical attacks? (fly/dig)
|
||||
jp nz, .failed
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld hl, W_PLAYERBATTSTATUS2
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3bae4
|
||||
ld hl, W_ENEMYBATTSTATUS2
|
||||
.asm_3bae4
|
||||
bit HasSubstituteUp, [hl]
|
||||
push af
|
||||
ld hl, Func_79747
|
||||
ld b, BANK(Func_79747)
|
||||
call nz, Bankswitch
|
||||
ld a, [W_OPTIONS]
|
||||
add a
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
ld b, BANK(PlayCurrentMoveAnimation)
|
||||
jr nc, .asm_3baff
|
||||
ld hl, AnimationTransformMon
|
||||
ld b, BANK(AnimationTransformMon)
|
||||
.asm_3baff
|
||||
call Bankswitch
|
||||
ld hl, Func_79771
|
||||
ld b, BANK(Func_79771)
|
||||
pop af
|
||||
call nz, Bankswitch
|
||||
pop bc
|
||||
ld a, [bc]
|
||||
set Transformed, a
|
||||
ld [bc], a
|
||||
pop de
|
||||
pop hl
|
||||
push hl
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
ld bc, $5
|
||||
add hl, bc
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
inc bc
|
||||
inc bc
|
||||
call CopyData
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3bb32
|
||||
ld a, [de]
|
||||
ld [wcceb], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ld [wccec], a
|
||||
dec de
|
||||
.asm_3bb32
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
inc hl
|
||||
inc hl
|
||||
inc hl
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
ld bc, $8
|
||||
call CopyData
|
||||
ld bc, $ffef
|
||||
add hl, bc
|
||||
ld b, $4
|
||||
.asm_3bb4a
|
||||
ld a, [hli]
|
||||
and a
|
||||
jr z, .asm_3bb57
|
||||
ld a, $5
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .asm_3bb4a
|
||||
jr .asm_3bb5d
|
||||
.asm_3bb57
|
||||
xor a
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .asm_3bb57
|
||||
.asm_3bb5d
|
||||
pop hl
|
||||
ld a, [hl]
|
||||
ld [wd11e], a
|
||||
call GetMonName
|
||||
ld hl, wEnemyMonUnmodifiedAttack
|
||||
ld de, wPlayerMonUnmodifiedAttack
|
||||
call .copyBasedOnTurn
|
||||
ld hl, wEnemyMonStatMods
|
||||
ld de, wPlayerMonStatMods
|
||||
call .copyBasedOnTurn
|
||||
ld hl, TransformedText
|
||||
jp PrintText
|
||||
|
||||
.copyBasedOnTurn
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3bb86
|
||||
push hl
|
||||
ld h, d
|
||||
ld l, e
|
||||
pop de
|
||||
.asm_3bb86
|
||||
ld bc, $8
|
||||
jp CopyData
|
||||
|
||||
.failed
|
||||
ld hl, PrintButItFailedText_
|
||||
jp BankswitchEtoF
|
||||
|
||||
TransformedText: ; 3bb92 (e:7b92)
|
||||
TX_FAR _TransformedText
|
||||
db "@"
|
||||
|
||||
ReflectLightScreenEffect_: ; 3bb97 (e:7b97)
|
||||
ld hl, W_PLAYERBATTSTATUS3
|
||||
ld de, W_PLAYERMOVEEFFECT
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3bba8
|
||||
ld hl, W_ENEMYBATTSTATUS3
|
||||
ld de, W_ENEMYMOVEEFFECT
|
||||
.asm_3bba8
|
||||
ld a, [de]
|
||||
cp LIGHT_SCREEN_EFFECT
|
||||
jr nz, .reflect
|
||||
bit HasLightScreenUp, [hl] ; is mon already protected by light screen?
|
||||
jr nz, .moveFailed
|
||||
set HasLightScreenUp, [hl] ; mon is now protected by light screen
|
||||
ld hl, LightScreenProtectedText
|
||||
jr .asm_3bbc1
|
||||
.reflect
|
||||
bit HasReflectUp, [hl] ; is mon already protected by reflect?
|
||||
jr nz, .moveFailed
|
||||
set HasReflectUp, [hl] ; mon is now protected by reflect
|
||||
ld hl, ReflectGainedArmorText
|
||||
.asm_3bbc1
|
||||
push hl
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call BankswitchEtoF
|
||||
pop hl
|
||||
jp PrintText
|
||||
.moveFailed
|
||||
ld c, $32
|
||||
call DelayFrames
|
||||
ld hl, PrintButItFailedText_
|
||||
jp BankswitchEtoF
|
||||
|
||||
LightScreenProtectedText: ; 3bbd7 (e:7bd7)
|
||||
TX_FAR _LightScreenProtectedText
|
||||
db "@"
|
||||
|
||||
ReflectGainedArmorText: ; 3bbdc (e:7bdc)
|
||||
TX_FAR _ReflectGainedArmorText
|
||||
db "@"
|
||||
|
||||
BankswitchEtoF: ; 3bbe1 (e:7be1)
|
||||
ld b, BANK(BattleCore)
|
||||
jp Bankswitch
|
||||
88
engine/battle/end_of_battle.asm
Normal file
88
engine/battle/end_of_battle.asm
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
EndOfBattle: ; 137aa (4:77aa)
|
||||
ld a, [wLinkState]
|
||||
cp LINK_STATE_BATTLING
|
||||
jr nz, .notLinkBattle
|
||||
; link battle
|
||||
ld a, [wEnemyMonPartyPos]
|
||||
ld hl, wEnemyMon1Status
|
||||
ld bc, wEnemyMon2 - wEnemyMon1
|
||||
call AddNTimes
|
||||
ld a, [wEnemyMonStatus]
|
||||
ld [hl], a
|
||||
call ClearScreen
|
||||
callab DisplayLinkBattleVersusTextBox
|
||||
ld a, [wBattleResult]
|
||||
cp $1
|
||||
ld de, YouWinText
|
||||
jr c, .placeWinOrLoseString
|
||||
ld de, YouLoseText
|
||||
jr z, .placeWinOrLoseString
|
||||
ld de, DrawText
|
||||
.placeWinOrLoseString
|
||||
hlCoord 6, 8
|
||||
call PlaceString
|
||||
ld c, $c8
|
||||
call DelayFrames
|
||||
jr .evolution
|
||||
.notLinkBattle
|
||||
ld a, [wBattleResult]
|
||||
and a
|
||||
jr nz, .resetVariables
|
||||
ld hl, wTotalPayDayMoney
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
inc hl
|
||||
or [hl]
|
||||
jr z, .evolution ; if pay day money is 0, jump
|
||||
ld de, wPlayerMoney + 2
|
||||
ld c, $3
|
||||
predef AddBCDPredef
|
||||
ld hl, PickUpPayDayMoneyText
|
||||
call PrintText
|
||||
.evolution
|
||||
xor a
|
||||
ld [wccd4], a
|
||||
predef EvolutionAfterBattle
|
||||
.resetVariables
|
||||
xor a
|
||||
ld [wLowHealthAlarm], a ;disable low health alarm
|
||||
ld [wc02a], a
|
||||
ld [W_ISINBATTLE], a
|
||||
ld [W_BATTLETYPE], a
|
||||
ld [W_MOVEMISSED], a
|
||||
ld [W_CUROPPONENT], a
|
||||
ld [wd11f], a
|
||||
ld [wNumRunAttempts], a
|
||||
ld [wEscapedFromBattle], a
|
||||
ld hl, wcc2b
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld [wListScrollOffset], a
|
||||
ld hl, wPlayerStatsToDouble
|
||||
ld b, $18
|
||||
.loop
|
||||
ld [hli], a
|
||||
dec b
|
||||
jr nz, .loop
|
||||
ld hl, wd72c
|
||||
set 0, [hl]
|
||||
call WaitForSoundToFinish
|
||||
call GBPalWhiteOut
|
||||
ld a, $ff
|
||||
ld [wDestinationWarpID], a
|
||||
ret
|
||||
|
||||
YouWinText: ; 13853 (4:7853)
|
||||
db "YOU WIN@"
|
||||
|
||||
YouLoseText: ; 1385b (4:785b)
|
||||
db "YOU LOSE@"
|
||||
|
||||
DrawText: ; 13864 (4:7864)
|
||||
db " DRAW@"
|
||||
|
||||
PickUpPayDayMoneyText: ; 1386b (4:786b)
|
||||
TX_FAR _PickUpPayDayMoneyText
|
||||
db "@"
|
||||
6
engine/battle/15.asm → engine/battle/experience.asm
Executable file → Normal file
6
engine/battle/15.asm → engine/battle/experience.asm
Executable file → Normal file
|
|
@ -82,7 +82,7 @@ GainExperience: ; 5524f (15:524f)
|
|||
call BoostExp ; traded mon exp boost
|
||||
ld a, $1
|
||||
.next
|
||||
ld [wcf4d], a
|
||||
ld [wGainBoostedExp], a
|
||||
ld a, [W_ISINBATTLE]
|
||||
dec a ; is it a trainer battle?
|
||||
call nz, BoostExp ; if so, boost exp
|
||||
|
|
@ -342,12 +342,12 @@ BoostExp: ; 5549f (15:549f)
|
|||
GainedText: ; 554b2 (15:54b2)
|
||||
TX_FAR _GainedText
|
||||
db $08 ; asm
|
||||
ld a, [wcc5b]
|
||||
ld a, [wBoostExpByExpAll]
|
||||
ld hl, WithExpAllText
|
||||
and a
|
||||
ret nz
|
||||
ld hl, ExpPointsText
|
||||
ld a, [wcf4d]
|
||||
ld a, [wGainBoostedExp]
|
||||
and a
|
||||
ret z
|
||||
ld hl, BoostedText
|
||||
24
engine/battle/get_trainer_name.asm
Normal file
24
engine/battle/get_trainer_name.asm
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
GetTrainerName_: ; 13a58 (4:7a58)
|
||||
ld hl, W_GRASSRATE
|
||||
ld a, [wLinkState]
|
||||
and a
|
||||
jr nz, .rival
|
||||
ld hl, W_RIVALNAME
|
||||
ld a, [W_TRAINERCLASS]
|
||||
cp SONY1
|
||||
jr z, .rival
|
||||
cp SONY2
|
||||
jr z, .rival
|
||||
cp SONY3
|
||||
jr z, .rival
|
||||
ld [wd0b5], a
|
||||
ld a, TRAINER_NAME
|
||||
ld [wNameListType], a
|
||||
ld a, BANK(TrainerNames)
|
||||
ld [wPredefBank], a
|
||||
call GetName
|
||||
ld hl, wcd6d
|
||||
.rival
|
||||
ld de, W_TRAINERNAME
|
||||
ld bc, $d
|
||||
jp CopyData
|
||||
89
engine/battle/ghost_marowak_anim.asm
Normal file
89
engine/battle/ghost_marowak_anim.asm
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
MarowakAnim: ; 708ca (1c:48ca)
|
||||
; animate the ghost being unveiled as a Marowak
|
||||
ld a, $e4
|
||||
ld [rOBP1], a
|
||||
call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same
|
||||
; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap
|
||||
hlCoord 12, 0
|
||||
ld bc, $707
|
||||
call ClearScreenArea
|
||||
call Delay3
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a ; disable BG transfer so we don't see the Marowak too soon
|
||||
; replace ghost pic with Marowak in BG
|
||||
ld a, MAROWAK
|
||||
ld [wHPBarMaxHP], a
|
||||
ld a, $1
|
||||
ld [H_WHOSETURN], a
|
||||
callab Func_79793
|
||||
; alternate between black and light grey 8 times.
|
||||
; this makes the ghost's body appear to flash
|
||||
ld d, $80
|
||||
call FlashSprite8Times
|
||||
.fadeOutGhostLoop
|
||||
ld c, 10
|
||||
call DelayFrames
|
||||
ld a, [rOBP1]
|
||||
sla a
|
||||
sla a
|
||||
ld [rOBP1], a
|
||||
jr nz, .fadeOutGhostLoop
|
||||
call ClearSprites
|
||||
call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM
|
||||
ld b, $e4
|
||||
.fadeInMarowakLoop
|
||||
ld c, 10
|
||||
call DelayFrames
|
||||
ld a, [rOBP1]
|
||||
srl b
|
||||
rra
|
||||
srl b
|
||||
rra
|
||||
ld [rOBP1], a
|
||||
ld a, b
|
||||
and a
|
||||
jr nz, .fadeInMarowakLoop
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
|
||||
call Delay3
|
||||
jp ClearSprites
|
||||
|
||||
; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM
|
||||
CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a)
|
||||
ld de, vFrontPic
|
||||
ld hl, vSprites
|
||||
ld bc, 7 * 7
|
||||
call CopyVideoData
|
||||
ld a, $10
|
||||
ld [W_BASECOORDY], a
|
||||
ld a, $70
|
||||
ld [W_BASECOORDX], a
|
||||
ld hl, wOAMBuffer
|
||||
ld bc, $606
|
||||
ld d, $8
|
||||
.oamLoop
|
||||
push bc
|
||||
ld a, [W_BASECOORDY]
|
||||
ld e, a
|
||||
.oamInnerLoop
|
||||
ld a, e
|
||||
add $8
|
||||
ld e, a
|
||||
ld [hli], a
|
||||
ld a, [W_BASECOORDX]
|
||||
ld [hli], a
|
||||
ld a, d
|
||||
ld [hli], a
|
||||
ld a, $10 ; use OBP1
|
||||
ld [hli], a
|
||||
inc d
|
||||
dec c
|
||||
jr nz, .oamInnerLoop
|
||||
inc d
|
||||
ld a, [W_BASECOORDX]
|
||||
add $8
|
||||
ld [W_BASECOORDX], a
|
||||
pop bc
|
||||
dec b
|
||||
jr nz, .oamLoop
|
||||
ret
|
||||
40
engine/battle/init_battle_variables.asm
Normal file
40
engine/battle/init_battle_variables.asm
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
InitBattleVariables: ; 525af (14:65af)
|
||||
ld a, [hTilesetType]
|
||||
ld [wd0d4], a
|
||||
xor a
|
||||
ld [wcd6a], a
|
||||
ld [wBattleResult], a
|
||||
ld hl, wcc2b
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld [wListScrollOffset], a
|
||||
ld [wCriticalHitOrOHKO], a
|
||||
ld [wBattleMonSpecies], a
|
||||
ld [wPartyGainExpFlags], a
|
||||
ld [wPlayerMonNumber], a
|
||||
ld [wEscapedFromBattle], a
|
||||
ld [wMapPalOffset], a
|
||||
ld hl, wcf1d
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld hl, wccd3
|
||||
ld b, $3c
|
||||
.loop
|
||||
ld [hli], a
|
||||
dec b
|
||||
jr nz, .loop
|
||||
inc a
|
||||
ld [wccd9], a
|
||||
ld a, [W_CURMAP]
|
||||
cp SAFARI_ZONE_EAST
|
||||
jr c, .notSafariBattle
|
||||
cp SAFARI_ZONE_REST_HOUSE_1
|
||||
jr nc, .notSafariBattle
|
||||
ld a, $2 ; safari battle
|
||||
ld [W_BATTLETYPE], a
|
||||
.notSafariBattle
|
||||
ld hl, PlayBattleMusic
|
||||
ld b, BANK(PlayBattleMusic)
|
||||
jp Bankswitch
|
||||
0
engine/battle/d.asm → engine/battle/link_battle_versus_text.asm
Executable file → Normal file
0
engine/battle/d.asm → engine/battle/link_battle_versus_text.asm
Executable file → Normal file
34
engine/battle/moveEffects/conversion_effect.asm
Normal file
34
engine/battle/moveEffects/conversion_effect.asm
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
ConversionEffect_: ; 139a3 (4:79a3)
|
||||
ld hl, wEnemyMonType1
|
||||
ld de, wBattleMonType1
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [W_ENEMYBATTSTATUS1]
|
||||
jr z, .asm_139b8
|
||||
push hl
|
||||
ld h, d
|
||||
ld l, e
|
||||
pop de
|
||||
ld a, [W_PLAYERBATTSTATUS1]
|
||||
.asm_139b8
|
||||
bit Invulnerable, a ; is mon immune to typical attacks (dig/fly)
|
||||
jr nz, PrintButItFailedText
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call CallBankF
|
||||
ld hl, ConvertedTypeText
|
||||
jp PrintText
|
||||
|
||||
ConvertedTypeText: ; 139cd (4:79cd)
|
||||
TX_FAR _ConvertedTypeText
|
||||
db "@"
|
||||
|
||||
PrintButItFailedText: ; 139d2 (4:79d2)
|
||||
ld hl, PrintButItFailedText_
|
||||
CallBankF: ; 139d5 (4:79d5)
|
||||
ld b, BANK(PrintButItFailedText_)
|
||||
jp Bankswitch
|
||||
0
engine/battle/1.asm → engine/battle/moveEffects/drain_hp_effect.asm
Executable file → Normal file
0
engine/battle/1.asm → engine/battle/moveEffects/drain_hp_effect.asm
Executable file → Normal file
24
engine/battle/moveEffects/focus_energy_effect.asm
Normal file
24
engine/battle/moveEffects/focus_energy_effect.asm
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
FocusEnergyEffect_: ; 27f86 (9:7f86)
|
||||
ld hl, W_PLAYERBATTSTATUS2
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .notEnemy
|
||||
ld hl, W_ENEMYBATTSTATUS2
|
||||
.notEnemy
|
||||
bit GettingPumped, [hl] ; is mon already using focus energy?
|
||||
jr nz, .alreadyUsing
|
||||
set GettingPumped, [hl] ; mon is now using focus energy
|
||||
callab PlayCurrentMoveAnimation
|
||||
ld hl, GettingPumpedText
|
||||
jp PrintText
|
||||
.alreadyUsing
|
||||
ld c, $32
|
||||
call DelayFrames
|
||||
ld hl, PrintButItFailedText_
|
||||
ld b, BANK(PrintButItFailedText_)
|
||||
jp Bankswitch
|
||||
|
||||
GettingPumpedText: ; 27fb3 (9:7fb3)
|
||||
db $0a
|
||||
TX_FAR _GettingPumpedText
|
||||
db "@"
|
||||
76
engine/battle/moveEffects/haze_effect.asm
Normal file
76
engine/battle/moveEffects/haze_effect.asm
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
HazeEffect_: ; 139da (4:79da)
|
||||
ld a, $7
|
||||
ld hl, wPlayerMonAttackMod
|
||||
call ResetStatMods
|
||||
ld hl, wEnemyMonAttackMod
|
||||
call ResetStatMods
|
||||
ld hl, wPlayerMonUnmodifiedAttack
|
||||
ld de, wBattleMonAttack
|
||||
call ResetStats
|
||||
ld hl, wEnemyMonUnmodifiedAttack
|
||||
ld de, wEnemyMonAttack
|
||||
call ResetStats
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, wEnemySelectedMove
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_13a09
|
||||
ld hl, wBattleMonStatus
|
||||
dec de
|
||||
|
||||
.asm_13a09
|
||||
ld a, [hl]
|
||||
ld [hl], $0
|
||||
and $27
|
||||
jr z, .asm_13a13
|
||||
ld a, $ff
|
||||
ld [de], a
|
||||
|
||||
.asm_13a13
|
||||
xor a
|
||||
ld [W_PLAYERDISABLEDMOVE], a
|
||||
ld [W_ENEMYDISABLEDMOVE], a
|
||||
ld hl, wccee
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld hl, W_PLAYERBATTSTATUS1
|
||||
call CureStatuses
|
||||
ld hl, W_ENEMYBATTSTATUS1
|
||||
call CureStatuses
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call CallBankF
|
||||
ld hl, StatusChangesEliminatedText
|
||||
jp PrintText
|
||||
|
||||
CureStatuses: ; 13a37 (4:7a37)
|
||||
res Confused, [hl]
|
||||
inc hl ; BATTSTATUS2
|
||||
ld a, [hl]
|
||||
and (1 << UsingRage) | (1 << NeedsToRecharge) | (1 << HasSubstituteUp) | (1 << 3) ; clear all but these from BATTSTATUS2
|
||||
ld [hli], a ; BATTSTATUS3
|
||||
ld a, [hl]
|
||||
and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
ResetStatMods: ; 13a43 (4:7a43)
|
||||
ld b, $8
|
||||
.loop
|
||||
ld [hli], a
|
||||
dec b
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
ResetStats: ; 13a4a (4:7a4a)
|
||||
ld b, $8
|
||||
.loop
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
StatusChangesEliminatedText: ; 13a53 (4:7a53)
|
||||
TX_FAR _StatusChangesEliminatedText
|
||||
db "@"
|
||||
116
engine/battle/moveEffects/heal_effect.asm
Normal file
116
engine/battle/moveEffects/heal_effect.asm
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
HealEffect_: ; 3b9ec (e:79ec)
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld de, wBattleMonHP
|
||||
ld hl, wBattleMonMaxHP
|
||||
ld a, [W_PLAYERMOVENUM]
|
||||
jr z, .asm_3ba03
|
||||
ld de, wEnemyMonHP
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [W_ENEMYMOVENUM]
|
||||
.asm_3ba03
|
||||
ld b, a
|
||||
ld a, [de]
|
||||
cp [hl]
|
||||
inc de
|
||||
inc hl
|
||||
ld a, [de]
|
||||
sbc [hl]
|
||||
jp z, .failed
|
||||
ld a, b
|
||||
cp REST
|
||||
jr nz, .asm_3ba37
|
||||
push hl
|
||||
push de
|
||||
push af
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
ld hl, wBattleMonStatus
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3ba25
|
||||
ld hl, wEnemyMonStatus
|
||||
.asm_3ba25
|
||||
ld a, [hl]
|
||||
and a
|
||||
ld [hl], 2 ; Number of turns from Rest
|
||||
ld hl, StartedSleepingEffect
|
||||
jr z, .asm_3ba31
|
||||
ld hl, FellAsleepBecameHealthyText
|
||||
.asm_3ba31
|
||||
call PrintText
|
||||
pop af
|
||||
pop de
|
||||
pop hl
|
||||
.asm_3ba37
|
||||
ld a, [hld]
|
||||
ld [wHPBarMaxHP], a
|
||||
ld c, a
|
||||
ld a, [hl]
|
||||
ld [wHPBarMaxHP+1], a
|
||||
ld b, a
|
||||
jr z, .asm_3ba47
|
||||
srl b
|
||||
rr c
|
||||
.asm_3ba47
|
||||
ld a, [de]
|
||||
ld [wHPBarOldHP], a
|
||||
add c
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP], a
|
||||
dec de
|
||||
ld a, [de]
|
||||
ld [wHPBarOldHP+1], a
|
||||
adc b
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP+1], a
|
||||
inc hl
|
||||
inc de
|
||||
ld a, [de]
|
||||
dec de
|
||||
sub [hl]
|
||||
dec hl
|
||||
ld a, [de]
|
||||
sbc [hl]
|
||||
jr c, .asm_3ba6f
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP+1], a
|
||||
inc de
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
ld [wHPBarNewHP], a
|
||||
.asm_3ba6f
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call BankswitchEtoF
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
hlCoord 10, 9
|
||||
ld a, $1
|
||||
jr z, .asm_3ba83
|
||||
hlCoord 2, 2
|
||||
xor a
|
||||
.asm_3ba83
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2
|
||||
ld hl, DrawHUDsAndHPBars
|
||||
call BankswitchEtoF
|
||||
ld hl, RegainedHealthText
|
||||
jp PrintText
|
||||
.failed
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
ld hl, PrintButItFailedText_
|
||||
jp BankswitchEtoF
|
||||
|
||||
StartedSleepingEffect: ; 3baa2 (e:7aa2)
|
||||
TX_FAR _StartedSleepingEffect
|
||||
db "@"
|
||||
|
||||
FellAsleepBecameHealthyText: ; 3baa7 (e:7aa7)
|
||||
TX_FAR _FellAsleepBecameHealthyText
|
||||
db "@"
|
||||
|
||||
RegainedHealthText: ; 3baac (e:7aac)
|
||||
TX_FAR _RegainedHealthText
|
||||
db "@"
|
||||
0
engine/battle/a.asm → engine/battle/moveEffects/leech_seed_effect.asm
Executable file → Normal file
0
engine/battle/a.asm → engine/battle/moveEffects/leech_seed_effect.asm
Executable file → Normal file
21
engine/battle/moveEffects/mist_effect.asm
Normal file
21
engine/battle/moveEffects/mist_effect.asm
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MistEffect_: ; 33f2b (c:7f2b)
|
||||
ld hl, W_PLAYERBATTSTATUS2
|
||||
ld a, [$fff3]
|
||||
and a
|
||||
jr z, .asm_33f36
|
||||
ld hl, W_ENEMYBATTSTATUS2
|
||||
.asm_33f36
|
||||
bit ProtectedByMist, [hl] ; is mon protected by mist?
|
||||
jr nz, .asm_33f4a
|
||||
set ProtectedByMist, [hl] ; mon is now protected by mist
|
||||
callab PlayCurrentMoveAnimation
|
||||
ld hl, ShroudedInMistText
|
||||
jp PrintText
|
||||
.asm_33f4a
|
||||
ld hl, PrintButItFailedText_
|
||||
ld b, BANK(PrintButItFailedText_)
|
||||
jp Bankswitch
|
||||
|
||||
ShroudedInMistText: ; 33f52 (c:7f52)
|
||||
TX_FAR _ShroudedInMistText
|
||||
db "@"
|
||||
22
engine/battle/c.asm → engine/battle/moveEffects/one_hit_ko_effect.asm
Executable file → Normal file
22
engine/battle/c.asm → engine/battle/moveEffects/one_hit_ko_effect.asm
Executable file → Normal file
|
|
@ -1,25 +1,3 @@
|
|||
MistEffect_: ; 33f2b (c:7f2b)
|
||||
ld hl, W_PLAYERBATTSTATUS2
|
||||
ld a, [$fff3]
|
||||
and a
|
||||
jr z, .asm_33f36
|
||||
ld hl, W_ENEMYBATTSTATUS2
|
||||
.asm_33f36
|
||||
bit ProtectedByMist, [hl] ; is mon protected by mist?
|
||||
jr nz, .asm_33f4a
|
||||
set ProtectedByMist, [hl] ; mon is now protected by mist
|
||||
callab PlayCurrentMoveAnimation
|
||||
ld hl, ShroudedInMistText
|
||||
jp PrintText
|
||||
.asm_33f4a
|
||||
ld hl, PrintButItFailedText_
|
||||
ld b, BANK(PrintButItFailedText_)
|
||||
jp Bankswitch
|
||||
|
||||
ShroudedInMistText: ; 33f52 (c:7f52)
|
||||
TX_FAR _ShroudedInMistText
|
||||
db "@"
|
||||
|
||||
OneHitKOEffect_: ; 33f57 (c:7f57)
|
||||
ld hl, W_DAMAGE
|
||||
xor a
|
||||
41
engine/battle/14.asm → engine/battle/moveEffects/paralyze_effect.asm
Executable file → Normal file
41
engine/battle/14.asm → engine/battle/moveEffects/paralyze_effect.asm
Executable file → Normal file
|
|
@ -1,44 +1,3 @@
|
|||
InitBattleVariables: ; 525af (14:65af)
|
||||
ld a, [hTilesetType]
|
||||
ld [wd0d4], a
|
||||
xor a
|
||||
ld [wcd6a], a
|
||||
ld [wBattleResult], a
|
||||
ld hl, wcc2b
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld [wListScrollOffset], a
|
||||
ld [wCriticalHitOrOHKO], a
|
||||
ld [wBattleMonSpecies], a
|
||||
ld [wPartyGainExpFlags], a
|
||||
ld [wPlayerMonNumber], a
|
||||
ld [wEscapedFromBattle], a
|
||||
ld [wMapPalOffset], a
|
||||
ld hl, wcf1d
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld hl, wccd3
|
||||
ld b, $3c
|
||||
.loop
|
||||
ld [hli], a
|
||||
dec b
|
||||
jr nz, .loop
|
||||
inc a
|
||||
ld [wccd9], a
|
||||
ld a, [W_CURMAP]
|
||||
cp SAFARI_ZONE_EAST
|
||||
jr c, .notSafariBattle
|
||||
cp SAFARI_ZONE_REST_HOUSE_1
|
||||
jr nc, .notSafariBattle
|
||||
ld a, $2 ; safari battle
|
||||
ld [W_BATTLETYPE], a
|
||||
.notSafariBattle
|
||||
ld hl, PlayBattleMusic
|
||||
ld b, BANK(PlayBattleMusic)
|
||||
jp Bankswitch
|
||||
|
||||
ParalyzeEffect_: ; 52601 (14:6601)
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, W_PLAYERMOVETYPE
|
||||
43
engine/battle/moveEffects/pay_day_effect.asm
Normal file
43
engine/battle/moveEffects/pay_day_effect.asm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
PayDayEffect_ ; 2feb8 (b:7eb8)
|
||||
xor a
|
||||
ld hl, wcd6d
|
||||
ld [hli], a
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [wBattleMonLevel]
|
||||
jr z, .asm_2fec8
|
||||
ld a, [wEnemyMonLevel]
|
||||
.asm_2fec8
|
||||
add a
|
||||
ld [H_DIVIDEND + 3], a
|
||||
xor a
|
||||
ld [H_DIVIDEND], a
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld [H_DIVIDEND + 2], a
|
||||
ld a, $64
|
||||
ld [H_DIVISOR], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld [hli], a
|
||||
ld a, [H_REMAINDER]
|
||||
ld [H_DIVIDEND + 3], a
|
||||
ld a, $a
|
||||
ld [H_DIVISOR], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
swap a
|
||||
ld b, a
|
||||
ld a, [H_REMAINDER]
|
||||
add b
|
||||
ld [hl], a
|
||||
ld de, wTotalPayDayMoney + 2
|
||||
ld c, $3
|
||||
predef AddBCDPredef
|
||||
ld hl, CoinsScatteredText
|
||||
jp PrintText
|
||||
|
||||
CoinsScatteredText: ; 2ff04 (b:7f04)
|
||||
TX_FAR _CoinsScatteredText
|
||||
db "@"
|
||||
68
engine/battle/moveEffects/recoil_effect.asm
Normal file
68
engine/battle/moveEffects/recoil_effect.asm
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
RecoilEffect_: ; 1392c (4:792c)
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [W_PLAYERMOVENUM]
|
||||
ld hl, wBattleMonMaxHP
|
||||
jr z, .asm_1393d
|
||||
ld a, [W_ENEMYMOVENUM]
|
||||
ld hl, wEnemyMonMaxHP
|
||||
.asm_1393d
|
||||
ld d, a
|
||||
ld a, [W_DAMAGE]
|
||||
ld b, a
|
||||
ld a, [W_DAMAGE + 1]
|
||||
ld c, a
|
||||
srl b
|
||||
rr c
|
||||
ld a, d
|
||||
cp STRUGGLE
|
||||
jr z, .asm_13953
|
||||
srl b
|
||||
rr c
|
||||
.asm_13953
|
||||
ld a, b
|
||||
or c
|
||||
jr nz, .asm_13958
|
||||
inc c
|
||||
.asm_13958
|
||||
ld a, [hli]
|
||||
ld [wHPBarMaxHP+1], a
|
||||
ld a, [hl]
|
||||
ld [wHPBarMaxHP], a
|
||||
push bc
|
||||
ld bc, $fff2
|
||||
add hl, bc
|
||||
pop bc
|
||||
ld a, [hl]
|
||||
ld [wHPBarOldHP], a
|
||||
sub c
|
||||
ld [hld], a
|
||||
ld [wHPBarNewHP], a
|
||||
ld a, [hl]
|
||||
ld [wHPBarOldHP+1], a
|
||||
sbc b
|
||||
ld [hl], a
|
||||
ld [wHPBarNewHP+1], a
|
||||
jr nc, .asm_13982
|
||||
xor a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld hl, wHPBarNewHP
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
.asm_13982
|
||||
hlCoord 10, 9
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, $1
|
||||
jr z, .asm_13990
|
||||
hlCoord 2, 2
|
||||
xor a
|
||||
.asm_13990
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2
|
||||
ld hl, HitWithRecoilText
|
||||
jp PrintText
|
||||
HitWithRecoilText: ; 1399e (4:799e)
|
||||
TX_FAR _HitWithRecoilText
|
||||
db "@"
|
||||
45
engine/battle/moveEffects/reflect_light_screen_effect.asm
Normal file
45
engine/battle/moveEffects/reflect_light_screen_effect.asm
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
ReflectLightScreenEffect_: ; 3bb97 (e:7b97)
|
||||
ld hl, W_PLAYERBATTSTATUS3
|
||||
ld de, W_PLAYERMOVEEFFECT
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3bba8
|
||||
ld hl, W_ENEMYBATTSTATUS3
|
||||
ld de, W_ENEMYMOVEEFFECT
|
||||
.asm_3bba8
|
||||
ld a, [de]
|
||||
cp LIGHT_SCREEN_EFFECT
|
||||
jr nz, .reflect
|
||||
bit HasLightScreenUp, [hl] ; is mon already protected by light screen?
|
||||
jr nz, .moveFailed
|
||||
set HasLightScreenUp, [hl] ; mon is now protected by light screen
|
||||
ld hl, LightScreenProtectedText
|
||||
jr .asm_3bbc1
|
||||
.reflect
|
||||
bit HasReflectUp, [hl] ; is mon already protected by reflect?
|
||||
jr nz, .moveFailed
|
||||
set HasReflectUp, [hl] ; mon is now protected by reflect
|
||||
ld hl, ReflectGainedArmorText
|
||||
.asm_3bbc1
|
||||
push hl
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call BankswitchEtoF
|
||||
pop hl
|
||||
jp PrintText
|
||||
.moveFailed
|
||||
ld c, $32
|
||||
call DelayFrames
|
||||
ld hl, PrintButItFailedText_
|
||||
jp BankswitchEtoF
|
||||
|
||||
LightScreenProtectedText: ; 3bbd7 (e:7bd7)
|
||||
TX_FAR _LightScreenProtectedText
|
||||
db "@"
|
||||
|
||||
ReflectGainedArmorText: ; 3bbdc (e:7bdc)
|
||||
TX_FAR _ReflectGainedArmorText
|
||||
db "@"
|
||||
|
||||
BankswitchEtoF: ; 3bbe1 (e:7be1)
|
||||
ld b, BANK(BattleCore)
|
||||
jp Bankswitch
|
||||
2
engine/battle/5.asm → engine/battle/moveEffects/substitute_effect.asm
Executable file → Normal file
2
engine/battle/5.asm → engine/battle/moveEffects/substitute_effect.asm
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
SubstituteEffectHandler: ; 17dad (5:7dad)
|
||||
SubstituteEffect_: ; 17dad (5:7dad)
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
ld hl, wBattleMonMaxHP
|
||||
138
engine/battle/moveEffects/transform_effect.asm
Normal file
138
engine/battle/moveEffects/transform_effect.asm
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
TransformEffect_: ; 3bab1 (e:7ab1)
|
||||
ld hl, wBattleMonSpecies
|
||||
ld de, wEnemyMonSpecies
|
||||
ld bc, W_ENEMYBATTSTATUS3
|
||||
ld a, [W_ENEMYBATTSTATUS1]
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr nz, .asm_3bad1
|
||||
ld hl, wEnemyMonSpecies
|
||||
ld de, wBattleMonSpecies
|
||||
ld bc, W_PLAYERBATTSTATUS3
|
||||
ld [wPlayerMoveListIndex], a
|
||||
ld a, [W_PLAYERBATTSTATUS1]
|
||||
.asm_3bad1
|
||||
bit Invulnerable, a ; is mon invulnerable to typical attacks? (fly/dig)
|
||||
jp nz, .failed
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld hl, W_PLAYERBATTSTATUS2
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3bae4
|
||||
ld hl, W_ENEMYBATTSTATUS2
|
||||
.asm_3bae4
|
||||
bit HasSubstituteUp, [hl]
|
||||
push af
|
||||
ld hl, Func_79747
|
||||
ld b, BANK(Func_79747)
|
||||
call nz, Bankswitch
|
||||
ld a, [W_OPTIONS]
|
||||
add a
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
ld b, BANK(PlayCurrentMoveAnimation)
|
||||
jr nc, .asm_3baff
|
||||
ld hl, AnimationTransformMon
|
||||
ld b, BANK(AnimationTransformMon)
|
||||
.asm_3baff
|
||||
call Bankswitch
|
||||
ld hl, Func_79771
|
||||
ld b, BANK(Func_79771)
|
||||
pop af
|
||||
call nz, Bankswitch
|
||||
pop bc
|
||||
ld a, [bc]
|
||||
set Transformed, a
|
||||
ld [bc], a
|
||||
pop de
|
||||
pop hl
|
||||
push hl
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
ld bc, $5
|
||||
add hl, bc
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
inc bc
|
||||
inc bc
|
||||
call CopyData
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3bb32
|
||||
ld a, [de]
|
||||
ld [wcceb], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ld [wccec], a
|
||||
dec de
|
||||
.asm_3bb32
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
inc hl
|
||||
inc hl
|
||||
inc hl
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
ld bc, $8
|
||||
call CopyData
|
||||
ld bc, $ffef
|
||||
add hl, bc
|
||||
ld b, $4
|
||||
.asm_3bb4a
|
||||
ld a, [hli]
|
||||
and a
|
||||
jr z, .asm_3bb57
|
||||
ld a, $5
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .asm_3bb4a
|
||||
jr .asm_3bb5d
|
||||
.asm_3bb57
|
||||
xor a
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .asm_3bb57
|
||||
.asm_3bb5d
|
||||
pop hl
|
||||
ld a, [hl]
|
||||
ld [wd11e], a
|
||||
call GetMonName
|
||||
ld hl, wEnemyMonUnmodifiedAttack
|
||||
ld de, wPlayerMonUnmodifiedAttack
|
||||
call .copyBasedOnTurn
|
||||
ld hl, wEnemyMonStatMods
|
||||
ld de, wPlayerMonStatMods
|
||||
call .copyBasedOnTurn
|
||||
ld hl, TransformedText
|
||||
jp PrintText
|
||||
|
||||
.copyBasedOnTurn
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .asm_3bb86
|
||||
push hl
|
||||
ld h, d
|
||||
ld l, e
|
||||
pop de
|
||||
.asm_3bb86
|
||||
ld bc, $8
|
||||
jp CopyData
|
||||
|
||||
.failed
|
||||
ld hl, PrintButItFailedText_
|
||||
jp BankswitchEtoF
|
||||
|
||||
TransformedText: ; 3bb92 (e:7b92)
|
||||
TX_FAR _TransformedText
|
||||
db "@"
|
||||
52
engine/battle/print_type.asm
Normal file
52
engine/battle/print_type.asm
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
; [wd0b5] = pokemon ID
|
||||
; hl = dest addr
|
||||
PrintMonType: ; 27d6b (9:7d6b)
|
||||
call GetPredefRegisters
|
||||
push hl
|
||||
call GetMonHeader
|
||||
pop hl
|
||||
push hl
|
||||
ld a, [W_MONHTYPE1]
|
||||
call PrintType
|
||||
ld a, [W_MONHTYPE1]
|
||||
ld b, a
|
||||
ld a, [W_MONHTYPE2]
|
||||
cp b
|
||||
pop hl
|
||||
jr z, EraseType2Text
|
||||
ld bc, SCREEN_WIDTH * 2
|
||||
add hl, bc
|
||||
|
||||
; a = type
|
||||
; hl = dest addr
|
||||
PrintType: ; 27d89 (9:7d89)
|
||||
push hl
|
||||
jr PrintType_
|
||||
|
||||
; erase "TYPE2/" if the mon only has 1 type
|
||||
EraseType2Text: ; 27d8c (9:7d8c)
|
||||
ld a, " "
|
||||
ld bc, $13
|
||||
add hl, bc
|
||||
ld bc, $6
|
||||
jp FillMemory
|
||||
|
||||
PrintMoveType: ; 27d98 (9:7d98)
|
||||
call GetPredefRegisters
|
||||
push hl
|
||||
ld a, [W_PLAYERMOVETYPE]
|
||||
; fall through
|
||||
|
||||
PrintType_: ; 27d9f (9:7d9f)
|
||||
add a
|
||||
ld hl, TypeNames
|
||||
ld e, a
|
||||
ld d, $0
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
ld d, [hl]
|
||||
pop hl
|
||||
jp PlaceString
|
||||
|
||||
INCLUDE "text/type_names.asm"
|
||||
164
engine/battle/read_trainer_party.asm
Normal file
164
engine/battle/read_trainer_party.asm
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
ReadTrainer: ; 39c53 (e:5c53)
|
||||
|
||||
; don't change any moves in a link battle
|
||||
ld a,[wLinkState]
|
||||
and a
|
||||
ret nz
|
||||
|
||||
; set [wEnemyPartyCount] to 0, [wEnemyPartyMons] to FF
|
||||
; XXX first is total enemy pokemon?
|
||||
; XXX second is species of first pokemon?
|
||||
ld hl,wEnemyPartyCount
|
||||
xor a
|
||||
ld [hli],a
|
||||
dec a
|
||||
ld [hl],a
|
||||
|
||||
; get the pointer to trainer data for this class
|
||||
ld a,[W_CUROPPONENT]
|
||||
sub $C9 ; convert value from pokemon to trainer
|
||||
add a,a
|
||||
ld hl,TrainerDataPointers
|
||||
ld c,a
|
||||
ld b,0
|
||||
add hl,bc ; hl points to trainer class
|
||||
ld a,[hli]
|
||||
ld h,[hl]
|
||||
ld l,a
|
||||
ld a,[W_TRAINERNO]
|
||||
ld b,a
|
||||
; At this point b contains the trainer number,
|
||||
; and hl points to the trainer class.
|
||||
; Our next task is to iterate through the trainers,
|
||||
; decrementing b each time, until we get to the right one.
|
||||
.outer
|
||||
dec b
|
||||
jr z,.IterateTrainer
|
||||
.inner
|
||||
ld a,[hli]
|
||||
and a
|
||||
jr nz,.inner
|
||||
jr .outer
|
||||
|
||||
; if the first byte of trainer data is FF,
|
||||
; - each pokemon has a specific level
|
||||
; (as opposed to the whole team being of the same level)
|
||||
; - if [W_LONEATTACKNO] != 0, one pokemon on the team has a special move
|
||||
; else the first byte is the level of every pokemon on the team
|
||||
.IterateTrainer
|
||||
ld a,[hli]
|
||||
cp $FF ; is the trainer special?
|
||||
jr z,.SpecialTrainer ; if so, check for special moves
|
||||
ld [W_CURENEMYLVL],a
|
||||
.LoopTrainerData
|
||||
ld a,[hli]
|
||||
and a ; have we reached the end of the trainer data?
|
||||
jr z,.FinishUp
|
||||
ld [wcf91],a ; write species somewhere (XXX why?)
|
||||
ld a,1
|
||||
ld [wcc49],a
|
||||
push hl
|
||||
call AddPartyMon
|
||||
pop hl
|
||||
jr .LoopTrainerData
|
||||
.SpecialTrainer
|
||||
; if this code is being run:
|
||||
; - each pokemon has a specific level
|
||||
; (as opposed to the whole team being of the same level)
|
||||
; - if [W_LONEATTACKNO] != 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
|
||||
ld [W_CURENEMYLVL],a
|
||||
ld a,[hli]
|
||||
ld [wcf91],a
|
||||
ld a,1
|
||||
ld [wcc49],a
|
||||
push hl
|
||||
call AddPartyMon
|
||||
pop hl
|
||||
jr .SpecialTrainer
|
||||
.AddLoneMove
|
||||
; does the trainer have a single monster with a different move
|
||||
ld a,[W_LONEATTACKNO] ; 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,[W_CUROPPONENT]
|
||||
sub $C8
|
||||
ld b,a
|
||||
ld hl,TeamMoves
|
||||
|
||||
; iterate through entries in TeamMoves, checking each for our trainer class
|
||||
.IterateTeamMoves
|
||||
ld a,[hli]
|
||||
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
|
||||
.FinishUp ; XXX this needs documenting
|
||||
xor a ; clear D079-D07B
|
||||
ld de,wd079
|
||||
ld [de],a
|
||||
inc de
|
||||
ld [de],a
|
||||
inc de
|
||||
ld [de],a
|
||||
ld a,[W_CURENEMYLVL]
|
||||
ld b,a
|
||||
.LastLoop
|
||||
ld hl,wd047
|
||||
ld c,2
|
||||
push bc
|
||||
predef AddBCDPredef
|
||||
pop bc
|
||||
inc de
|
||||
inc de
|
||||
dec b
|
||||
jr nz,.LastLoop
|
||||
ret
|
||||
78
engine/battle/9.asm → engine/battle/save_trainer_name.asm
Executable file → Normal file
78
engine/battle/9.asm → engine/battle/save_trainer_name.asm
Executable file → Normal file
|
|
@ -1,56 +1,3 @@
|
|||
; [wd0b5] = pokemon ID
|
||||
; hl = dest addr
|
||||
PrintMonType: ; 27d6b (9:7d6b)
|
||||
call GetPredefRegisters
|
||||
push hl
|
||||
call GetMonHeader
|
||||
pop hl
|
||||
push hl
|
||||
ld a, [W_MONHTYPE1]
|
||||
call PrintType
|
||||
ld a, [W_MONHTYPE1]
|
||||
ld b, a
|
||||
ld a, [W_MONHTYPE2]
|
||||
cp b
|
||||
pop hl
|
||||
jr z, EraseType2Text
|
||||
ld bc, SCREEN_WIDTH * 2
|
||||
add hl, bc
|
||||
|
||||
; a = type
|
||||
; hl = dest addr
|
||||
PrintType: ; 27d89 (9:7d89)
|
||||
push hl
|
||||
jr PrintType_
|
||||
|
||||
; erase "TYPE2/" if the mon only has 1 type
|
||||
EraseType2Text: ; 27d8c (9:7d8c)
|
||||
ld a, " "
|
||||
ld bc, $13
|
||||
add hl, bc
|
||||
ld bc, $6
|
||||
jp FillMemory
|
||||
|
||||
PrintMoveType: ; 27d98 (9:7d98)
|
||||
call GetPredefRegisters
|
||||
push hl
|
||||
ld a, [W_PLAYERMOVETYPE]
|
||||
; fall through
|
||||
|
||||
PrintType_: ; 27d9f (9:7d9f)
|
||||
add a
|
||||
ld hl, TypeNames
|
||||
ld e, a
|
||||
ld d, $0
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
ld d, [hl]
|
||||
pop hl
|
||||
jp PlaceString
|
||||
|
||||
INCLUDE "text/type_names.asm"
|
||||
|
||||
SaveTrainerName: ; 27e4a (9:7e4a)
|
||||
ld hl,TrainerNamePointers
|
||||
ld a,[W_TRAINERCLASS]
|
||||
|
|
@ -163,28 +110,3 @@ CooltrainerMName: ; 27f6c (9:7f6c)
|
|||
db "COOLTRAINER♂@"
|
||||
CooltrainerFName: ; 27f79 (9:7f79)
|
||||
db "COOLTRAINER♀@"
|
||||
|
||||
FocusEnergyEffect_: ; 27f86 (9:7f86)
|
||||
ld hl, W_PLAYERBATTSTATUS2
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
jr z, .notEnemy
|
||||
ld hl, W_ENEMYBATTSTATUS2
|
||||
.notEnemy
|
||||
bit GettingPumped, [hl] ; is mon already using focus energy?
|
||||
jr nz, .alreadyUsing
|
||||
set GettingPumped, [hl] ; mon is now using focus energy
|
||||
callab PlayCurrentMoveAnimation
|
||||
ld hl, GettingPumpedText
|
||||
jp PrintText
|
||||
.alreadyUsing
|
||||
ld c, $32
|
||||
call DelayFrames
|
||||
ld hl, PrintButItFailedText_
|
||||
ld b, BANK(PrintButItFailedText_)
|
||||
jp Bankswitch
|
||||
|
||||
GettingPumpedText: ; 27fb3 (9:7fb3)
|
||||
db $0a
|
||||
TX_FAR _GettingPumpedText
|
||||
db "@"
|
||||
44
engine/battle/b_2.asm → engine/battle/scale_sprites.asm
Executable file → Normal file
44
engine/battle/b_2.asm → engine/battle/scale_sprites.asm
Executable file → Normal file
|
|
@ -83,47 +83,3 @@ DuplicateBitsTable: ; 2fea8 (b:7ea8)
|
|||
db $30, $33, $3c, $3f
|
||||
db $c0, $c3, $cc, $cf
|
||||
db $f0, $f3, $fc, $ff
|
||||
|
||||
PayDayEffect_ ; 2feb8 (b:7eb8)
|
||||
xor a
|
||||
ld hl, wcd6d
|
||||
ld [hli], a
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [wBattleMonLevel]
|
||||
jr z, .asm_2fec8
|
||||
ld a, [wEnemyMonLevel]
|
||||
.asm_2fec8
|
||||
add a
|
||||
ld [H_DIVIDEND + 3], a
|
||||
xor a
|
||||
ld [H_DIVIDEND], a
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld [H_DIVIDEND + 2], a
|
||||
ld a, $64
|
||||
ld [H_DIVISOR], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld [hli], a
|
||||
ld a, [H_REMAINDER]
|
||||
ld [H_DIVIDEND + 3], a
|
||||
ld a, $a
|
||||
ld [H_DIVISOR], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
swap a
|
||||
ld b, a
|
||||
ld a, [H_REMAINDER]
|
||||
add b
|
||||
ld [hl], a
|
||||
ld de, wTotalPayDayMoney + 2
|
||||
ld c, $3
|
||||
predef AddBCDPredef
|
||||
ld hl, CoinsScatteredText
|
||||
jp PrintText
|
||||
|
||||
CoinsScatteredText: ; 2ff04 (b:7f04)
|
||||
TX_FAR _CoinsScatteredText
|
||||
db "@"
|
||||
50
engine/battle/scroll_draw_trainer_pic.asm
Normal file
50
engine/battle/scroll_draw_trainer_pic.asm
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
_ScrollTrainerPicAfterBattle: ; 396d3 (e:56d3)
|
||||
; Load the enemy trainer's pic and scrolls it into
|
||||
; the screen from the right.
|
||||
xor a
|
||||
ld [wEnemyMonSpecies2], a
|
||||
ld b, $1
|
||||
call GoPAL_SET
|
||||
callab _LoadTrainerPic
|
||||
hlCoord 19, 0
|
||||
ld c, $0
|
||||
.scrollLoop
|
||||
inc c
|
||||
ld a, c
|
||||
cp 7
|
||||
ret z
|
||||
ld d, $0
|
||||
push bc
|
||||
push hl
|
||||
.drawTrainerPicLoop
|
||||
call DrawTrainerPicColumn
|
||||
inc hl
|
||||
ld a, 7
|
||||
add d
|
||||
ld d, a
|
||||
dec c
|
||||
jr nz, .drawTrainerPicLoop
|
||||
ld c, 4
|
||||
call DelayFrames
|
||||
pop hl
|
||||
pop bc
|
||||
dec hl
|
||||
jr .scrollLoop
|
||||
|
||||
; write one 7-tile column of the trainer pic to the tilemap
|
||||
DrawTrainerPicColumn: ; 39707 (e:5707)
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld e, 7
|
||||
.loop
|
||||
ld [hl], d
|
||||
ld bc, SCREEN_WIDTH
|
||||
add hl, bc
|
||||
inc d
|
||||
dec e
|
||||
jr nz, .loop
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
806
engine/battle/e.asm → engine/battle/trainer_ai.asm
Executable file → Normal file
806
engine/battle/e.asm → engine/battle/trainer_ai.asm
Executable file → Normal file
|
|
@ -1,117 +1,3 @@
|
|||
; does nothing since no stats are ever selected (barring glitches)
|
||||
DoubleSelectedStats: ; 39680 (e:5680)
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [wPlayerStatsToDouble]
|
||||
ld hl, wBattleMonAttack + 1
|
||||
jr z, .notEnemyTurn
|
||||
ld a, [wEnemyStatsToDouble]
|
||||
ld hl, wEnemyMonAttack + 1
|
||||
.notEnemyTurn
|
||||
ld c, 4
|
||||
ld b, a
|
||||
.loop
|
||||
srl b
|
||||
call c, .doubleStat
|
||||
inc hl
|
||||
inc hl
|
||||
dec c
|
||||
ret z
|
||||
jr .loop
|
||||
|
||||
.doubleStat
|
||||
ld a, [hl]
|
||||
add a
|
||||
ld [hld], a
|
||||
ld a, [hl]
|
||||
rl a
|
||||
ld [hli], a
|
||||
ret
|
||||
|
||||
; does nothing since no stats are ever selected (barring glitches)
|
||||
HalveSelectedStats: ; 396a7 (e:56a7)
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [wPlayerStatsToHalve]
|
||||
ld hl, wBattleMonAttack
|
||||
jr z, .notEnemyTurn
|
||||
ld a, [wEnemyStatsToHalve]
|
||||
ld hl, wEnemyMonAttack
|
||||
.notEnemyTurn
|
||||
ld c, 4
|
||||
ld b, a
|
||||
.loop
|
||||
srl b
|
||||
call c, .halveStat
|
||||
inc hl
|
||||
inc hl
|
||||
dec c
|
||||
ret z
|
||||
jr .loop
|
||||
|
||||
.halveStat
|
||||
ld a, [hl]
|
||||
srl a
|
||||
ld [hli], a
|
||||
rr [hl]
|
||||
or [hl]
|
||||
jr nz, .nonzeroStat
|
||||
ld [hl], 1
|
||||
.nonzeroStat
|
||||
dec hl
|
||||
ret
|
||||
|
||||
_ScrollTrainerPicAfterBattle: ; 396d3 (e:56d3)
|
||||
; Load the enemy trainer's pic and scrolls it into
|
||||
; the screen from the right.
|
||||
xor a
|
||||
ld [wEnemyMonSpecies2], a
|
||||
ld b, $1
|
||||
call GoPAL_SET
|
||||
callab _LoadTrainerPic
|
||||
hlCoord 19, 0
|
||||
ld c, $0
|
||||
.scrollLoop
|
||||
inc c
|
||||
ld a, c
|
||||
cp 7
|
||||
ret z
|
||||
ld d, $0
|
||||
push bc
|
||||
push hl
|
||||
.drawTrainerPicLoop
|
||||
call DrawTrainerPicColumn
|
||||
inc hl
|
||||
ld a, 7
|
||||
add d
|
||||
ld d, a
|
||||
dec c
|
||||
jr nz, .drawTrainerPicLoop
|
||||
ld c, 4
|
||||
call DelayFrames
|
||||
pop hl
|
||||
pop bc
|
||||
dec hl
|
||||
jr .scrollLoop
|
||||
|
||||
; write one 7-tile column of the trainer pic to the tilemap
|
||||
DrawTrainerPicColumn: ; 39707 (e:5707)
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld e, 7
|
||||
.loop
|
||||
ld [hl], d
|
||||
ld bc, SCREEN_WIDTH
|
||||
add hl, bc
|
||||
inc d
|
||||
dec e
|
||||
jr nz, .loop
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
; 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)
|
||||
|
|
@ -227,17 +113,17 @@ AIMoveChoiceModificationFunctionPointers: ; 397a3 (e:57a3)
|
|||
AIMoveChoiceModification1: ; 397ab (e:57ab)
|
||||
ld a, [wBattleMonStatus]
|
||||
and a
|
||||
ret z ; return if no status ailment on player's mon
|
||||
ld hl, wBuffer - 1 ; temp move selection array (-1 byte offest)
|
||||
ld de, wEnemyMonMoves ; enemy moves
|
||||
ld b, $5
|
||||
ret z ; return if no status ailment on player's mon
|
||||
ld hl, wBuffer - 1 ; temp move selection array (-1 byte offest)
|
||||
ld de, wEnemyMonMoves ; enemy moves
|
||||
ld b, NUM_MOVES + 1
|
||||
.nextMove
|
||||
dec b
|
||||
ret z ; processed all 4 moves
|
||||
ret z ; processed all 4 moves
|
||||
inc hl
|
||||
ld a, [de]
|
||||
and a
|
||||
ret z ; no more moves in move set
|
||||
ret z ; no more moves in move set
|
||||
inc de
|
||||
call ReadMove
|
||||
ld a, [W_ENEMYMOVEPOWER]
|
||||
|
|
@ -255,32 +141,34 @@ AIMoveChoiceModification1: ; 397ab (e:57ab)
|
|||
pop hl
|
||||
jr nc, .nextMove
|
||||
ld a, [hl]
|
||||
add $5 ; discourage move
|
||||
add $5 ; heavily discourage move
|
||||
ld [hl], a
|
||||
jr .nextMove
|
||||
|
||||
StatusAilmentMoveEffects ; 57e2
|
||||
db $01 ; some sleep effect?
|
||||
db $01 ; unused sleep effect
|
||||
db SLEEP_EFFECT
|
||||
db POISON_EFFECT
|
||||
db PARALYZE_EFFECT
|
||||
db $FF
|
||||
|
||||
; slightly encourage moves with specific effects
|
||||
; slightly encourage moves with specific effects.
|
||||
; in particular, stat-modifying moves and other move effects
|
||||
; that fall in-bewteen
|
||||
AIMoveChoiceModification2: ; 397e7 (e:57e7)
|
||||
ld a, [wccd5]
|
||||
cp $1
|
||||
ld a, [wAILayer2Encouragement]
|
||||
cp $1
|
||||
ret nz
|
||||
ld hl, wBuffer - 1 ; temp move selection array (-1 byte offest)
|
||||
ld de, wEnemyMonMoves ; enemy moves
|
||||
ld b, $5
|
||||
ld hl, wBuffer - 1 ; temp move selection array (-1 byte offset)
|
||||
ld de, wEnemyMonMoves ; enemy moves
|
||||
ld b, NUM_MOVES + 1
|
||||
.nextMove
|
||||
dec b
|
||||
ret z ; processed all 4 moves
|
||||
ret z ; processed all 4 moves
|
||||
inc hl
|
||||
ld a, [de]
|
||||
and a
|
||||
ret z ; no more moves in move set
|
||||
ret z ; no more moves in move set
|
||||
inc de
|
||||
call ReadMove
|
||||
ld a, [W_ENEMYMOVEEFFECT]
|
||||
|
|
@ -294,21 +182,23 @@ AIMoveChoiceModification2: ; 397e7 (e:57e7)
|
|||
jr c, .preferMove
|
||||
jr .nextMove
|
||||
.preferMove
|
||||
dec [hl] ; slighly encourage this move
|
||||
dec [hl] ; sligthly encourage this move
|
||||
jr .nextMove
|
||||
|
||||
; encourages moves that are effective against the player's mon
|
||||
; 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)
|
||||
ld hl, wBuffer - 1 ; temp move selection array (-1 byte offest)
|
||||
ld de, wEnemyMonMoves ; enemy moves
|
||||
ld hl, wBuffer - 1 ; temp move selection array (-1 byte offset)
|
||||
ld de, wEnemyMonMoves ; enemy moves
|
||||
ld b, $5
|
||||
.nextMove
|
||||
dec b
|
||||
ret z ; processed all 4 moves
|
||||
ret z ; processed all 4 moves
|
||||
inc hl
|
||||
ld a, [de]
|
||||
and a
|
||||
ret z ; no more moves in move set
|
||||
ret z ; no more moves in move set
|
||||
inc de
|
||||
call ReadMove
|
||||
push hl
|
||||
|
|
@ -322,16 +212,16 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
|
|||
cp $10
|
||||
jr z, .nextMove
|
||||
jr c, .notEffectiveMove
|
||||
dec [hl] ; slighly encourage this move
|
||||
dec [hl] ; sligthly encourage this move
|
||||
jr .nextMove
|
||||
.notEffectiveMove ; discourages non-effective moves if better moves are available
|
||||
.notEffectiveMove ; discourages non-effective moves if better moves are available
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld a, [W_ENEMYMOVETYPE]
|
||||
ld d, a
|
||||
ld hl, wEnemyMonMoves ; enemy moves
|
||||
ld b, $5
|
||||
ld b, NUM_MOVES + 1
|
||||
ld c, $0
|
||||
.loopMoves
|
||||
dec b
|
||||
|
|
@ -342,17 +232,17 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
|
|||
call ReadMove
|
||||
ld a, [W_ENEMYMOVEEFFECT]
|
||||
cp SUPER_FANG_EFFECT
|
||||
jr z, .betterMoveFound ; Super Fang is considered to be a better move
|
||||
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
|
||||
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
|
||||
jr z, .betterMoveFound ; Fly is considered to be a better move
|
||||
ld a, [W_ENEMYMOVETYPE]
|
||||
cp d
|
||||
jr z, .loopMoves
|
||||
ld a, [W_ENEMYMOVEPOWER]
|
||||
and a
|
||||
jr nz, .betterMoveFound ; damaging moves of a different type are considered to be better moves
|
||||
jr nz, .betterMoveFound ; damaging moves of a different type are considered to be better moves
|
||||
jr .loopMoves
|
||||
.betterMoveFound
|
||||
ld c, a
|
||||
|
|
@ -363,7 +253,7 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
|
|||
pop hl
|
||||
and a
|
||||
jr z, .nextMove
|
||||
inc [hl] ; slighly discourage this move
|
||||
inc [hl] ; sligthly discourage this move
|
||||
jr .nextMove
|
||||
AIMoveChoiceModification4: ; 39883 (e:5883)
|
||||
ret
|
||||
|
|
@ -434,439 +324,13 @@ TrainerClassMoveChoiceModifications: ; 3989b (e:589b)
|
|||
db 1,0 ; AGATHA
|
||||
db 1,3,0 ; LANCE
|
||||
|
||||
TrainerPicAndMoneyPointers: ; 39914 (e:5914)
|
||||
; trainer pic pointers and base money.
|
||||
; money received after battle = base money × level of highest-level enemy mon
|
||||
dw YoungsterPic
|
||||
money 1500
|
||||
INCLUDE "engine/battle/trainer_pic_money_pointers.asm"
|
||||
|
||||
INCLUDE "text/trainer_names.asm"
|
||||
|
||||
dw BugCatcherPic
|
||||
money 1000
|
||||
INCLUDE "engine/battle/bank_e_misc.asm"
|
||||
|
||||
dw LassPic
|
||||
money 1500
|
||||
|
||||
dw SailorPic
|
||||
money 3000
|
||||
|
||||
dw JrTrainerMPic
|
||||
money 2000
|
||||
|
||||
dw JrTrainerFPic
|
||||
money 2000
|
||||
|
||||
dw PokemaniacPic
|
||||
money 5000
|
||||
|
||||
dw SuperNerdPic
|
||||
money 2500
|
||||
|
||||
dw HikerPic
|
||||
money 3500
|
||||
|
||||
dw BikerPic
|
||||
money 2000
|
||||
|
||||
dw BurglarPic
|
||||
money 9000
|
||||
|
||||
dw EngineerPic
|
||||
money 5000
|
||||
|
||||
dw JugglerPic
|
||||
money 3500
|
||||
|
||||
dw FisherPic
|
||||
money 3500
|
||||
|
||||
dw SwimmerPic
|
||||
money 500
|
||||
|
||||
dw CueBallPic
|
||||
money 2500
|
||||
|
||||
dw GamblerPic
|
||||
money 7000
|
||||
|
||||
dw BeautyPic
|
||||
money 7000
|
||||
|
||||
dw PsychicPic
|
||||
money 1000
|
||||
|
||||
dw RockerPic
|
||||
money 2500
|
||||
|
||||
dw JugglerPic
|
||||
money 3500
|
||||
|
||||
dw TamerPic
|
||||
money 4000
|
||||
|
||||
dw BirdKeeperPic
|
||||
money 2500
|
||||
|
||||
dw BlackbeltPic
|
||||
money 2500
|
||||
|
||||
dw Rival1Pic
|
||||
money 3500
|
||||
|
||||
dw ProfOakPic
|
||||
money 9900
|
||||
|
||||
dw ChiefPic
|
||||
money 3000
|
||||
|
||||
dw ScientistPic
|
||||
money 5000
|
||||
|
||||
dw GiovanniPic
|
||||
money 9900
|
||||
|
||||
dw RocketPic
|
||||
money 3000
|
||||
|
||||
dw CooltrainerMPic
|
||||
money 3500
|
||||
|
||||
dw CooltrainerFPic
|
||||
money 3500
|
||||
|
||||
dw BrunoPic
|
||||
money 9900
|
||||
|
||||
dw BrockPic
|
||||
money 9900
|
||||
|
||||
dw MistyPic
|
||||
money 9900
|
||||
|
||||
dw LtSurgePic
|
||||
money 9900
|
||||
|
||||
dw ErikaPic
|
||||
money 9900
|
||||
|
||||
dw KogaPic
|
||||
money 9900
|
||||
|
||||
dw BlainePic
|
||||
money 9900
|
||||
|
||||
dw SabrinaPic
|
||||
money 9900
|
||||
|
||||
dw GentlemanPic
|
||||
money 7000
|
||||
|
||||
dw Rival2Pic
|
||||
money 6500
|
||||
|
||||
dw Rival3Pic
|
||||
money 9900
|
||||
|
||||
dw LoreleiPic
|
||||
money 9900
|
||||
|
||||
dw ChannelerPic
|
||||
money 3000
|
||||
|
||||
dw AgathaPic
|
||||
money 9900
|
||||
|
||||
dw LancePic
|
||||
money 9900
|
||||
|
||||
INCLUDE "text/trainer_names.asm"
|
||||
|
||||
; formats a string at wMovesString that lists the moves at wMoves
|
||||
FormatMovesString: ; 39b87 (e:5b87)
|
||||
ld hl, wMoves
|
||||
ld de, wMovesString
|
||||
ld b, $0
|
||||
.printMoveNameLoop
|
||||
ld a, [hli]
|
||||
and a ; end of move list?
|
||||
jr z, .printDashLoop ; print dashes when no moves are left
|
||||
push hl
|
||||
ld [wd0b5], a
|
||||
ld a, BANK(MoveNames)
|
||||
ld [wPredefBank], a
|
||||
ld a, MOVE_NAME
|
||||
ld [wNameListType], a
|
||||
call GetName
|
||||
ld hl, wcd6d
|
||||
.copyNameLoop
|
||||
ld a, [hli]
|
||||
cp $50
|
||||
jr z, .doneCopyingName
|
||||
ld [de], a
|
||||
inc de
|
||||
jr .copyNameLoop
|
||||
.doneCopyingName
|
||||
ld a, b
|
||||
ld [wcd6c], a
|
||||
inc b
|
||||
ld a, $4e ; line break
|
||||
ld [de], a
|
||||
inc de
|
||||
pop hl
|
||||
ld a, b
|
||||
cp NUM_MOVES
|
||||
jr z, .done
|
||||
jr .printMoveNameLoop
|
||||
.printDashLoop
|
||||
ld a, "-"
|
||||
ld [de], a
|
||||
inc de
|
||||
inc b
|
||||
ld a, b
|
||||
cp NUM_MOVES
|
||||
jr z, .done
|
||||
ld a, $4e ; line break
|
||||
ld [de], a
|
||||
inc de
|
||||
jr .printDashLoop
|
||||
.done
|
||||
ld a, "@"
|
||||
ld [de], a
|
||||
ret
|
||||
|
||||
; XXX this is called in a few places, but it doesn't appear to do anything useful
|
||||
Func_39bd5: ; 39bd5 (e:5bd5)
|
||||
ld a, [wd11b]
|
||||
cp $1
|
||||
jr nz, .asm_39be6
|
||||
ld hl, wEnemyPartyCount
|
||||
ld de, wEnemyMonOT
|
||||
ld a, ENEMYOT_NAME
|
||||
jr .asm_39c18
|
||||
.asm_39be6
|
||||
cp $4
|
||||
jr nz, .calcAttackStat4
|
||||
ld hl, wPartyCount
|
||||
ld de, wPartyMonOT
|
||||
ld a, PLAYEROT_NAME
|
||||
jr .asm_39c18
|
||||
.calcAttackStat4
|
||||
cp $5
|
||||
jr nz, .asm_39c02
|
||||
ld hl, wStringBuffer2 + 11
|
||||
ld de, MonsterNames
|
||||
ld a, MONSTER_NAME
|
||||
jr .asm_39c18
|
||||
.asm_39c02
|
||||
cp $2
|
||||
jr nz, .asm_39c10
|
||||
ld hl, wNumBagItems
|
||||
ld de, ItemNames
|
||||
ld a, ITEM_NAME
|
||||
jr .asm_39c18
|
||||
.asm_39c10
|
||||
ld hl, wStringBuffer2 + 11
|
||||
ld de, ItemNames
|
||||
ld a, ITEM_NAME
|
||||
.asm_39c18
|
||||
ld [wNameListType], a
|
||||
ld a, l
|
||||
ld [wList], a
|
||||
ld a, h
|
||||
ld [wList + 1], a
|
||||
ld a, e
|
||||
ld [wcf8d], a
|
||||
ld a, d
|
||||
ld [wcf8e], a
|
||||
ld bc, ItemPrices
|
||||
ld a, c
|
||||
ld [wItemPrices], a
|
||||
ld a, b
|
||||
ld [wItemPrices + 1], a
|
||||
ret
|
||||
|
||||
; get species of mon e in list [wcc49] for LoadMonData
|
||||
GetMonSpecies: ; 39c37 (e:5c37)
|
||||
ld hl, wPartySpecies
|
||||
ld a, [wcc49]
|
||||
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
|
||||
|
||||
ReadTrainer: ; 39c53 (e:5c53)
|
||||
|
||||
; don't change any moves in a link battle
|
||||
ld a,[wLinkState]
|
||||
and a
|
||||
ret nz
|
||||
|
||||
; set [wEnemyPartyCount] to 0, [wEnemyPartyMons] to FF
|
||||
; XXX first is total enemy pokemon?
|
||||
; XXX second is species of first pokemon?
|
||||
ld hl,wEnemyPartyCount
|
||||
xor a
|
||||
ld [hli],a
|
||||
dec a
|
||||
ld [hl],a
|
||||
|
||||
; get the pointer to trainer data for this class
|
||||
ld a,[W_CUROPPONENT]
|
||||
sub $C9 ; convert value from pokemon to trainer
|
||||
add a,a
|
||||
ld hl,TrainerDataPointers
|
||||
ld c,a
|
||||
ld b,0
|
||||
add hl,bc ; hl points to trainer class
|
||||
ld a,[hli]
|
||||
ld h,[hl]
|
||||
ld l,a
|
||||
ld a,[W_TRAINERNO]
|
||||
ld b,a
|
||||
; At this point b contains the trainer number,
|
||||
; and hl points to the trainer class.
|
||||
; Our next task is to iterate through the trainers,
|
||||
; decrementing b each time, until we get to the right one.
|
||||
.outer
|
||||
dec b
|
||||
jr z,.IterateTrainer
|
||||
.inner
|
||||
ld a,[hli]
|
||||
and a
|
||||
jr nz,.inner
|
||||
jr .outer
|
||||
|
||||
; if the first byte of trainer data is FF,
|
||||
; - each pokemon has a specific level
|
||||
; (as opposed to the whole team being of the same level)
|
||||
; - if [W_LONEATTACKNO] != 0, one pokemon on the team has a special move
|
||||
; else the first byte is the level of every pokemon on the team
|
||||
.IterateTrainer
|
||||
ld a,[hli]
|
||||
cp $FF ; is the trainer special?
|
||||
jr z,.SpecialTrainer ; if so, check for special moves
|
||||
ld [W_CURENEMYLVL],a
|
||||
.LoopTrainerData
|
||||
ld a,[hli]
|
||||
and a ; have we reached the end of the trainer data?
|
||||
jr z,.FinishUp
|
||||
ld [wcf91],a ; write species somewhere (XXX why?)
|
||||
ld a,1
|
||||
ld [wcc49],a
|
||||
push hl
|
||||
call AddPartyMon
|
||||
pop hl
|
||||
jr .LoopTrainerData
|
||||
.SpecialTrainer
|
||||
; if this code is being run:
|
||||
; - each pokemon has a specific level
|
||||
; (as opposed to the whole team being of the same level)
|
||||
; - if [W_LONEATTACKNO] != 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
|
||||
ld [W_CURENEMYLVL],a
|
||||
ld a,[hli]
|
||||
ld [wcf91],a
|
||||
ld a,1
|
||||
ld [wcc49],a
|
||||
push hl
|
||||
call AddPartyMon
|
||||
pop hl
|
||||
jr .SpecialTrainer
|
||||
.AddLoneMove
|
||||
; does the trainer have a single monster with a different move
|
||||
ld a,[W_LONEATTACKNO] ; 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,[W_CUROPPONENT]
|
||||
sub $C8
|
||||
ld b,a
|
||||
ld hl,TeamMoves
|
||||
|
||||
; iterate through entries in TeamMoves, checking each for our trainer class
|
||||
.IterateTeamMoves
|
||||
ld a,[hli]
|
||||
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
|
||||
.FinishUp ; XXX this needs documenting
|
||||
xor a ; clear D079-D07B
|
||||
ld de,wd079
|
||||
ld [de],a
|
||||
inc de
|
||||
ld [de],a
|
||||
inc de
|
||||
ld [de],a
|
||||
ld a,[W_CURENEMYLVL]
|
||||
ld b,a
|
||||
.LastLoop
|
||||
ld hl,wd047
|
||||
ld c,2
|
||||
push bc
|
||||
predef AddBCDPredef
|
||||
pop bc
|
||||
inc de
|
||||
inc de
|
||||
dec b
|
||||
jr nz,.LastLoop
|
||||
ret
|
||||
INCLUDE "engine/battle/read_trainer_party.asm"
|
||||
|
||||
INCLUDE "data/trainer_moves.asm"
|
||||
|
||||
|
|
@ -1371,195 +835,3 @@ AIPrintItemUse_: ; 3a835 (e:6835)
|
|||
AIBattleUseItemText: ; 3a844 (e:6844)
|
||||
TX_FAR _AIBattleUseItemText
|
||||
db "@"
|
||||
|
||||
DrawAllPokeballs: ; 3a849 (e:6849)
|
||||
call LoadPartyPokeballGfx
|
||||
call SetupOwnPartyPokeballs
|
||||
ld a, [W_ISINBATTLE] ; W_ISINBATTLE
|
||||
dec a
|
||||
ret z ; return if wild pokémon
|
||||
jp SetupEnemyPartyPokeballs
|
||||
|
||||
DrawEnemyPokeballs: ; 0x3a857
|
||||
call LoadPartyPokeballGfx
|
||||
jp SetupEnemyPartyPokeballs
|
||||
|
||||
LoadPartyPokeballGfx: ; 3a85d (e:685d)
|
||||
ld de, PokeballTileGraphics ; $697e
|
||||
ld hl, vSprites + $310
|
||||
ld bc, (BANK(PokeballTileGraphics) << 8) + $04
|
||||
jp CopyVideoData
|
||||
|
||||
SetupOwnPartyPokeballs: ; 3a869 (e:6869)
|
||||
call PlacePlayerHUDTiles
|
||||
ld hl, wPartyMon1
|
||||
ld de, wPartyCount ; wPartyCount
|
||||
call SetupPokeballs
|
||||
ld a, $60
|
||||
ld hl, W_BASECOORDX ; wd081
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld a, $8
|
||||
ld [wTrainerEngageDistance], a
|
||||
ld hl, wOAMBuffer
|
||||
jp WritePokeballOAMData
|
||||
|
||||
SetupEnemyPartyPokeballs: ; 3a887 (e:6887)
|
||||
call PlaceEnemyHUDTiles
|
||||
ld hl, wEnemyMons
|
||||
ld de, wEnemyPartyCount ; wEnemyPartyCount
|
||||
call SetupPokeballs
|
||||
ld hl, W_BASECOORDX ; wd081
|
||||
ld a, $48
|
||||
ld [hli], a
|
||||
ld [hl], $20
|
||||
ld a, $f8
|
||||
ld [wTrainerEngageDistance], a
|
||||
ld hl, wOAMBuffer + PARTY_LENGTH * 4
|
||||
jp WritePokeballOAMData
|
||||
|
||||
SetupPokeballs: ; 0x3a8a6
|
||||
ld a, [de]
|
||||
push af
|
||||
ld de, wBuffer
|
||||
ld c, PARTY_LENGTH
|
||||
ld a, $34 ; empty pokeball
|
||||
.emptyloop
|
||||
ld [de], a
|
||||
inc de
|
||||
dec c
|
||||
jr nz, .emptyloop
|
||||
pop af
|
||||
ld de, wBuffer
|
||||
.monloop
|
||||
push af
|
||||
call PickPokeball
|
||||
inc de
|
||||
pop af
|
||||
dec a
|
||||
jr nz, .monloop
|
||||
ret
|
||||
|
||||
PickPokeball: ; 3a8c2 (e:68c2)
|
||||
inc hl
|
||||
ld a, [hli]
|
||||
and a
|
||||
jr nz, .alive
|
||||
ld a, [hl]
|
||||
and a
|
||||
ld b, $33 ; crossed ball (fainted)
|
||||
jr z, .done_fainted
|
||||
.alive
|
||||
inc hl
|
||||
inc hl
|
||||
ld a, [hl] ; status
|
||||
and a
|
||||
ld b, $32 ; black ball (status)
|
||||
jr nz, .done
|
||||
dec b ; regular ball
|
||||
jr .done
|
||||
.done_fainted
|
||||
inc hl
|
||||
inc hl
|
||||
.done
|
||||
ld a, b
|
||||
ld [de], a
|
||||
ld bc, $0028 ; rest of mon struct
|
||||
add hl, bc
|
||||
ret
|
||||
|
||||
WritePokeballOAMData: ; 3a8e1 (e:68e1)
|
||||
ld de, wBuffer
|
||||
ld c, PARTY_LENGTH
|
||||
.loop
|
||||
ld a, [W_BASECOORDY] ; wd082
|
||||
ld [hli], a
|
||||
ld a, [W_BASECOORDX] ; wd081
|
||||
ld [hli], a
|
||||
ld a, [de]
|
||||
ld [hli], a
|
||||
xor a
|
||||
ld [hli], a
|
||||
ld a, [W_BASECOORDX] ; wd081
|
||||
ld b, a
|
||||
ld a, [wTrainerEngageDistance]
|
||||
add b
|
||||
ld [W_BASECOORDX], a ; wd081
|
||||
inc de
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
PlacePlayerHUDTiles: ; 3a902 (e:6902)
|
||||
ld hl, PlayerBattleHUDGraphicsTiles ; $6916
|
||||
ld de, wTrainerFacingDirection
|
||||
ld bc, $3
|
||||
call CopyData
|
||||
hlCoord 18, 10
|
||||
ld de, rIE ; $ffff
|
||||
jr PlaceHUDTiles
|
||||
|
||||
PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916)
|
||||
; The tile numbers for specific parts of the battle display for the player's pokemon
|
||||
db $73 ; unused ($73 is hardcoded into the routine that uses these bytes)
|
||||
db $77 ; lower-right corner tile of the HUD
|
||||
db $6F ; lower-left triangle tile of the HUD
|
||||
|
||||
PlaceEnemyHUDTiles: ; 3a919 (e:6919)
|
||||
ld hl, EnemyBattleHUDGraphicsTiles ; $692d
|
||||
ld de, wTrainerFacingDirection
|
||||
ld bc, $3
|
||||
call CopyData
|
||||
hlCoord 1, 2
|
||||
ld de, $1
|
||||
jr PlaceHUDTiles
|
||||
|
||||
EnemyBattleHUDGraphicsTiles: ; 3a92d (e:692d)
|
||||
; The tile numbers for specific parts of the battle display for the enemy
|
||||
db $73 ; unused ($73 is hardcoded in the routine that uses these bytes)
|
||||
db $74 ; lower-left corner tile of the HUD
|
||||
db $78 ; lower-right triangle tile of the HUD
|
||||
|
||||
PlaceHUDTiles: ; 3a930 (e:6930)
|
||||
ld [hl], $73
|
||||
ld bc, $14
|
||||
add hl, bc
|
||||
ld a, [wTrainerScreenY]
|
||||
ld [hl], a
|
||||
ld a, $8
|
||||
.asm_3a93c
|
||||
add hl, de
|
||||
ld [hl], $76
|
||||
dec a
|
||||
jr nz, .asm_3a93c
|
||||
add hl, de
|
||||
ld a, [wTrainerScreenX]
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948)
|
||||
call LoadPartyPokeballGfx
|
||||
ld hl, wPartyMon1Species ; wPartyMon1Species (aliases: wPartyMon1)
|
||||
ld de, wPartyCount ; wPartyCount
|
||||
call SetupPokeballs
|
||||
ld hl, W_BASECOORDX ; wd081
|
||||
ld a, $50
|
||||
ld [hli], a
|
||||
ld [hl], $40
|
||||
ld a, $8
|
||||
ld [wTrainerEngageDistance], a
|
||||
ld hl, wOAMBuffer
|
||||
call WritePokeballOAMData
|
||||
ld hl, wEnemyMons ; wEnemyMon1Species
|
||||
ld de, wEnemyPartyCount ; wEnemyPartyCount
|
||||
call SetupPokeballs
|
||||
ld hl, W_BASECOORDX ; wd081
|
||||
ld a, $50
|
||||
ld [hli], a
|
||||
ld [hl], $68
|
||||
ld hl, wOAMBuffer + $18
|
||||
jp WritePokeballOAMData
|
||||
|
||||
; four tiles: pokeball, black pokeball (status ailment), crossed out pokeball (faited) and pokeball slot (no mon)
|
||||
PokeballTileGraphics:: ; 3a97e (e:697e)
|
||||
INCBIN "gfx/pokeball.2bpp"
|
||||
143
engine/battle/trainer_pic_money_pointers.asm
Normal file
143
engine/battle/trainer_pic_money_pointers.asm
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
TrainerPicAndMoneyPointers: ; 39914 (e:5914)
|
||||
; trainer pic pointers and base money.
|
||||
; money received after battle = base money × level of highest-level enemy mon
|
||||
dw YoungsterPic
|
||||
money 1500
|
||||
|
||||
dw BugCatcherPic
|
||||
money 1000
|
||||
|
||||
dw LassPic
|
||||
money 1500
|
||||
|
||||
dw SailorPic
|
||||
money 3000
|
||||
|
||||
dw JrTrainerMPic
|
||||
money 2000
|
||||
|
||||
dw JrTrainerFPic
|
||||
money 2000
|
||||
|
||||
dw PokemaniacPic
|
||||
money 5000
|
||||
|
||||
dw SuperNerdPic
|
||||
money 2500
|
||||
|
||||
dw HikerPic
|
||||
money 3500
|
||||
|
||||
dw BikerPic
|
||||
money 2000
|
||||
|
||||
dw BurglarPic
|
||||
money 9000
|
||||
|
||||
dw EngineerPic
|
||||
money 5000
|
||||
|
||||
dw JugglerPic
|
||||
money 3500
|
||||
|
||||
dw FisherPic
|
||||
money 3500
|
||||
|
||||
dw SwimmerPic
|
||||
money 500
|
||||
|
||||
dw CueBallPic
|
||||
money 2500
|
||||
|
||||
dw GamblerPic
|
||||
money 7000
|
||||
|
||||
dw BeautyPic
|
||||
money 7000
|
||||
|
||||
dw PsychicPic
|
||||
money 1000
|
||||
|
||||
dw RockerPic
|
||||
money 2500
|
||||
|
||||
dw JugglerPic
|
||||
money 3500
|
||||
|
||||
dw TamerPic
|
||||
money 4000
|
||||
|
||||
dw BirdKeeperPic
|
||||
money 2500
|
||||
|
||||
dw BlackbeltPic
|
||||
money 2500
|
||||
|
||||
dw Rival1Pic
|
||||
money 3500
|
||||
|
||||
dw ProfOakPic
|
||||
money 9900
|
||||
|
||||
dw ChiefPic
|
||||
money 3000
|
||||
|
||||
dw ScientistPic
|
||||
money 5000
|
||||
|
||||
dw GiovanniPic
|
||||
money 9900
|
||||
|
||||
dw RocketPic
|
||||
money 3000
|
||||
|
||||
dw CooltrainerMPic
|
||||
money 3500
|
||||
|
||||
dw CooltrainerFPic
|
||||
money 3500
|
||||
|
||||
dw BrunoPic
|
||||
money 9900
|
||||
|
||||
dw BrockPic
|
||||
money 9900
|
||||
|
||||
dw MistyPic
|
||||
money 9900
|
||||
|
||||
dw LtSurgePic
|
||||
money 9900
|
||||
|
||||
dw ErikaPic
|
||||
money 9900
|
||||
|
||||
dw KogaPic
|
||||
money 9900
|
||||
|
||||
dw BlainePic
|
||||
money 9900
|
||||
|
||||
dw SabrinaPic
|
||||
money 9900
|
||||
|
||||
dw GentlemanPic
|
||||
money 7000
|
||||
|
||||
dw Rival2Pic
|
||||
money 6500
|
||||
|
||||
dw Rival3Pic
|
||||
money 9900
|
||||
|
||||
dw LoreleiPic
|
||||
money 9900
|
||||
|
||||
dw ChannelerPic
|
||||
money 3000
|
||||
|
||||
dw AgathaPic
|
||||
money 9900
|
||||
|
||||
dw LancePic
|
||||
money 9900
|
||||
62
engine/battle/unused_stats_functions.asm
Normal file
62
engine/battle/unused_stats_functions.asm
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
; does nothing since no stats are ever selected (barring glitches)
|
||||
DoubleSelectedStats: ; 39680 (e:5680)
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [wPlayerStatsToDouble]
|
||||
ld hl, wBattleMonAttack + 1
|
||||
jr z, .notEnemyTurn
|
||||
ld a, [wEnemyStatsToDouble]
|
||||
ld hl, wEnemyMonAttack + 1
|
||||
.notEnemyTurn
|
||||
ld c, 4
|
||||
ld b, a
|
||||
.loop
|
||||
srl b
|
||||
call c, .doubleStat
|
||||
inc hl
|
||||
inc hl
|
||||
dec c
|
||||
ret z
|
||||
jr .loop
|
||||
|
||||
.doubleStat
|
||||
ld a, [hl]
|
||||
add a
|
||||
ld [hld], a
|
||||
ld a, [hl]
|
||||
rl a
|
||||
ld [hli], a
|
||||
ret
|
||||
|
||||
; does nothing since no stats are ever selected (barring glitches)
|
||||
HalveSelectedStats: ; 396a7 (e:56a7)
|
||||
ld a, [H_WHOSETURN]
|
||||
and a
|
||||
ld a, [wPlayerStatsToHalve]
|
||||
ld hl, wBattleMonAttack
|
||||
jr z, .notEnemyTurn
|
||||
ld a, [wEnemyStatsToHalve]
|
||||
ld hl, wEnemyMonAttack
|
||||
.notEnemyTurn
|
||||
ld c, 4
|
||||
ld b, a
|
||||
.loop
|
||||
srl b
|
||||
call c, .halveStat
|
||||
inc hl
|
||||
inc hl
|
||||
dec c
|
||||
ret z
|
||||
jr .loop
|
||||
|
||||
.halveStat
|
||||
ld a, [hl]
|
||||
srl a
|
||||
ld [hli], a
|
||||
rr [hl]
|
||||
or [hl]
|
||||
jr nz, .nonzeroStat
|
||||
ld [hl], 1
|
||||
.nonzeroStat
|
||||
dec hl
|
||||
ret
|
||||
118
engine/battle/wild_encounters.asm
Normal file
118
engine/battle/wild_encounters.asm
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
; try to initiate a wild pokemon encounter
|
||||
; returns success in Z
|
||||
TryDoWildEncounter: ; 13870 (4:7870)
|
||||
ld a, [wNPCMovementScriptPointerTableNum]
|
||||
and a
|
||||
ret nz
|
||||
ld a, [wd736]
|
||||
and a
|
||||
ret nz
|
||||
callab IsPlayerStandingOnDoorTileOrWarpTile
|
||||
jr nc, .notStandingOnDoorOrWarpTile
|
||||
.CantEncounter
|
||||
ld a, $1
|
||||
and a
|
||||
ret
|
||||
.notStandingOnDoorOrWarpTile
|
||||
callab IsPlayerJustOutsideMap
|
||||
jr z, .CantEncounter
|
||||
ld a, [wRepelRemainingSteps]
|
||||
and a
|
||||
jr z, .asm_1389e
|
||||
dec a
|
||||
jr z, .lastRepelStep
|
||||
ld [wRepelRemainingSteps], a
|
||||
.asm_1389e
|
||||
; determine if wild pokémon can appear in the half-block we’re standing in
|
||||
; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile?
|
||||
hlCoord 9, 9
|
||||
ld c, [hl]
|
||||
ld a, [W_GRASSTILE]
|
||||
cp c
|
||||
ld a, [W_GRASSRATE]
|
||||
jr z, .CanEncounter
|
||||
ld a, $14 ; in all tilesets with a water tile, this is its id
|
||||
cp c
|
||||
ld a, [W_WATERRATE]
|
||||
jr z, .CanEncounter
|
||||
; even if not in grass/water, standing anywhere we can encounter pokémon
|
||||
; so long as the map is “indoor” and has wild pokémon defined.
|
||||
; …as long as it’s not Viridian Forest or Safari Zone.
|
||||
ld a, [W_CURMAP]
|
||||
cp REDS_HOUSE_1F ; is this an indoor map?
|
||||
jr c, .CantEncounter2
|
||||
ld a, [W_CURMAPTILESET]
|
||||
cp FOREST ; Viridian Forest/Safari Zone
|
||||
jr z, .CantEncounter2
|
||||
ld a, [W_GRASSRATE]
|
||||
.CanEncounter
|
||||
; compare encounter chance with a random number to determine if there will be an encounter
|
||||
ld b, a
|
||||
ld a, [hRandomAdd]
|
||||
cp b
|
||||
jr nc, .CantEncounter2
|
||||
ld a, [hRandomSub]
|
||||
ld b, a
|
||||
ld hl, WildMonEncounterSlotChances
|
||||
.determineEncounterSlot
|
||||
ld a, [hli]
|
||||
cp b
|
||||
jr nc, .gotEncounterSlot
|
||||
inc hl
|
||||
jr .determineEncounterSlot
|
||||
.gotEncounterSlot
|
||||
; determine which wild pokémon (grass or water) can appear in the half-block we’re standing in
|
||||
ld c, [hl]
|
||||
ld hl, W_GRASSMONS
|
||||
aCoord 8, 9
|
||||
cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile?
|
||||
jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default
|
||||
ld hl, W_WATERMONS
|
||||
; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not,
|
||||
; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters.
|
||||
.gotWildEncounterType
|
||||
ld b, $0
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
ld [W_CURENEMYLVL], a
|
||||
ld a, [hl]
|
||||
ld [wcf91], a
|
||||
ld [wEnemyMonSpecies2], a
|
||||
ld a, [wRepelRemainingSteps]
|
||||
and a
|
||||
jr z, .willEncounter
|
||||
ld a, [wPartyMon1Level]
|
||||
ld b, a
|
||||
ld a, [W_CURENEMYLVL]
|
||||
cp b
|
||||
jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon
|
||||
jr .willEncounter
|
||||
.lastRepelStep
|
||||
ld [wRepelRemainingSteps], a
|
||||
ld a, $d2
|
||||
ld [H_DOWNARROWBLINKCNT2], a
|
||||
call EnableAutoTextBoxDrawing
|
||||
call DisplayTextID
|
||||
.CantEncounter2
|
||||
ld a, $1
|
||||
and a
|
||||
ret
|
||||
.willEncounter
|
||||
xor a
|
||||
ret
|
||||
|
||||
WildMonEncounterSlotChances: ; 13918 (4:7918)
|
||||
; There are 10 slots for wild pokemon, and this is the table that defines how common each of
|
||||
; those 10 slots is. A random number is generated and then the first byte of each pair in this
|
||||
; table is compared against that random number. If the random number is less than or equal
|
||||
; to the first byte, then that slot is chosen. The second byte is double the slot number.
|
||||
db $32, $00 ; 51/256 = 19.9% chance of slot 0
|
||||
db $65, $02 ; 51/256 = 19.9% chance of slot 1
|
||||
db $8C, $04 ; 39/256 = 15.2% chance of slot 2
|
||||
db $A5, $06 ; 25/256 = 9.8% chance of slot 3
|
||||
db $BE, $08 ; 25/256 = 9.8% chance of slot 4
|
||||
db $D7, $0A ; 25/256 = 9.8% chance of slot 5
|
||||
db $E4, $0C ; 13/256 = 5.1% chance of slot 6
|
||||
db $F1, $0E ; 13/256 = 5.1% chance of slot 7
|
||||
db $FC, $10 ; 11/256 = 4.3% chance of slot 8
|
||||
db $FF, $12 ; 3/256 = 1.2% chance of slot 9
|
||||
|
|
@ -320,8 +320,8 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld [W_ANIMATIONID],a
|
||||
xor a
|
||||
ld [$fff3],a
|
||||
ld [wcc5b],a
|
||||
ld [wd05b],a
|
||||
ld [wAnimationType],a
|
||||
ld [wDamageMultipliers],a
|
||||
ld a,[wWhichPokemon]
|
||||
push af
|
||||
ld a,[wcf91]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,67 @@
|
|||
DrawHP: ; 128ef (4:68ef)
|
||||
; Draws the HP bar in the stats screen
|
||||
call GetPredefRegisters
|
||||
ld a, $1
|
||||
jr DrawHP_
|
||||
|
||||
DrawHP2: ; 128f6 (4:68f6)
|
||||
; Draws the HP bar in the party screen
|
||||
call GetPredefRegisters
|
||||
ld a, $2
|
||||
|
||||
DrawHP_: ; 128fb (4:68fb)
|
||||
ld [wHPBarType], a
|
||||
push hl
|
||||
ld a, [wLoadedMonHP]
|
||||
ld b, a
|
||||
ld a, [wLoadedMonHP + 1]
|
||||
ld c, a
|
||||
or b
|
||||
jr nz, .nonzeroHP
|
||||
xor a
|
||||
ld c, a
|
||||
ld e, a
|
||||
ld a, $6
|
||||
ld d, a
|
||||
jp .drawHPBarAndPrintFraction
|
||||
.nonzeroHP
|
||||
ld a, [wLoadedMonMaxHP]
|
||||
ld d, a
|
||||
ld a, [wLoadedMonMaxHP + 1]
|
||||
ld e, a
|
||||
predef HPBarLength
|
||||
ld a, $6
|
||||
ld d, a
|
||||
ld c, a
|
||||
.drawHPBarAndPrintFraction
|
||||
pop hl
|
||||
push de
|
||||
push hl
|
||||
push hl
|
||||
call DrawHPBar
|
||||
pop hl
|
||||
ld a, [hFlags_0xFFF6]
|
||||
bit 0, a
|
||||
jr z, .printFractionBelowBar
|
||||
ld bc, $9 ; right of bar
|
||||
jr .printFraction
|
||||
.printFractionBelowBar
|
||||
ld bc, SCREEN_WIDTH + 1 ; below bar
|
||||
.printFraction
|
||||
add hl, bc
|
||||
ld de, wLoadedMonHP
|
||||
ld bc, $203
|
||||
call PrintNumber
|
||||
ld a, "/"
|
||||
ld [hli], a
|
||||
ld de, wLoadedMonMaxHP
|
||||
ld bc, $203
|
||||
call PrintNumber
|
||||
pop hl
|
||||
pop de
|
||||
ret
|
||||
|
||||
|
||||
; Predef 0x37
|
||||
StatusScreen: ; 12953 (4:6953)
|
||||
call LoadMonData
|
||||
|
|
|
|||
16
engine/overworld/is_player_just_outside_map.asm
Normal file
16
engine/overworld/is_player_just_outside_map.asm
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
; returns whether the player is one tile outside the map in Z
|
||||
IsPlayerJustOutsideMap: ; 128d8 (4:68d8)
|
||||
ld a, [W_YCOORD]
|
||||
ld b, a
|
||||
ld a, [W_CURMAPHEIGHT]
|
||||
call .compareCoordWithMapDimension
|
||||
ret z
|
||||
ld a, [W_XCOORD]
|
||||
ld b, a
|
||||
ld a, [W_CURMAPWIDTH]
|
||||
.compareCoordWithMapDimension
|
||||
add a
|
||||
cp b
|
||||
ret z
|
||||
inc b
|
||||
ret
|
||||
50
main.asm
50
main.asm
|
|
@ -1907,7 +1907,7 @@ FieldMoveDisplayData: ; 7823 (1:7823)
|
|||
db $ff ; list terminator
|
||||
|
||||
|
||||
INCLUDE "engine/battle/1.asm"
|
||||
INCLUDE "engine/battle/moveEffects/drain_hp_effect.asm"
|
||||
|
||||
INCLUDE "engine/menu/players_pc.asm"
|
||||
|
||||
|
|
@ -4755,7 +4755,7 @@ PlayerCharacterTitleGraphics: INCBIN "gfx/player_title.2bpp"
|
|||
|
||||
SECTION "Battle (bank 4)", ROMX, BANK[$4]
|
||||
|
||||
INCLUDE "engine/battle/4.asm"
|
||||
INCLUDE "engine/overworld/is_player_just_outside_map.asm"
|
||||
INCLUDE "engine/menu/status_screen.asm"
|
||||
INCLUDE "engine/menu/party_menu.asm"
|
||||
|
||||
|
|
@ -4766,7 +4766,12 @@ ShrinkPic2:: INCBIN "pic/trainer/shrink2.pic"
|
|||
INCLUDE "engine/turn_sprite.asm"
|
||||
INCLUDE "engine/menu/start_sub_menus.asm"
|
||||
INCLUDE "engine/items/tms.asm"
|
||||
INCLUDE "engine/battle/4_2.asm"
|
||||
INCLUDE "engine/battle/end_of_battle.asm"
|
||||
INCLUDE "engine/battle/wild_encounters.asm"
|
||||
INCLUDE "engine/battle/moveEffects/recoil_effect.asm"
|
||||
INCLUDE "engine/battle/moveEffects/conversion_effect.asm"
|
||||
INCLUDE "engine/battle/moveEffects/haze_effect.asm"
|
||||
INCLUDE "engine/battle/get_trainer_name.asm"
|
||||
INCLUDE "engine/random.asm"
|
||||
|
||||
|
||||
|
|
@ -4820,7 +4825,7 @@ INCLUDE "engine/load_pokedex_tiles.asm"
|
|||
INCLUDE "engine/overworld/map_sprites.asm"
|
||||
INCLUDE "engine/overworld/emotion_bubbles.asm"
|
||||
INCLUDE "engine/evolve_trade.asm"
|
||||
INCLUDE "engine/battle/5.asm"
|
||||
INCLUDE "engine/battle/moveEffects/substitute_effect.asm"
|
||||
INCLUDE "engine/menu/pc.asm"
|
||||
|
||||
|
||||
|
|
@ -5149,7 +5154,9 @@ TangelaPicBack:: INCBIN "pic/monback/tangelab.pic"
|
|||
|
||||
|
||||
SECTION "Battle (bank 9)", ROMX, BANK[$9]
|
||||
INCLUDE "engine/battle/9.asm"
|
||||
INCLUDE "engine/battle/print_type.asm"
|
||||
INCLUDE "engine/battle/save_trainer_name.asm"
|
||||
INCLUDE "engine/battle/moveEffects/focus_energy_effect.asm"
|
||||
|
||||
|
||||
SECTION "Pics 2", ROMX, BANK[PICS_2]
|
||||
|
|
@ -5221,7 +5228,7 @@ MoltresPicBack:: INCBIN "pic/monback/moltresb.pic"
|
|||
|
||||
|
||||
SECTION "Battle (bank A)", ROMX, BANK[$A]
|
||||
INCLUDE "engine/battle/a.asm"
|
||||
INCLUDE "engine/battle/moveEffects/leech_seed_effect.asm"
|
||||
|
||||
|
||||
SECTION "Pics 3", ROMX, BANK[PICS_3]
|
||||
|
|
@ -5300,7 +5307,7 @@ FossilKabutopsPic:: INCBIN "pic/bmon/fossilkabutops.pic"
|
|||
|
||||
SECTION "Battle (bank B)", ROMX, BANK[$B]
|
||||
|
||||
INCLUDE "engine/battle/b.asm"
|
||||
INCLUDE "engine/battle/display_effectiveness.asm"
|
||||
|
||||
TrainerInfoTextBoxTileGraphics: INCBIN "gfx/trainer_info.2bpp"
|
||||
BlankLeaderNames: INCBIN "gfx/blank_leader_names.2bpp"
|
||||
|
|
@ -5308,7 +5315,8 @@ CircleTile: INCBIN "gfx/circle_tile.2bpp"
|
|||
BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp"
|
||||
|
||||
INCLUDE "engine/items/tmhm.asm"
|
||||
INCLUDE "engine/battle/b_2.asm"
|
||||
INCLUDE "engine/battle/scale_sprites.asm"
|
||||
INCLUDE "engine/battle/moveEffects/pay_day_effect.asm"
|
||||
INCLUDE "engine/game_corner_slots2.asm"
|
||||
|
||||
|
||||
|
|
@ -5378,7 +5386,8 @@ OldManPic:: INCBIN "pic/trainer/oldman.pic"
|
|||
|
||||
|
||||
SECTION "Battle (bank C)", ROMX, BANK[$C]
|
||||
INCLUDE "engine/battle/c.asm"
|
||||
INCLUDE "engine/battle/moveEffects/mist_effect.asm"
|
||||
INCLUDE "engine/battle/moveEffects/one_hit_ko_effect.asm"
|
||||
|
||||
|
||||
SECTION "Pics 5", ROMX, BANK[PICS_5]
|
||||
|
|
@ -5442,7 +5451,7 @@ VictreebelPicBack:: INCBIN "pic/monback/victreebelb.pic"
|
|||
SECTION "Battle (bank D)", ROMX, BANK[$D]
|
||||
|
||||
INCLUDE "engine/titlescreen2.asm"
|
||||
INCLUDE "engine/battle/d.asm"
|
||||
INCLUDE "engine/battle/link_battle_versus_text.asm"
|
||||
INCLUDE "engine/slot_machine.asm"
|
||||
INCLUDE "engine/overworld/pewter_guys.asm"
|
||||
INCLUDE "engine/multiply_divide.asm"
|
||||
|
|
@ -5454,7 +5463,10 @@ SECTION "bankE",ROMX,BANK[$E]
|
|||
INCLUDE "data/moves.asm"
|
||||
BaseStats: INCLUDE "data/base_stats.asm"
|
||||
INCLUDE "data/cries.asm"
|
||||
INCLUDE "engine/battle/e.asm"
|
||||
INCLUDE "engine/battle/unused_stats_functions.asm"
|
||||
INCLUDE "engine/battle/scroll_draw_trainer_pic.asm"
|
||||
INCLUDE "engine/battle/trainer_ai.asm"
|
||||
INCLUDE "engine/battle/draw_hud_pokeball_gfx.asm"
|
||||
|
||||
TradingAnimationGraphics:
|
||||
INCBIN "gfx/game_boy.norepeat.2bpp"
|
||||
|
|
@ -5465,7 +5477,9 @@ TradingAnimationGraphics2:
|
|||
INCBIN "gfx/trade2.2bpp"
|
||||
|
||||
INCLUDE "engine/evos_moves.asm"
|
||||
INCLUDE "engine/battle/e_2.asm"
|
||||
INCLUDE "engine/battle/moveEffects/heal_effect.asm"
|
||||
INCLUDE "engine/battle/moveEffects/transform_effect.asm"
|
||||
INCLUDE "engine/battle/moveEffects/reflect_light_screen_effect.asm"
|
||||
|
||||
|
||||
SECTION "bankF",ROMX,BANK[$F]
|
||||
|
|
@ -5938,7 +5952,8 @@ INCLUDE "scripts/mansion4.asm"
|
|||
INCLUDE "data/mapObjects/mansion4.asm"
|
||||
Mansion4Blocks: INCBIN "maps/mansion4.blk"
|
||||
|
||||
INCLUDE "engine/battle/14.asm"
|
||||
INCLUDE "engine/battle/init_battle_variables.asm"
|
||||
INCLUDE "engine/battle/moveEffects/paralyze_effect.asm"
|
||||
|
||||
INCLUDE "engine/overworld/card_key.asm"
|
||||
|
||||
|
|
@ -5999,7 +6014,7 @@ DayCareMBlocks: INCBIN "maps/daycarem.blk"
|
|||
|
||||
FuchsiaHouse3Blocks: INCBIN "maps/fuchsiahouse3.blk"
|
||||
|
||||
INCLUDE "engine/battle/15.asm"
|
||||
INCLUDE "engine/battle/experience.asm"
|
||||
|
||||
INCLUDE "scripts/route2.asm"
|
||||
INCLUDE "scripts/route3.asm"
|
||||
|
|
@ -6079,7 +6094,7 @@ Route18Blocks: INCBIN "maps/route18.blk"
|
|||
|
||||
INCBIN "maps/unusedblocks58d7d.blk"
|
||||
|
||||
INCLUDE "engine/battle/16.asm"
|
||||
INCLUDE "engine/battle/common_text.asm"
|
||||
|
||||
INCLUDE "engine/experience.asm"
|
||||
|
||||
|
|
@ -6436,7 +6451,7 @@ Plateau_Block: INCBIN "gfx/blocksets/plateau.bst"
|
|||
|
||||
SECTION "bank1A",ROMX,BANK[$1A]
|
||||
|
||||
INCLUDE "engine/battle/1a.asm"
|
||||
INCLUDE "engine/battle/decrement_pp.asm"
|
||||
|
||||
Version_GFX:
|
||||
IF DEF(_RED)
|
||||
|
|
@ -6493,7 +6508,8 @@ INCLUDE "engine/gamefreak.asm"
|
|||
INCLUDE "engine/hall_of_fame.asm"
|
||||
INCLUDE "engine/overworld/healing_machine.asm"
|
||||
INCLUDE "engine/overworld/player_animations.asm"
|
||||
INCLUDE "engine/battle/1c.asm"
|
||||
INCLUDE "engine/battle/ghost_marowak_anim.asm"
|
||||
INCLUDE "engine/battle/battle_transitions.asm"
|
||||
INCLUDE "engine/town_map.asm"
|
||||
INCLUDE "engine/mon_party_sprites.asm"
|
||||
INCLUDE "engine/in_game_trades.asm"
|
||||
|
|
|
|||
27
wram.asm
27
wram.asm
|
|
@ -351,6 +351,10 @@ wNPCMovementScriptBank:: ; cc58
|
|||
ds 2
|
||||
|
||||
wHallOfFame:: ; cc5b
|
||||
wBoostExpByExpAll:: ; cc5b
|
||||
wAnimationType:: ; cc5b
|
||||
; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon...
|
||||
|
||||
wcc5b:: ds 1
|
||||
wcc5c:: ds 1
|
||||
wcc5d:: ds 1
|
||||
|
|
@ -377,7 +381,11 @@ wSimulatedJoypadStatesEnd:: ; ccd3
|
|||
|
||||
wccd3:: ds 1
|
||||
wccd4:: ds 1
|
||||
wccd5:: ds 2
|
||||
|
||||
; if [ccd5] != 1, the second AI layer is not applied
|
||||
wAILayer2Encouragement:: ; ccd5
|
||||
ds 1
|
||||
ds 1
|
||||
|
||||
; current HP of player and enemy substitutes
|
||||
wPlayerSubstituteHP:: ; ccd7
|
||||
|
|
@ -424,14 +432,14 @@ wSafariBaitFactor:: ; cce9
|
|||
|
||||
wcceb:: ds 1
|
||||
wccec:: ds 1
|
||||
wcced:: ds 1
|
||||
wMonIsDisobedient:: ds 1
|
||||
wccee:: ds 1
|
||||
wccef:: ds 1
|
||||
wccf0:: ds 1
|
||||
wPlayerUsedMove:: ds 1
|
||||
wEnemyUsedMove:: ds 1
|
||||
wccf3:: ds 1
|
||||
wccf4:: ds 1
|
||||
wMoveDidntMiss:: ds 1
|
||||
|
||||
wPartyFoughtCurrentEnemyFlags::
|
||||
; flags that indicate which party members have fought the current enemy mon
|
||||
|
|
@ -783,7 +791,9 @@ wcf30:: ds 7
|
|||
wcf37:: ds 20
|
||||
wcf4b:: ds 1
|
||||
wcf4c:: ds 1
|
||||
wcf4d:: ds 18
|
||||
wGainBoostedExp:: ; cf4d
|
||||
ds 1
|
||||
ds 17
|
||||
|
||||
wGymCityName:: ; cf5f
|
||||
wStringBuffer1:: ; cf5f
|
||||
|
|
@ -967,7 +977,14 @@ W_BATTLETYPE:: ; d05a
|
|||
; in safari battle, this is 2
|
||||
ds 1
|
||||
|
||||
wd05b:: ds 1
|
||||
wDamageMultipliers:: ; d05b
|
||||
; bits 0-6: Effectiveness
|
||||
; $0 = immune
|
||||
; $5 = not very effective
|
||||
; $a = neutral
|
||||
; $14 = super-effective
|
||||
; bit 7: STAB
|
||||
ds 1
|
||||
|
||||
W_LONEATTACKNO:: ; d05c
|
||||
; which entry in LoneAttacks to use
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue