# U26L4 剧本检查脚本

# 所有"互动"行的User台词（知识点输出）
interactions = [
    (21, "Wow! Eighty is a lot!"),
    (53, "Can you help Bingo?"),
    (55, "Maybe Bingo can use potato power!"),
    (63, "I can help to make it!"),
    (68, "Wow! That helps a lot!"),
    (76, "Oh, We can use these boxes for the potatoes!"),
    (79, "There are seventy potatoes!"),
    (98, "Aha! We can use ladder!"),
    (105, "Oh, There are eighty chips in total!"),
    (108, "That helps a lot!"),
    (128, "Let me help you!"),
    (141, "It's at seventy!"),
    (146, "Wow! It's at eighty!"),
    (171, "That helps a lot, Bingo!"),
]

# 知识点
kps = {
    'seventy': {'type': 'word', 'pos': 'num'},
    'eighty': {'type': 'word', 'pos': 'num'},
    'help': {'type': 'word', 'pos': 'v'},
    'use': {'type': 'word', 'pos': 'v'},
    'We can use': {'type': 'sentence'},
    'That helps a lot': {'type': 'sentence'},
}

# 统计输出
print("=" * 60)
print("U26L4 知识点输出统计（中互动）")
print("=" * 60)

output_count = {}
for kp in kps:
    output_count[kp] = []

for line_no, text in interactions:
    text_lower = text.lower()
    for kp in kps:
        if kp.lower() in text_lower:
            output_count[kp].append((line_no, text))

for kp, hits in output_count.items():
    print(f"\n{kp} ({kps[kp]['type']}) — 输出 {len(hits)} 次:")
    for line_no, text in hits:
        print(f"  行{line_no}: {text}")

print("\n" + "=" * 60)
print("输出汇总")
print("=" * 60)
for kp, hits in output_count.items():
    status = "✅" if 2 <= len(hits) <= 3 else "⚠️"
    print(f"  {kp}: {len(hits)}次 {status}")

print(f"\n中互动总数: {len(interactions)}个")
print(f"标准: 14-17个中互动 + 1个核心互动")

# 检查NPC输入（含知识点的NPC台词）
print("\n" + "=" * 60)
print("NPC知识点输入检查")
print("=" * 60)

npc_lines = [
    (20, "Jay", "This month...We only made eighty Vala coins..."),
    (29, "Lin", "So he took seventy!"),
    (43, "Jay", "Potato can help Eleven!"),
    (45, "Lin", "Yes. Eleven can only use potato power now."),
    (49, "Lin", "That helps a lot for Eleven."),
    (59, "Bingo", "Please help Bingo..."),
    (61, "Jay", "Sure! We can help!"),
    (62, "Lin", "But we need to make some new potato chargers."),
    (66, "Jay", "We have about seventy potatoes here!"),
    (125, "Jay", "OK! I'll help too."),
    (131, "Jay", "Seventy... not enough..."),
    (159, "Lin", "We used everything to help Bingo..."),
    (162, "Bingo", "You helped me."),
    (163, "Bingo", "I want to help you too."),
]

input_count = {}
for kp in kps:
    input_count[kp] = []

for line_no, char, text in npc_lines:
    text_lower = text.lower()
    for kp in kps:
        if kp.lower() in text_lower:
            input_count[kp].append((line_no, char, text))

for kp, hits in input_count.items():
    print(f"\n{kp} — 输入 {len(hits)} 次:")
    for line_no, char, text in hits:
        print(f"  行{line_no} ({char}): {text}")

