def __init__(self, name, lvl): super().__init__(name, lvl) self.cr_class = 'Wizard' self.stats = { 'int': self.gen_scores(4) + 5, 'str': self.gen_scores(4), 'dex': self.gen_scores(4), 'cha': self.gen_scores(4), 'wis': self.gen_scores(4), 'con': self.gen_scores(4), } self.hp = sum([random.randint(1, 6) for _ in range(self.lvl)]) self.ac = 10 + self.stats.get('dex') + 3 self.spellbook = { '1': Spell('Clashing Rocks', 9, 'smash', sum([random.randint(1, 6) for _ in range(1, 20)]), 4), '2': Spell('Stormbolts', 8, 'shock', sum([random.randint(1, 8) for _ in range(1, 20)]), 4), '3': Spell('Greater Shout', 8, 'yell', sum([random.randint(1, 6) for _ in range(1, 10)]), 4), '4': Spell('Finger of Death', 7, 'ray', 10 * self.lvl, 4), '5': Spell('Caustic Eruption', 7, 'acid', sum([random.randint(1, 6) for _ in range(1, self.lvl)]), 4), }
def generate_lua(spells, class_name): s = """--[[[ @module %s @description %s Spells. GENERATED FROM WOWHEAD SPELLS - DO NOT EDIT MANUALLY ]]-- kps.spells.%s = {} """ % (class_name.title(), class_name.title(), class_name) class_spells = [] for spell in spells: if not is_filtered(spell)[0]: class_spells.append( "kps.spells.%s.%s = kps.Spell.fromId(%s)\n" % (class_name, spell_key(spell["name"][1:]), spell["id"])) for spell_id in RACIAL_SPELLS: try: spell = Spell(spell_id) class_spells.append("kps.spells.%s.%s = kps.Spell.fromId(%s)\n" % (class_name, spell.key, spell.id)) except: LOG.error("ERROR: Spell-ID %s not found for %s", spell_id, class_name) for spell_id in ADDITIONAL_SPELLS[class_name]: try: spell = Spell(spell_id) class_spells.append("kps.spells.%s.%s = kps.Spell.fromId(%s)\n" % (class_name, spell.key, spell.id)) except: LOG.error("ERROR: Spell-ID %s not found for %s", spell_id, class_name) for class_spell in sorted(class_spells): s += class_spell return s
def summarize(spells, class_name): s = "" for spell in spells: filtered, reason = is_filtered(spell) if filtered: s += " * FILTERED (%s): %s\n" % (reason, spell["name"][1:]) else: s += " * %s (ID: %s CAT: %s)\n" % (spell["name"][1:], spell["id"], spell["cat"]) for spell_id in RACIAL_SPELLS: spell = Spell(spell_id) s += " * %s (ID: %s - from ADDITIONAL_SPELLS)\n" % (spell.name, spell.id) for spell_id in ADDITIONAL_SPELLS[class_name]: spell = Spell(spell_id) s += " * %s (ID: %s - from ADDITIONAL_SPELLS)\n" % (spell.name, spell.id) return s
def addSpell(self, name, xml, bookname): spellName = xml.tag if (spellName in self.spells.keys()): self.spells[spellName].appendBook(bookname) else: self.spells[spellName] = Spell(xml, bookname)
def generate_lua(spells, class_name): s = """--[[[ @module %s @description %s Spells and Environment Functions. GENERATED FROM WOWHEAD SPELLS - DO NOT EDIT MANUALLY ]]-- kps.spells.%s = {} """ % (class_name.title(), class_name.title(), class_name) for spell in spells: if not is_filtered(spell)[0]: s += "kps.spells.%s.%s = kps.Spell.fromId(%s)\n" % ( class_name, spell_key(spell["name"][1:]), spell["id"]) for spell_id in ADDITIONAL_SPELLS[class_name]: spell = Spell(spell_id) s += "kps.spells.%s.%s = kps.Spell.fromId(%s)\n" % ( class_name, spell.key, spell.id) return s + "\nkps.env." + class_name + " = {}\n" + ENV_FUNCTIONS[ class_name] + "\n"