@@ 1,6 1,7 @@
-\ vocabulary magic also magic definitions
+require random.fs
-struct cell% field intelligence-dots
+struct
+ cell% field intelligence-dots
cell% field wits-dots
cell% field resolve-dots
end-struct mental-attributes
@@ 38,30 39,58 @@ end-struct mage-struct
\G Defines constant unique identifiers for the 10 arcanum.
\G These are specifically the offsets into the mage struct
\G but should be set when defining a spell with `spell`.
-0 death-dots constant death
-0 fate-dots constant fate
-0 forces-dots constant forces
-0 life-dots constant life
-0 matter-dots constant matter
-0 mind-dots constant mind
-0 prime-dots constant prime
-0 space-dots constant space
-0 spirit-dots constant spirit
-0 time-dots constant time
+0 death-dots constant death-arcanum
+0 fate-dots constant fate-arcanum
+0 forces-dots constant forces-arcanum
+0 life-dots constant life-arcanum
+0 matter-dots constant matter-arcanum
+0 mind-dots constant mind-arcanum
+0 prime-dots constant prime-arcanum
+0 space-dots constant space-arcanum
+0 spirit-dots constant spirit-arcanum
+0 time-dots constant time-arcanum
: mage \G Creates a named mage with uninitialized data
create mage-struct mage-struct %allot ;
-: spell \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)
- create 2, ;
+\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,
+ does> ( -- arcanum dots )
+ dup @ swap cell+ @ ;
-: spell-arcanum ( a -- w )
- cell + @ ;
+\G The paradox already present in a scene
+0 value scene-paradox
-\ example spell
-death 2 spell decay
+\G Resets the scene-paradox to zero
+: reset-scene 0 to scene-paradox ;
-\ previous
+
+: 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
+
+;
+
+\ spell-difficulty is the difference of (mage dots in arcanum) and (spell arcanum dots)
+: calculate-paradox ( reaches free-reach mage-gnosis -- w )
+ \ calculate the special paradox dice pool
+ 2 /mod + -rot - * ;
+
+: with-dedicated-tool ( w -- w ) 2 - ;
+\ Death Spells
+
+
+\G Rolls n dice, calculating successes (8+) and re-rolling 10s
+: roll-10again ( n -- w ) 0 do random ;
+
+\G Decay: age an object, lowering durability
+\G +1 Reach: Decrease structure instead
+\G Source: MtAw2 p129
+death-arcanum 2 spell deckkay