@program meritflaw2.muf 1 1000 d i $include $lib/rp $include $lib/alynna $include $muf/rp/utils $include $muf/rp/boxutils $include #2123 $def rpsys "$rpsystem" match : globalmod ( s i i -- i ) var target var cost var cur var merit? var total var haveit var point merit? ! cost ! target ! #1 cur ! 0 haveit ! 0 total ! begin cur @ player? if cur @ merit? @ if "meritpoints" else "flawpoints" then getstatint if total @ 1 + total ! cur @ "Jnote" target @ findboxitem if haveit @ 1 + haveit ! then then then cur @ int 1 + dbref cur ! cur @ dbtop dbcmp until cost @ 5 * 50 swap - point ! haveit @ 100 * total @ / point @ > if haveit @ if haveit @ 100 * total @ / point @ - 100.0 / else -0.2 then 1.5 * 1 merit? @ not if swap - else + then cost @ * cost ! else haveit @ if haveit @ 100 * total @ / point @ - 100.0 / else -0.2 then 0.9 * 1 merit? @ not if swap - else + then cost @ * cost ! then cost @ not if 1 cost ! then cost @ int ; : buyflaw ( s -- ) var target var cost var tempd var note strip Capitalize target ! target @ not if "Type buy flaw (flaw)" .tell exit then rpsys "Flaw/" target @ strcat "/desc" strcat getpropstr tempd ! tempd @ not if "That doesn't appear to be a flaw" .tell exit then rpsys "Flaw/" target @ strcat "/costadj" strcat getpropstr atoi cost ! cost @ not if "There's no cost set, error" .tell exit then "Do you have any additional notes to add to this flaw(like explaining a phobia). Hit space and enter if you have nothing to add." .tell read strip note ! note @ if str tempd @ " {Extra Note:" note @ "}" cat tempd ! then str "You are currently buying the " target @ " flaw" cat .tell str "Desc: " tempd @ cat .tell "ARE YOU SURE YOU WANT THIS?(Y/N)" .tell read "y" instring not if "Aborted" .tell exit then me @ "Flawpoints" getstatint cost @ + dup 20 > if "You can only have 20 points of flaws" .tell pop exit then me @ "Flawpoints" rot setstat me @ "Growth" getstatfloat cost @ + me @ "Growth" rot setstat #21 "@Q" force #21 "+jnote/add" force #21 me @ name force #21 target @ force #21 tempd @ "| Price: " cost @ intostr strcat strcat force #21 "y" force "Done." .tell ; : buyMerit ( s -- ) var target var cost var tempd var note strip Capitalize target ! target @ not if "Type buy Merit (Merit)" .tell exit then rpsys "Merit/" target @ strcat "/desc" strcat getpropstr tempd ! tempd @ not if "That doesn't appear to be a Merit" .tell exit then rpsys "Merit/" target @ strcat "/costadj" strcat getpropstr atoi cost ! cost @ not if "There's no cost set, error" .tell exit then "Do you have any additional notes to add to this Merit(like explaining a phobia). Hit space and enter if you have nothing to add." .tell read strip note ! note @ if str tempd @ " {Extra Note:" note @ "}" cat tempd ! then str "You are currently buying the " target @ " merit" cat .tell str "Desc: " tempd @ cat .tell "ARE YOU SURE YOU WANT THIS?(Y/N)" .tell read "y" instring not if "Aborted" .tell exit then me @ "Meritpoints" getstatint cost @ + dup 20 > if "You can only have 20 points of Merits" .tell pop exit then me @ "Meritpoints" rot setstat me @ "Growth" getstatfloat cost @ - me @ "Growth" rot setstat #21 "@Q" force #21 "+jnote/add" force #21 me @ name force #21 target @ force #21 tempd @ "| Price: " cost @ intostr strcat strcat force #21 "y" force "Done" .tell ; : listmerits ( -- ) var cur "Listing Merits.." .tell "Merit" "" RPutils.nextitem cur ! begin str cur @ 25 left ":" rpsys "Merit/" cur @ strcat "/Costadj" strcat getpropstr 40 right cat .tell cur @ "Merit" swap RPutils.nextitem cur ! cur @ not until str "Done. " me @ "Meritpoints" getstatint 20 swap - intostr " Merit Points remaining" cat .tell ; : listflaws ( -- ) var cur "Listing Flaws.." .tell "Flaw" "" RPutils.nextitem cur ! begin str cur @ 25 left ":" rpsys "Flaw/" cur @ strcat "/Costadj" strcat getpropstr 40 right cat .tell cur @ "Flaw" swap RPutils.nextitem cur ! cur @ not until str "Done. " me @ "Flawpoints" getstatint 20 swap - intostr " Flaw Points remaining" cat .tell ; : mfheart var cur background "DMPQ: Merit heart" log_status "Merit" "" RPutils.nextitem cur ! begin rpsys str "Merit/" cur @ strcat "/Cost" cat getpropstr atoi cur @ swap 1 globalmod intostr rpsys str "Merit/" cur @ strcat "/Costadj" cat rot setprop cur @ "Merit" swap RPutils.nextitem cur ! cur @ not until "DMPQ: Flaw heart" log_status "Flaw" "" RPutils.nextitem cur ! begin rpsys str "Flaw/" cur @ strcat "/Cost" cat getpropstr atoi cur @ swap 1 globalmod intostr rpsys str "Flaw/" cur @ strcat "/Costadj" cat rot setprop cur @ "Flaw" swap RPutils.nextitem cur ! cur @ not until "DMPQ: MFHeart done" log_status ; : main var target command @ "list merits" smatch if background listmerits exit then command @ "list flaws" smatch if background listflaws exit then command @ "buy flaw" smatch if buyflaw exit then command @ "buy merit" smatch if buymerit exit then mfheart ; . c q