Skip to content

Instantly share code, notes, and snippets.

@J-Moravec
Created June 5, 2020 00:48
Show Gist options
  • Save J-Moravec/a52beb76db671eb9e763f86bfe77a5c8 to your computer and use it in GitHub Desktop.
Save J-Moravec/a52beb76db671eb9e763f86bfe77a5c8 to your computer and use it in GitHub Desktop.
Effect of reinvigoration on number of spell cast in battle
turn_of_casting = function(spell_fatigue, reinvigoration, turn_max=100){
tcast = c()
fatigue = 0
for(turn in seq_len(turn_max)){
if(fatigue < 100){
# cast spell
fatigue = fatigue + spell_fatigue
tcast = c(tcast, turn)
} else {
# nap
fatigue = fatigue - 5
}
# reinvigoration always applies
fatigue = fatigue - reinvigoration
}
tcast
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment