~chiefnoah/spellbook

72b5dc39df706f2d04b121a4dd49585339b1286e — Noah Pederson 1 year, 3 months ago 3a869a3 master
stuff
4 files changed, 23 insertions(+), 10 deletions(-)

M awakened.fs
M grimoire.fs
M magic.fs
M test-magic.fs
M awakened.fs => awakened.fs +3 -3
@@ 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 !

M grimoire.fs => grimoire.fs +0 -1
@@ 1,5 1,4 @@
require death.fs
require awakened.fs

\ ...
\ noah casts decay with 3 reaches paradox? with-mage-tool 1 mana-contain

M magic.fs => magic.fs +18 -6
@@ 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 ;

M test-magic.fs => test-magic.fs +2 -0
@@ 1,5 1,7 @@
require magic.fs

: test-roll-10again 10 roll-10again ;

test-roll-10again ." Successes: " .

bye