def ToString(self): thisString = "Guardian #" + str(self.id) + "\n" thisString += " Name : " + str(self.name) + "\n" thisString += " Equipment IDs : " for equipmentType in EquipmentType: if self.equipments.has_key(equipmentType): thisString += str(self.equipments[equipmentType].id) + " " else: thisString += "0 " thisString += "\n" thisString += " ATK DEF PINCER HP CRTRATE CRTDMG ACC RES\n" thisString += " Base Statistic :" for statisticType in StatisticType: thisString += str(self.statistics[statisticType]).rjust(10) thisString += "\n" thisString += " Collection Effect:" for statisticType in StatisticType: thisString += str(self.collectionEffects[statisticType]).rjust(10) thisString += "\n" for equipmentType in EquipmentType: thisString += (equipmentType.name + " Buff:").rjust(20) for statisticType in StatisticType: if self.equipments.has_key(equipmentType): thisString += str( self.equipments[equipmentType].GetBuffedStatistic( statisticType, self)).rjust(10) thisString += "\n" equipmentSet = self.GetEquipmentSet() for set in equipmentSet: thisString += " " + str(set).ljust(16) + " :" setBuffPercent = Equipment.GetSetBuff(set, self) for statisticType in StatisticType: thisString += str(setBuffPercent.get(statisticType, 0)).rjust(10) for specialAbility in SpecialAbility: thisString += " " + str( setBuffPercent.get(specialAbility, "")) thisString += "\n" finalStats = self.CalculateFinalStats() thisString += " Final Statistic :" for statisticType in StatisticType: thisString += str(finalStats[statisticType]).rjust(10) thisString += "\n" thisString += " Average ATK : " + str( Guardian.GetAverageAttack(finalStats)) return thisString
def CalculateFinalStats(self): finalStats = {} for statisticType in StatisticType: finalStats[statisticType] = self.statistics[statisticType] finalStats[statisticType] += self.collectionEffects[statisticType] if len(self.equipments) > 0: for equipmentType in EquipmentType: if self.equipments.has_key(equipmentType): finalStats[statisticType] += self.equipments[ equipmentType].GetBuffedStatistic( statisticType, self) equipmentSet = self.GetEquipmentSet() for set in equipmentSet: setBuffPercent = Equipment.GetSetBuff(set, self) for statisticType in StatisticType: finalStats[statisticType] += setBuffPercent.get( statisticType, 0) return finalStats