Skip to content

Instantly share code, notes, and snippets.

@MisterPhoton
Created January 13, 2011 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MisterPhoton/777229 to your computer and use it in GitHub Desktop.
Save MisterPhoton/777229 to your computer and use it in GitHub Desktop.
D&D AnyDice Hunter Calc
MISS: 0
HIT: 1
CRITICALHIT: 2
function: attack ROLL:n vs DEFENSE:n {
if ROLL = 1 { result: MISS }
if ROLL = 20 {
if ROLL + ATTACK >= DEFENSE { result: CRITICALHIT }
result: HIT
}
if ROLL + ATTACK >= DEFENSE { result: HIT }
result: MISS
}
function: damage for ATTACKS:s {
D: 0
loop A over {1..#ATTACKS} {
if A@ATTACKS = CRITICALHIT { D: D + CRITICAL }
else if A@ATTACKS = HIT { D: D + DAMAGE }
}
result: D + [extra damage for ATTACKS]
}
function: extra damage for ATTACKS:s {
if [ATTACKS contains CRITICALHIT] {
result: [maximum of QUARRY]
}
if [ATTACKS contains HIT] { result: QUARRY }
result: 0
}
function: twin strike {
result: [damage for 2d[attack d20 vs DEFENSE]]
}
DEFENSE: d{12..22}
QUARRY: d6
ATTACK : 6 + 2
DAMAGE : d12 + 6
CRITICAL: 18
output [twin strike] named "Greatbow"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment