Created
April 6, 2015 22:26
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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