2015-04-01 14:51:04 +00:00
|
|
|
TransformEffect_: ; 3bab1 (e:7ab1)
|
|
|
|
ld hl, wBattleMonSpecies
|
|
|
|
ld de, wEnemyMonSpecies
|
|
|
|
ld bc, W_ENEMYBATTSTATUS3
|
|
|
|
ld a, [W_ENEMYBATTSTATUS1]
|
|
|
|
ld a, [H_WHOSETURN]
|
|
|
|
and a
|
2015-04-08 10:15:08 +00:00
|
|
|
jr nz, .hitTest
|
2015-04-01 14:51:04 +00:00
|
|
|
ld hl, wEnemyMonSpecies
|
|
|
|
ld de, wBattleMonSpecies
|
|
|
|
ld bc, W_PLAYERBATTSTATUS3
|
|
|
|
ld [wPlayerMoveListIndex], a
|
|
|
|
ld a, [W_PLAYERBATTSTATUS1]
|
2015-04-08 10:15:08 +00:00
|
|
|
.hitTest
|
2015-04-01 14:51:04 +00:00
|
|
|
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
|
2015-04-08 10:15:08 +00:00
|
|
|
jr z, .transformEffect
|
2015-04-01 14:51:04 +00:00
|
|
|
ld hl, W_ENEMYBATTSTATUS2
|
2015-04-08 10:15:08 +00:00
|
|
|
.transformEffect
|
|
|
|
; animation(s) played are different if target has Substitute up
|
2015-06-11 22:41:33 +00:00
|
|
|
bit HasSubstituteUp, [hl]
|
2015-04-01 14:51:04 +00:00
|
|
|
push af
|
2015-07-12 22:51:04 +00:00
|
|
|
ld hl, HideSubstituteShowMonAnim
|
|
|
|
ld b, BANK(HideSubstituteShowMonAnim)
|
2015-04-01 14:51:04 +00:00
|
|
|
call nz, Bankswitch
|
|
|
|
ld a, [W_OPTIONS]
|
|
|
|
add a
|
|
|
|
ld hl, PlayCurrentMoveAnimation
|
|
|
|
ld b, BANK(PlayCurrentMoveAnimation)
|
2015-04-08 10:15:08 +00:00
|
|
|
jr nc, .gotAnimToPlay
|
2015-04-01 14:51:04 +00:00
|
|
|
ld hl, AnimationTransformMon
|
|
|
|
ld b, BANK(AnimationTransformMon)
|
2015-04-08 10:15:08 +00:00
|
|
|
.gotAnimToPlay
|
2015-04-01 14:51:04 +00:00
|
|
|
call Bankswitch
|
2015-07-12 22:51:04 +00:00
|
|
|
ld hl, ReshowSubstituteAnim
|
|
|
|
ld b, BANK(ReshowSubstituteAnim)
|
2015-04-01 14:51:04 +00:00
|
|
|
pop af
|
|
|
|
call nz, Bankswitch
|
|
|
|
pop bc
|
|
|
|
ld a, [bc]
|
2015-04-08 10:15:08 +00:00
|
|
|
set Transformed, a ; mon is now Transformed
|
2015-04-01 14:51:04 +00:00
|
|
|
ld [bc], a
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
push hl
|
2015-06-11 22:41:33 +00:00
|
|
|
; transform user into opposing Pokemon
|
2015-04-08 10:15:08 +00:00
|
|
|
; species
|
2015-06-11 22:41:33 +00:00
|
|
|
ld a, [hl]
|
2015-04-01 14:51:04 +00:00
|
|
|
ld [de], a
|
2015-06-11 22:41:33 +00:00
|
|
|
; type 1, type 2, catch rate, and moves
|
2015-04-01 14:51:04 +00:00
|
|
|
ld bc, $5
|
2015-06-11 22:41:33 +00:00
|
|
|
add hl, bc
|
2015-04-01 14:51:04 +00:00
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
inc bc
|
|
|
|
inc bc
|
|
|
|
call CopyData
|
|
|
|
ld a, [H_WHOSETURN]
|
|
|
|
and a
|
2015-04-08 10:15:08 +00:00
|
|
|
jr z, .next
|
|
|
|
; save enemy mon DVs in wcceb/wccec (enemy turn only)
|
2015-04-01 14:51:04 +00:00
|
|
|
ld a, [de]
|
|
|
|
ld [wcceb], a
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
ld [wccec], a
|
|
|
|
dec de
|
2015-04-08 10:15:08 +00:00
|
|
|
.next
|
|
|
|
; DVs
|
2015-04-01 14:51:04 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-06-11 22:41:33 +00:00
|
|
|
; Attack, Defense, Speed, and Special stats
|
2015-04-01 14:51:04 +00:00
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
ld bc, $8
|
|
|
|
call CopyData
|
2015-06-11 22:41:33 +00:00
|
|
|
ld bc, wBattleMonMoves - wBattleMonPP
|
2015-04-08 10:15:08 +00:00
|
|
|
add hl, bc ; ld hl, wBattleMonMoves
|
|
|
|
ld b, NUM_MOVES
|
|
|
|
.copyPPLoop
|
|
|
|
; 5 PP for all moves
|
2015-04-01 14:51:04 +00:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
2015-04-08 10:15:08 +00:00
|
|
|
jr z, .lessThanFourMoves
|
2015-04-01 14:51:04 +00:00
|
|
|
ld a, $5
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec b
|
2015-04-08 10:15:08 +00:00
|
|
|
jr nz, .copyPPLoop
|
|
|
|
jr .copyStats
|
|
|
|
.lessThanFourMoves
|
|
|
|
; 0 PP for blank moves
|
2015-04-01 14:51:04 +00:00
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec b
|
2015-04-08 10:15:08 +00:00
|
|
|
jr nz, .lessThanFourMoves
|
|
|
|
.copyStats
|
|
|
|
; original (unmodified) stats and stat mods
|
2015-04-01 14:51:04 +00:00
|
|
|
pop hl
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wd11e], a
|
|
|
|
call GetMonName
|
|
|
|
ld hl, wEnemyMonUnmodifiedAttack
|
|
|
|
ld de, wPlayerMonUnmodifiedAttack
|
2015-04-08 10:15:08 +00:00
|
|
|
call .copyBasedOnTurn ; original (unmodified) stats
|
2015-04-01 14:51:04 +00:00
|
|
|
ld hl, wEnemyMonStatMods
|
|
|
|
ld de, wPlayerMonStatMods
|
2015-04-08 10:15:08 +00:00
|
|
|
call .copyBasedOnTurn ; stat mods
|
2015-04-01 14:51:04 +00:00
|
|
|
ld hl, TransformedText
|
|
|
|
jp PrintText
|
|
|
|
|
|
|
|
.copyBasedOnTurn
|
|
|
|
ld a, [H_WHOSETURN]
|
|
|
|
and a
|
2015-04-08 10:15:08 +00:00
|
|
|
jr z, .gotStatsOrModsToCopy
|
2015-04-01 14:51:04 +00:00
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
pop de
|
2015-04-08 10:15:08 +00:00
|
|
|
.gotStatsOrModsToCopy
|
2015-04-01 14:51:04 +00:00
|
|
|
ld bc, $8
|
|
|
|
jp CopyData
|
|
|
|
|
|
|
|
.failed
|
|
|
|
ld hl, PrintButItFailedText_
|
|
|
|
jp BankswitchEtoF
|
|
|
|
|
|
|
|
TransformedText: ; 3bb92 (e:7b92)
|
|
|
|
TX_FAR _TransformedText
|
|
|
|
db "@"
|