summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2019-09-09 23:49:05 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2019-09-09 23:49:05 +0100
commitd4959345dfa703a0054dd84d2e2c54ca9eac25ee (patch)
treec5811254860fd7b7380010ee066d50ffc65310aa /src
parent37af0eac26585f6a38582bbc0ab8459e2387543d (diff)
Disassemble Func_17080
Diffstat (limited to 'src')
-rw-r--r--src/engine/bank01.asm1
-rw-r--r--src/engine/bank05.asm52
2 files changed, 51 insertions, 2 deletions
diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm
index f9f8781..0880839 100644
--- a/src/engine/bank01.asm
+++ b/src/engine/bank01.asm
@@ -7620,6 +7620,7 @@ PrintThereWasNoEffectFromStatusText: ; 700a (1:700a)
ret
; 0x7045
+Func_7045: ; 7045 (1:7045)
INCROM $7045, $70aa
; initializes variables when a duel begins, such as zeroing wDuelFinished or wDuelTurns,
diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm
index 0385820..8c78a94 100644
--- a/src/engine/bank05.asm
+++ b/src/engine/bank05.asm
@@ -5241,8 +5241,56 @@ CheckIfAnyBasicPokemonInDeck: ; 17057 (5:7057)
ret
; 0x17080
-Func_17080 ; 17080 (5:7080)
- INCROM $17080, $170c9
+Func_17080: ; 17080 (5:7080)
+ ldh a, [hTempPlayAreaLocation_ff9d]
+ push af
+ call SwapTurn
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ ld b, a
+ ld c, PLAY_AREA_ARENA
+
+.loop
+ ld a, c
+ ldh [hTempPlayAreaLocation_ff9d], a
+ push bc
+ bank1call Func_7045
+ pop bc
+ jr c, .next
+ ld a, d
+ push bc
+ call LoadCardDataToBuffer2_FromDeckIndex
+ pop bc
+ ld a, [wLoadedCard2HP]
+ ld [wCurMoveDamage], a
+ ld e, c
+ push bc
+ call GetCardDamage
+ pop bc
+ ld e, a
+ ld a, [wCurMoveDamage]
+ cp e
+ jr c, .set_carry
+ jr z, .set_carry
+.next
+ inc c
+ ld a, c
+ cp b
+ jr nz, .loop
+
+ call SwapTurn
+ pop af
+ ldh [hTempPlayAreaLocation_ff9d], a
+ or a
+ ret
+.set_carry
+ call SwapTurn
+ pop af
+ ldh [hTempPlayAreaLocation_ff9d], a
+ ld a, c
+ scf
+ ret
+; 0x170c9
; returns carry if the following conditions are met:
; - arena card HP >= half max HP