2018-06-24 14:09:41 +00:00
|
|
|
BattleCommand_Transform:
|
2016-01-18 05:39:01 +00:00
|
|
|
; transform
|
|
|
|
|
|
|
|
call ClearLastMove
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
|
|
|
call GetBattleVarAddr
|
|
|
|
bit SUBSTATUS_TRANSFORMED, [hl]
|
|
|
|
jp nz, BattleEffect_ButItFailed
|
|
|
|
call CheckHiddenOpponent
|
|
|
|
jp nz, BattleEffect_ButItFailed
|
|
|
|
xor a
|
|
|
|
ld [wNumHits], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wFXAnimID + 1], a
|
2016-01-18 05:39:01 +00:00
|
|
|
ld a, $1
|
|
|
|
ld [wKickCounter], a
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS4
|
|
|
|
call GetBattleVarAddr
|
|
|
|
bit SUBSTATUS_SUBSTITUTE, [hl]
|
|
|
|
push af
|
|
|
|
jr z, .mimic_substitute
|
|
|
|
call CheckUserIsCharging
|
|
|
|
jr nz, .mimic_substitute
|
|
|
|
ld a, SUBSTITUTE
|
|
|
|
call LoadAnim
|
|
|
|
.mimic_substitute
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5
|
|
|
|
call GetBattleVarAddr
|
|
|
|
set SUBSTATUS_TRANSFORMED, [hl]
|
|
|
|
call ResetActorDisable
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wBattleMonSpecies
|
|
|
|
ld de, wEnemyMonSpecies
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hBattleTurn]
|
2016-01-18 05:39:01 +00:00
|
|
|
and a
|
|
|
|
jr nz, .got_mon_species
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wEnemyMonSpecies
|
|
|
|
ld de, wBattleMonSpecies
|
2016-01-18 05:39:01 +00:00
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurMoveNum], a
|
2016-01-18 05:39:01 +00:00
|
|
|
.got_mon_species
|
|
|
|
push hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
ld bc, NUM_MOVES
|
|
|
|
call CopyBytes
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hBattleTurn]
|
2016-01-18 05:39:01 +00:00
|
|
|
and a
|
|
|
|
jr z, .mimic_enemy_backup
|
|
|
|
ld a, [de]
|
|
|
|
ld [wEnemyBackupDVs], a
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
ld [wEnemyBackupDVs + 1], a
|
|
|
|
dec de
|
|
|
|
.mimic_enemy_backup
|
|
|
|
; copy DVs
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
; move pointer to stats
|
2018-01-23 22:39:09 +00:00
|
|
|
ld bc, wBattleMonStats - wBattleMonPP
|
2016-01-18 05:39:01 +00:00
|
|
|
add hl, bc
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
2018-01-23 22:39:09 +00:00
|
|
|
ld bc, wBattleMonStructEnd - wBattleMonStats
|
2016-01-18 05:39:01 +00:00
|
|
|
call CopyBytes
|
|
|
|
; init the power points
|
2018-01-23 22:39:09 +00:00
|
|
|
ld bc, wBattleMonMoves - wBattleMonStructEnd
|
2016-01-18 05:39:01 +00:00
|
|
|
add hl, bc
|
|
|
|
push de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
2018-01-23 22:39:09 +00:00
|
|
|
ld bc, wBattleMonPP - wBattleMonStructEnd
|
2016-01-18 05:39:01 +00:00
|
|
|
add hl, bc
|
|
|
|
ld b, NUM_MOVES
|
|
|
|
.pp_loop
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
and a
|
|
|
|
jr z, .done_move
|
|
|
|
cp SKETCH
|
|
|
|
ld a, 1
|
|
|
|
jr z, .done_move
|
|
|
|
ld a, 5
|
|
|
|
.done_move
|
|
|
|
ld [hli], a
|
|
|
|
dec b
|
|
|
|
jr nz, .pp_loop
|
|
|
|
pop hl
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wNamedObjectIndexBuffer], a
|
|
|
|
call GetPokemonName
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wEnemyStats
|
|
|
|
ld de, wPlayerStats
|
2016-01-18 05:39:01 +00:00
|
|
|
ld bc, 2 * 5
|
|
|
|
call BattleSideCopy
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wEnemyStatLevels
|
|
|
|
ld de, wPlayerStatLevels
|
2016-01-18 05:39:01 +00:00
|
|
|
ld bc, 8
|
|
|
|
call BattleSideCopy
|
|
|
|
call _CheckBattleScene
|
|
|
|
jr c, .mimic_anims
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hBattleTurn]
|
2016-01-18 05:39:01 +00:00
|
|
|
and a
|
|
|
|
ld a, [wPlayerMinimized]
|
|
|
|
jr z, .got_byte
|
|
|
|
ld a, [wEnemyMinimized]
|
|
|
|
.got_byte
|
|
|
|
and a
|
|
|
|
jr nz, .mimic_anims
|
|
|
|
call LoadMoveAnim
|
|
|
|
jr .after_anim
|
|
|
|
|
|
|
|
.mimic_anims
|
|
|
|
call BattleCommand_MoveDelay
|
|
|
|
call BattleCommand_RaiseSubNoAnim
|
|
|
|
.after_anim
|
|
|
|
xor a
|
|
|
|
ld [wNumHits], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wFXAnimID + 1], a
|
2016-01-18 05:39:01 +00:00
|
|
|
ld a, $2
|
|
|
|
ld [wKickCounter], a
|
|
|
|
pop af
|
|
|
|
ld a, SUBSTITUTE
|
|
|
|
call nz, LoadAnim
|
|
|
|
ld hl, TransformedText
|
|
|
|
jp StdBattleTextBox
|
2018-11-21 13:14:34 +00:00
|
|
|
|
|
|
|
BattleSideCopy:
|
|
|
|
; Copy bc bytes from hl to de if it's the player's turn.
|
|
|
|
; Copy bc bytes from de to hl if it's the enemy's turn.
|
|
|
|
ldh a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .copy
|
|
|
|
|
|
|
|
; Swap hl and de
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
pop de
|
|
|
|
.copy
|
|
|
|
jp CopyBytes
|