Skip to content

Instantly share code, notes, and snippets.

@brubsby
Created May 16, 2022 14:46
Show Gist options
  • Select an option

  • Save brubsby/aabec68224635612ba0320d60e4c412d to your computer and use it in GitHub Desktop.

Select an option

Save brubsby/aabec68224635612ba0320d60e4c412d to your computer and use it in GitHub Desktop.
Anydice program to calculate best cantrip to use while concentrating on melf's minute meteors
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
}
}
TARGET_INT:1
TARGET_WIS:0
TARGET_DEX:2
TARGET_AC:12
SPELL_SAVE:18
SPELL_ATTACK:7
CANTRIP_DICE:2
METEOR_TARGETS:d{1:3,2:4,3:3,4:1}
INT_FAIL_CHANCE:[TARGET_INT saving throw dc SPELL_SAVE]
WIS_FAIL_CHANCE:[TARGET_WIS saving throw dc SPELL_SAVE]
DEX_FAIL_CHANCE:[TARGET_DEX saving throw dc SPELL_SAVE]
SLIVER_DEX_FAIL_CHANCE:[TARGET_DEX-1d4 saving throw dc SPELL_SAVE]
ATTACK_CHANCE:[SPELL_ATTACK attack vs TARGET_AC]
ONE_METEOR: [true or half DEX_FAIL_CHANCE 2d6]
TWO_METEOR: ONE_METEOR + ONE_METEOR
ONE_SLIVERED_METEOR:[true or half SLIVER_DEX_FAIL_CHANCE 2d6]
TWO_METEOR_SLIVERED:ONE_SLIVERED_METEOR + ONE_METEOR
MIND_SLIVER: [true or none INT_FAIL_CHANCE CANTRIP_DICEd6]
FIRE_BOLT: [true or none ATTACK_CHANCE CANTRIP_DICEd10]
TOLL_DEAD_ONE: [true or none WIS_FAIL_CHANCE CANTRIP_DICEd8]
TOLL_DEAD_TWO: [true or none WIS_FAIL_CHANCE CANTRIP_DICEd12]
SLIVER_SUCCESS_INTO_METEORS: (CANTRIP_DICEd6 + TWO_METEOR_SLIVERED)
SLIVER_METEOR: [SLIVER_SUCCESS_INTO_METEORS if INT_FAIL_CHANCE else TWO_METEOR]
output SLIVER_METEOR named "sliver then meteors"
output TOLL_DEAD_TWO + TWO_METEOR named "toll 2meteor"
output FIRE_BOLT + TWO_METEOR named "firebolt 2meteor"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment