From 72b5dc39df706f2d04b121a4dd49585339b1286e Mon Sep 17 00:00:00 2001 From: Noah Pederson Date: Sun, 3 Sep 2023 12:37:28 -0500 Subject: [PATCH] stuff --- awakened.fs | 6 +++--- grimoire.fs | 1 - magic.fs | 24 ++++++++++++++++++------ test-magic.fs | 2 ++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/awakened.fs b/awakened.fs index e29dadd..bc2de8c 100644 --- a/awakened.fs +++ b/awakened.fs @@ -1,7 +1,7 @@ require magic.fs \ drop because we get the evaluation semantics of this here too for some reason -mage balaam drop +mage balaam \ Gnosis 6 balaam gnosis-dots ! \ Arcanum @@ -18,11 +18,11 @@ mage balaam drop \ Attributes \ Mental 3 balaam mental-dots intelligence-dots ! -3 balaam mental-dots wits-dost ! +3 balaam mental-dots wits-dots ! 2 balaam mental-dots resolve-dots ! \ Physical 2 balaam physical-dots strength-dots ! -3 balaam physical-dots dexterity-dots-dots ! +3 balaam physical-dots dexterity-dots ! 2 balaam physical-dots stamina-dots ! \ Social 1 balaam social-dots presence-dots ! diff --git a/grimoire.fs b/grimoire.fs index 9e5dbd9..3c29abe 100644 --- a/grimoire.fs +++ b/grimoire.fs @@ -1,5 +1,4 @@ require death.fs require awakened.fs -\ ... \ noah casts decay with 3 reaches paradox? with-mage-tool 1 mana-contain diff --git a/magic.fs b/magic.fs index e4fe237..41985bb 100644 --- a/magic.fs +++ b/magic.fs @@ -52,9 +52,11 @@ end-struct mage-struct 0 spirit-dots constant spirit-arcanum 0 time-dots constant time-arcanum - -: mage \G Creates a named mage with uninitialized data - create mage-struct %allot does> ; + \G Creates a named mage with uninitialized data. + \G All stats initialize to an undefined state, you *must* + \G set every proprety. +: mage + create mage-struct %allot drop does> ; \G Creates a named spell with ( arcanum dots -- ) \G where arcanum is the offset into a `mage-struct` @@ -129,8 +131,9 @@ end-struct mage-struct \ TODO: finish implementing chance die : roll-chance-die ( -- successes ) roll-d10 10 = if 1 else 0 then ; - -: roll-pool ( dice-pool -- successes ) +\G Rolls n dice and leave the number of successes on the stack. +\G If n is 0, rolls a chance die, yielding a success only if a 10 is rolled +: roll-pool ( n -- successes ) dup 0= if drop roll-chance-die else @@ -139,7 +142,16 @@ end-struct mage-struct \ No op, for flavor : casts ; -: with ; + +\G with checks if the mage is capable of casting the spell +: with ( mage spell-dots spell-arcanum -- mage spell-dots spell-arcanum ) + swap >r ( mage spell-arcanum --; r:spell-dots -- ) + 2dup + @ + r> tuck ( mage spell-arcanum spell-dots mage-dots-in-spell-arcanum spell-dots ) + < if + swap + abort" Mage does not have enough dots in spell arcanum to cast" + then swap ; : with-mage-tool ( paradox-die -- paradox-die ) dup 0 > if 0 swap 2 - max then ; diff --git a/test-magic.fs b/test-magic.fs index dd08f99..0d59d73 100644 --- a/test-magic.fs +++ b/test-magic.fs @@ -1,5 +1,7 @@ require magic.fs : test-roll-10again 10 roll-10again ; + test-roll-10again ." Successes: " . + bye -- 2.45.2