Skip to content

Instantly share code, notes, and snippets.

@Erreinion
Created April 6, 2015 22:26
Show Gist options
  • Save Erreinion/7da52bdc57d5fa832645 to your computer and use it in GitHub Desktop.
Save Erreinion/7da52bdc57d5fa832645 to your computer and use it in GitHub Desktop.
D&D script to calculate the damage made by a squad of minions
from math import ceil, floor
# inputs
quantity = (int(raw_input("Minions left: ")))
roll = (int(raw_input("Roll: ")))
target = (int(raw_input("Target AC: ")))
# minion attack details
bonus = 15
damage = 10
# internal variable
number_hit = 0
threshold = target - bonus
upper_half_quantity = (int(ceil(float(quantity)/2)))
lower_half_quantity = (int(floor(float(quantity)/2)))
for x in range(1, upper_half_quantity + 1):
if roll + (x * 2) > threshold:
number_hit += 1
print "Damage = " + str(damage * number_hit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment