Skip to content

Instantly share code, notes, and snippets.

@brubsby
Last active November 19, 2022 22:01
Show Gist options
  • Save brubsby/95a3528523947345c40b54c4911da76c to your computer and use it in GitHub Desktop.
Save brubsby/95a3528523947345c40b54c4911da76c to your computer and use it in GitHub Desktop.
function: MOD saving throw dc DC {
result: d20+MOD < DC
}
function: ATTACK attack vs AC {
result: d20+ATTACK >= AC
}
function: true or half SUCCESS DAMAGE {
result: DAMAGE / (2 - SUCCESS)
}
function: true or none SUCCESS DAMAGE {
result: SUCCESSdDAMAGE
}
function: TRUE_EXPR if COND:n else FALSE_EXPR {
if COND > 0 {
result: TRUE_EXPR
} else {
result: FALSE_EXPR
}
}
function: stat modifier at level LVL:n {
if LVL > 7 {
result: 5
} else if LVL > 3 {
result: 4
} else {
result: 3
}
}
function: proficiency bonus at level LVL:n {
if LVL > 16 {
result: 6
} else if LVL > 12 {
result: 5
} else if LVL > 8 {
result: 4
} else if LVL > 4 {
result: 3
} else {
result: 2
}
}
function: spell attack modifier at level LVL:n {
result: [proficiency bonus at level LVL] + [stat modifier at level LVL]
}
function: spell save at level LVL:n {
result: [proficiency bonus at level LVL] + [stat modifier at level LVL] + 8
}
function: ac for cr CR:n monster {
if CR > 16 {
result: 19
} else if CR > 12 {
result: 18
} else if CR > 9 {
result: 17
} else if CR > 7 {
result: 16
} else if CR > 4 {
result: 15
} else if CR > 3 {
result: 14
} else {
result: 13
}
}
function: firebolt damage at level LVL:n {
if LVL > 16 {
result: 4d10
} else if LVL > 10 {
result: 3d10
} else if LVL > 4 {
result: 2d10
} else {
result: 1d10
}
}
function: firebolt damage to a cr CR:n at level LVL:n {
result: [true or none [[spell attack modifier at level LVL] attack vs [ac for cr CR monster]] [firebolt damage at level LVL]]
}
loop N over {1..20} {
output [firebolt damage to a cr N at level N] named "level [N] firebolt damage against CR [N] monster"
}
loop N over {1..10} {
output Nd4 + N named "[N]d4 + [N] magic missile damage"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment