哈喽啊,我有新的PY作品啦;

大家康康吧,点个赞再看吧,编写真的很累哦!

(不知道大家能不能运行,我这个代码用的是一个系统里写的)


import random
import time
monster = ['火柴鼠', '瞌睡熊', '板牙狸', '博学企鹅',
           '绅士企鹅','漂浮龟', '贪玩虎', '蹦蹦蛙',
           '聒噪鸦','弹簧蛇', '小火龙','旋转鳄鱼']
monster2 = ['火柴鼠', '瞌睡熊', '板牙狸', '博学企鹅',
           '绅士企鹅','漂浮龟', '贪玩虎', '蹦蹦蛙',
           '聒噪鸦','弹簧蛇', '小火龙','旋转鳄鱼']
energy = [10 ,11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
live=1000000000000000000000000000000000000000
bag=[]
bag2=[]
cnt1=0
cnt2=0
bag2=1
start3=0
opponent=['追风少年','大灰狼','世界上最美丽的女子','sb才怪','33','5233','神觉吧','堵车堵的厉害的vvv','简单冰激淋大s']
a='''欢迎来到精灵大战,主页正在加载中.......'''
for b in a:
    print(b,flush = True,end = "")
    time.sleep(0.15)
time.sleep(5)
print()
c='''主页加载成功!
 一键三连, 求个赞 '''
for d in c:
    print(d,flush = True,end = "")
    time.sleep(0.15)
while start3==0:
    print()
    e='''1开始游戏  2游戏剧情  3更新日志  4制作人'''
    for f in e:
        print(f,flush = True,end = "")
        time.sleep(0.15)
    start=int(input())
    if start==1:
        n='''你选择了1
游戏加载中....'''
        for o in n:
            print(o,flush = True,end = "")
            time.sleep(0.15)
        print()
        time.sleep(5.6)
        p='''游戏加载成功
开始游戏'''
        for q in p:
            print(q,flush = True,end = "")
            time.sleep(0.15)
        print()
        r='''你现在没有精灵,但有60体力,作者先带你抓精灵'''
        for s in r:
            print(s,flush = True,end = "")
            time.sleep(0.15)
        t='''你在去往精灵山洞的路上,遇到3只精灵拦路,分别消耗体力:
12,4,7'''
        print()
        for u in t:
            print(u,flush = True,end = "")
            time.sleep(0.1)
        f='''你要扑捉他们吗 1要 2不要'''
        for g in f:
            print(g,flush = True,end = "")
            time.sleep(0.15)
        cash=int(input())
        if cash==1:
            h='''扑捉完成,现有37体力
原来他们是火柴鼠的弟弟和哥哥
他们若不经风,被你打死了'''
            for i in h:
                print(i,flush = True,end = "")
                time.sleep(0.15)
            live=37
            print()
            l='''你走啊走,看见一个能量100的急救包,你要拿起并使用吗 1要 2不要'''
            for m in l:
                print(m,flush = True,end = "")
                time.sleep(0.15)
            n=int(input())
            if n==1:
                o='''使用完毕,目前体力137'''
                for p in o:
                    print(p,flush = True,end = "")
                    time.sleep(0.15)
                live=137
            q='''你继续前进,终于到了扑捉精灵山洞
规则:
至少扑捉3只'''
            for r in q:
                print(r,flush = True,end = "")
                time.sleep(0.15)
            print()
            print('3')
            time.sleep(1)
            print('2')
            time.sleep(1)
            print('1')
            time.sleep(1)
            print('扑捉精灵开始')
            cash2=0
            for _ in range(3):
               
                m= random.choice(monster)
                print()
                a='''遇到精灵:'''
                for d in a:
                    print(d,flush = True,end = "")
                    time.sleep(0.15)
                print(m)
                i = monster.index(m)
                e = energy[i]
                f='''扑捉他需要耗费体力:'''
                for r in f:
                    print(r,flush = True,end = "")
                    time.sleep(0.15)
                print(e)
                w='''以自动抓扑'''
                for q in w:
                    print(q,flush = True,end = "")
                    time.sleep(0.15)
                live-=e
                bag.append(m)
                print()
                g='''扑捉完成,现有'''
                for q in g:
                    print(q,flush = True,end = "")
                    time.sleep(0.15)
                print(live)
                l='''体力'''
                for q in l:
                    print(q,flush = True,end = "")
                    time.sleep(0.15)
                print()
            print('你可以想抓不抓了')
            while cash2==0:
                if live>=10:
                    print()
                    q='''在要抓吗 1要 2不要'''
                    for r in q:
                        print(r,flush = True,end = "")
                        time.sleep(0.15)
                    cash3=int(input())
                    if cash3==2:
                        cash2==1
                        break
                    m= random.choice(monster)
                    print()
                    rt='''遇到精灵:'''
                    for rty in rt:
                        print(rty,flush = True,end = "")
                        time.sleep(0.15)
                    print(m)
                    print()
                    i = monster.index(m)
                    e = energy[i]
                    ji='''扑捉他需要耗费体力:'''
                    for jiu in ji:
                        print(jiu,flush = True,end = "")
                        time.sleep(0.15)
                    print(e)
                    print()
                    if live >= e:
                        re='''要抓吗 1要 2不要'''
                        for lop in re:
                            print(lop,flush = True,end = "")
                            time.sleep(0.15)
                        cash=int(input())
                        if cash == 1:
                            live-=e
                            bag.append(m)
                            print()
                            g='''扑捉完成,现有'''
                            for q in g:
                                print(q,flush = True,end = "")
                                time.sleep(0.15)
                            print(live)
                            l='''体力'''
                            for q in l:
                                print(q,flush = True,end = "")
                                time.sleep(0.15)
                            print()
                        else:
                            live-=2
                            g='''放弃抓扑,扣2体力,现有'''
                            for q in g:
                                print(q,flush = True,end = "")
                                time.sleep(0.15)
                            print(live)
                            l='''体力'''
                            for q in l:
                                print(q,flush = True,end = "")
                                time.sleep(0.15)
                            print()
                    else:
                        g='''体力不够,现有'''
                        for q in g:
                            print(q,flush = True,end = "")
                            time.sleep(0.15)
                        print(live)
                        l='''体力'''
                        for q in l:
                            print(q,flush = True,end = "")
                            time.sleep(0.15)
                else:
                    hjumk='''你剩下的体力不足以扑捉任何精灵'''
                    for q in hjumk:
                        print(q,flush = True,end = "")
                        time.sleep(0.15)
                    break  
            print()                    
            u='''扑捉完毕,以自动增加45体力值,即将开始游戏'''
            for v in u:
                print(v,flush = True,end = "")
                time.sleep(0.15)
            live+=45
            print()
            w='''正在挑选对手.....'''
            for x in w:
                print(x,flush = True,end = "")
                time.sleep(0.15)  
            time.sleep(7.5)
            y='''以挑选完选手:'''
            for z in y:
                print(z,flush = True,end = "")
                time.sleep(0.15)
            print(random.choice(opponent))
            print('3')
            time.sleep(1)
            print('2')
            time.sleep(1)
            print('1')
            time.sleep(1)
            y='''精灵大战开始:
以下是精灵与攻击力对照表,上为精灵,下为攻击力,两两对应'''
            for z in y:
                print(z,flush = True,end = "")
                time.sleep(0.15)
            print()
            print(monster)
            print(energy)
            print()
            print('你有精灵:')
            print(bag)
            print()
            time.sleep(10)
            while not live<=0 or bag2!=0:
                A=random.choice(monster)
                B= monster.index(A)
                C =int(energy[B])
                if live<=0:
                    y='''你没体力了,游戏结束'''
                    for z in y:
                        print(z,flush = True,end = "")
                        time.sleep(0.15)
                    break
                y='''对手出'''
                for z in y:
                    print(z,flush = True,end = "")
                    time.sleep(0.15)
                print(A)
                print()
                y='''攻击力'''
                for z in y:
                    print(z,flush = True,end = "")
                    time.sleep(0.15)
                print(C)
                print()
                y='''你出的精灵 填精灵名称'''
                for z in y:
                    print(z,flush = True,end = "")
                    time.sleep(0.15)
                D=input()
                if not D in bag :
                    y='''你没有这个精灵,游戏结束'''
                    for z in y:
                        print(z,flush = True,end = "")
                        time.sleep(0.15)
                    break
                F= monster2.index(D)
                G = energy[F]
                if G>=C:
                    y='''你赢了,不扣体力'''
                    for z in y:
                        print(z,flush = True,end = "")
                        time.sleep(0.15)
                    cnt1+=1
                    print()
                    y='''现有精灵:'''
                    for z in y:
                        print(z,flush = True,end = "")
                        time.sleep(0.15)
                    bag2=int(len(bag))
                    print(bag)
                    if bag2 == 0:
                        break
                else:
                    cnt2+=1
                    y='''你输了,扣体力'''
                    for z in y:
                        print(z,flush = True,end = "")
                        time.sleep(0.15)
                    print()
                    y='''现有精灵:'''
                    for z in y:
                        print(z,flush = True,end = "")
                        time.sleep(0.15)


     

本站作者已申明原创,禁止转载!

文章内容属作者个人观点,不代表本站立场,如有侵权立删。

   口袋儿题库-青少儿编程自测题库