Skip to content

Instantly share code, notes, and snippets.

@MisterPhoton
Created January 13, 2011 01:15
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/777239 to your computer and use it in GitHub Desktop.
Save MisterPhoton/777239 to your computer and use it in GitHub Desktop.
D&D AnyDice Two-Fanged Strike
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] { D: [maximum of QUARRY] }
else if [ATTACKS contains HIT] { D: QUARRY }
else { D: 0 }
if ![ATTACKS contains MISS] {
result: D + 4
}
result: D
}
function: twofanged strike {
result: [damage for 2d[attack d20 vs DEFENSE]]
}
DEFENSE: d{12..22}
QUARRY: d6
ATTACK : 6 + 2
DAMAGE : d12 + 6
CRITICAL: 18
output [twofanged strike] named "Greatbow"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment