[RPG] How to use AnyDice with Classic World of Darkness / 20th Anniversary

anydicedicetoolsworld-of-darkness

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 + ")";
}

Best Answer

I ended up getting a tweet from the creator of AnyDice with an optimized solution. The function names are clear and it works quickly.


@catlikecoding Hey Jasper, could you help me with an #AnyDice question? I'm still learning the ropes with the system. http://t.co/H0qMhIaIGD

— Taylor Wright (@redlamp) June 6, 2014

@redlamp Don't use a mega function, break it up. http://t.co/anUMab5ByK

— Jasper Flick (@catlikecoding) June 6, 2014

The code sample:

function: roll ROLL:s {
 if 1@ROLL < 1 & (#ROLL)@ROLL = -1 {
  result: -1
 }
 result: [highest of 0 and ROLL]
}

function: roll ROLL:n with willpower {
 result: [highest of 0 and ROLL + 1]
}

function: specialty N:n {
 if N = 10 { result: 2 }
 if N = 1 { result: -1 }
 result: N >= DIFFICULTY
}

DIFFICULTY: 7

NORMAL: d{-1:1, 0:(DIFFICULTY - 2), 1:(11 - DIFFICULTY)}

SPECIALTY: [specialty d10]

X: 4

output [roll X d NORMAL] named "normal"
output [roll X d SPECIALTY] named "speciality"
output [roll X d NORMAL with willpower] named "normal willpower"
output [roll X d SPECIALTY with willpower] named "speciality willpower"
\ automatic success is automatic, nothing to show \
Related Topic