pokecrystal-board/engine/battle/move_effects/attract.asm

77 lines
1.2 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
BattleCommand_Attract:
2015-11-06 19:36:06 -08:00
; attract
2018-01-23 14:39:09 -08:00
ld a, [wAttackMissed]
2015-11-06 19:36:06 -08:00
and a
jr nz, .failed
call CheckOppositeGender
jr c, .failed
call CheckHiddenOpponent
jr nz, .failed
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVarAddr
bit SUBSTATUS_IN_LOVE, [hl]
jr nz, .failed
set SUBSTATUS_IN_LOVE, [hl]
call AnimateCurrentMove
; 'fell in love!'
ld hl, FellInLoveText
2019-04-08 05:15:10 -07:00
jp StdBattleTextbox
2015-11-06 19:36:06 -08:00
.failed
jp FailMove
2015-11-06 19:36:06 -08:00
2018-06-24 07:09:41 -07:00
CheckOppositeGender:
2015-11-06 19:36:06 -08:00
ld a, MON_SPECIES
call BattlePartyAttr
ld a, [hl]
2018-01-23 14:39:09 -08:00
ld [wCurPartySpecies], a
2015-11-06 19:36:06 -08:00
2018-01-23 14:39:09 -08:00
ld a, [wCurBattleMon]
ld [wCurPartyMon], a
2015-11-06 19:36:06 -08:00
xor a
2018-01-23 14:39:09 -08:00
ld [wMonType], a
2015-11-06 19:36:06 -08:00
2017-12-24 09:47:30 -08:00
farcall GetGender
2015-11-06 19:36:06 -08:00
jr c, .genderless_samegender
ld b, 1
jr nz, .got_gender
dec b
.got_gender
push bc
2018-01-23 14:39:09 -08:00
ld a, [wTempEnemyMonSpecies]
ld [wCurPartySpecies], a
ld hl, wEnemyMonDVs
ld a, [wEnemySubStatus5]
2015-11-06 19:36:06 -08:00
bit SUBSTATUS_TRANSFORMED, a
jr z, .not_transformed
ld hl, wEnemyBackupDVs
.not_transformed
ld a, [hli]
2018-01-23 14:39:09 -08:00
ld [wTempMonDVs], a
2015-11-06 19:36:06 -08:00
ld a, [hl]
2018-01-23 14:39:09 -08:00
ld [wTempMonDVs + 1], a
2015-11-06 19:36:06 -08:00
ld a, 3
2018-01-23 14:39:09 -08:00
ld [wMonType], a
2017-12-24 09:47:30 -08:00
farcall GetGender
2015-11-06 19:36:06 -08:00
pop bc
jr c, .genderless_samegender
ld a, 1
jr nz, .got_enemy_gender
dec a
.got_enemy_gender
xor b
jr z, .genderless_samegender
and a
ret
.genderless_samegender
scf
ret