Today’s update just adds to more evaluations: average per cast and average per spell. Nothing new was learning, or – to put it more positively –: there was nothing that I had to look up.
The tricky part was only to mind the column/line header string-lengths to accomodate for the new “Average” header, if they are shorter. And some small change to the output for the sake of readability.
I will probably end this project for now because I have some ideas more a more scientific project. I’m now rather confident with the basics of Python so that this seems like a reasonable thing to do.
...
for e in logEvents:
print ("Evaluation for event "+e+":\n")
targetLine = ""
targetNameLength = getTargetNameLength(targetList,targetDictionary)
if targetNameLength < len("AVERAGE"):
targetNameLength = len("AVERAGE")
for t in targetList:
targetLine = targetLine+" "+targetDictionary[t].center(targetNameLength)+" |"
targetLine = targetLine+" "+"AVERAGE".center(targetNameLength)+" |"
spellNameLength = getSpellnameLength(spellList[e])
if spellNameLength < len("Average/Cast"):
spellNameLength = len("Average/Cast")
space = " " * spellNameLength
print(space+" |"+targetLine)
castAvrgDmg = 0
targetCount = 0
for s in spellList[e]:
outLine = s.rjust(spellNameLength)+" |"
for t in targetList:
if t in logData[e].keys():
if s in logData[e][t].keys():
outLine = outLine+" "+str(getAverageDmg(logData[e][t][s])).center(targetNameLength)+" |"
castAvrgDmg += getAverageDmg(logData[e][t][s])
targetCount += 1
else:
outLine = outLine+" "+str(0).center(targetNameLength)+" |"
else:
outLine = outLine+" "+str(0).center(targetNameLength)+" |"
print(outLine+" "+str(round(castAvrgDmg/targetCount,2)).center(targetNameLength)+" | "+s.ljust(spellNameLength))
castAvrgDmg = 0
targetCount = 0
# get average damage for each target
outLine = "Average/Cast".rjust(spellNameLength)+" |"
for t in targetList:
if t in logData[e].keys():
avrgDmg = 0
sourcesCount = 0
for s in spellList[e]:
if s in logData[e][t].keys():
avrgDmg += getAverageDmg(logData[e][t][s])
sourcesCount += 1
else:
avrgDmg = 0
sourcesCount = 1
outLine = outLine+" "+str(round(avrgDmg/sourcesCount,2)).center(targetNameLength)+" |"
print(outLine)
print()
OUTPUT:
Evaluation for event SPELL_DAMAGE:
| "Alchemist Pitts" | "Tidesage Morris" | "Ivus the Decayed" | AVERAGE |
"Fire Blast" | 11825.25 | 0 | 7820.67 | 8655.78 | "Fire Blast"
"Blazing Barrier" | 2052.33 | 0 | 0 | 1626.16 | "Blazing Barrier"
"Pyroblast" | 18006.5 | 0 | 14811.5 | 15053.2 | "Pyroblast"
"Meteor" | 43235.0 | 0 | 39422.0 | 37384.67 | "Meteor"
"Dragon's Breath" | 9664.0 | 0 | 0 | 8343.0 | "Dragon's Breath"
"Scorch" | 4847.25 | 0 | 5222.6 | 3708.99 | "Scorch"
"Gutripper" | 2971.0 | 1485.0 | 3045.33 | 2391.47 | "Gutripper"
"Living Bomb" | 0 | 1539.25 | 0 | 1539.25 | "Living Bomb"
"Heed My Call" | 0 | 0 | 4207.0 | 4248.62 | "Heed My Call"
"Fireball" | 0 | 0 | 0 | 9043.86 | "Fireball"
Average/Cast | 13228.76 | 1512.12 | 12421.52 |