function: push ROLL:s {
H:0 \number of hits\
C:0 \number of crits\
loop X over {1..#ROLL} {
if X@ROLL>4 {H:H+1 if X@ROLL=6 {C:C+1}}
}
result: C*10+H \to send both crit and hit numbers?\
}
function: make ROLL:s TBP:n {
H:0 \number of hits\
M:0 \number of mishaps\
B:0 \number of blanks\
C:0 \number of crits\
loop X over {1..#ROLL} {
if X@ROLL>4 {H:H+1 if X@ROLL=6 {C:C+1}}
else if X@ROLL>1 {B:B+1}
else if X@ROLL=1 {M:M+1}
}
if TBP=1 {
T:[push Bd6]
C:C+(T/10)
H:H+(T-((T/10)*10))
}
if H>2 {H:2}
if C>1 {result:3}
else {result:H}
}
Any help would be appreciated. I feel like there is a better way but I can't see it apparently.
EDIT::
function: make ROLL:s TBP:n HT:n BL:n CR:n {
H:HT\H number of hits\
B:BL\B number of blanks\
C:CR\C number of crits\
loop X over {1..#ROLL} {
if X@ROLL>4 {H:H+1 if X@ROLL=6 {C:C+1}}
else if X@ROLL>1 {B:B+1}
}
if H=HT {H:H-1 if C>1 {C:C-1}}
if H2 {if C>1 {H:3} else {H:2}}
if H>0 & TBP=1 {result:[make Bd6 0 H B C]}
else {result:H}
}
loop C over {1..6} {
output [make Cd6 1 0 0 0] named "[C]d"
}
I've tried this and it's been compiled at least, but not sure if I can confirm it mathematically. And still is there a better way?