How can I take advantage of AnyDice with 20th Anniversary rules? I'm new to AnyDice but very interested in using it.
I would like a wrapper function that accepts the following params.
- the number of dice to roll
- the action's difficulty
- optional: a willpower being spent for a success.
- optional: a character having a relevant specialty, allowing for second success on 10's.
If the dice pool is higher than difficulty I'd like and indication for automatic success.
Dice mechanics
- Roll Xd10 against target difficulty, dice equal to or greater than the difficulty are successes.
- Rolling 10's
- are always successes.
- count as 2 successes, if the character has a relevant specialty.
- Rolling 1's
- each 1 negates a success down to failure.
- if there were no successes rolled, the action is botched.
- optional: before rolling you may spend 1 willpower for an additional success.
- you can only spend 1 willpower per turn.
- optional: if Xd10 is greater than the target difficulty you can take the action as an automatic success.
- not usable in stressful situations.
- only counts for 1 success.
- you can roll, or take the automatic success, but not both.
Success results
- 5 Phenomenal
- 4 Exceptional
- 3 Complete
- 2 Moderate
- 1 Marginal
- 0 Failure
- -1: Botch (only possible when no successes are present)
Psuedocode (this is a loose sketch of what I have in mind)
function roll(int POOL, int DIFFICULTY, bool WILLPOWER, bool SPECIALTY, bool AUTO_SUCCESS = true)
{
int _roll = 0;
int SUCCESS = 0;
int FAILURE = 0;
bool BOTCH = false;
if (WILLPOWER) SUCCESS++;
for (int i = 0; i < POOL; i++)
{
_roll = 1d10;
if (_roll >= DIFFICULTY) SUCCESS++;
if (SPECIALTY && _roll == 10) SUCCESS++;
if (_roll == 1) FAILURE++;
}
if (SUCCESS == 0 && FAILURE > 0) BOTCH == true;
if (BOTCH)
output "Botch!\t" + tally(SUCCESS, FAILURE);
else if (SUCCESS > FAILURE)
output "Pass.\t" + tally(SUCCESS, FAILURE);
else
output "Fail.\t" + tally(SUCCESS, FAILURE);
}
function string tally(int S, int F)
{
return (SUCCESS - FAILURE) + "\t(" + SUCCESS + " - " + FAILURE + ")";
}