From dfabb00475cd08b9374492cc75fd24f64599f027 Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Mon, 9 Sep 2024 15:31:48 +0700 Subject: [PATCH] Implement Opal Shard payment --- maps/RuinsOfAlphResearchCenter.asm | 33 +++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/maps/RuinsOfAlphResearchCenter.asm b/maps/RuinsOfAlphResearchCenter.asm index 35bd5baac..9483463ad 100644 --- a/maps/RuinsOfAlphResearchCenter.asm +++ b/maps/RuinsOfAlphResearchCenter.asm @@ -467,6 +467,7 @@ RuinsOfAlphResearchCenterTutotScientistScript: callasm .LoadMovesMenu ; closewindow ; doesn't work for some reason… it leaves the textbox border hanging writetext RuinsOfAlphResearchCenterTutorMoveText + ifequal 2, .NotEnough iffalse .CloseTutor special MoveTutor2 iffalse .TeachMove @@ -492,12 +493,17 @@ RuinsOfAlphResearchCenterTutotScientistScript: ld a, [wMenuSelection] cp -1 ; CANCEL jr z, .cancel_selection - ld a, [wMenuSelectionQuantity] +; selection confirmed + assert wMenuSelectionQuantity == wMenuSelection + 1 + ld hl, wMenuSelection + ld a, [hli] + ld [wNamedObjectIndex], a + ld a, [hl] + ld [wRuinsMoveTutorScratch], a ; not used for menus anymore at this point ld b, a call .GetAmountOfOpalShards cp b - jr c, .cancel_selection ; not enough shards! - ld [wNamedObjectIndex], a + jr c, .not_enough_shards ld a, TRUE ld [wScriptVar], a ret @@ -505,6 +511,10 @@ RuinsOfAlphResearchCenterTutotScientistScript: ld a, FALSE ld [wScriptVar], a ret +.not_enough_shards: + ld a, 2 + ld [wScriptVar], a + ret .MovesMenu: db MENU_BACKUP_TILES @@ -617,7 +627,7 @@ RuinsOfAlphResearchCenterTutotScientistScript: ret .GetAmountOfOpalShards: -; returns: [wMenuSelectionQuantity] = qty. of opal shards +; returns: a = qty. of opal shards ld hl, wItems ; pocket of OPAL_SHARD, see attributes.asm ld c, MAX_ITEMS ; search bound .keep_looking @@ -639,7 +649,6 @@ RuinsOfAlphResearchCenterTutotScientistScript: ld [wMenuSelectionQuantity], a ret - .FullMoveList: db 20 ; list length ; list items @@ -680,12 +689,26 @@ RuinsOfAlphResearchCenterTutotScientistScript: .TeachMove: closetext + callasm .PayTutorInShards opentext writetext RuinsOfAlphResearchCenterTutorExcellentTheseShardsText waitbutton closetext end +.PayTutorInShards: +; this is a variable `takeitem`, and idk what the script equivalent of this +; is soooo... + ld a, OPAL_SHARD + ld [wCurItem], a + ld a, [wRuinsMoveTutorScratch] ; should have been set back in .LoadMovesMenu + ld [wItemQuantityChange], a + ld a, -1 + ld [wCurItemQuantity], a + ld hl, wNumItems + call TossItem + ret + RuinsOfAlphResearchCenterPhoto: ; unreferenced jumptext RuinsOfAlphResearchCenterProfSilktreePhotoText