summaryrefslogtreecommitdiff
path: root/engine/battle/moveEffects/transform_effect.asm
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2015-04-01 16:51:04 +0200
committerxCrystal <rgr.crystal@gmail.com>2015-04-01 17:05:50 +0200
commit2fe782b11a039b52fd236da28fb2f1ae10cae7db (patch)
tree580cc7bf8b0ebd617fd0ba0440618d38c355aa83 /engine/battle/moveEffects/transform_effect.asm
parent77d0e5ff84cc61ae625da19f184094241eddd4dc (diff)
Rename battle files and split move effects Part 4
e.asm, e_2. asm, and 14.asm
Diffstat (limited to 'engine/battle/moveEffects/transform_effect.asm')
-rw-r--r--engine/battle/moveEffects/transform_effect.asm138
1 files changed, 138 insertions, 0 deletions
diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm
new file mode 100644
index 00000000..6e25712a
--- /dev/null
+++ b/engine/battle/moveEffects/transform_effect.asm
@@ -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 "@"