mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Merge github.com:pikalaxalt/pokecrystal
This commit is contained in:
commit
803c6081d7
232
audio/cries.asm
232
audio/cries.asm
File diff suppressed because it is too large
Load Diff
221
audio/engine.asm
221
audio/engine.asm
File diff suppressed because it is too large
Load Diff
@ -13,13 +13,13 @@ Music_Evolution_Ch1: ; f06ed
|
||||
dutycycle $2
|
||||
notetype $c, $92
|
||||
octave 3
|
||||
unknownmusic0xe0 $0, 4, A_
|
||||
slidepitchto 0, 4, A_
|
||||
note C_, 1
|
||||
unknownmusic0xe0 $0, 4, A_
|
||||
slidepitchto 0, 4, A_
|
||||
note G_, 1
|
||||
unknownmusic0xe0 $0, 4, A_
|
||||
slidepitchto 0, 4, A_
|
||||
note C_, 1
|
||||
unknownmusic0xe0 $0, 4, A_
|
||||
slidepitchto 0, 4, A_
|
||||
note G_, 1
|
||||
note __, 4
|
||||
dutycycle $3
|
||||
|
@ -275,9 +275,8 @@ Music_GoldenrodCity_Ch3: ; eb584
|
||||
vibrato $8, $23
|
||||
notetype $c, $25
|
||||
Music_GoldenrodCity_branch_eb58c: ; eb58c
|
||||
rept 2
|
||||
callchannel Music_GoldenrodCity_branch_eb5aa
|
||||
endr
|
||||
callchannel Music_GoldenrodCity_branch_eb5aa
|
||||
callchannel Music_GoldenrodCity_branch_eb5d2
|
||||
note __, 3
|
||||
octave 3
|
||||
|
@ -11,16 +11,16 @@ Music_HealPokemon_Ch1: ; f06a0
|
||||
tone $0001
|
||||
notetype $c, $81
|
||||
note __, 2
|
||||
unknownmusic0xe0 $0, 4, __
|
||||
slidepitchto 0, 4, __
|
||||
note B_, 2
|
||||
unknownmusic0xe0 $0, 5, E_
|
||||
slidepitchto 0, 5, E_
|
||||
note B_, 2
|
||||
unknownmusic0xe0 $0, 4, E_
|
||||
slidepitchto 0, 4, E_
|
||||
note E_, 2
|
||||
note __, 4
|
||||
unknownmusic0xe0 $0, 3, __
|
||||
slidepitchto 0, 3, __
|
||||
note E_, 4
|
||||
unknownmusic0xe0 $0, 4, __
|
||||
slidepitchto 0, 4, __
|
||||
note B_, 4
|
||||
endchannel
|
||||
; f06c4
|
||||
|
@ -492,9 +492,8 @@ Music_JohtoWildBattle_branch_f5fdb: ; f5fdb
|
||||
note G_, 2
|
||||
loopchannel 7, Music_JohtoWildBattle_branch_f5fdb
|
||||
note F#, 4
|
||||
rept 2
|
||||
callchannel Music_JohtoWildBattle_branch_f6055
|
||||
endr
|
||||
callchannel Music_JohtoWildBattle_branch_f6055
|
||||
Music_JohtoWildBattle_branch_f5fe8: ; f5fe8
|
||||
note D_, 2
|
||||
note G_, 2
|
||||
|
@ -325,25 +325,21 @@ Music_KantoWildBattle_branch_ed1c8: ; ed1c8
|
||||
note F_, 1
|
||||
note F#, 1
|
||||
notetype $6, $b7
|
||||
rept 2
|
||||
callchannel Music_KantoWildBattle_branch_ed307
|
||||
endr
|
||||
callchannel Music_KantoWildBattle_branch_ed307
|
||||
forceoctave $1
|
||||
rept 2
|
||||
callchannel Music_KantoWildBattle_branch_ed307
|
||||
endr
|
||||
callchannel Music_KantoWildBattle_branch_ed307
|
||||
forceoctave $0
|
||||
rept 4
|
||||
callchannel Music_KantoWildBattle_branch_ed307
|
||||
endr
|
||||
forceoctave $1
|
||||
rept 2
|
||||
callchannel Music_KantoWildBattle_branch_ed307
|
||||
endr
|
||||
callchannel Music_KantoWildBattle_branch_ed307
|
||||
forceoctave $0
|
||||
rept 2
|
||||
callchannel Music_KantoWildBattle_branch_ed307
|
||||
endr
|
||||
callchannel Music_KantoWildBattle_branch_ed307
|
||||
note __, 16
|
||||
octave 3
|
||||
note A#, 16
|
||||
|
@ -2322,7 +2322,7 @@ Sfx_Aeroblast: ; f1334
|
||||
; f133a
|
||||
|
||||
Sfx_Aeroblast_Ch5: ; f133a
|
||||
unknownmusic0xde $f2
|
||||
sound_duty 2, 0, 3, 3
|
||||
soundinput $f5
|
||||
sound C_, 13, $f8, $0580
|
||||
soundinput $8
|
||||
@ -4762,7 +4762,7 @@ Sfx_Supersonic_branch_f21ef: ; f21ef
|
||||
; f21fc
|
||||
|
||||
Sfx_Supersonic_Ch6: ; f21fc
|
||||
unknownmusic0xde $b3
|
||||
sound_duty 3, 0, 3, 2
|
||||
sound __, 16, $2f, $07c8
|
||||
Sfx_Supersonic_branch_f2202: ; f2202
|
||||
sound __, 16, $cf, $07c7
|
||||
@ -4790,7 +4790,7 @@ Sfx_Leer_branch_f221a: ; f221a
|
||||
|
||||
Sfx_Leer_Ch6: ; f2229
|
||||
Sfx_Leer_branch_f2229: ; f2229
|
||||
unknownmusic0xde $b3
|
||||
sound_duty 3, 0, 3, 2
|
||||
sound __, 1, $e1, $07c1
|
||||
sound __, 1, $e1, $0701
|
||||
loopchannel 12, Sfx_Leer_branch_f2229
|
||||
@ -4807,7 +4807,7 @@ Sfx_Leer_branch_f2238: ; f2238
|
||||
|
||||
Sfx_Ember_Ch5: ; f2243
|
||||
Sfx_Ember_branch_f2243: ; f2243
|
||||
unknownmusic0xde $c9
|
||||
sound_duty 1, 2, 0, 3
|
||||
sound __, 12, $f3, $0120
|
||||
sound __, 10, $d3, $0150
|
||||
loopchannel 5, Sfx_Ember_branch_f2243
|
||||
@ -4829,7 +4829,7 @@ Sfx_Ember_branch_f225a: ; f225a
|
||||
|
||||
Sfx_Bubblebeam_Ch5: ; f226e
|
||||
Sfx_Bubblebeam_branch_f226e: ; f226e
|
||||
unknownmusic0xde $39
|
||||
sound_duty 1, 2, 3, 0
|
||||
sound __, 5, $f4, $0600
|
||||
sound __, 4, $c4, $0500
|
||||
sound __, 6, $b5, $0600
|
||||
@ -4841,7 +4841,7 @@ Sfx_Bubblebeam_branch_f226e: ; f226e
|
||||
|
||||
Sfx_Bubblebeam_Ch6: ; f2289
|
||||
Sfx_Bubblebeam_branch_f2289: ; f2289
|
||||
unknownmusic0xde $8d
|
||||
sound_duty 1, 3, 0, 2
|
||||
sound __, 6, $e4, $05e0
|
||||
sound __, 5, $b4, $04e0
|
||||
sound __, 7, $a5, $05e8
|
||||
@ -4862,7 +4862,7 @@ Sfx_Bubblebeam_branch_f22a0: ; f22a0
|
||||
|
||||
Sfx_HydroPump_Ch5: ; f22b1
|
||||
Sfx_HydroPump_branch_f22b1: ; f22b1
|
||||
unknownmusic0xde $d2
|
||||
sound_duty 2, 0, 1, 3
|
||||
sound __, 4, $81, $0300
|
||||
sound __, 4, $c1, $0400
|
||||
sound __, 4, $f1, $0500
|
||||
@ -4887,7 +4887,7 @@ Sfx_HydroPump_branch_f22d0: ; f22d0
|
||||
|
||||
Sfx_Surf_Ch5: ; f22e7
|
||||
Sfx_Surf_branch_f22e7: ; f22e7
|
||||
unknownmusic0xde $39
|
||||
sound_duty 1, 2, 3, 0
|
||||
sound __, 16, $f4, $0500
|
||||
sound __, 16, $c4, $0400
|
||||
sound __, 16, $e2, $05c0
|
||||
@ -4897,7 +4897,7 @@ Sfx_Surf_branch_f22e7: ; f22e7
|
||||
|
||||
Sfx_Surf_Ch6: ; f22fa
|
||||
Sfx_Surf_branch_f22fa: ; f22fa
|
||||
unknownmusic0xde $8d
|
||||
sound_duty 1, 3, 0, 2
|
||||
sound __, 8, $e4, $0430
|
||||
sound __, 16, $b4, $0330
|
||||
sound __, 16, $a2, $0438
|
||||
@ -4917,7 +4917,7 @@ Sfx_Surf_branch_f230d: ; f230d
|
||||
|
||||
Sfx_Psybeam_Ch5: ; f231e
|
||||
Sfx_Psybeam_branch_f231e: ; f231e
|
||||
unknownmusic0xde $a1
|
||||
sound_duty 1, 0, 2, 2
|
||||
sound __, 11, $f1, $0640
|
||||
sound __, 11, $f3, $0680
|
||||
sound __, 11, $f2, $0620
|
||||
@ -4928,7 +4928,7 @@ Sfx_Psybeam_branch_f231e: ; f231e
|
||||
|
||||
Sfx_Psybeam_Ch6: ; f2335
|
||||
Sfx_Psybeam_branch_f2335: ; f2335
|
||||
unknownmusic0xde $b3
|
||||
sound_duty 3, 0, 3, 2
|
||||
sound __, 11, $f3, $0571
|
||||
sound __, 8, $e3, $0531
|
||||
sound __, 11, $f1, $0551
|
||||
@ -4958,7 +4958,7 @@ Sfx_Charge_branch_f2357: ; f2357
|
||||
|
||||
Sfx_Charge_Ch6: ; f236e
|
||||
Sfx_Charge_branch_f236e: ; f236e
|
||||
unknownmusic0xde $b3
|
||||
sound_duty 3, 0, 3, 2
|
||||
sound __, 3, $e1, $0302
|
||||
sound __, 4, $e1, $07f2
|
||||
sound __, 5, $e1, $0602
|
||||
@ -4979,7 +4979,7 @@ Sfx_Charge_branch_f2385: ; f2385
|
||||
|
||||
Sfx_Thundershock_Ch5: ; f2396
|
||||
Sfx_Thundershock_branch_f2396: ; f2396
|
||||
unknownmusic0xde $2b
|
||||
sound_duty 3, 2, 2, 0
|
||||
sound __, 4, $f1, $07f0
|
||||
sound __, 5, $f2, $0200
|
||||
loopchannel 8, Sfx_Thundershock_branch_f2396
|
||||
@ -4988,7 +4988,7 @@ Sfx_Thundershock_branch_f2396: ; f2396
|
||||
|
||||
Sfx_Thundershock_Ch6: ; f23a5
|
||||
Sfx_Thundershock_branch_f23a5: ; f23a5
|
||||
unknownmusic0xde $b3
|
||||
sound_duty 3, 0, 3, 2
|
||||
sound __, 5, $e2, $0202
|
||||
sound __, 5, $e1, $07e2
|
||||
loopchannel 9, Sfx_Thundershock_branch_f23a5
|
||||
@ -5092,7 +5092,7 @@ Sfx_Sharpen_Ch6: ; f2463
|
||||
; f247a
|
||||
|
||||
Sfx_EggBomb_Ch5: ; f247a
|
||||
unknownmusic0xde $ed
|
||||
sound_duty 1, 3, 2, 3
|
||||
sound __, 9, $ff, $03f8
|
||||
sound __, 16, $ff, $0400
|
||||
sound __, 16, $f3, $0400
|
||||
@ -5100,7 +5100,7 @@ Sfx_EggBomb_Ch5: ; f247a
|
||||
; f2489
|
||||
|
||||
Sfx_EggBomb_Ch6: ; f2489
|
||||
unknownmusic0xde $b4
|
||||
sound_duty 0, 1, 3, 2
|
||||
sound __, 9, $ef, $03c0
|
||||
sound __, 16, $ef, $03c0
|
||||
sound __, 16, $e3, $03c0
|
||||
@ -5168,7 +5168,7 @@ Sfx_HyperBeam_branch_f24f8: ; f24f8
|
||||
; f2509
|
||||
|
||||
Sfx_HyperBeam_Ch6: ; f2509
|
||||
unknownmusic0xde $b3
|
||||
sound_duty 3, 0, 3, 2
|
||||
sound __, 3, $f1, $0781
|
||||
sound __, 3, $f1, $0701
|
||||
sound __, 3, $f1, $0791
|
||||
|
@ -196,9 +196,9 @@ AI_TryItem: ; 38105
|
||||
jr z, .has_item
|
||||
|
||||
dec de
|
||||
rept 3
|
||||
inc hl
|
||||
endr
|
||||
inc hl
|
||||
inc hl
|
||||
jr .loop
|
||||
|
||||
.has_item
|
||||
@ -216,9 +216,8 @@ endr
|
||||
pop de
|
||||
pop hl
|
||||
|
||||
rept 2
|
||||
inc hl
|
||||
endr
|
||||
inc hl
|
||||
jr c, .loop
|
||||
|
||||
.used_item
|
||||
@ -572,20 +571,20 @@ EnemyUsedFullHeal: ; 383a3 (e:43a3)
|
||||
|
||||
EnemyUsedMaxPotion: ; 383ae (e:43ae)
|
||||
ld a, MAX_POTION
|
||||
ld [wd1f1], a
|
||||
ld [CurEnemyItem], a
|
||||
jr FullRestoreContinue
|
||||
|
||||
EnemyUsedFullRestore: ; 383b5 (e:43b5)
|
||||
call AI_HealStatus
|
||||
ld a, FULL_RESTORE
|
||||
ld [wd1f1], a
|
||||
ld [CurEnemyItem], a
|
||||
ld hl, EnemySubStatus3
|
||||
res SUBSTATUS_CONFUSED, [hl]
|
||||
xor a
|
||||
ld [EnemyConfuseCount], a
|
||||
|
||||
FullRestoreContinue: ; 383c6
|
||||
ld de, wd1ec
|
||||
ld de, wCurHPAnimOldHP
|
||||
ld hl, EnemyMonHP + 1
|
||||
ld a, [hld]
|
||||
ld [de], a
|
||||
@ -597,11 +596,11 @@ FullRestoreContinue: ; 383c6
|
||||
ld a, [hld]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld [Buffer1], a
|
||||
ld [wCurHPAnimMaxHP], a
|
||||
ld [EnemyMonHP + 1], a
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
ld [Buffer2], a
|
||||
ld [wCurHPAnimMaxHP + 1], a
|
||||
ld [EnemyMonHP], a
|
||||
jr EnemyPotionFinish
|
||||
; 383e8 (e:43e8)
|
||||
@ -621,20 +620,20 @@ EnemyUsedHyperPotion: ; 383f4 (e:43f4)
|
||||
ld b, 200
|
||||
|
||||
EnemyPotionContinue: ; 383f8
|
||||
ld [wd1f1], a
|
||||
ld [CurEnemyItem], a
|
||||
ld hl, EnemyMonHP + 1
|
||||
ld a, [hl]
|
||||
ld [wd1ec], a
|
||||
ld [wCurHPAnimOldHP], a
|
||||
add b
|
||||
ld [hld], a
|
||||
ld [wd1ee], a
|
||||
ld [wCurHPAnimNewHP], a
|
||||
ld a, [hl]
|
||||
ld [wd1ec + 1], a
|
||||
ld [wd1ee + 1], a
|
||||
ld [wCurHPAnimOldHP + 1], a
|
||||
ld [wCurHPAnimNewHP + 1], a
|
||||
jr nc, .ok
|
||||
inc a
|
||||
ld [hl], a
|
||||
ld [wd1ee + 1], a
|
||||
ld [wCurHPAnimNewHP + 1], a
|
||||
.ok
|
||||
inc hl
|
||||
ld a, [hld]
|
||||
@ -642,22 +641,22 @@ EnemyPotionContinue: ; 383f8
|
||||
ld de, EnemyMonMaxHP + 1
|
||||
ld a, [de]
|
||||
dec de
|
||||
ld [Buffer1], a
|
||||
ld [wCurHPAnimMaxHP], a
|
||||
sub b
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld a, [de]
|
||||
ld [Buffer2], a
|
||||
ld [wCurHPAnimMaxHP + 1], a
|
||||
sbc b
|
||||
jr nc, EnemyPotionFinish
|
||||
inc de
|
||||
ld a, [de]
|
||||
dec de
|
||||
ld [hld], a
|
||||
ld [wd1ee], a
|
||||
ld [wCurHPAnimNewHP], a
|
||||
ld a, [de]
|
||||
ld [hl], a
|
||||
ld [wd1ef], a
|
||||
ld [wCurHPAnimNewHP + 1], a
|
||||
|
||||
EnemyPotionFinish: ; 38436
|
||||
call PrintText_UsedItemOn
|
||||
@ -844,7 +843,7 @@ EnemyUsedXSpecial: ; 38553
|
||||
; a = ITEM_CONSTANT
|
||||
; b = BATTLE_CONSTANT (ATTACK, DEFENSE, SPEED, SP_ATTACK, SP_DEFENSE, ACCURACY, EVASION)
|
||||
EnemyUsedXItem:
|
||||
ld [wd1f1], a
|
||||
ld [CurEnemyItem], a
|
||||
push bc
|
||||
call PrintText_UsedItemOn
|
||||
pop bc
|
||||
@ -856,13 +855,13 @@ EnemyUsedXItem:
|
||||
; Parameter
|
||||
; a = ITEM_CONSTANT
|
||||
PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568
|
||||
ld [wd1f1], a
|
||||
ld [CurEnemyItem], a
|
||||
call PrintText_UsedItemOn
|
||||
jp AIUpdateHUD
|
||||
; 38571
|
||||
|
||||
PrintText_UsedItemOn: ; 38571
|
||||
ld a, [wd1f1]
|
||||
ld a, [CurEnemyItem]
|
||||
ld [wd265], a
|
||||
call GetItemName
|
||||
ld hl, StringBuffer1
|
||||
|
@ -19,9 +19,9 @@ AIChooseMove: ; 440ce
|
||||
; The default score is 20. Unusable moves are given a score of 80.
|
||||
ld a, 20
|
||||
ld hl, Buffer1
|
||||
rept 3
|
||||
ld [hli], a
|
||||
endr
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
|
||||
; Don't pick disabled moves.
|
||||
@ -107,9 +107,8 @@ endr
|
||||
ld hl, AIScoringPointers
|
||||
dec c
|
||||
ld b, 0
|
||||
rept 2
|
||||
add hl, bc
|
||||
endr
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -136,9 +136,11 @@ CheckPlayerMoveTypeMatchups: ; 3484e
|
||||
jr c, .loop2
|
||||
|
||||
; neutral
|
||||
rept 5
|
||||
inc c
|
||||
endr
|
||||
inc c
|
||||
inc c
|
||||
inc c
|
||||
inc c
|
||||
cp 10
|
||||
jr z, .loop2
|
||||
|
||||
@ -161,11 +163,6 @@ endr
|
||||
|
||||
.doubledown
|
||||
call .DecreaseScore
|
||||
|
||||
; fallthrough
|
||||
; 34931
|
||||
|
||||
|
||||
.DecreaseScore: ; 34931
|
||||
ld a, [wEnemyAISwitchScore]
|
||||
dec a
|
||||
@ -173,7 +170,6 @@ endr
|
||||
ret
|
||||
; 34939
|
||||
|
||||
|
||||
.IncreaseScore: ; 34939
|
||||
ld a, [wEnemyAISwitchScore]
|
||||
inc a
|
||||
@ -198,16 +194,16 @@ CheckAbleToSwitch: ; 34941
|
||||
; Perish count is 1
|
||||
|
||||
call FindAliveEnemyMons
|
||||
call FindEnemyMonsWithEnoughHP
|
||||
call FindEnemyMonsWithAtLeastQuarterMaxHP
|
||||
call FindEnemyMonsThatResistPlayer
|
||||
call Function34a85
|
||||
call FindAliveEnemyMonsWithASuperEffectiveMove
|
||||
|
||||
ld a, e
|
||||
cp 2
|
||||
jr nz, .not_2
|
||||
|
||||
ld a, [wEnemyAISwitchScore]
|
||||
add $30
|
||||
add $30 ; maximum chance
|
||||
ld [wEnemySwitchMonParam], a
|
||||
ret
|
||||
|
||||
@ -223,12 +219,11 @@ CheckAbleToSwitch: ; 34941
|
||||
jr nc, .loop1
|
||||
|
||||
ld a, b
|
||||
add $30
|
||||
add $30 ; maximum chance
|
||||
ld [wEnemySwitchMonParam], a
|
||||
ret
|
||||
|
||||
.no_perish
|
||||
|
||||
call CheckPlayerMoveTypeMatchups
|
||||
ld a, [wEnemyAISwitchScore]
|
||||
cp 11
|
||||
@ -238,13 +233,13 @@ CheckAbleToSwitch: ; 34941
|
||||
and a
|
||||
jr z, .no_last_counter_move
|
||||
|
||||
call Function34a2a
|
||||
call FindEnemyMonsImmuneToLastCounterMove
|
||||
ld a, [wEnemyAISwitchScore]
|
||||
and a
|
||||
jr z, .no_last_counter_move
|
||||
|
||||
ld c, a
|
||||
call Function34aa7
|
||||
call FindEnemyMonsWithASuperEffectiveMove
|
||||
ld a, [wEnemyAISwitchScore]
|
||||
cp $ff
|
||||
ret z
|
||||
@ -285,9 +280,9 @@ CheckAbleToSwitch: ; 34941
|
||||
ret nc
|
||||
|
||||
call FindAliveEnemyMons
|
||||
call FindEnemyMonsWithEnoughHP
|
||||
call FindEnemyMonsWithAtLeastQuarterMaxHP
|
||||
call FindEnemyMonsThatResistPlayer
|
||||
call Function34a85
|
||||
call FindAliveEnemyMonsWithASuperEffectiveMove
|
||||
|
||||
ld a, e
|
||||
cp $2
|
||||
@ -352,7 +347,7 @@ FindAliveEnemyMons: ; 349f4
|
||||
; 34a2a
|
||||
|
||||
|
||||
Function34a2a: ; 34a2a
|
||||
FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
|
||||
ld hl, OTPartyMon1
|
||||
ld a, [OTPartyCount]
|
||||
ld b, a
|
||||
@ -361,44 +356,50 @@ Function34a2a: ; 34a2a
|
||||
xor a
|
||||
ld [wEnemyAISwitchScore], a
|
||||
|
||||
.asm_34a39
|
||||
.loop
|
||||
ld a, [CurOTMon]
|
||||
cp d
|
||||
push hl
|
||||
jr z, .asm_34a77
|
||||
jr z, .next
|
||||
|
||||
push hl
|
||||
push bc
|
||||
|
||||
; If the Pokemon has at least 1 HP...
|
||||
ld bc, MON_HP
|
||||
add hl, bc
|
||||
pop bc
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
pop hl
|
||||
jr z, .asm_34a77
|
||||
jr z, .next
|
||||
|
||||
ld a, [hl]
|
||||
ld [CurSpecies], a
|
||||
call GetBaseData
|
||||
|
||||
; the enemy's last move is damaging...
|
||||
ld a, [LastEnemyCounterMove]
|
||||
dec a
|
||||
ld hl, Moves + MOVE_POWER
|
||||
call GetMoveAttr
|
||||
and a
|
||||
jr z, .asm_34a77
|
||||
jr z, .next
|
||||
|
||||
; and the Pokemon is immune to it...
|
||||
inc hl
|
||||
call GetMoveByte
|
||||
ld hl, BaseType
|
||||
call CheckTypeMatchup
|
||||
ld a, [wTypeMatchup]
|
||||
and a
|
||||
jr nz, .asm_34a77
|
||||
jr nz, .next
|
||||
|
||||
; ... encourage that Pokemon.
|
||||
ld a, [wEnemyAISwitchScore]
|
||||
or c
|
||||
ld [wEnemyAISwitchScore], a
|
||||
.asm_34a77
|
||||
.next
|
||||
pop hl
|
||||
dec b
|
||||
ret z
|
||||
@ -410,11 +411,11 @@ Function34a2a: ; 34a2a
|
||||
|
||||
inc d
|
||||
srl c
|
||||
jr .asm_34a39
|
||||
jr .loop
|
||||
; 34a85
|
||||
|
||||
|
||||
Function34a85: ; 34a85
|
||||
FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85
|
||||
push bc
|
||||
ld a, [OTPartyCount]
|
||||
ld e, a
|
||||
@ -444,13 +445,9 @@ Function34a85: ; 34a85
|
||||
|
||||
and c
|
||||
ld c, a
|
||||
FindEnemyMonsWithASuperEffectiveMove: ; 34aa7
|
||||
|
||||
; fallthrough
|
||||
; 34aa7
|
||||
|
||||
Function34aa7: ; 34aa7
|
||||
|
||||
ld a, $ff
|
||||
ld a, -1
|
||||
ld [wEnemyAISwitchScore], a
|
||||
ld hl, OTPartyMon1Moves
|
||||
ld b, 1 << (PARTY_LENGTH - 1)
|
||||
@ -463,32 +460,40 @@ Function34aa7: ; 34aa7
|
||||
|
||||
push hl
|
||||
push bc
|
||||
; for move on mon:
|
||||
ld b, NUM_MOVES
|
||||
ld c, 0
|
||||
.loop3
|
||||
; if move is None: break
|
||||
ld a, [hli]
|
||||
and a
|
||||
push hl
|
||||
jr z, .break3
|
||||
|
||||
; if move has no power: continue
|
||||
dec a
|
||||
ld hl, Moves + MOVE_POWER
|
||||
call GetMoveAttr
|
||||
and a
|
||||
jr z, .nope
|
||||
|
||||
; check type matchups
|
||||
inc hl
|
||||
call GetMoveByte
|
||||
ld hl, BattleMonType1
|
||||
call CheckTypeMatchup
|
||||
|
||||
; if immune or not very effective: continue
|
||||
ld a, [wTypeMatchup]
|
||||
cp 10
|
||||
jr c, .nope
|
||||
|
||||
; if neutral: load 1 and continue
|
||||
ld e, 1
|
||||
cp 10 + 1
|
||||
jr c, .nope
|
||||
|
||||
; if super-effective: load 2 and break
|
||||
ld e, 2
|
||||
jr .break3
|
||||
|
||||
@ -505,18 +510,19 @@ Function34aa7: ; 34aa7
|
||||
ld a, e
|
||||
pop bc
|
||||
pop hl
|
||||
cp $2
|
||||
jr z, .done2
|
||||
|
||||
cp $1
|
||||
jr nz, .next
|
||||
cp 2
|
||||
jr z, .done2 ; at least one move is super-effective
|
||||
cp 1
|
||||
jr nz, .next ; no move does more than half damage
|
||||
|
||||
; encourage this pokemon
|
||||
ld a, d
|
||||
or b
|
||||
ld d, a
|
||||
jr .next
|
||||
jr .next ; such a long jump
|
||||
|
||||
.next
|
||||
; next pokemon?
|
||||
push bc
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
add hl, bc
|
||||
@ -524,12 +530,14 @@ Function34aa7: ; 34aa7
|
||||
srl b
|
||||
jr nc, .loop
|
||||
|
||||
; if no pokemon has a super-effective move: return
|
||||
ld a, d
|
||||
ld b, a
|
||||
and a
|
||||
ret z
|
||||
|
||||
.done2
|
||||
; convert the bit flag to an int and return
|
||||
push bc
|
||||
sla b
|
||||
sla b
|
||||
@ -608,7 +616,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20
|
||||
; 34b77
|
||||
|
||||
|
||||
FindEnemyMonsWithEnoughHP: ; 34b77
|
||||
FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77
|
||||
push bc
|
||||
ld de, OTPartySpecies
|
||||
ld b, 1 << (PARTY_LENGTH - 1)
|
||||
@ -626,17 +634,15 @@ FindEnemyMonsWithEnoughHP: ; 34b77
|
||||
ld b, [hl]
|
||||
inc hl
|
||||
ld c, [hl]
|
||||
rept 2
|
||||
inc hl
|
||||
endr
|
||||
inc hl
|
||||
; hl = MaxHP + 1
|
||||
; b = (4 * b) % $100 + (c & 3)
|
||||
; c = c / 4
|
||||
; bc = [CurHP] * 4
|
||||
srl c
|
||||
rl b
|
||||
srl c
|
||||
rl b
|
||||
; a = (MaxHP / $100) - b - (1 if c > (MaxHP % $100) else 0)
|
||||
; if bc >= [hl], encourage
|
||||
ld a, [hld]
|
||||
cp c
|
||||
ld a, [hl]
|
||||
|
@ -108,7 +108,7 @@ RunBattleAnimScript: ; cc163
|
||||
call RunBattleAnimCommand
|
||||
call _ExecuteBGEffects
|
||||
call BattleAnim_UpdateOAM_All
|
||||
call Function3b0c
|
||||
call PushLYOverrides
|
||||
call BattleAnimRequestPals
|
||||
|
||||
; Speed up Rollout's animation.
|
||||
@ -265,9 +265,9 @@ BattleAnim_ClearCGB_OAMFlags: ; cc23d
|
||||
ld a, [hl]
|
||||
and $f0
|
||||
ld [hli], a
|
||||
rept 3
|
||||
inc hl
|
||||
endr
|
||||
inc hl
|
||||
inc hl
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
@ -382,7 +382,7 @@ BattleAnimCommands:: ; cc2a4 (33:42a4)
|
||||
dw BattleAnimCmd_EB ; dummy
|
||||
dw BattleAnimCmd_EC ; dummy
|
||||
dw BattleAnimCmd_ED ; dummy
|
||||
dw BattleAnimCmd_JumpAnd
|
||||
dw BattleAnimCmd_IfParamAnd
|
||||
dw BattleAnimCmd_JumpUntil
|
||||
dw BattleAnimCmd_BGEffect
|
||||
dw BattleAnimCmd_BGP
|
||||
@ -392,10 +392,10 @@ BattleAnimCommands:: ; cc2a4 (33:42a4)
|
||||
dw BattleAnimCmd_F5
|
||||
dw BattleAnimCmd_F6
|
||||
dw BattleAnimCmd_F7
|
||||
dw BattleAnimCmd_JumpIf
|
||||
dw BattleAnimCmd_IfParamEqual
|
||||
dw BattleAnimCmd_SetVar
|
||||
dw BattleAnimCmd_IncVar
|
||||
dw BattleAnimCmd_JumpVar
|
||||
dw BattleAnimCmd_IfVarEqual
|
||||
dw BattleAnimCmd_Jump
|
||||
dw BattleAnimCmd_Loop
|
||||
dw BattleAnimCmd_Call
|
||||
@ -535,7 +535,7 @@ BattleAnimCmd_IncVar: ; cc3ad (33:43ad)
|
||||
inc [hl]
|
||||
ret
|
||||
|
||||
BattleAnimCmd_JumpVar: ; cc3b2 (33:43b2)
|
||||
BattleAnimCmd_IfVarEqual: ; cc3b2 (33:43b2)
|
||||
call GetBattleAnimByte
|
||||
ld hl, BattleAnimVar
|
||||
cp [hl]
|
||||
@ -563,7 +563,7 @@ BattleAnimCmd_JumpVar: ; cc3b2 (33:43b2)
|
||||
ld [hl], d
|
||||
ret
|
||||
|
||||
BattleAnimCmd_JumpIf: ; cc3d6 (33:43d6)
|
||||
BattleAnimCmd_IfParamEqual: ; cc3d6 (33:43d6)
|
||||
call GetBattleAnimByte
|
||||
ld hl, wBattleAnimParam
|
||||
cp [hl]
|
||||
@ -591,7 +591,7 @@ BattleAnimCmd_JumpIf: ; cc3d6 (33:43d6)
|
||||
ld [hl], d
|
||||
ret
|
||||
|
||||
BattleAnimCmd_JumpAnd: ; cc3fa (33:43fa)
|
||||
BattleAnimCmd_IfParamAnd: ; cc3fa (33:43fa)
|
||||
call GetBattleAnimByte
|
||||
ld e, a
|
||||
ld a, [wBattleAnimParam]
|
||||
@ -608,6 +608,7 @@ BattleAnimCmd_JumpAnd: ; cc3fa (33:43fa)
|
||||
dec hl
|
||||
ld [hl], e
|
||||
ret
|
||||
|
||||
.jump
|
||||
call GetBattleAnimByte
|
||||
ld e, a
|
||||
|
236
battle/anims.asm
236
battle/anims.asm
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
145
battle/core.asm
145
battle/core.asm
File diff suppressed because it is too large
Load Diff
@ -1541,11 +1541,6 @@ BattleCheckTypeMatchup: ; 347c8
|
||||
and a
|
||||
jr z, CheckTypeMatchup
|
||||
ld hl, BattleMonType1
|
||||
|
||||
; fallthrough
|
||||
; 347d3
|
||||
|
||||
|
||||
CheckTypeMatchup: ; 347d3
|
||||
push hl
|
||||
push de
|
||||
@ -2837,11 +2832,11 @@ PlayerAttackDamage: ; 352e2
|
||||
call GetDamageStatsCritical
|
||||
jr c, .thickclub
|
||||
|
||||
ld hl, EnemyStats + 2
|
||||
ld hl, EnemyDefense
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld c, [hl]
|
||||
ld hl, PlayerStats
|
||||
ld hl, PlayerAttack
|
||||
jr .thickclub
|
||||
|
||||
.special
|
||||
@ -2861,11 +2856,11 @@ PlayerAttackDamage: ; 352e2
|
||||
call GetDamageStatsCritical
|
||||
jr c, .lightball
|
||||
|
||||
ld hl, EnemyStats + SP_DEFENSE * 2
|
||||
ld hl, EnemySpDef
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld c, [hl]
|
||||
ld hl, PlayerStats + SP_ATTACK * 2
|
||||
ld hl, PlayerSpAtk
|
||||
|
||||
.lightball
|
||||
; Note: Returns player special attack at hl in hl.
|
||||
@ -3103,11 +3098,11 @@ EnemyAttackDamage: ; 353f6
|
||||
call GetDamageStatsCritical
|
||||
jr c, .thickclub
|
||||
|
||||
ld hl, PlayerStats + 2
|
||||
ld hl, PlayerDefense
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld c, [hl]
|
||||
ld hl, EnemyStats
|
||||
ld hl, EnemyAttack
|
||||
jr .thickclub
|
||||
|
||||
.Special:
|
||||
@ -3126,11 +3121,11 @@ EnemyAttackDamage: ; 353f6
|
||||
ld hl, EnemyMonSpclAtk
|
||||
call GetDamageStatsCritical
|
||||
jr c, .lightball
|
||||
ld hl, PlayerStats + 8
|
||||
ld hl, PlayerSpDef
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld c, [hl]
|
||||
ld hl, EnemyStats + 6
|
||||
ld hl, EnemySpAtk
|
||||
|
||||
.lightball
|
||||
call LightBallBoost
|
||||
@ -3407,9 +3402,9 @@ HitSelfInConfusion: ; 355dd
|
||||
sla c
|
||||
rl b
|
||||
.mimic_screen
|
||||
rept 3
|
||||
dec hl
|
||||
endr
|
||||
dec hl
|
||||
dec hl
|
||||
ld a, [hli]
|
||||
ld l, [hl]
|
||||
ld h, a
|
||||
@ -3953,9 +3948,9 @@ BattleCommand_Encore: ; 35864
|
||||
set SUBSTATUS_ENCORED, [hl]
|
||||
call BattleRandom
|
||||
and $3
|
||||
rept 3
|
||||
inc a
|
||||
endr
|
||||
inc a
|
||||
inc a
|
||||
ld [de], a
|
||||
call CheckOpponentWentFirst
|
||||
jr nz, .finish_move
|
||||
@ -4094,12 +4089,12 @@ BattleCommand_PainSplit: ; 35926
|
||||
ld a, [CurDamage + 1]
|
||||
rr a
|
||||
ld [CurDamage + 1], a
|
||||
rept 3
|
||||
inc hl
|
||||
endr
|
||||
rept 3
|
||||
inc hl
|
||||
inc hl
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
endr
|
||||
|
||||
.EnemyShareHP: ; 359ac
|
||||
ld c, [hl]
|
||||
@ -7447,9 +7442,9 @@ BattleCommand_TrapTarget: ; 36c2d
|
||||
ret nz
|
||||
call BattleRandom
|
||||
and 3
|
||||
rept 3
|
||||
inc a
|
||||
endr
|
||||
inc a
|
||||
inc a
|
||||
ld [hl], a
|
||||
ld a, BATTLE_VARS_MOVE_ANIM
|
||||
call GetBattleVar
|
||||
|
@ -45,9 +45,8 @@ HiddenPowerDamage: ; fbced
|
||||
|
||||
; Multiply by 5
|
||||
ld b, a
|
||||
rept 2
|
||||
add a
|
||||
endr
|
||||
add a
|
||||
add b
|
||||
|
||||
; Add Special & 3
|
||||
@ -75,9 +74,8 @@ endr
|
||||
ld a, [hl]
|
||||
and 3 << 4
|
||||
swap a
|
||||
rept 2
|
||||
add a
|
||||
endr
|
||||
add a
|
||||
or b
|
||||
|
||||
; Skip Normal
|
||||
|
162
battle/link_result.asm
Executable file
162
battle/link_result.asm
Executable file
@ -0,0 +1,162 @@
|
||||
DetermineLinkBattleResult: ; 2b930
|
||||
callba UpdateEnemyMonInParty
|
||||
ld hl, PartyMon1HP
|
||||
call .CountMonsRemaining
|
||||
push bc
|
||||
ld hl, OTPartyMon1HP
|
||||
call .CountMonsRemaining
|
||||
ld a, c
|
||||
pop bc
|
||||
cp c
|
||||
jr z, .even_number_of_mons_remaining
|
||||
jr c, .defeat
|
||||
jr .victory
|
||||
|
||||
.even_number_of_mons_remaining
|
||||
call .BothSides_CheckNumberMonsAtFullHealth
|
||||
jr z, .drawn
|
||||
ld a, e
|
||||
cp $1
|
||||
jr z, .victory
|
||||
cp $2
|
||||
jr z, .defeat
|
||||
ld hl, PartyMon1HP
|
||||
call .CalcPercentHPRemaining
|
||||
push de
|
||||
ld hl, OTPartyMon1HP
|
||||
call .CalcPercentHPRemaining
|
||||
pop hl
|
||||
ld a, d
|
||||
cp h
|
||||
jr c, .victory
|
||||
jr z, .compare_lo
|
||||
jr .defeat
|
||||
|
||||
.compare_lo
|
||||
ld a, e
|
||||
cp l
|
||||
jr z, .drawn
|
||||
jr nc, .defeat
|
||||
|
||||
.victory
|
||||
ld a, [wBattleResult]
|
||||
and $f0
|
||||
ld [wBattleResult], a
|
||||
ret
|
||||
|
||||
.defeat
|
||||
ld a, [wBattleResult]
|
||||
and $f0
|
||||
add $1
|
||||
ld [wBattleResult], a
|
||||
ret
|
||||
|
||||
.drawn
|
||||
ld a, [wBattleResult]
|
||||
and $f0
|
||||
add $2
|
||||
ld [wBattleResult], a
|
||||
ret
|
||||
|
||||
.CountMonsRemaining: ; 2b995
|
||||
ld c, 0
|
||||
ld b, 3
|
||||
ld de, PARTYMON_STRUCT_LENGTH - 1
|
||||
.loop
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
jr nz, .not_fainted
|
||||
inc c
|
||||
|
||||
.not_fainted
|
||||
add hl, de
|
||||
dec b
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
.CalcPercentHPRemaining: ; 2b9a6
|
||||
ld de, 0
|
||||
ld c, $3
|
||||
.loop2
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
jr z, .next
|
||||
dec hl
|
||||
xor a
|
||||
ld [hDividend + 0], a
|
||||
ld a, [hli]
|
||||
ld [hDividend + 1], a
|
||||
ld a, [hli]
|
||||
ld [hDividend + 2], a
|
||||
xor a
|
||||
ld [hDividend + 3], a
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld a, [hld]
|
||||
srl b
|
||||
rr a
|
||||
srl b
|
||||
rr a
|
||||
ld [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [hQuotient + 2]
|
||||
add e
|
||||
ld e, a
|
||||
ld a, [hQuotient + 1]
|
||||
adc d
|
||||
ld d, a
|
||||
dec hl
|
||||
|
||||
.next
|
||||
push de
|
||||
ld de, $2f
|
||||
add hl, de
|
||||
pop de
|
||||
dec c
|
||||
jr nz, .loop2
|
||||
ret
|
||||
|
||||
.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1
|
||||
ld hl, PartyMon1HP
|
||||
call .CheckFaintedOrFullHealth
|
||||
jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
|
||||
ld hl, OTPartyMon1HP
|
||||
call .CheckFaintedOrFullHealth
|
||||
ld e, $1
|
||||
ret
|
||||
|
||||
.finish
|
||||
ld hl, OTPartyMon1HP
|
||||
call .CheckFaintedOrFullHealth
|
||||
ld e, $0
|
||||
ret nz ; we both have pokemon that are neither fainted nor at full health
|
||||
ld e, $2
|
||||
ld a, $1
|
||||
and a
|
||||
ret
|
||||
|
||||
.CheckFaintedOrFullHealth: ; 2ba01
|
||||
ld d, 3
|
||||
.loop3
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld a, [hli]
|
||||
ld c, a
|
||||
or b
|
||||
jr z, .fainted_or_full_health
|
||||
ld a, [hli]
|
||||
cp b
|
||||
ret nz
|
||||
ld a, [hld]
|
||||
cp c
|
||||
ret nz
|
||||
|
||||
.fainted_or_full_health
|
||||
push de
|
||||
ld de, PARTYMON_STRUCT_LENGTH - 2
|
||||
add hl, de
|
||||
pop de
|
||||
dec d
|
||||
jr nz, .loop3
|
||||
ret
|
@ -141,9 +141,8 @@ CalcMagikarpLength: ; fbbfc
|
||||
; hl = de * 10
|
||||
ld h, d
|
||||
ld l, e
|
||||
rept 2
|
||||
add hl, hl
|
||||
endr
|
||||
add hl, hl
|
||||
add hl, de
|
||||
add hl, hl
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user