# How to simulate d616 on Anydice?

In Marvel Multiverse Role-Playing Game, the players roll d616. It means that they roll 3d6, but:

• One die has a different color, its 1 counts as a 6 and it's called the Marvel die, which would mean 1d{6,2,3,4,5,6};
• The other two dice are normal d6s, which means they total 2d6;
• I believe a normal roll would be 1d{6,2,3,4,5,6} + 2d6;

output 1d{6,2,3,4,5,6} + 2d6

The complicated part is when you add Edges and Troubles:

• If you add an Edge, you reroll the lowest die and keep the highest result for that die between the roll and the reroll;
• If you add a Trouble, you reroll the highest die and keep the lowest result for that die between the roll and the reroll;
• When you reroll because of an Edge or a Trouble, it doesn't matter which die it is, it can be the Marvel die (d{6,2,3,4,5,6}) or any of the other two d6s;
• Your Edges and Troubles are cumulative (e.g., you can roll with 2 Edges or 3 Troubles);
• An Edge eliminates a Trouble (i.e., you cannot roll with Edges and Troubles at the same time, 2 Edges and 3 Troubles becomes 1 Trouble);

I've been trying to create a function where I can inform in a parameter if the roll gets Edges (1,2,3,...), Troubles (-1,-2,-3,...), or no modifier (0), and it gives me the probabilities for each result since last Friday, but I simply can't.

Can anyone help me get there?

EDITED FOR MORE CLARITY:

Edges and Troubles have priorities:

• For Edges: If you have 2 lowest numbers, you reroll the Marvel Die (the most advantageous to reroll and get a higher number). If you rolled 3, 3, and 6, and one of the 3s is the Marvel Die, you reroll it to try and replace it with a higher number;
• For Troubles: If you have 2 highest numbers, you reroll one of the normal dice (the lest advantageous to reroll and get a lower number). If you rolled 3, 3, and 6, and one of the 3s is the Marvel Die, you reroll the normal one to prevent the Marvel Die from getting lower that it already is;

Stacked Edges and Troubles work one at a time:

• If you rolled 1, 3, and 6 and had two Edges, your first Edge would reroll the 1. Imagine you rerolled the 1 and got a 2, then you would have the sequence 2, 3, and 6. your second edge would reroll the 2.
• If you rolled 1, 3, and 6 and had two Troubles, your first Trouble would reroll the 6. If you rerolled the 6 and got 2, you would then have 1, 2, and 3. Your second Trouble would reroll the 3.

Stacked Edged and Troubles with priorities:

• If you rolled 1, 3, and 6 and had two Edges, your first Edge would reroll the 1. Imagine you rerolled the 1 and got a 3, then you would have the sequence 3, 3, and 6. If one of the 3s if the Marvel Die, you reroll it.
• If you rolled 1, 3, and 6 and had two Troubles, your first Trouble would reroll the 6. If you rerolled the 6 and got 3, you would then have 1, 3, and 3. If one of the 3s is your Marvel Die, your second Trouble would reroll the 3 from the normal die.
• Welcome to RPG Stack Exchange! Can you elaborate on how this system behaves when there are multiple Edges or Troubles? e.g. when there are 2 Troubles and no Edges, do you reroll the highest 2 dice? Reroll the highest die twice? Something else? Feb 27 at 2:31
• I edited the post. I failed to explain some details that happen around a table regarding Edges and Troubles. Feb 27 at 5:04

DMARVEL: d{7, 2, 3, 4, 5, 6}

function: normal A:n marvel B:n normal C:n edge E:n {
if E = 0 | (A = 6 & B = 7 & C = 6) {
result: A + B + C - (B = 7)
}
L: [lowest of A and C]
H: [highest of A and C]
if E > 0 {
if B <= L {
result: [normal L marvel [highest of B and DMARVEL] normal H edge E-1]
} else {
result: [normal [highest of L and d6] marvel B normal H edge E-1]
}
} else {
if B > H {
result: [normal L marvel [lowest of B and DMARVEL] normal H edge E+1]
} else {
result: [normal L marvel B normal [lowest of H and d6] edge E+1]
}
}
}

output [normal d6 marvel DMARVEL normal d6 edge 1]


### Fantastic rolls

Note that we temporarily assign the M result a value of 7 in order to distinguish it from a 6. This is needed to distinguish Ultimate Fantastic rolls of 6M6 which bypass any Trouble, and to prioritize rerolling M over a normal 6 when in Trouble. This also allows us to determine Fantastic rolls in the hundreds digit by replacing the base case

result: A + B + C - (B = 7)


with

result: A + B + C + (B = 7) * 99


though note that the reroll strategy strictly prioritizes the total over trying to get a Fantastic roll.

• That's amazing! I'm still trying to decipher the code because my AnyDice skill are really limited, but I'm really grateful for what you've posted here. It really helps me know the impact of Edges and Troubles in game and, with that, I am able to determine how often it makes sense apply them. It also informs me how punitive/beneficial stacking those modifiers can be. Thank you! <3 Mar 12 at 13:42