pokecrystal/engine/events/move_deleter.asm

159 lines
2.3 KiB
NASM
Raw Normal View History

MoveDeletion:
ld hl, .IntroText
2015-02-11 21:20:22 +00:00
call PrintText
call YesNoBox
jr c, .declined
ld hl, .AskWhichMonText
2015-02-11 21:20:22 +00:00
call PrintText
2017-12-24 17:47:30 +00:00
farcall SelectMonFromParty
jr c, .declined
2018-01-23 22:39:09 +00:00
ld a, [wCurPartySpecies]
2015-02-11 21:20:22 +00:00
cp EGG
jr z, .egg
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
ld hl, wPartyMon1Moves + 1
ld bc, PARTYMON_STRUCT_LENGTH
2015-02-11 21:20:22 +00:00
call AddNTimes
ld a, [hl]
and a
jr z, .onlyonemove
ld hl, .AskWhichMoveText
2015-02-11 21:20:22 +00:00
call PrintText
call LoadStandardMenuHeader
2017-12-24 17:47:30 +00:00
farcall ChooseMoveToDelete
2015-02-11 21:20:22 +00:00
push af
2015-12-19 01:07:09 +00:00
call ReturnToMapWithSpeechTextbox
2015-02-11 21:20:22 +00:00
pop af
jr c, .declined
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-02-11 21:20:22 +00:00
push af
2018-07-29 20:04:38 +00:00
ld a, [wCurSpecies]
ld [wNamedObjectIndexBuffer], a
2015-02-11 21:20:22 +00:00
call GetMoveName
ld hl, .ConfirmDeleteText
2015-02-11 21:20:22 +00:00
call PrintText
call YesNoBox
pop bc
jr c, .declined
call .DeleteMove
2015-02-11 21:20:22 +00:00
call WaitSFX
ld de, SFX_MOVE_DELETED
call PlaySFX
call WaitSFX
ld hl, .MoveDeletedText
2015-02-11 21:20:22 +00:00
call PrintText
ret
.egg
ld hl, .EggText
2015-02-11 21:20:22 +00:00
call PrintText
ret
.declined
ld hl, .DeclinedDeletionText
2015-02-11 21:20:22 +00:00
call PrintText
ret
.onlyonemove
ld hl, .OnlyOneMoveText
2015-02-11 21:20:22 +00:00
call PrintText
ret
.OnlyOneMoveText:
2015-02-11 21:20:22 +00:00
; That #MON knows only one move.
text_far UnknownText_0x1c5eba
2015-02-11 21:20:22 +00:00
db "@"
.ConfirmDeleteText:
2015-02-11 21:20:22 +00:00
; Oh, make it forget @ ?
text_far UnknownText_0x1c5eda
2015-02-11 21:20:22 +00:00
db "@"
.MoveDeletedText:
2015-02-11 21:20:22 +00:00
; Done! Your #MON forgot the move.
text_far UnknownText_0x1c5ef5
2015-02-11 21:20:22 +00:00
db "@"
.EggText:
2015-02-11 21:20:22 +00:00
; An EGG doesn't know any moves!
text_far UnknownText_0x1c5f17
2015-02-11 21:20:22 +00:00
db "@"
.DeclinedDeletionText:
2015-02-11 21:20:22 +00:00
; No? Come visit me again.
text_far UnknownText_0x1c5f36
2015-02-11 21:20:22 +00:00
db "@"
.AskWhichMoveText:
2015-02-11 21:20:22 +00:00
; Which move should it forget, then?
text_far UnknownText_0x1c5f50
2015-02-11 21:20:22 +00:00
db "@"
.IntroText:
2015-02-11 21:20:22 +00:00
; Um… Oh, yes, I'm the MOVE DELETER. I can make #MON forget moves. Shall I make a #MON forget?
text_far UnknownText_0x1c5f74
2015-02-11 21:20:22 +00:00
db "@"
.AskWhichMonText:
2015-02-11 21:20:22 +00:00
; Which #MON?
text_far UnknownText_0x1c5fd1
2015-02-11 21:20:22 +00:00
db "@"
2018-06-24 14:09:41 +00:00
.DeleteMove:
2015-02-11 21:20:22 +00:00
ld a, b
push bc
dec a
ld c, a
ld b, 0
2018-01-23 22:39:09 +00:00
ld hl, wPartyMon1Moves
2015-02-11 21:20:22 +00:00
add hl, bc
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
ld bc, PARTYMON_STRUCT_LENGTH
2015-02-11 21:20:22 +00:00
call AddNTimes
pop bc
push bc
inc b
.loop
2015-02-11 21:20:22 +00:00
ld a, b
cp NUM_MOVES + 1
jr z, .okay
2015-02-11 21:20:22 +00:00
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
jr .loop
2015-02-11 21:20:22 +00:00
.okay
2015-02-11 21:20:22 +00:00
xor a
ld [hl], a
pop bc
ld a, b
push bc
dec a
ld c, a
ld b, 0
2018-01-23 22:39:09 +00:00
ld hl, wPartyMon1PP
2015-02-11 21:20:22 +00:00
add hl, bc
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
ld bc, PARTYMON_STRUCT_LENGTH
2015-02-11 21:20:22 +00:00
call AddNTimes
pop bc
inc b
.loop2
2015-02-11 21:20:22 +00:00
ld a, b
cp NUM_MOVES + 1
jr z, .done
2015-02-11 21:20:22 +00:00
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
jr .loop2
2015-02-11 21:20:22 +00:00
.done
2015-02-11 21:20:22 +00:00
xor a
ld [hl], a
ret