Example #1
0
File: deploy.py Project: Canim44/dl
def get_sim_target_modules(targets):
    target_modules = {}
    if all([cmd not in targets for cmd in ('all', 'quick', 'slow')]):
        for adv in targets:
            try:
                core.simulate.load_adv_module(adv, in_place=target_modules)
            except Exception as e:
                print(f'\033[93m{0:.4f}s - load:{adv} {e}\033[0m', flush=True)
        return target_modules

    for adv in list_advs():
        try:
            core.simulate.load_adv_module(adv, in_place=target_modules)
        except Exception as e:
            print(f'\033[93m{0:.4f}s - load:{adv} {e}\033[0m', flush=True)
    if 'all' in targets:
        return target_modules
    if 'quick' in targets:
        for adv, variants in target_modules.copy().items():
            if 'mass' in variants:
                del target_modules[adv]
        return target_modules
    if 'slow' in targets:
        for adv, variants in target_modules.copy().items():
            if not 'mass' in variants:
                del target_modules[adv]
        return target_modules
Example #2
0
def get_sim_target_module_dict(advs=None,
                               conds=None,
                               mass=None,
                               special=False):
    target_modules = {}
    advs = advs or list_advs()
    for adv in advs:
        try:
            name = core.simulate.load_adv_module(adv, in_place=target_modules)
            if conds is not None:
                adv_data = load_adv_json(name)
                if not all([cond(adv_data) for cond in conds]):
                    del target_modules[name]
                    continue
            if mass is not None:
                if (mass and "mass" not in target_modules[name]) or (
                        not mass and "mass" in target_modules[name]):
                    del target_modules[name]
                    continue
            if special and all((variant == None or variant in SKIP_VARIANT
                                for variant in target_modules[name].keys())):
                del target_modules[name]
                continue
        except Exception as e:
            printlog("load", monotonic() - t_start, adv, None, err=e, color=93)
    return target_modules
Example #3
0
def get_sim_target_module_dict(advs=None, conds=None, mass=None):
    target_modules = {}
    advs = advs or list_advs()
    for adv in advs:
        try:
            name = core.simulate.load_adv_module(adv, in_place=target_modules)
            if conds is not None:
                adv_data = load_adv_json(name)
                if not all([cond(adv_data) for cond in conds]):
                    del target_modules[name]
            if mass is not None:
                if (mass and 'mass' not in target_modules[name]) or (not mass and 'mass' in target_modules[name]):
                    del target_modules[name]
        except Exception as e:
            print(f'\033[93m{0:.4f}s - load:{adv} {e}\033[0m', flush=True)
    return target_modules
Example #4
0
app = Flask(__name__)

# Helpers
SIMULATED_BUFFS = {
    "str_buff": (-100, 200, 100),
    "def_down": (-50, 200, 100),
    "critr": (-100, 100, 100),
    "critd": (-100, 200, 100),
    "doublebuff_interval": (0.5, 600.0, 1),
    "count": (0, float("inf"), 1),
    "echo": (0, float("inf"), 1),
}
RARITY_MAP = {1: "formA", 2: "formB", 3: "formC"}

ADV_MODULES = {}
for fn in list_advs():
    core.simulate.load_adv_module(fn, in_place=ADV_MODULES)

EQUIP_MANAGERS = initialize_equip_managers()


def set_teamdps_res(result, logs, real_d, suffix=""):
    result["extra" + suffix] = {}
    if logs.team_buff > 0:
        result["extra" + suffix]["team_buff"] = "+{}%".format(
            round(logs.team_buff / real_d * 100))
    for tension, count in logs.team_tension.items():
        if count > 0:
            result["extra" +
                   suffix]["team_{}".format(tension)] = "{} stacks".format(
                       round(count))
Example #5
0
def initialize_equip_managers():
    return {
        advname: EquipManager(advname, debug=False)
        for advname in list_advs()
    }
Example #6
0
    print(advname, end="\t", flush=True)
    while equilibrium < max_equilibrium:
        dprint("")
        dprint("=" * 100)
        dprint("")
        equilibrium += 1
        convert_from_existing(advname)
        next_sha256 = sha256sum(new_equip_file)
        if sha256 == next_sha256:
            break
        sha256 = next_sha256
    print(monotonic() - t_start, flush=True)
    if equilibrium == max_equilibrium and sha256 != next_sha256:
        print(f"Failed to achieve equilibrium for {advname}")
    else:
        dprint(f"It took {equilibrium} iterations to achieve equilibrium")
    # convert_from_existing(advname)
    # second_pass = sha256sum(new_equip_file)
    # if first_pass != second_pass:
    #     print(f"{advname} differed")


if __name__ == "__main__":
    # advname = sys.argv[1]
    # convert_from_existing(advname)
    # n_pass_test("alberius")
    # python deploy.py lea valerio gala_notte sophie_persona patia chelsea hunter_sarisse noelle hildegarde gala_chelle -c
    # advlist = ["lea", "valerio", "gala_notte", "sophie_persona", "patia", "chelsea", "hunter_sarisse", "noelle", "hildegarde", "gala_chelle"]
    for advname in list_advs():
        n_pass_test(advname)