Skip to content

Instantly share code, notes, and snippets.

@Noxville
Last active August 29, 2015 14:06
Show Gist options
  • Save Noxville/6092d141be552cb13f69 to your computer and use it in GitHub Desktop.
Save Noxville/6092d141be552cb13f69 to your computer and use it in GitHub Desktop.
/r/Dota2 Discussion about effect 4 slots for Spirit Bear
import itertools
import operator
def evaluateDps(items):
bat = 1.45
ias = min(4.00, 0.35 + sum(c.ias for c in items)) # ias is capped at 400, AC gives 35% IAS
dmg = 33 + 60 + sum(c.damage for c in items) # 33 is the mean base damage, 60 damage from desolator
aps = (1. + ias) / bat
return dmg * aps
class Item:
def __init__(self, name, damage, ias):
self.name = name
self.damage = damage
self.ias = ias
mjo = Item("Mjollnir", 24, 0.8)
mkb = Item("Monkey King Bar", 88, 0.15)
aby = Item("Abyssal Blade", 100, 0)
div = Item("Divine Rapier", 300, 0)
itemList = ([mjo] * 4) + ([mkb] * 4) + ([aby] * 4) + ([div] * 4)
dps = {}
for it in itertools.combinations(tuple(itemList), 4):
dps[" / ".join(x.name for x in it)] = evaluateDps(it)
for pair in sorted(dps.iteritems(), key=operator.itemgetter(1))[::-1]:
tex = str("%.2f" % pair[1]) + " => " + str(pair[0])
if ("Divine" in tex):
tex = "**" + tex + "**"
print "* " + tex # reddit friendly folks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment