KN战争游戏(文字版)

Posted 正在等待对方输入

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了KN战争游戏(文字版)相关的知识,希望对你有一定的参考价值。

KN联手计划

说明

  • 由于国庆期间在家太无聊,不能回学校,又不能出去玩,就决定和刘XX拾回python,做了一个游戏机制(未完善),虽然代码有点混乱且基础功较差(太久没碰了😢),但制作不易,勿喷。

源码展示


import random
import time

# 主线剧情
print('欢迎来到KN——War')
time.sleep(0.6)
User_name = input('请输入您的昵称:\\n')
print('欢迎%s来到游戏' % User_name + "\\n")
time.sleep(2.5)

# 所有列表元素
money = 250
shop_part = ['T', '口', '○', '┏┛┗┓', '╬╬╬╬', '🚩', '🛹', '⚓', '🖇']
shop_part_name = ['螺丝', '铁', '车轮', '发动机', '涡轮增压器', '旗帜', '干扰器', '铁锚', '螺旋桨']
element_part = ['⚡', '🔥', '❄', '🌀', '💧', ]
element_part_name = ['电属性', '火属性', '冰属性', '风属性', '水属性']
element_part_my = []
shop_part_money = [5, 10, 10, 60, 110, 40, 180, 60, 270]
tool = ['Black_Tank-N', 'K-01']
blue_picture = ["""
 _______________________________
|                               |
|                 ⚐             |
| ---------[=[]=> ____===__|    |
|       ----====--/  ★01N  \\\\  |
|     /_____________________/   |
|     \\◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎⊙|   |
|       ~~~~~~~~~~~~~~~~~~~     |                    
|                               |     
|  Name: Black_Tank-N           |
|  part:Tx3, 口x2, ○x6, ┏┛┗┓x1 |
|                               |
 -------------------------------
    """, '''
 _____________________________
|                            |
|         __.__              |
|          //         ++     |
|     ▁╭▅▇□□█▇▆▅▄▃▂▁..|      |
|    ╰═█▁▁K-01∠═══▔▔^^      |
|         ┻━┻                |
|                            |
|    name : K-01             |
|    part: 口x2,┏┛┗┓x1,      |
|       🚩x1,🖇x3,Tx4         |
|____________________________|

''']
shop_part_dictionary = dict(zip(shop_part_name, shop_part))
blue_picture_dictionary_name = dict(zip(tool, blue_picture))

Warehouse = []
bag = ['T', '口', '○', '┏┛┗┓']
bag_number = [6, 4, 8, 2]
part = ['T', '口', '○', '┏┛┗┓']
part_number_1 = [3, 2, 6, 1]
part_number_2 = [2, 1, 1, 3, 4]
part_number = [part_number_1, part_number_2]
dictionary_part_name_number = dict(zip(tool, part_number))
dictionary_tool_part = dict(zip(tool, part))
part_number_dictionary = dict(zip(part, part_number_1))

# 背景
print('2034年,因核泄漏造成海洋污染的时间发生以后,造成了世界经济大乱。')
time.sleep(4)
print('2045年受到世界经济大乱影响的全球证券市场暴跌,从而引发第2次经济大危机。在前所未有的大危机中,以发起大战的略夺者被称为吞噬者M。')
time.sleep(4)
print('2059年,吞噬者之一的联合重工利用新型替代能源技术企图掌握霸权。 2073年,联合重工不满吞噬者的行为,为了尽快掌握量子微米核的制造技术')
time.sleep(4)
print('以K为首的净化能源计划‘K工程‘与吞噬者M之间发生冲突。')
time.sleep(4)
print('为了清除阻碍前程的妨碍者,吞噬者们请了雇佣军N。利用高能武器装甲,人们称他们为影子部队N')
time.sleep(4)

# 大标题

print(
    """
 __  ___ .__   __.               ____    __    ____  ___      .______      
|  |/  / |  \\ |  |               \\   \\  /  \\  /   / /   \\     |   _  \\     
|  '  /  |   \\|  |     ______     \\   \\/    \\/   / /  ^  \\    |  |_)  |    
|    <   |  . `  |    |______|     \\            / /  /_\\  \\   |      /     
|  .  \\  |  |\\   |                  \\    /\\    / /  _____  \\  |  |\\  \\----.
|__|\\__\\ |__| \\__|                   \\__/  \\__/ /__/     \\__\\ | _| `._____|

""")
time.sleep(3)

