pokecrystal/engine/battle/move_effects/attract.asm

77 lines
1.2 KiB
NASM
Raw Normal View History

2018-06-24 14:09:41 +00:00
BattleCommand_Attract:
2015-11-07 03:36:06 +00:00
; attract
2018-01-23 22:39:09 +00:00
ld a, [wAttackMissed]
2015-11-07 03:36:06 +00: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 12:15:10 +00:00
jp StdBattleTextbox
2015-11-07 03:36:06 +00:00
.failed
jp FailMove
2015-11-07 03:36:06 +00:00
2018-06-24 14:09:41 +00:00
CheckOppositeGender:
2015-11-07 03:36:06 +00:00
ld a, MON_SPECIES
call BattlePartyAttr
ld a, [hl]
2018-01-23 22:39:09 +00:00
ld [wCurPartySpecies], a
2015-11-07 03:36:06 +00:00
2018-01-23 22:39:09 +00:00
ld a, [wCurBattleMon]
ld [wCurPartyMon], a
2015-11-07 03:36:06 +00:00
xor a
2018-01-23 22:39:09 +00:00
ld [wMonType], a
2015-11-07 03:36:06 +00:00
2017-12-24 17:47:30 +00:00
farcall GetGender
2015-11-07 03:36:06 +00:00
jr c, .genderless_samegender
ld b, 1
jr nz, .got_gender
dec b
.got_gender
push bc
2018-01-23 22:39:09 +00:00
ld a, [wTempEnemyMonSpecies]
ld [wCurPartySpecies], a
ld hl, wEnemyMonDVs
ld a, [wEnemySubStatus5]
2015-11-07 03:36:06 +00:00
bit SUBSTATUS_TRANSFORMED, a
jr z, .not_transformed
ld hl, wEnemyBackupDVs
.not_transformed
ld a, [hli]
2018-01-23 22:39:09 +00:00
ld [wTempMonDVs], a
2015-11-07 03:36:06 +00:00
ld a, [hl]
2018-01-23 22:39:09 +00:00
ld [wTempMonDVs + 1], a
2015-11-07 03:36:06 +00:00
ld a, 3
2018-01-23 22:39:09 +00:00
ld [wMonType], a
2017-12-24 17:47:30 +00:00
farcall GetGender
2015-11-07 03:36:06 +00: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