用户:陶夕晨查看:2 回复:6 评论:2 创建时间:2019-05-12T13:01:33
import easygui
import time
import random
import easygui as tu
import sys
import random as shu
ke = []
xun = ['训练师杰克','短裤小子','训练师迈克','训练师张鹏','训练师陈诚','训练师杰瑞']
dui = ['鲤鱼王','角金鱼','杰尼龟','小拉达']
ji = 1
s = 0
g1 = (ji * 2)
g2 = (ji * 4)
g3 = (ji * 3)
g4 = (ji * 5)
g1s = (ji * 1)
g2s = (ji * 3)
g3s = (ji * 4)
g4s = (ji * 5)
zhi = 0
hp = (ji * 10)
hps = (ji * 10)
zhis = (ji * 100)
jieguo = 0
jineng = []
name = input('请输入用户名:')
easygui.msgbox((name + ',欢迎游玩此游戏!'),'欢迎')
msg = '请选择初始宝可梦:'
title = '请选择'
choices = ['小火龙','妙蛙种子','呱呱泡蛙','皮卡丘']
choice = tu.choicebox(msg,title,choices)
if (choice == '小火龙'):
jineng = ['利爪']
jineng1 = ['火花']
if (choice == '妙蛙种子'):
jineng = ['撞击']
jineng1 = ['藤蔓攻击']
if (choice == '呱呱泡蛙'):
jineng = ['水花']
jineng1 = ['撞击']
if (choice == '皮卡丘'):
jineng = ['电击']
jineng1 = ['撞击']
easygui.msgbox(('你选择的是' + str(choice)))
ke.append(choice)
while (ji <= 50):
if (zhi == zhis):
ji += 1
zhi -= zhis
if (zhi > zhis):
ji += 1
zhi -= zhis
hp = (ji * 10)
hps = (ji * 10)
zhis = (ji * 100)
msg = '你希望干什么?'
title = '请选择'
choices = ['战斗','补给','查看','学习','退出']
choice = tu.choicebox(msg,title,choices)
easygui.msgbox(('你选择的是' + str(choice)))
if (str(choice) == '查看'):
easygui.msgbox(((((((((str(ke) + '\n等级:') + str(ji)) + '\n经验:') + str(zhi)) + '|') + str(zhis)) + '\nHP:') + str(hp)),'查看','返回')
if (str(choice) == '退出'):
msg = '你确定退出吗?'
title = '请选择'
choices = ['确定','取消']
choice = tu.choicebox(msg,title,choices)
if (str(choice) == '确定'):
easygui.msgbox('你已退出!','已退出','确定')
jieguo = 1
break
if (str(choice) == '取消'):
easygui.msgbox('你已取消!','已取消','确定')
if (str(choice) == '战斗'):
easygui.msgbox('正在寻找合适的训练师...','寻找中')
time.sleep(shu.randrange(1,3))
xuns = xun[shu.randrange(0,5)]
easygui.msgbox(('已找到' + str(xuns)))
duis = dui[shu.randrange(0,3)]
easygui.msgbox(((('对方派出了' + str(ji)) + '级的') + str(duis)))
msg = '你要派出谁?'
title = '请选择'
choices = [str(ke)]
choice = tu.choicebox(msg,title,choices)
easygui.msgbox(('你已派出' + str(choice)))
easygui.msgbox('战斗开始!','战斗开始')
while (hps > 0):
easygui.msgbox('我方攻击','我方攻击')
msg = '要使用什么?'
title = '请选择'
choices = [str(jineng),str(jineng1)]
choice = tu.choicebox(msg,title,choices)
if ('小火龙' in str(ke)):
if ('利爪' in str(choice)):
easygui.msgbox('你使用了利爪')
gong = shu.randrange(g1,g2)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('火花' in str(choice)):
easygui.msgbox('你使用了火花')
gong = shu.randrange(g3,g4)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('妙蛙种子' in str(ke)):
if ('撞击' in str(choice)):
easygui.msgbox('你使用了撞击')
gong = shu.randrange(g1,g2)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('藤蔓攻击' in str(choice)):
easygui.msgbox('你使用了藤蔓攻击')
gong = shu.randrange(g3,g4)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('呱呱泡蛙' in str(ke)):
if ('撞击' in str(choice)):
easygui.msgbox('你使用了撞击')
gong = shu.randrange(g1,g2)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('水花' in str(choice)):
easygui.msgbox('你使用了水花')
gong = shu.randrange(g3,g4)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('皮卡丘' in str(ke)):
if ('撞击' in str(choice)):
easygui.msgbox('你使用了撞击')
gong = shu.randrange(g1,g2)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('电击' in str(choice)):
easygui.msgbox('你使用了电击')
gong = shu.randrange(g3,g4)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('鲤鱼王' in str(duis)):
dikeg = '拍击'
dikegs = '撞击'
duiss = (dikeg or dikegs)
easygui.msgbox(('对方使用了' + str(duiss)))
s = random.randint(1, 2)
if (('拍击' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (('撞击' in str(duiss)) and s == 2):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if ('角金鱼' in str(duis)):
dikeg = '撞击'
dikegs = '水花'
duiss = (dikeg or dikegs)
s = random.randint(1, 2)
easygui.msgbox(('对方使用了' + str(duiss)))
if (('撞击' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (('水花' in str(duiss)) and s == 2):
dj = shu.randrange(g3s,g4s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if ('杰尼龟' in str(duis)):
dikeg = '啃咬'
dikegs = '泡沫'
duiss = (dikeg or dikegs)
s = random.randint(1, 2)
easygui.msgbox(('对方使用了' + str(duiss)))
if (('啃咬' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (('泡沫' in str(duiss)) and s == 2):
dj = shu.randrange(g3s,g4s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if ('小拉达' in str(duis)):
dikeg = '撞击'
dikegs = '甩尾'
duiss = (dikeg or dikegs)
s = random.randint(1, 2)
easygui.msgbox(('对方使用了' + str(duiss)))
if (('撞击' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (('甩尾' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (hp <= 0):
easygui.msgbox('你输了!','你输了!','确定')
if (hps <= 0):
easygui.msgbox('你赢了!','你赢了!','确定')
sheng = (ji * 30)
easygui.msgbox((('增长' + str(sheng)) + '点经验值'))
zhi += sheng
import time
import easygui as tu
import sys
import random as shu
ke = []
xun = ['训练师杰克','短裤小子','训练师迈克','训练师张鹏','训练师陈诚','训练师杰瑞']
dui = ['鲤鱼王','角金鱼','杰尼龟','小拉达']
ji = 1
s = 0
g1 = (ji * 2)
g2 = (ji * 4)
g3 = (ji * 3)
g4 = (ji * 5)
g1s = (ji * 1)
g2s = (ji * 3)
g3s = (ji * 4)
g4s = (ji * 5)
zhi = 0
hp = (ji * 10)
hps = (ji * 10)
zhis = (ji * 100)
jieguo = 0
jineng = []
name = input('请输入用户名:')
easygui.msgbox((name + ',欢迎游玩此游戏!'),'欢迎')
msg = '请选择初始宝可梦:'
title = '请选择'
choices = ['小火龙','妙蛙种子','呱呱泡蛙','皮卡丘']
choice = tu.choicebox(msg,title,choices)
if (choice == '小火龙'):
jineng = ['利爪']
jineng1 = ['火花']
if (choice == '妙蛙种子'):
jineng = ['撞击']
jineng1 = ['藤蔓攻击']
if (choice == '呱呱泡蛙'):
jineng = ['水花']
jineng1 = ['撞击']
if (choice == '皮卡丘'):
jineng = ['电击']
jineng1 = ['撞击']
easygui.msgbox(('你选择的是' + str(choice)))
ke.append(choice)
while (ji <= 50):
if (zhi == zhis):
ji += 1
zhi -= zhis
if (zhi > zhis):
ji += 1
zhi -= zhis
hp = (ji * 10)
hps = (ji * 10)
zhis = (ji * 100)
msg = '你希望干什么?'
title = '请选择'
choices = ['战斗','补给','查看','学习','退出']
choice = tu.choicebox(msg,title,choices)
easygui.msgbox(('你选择的是' + str(choice)))
if (str(choice) == '查看'):
easygui.msgbox(((((((((str(ke) + '\n等级:') + str(ji)) + '\n经验:') + str(zhi)) + '|') + str(zhis)) + '\nHP:') + str(hp)),'查看','返回')
if (str(choice) == '退出'):
msg = '你确定退出吗?'
title = '请选择'
choices = ['确定','取消']
choice = tu.choicebox(msg,title,choices)
if (str(choice) == '确定'):
easygui.msgbox('你已退出!','已退出','确定')
jieguo = 1
break
if (str(choice) == '取消'):
easygui.msgbox('你已取消!','已取消','确定')
if (str(choice) == '战斗'):
easygui.msgbox('正在寻找合适的训练师...','寻找中')
time.sleep(shu.randrange(1,3))
xuns = xun[shu.randrange(0,5)]
easygui.msgbox(('已找到' + str(xuns)))
duis = dui[shu.randrange(0,3)]
easygui.msgbox(((('对方派出了' + str(ji)) + '级的') + str(duis)))
msg = '你要派出谁?'
title = '请选择'
choices = [str(ke)]
choice = tu.choicebox(msg,title,choices)
easygui.msgbox(('你已派出' + str(choice)))
easygui.msgbox('战斗开始!','战斗开始')
while (hps > 0):
easygui.msgbox('我方攻击','我方攻击')
msg = '要使用什么?'
title = '请选择'
choices = [str(jineng),str(jineng1)]
choice = tu.choicebox(msg,title,choices)
if ('小火龙' in str(ke)):
if ('利爪' in str(choice)):
easygui.msgbox('你使用了利爪')
gong = shu.randrange(g1,g2)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('火花' in str(choice)):
easygui.msgbox('你使用了火花')
gong = shu.randrange(g3,g4)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('妙蛙种子' in str(ke)):
if ('撞击' in str(choice)):
easygui.msgbox('你使用了撞击')
gong = shu.randrange(g1,g2)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('藤蔓攻击' in str(choice)):
easygui.msgbox('你使用了藤蔓攻击')
gong = shu.randrange(g3,g4)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('呱呱泡蛙' in str(ke)):
if ('撞击' in str(choice)):
easygui.msgbox('你使用了撞击')
gong = shu.randrange(g1,g2)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('水花' in str(choice)):
easygui.msgbox('你使用了水花')
gong = shu.randrange(g3,g4)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('皮卡丘' in str(ke)):
if ('撞击' in str(choice)):
easygui.msgbox('你使用了撞击')
gong = shu.randrange(g1,g2)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('电击' in str(choice)):
easygui.msgbox('你使用了电击')
gong = shu.randrange(g3,g4)
easygui.msgbox((('你对对方宝可梦造成了' + str(gong)) + '点伤害'))
hps -= gong
easygui.msgbox((('对方还剩' + str(hps)) + '点血'))
easygui.msgbox('对方攻击')
if ('鲤鱼王' in str(duis)):
dikeg = '拍击'
dikegs = '撞击'
duiss = (dikeg or dikegs)
easygui.msgbox(('对方使用了' + str(duiss)))
s = random.randint(1, 2)
if (('拍击' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (('撞击' in str(duiss)) and s == 2):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if ('角金鱼' in str(duis)):
dikeg = '撞击'
dikegs = '水花'
duiss = (dikeg or dikegs)
s = random.randint(1, 2)
easygui.msgbox(('对方使用了' + str(duiss)))
if (('撞击' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (('水花' in str(duiss)) and s == 2):
dj = shu.randrange(g3s,g4s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if ('杰尼龟' in str(duis)):
dikeg = '啃咬'
dikegs = '泡沫'
duiss = (dikeg or dikegs)
s = random.randint(1, 2)
easygui.msgbox(('对方使用了' + str(duiss)))
if (('啃咬' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (('泡沫' in str(duiss)) and s == 2):
dj = shu.randrange(g3s,g4s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if ('小拉达' in str(duis)):
dikeg = '撞击'
dikegs = '甩尾'
duiss = (dikeg or dikegs)
s = random.randint(1, 2)
easygui.msgbox(('对方使用了' + str(duiss)))
if (('撞击' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (('甩尾' in str(duiss)) and s == 1):
dj = shu.randrange(g1s,g2s)
hp -= dj
easygui.msgbox((('对手对你的宝可梦造成了' + str(dj)) + '点伤害!'))
easygui.msgbox((('你还剩' + str(hp)) + '滴血'),'对手','确定')
if (hp <= 0):
easygui.msgbox('你输了!','你输了!','确定')
if (hps <= 0):
easygui.msgbox('你赢了!','你赢了!','确定')
sheng = (ji * 30)
easygui.msgbox((('增长' + str(sheng)) + '点经验值'))
zhi += sheng点赞0
评论