# 初始值
print('%s当前的背包里有' % User_name + str(bag) + "数量分别是:" + str(bag_number))
print('T为螺丝,口为铁片,○为车轮,┏┛┗┓为发动机')
print('金币为', money)

"""所有自定义函数模式框"""


# 工具房
def tool_room():
    global bag_number
    s1 = True
    while s1:
        print('欢迎来到工具房,以后这里就是你制造工具的地方,需要到此请输入<工具房>')
        print('现有武器蓝图%s' % tool)
        find_tool_picture = input('请输入您想制造的武器:')
        if find_tool_picture in tool:
            print('%s所需的零件' % find_tool_picture + blue_picture_dictionary_name.get(find_tool_picture))
            make_war_car_get = input('请结合背包条件,请问您是否制造(1 or 2):')
            if make_war_car_get == "1":
                if find_tool_picture == 'Black_Tank-N':
                    new_number = [bag_number[0] - part_number_1[0], bag_number[1] - part_number_1[1],
                                  bag_number[2] - part_number_1[2], bag_number[3] - part_number_1[3]]
                    if new_number[0:4] >= [0, 0, 0, 0]:
                        Warehouse.append(find_tool_picture)
                        bag_new_number = dict(zip(bag, new_number))
                        print('制造成功')
                        time.sleep(1)
                        bag_number = new_number
                        print("您的仓库Warehouse武器:%s" % Warehouse)
                        print("当前Warehouse零件:" + str(bag_new_number))
                        s1 = False
                    else:
                        print("制造失败")
                        print("哈哈,零件够吗你?")
                        s1 = False
                elif find_tool_picture == 'K-01':
                    if '🚩' and '🖇' in bag:
                        new_number = [bag_number[bag.index('口')] - part_number_2[0],
                                      bag_number[bag.index('┏┛┗┓')] - part_number_2[1],
                                      bag_number[bag.index('🚩')] - part_number_2[2],
                                      bag_number[bag.index('🖇')] - part_number_2[3],
                                      bag_number[bag.index('T')] - part_number_2[4]]
                        # new_number = list(set(bag_number) - set(part_number))
                        if new_number[0:5] >= [0, 0, 0, 0, 0]:
                            Warehouse.append(find_tool_picture)
                            bag_new_number = dict(zip(bag, new_number))
                            bag_number = new_number
                            print('制造成功')
                            time.sleep(1)
                            print("您的仓库Warehouse武器:%s" % Warehouse)
                            print("当前Warehouse零件:" + str(bag_new_number))
                            s1 = False
                        else:
                            print("制造失败")
                            print("哈哈,零件够吗你?")
                            s1 = False
                    else:
                        print("制造失败")
                        print("哈哈,零件够吗你?")
                        s1 = False
                else:
                    print('无此蓝图')
            else:
                print('已退离开工具房啦')
                s1 = False
        elif find_tool_picture == "q":
            s1 = False
        else:
            print("无此装甲")


# 金币查看
def money_1():
    print('当前金币有%s哦' %money)


# 战斗
def battle():
    global money
    s2 = True
    while s2:
        pattern = input('请选择您的模式 <匹配> <冒险> <退出>:')
        if pattern == "匹配":
            print("正在为您匹配对手")
            time.sleep(1.5)
            print("匹配成功")
            time.sleep(1)
            print("加载中...")
            time.sleep(2)
            print("——————————————Start fighting——————————————\\n")
            armor = input("请选择您出战的装甲" + str(Warehouse) + ':')
            element_input = input("请选择您要使用的元素(如果没有元素请输入1)" + str(element_part_my) + ':')
            if armor == "Black_Tank-N":
                print('敌方信息')
                time.sleep(1)
                print("很强")
                print('机甲正在战斗中...')
                time.sleep(3)
                random_int = random.randint(0, 1)
                random_money_win = random.randint(80, 150)
                random_tool_win = random.randint(0, 7)
                random_ele = random.randint(0, 5)
                random_money_lose = random.randint(20, 30)
                if random_int == 0:
                    if random_tool_win == 3 or 6:
                        if element_part[random_ele] not in bag:
                            element_part_my.append(element_part[random_ele])
                            print('恭喜恭喜!,你获得了%s元素,快去元素台看看吧' % element_part[random_ele])
                        print('你赢了!赢得了%s¥' % random_money_win)
                        money += random_money_win

                    else:
                        print('你赢了!赢得了%s¥' % random_money_win)
                        money += random_money_win
                else:
                    print('你输了,安慰金%s' % random_money_lose)
                    money += random_money_lose

            if armor == "K-01":
                print('敌方信息')
                time.sleep(1)
                print("有点强")
                print('机甲正在战斗中...')
                time.sleep(3)
                random_int = random.randint(0, 1)
                random_money_win = random.randint(80, 150)
                random_tool_win = random.randint(0, 7)
                random_ele = random.randint(0, 5)
                random_money_lose = random.randint(20, 30)
                if random_int == 0:
                    if random_tool_win == 3 or 6:
                        if element_part[random_ele] not in bag:
                            element_part_my.append(element_part[random_ele])
                            print('恭喜恭喜!,你获得了%s元素,快去元素台看看吧'%element_part[random_ele])
                        print('你赢了!赢得了%s¥' % random_money_win)
                        money += random_money_win

                    else:
                        print('你赢了!赢得了%s¥' % random_money_win)
                        money += random_money_win
                else:
                    print('你输了,安慰金%s' % random_money_lose)
                    money += random_money_lose


                s2 = False
            elif armor == "q":
                s2 = False

        elif pattern == "冒险":
            print("作者有点懒,敬请期待")
            continue
        elif pattern == "退出":
            s2 = False
        else:
            print("努力更新中,敬请期待")
            continue


