[Python] 纯文本查看 复制代码
# !/usr/bin/python3
# encoding=utf-8
def calculate_summons_and_rewards(resource_quantity, resource_per_summon):
summons = resource_quantity // resource_per_summon
rewards = summons
return summons, rewards
def main():
bosses = {
1: {"name": "齐尔领主暗黑boss", "resource": "精纯鲜血", "amount": 9, "reward": "炙沙枷锁", "location": "破碎群峰的晦暗之路"},
2: {"name": "冰中巨兽", "resource": "提纯的恐惧", "amount": 27, "reward": "针垫玩偶", "location": "梦魇冰川"},
3: {"name": "格里高列", "resource": "活体钢铁", "amount": 5, "reward": "苦痛碎片", "location": "干燥平原的悔罪者大厅"},
4: {"name": "瓦尔申", "resource": ["颤栗之手", "咕噜头颅", "恶念之心", "发黑的股骨"], "amount": 1, "reward": "粘液覆盖的蛋", "location": "谜语古树"},
5: {"name": "普通督瑞尔", "resource": ["苦痛碎片", "粘液覆盖的蛋"], "amount": 2, "reward": "大概率稀有暗金!!!", "location": "凯基斯坦的巨口深坑"},
6: {"name": "普通安达莉尔", "resource": ["针垫玩偶", "炙沙枷锁"], "amount": 2, "reward": "大概率稀有暗金!!!", "location": "凯基斯坦的绞首者大厅"}
}
while True:
print("请选择你要召唤的BOSS:")
for key, boss in bosses.items():
if isinstance(boss["resource"], list):
resources = "和".join(boss["resource"])
print(f"{key}. {boss['name']}(需要每种各{boss['amount']}个:{resources}) - 召唤地点: {boss['location']}")
else:
print(f"{key}. {boss['name']}(需要 {boss['amount']} 个 {boss['resource']}) - 召唤地点: {boss['location']}")
choice = int(input("请输入选择的数字 (1-6): "))
if choice in bosses:
boss = bosses[choice]
if isinstance(boss["resource"], list):
quantities = []
for resource in boss["resource"]:
quantity = int(input(f"请输入你拥有的 {resource} 数量: "))
quantities.append(quantity)
summons = min(quantities) // boss["amount"]
rewards = summons
else:
resource_quantity = int(input(f"请输入你拥有的 {boss['resource']} 数量: "))
summons, rewards = calculate_summons_and_rewards(resource_quantity, boss["amount"])
print(f"你可以召唤 {summons} 次 {boss['name']}。")
print(f"你将得到 {rewards} 个 {boss['reward']}。")
else:
print("无效的选择,请重新选择。")
continue
if input("是否继续召唤其他BOSS?(输入 y 继续,输入其他任意键退出): ") != 'y':
break
if __name__ == "__main__":
main()