A awakened.fs => awakened.fs +6 -0
@@ 0,0 1,6 @@
+require magic.fs
+
+\ drop because we get the evaluation semantics of this here too for some reason
+mage noah drop
+5 noah death-dots !
+5 noah gnosis-dots !
A death.fs => death.fs +9 -0
@@ 0,0 1,9 @@
+require magic.fs
+
+
+\ Two Dot Spells
+
+\G Decay: age an object, lowering durability
+\G +1 Reach: Decrease structure instead
+\G Source: MtAw2 p129
+death-arcanum 2 spell decay
A grimoire.fs => grimoire.fs +4 -0
@@ 0,0 1,4 @@
+require death.fs
+require awakened.fs
+
+\ ...
M magic.fs => magic.fs +23 -30
@@ 1,6 1,6 @@
require random.fs
-struct
+struct
cell% field intelligence-dots
cell% field wits-dots
cell% field resolve-dots
@@ 52,13 52,13 @@ end-struct mage-struct
: mage \G Creates a named mage with uninitialized data
- create mage-struct mage-struct %allot ;
+ create mage-struct %allot does> ;
\G Creates a named spell with ( arcanum dots -- )
\G where arcanum is the offset into a `mage-struct`
\G (ie. the value of 0 <arcanum>-dots)
: spell ( arcanum dots -- )
- create 2,
+ create 2,
does> ( -- arcanum dots )
dup @ swap cell+ @ ;
@@ 68,25 68,10 @@ end-struct mage-struct
\G Resets the scene-paradox to zero
: reset-scene 0 to scene-paradox ;
-
-: cast-spell ( spell-arcanum spell-dots mage-a reaches -- )
- \ fetch the mages dots in that spell arcanum
- 2>r >r over r@ + @ swap ( spell-arcanum mage-dots-in-spell-arcanum spell-dots -- )
- \ validate that the mage has at least as many dots in the respective arcanum
- 2dup < abort" Mage cannot case spell. Not enough dots in arcanum"
- \ TODO calculate overreaches
-
-;
-
-: calculate-free-reach ( mage ) ;
-
\ spell-difficulty is the difference of <mage dots in arcanum> and <spell arcanum dots>
-: calculate-paradox ( reaches free-reach mage-gnosis -- w )
+: mage-paradox-scale ( mage-gnosis -- w )
\ calculate the special paradox dice pool
- 2 /mod + -rot - * ;
-
-: with-dedicated-tool ( w -- w ) 2 - ;
-\ Death Spells
+ 2 /mod + ;
: roll-dice ( -- w ) 10 random 1+ ;
@@ 99,17 84,21 @@ end-struct mage-struct
: free-reach ( mage spell-dots spell-arcanum -- mage free-reach )
rot dup rot + @ swap -rot swap - 1+ ;
-\G Rolls n dice, calculating successes (8+) and re-rolling 10s
-: roll-10again ( n -- w )
- 0
+\G Rolls n dice, calculating successes 8+ and re-rolling 10s
+: roll-10again ( dice-pool -- successes )
+ 0 cr
begin
- roll-dice ( #dice successes roll ) ." roll: " dup . cr
+ roll-dice ( #dice successes roll )
+ \ ." roll: " dup . cr
\ reuse 8-again to check for successes, as it's the same check
dup 8-again
rot + swap
10-again rot +
1- dup -rot 0=
- until swap drop ;
+ until swap drop ( and roll ) ;
+
+: roll-chance-die ( -- f )
+ roll-dice 10-again ;
\G Decay: age an object, lowering durability
\G +1 Reach: Decrease structure instead
@@ 120,10 109,14 @@ death-arcanum 2 spell decay
: casts ;
: with ;
-: reaches ( mage spell-dots spell-arcanum w -- mage overreaches )
- >r free-reach - r> swap ;
+: with-mage-tool ( paradox-die -- paradox-die )
+ dup 0 > if 0 swap 2 - max then ;
+
+: mana-contain ( paradox-die mana -- paradox-die )
+ swap dup 0 > if swap - 0 max then ;
-mage noah
-5 noah death-dots !
+: reaches ( mage spell-dots spell-arcanum w -- mage overreaches )
+ >r free-reach r> swap - ;
-\ noah casts decay with 3 reaches
+: paradox? ( mage overreaches -- paradox-die )
+ swap gnosis-dots @ mage-paradox-scale * ;