# 背包
def bag_part():
    print('当前的零件有' + str(bag) + '有' + str(bag_number))


# 仓库
def Warehouse_bag():
    s4 = True
    while s4:
        print('当前仓库里有', Warehouse)
        finding = input("输入装甲名称,查看详情")
        if finding in tool:
            print('%s所需的零件' % finding + blue_picture_dictionary_name.get(finding))
        elif finding == 'q':
            s4 = False
        else:
            print('暂无此装甲')
            s4 = False


# 商场
def shop():
    global money
    print("坑人的商店老板:我相信你以后会经常来的( $∇$ )")
    time.sleep(2)
    print('看看有什么需要的:' + str(shop_part_dictionary))
    time.sleep(2)
    print('''        T   口   ○   ┏┛┗┓   ╬╬╬╬   🚩    🛹    ⚓     🖇
prise: 5$  10$  10$  60$   110$   40$  180$  60$   270$''')
    print('当前金币只有%s哦'%money)
    shopping = input('请输入您要购买的零件(输入零件名称,q为退出):')
    if shopping == '螺丝':
        shop_number = int(input('购买数量:'))
        if money >= shop_part_money[0]*shop_number:
            money -= shop_part_money[0]*shop_number
            bag_number[0] = int(bag_number[0]) + shop_number
            print('购买成功')
        else:
            print('你的钱呢¥_¥')
            print('当前金币为', money)
    elif shopping == '铁':
        shop_number = int(input('购买数量:'))
        if money >= shop_part_money[1]*shop_number:
            money -= shop_part_money[1]*shop_number
            bag_number[1] = int(bag_number[1]) + shop_number
            print('购买成功')
        else:
            print('你的钱呢¥_¥')
            print('当前金币为', money)
    elif shopping == '车轮':
        shop_number = int(input('购买数量:'))
        if money >= shop_part_money[2]*shop_number:
            money -= shop_part_money[2]*shop_number
            bag_number[2] = int(bag_number[2]) + shop_number
            print('购买成功')
        else:
            print('你的钱呢¥_¥')
            print('当前金币为', money)
    elif shopping == '发动机':
        shop_number = int(input('购买数量:'))
        if money >= shop_part_money[3]*shop_number:
            money -= shop_part_money[3]*shop_number
            bag_number[3] = int(bag_number[3]) + shop_number
            print('购买成功')
        else:
            print('你的钱呢¥_¥')
            print('当前金币为', money)
    elif shopping == '涡轮增压器':
        if '╬╬╬╬' not in bag:
            bag.append('╬╬╬╬')
            bag_number.append(0)
        shop_number = int(input('购买数量:'))
        if money >= shop_part_money[4]*shop_number:
            money -= shop_part_money[4]*shop_number
            bag_number[bag.index('╬╬╬╬')] = int(bag_number[bag.index('╬╬╬╬')]) 使命召唤6现代战争2秘籍怎么用

寻找一个老游戏

这是我的战争是使用了啥样的游戏引擎?

[TJOI2009]战争游戏 - 网络流,最小割

课外阅读亮剑小说片段 毕业论文

clash royale怎么换中文 部落冲突皇室战争中文设置