猫史档案馆


【Python作品分享】屠龙【作品秀】

用户:大作家飓风大作家飓风查看:0 回复:0 评论:0 创建时间:2022-12-03T16:44:44


【作品展示】

center_image

 

【作品介绍】

文字游戏

 

【作品源代码】

import random


攻击力 = random.randint(50, 60)
回答 = 0
BOSS = 1000
我 = 100
while (not BOSS < 0 and not 我 < 0):
    BOSS攻击的伤害 = random.randint(1, 20)
    回答 = input("‘第一项是攻击,第二项是提升攻击力,第三项是回血(输入'1'或'2'或'3')’")
    if (回答 == '1'):
        BOSS -= 攻击力
        我 -= BOSS攻击的伤害
        print('玩家血量', 我)
        print('龙血量', BOSS)
    elif (回答 == '2'):
        攻击力 += random.randint(50, 100)
        我 -= BOSS攻击的伤害
        print('玩家血量', 我)
        print('龙血量', BOSS)
    elif (回答 == '3'):
        我 += random.randint(10, 20)
        我 -= BOSS攻击的伤害
        print('玩家血量', 我)
        print('龙血量', BOSS)
    else:
        print('没有这个选项')
print('游戏结束')

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页