~chiefnoah/spellbook

b72de7dda78edd7b54624994bdd0a1d250e9034e — Noah Pederson 1 year, 3 months ago 5dff84e
Implements rolling chance-dice
1 files changed, 8 insertions(+), 9 deletions(-)

M magic.fs
M magic.fs => magic.fs +8 -9
@@ 73,7 73,7 @@ end-struct mage-struct
    \ calculate the special paradox dice pool
    2 /mod + ;

: roll-dice ( -- w ) 10 random 1+ ;
: roll-d10 ( -- w ) 10 random 1+ ;

: 10-again ( w -- w ) 10 = if 1 else 0 then ;



@@ 89,7 89,7 @@ end-struct mage-struct
    1 max
    0 cr
    begin
        roll-dice ( #dice successes roll )
        roll-d10 ( #dice successes roll )
        \ ." roll: " dup . cr
        \ reuse 8-again to check for successes, as it's the same check
        dup 8-again


@@ 102,7 102,7 @@ end-struct mage-struct
: roll-9again ( dice-pool -- successes )
    0 cr
    begin
        roll-dice ( #dice successes roll )
        roll-d10 ( #dice successes roll )
        \ ." roll: " dup . cr
        \ reuse 8-again to check for successes, as it's the same check
        dup 8-again


@@ 115,7 115,7 @@ end-struct mage-struct
: roll-8again ( dice-pool -- successes )
    0 cr
    begin
        roll-dice ( #dice successes roll )
        roll-d10 ( #dice successes roll )
        \ ." roll: " dup . cr
        \ reuse 8-again to check for successes, as it's the same check
        dup 8-again


@@ 125,13 125,12 @@ end-struct mage-struct
    until swap drop ( and roll ) ;

\ TODO: finish implementing chance die
: roll-chance-die ( -- successes ) 
    roll-dice 10 = if 
;
: roll-chance-die ( -- successes )
    roll-d10 10 = if 1 else 0 then ;

: roll-pool ( dice-pool -- successes ) 
: roll-pool ( dice-pool -- successes )
    dup 0= if
        drop 1 roll-chance-die
        drop roll-chance-die
    else
        roll-10again
    then ;