User:Cerenkov/记忆结晶的实用性指南/script

来自魔法纪录中文Wiki
跳转至: 导航 搜索
# coding=utf-8
# get json from: https://gitlab.com/EnkanRec/magireco-data-json/-/tree/master/
# version beta
import json

MEMORIA_JSON = "memoria.json"
OUTPUT = "wikitext.txt"
WD = ""

def read_json(fname):
    f = open(WD + fname, 'r', encoding='utf-8')
    data = f.read()
    f.close()
    return json.loads(data)

def write_wiki(fname, text):
    f = open(WD + fname, 'w', encoding='utf-8')
    f.write(text)
    f.close()

def table_header(columns, column_certain=False, percentage=True, icon_width='30px', table_style='width: 98%;'):
    text = '{| class="wikitable"'
    if table_style: text += ' style="%s"' % table_style
    text += '\n'
    text += table_caption(columns, column_certain=column_certain, percentage=percentage, firstRow=True, icon_width=icon_width)
    return text

def table_caption(columns, column_certain=False, percentage=True, firstRow=False, icon_width='30px'):
    text = '' if firstRow else '|-\n'
    text += '! style="width: %s" | !! 技能' % icon_width
    if column_certain:
        text += ' !! 必定'
    for i in columns:
        if percentage:
            text += ' !! %g%%' % (i/10)
        else:
            text += ' !! %g' % (i/10)
    text += ' !! 其他\n'
    return text

def memoriaSort(m):
    if type(m) == type(()): m = m[1]
    art = m['art']
    a = ['ABILITY', 'SKILL'].index(m['pieceType'])
    b = ['ALL', 'TARGET', 'SELF', 'CONNECT', 'ONE', 'DYING'].index(art['targetId'])
    c = 0 if 'enableTurn' not in art.keys() else -art['enableTurn']
    d = ['RANK_4', 'RANK_3', 'RANK_2', 'RANK_1'].index(m['rank'])
    return d + 4*(c + 10*(b + 6*a))

def table_row(icon, name, data, column_certain=False, bad_target=None, mark_chara=False):
    text = '|-\n| '
    if len(icon) > 0:
        if type(icon) != type([]):
            text += '[[文件:%s|30px]]' % icon
        else:
            for i in icon:
                text += '[[文件:%s|30px]]' % i
    text += ' || '
    if len(name) > 0: text += name
    for cell in data:
        text += ' || '
        # if len(cell) > 0:
            # text += 'style="padding: 0;" | '
        cell.sort(key=memoriaSort)
        for memo in cell:
            rubyValue = None
            if type(memo) == type(()):
                rubyValue = memo[0]
                memo = memo[1]
            uText = '{{记忆数据表/%s|icon|35px}}' % get_name(memo)
            style = ''
            boxShadow = []
            if 'enableTurn' in memo['art'].keys() and memo['art']['enableTurn'] > 1:
                boxShadow.append('2px 2px 6px #00f')
            if memo['art']['targetId'] == bad_target:
                boxShadow.append('2px 0 15px #000, 0 2px 15px #000')
            if memo['art']['targetId'] == 'ALL':
                # boxShadow.append('0 0 25px #da0')
                boxShadow.append('0 2px 15px #f80, 0 -2px 15px #f80, -2px 0 15px #f80, 2px 0 15px #f80')
            if len(boxShadow) > 0:
                style += 'margin: 2px; box-shadow: %s; ' % ', '.join(boxShadow)
            if 'charaList' in memo.keys():
                style += 'border: 2px solid #0f0;'
            if style != '':
                uText = '<div style="display: inline-block; width: 35px; height: 35px; %s">%s</div>' % (style, uText)
            if not rubyValue and mark_chara and 'charaList' in memo.keys():
                rubyValue = '、'.join([c['name'] for c in memo['charaList']])
            if rubyValue:
                text += '{{Ruby|1=%s|2=%s}}' % (uText, rubyValue)
            else:
                text += uText
            
    text += '\n'
    return text

def get_name(memo):
    if memo['pieceId'] == 1001:
        return memo['pieceName'] + ' (1)'
    elif memo['pieceId'] == 1002:
        return memo['pieceName'] + ' (2)'
    else:
        return memo['pieceName']

def table_footer():
    return '|}\n'

def check(memo, condition):
    if 'pieceSkill2' not in memo.keys(): return False
    for key, art in memo['pieceSkill2'].items():
        if key[:3] == 'art' and key[:5] != 'artId':
            checked = True
            for cKey, cValue in condition.items():
                if cKey != 'EXCEPT':
                    if cKey not in art.keys() or art[cKey] != cValue:
                        checked = False
                else:
                    for cKey2, cValue2 in cValue.items():
                        if cKey2 in art.keys() and art[cKey2] == cValue2:
                            cheched = False
            if checked:
                memo['art'] = art
                return True
    return False

def select(baseMemoria, pieceType, mFilters):
    if pieceType:
        memoria = [v for k, v in baseMemoria.items() if 'pieceType' in v.keys() and v['pieceType']==pieceType and check(v, mFilters)]
    else:
        memoria = [v for k, v in baseMemoria.items() if check(v, mFilters)]
    return memoria

def seperate(baseMemoria, columnKey, columnValues, percentage=True):
    columns = []
    if columnKey == 'probability':
        cell = [memo for memo in baseMemoria if memo['art']['probability'] == 1000]
        baseMemoria[:] = [memo for memo in baseMemoria if memo not in cell]
        columns.append(cell)
    for v in columnValues:
        cell = [memo for memo in baseMemoria if memo['art'][columnKey] == v]
        baseMemoria[:] = [memo for memo in baseMemoria if memo not in cell]
        columns.append(cell)
    if percentage:
        cell = [('%g%%' % (memo['art'][columnKey]/10), memo) for memo in baseMemoria]
    else:
        cell = [('%g' % (memo['art'][columnKey]/10), memo) for memo in baseMemoria]
    columns.append(cell)
    return columns

def png(num):
    return "Icon skill %g.png" % num

def active_ailments(memoria, effectCode, name, icon, columns):
    data = seperate(select(memoria, 'SKILL', {"verbCode": "CONDITION_BAD", "effectCode": effectCode}), 'probability', columns)
    problematic = select(memoria, 'ABILITY', {"verbCode": "CONDITION_BAD", "effectCode": effectCode})
    if len(problematic) > 0:
        print("Unexpected type: passive CONDITION_BAD " + effectCode)
        for memo in problematic:
            print(str(memo['pieceId'])+' '+memo['pieceName'])
    return table_row(icon, name, data, column_certain=True, bad_target='SELF')

def passive_ailments(memoria, effectCode, name, icon, columns):
    data = seperate(select(memoria, 'ABILITY', {"verbCode": "ENCHANT", "effectCode": effectCode}), 'probability', columns)
    problematic = select(memoria, 'SKILL', {"verbCode": "ENCHANT", "effectCode": effectCode})
    if len(problematic) > 0:
        print("Unexpected type: active ENCHANT " + effectCode)
        for memo in problematic:
            print(str(memo['pieceId'])+' '+memo['pieceName'])
    return table_row(icon, name, data, column_certain=True)

def ignore(memoria, effectCode, name, icon, columns):
    data = seperate(select(memoria, '', {"verbCode": "IGNORE", "effectCode": effectCode}), 'probability', columns)
    return table_row(icon, name, data, column_certain=True, bad_target='TARGET')

def condition_good_p(memoria, effectCode, name, icon, columns, percentage=True):
    data = seperate(select(memoria, '', {"verbCode": "CONDITION_GOOD", "effectCode": effectCode}), 'probability', columns, percentage=percentage)
    return table_row(icon, name, data, column_certain=True, bad_target='TARGET')

def condition_good_v(memoria, effectCode, name, icon, columns, percentage=True):
    data = seperate(select(memoria, '', {"verbCode": "CONDITION_GOOD", "effectCode": effectCode}), 'effectValue', columns, percentage=percentage)
    return table_row(icon, name, data, bad_target='TARGET')

def buff(memoria, effectCode, name, icon, columns, pieceType=''):
    data = seperate(select(memoria, pieceType, {"verbCode": "BUFF", "effectCode": effectCode}), 'effectValue', columns)
    return table_row(icon, name, data, bad_target='TARGET')

def debuff(memoria, effectCode, name, icon, columns, pieceType=''):
    data = seperate(select(memoria, pieceType, {"verbCode": "DEBUFF", "effectCode": effectCode}), 'effectValue', columns)
    return table_row(icon, name, data, bad_target='SELF')

def draw(memoria, effectCode, name, icon):
    data = seperate(select(memoria, 'SKILL', {"verbCode": "DRAW", "effectCode": effectCode}), 'probability', [])
    return table_row(icon, name, data, column_certain=True, mark_chara=True)

def sanityCheck(memo):
    try:
        if 'pieceId' not in memo.keys():
            raise Exception('Unexpected: pieceId key not found in:', memo)
        if 'pieceName' not in memo.keys():
            raise Exception('Unexpected: pieceName key not found in:', memo)
        pieceId = memo['pieceId']
        pieceName = memo['pieceName']
        if 'pieceType' not in memo.keys():
            raise Exception('Unexpected: pieceType key not found in %g %s' % (pieceId, pieceName))
        pieceType = memo['pieceType']
        if pieceType != 'SKILL' and pieceType != 'ABILITY':
            raise Exception('Unexpected: pieceType value %s in %g %s' % (pieceType, pieceId, pieceName))
        if 'pieceSkill2' not in memo.keys():
            raise Exception('Unexpected: pieceSkill2 key not found in %g %s' % (pieceId, pieceName))
        hasArt = False
        for key, art in memo['pieceSkill2'].items():
            if key[:3] == 'art' and key[:5] != 'artId':
                hasArt = True
                if 'verbCode' not in art.keys():
                    raise Exception('Unexpected: missing verbCode for %s in %g %s' % (key, pieceId, pieceName))
                if 'effectCode' not in art.keys():
                    raise Exception('Unexpected: missing effectCode for %s in %g %s' % (key, pieceId, pieceName))
                verbCode = art['verbCode']
                effectCode = art['effectCode']
                if verbCode == 'BUFF' or verbCode == 'DEBUFF' or verbCode == 'BUFF_HPMAX' or verbCode == 'BUFF_DYING' or verbCode == 'BUFF_DIE':
                    if effectCode not in ['ATTACK', 'DEFENSE', 'DAMAGE', 'ACCEL', 'BLAST', 'CHARGE', 'MAGIA', 'MP_GAIN', 'RESIST']:
                        raise Exception('Unexpected: %s %s for %s in %g %s' % (verbCode, effectCode, key, pieceId, pieceName))
                    if verbCode == 'DEBUFF' and effectCode == 'CHARGE':
                        raise Exception('Report: %s %s realized for %s in %g %s' % (verbCode, effectCode, key, pieceId, pieceName))
                    if verbCode in ['BUFF_HPMAX', 'BUFF_DYING', 'BUFF_DIE'] and effectCode not in ['ATTACK', 'DEFENSE']:
                        raise Exception('Report: %s %s realized for %s in %g %s' % (verbCode, effectCode, key, pieceId, pieceName))
                elif verbCode == 'CONDITION_BAD' or verbCode == 'ENCHANT':
                    if effectCode not in ["CHARM", "STUN", "RESTRAINT", "POISON", "BURN", "CURSE", "FOG", "DARKNESS", "BLINDNESS", "BAN_SKILL", "BAN_MAGIA"]:
                        raise Exception('Unexpected: %s %s for %s in %g %s' % (verbCode, effectCode, key, pieceId, pieceName))
                    if verbCode == 'CONDITION_BAD' and pieceType == 'ABILITY':
                        raise Exception('Unexpected: ABILITY (passive) CONDITION_BAD %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                    if verbCode == 'ENCHANT' and pieceType == 'SKILL':
                        raise Exception('Unexpected: SKILL (active) ENCHANT %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                elif verbCode == 'CONDITION_GOOD':
                    if effectCode not in ["DAMAGE_UP", "DAMAGE_UP_BAD", "DAMAGE_DOWN", "DAMAGE_DOWN_BLAST", "DAMAGE_DOWN_NODISK", "CRITICAL", "DEFENSE_IGNORED", "AVOID", "COUNTER", "PROVOKE",  "PROTECT", "PURSUE", "GUTS", "SKILL_QUICK", "C_COMBO_PLUS", "AUTO_HEAL", "MP_PLUS_WEAKED", "MP_PLUS_BLAST"]:
                        raise Exception('Unexpected: CONDITION_GOOD %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                elif verbCode == 'IGNORE':
                    if effectCode not in ["DAMAGE_DOWN", "AVOID", "COUNTER", "PROVOKE", "CHARM", "STUN", "RESTRAINT", "POISON", "BURN", "CURSE", "FOG", "DARKNESS", "BLINDNESS", "BAN_SKILL", "BAN_MAGIA", "DEBUFF"]:
                        raise Exception('Unexpected: IGNORE %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                elif verbCode == 'HEAL':
                    if effectCode not in ['HP', 'MP', 'MP_DAMAGE']:
                        raise Exception('Unexpected: HEAL %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                    if pieceType == 'ABILITY':
                        raise Exception('Unexpected: ABILITY (passive) HEAL %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                elif verbCode == 'DRAW':
                    if effectCode not in ["AGAIN", "CHARACTER", "ACCEL", "BLAST", "CHARGE", "ALIGNMENT"]:
                        raise Exception('Unexpected: DRAW %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                    if pieceType == 'ABILITY':
                        raise Exception('Unexpected: ABILITY (passive) DRAW %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                elif verbCode == 'REVOKE':
                    if effectCode not in ["BAD", "DEBUFF", "BUFF", "CONDITION_GOOD"]:
                        raise Exception('Unexpected: REVOKE %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                    if pieceType == 'ABILITY':
                        raise Exception('Unexpected: ABILITY (passive) REVOKE %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                elif verbCode == 'INITIAL':
                    if effectCode != "MP":
                        raise Exception('Unexpected: INITIAL %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                elif verbCode == 'OTHER':
                    if effectCode not in ['EPISODE_UP', 'GOLD_UP']:
                        raise Exception('Unexpected: OTHER %s for %s in %g %s' % (effectCode, key, pieceId, pieceName))
                else:
                    raise Exception('Unexpected: %s %s for %s in %g %s' % (verbCode, effectCode, key, pieceId, pieceName))
    except Exception as e:
        if len(e.args) == 2:
            print(e.args[0])
            print(e.args[1])
        else:
            print(e)

def main():
    memoria = read_json(MEMORIA_JSON)
    wikitext = ""
    
    wikitext += "\n===攻击系===\n"
    columns = range(550, 100-50, -50)
    wikitext += table_header(columns, column_certain=True)
    wikitext += condition_good_p(memoria, "CRITICAL", "暴击", png(1121), columns)
    wikitext += condition_good_p(memoria, "DEFENSE_IGNORED", "无视防御", png(1123), columns)
    columns = range(750, 300-50, -50)
    wikitext += table_caption(columns, column_certain=True)
    wikitext += ignore(memoria, "DAMAGE_DOWN", "无视伤害削减", png(1177), columns)
    wikitext += table_footer()
    
    columns = range(500, 50-50, -50)
    wikitext += table_header(columns)
    wikitext += buff(memoria, "ATTACK", "攻击力UP", png(1085), columns)
    wikitext += debuff(memoria, "DEFENSE", "防御力DOWN", png(1095), columns)
    wikitext += buff(memoria, "DAMAGE", "造成伤害UP", png(1087), columns)
    wikitext += condition_good_v(memoria, "DAMAGE_UP", "伤害上升状态", png(1119), columns)
    wikitext += condition_good_v(memoria, "DAMAGE_UP_BAD", "敌方状态异常时伤害上升", png(1172), columns)
    wikitext += table_caption(columns)
    wikitext += table_footer()
    
    columns = range(600, 150-50, -50)
    wikitext += table_header(columns)
    wikitext += buff(memoria, "BLAST", "Blast伤害UP", png(1092), columns)
    columns = range(275, 50-25, -25)
    wikitext += table_caption(columns)
    wikitext += buff(memoria, "CHARGE", "Charge后伤害UP", png(1091), columns)
    wikitext += buff(memoria, "MAGIA", "Magia伤害UP", png(1088), columns)
    columns = range(500, 50-50, -50)
    wikitext += table_caption(columns)
    wikitext += table_row(png(1085), "HP最大时攻击力UP", seperate(select(memoria, '', {"verbCode": "BUFF_HPMAX", "effectCode": "ATTACK"}), 'effectValue', columns), bad_target='TARGET')
    wikitext += table_row(png(1085), "濒死时攻击力UP", seperate(select(memoria, '', {"verbCode": "BUFF_DYING", "effectCode": "ATTACK"}), 'effectValue', columns), bad_target='TARGET')
    wikitext += table_row(png(1085), "战斗不能时获得攻击力UP(己全)", seperate(select(memoria, '', {"verbCode": "BUFF_DIE", "effectCode": "ATTACK"}), 'effectValue', columns))
    wikitext += table_footer()
    
    wikitext += "\n===防守系===\n"
    columns = range(750, 75-75, -75)
    wikitext += table_header(columns)
    wikitext += buff(memoria, "DEFENSE", "防御力UP", png(1086), columns)
    columns = range(500, 50-50, -50)
    wikitext += table_caption(columns)
    wikitext += debuff(memoria, "ATTACK", "攻击力DOWN", png(1094), columns)  # 按数值合并了主动3T而非按等级
    wikitext += debuff(memoria, "DAMAGE", "造成伤害DOWN", png(1096), columns)  # 按数值合并了主动3T而非按等级
    wikitext += debuff(memoria, "MAGIA", "Magia伤害DOWN", png(1097), columns)
    wikitext += condition_good_v(memoria, "DAMAGE_DOWN", "伤害削减", png(1120), columns)
    wikitext += condition_good_v(memoria, "DAMAGE_DOWN_BLAST", "Blast伤害削减", png(1202), columns)
    wikitext += condition_good_v(memoria, "DAMAGE_DOWN_NODISK", "Magia伤害削减状态", png(1205), columns)
    columns = range(275, 200-25*7, -25)
    wikitext += table_caption(columns)
    wikitext += debuff(memoria, "BLAST", "Blast伤害DOWN", png(1101), columns)
    columns = range(1000, 100-100, -100)
    wikitext += table_caption(columns)
    wikitext += table_row(png(1086), "HP最大时防御力UP", seperate(select(memoria, '', {"verbCode": "BUFF_HPMAX", "effectCode": "DEFENSE"}), 'effectValue', columns), bad_target='TARGET')
    columns = range(1100, 200-100, -100)
    wikitext += table_caption(columns)
    wikitext += table_row(png(1086), "濒死时防御力UP", seperate(select(memoria, '', {"verbCode": "BUFF_DYING", "effectCode": "DEFENSE"}), 'effectValue', columns), bad_target='TARGET')
    wikitext += table_row(png(1086), "战斗不能时获得防御力UP(己全)", seperate(select(memoria, '', {"verbCode": "BUFF_DIE", "effectCode": "DEFENSE"}), 'effectValue', columns))
    wikitext += table_footer()
    
    wikitext += "\n===MP获取与阻碍===\n"
    columns = range(325, 100-25, -25)
    wikitext += table_header(columns)
    wikitext += buff(memoria, "ACCEL", "Accele MPUP", png(1090), columns)
    columns = range(275, 50-25, -25)
    wikitext += table_caption(columns)
    wikitext += buff(memoria, "MP_GAIN", "MP获得量UP", png(1093), columns)
    wikitext += table_footer()
    
    columns = [150, 100]
    wikitext += table_header(columns, table_style=None)
    wikitext += table_row(png(1130), "战斗开始时拥有一定MP", seperate(select(memoria, '', {"verbCode": "INITIAL", "effectCode": "MP"}), 'effectValue', columns))
    columns = [180, 100]
    wikitext += table_caption(columns, percentage=False)
    wikitext += table_row(png(1079), "回复MP", seperate(select(memoria, '', {"verbCode": "HEAL", "effectCode": "MP"}), 'effectValue', columns, percentage=False))
    columns = [30]
    wikitext += table_caption(columns, percentage=False)
    wikitext += table_row(png(1180), "自动回复MP", seperate(select(memoria, '', {"verbCode": "CONDITION_GOOD", "effectCode": "AUTO_HEAL", "genericValue": "MP"}), 'effectValue', columns, percentage=False))
    columns = range(110, 20-10, -10)
    wikitext += table_caption(columns, percentage=False)
    wikitext += condition_good_v(memoria, "MP_PLUS_WEAKED", "被弱点属性攻击时MPUP", png(1132), columns, percentage=False)
    columns = range(100, 10-10, -10)
    wikitext += table_caption(columns, percentage=False)
    wikitext += condition_good_v(memoria, "MP_PLUS_BLAST", "Blast攻击时MP获得", png(1225), columns, percentage=False)
    columns = range(550, 100-50, -50)
    wikitext += table_caption(columns)
    wikitext += debuff(memoria, "MP_GAIN", "MP获得量DOWN", png(1102), columns)
    columns = [275]
    wikitext += table_caption(columns)
    wikitext += debuff(memoria, "ACCEL", "Accele MP DOWN", png(1099), columns)
    columns = [300]
    wikitext += table_caption(columns, percentage=False)
    wikitext += table_row('', "MP伤害", seperate(select(memoria, '', {"verbCode": "HEAL", "effectCode": "MP_DAMAGE"}), 'effectValue', columns, percentage=False), bad_target='SELF')
    wikitext += table_footer()
    
    wikitext += "\n===异常、抗异常===\n"
    ailmentEffectCodes = ["CHARM", "STUN", "RESTRAINT", "POISON", "BURN", "CURSE", "FOG", "DARKNESS", "BLINDNESS", "BAN_SKILL", "BAN_MAGIA"]
    ailmentNames = ["魅惑", "眩晕", "拘束", "毒", "烧伤", "诅咒", "雾", "黑暗", "幻惑", "技能封印", "Magia封印"]
    icons = [png(i) for i in range(1103, 1114)]
    columns = range(525, 300-25, -25)
    wikitext += table_header(columns, column_certain=True)
    wikitext += ''.join([active_ailments(memoria, *i, columns) for i in zip(ailmentEffectCodes, ["主动"+x for x in ailmentNames], icons)])
    wikitext += table_caption(columns, column_certain=True)
    wikitext += table_footer()
    
    icons = [png(i) for i in range(1145, 1155)] + [""]
    columns = range(550, 100-50, -50)
    # columns = range(450, 150-50, -50) # 减少无用纵栏时使用
    wikitext += table_header(columns, column_certain=True)
    wikitext += ''.join([passive_ailments(memoria, *i, columns) for i in zip(ailmentEffectCodes, ["攻击时概率给予"+x for x in ailmentNames], icons)])
    wikitext += table_caption(columns, column_certain=True)
    wikitext += table_footer()
    
    icons = [png(i) for i in list(range(1136, 1145))+[1183, 1155]]
    columns = range(700, 250-50, -50)
    # columns = range(700, 650-50, -50) # 减少无用纵栏时使用
    wikitext += table_header(columns, column_certain=True)
    wikitext += ''.join([ignore(memoria, *i, columns) for i in zip(ailmentEffectCodes, ["概率"+x+"无效" for x in ailmentNames], icons)])
    wikitext += table_caption(columns, column_certain=True)
    wikitext += table_footer()
    
    columns = range(650, 200-50, -50)
    wikitext += table_header(columns)
    wikitext += buff(memoria, "RESIST", "状态异常耐性UP", png(1089), columns)
    columns = range(275, 50-25, -25)
    wikitext += table_caption(columns)
    wikitext += debuff(memoria, "RESIST", "状态异常耐性DOWN", png(1098), columns)
    wikitext += table_footer()
    
    wikitext += "\n===特殊行动、特殊对策===\n"
    columns = range(550, 100-50, -50)
    # columns = range(550, 150-50, -50) # 减少无用纵栏时使用
    wikitext += table_header(columns, column_certain=True)
    wikitext += condition_good_p(memoria, "AVOID", "回避", png(1124), columns)
    wikitext += condition_good_p(memoria, "COUNTER", "反击", png(1125), columns)
    wikitext += condition_good_p(memoria, "PROVOKE", "挑衅", png(1128), columns)
    wikitext += condition_good_p(memoria, "PROTECT", "保护", png(1170), columns)
    data = seperate(select(memoria, 'SKILL', {"verbCode": "CONDITION_GOOD", "effectCode": "PURSUE"}), 'probability', columns)
    wikitext += table_row(png(1126), "追击(主动)", data, column_certain=True)
    columns = range(120, 30-10, -10)
    # columns = range(120, 40-10, -10) # 减少无用纵栏时使用
    wikitext += table_caption(columns, column_certain=True)
    data = seperate(select(memoria, 'ABILITY', {"verbCode": "CONDITION_GOOD", "effectCode": "PURSUE"}), 'probability', columns)
    wikitext += table_row(png(1126), "追击(被动)", data, column_certain=True)
    wikitext += table_footer()
    
    columns = range(850, 500-50, -50)
    wikitext += table_header(columns, column_certain=True)
    wikitext += ignore(memoria, "AVOID", "回避无效", png(1134), columns)  # 这里使用了非I级至X级横坐标,并且按数值合并而非按等级合并
    wikitext += ignore(memoria, "COUNTER", "反击无效", png(1135), columns)  # 这里使用了非I级至X级横坐标,并且按数值合并而非按等级合并
    wikitext += ignore(memoria, "PROVOKE", "无视挑衅", png(1219), columns)  # 这里使用了非I级至X级横坐标,并且按数值合并而非按等级合并
    wikitext += table_footer()
    
    wikitext += "\n===重抽盘===\n"
    wikitext += table_header([], column_certain=True, icon_width='150px', table_style=None)
    wikitext += draw(memoria, "AGAIN", "重抽盘", png(1169))
    wikitext += draw(memoria, "CHARACTER", "重抽自己盘", [png(1161), png(1162), png(1163), png(1164), png(1165)])
    wikitext += draw(memoria, "ACCEL", "重抽Accele盘", png(1166))
    wikitext += draw(memoria, "BLAST", "重抽Blast盘", png(1168))
    wikitext += draw(memoria, "CHARGE", "重抽Charge盘", png(1167))
    wikitext += draw(memoria, "ALIGNMENT", "重抽同属性盘", [png(1156), png(1157), png(1158), png(1159), png(1160)])
    wikitext += table_footer()
    
    wikitext += "\n===回复、状态恢复===\n"
    columns = range(525, 300-25, -25)
    wikitext += table_header(columns, percentage=False)
    wikitext += table_row(png(1078), "回复HP", seperate(select(memoria, '', {"verbCode": "HEAL", "effectCode": "HP"}), 'effectValue', columns, percentage=False), bad_target='TARGET')
    columns = range(110, 20-10, -10)
    wikitext += table_caption(columns, percentage=False)
    wikitext += table_row(png(1129), "自动回复HP", seperate(select(memoria, '', {"verbCode": "CONDITION_GOOD", "effectCode": "AUTO_HEAL", "EXCEPT": {"genericValue": "MP"}}), 'effectValue', columns, percentage=False), bad_target='TARGET')
    wikitext += table_footer()
    
    wikitext += table_header([], table_style=None)
    wikitext += table_row(png(1084), "状态异常解除", [select(memoria, 'SKILL', {"verbCode": "REVOKE", "effectCode": "BAD"})], bad_target='TARGET')
    wikitext += table_row(png(1082), "Debuff解除", [select(memoria, 'SKILL', {"verbCode": "REVOKE", "effectCode": "DEBUFF"})], bad_target='TARGET')
    wikitext += table_row(png(1081), "Buff解除", [select(memoria, 'SKILL', {"verbCode": "REVOKE", "effectCode": "BUFF"})], bad_target='SELF')
    wikitext += table_row(png(1083), "状态强化解除", [select(memoria, 'SKILL', {"verbCode": "REVOKE", "effectCode": "CONDITION_GOOD"})], bad_target='SELF')
    wikitext += table_footer()
    
    wikitext += "\n===其他===\n"
    wikitext += table_header([], column_certain=True, table_style=None)
    wikitext += condition_good_p(memoria, "GUTS", "忍耐", png(1127), [])
    wikitext += condition_good_p(memoria, "SKILL_QUICK", "技能冷却加速", png(1131), [])
    wikitext += ignore(memoria, "DEBUFF", "Debuff无效", png(1218), [])
    wikitext += table_footer()
    
    wikitext += table_header([20], percentage=False, table_style=None)  # 数值本身是2000,不同于MP数值2000代表2000/10=200pt,此处应代表2层combo=20/10
    wikitext += condition_good_v(memoria, "C_COMBO_PLUS", "Charge combo时Charge数增加", png(1217), [2000])
    wikitext += table_footer()
    
    columns = range(200, 50-50, -50)
    wikitext += table_header(columns, table_style=None)
    wikitext += table_row(png(1173), "获得篇章点UP", seperate(select(memoria, '', {"verbCode": "OTHER", "effectCode": "EPISODE_UP"}), 'effectValue', columns))
    wikitext += table_row(png(1175), "CC获得量UP", seperate(select(memoria, '', {"verbCode": "OTHER", "effectCode": "GOLD_UP"}), 'effectValue', columns))
    wikitext += table_footer()
    
    
    write_wiki(OUTPUT, wikitext)
    print("wikitext written")
    
    print("proceed to sanity check")
    for k, v in memoria.items():
        sanityCheck(v)


if __name__ == '__main__':
    main()