# How do I find the outcomes of Ironsworn rolls in Anydice?

Ironsworn generally has two kinds of dice rolls in play: action rolls and progress rolls.

Progress rolls are static, and use the number of progress boxes you've filled in through play (ranging from 0 to 10), comparing that 'progress score' to two challenge dice, each of which is a d10. The challenge dice win ties. For each challenge die that your progress score fails to beat, you suffer one outcome level worse (from Strong Hit to Weak Hit with one challenge die, and from Weak Hit to Miss if a second challenge die proves to be insurmountable.)

Action rolls are a bit more involved; instead of using your progress score, you roll a d6 action die and add a stat you have (usually 1 or higher). The resulting action score doesn't ever exceed 10. The action score is compared to the challenge dice much like with a progress roll, with challenge dice beating ties and the quality of the outcome being reduced from a Strong Hit to a Weak Hit and then a Miss.
The action roll is also complicated by momentum, a metric running from -6 to +10 that can work against the challenge dice or against the action die.

• If momentum is negative (-1 to -6), then exact matches of the action die (the face of the die itself) are cancelled out, as if that particular face of the die read 0 instead.
• If momentum is positive (2* to 10), then it can be used to cancel any challenge dice lower than the momentum score; they don't count against your outcome, even if they beat your action score. (* Because a challenge die can't get cancelled by a momentum score that matches it exactly, momentum scores of 0 and 1 have no meaningful consequence.)

I can't wrap my head around the script needed to instruct Anydice to tell me the odds that any given roll (for an input progress score, and for an input action roll bonus and momentum score) is going to be a Strong Hit, Weak Hit, or Miss.

Which functions of Anydice do I need to get a grasp on to put action rolls together?

• Note for Anydice experts unfamiliar with Ironsworn: there's a 1-page rules reference document on the linked website that'll clarify anything that's confusing from the text of the question (you can also read the whole core book for free). Feb 12 '20 at 6:50

I've written the following anydice program which should calculate this mechanic. For the purposes of interpreting the results, 0 means a miss, 1 is a weak hit, and 2 is a strong hit.

The progress roll is pretty easy:

function: progress CROLL:s PROG:n {
result: PROG > CROLL
}

output [progress 2d10 5] named "Progress 5"


Essentially, all a progress roll does is compare a target number to a pair of d10. We can do this using a function which casts a 2d10 roll to a sequence (that's what the :s part of the function definition does, and it essentially makes anydice invoke the function once for every possible combination of 2d10) and then just use a direct comparison > with the progress number. When comparing a flat number to a sequence, anydice compares the flat number to each value in the sequence in turn and counts the results; thus, if the progress number beats both d10, the result is 2, a strong hit. If it only beats 1, the result is 1 (a weak hit), and if it beats neither, the result is 0 (a miss).

We can model the action roll with a function too, though it takes more parameters as there are more variables we need to keep track of.

function: action AROLL:n AMOD:n CROLL:s MOM:n {
if MOM < 0 & AROLL = [absolute MOM] {AROLL: 0}
result: [highest of [lowest of (AROLL + AMOD) and 10] and MOM] > CROLL
}

loop X over {-6..10} {
output [action 1d6 2 2d10 X] named "Action 1d6+2 Momentum [X]"
}


Here, AROLL is the 1d6 roll, AMOD is whatever modifiers we would apply to the 1d6 roll, CROLL is the 2d10 challenge dice, and MOM is our momentum value. We need AROLL and AMOD to be separate since this mechanic requires us to be able to inspect and manipulate the actual value of the die, not just the final total, and we cast AROLL to a number :n to fix it in value for each invocation of the function (like casting to a sequence, the function will be invoked once for each possible value of AROLL and the results aggregated).

If MOM is less than 0, we compare AROLL to the absolute value of MOM, and if there is a match, we cancel the action die by setting the value to 0. Then, we compare the challenge dice CROLL to either our total action roll (capped at a maximum of 10 by the lowest of function) or our momentum MOM, whichever is best - this function assumes you will always burn momentum if that gets you a better result. As with the progress roll, this is comparing a sequence to a flat number and we get the same outcomes as a result: 0, 1, or 2, depending on how many challenge dice we beat.

The loop defined in the program here iterates over the possible momentum values to quickly show us how that influences the outcome. Here's the table of results created by this example program:

As we can see, the more negative the momentum becomes the worse the result gets, but positive momentum doesn't make a difference until the momentum value exceeds the minimum action roll result. Hopefully, it should be obvious how to modify this program to compare results with different roll modifiers and progress/momentum values.

• FWIW, here's an optimized version of your program that should run about 20 to 100 times faster (due to eliminating the iteration over the 55 possible values of the CROLL parameter). Of course, for this particular exercise, your code is already plenty fast enough. Feb 22 '20 at 17:35