class DragonBase(EquipBase): AUGMENTS = 50 FAFNIR = 0.115 DEFAULT_DCONF = Conf({ "duration": 10, # 10s dragon time "dracolith": 0.70, # base dragon damage "exhilaration": 0, # psiren aura "gauge_val": 100, # gauge regen value "latency": 0, # amount of delay for cancel "act": "c3-s", "dshift.startup": 1.0, "dshift.recovery": 0.63333, "dshift.attr": [{ "dmg": 2.0 }], "dodge.startup": 0.0, "dodge.recovery": 0.66667, "end.startup": 0, "end.recovery": 0, "allow_end": 3.0, # time before force end is allowed, not including the time needed for skill "allow_end_step": 2.0, # for each shift, add this amount of time to allow_end }) def __init__(self, conf, c, qual=None): super().__init__(conf.d, c, qual) self.dragonform = conf def oninit(self, adv): from core.dragonform import DragonForm if adv.conf["dragonform"]: name = self.c.name self.dragonform = Conf(adv.conf["dragonform"]) else: name = self.name for dn, dconf in self.dragonform.items(): if isinstance(dconf, dict): adv.hitattr_check(dn, dconf) self.dragonform.update(DragonBase.DEFAULT_DCONF, rebase=True) adv.dragonform = DragonForm(name, self.dragonform, adv) @property def att(self): return super().att * (1 + DragonBase.FAFNIR) @property def hp(self): return super().hp * (1 + DragonBase.FAFNIR) @property def ele(self): return self.conf.ele @property def ab(self): return super().ab if self.on_ele else []
def set_w(self, key=None): try: conf = Conf(weapons[self.c.wt][self.c.ele][key]) except KeyError: try: conf = Conf(weapons[self.c.wt]['any'][key]) except KeyError: conf = Conf(weapons[self.c.wt][self.c.ele][Slots.DEFAULT_WEAPON]) key = Slots.DEFAULT_WEAPON self.w = WeaponBase(conf, self.c, key)
def oninit(self, adv): from core.dragonform import DragonForm if adv.conf["dragonform"]: name = self.c.name self.dragonform = Conf(adv.conf["dragonform"]) else: name = self.name for dn, dconf in self.dragonform.items(): if isinstance(dconf, dict): adv.hitattr_check(dn, dconf) self.dragonform.update(DragonBase.DEFAULT_DCONF, rebase=True) adv.dragonform = DragonForm(name, self.dragonform, adv)
def pick(self, amulets, c): retain_union = {} for u, thresh in AmuletPicker.UNION_THRESHOLD.items(): u_sum = sum(a.union == u for a in amulets) if u_sum >= thresh: retain_union[u] = u_sum new_amulet_quals = set() for a_i, a in enumerate(amulets): group, gval = self.get_group(a.qual) if len(group) == 1: new_amulet_quals.add(a.qual) continue bis_i = len(group) - 1 bis_i = self.find_next_matching(bis_i, group, gval, c, retain_union) while group[bis_i].qual in new_amulet_quals: bis_i -= 1 bis_i = self.find_next_matching(bis_i, group, gval, c, retain_union) bis_qual = group[bis_i].qual amulets[a_i] = AmuletBase(Conf(wyrmprints[bis_qual]), c, bis_qual) new_amulet_quals.add(bis_qual) return amulets
def __init__(self, adv, name, conf, x_proc=None, no_fs=False, no_dodge=False): self.conf = Conf(conf) self.adv = adv self.name = name self.x_og = adv.x self.a_x_alt = {} self.x_proc = x_proc or self.x_proc_default self.l_x_alt = Listener("x", self.l_x).off() self.no_fs = no_fs self.no_dodge = no_dodge self.fs_og = adv.fs self.dodge_og = adv.dodge self.xmax = 1 n = "x{}".format(self.xmax) while n in self.conf: self.a_x_alt[self.xmax] = X((n, self.xmax), self.conf[n]) self.xmax += 1 n = "x{}".format(self.xmax) self.xmax -= 1 self.active = False self.xstart = None self.zeroed = None
def __init__(self, adv, conf, fs_proc=None): self.adv = adv self.a_fs_og = adv.a_fs self.conf_og = adv.conf self.fs_proc_og = adv.fs_proc self.conf_alt = adv.conf + Conf(conf) self.a_fs_alt = Fs_group('fs_alt', self.conf_alt) self.fs_proc_alt = fs_proc self.uses = 0
def oninit(self, adv): unique_dform = False if adv.conf["dragonform"]: name = self.c.name self.dform = Conf(adv.conf["dragonform"]) unique_dform = True else: name = self.name self.dform.update(DragonBase.DEFAULT_DCONF, rebase=True) if self.c.conf["utp"]: from core.dragonform import DragonFormUTP adv.dragonform = DragonFormUTP(name, self.dform, adv, self) else: from core.dragonform import DragonForm adv.dragonform = DragonForm(name, self.dform, adv, self, unique_dform=unique_dform) self.adv = adv return unique_dform
def __init__(self, adv, conf, fs_proc=None): self.adv = adv self.a_fs_og = adv.a_fs self.conf_og = adv.conf self.fs_proc_og = adv.fs_proc self.conf_alt = adv.conf + Conf(conf) self.a_fs_alt = Fs_group('fs_alt', self.conf_alt) self.fs_proc_alt = fs_proc self.uses = 0 self.has_fsf = False if 'fsf' in conf: self.a_fsf_og = adv.a_fsf self.a_fsf_alt = Fs('fsf', conf.fsf) self.a_fsf_alt.act_event = Event('none') self.has_fsf = True
def __init__(self, adv, name, conf, x_proc=None, no_fs=False): self.conf = Conf(conf) self.adv = adv self.name = name self.x_og = adv.x self.a_x_alt = {} if x_proc: self.x_proc = x_proc self.l_x_alt = Listener('x', self.l_x).off() else: self.l_x_alt = None self.no_fs = no_fs self.fs_og = adv.fs self.xmax = 1 n = 'x{}'.format(self.xmax) while n in self.conf: self.a_x_alt[n] = X((n, self.xmax), self.conf[n]) self.xmax += 1 n = 'x{}'.format(self.xmax) self.xmax -= 1 self.active = False
def __init__(self, adv, conf, fs_proc=None, l_fs=None): raise RuntimeError("deprecated") # Note: Do not run this in adv init, as it will copy premature conf. # TODO add l_fs_alt to better handle before and after when needed; maybe fsnf self.patterns = [ re.compile(r"^a_fs(?!f).*"), re.compile(r"^conf$"), re.compile(r"^fs.*proc$"), ] self.pattern_fsn = re.compile(r"^fs\d*$") self.adv = adv self.conf_alt = adv.conf + Conf(conf) self.fs_proc_alt_temp = fs_proc self.l_fs = l_fs self.uses = 0 self.has_fsf = False self.do_config(self.conf_alt) if "fsf" in conf: self.a_fsf_og = adv.a_fsf self.a_fsf_alt = Fs("fsf", conf.fsf) self.a_fsf_alt.act_event = Event("none") self.has_fsf = True
def pick(self, amulets, c): union_threshold = AmuletPicker.UNION_THRESHOLD.copy() for a in amulets: for ab in a.ab: if ab[0] == "psalm": _, union, min_count, extra_level = ab union_threshold[union] = max( min_count, union_threshold[union] - extra_level) retain_union = {} for u, thresh in union_threshold.items(): u_sum = sum(a.union == u for a in amulets) if u_sum >= thresh: retain_union[u] = u_sum new_amulet_quals = set() for a_i, a in enumerate(amulets): # always keep psalm print if any((ab[0] == "psalm" for ab in a.ab)): new_amulet_quals.add(a.qual) continue group, gval = self.get_group(a.qual) if len(group) == 1: new_amulet_quals.add(a.qual) continue bis_i = len(group) - 1 bis_i = self.find_next_matching(bis_i, group, gval, c, retain_union) while group[bis_i].qual in new_amulet_quals: bis_i -= 1 bis_i = self.find_next_matching(bis_i, group, gval, c, retain_union) bis_qual = group[bis_i].qual amulets[a_i] = AmuletBase(Conf(wyrmprints[bis_qual]), c, bis_qual) new_amulet_quals.add(bis_qual) return amulets
def get_with_alias(source, k): try: return Conf(source[k]), k except KeyError: k = alias[k.lower()] return Conf(source[k]), k
def set_w(self, key=None, affkey=None): conf = Conf(weapons[self.c.ele][self.c.wt]) self.w = WeaponBase(conf, self.c)
return self.c.hp + self.d.hp + self.w.hp + self.a.hp def oninit(self, adv=None): # self.c.oninit(adv) self.d.oninit(adv) # self.w.oninit(adv) # self.a.oninit(adv) for kind, slot in (('c', self.c), ('d', self.d), ('a', self.a), ('w', self.w)): for aidx, ab in enumerate(slot.ab): name = ab[0] if '_' in name: acat = name.split('_')[0] else: acat = name self.abilities[f'{kind}_{aidx}_{name}'] = (kind, ability_dict[acat](*ab)) for name, val in self.abilities.items(): kind, abi = val abi.oninit(adv, kind) self.abilities[name] = abi if __name__ == '__main__': from conf import load_adv_json conf = Conf(load_adv_json('Xania')) # conf['slots.a'] = ['Candy_Couriers', 'Me_and_My_Bestie'] conf['slots.d'] = 'Gala_Mars' slots = Slots(conf.c, True) slots.set_slots(conf.slots) print(type(slots.d))
class DragonBase(EquipBase): AUGMENTS = 50 FAFNIR = 0.115 DEFAULT_DCONF = Conf({ "dacl": "ds1,x=3", # the default dacl "duration": 10.0, # 10s dragon time "dracolith": 0.70, # base dragon damage "exhilaration": 0, # psiren aura "default_ds_x": 0, "default_x_loop": 0, "dshift.startup": 1.0, "dshift.recovery": 0.63333, "dshift.attr": [{ "dmg": 2.0 }], "dodge.startup": 0.0, "dodge.recovery": 0.66667, "dodge.interrupt": { "s": 0.0 }, "dodge.cancel": { "s": 0.0 }, "dend.startup": 0.0, "dend.recovery": 0.0, "allow_end": 3.0, # time before force end is allowed, not including the time needed for skill "allow_end_step": 2.0, # for each shift, add this amount of time to allow_end }) def __init__(self, conf, c, qual=None): super().__init__(conf.d, c, qual) self.dform = conf def oninit(self, adv): unique_dform = False if adv.conf["dragonform"]: name = self.c.name self.dform = Conf(adv.conf["dragonform"]) unique_dform = True else: name = self.name self.dform.update(DragonBase.DEFAULT_DCONF, rebase=True) if self.c.conf["utp"]: from core.dragonform import DragonFormUTP adv.dragonform = DragonFormUTP(name, self.dform, adv, self) else: from core.dragonform import DragonForm adv.dragonform = DragonForm(name, self.dform, adv, self, unique_dform=unique_dform) self.adv = adv return unique_dform @property def att(self): return super().att * (1 + DragonBase.FAFNIR) @property def hp(self): return super().hp * (1 + DragonBase.FAFNIR) @property def ele(self): return self.conf.ele @property def ab(self): return super().ab if self.on_ele else []