def format_condition(cond: Condition): converter = EnESTextConverter() parts = [] if cond.skill_set: parts.append('SkillSet {}'.format(cond.skill_set)) if cond.use_chance not in [0, 100]: parts.append('{}% chance'.format(cond.use_chance)) if cond.global_one_time: parts.append('one time only') if cond.limited_execution: parts.append('at most {} times'.format(cond.limited_execution)) if cond.trigger_enemies_remaining: parts.append('when {} enemies remain'.format(cond.trigger_enemies_remaining)) if cond.if_defeated: parts.append('when defeated') if cond.if_attributes_available: parts.append('when required attributes on board') if cond.trigger_monsters: parts.append('when {} on team'.format(', '.join(map(str, cond.trigger_monsters)))) if cond.trigger_combos: parts.append('when {} combos last turn'.format(cond.trigger_combos)) if len(cond.erased_attributes) != 0: parts.append('when all {} orbs are matched last turn'.format( converter.attributes_to_str(cond.erased_attributes))) if cond.if_nothing_matched: parts.append('if no other skills matched') if cond.damage_done: parts.append("when damage done last turn >= {}".format(cond.damage_done)) if len(cond.attributes_attacked) != 0: parts.append( "when {} attributes are used to attack".format(converter.attributes_to_str(cond.attributes_attacked))) if cond.skills_used: parts.append("when {} or more skills are used".format(cond.skills_used)) if cond.repeats_every: if cond.trigger_turn: if cond.trigger_turn_end: parts.append('execute repeatedly, turn {}-{} of {}'.format(cond.trigger_turn, cond.trigger_turn_end, cond.repeats_every)) else: parts.append('execute repeatedly, turn {} of {}'.format(cond.trigger_turn, cond.repeats_every)) else: parts.append('repeats every {} turns'.format(cond.repeats_every)) elif cond.trigger_turn_end: turn_text = 'turns {}-{}'.format(cond.trigger_turn, cond.trigger_turn_end) parts.append(_cond_hp_timed_text(cond.always_trigger_above, turn_text)) elif cond.trigger_turn: turn_text = 'turn {}'.format(cond.trigger_turn) parts.append(_cond_hp_timed_text(cond.always_trigger_above, turn_text)) if not parts and cond.hp_threshold in [100, 0]: return None if cond.hp_threshold == 101: parts.append('when hp is full') elif cond.hp_threshold: parts.append('hp <= {}'.format(cond.hp_threshold)) return ', '.join(parts)
def from_cseb(o: CrossServerESInstance) -> 'EnemySkill': exemplar = o.jp_skill.behavior has_attack = hasattr(exemplar, 'attack') and exemplar.attack min_hits = exemplar.attack.min_hits if has_attack else 0 max_hits = exemplar.attack.max_hits if has_attack else 0 atk_mult = exemplar.attack.atk_multiplier if has_attack else 0 ja_desc = exemplar.full_description(JpESTextConverter()) en_desc = exemplar.full_description(EnESTextConverter()) #ko_desc = exemplar.full_description(KrESTextConverter()) return EnemySkill(enemy_skill_id=o.enemy_skill_id, name_ja=o.jp_skill.name, name_en=o.na_skill.name, name_ko=o.kr_skill.name, desc_ja=ja_desc, desc_en=en_desc, desc_ko=en_desc, min_hits=min_hits, max_hits=max_hits, atk_mult=atk_mult)
from typing import List from dadguide_proto.enemy_skills_pb2 import MonsterBehavior, BehaviorGroup, Condition, Behavior from pad.raw.skills.enemy_skill_info import ESSkillSet, ESInstance, ESCountdownMessage, ESDefaultAttack from pad.raw.enemy_skills.enemy_skillset_processor import ProcessedSkillset, StandardSkillGroup, Moveset from pad.raw_processor.crossed_data import CrossServerCard from pad.raw.skills.en.enemy_skill_text import EnESTextConverter ESTextConverter = EnESTextConverter() def save_monster_behavior(file_path: str, csc: CrossServerCard, mb: MonsterBehavior): output = '#{} - {}'.format(csc.monster_id, csc.na_card.card.name) card = csc.jp_card.card output += '\nmonster size: {}'.format(card.unknown_009) output += '\nnew AI: {}'.format(card.use_new_ai) output += '\nstart/max counter: {}'.format(card.enemy_skill_max_counter) output += '\ncounter increment: {}'.format( card.enemy_skill_counter_increment) library = { x.enemy_skill_id: x.na_skill.behavior for x in csc.enemy_behavior } library[-1] = ESCountdownMessage() library[-2] = ESDefaultAttack() output += '\n' + format_monster_behavior(mb, library) with open(file_path, 'w', encoding='utf-8') as f: f.write(output)
import pathlib import padtools from pad.common import pad_util from pad.common.shared_types import Server from pad.raw.skills import skill_text_typing from pad.raw.skills.en.active_skill_text import EnASTextConverter from pad.raw.skills.jp.active_skill_text import JpASTextConverter from pad.raw.skills.en.leader_skill_text import EnLSTextConverter from pad.raw.skills.jp.leader_skill_text import JpLSTextConverter from pad.raw.skills.jp.enemy_skill_text import JpESTextConverter from pad.raw.skills.en.enemy_skill_text import EnESTextConverter from pad.raw.skills.leader_skill_info import LeaderSkill AS_CONVERTERS = (JpASTextConverter(), EnASTextConverter(), EnASTextConverter()) LS_CONVERTERS = (JpLSTextConverter(), EnLSTextConverter(), EnLSTextConverter()) ES_CONVERTERS = (JpESTextConverter(), EnESTextConverter(), EnESTextConverter()) from pad.raw_processor import merged_database from pad.raw_processor.crossed_data import CrossServerDatabase from pad.raw.skills.enemy_skill_info import BEHAVIOR_MAP def parse_args(): parser = argparse.ArgumentParser(description="Runs the integration test.", add_help=False) input_group = parser.add_argument_group("Input") input_group.add_argument("--input_dir", required=True, help="Path to a folder where the input data is") output_group = parser.add_argument_group("Output")
from pad.raw.skills import skill_text_typing from pad.raw.skills.emoji_en.enemy_skill_text import EnEmojiESTextConverter from pad.raw.skills.en.active_skill_text import EnASTextConverter from pad.raw.skills.en.enemy_skill_text import EnESTextConverter from pad.raw.skills.en.leader_skill_text import EnLSTextConverter from pad.raw.skills.enemy_skill_info import BEHAVIOR_MAP from pad.raw.skills.ja.active_skill_text import JaASTextConverter from pad.raw.skills.ja.enemy_skill_text import JaESTextConverter from pad.raw.skills.ja.leader_skill_text import JaLSTextConverter from pad.raw.skills.leader_skill_info import LeaderSkill from pad.raw_processor import merged_database from pad.raw_processor.crossed_data import CrossServerDatabase, CrossServerEnemySkill, CrossServerDungeon AS_CONVERTERS = (JaASTextConverter(), EnASTextConverter(), EnASTextConverter()) LS_CONVERTERS = (JaLSTextConverter(), EnLSTextConverter(), EnLSTextConverter()) ES_CONVERTERS = (JaESTextConverter(), EnESTextConverter(), EnESTextConverter(), EnEmojiESTextConverter()) def parse_args(): parser = argparse.ArgumentParser(description="Runs the integration test.", add_help=False) input_group = parser.add_argument_group("Input") input_group.add_argument("--input_dir", required=True, help="Path to a folder where the input data is") output_group = parser.add_argument_group("Output") output_group.add_argument("--output_dir", required=True, help="Path to a folder where output should be saved") input_group.add_argument("--image_data_only", default=False, action="store_true", help="Should we only dump image availability") input_group.add_argument("--server", default="JP", help="Server to build for")