Skip to content

Instantly share code, notes, and snippets.

@friscojosh
Last active April 7, 2020 22:41
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 friscojosh/9ea7d0040e375f7de4dc1a0c94757144 to your computer and use it in GitHub Desktop.
Save friscojosh/9ea7d0040e375f7de4dc1a0c94757144 to your computer and use it in GitHub Desktop.
Improved Shadow Bolt uptime estimates
library("tidyverse")
library("tidylog")
### Mechanic explantion
# When your SB crits, a debuff (shadow vulnerability=SV) is placed on your
# target. That debuff increases ALL shadow damage taken by 20% and can last
# up to 12 seconds. So SV will actually increase the damage:
#
# - your shadow dots tick for,
# - of your next SB,
# - of your drain life,
# - of another warlock's SB and shadow dots and drain life,
# - of the spells of a shadow priest,
# - of a shadow dmg wand
# - etc..etc..
#
# Now, SV has 4 charges hence the number "4" on the icon on your target. That
# means that the debuff will stay on the target until 4 NON-PERIODIC shadow dmg
# sources are applied. So dots do NOT consume the charges of SV debuff. Direct
# shadow damage will though. So a shadow bolt, a shadow burn, a shadow wand or
# a mind blast will consume 1 charge.
#
# When all 4 charges are consumed by direct shadow damage or 12 seconds pass
# without all 4 charges having been consumed, SV ends.
#
# If the target is hit by a new shadow bolt crit while under the influence of
# the debuff, the charges become again 4 and the 12 sec timer is reset and
# starts ticking for another 12 seconds.
isb <- 0
simulations <- 1000000
isbuptime <- 0
crit <- 0.15
hit <- 0.83
bolt <- 1054.74
casttime <- 2.5
isbtimeleft <- 0
counter <- 0
for ( i in seq(1:simulations)) {
counter = counter + 1
if (isb > 0) { isbtimeleft = isbtimeleft - casttime }
if (isbtimeleft < 0) { isb = 0 }
if (isb > 0) { isbuptime = isbuptime + casttime }
if (runif(1) > hit) { next }
if (runif(1) <= crit) {
if (runif(1) <= hit) {
isb = 4
isbtimeleft = 12
}
else {
if (isb > 0) { isb = isb - 1 }
}
} else {
if (isb > 0) { isb = isb - 1 }
}
}
sim_isbuptime <- isbuptime / (simulations * casttime)
sim_isbuptime
# 0.35
1 - (1- crit * hit) ^ 4
# 0.41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment