# 第八幕全部房间模板（宽 16）。tpl_check.py 读取本文件校验；设计书里的 ASCII 由 gen_md 生成。
D = '................'
def pad(rows, n):
    return rows + [D] * (n - len(rows))

# ---------------- 8-1 倒穹裂原（双层）
A1_UP = pad(['................','................','..R..........R..','................','...~~~....~~~...','...~o~....~o~...','...~~~....~~~...','................',
 '.R....#..#....R.','................','......~~~~......','..##..~oo~..##..','......~~~~......','................','.~~~...RR...~~~.','.~~~........~~~.',
 '................','....R......R....','................','..~~~~....~~~~..','..~~~~.##.~~~~..','................','.R............R.','................','......~~~~......'], 30)
A1_LO = pad(['................','................','.##..........##.','................','................','.#............#.','................','.....U....U.....',
 '..#..........#..','................','#..............#','#....R....R....#','................','...##......##...','................','................',
 '......#..#......','................','..U..........U..','................','.......##.......','................','.##..........##.','................','................','.....R....R.....'], 30)
B1_UP = pad(['................','................','.R....R..R....R.','................','##....~~~~....##','......~~~~......','..R...~~~~...R..','......~~~~......',
 '##....~~~~....##','................','...~~......~~...','...~o......o~...','...~~..RR..~~...','................','#####.~~~~.#####','......~~~~......',
 '................','.R....R..R....R.','................','.~~~~......~~~~.','.~oo~..##..~oo~.','.~~~~......~~~~.','................','................',
 '...####..####...','................','......~~~~......','.R............R.'], 32)
B1_LO = pad(['................','................','..#..........#..','................','.#............#.','................','................','..U..........U..',
 '................','....##....##....','................','................','#......##......#','................','................','................',
 '..###......###..','................','................','................','................','................','......U..U......','................',
 '.##..........##.','................','................','....R......R....'], 32)
C1_UP = pad(['................','................','..R..........R..','................','................','.....~~~~~~.....','.....~~oo~~.....','.....~~~~~~.....',
 '................','................','.R............R.','................','....R......R....','................','................','...~~~....~~~...',
 '...~~~....~~~...','................','................','.R............R.'], 30)
C1_LO = pad(['................','................','................','..##........##..','................','................','................','................',
 '................','...U........U...','................','..#..........#..','................','................','................','................',
 '................','.##..........##.'], 30)
BOSS1_UP = pad(['................','................','................','................','.R............R.','................','...~~~~~~~~~~...','...~~~~~~~~~~...',
 '...~~......~~...','...~~..RR..~~...','...~~......~~...','...~~~~~~~~~~...','...~~~~~~~~~~...','................','.R............R.'], 22)
BOSS1_LO = pad(['................','................','................','................','..#..........#..','................','................','................',
 '.U............U.','................','................','................','................','................','..#..........#..'], 22)

# ---------------- 8-2 碎陆拼廊（拼接段）
SLABS2 = {
 'a': ['................','..R..........R..','................','xxxx..xxxx..xxxx','xxxx..xxxx..xxxx','................','.....R....R.....','................','..x..........x..','................'],
 'b': ['................','.R....R..R....R.','................','...##......##...','................','......xxxx......','......xxxx......','................','...##......##...','.R............R.','................'],
 'c': ['................','................','xx....xxxx....xx','xx.R..xxxx..R.xx','xx....xxxx....xx','................','................','.xxxx...........','.xxxx..RR.......','................','................'],
 'd': ['................','..R..........R..','................','xxxxx......xxxxx','xxxxx..R...xxxxx','xxxxx......xxxxx','................','................','.R...xx.......R.','.....xx.........','................','................'],
 'e': ['................','................','.xxx..R..R..xxx.','.xxx........xxx.','................','....xx....xx....','....xx....xx....','................','..R..........R..','................'],
 'f': ['................','................','.R..xxxxxxxx..R.','....xxxxxxxx....','................','................','xx..R......R....','xx..............','................','.....##..##.....','................','................'],
}
BOSS2 = pad(['................','................','................','.R............R.','................','...xx......xx...','...xx......xx...','................','......R..R......','................','................',
 '................','................','......R..R......','................','...xx......xx...','...xx......xx...','................','.R............R.'], 22)

# ---------------- 8-3 星象废台（天象）
A3 = pad(['................','................','..R..........R..','................','....+..++..+....','................','.#............#.','.#..+..S...+..#.','.#............#.','................',
 '..++........++..','................','.....R....R.....','................','+..............+','...xxx....xxx...','...xxx....xxx...','+..............+','................','.....R....R.....',
 '................','..++...++...++..','................','.R............R.','................','......+..+......'], 32)
B3 = pad(['................','................','.R............R.','................','...##......##...','................','.....++++++.....','....+......+....','....+..S...+....','....+......+....',
 '.....++++++.....','................','##....R..R....##','................','................','..+..xx..xx..+..','..+..xx..xx..+..','................','.R............R.','................',
 '...+++....+++...','................','......####......','................','.+............+.','................','....R......R....'], 34)
C3 = pad(['................','................','..R..........R..','................','................','.......S........','................','....+......+....','................','..+....++....+..',
 '................','.R............R.','................','.....+....+.....','................','..#..........#..','................','...+........+...'], 30)
BOSS3 = pad(['................','................','................','................','.S............S.','................','....+......+....','................','..+...R..R...+..','................',
 '.......++.......','................','..+...R..R...+..','................','....+......+....','................','.S............S.'], 22)

# ---------------- 8-4 重力坟场（引力井 + 翻转）
A4 = pad(['................','................','.R....##........','................','...O.........R..','................','.......###......','..R.............','..........O.....','................',
 '####............','................','.....R.....xxx..','...........xxx..','................','................','........R...##..','................','.xxx............','.xxx.....O......',
 '................','..##.......R....','................','.......R........','................','.R..........O...'], 32)
B4 = pad(['................','................','..R.........R...','................','.......O........','................','#####.......####','................','...R......xx....','..........xx..R.',
 '................','.O..............','................','......####......','................','..xx........O...','..xx............','................','.R.....R........','................',
 '#####.....######','................','.........R......','...O............','................','..........##....','.R..............'], 34)
C4 = pad(['................','................','..R..........R..','................','................','..........O.....','................','.R..............','................','....##......R...',
 '................','................','...O............','................','..........##....','.R..............','................','.........R......'], 30)
BOSS4 = pad(['................','................','................','..O.........R...','................','................','.....R..........','................','...........O....','................',
 '................','..O.............','................','..........R.....','................','................','.R..........O...'], 22)

# ---------------- 8-5 坠天长阶（收缩 + 追逐）
A5 = pad(['................','................','..#..........#..','................','...Y........Y...','................','.....xx..xx.....','.....xx..xx.....','................','..R..........R..',
 '................','......####......','................','...xx......xx...','...xx......xx...','................','................','.R...R....R...R.','................','................',
 '....xxx..xxx....','................','...Y........Y...','................','.##..........##.','................','.....R....R.....'], 34)
B5 = pad(['................','................','.R............R.','................','....##....##....','................','...Y........Y...','................','...xxxx..xxxx...','................',
 '.......R........','................','..R..........R..','................','.xxxx......xxxx.','.xxxx......xxxx.','................','......R..R......','................','....Y......Y....',
 '................','##...xx..xx...##','................','.R............R.','................','.....xxxxxx.....','................','................','................','..R..........R..'], 36)
C5 = pad(['................','................','..R..........R..','................','................','....Y......Y....','................','................','.....xx..xx.....','................',
 '................','..R..........R..','................','................','......R..R......','................','....Y......Y....'], 30)
BOSS5A = pad(['................','................','................','..R..........R..','................','.....xx..xx.....','................','................','...R........R...','................',
 '......xxxx......','................','...R........R...','................','................','.....xx..xx.....','................','..R..........R..'], 22)
BOSS5B = pad(['................','................','................','................','...Y........Y...','................','................','......R..R......','................','................',
 '................','................','......R..R......','................','................','...Y........Y...'], 22)

# ---------------- 8-6 坠天之心（全组合）
A6_UP = pad(['................','................','.R............R.','................','....~~~..~~~....','....~o~..~o~....','....~~~..~~~....','................','..##...S....##..','................',
 '.~~~........~~~.','.~~~..+..+..~~~.','.~~~........~~~.','................','......R..R......','................','..+..~~~~~~..+..','.....~~oo~~.....','.....~~~~~~.....','................',
 '.R............R.','................','...##......##...','................','.....~~..~~.....','................','..R..........R..'], 32)
A6_LO = pad(['................','................','..#..........#..','................','................','................','................','.......O........','................','..U..........U..',
 '................','................','................','....##....##....','................','................','................','................','................','................',
 '...O........O...','................','.......UU.......','................','................','................','.##..........##.'], 32)
SLABS6 = {
 'g': ['................','.R....+..+....R.','................','xxx..........xxx','xxx...Y..Y...xxx','xxx..........xxx','................','....R......R....','................','..+..........+..','................'],
 'h': ['................','................','...##......##...','................','......xxxx......','..O...xxxx......','......xxxx...O..','................','................','.R....S.......R.','................','................'],
 'i': ['................','................','..xxx......xxx..','..xxx..R...xxx..','................','................','.+....R..R....+.','................','...##......##...','................','................'],
}
C6 = pad(['................','................','..R..........R..','................','......+..+......','................','...O........R...','................','................','.R....R..R....R.',
 '................','................','..+..........+..','................','.....xx..xx.....','................','................','.R............R.'], 30)
BOSS6_UP = pad(['................','................','................','................','.K............K.','................','....~~~~~~~~....','...~~~~~~~~~~...','...~~~.HH.~~~...','...~~~~~~~~~~...',
 '....~~~~~~~~....','................','..R..........R..','................','.K............K.'], 22)
BOSS6_LO = pad(['................','................','................','................','..#..........#..','................','................','................','.U............U.','................',
 '................','......R..R......','................','................','..#..........#..'], 22)
BOSS6_WELL = pad(['................','................','................','................','...K..O..O..K...','................','................','...R........R...','................','................',
 '................','................','................','................','...R........R...','................','................','...K..O..O..K...'], 22)

CHAPTERS = [
 {'id': '8-1', 'tpls': [
   {'name': '模板 A「裂穹原」', 'kind': 'double', 'up': A1_UP, 'low': A1_LO},
   {'name': '模板 B「穹骨廊」', 'kind': 'double', 'up': B1_UP, 'low': B1_LO},
   {'name': '模板 C「坠光坡」（入口）', 'kind': 'double', 'up': C1_UP, 'low': C1_LO},
   {'name': '首领房「碎穹台」', 'kind': 'segments', 'boss': True, 'segs': [{'kind': 'double', 'up': BOSS1_UP, 'low': BOSS1_LO}]},
 ]},
 {'id': '8-2', 'slabs': SLABS2, 'tpls': [
   {'name': '模板 A「碎陆拼廊」', 'kind': 'splice', 'seq': ['a', 'b', 'c'], 'pool': ['e']},
   {'name': '模板 B「断崖拼廊」', 'kind': 'splice', 'seq': ['d', 'c', 'f'], 'pool': ['b']},
   {'name': '模板 C「落陆坡」（入口）', 'kind': 'splice', 'seq': ['e', 'b', 'a'], 'pool': []},
   {'name': '首领房「拼天台」', 'kind': 'segments', 'boss': True, 'segs': [{'g': BOSS2, 'morph': ['swap11']}]},
 ]},
 {'id': '8-3', 'tpls': [
   {'name': '模板 A「星位台」', 'kind': 'single', 'g': A3},
   {'name': '模板 B「天轨环」', 'kind': 'single', 'g': B3},
   {'name': '模板 C「观星坡」（入口）', 'kind': 'single', 'g': C3},
   {'name': '首领房「司天台」', 'kind': 'segments', 'boss': True, 'segs': [{'g': BOSS3}]},
 ]},
 {'id': '8-4', 'tpls': [
   {'name': '模板 A「坠星冢」', 'kind': 'single', 'g': A4, 'morph': ['mirror']},
   {'name': '模板 B「引渊廊」', 'kind': 'single', 'g': B4, 'morph': ['mirror']},
   {'name': '模板 C「井口」（入口）', 'kind': 'single', 'g': C4, 'morph': ['mirror']},
   {'name': '首领房「衔星井」', 'kind': 'segments', 'boss': True, 'segs': [{'g': BOSS4, 'morph': ['mirror']}]},
 ]},
 {'id': '8-5', 'tpls': [
   {'name': '模板 A「长阶」', 'kind': 'single', 'g': A5, 'morph': ['shrink3']},
   {'name': '模板 B「追骸道」', 'kind': 'single', 'g': B5, 'morph': ['shrink3']},
   {'name': '模板 C「阶口」（入口）', 'kind': 'single', 'g': C5, 'morph': ['shrink3']},
   {'name': '首领房「断阶 → 合壁阶」', 'kind': 'segments', 'boss': True, 'segs': [{'g': BOSS5A}, {'g': BOSS5B, 'morph': ['shrink3']}]},
 ]},
 {'id': '8-6', 'slabs': SLABS6, 'tpls': [
   {'name': '模板 A「王庭外环」', 'kind': 'double', 'up': A6_UP, 'low': A6_LO, 'morph': ['shrink2']},
   {'name': '模板 B「骸王长廊」', 'kind': 'splice', 'seq': ['g', 'h', 'i'], 'pool': [], 'morph': ['shrink2']},
   {'name': '模板 C「坠天阶」（入口）', 'kind': 'single', 'g': C6, 'morph': ['mirror']},
   {'name': '首领房「坠天之心」', 'kind': 'segments', 'boss': True, 'segs': [{'kind': 'double', 'up': BOSS6_UP, 'low': BOSS6_LO}, {'g': BOSS6_WELL, 'morph': ['swap11', 'shrink2']}]},
 ]},
]
