首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

自己闲暇时制作的一款宠物游戏,类似slg包括抽奖,培养,战斗,充值(免费)等功能

游戏开发 5.99KB 14 需要积分: 1
立即下载

资源介绍:

petf.py:这个模块是宠物功能的核心,涵盖了宠物的进阶、技能使用、抽奖和商店交易等。玩家可以查看宠物的详细属性,如生命值和攻击力,并使用特定的丹药来提升宠物的能力。此外,玩家还可以通过选择不同的种族(如灭天族、神族、仙族)来进行针对性的宠物培养。游戏中的抽奖系统允许玩家用金子(游戏货币)来获取新的宠物或宠物碎片。 main.py:作为游戏的启动点,这个脚本设置了玩家的初始状态,包括金钱和宠物。它提供了一个用户界面,玩家可以通过这个界面选择不同的游戏模式,比如进入宠物养成系统、开始对战、进行游戏测试或充值金子。这个脚本还负责处理用户的选择和调用相应的功能。 petvs.py:这个模块负责实现宠物对战的逻辑。玩家首先选择对战的难度级别,然后从自己的宠物中选择三个进行上阵。在对战中,玩家可以根据自己的战略选择使用宠物的技能,并观察战斗的实时变化。战斗结束后,根据结果,玩家的金钱会相应增减。 游戏中的宠物拥有独特的技能和属性,这些可以通过消耗特定的资源来增强。例如,宠物可以通过消耗凡丹、妖丹或仙丹来提升生命值和攻击力。此外,宠物还有命座系统,可以通过消耗碎片来提升宠物的星级。
from math import * from ti_system import * from random import * from time import * def dvs(pet,bag): lv=chooselevel() clear_history() if lv!=0: sz=choosepet(bag,pet) else: sz=[2,2,2] clear_history() heart=[0,0,0,0,0,0] dheart=[0,0,0,0,0,0] petname=[] dpet=[] for i in range(3): sz.append(randint(0,len(pet)-1)) for i in range(len(pet)): if i==sz[3]: dpet.append([0,pet[sz[3]][1],[[pet[sz[3]][2][0][0],0,pet[sz[3]][2][0][2],pet[sz[3]][2][0][3],0],[pet[sz[3]][2][1][0],0,pet[sz[3]][2][1][2],pet[sz[3]][2][1][3],0]]]) if i==sz[4]: dpet.append([0,pet[sz[4]][1],[[pet[sz[4]][2][0][0],0,pet[sz[4]][2][0][2],pet[sz[4]][2][0][3],0],[pet[sz[4]][2][1][0],0,pet[sz[4]][2][1][2],pet[sz[4]][2][1][3],0]]]) if i==sz[5]: dpet.append([0,pet[sz[5]][1],[[pet[sz[5]][2][0][0],0,pet[sz[5]][2][0][2],pet[sz[5]][2][0][3],0],[pet[sz[5]][2][1][0],0,pet[sz[5]][2][1][2],pet[sz[5]][2][1][3],0]]]) for i in range(3): if sz[i]!=-1: dheart[i]=2*(pet[sz[i]][1]+bag[sz[i]+5][0]*int(bag[sz[i]+5][1]/3)) heart[i]=2*(pet[sz[i]][1]+bag[sz[i]+5][0]*int(bag[sz[i]+5][1]/3)) petname.append(pet[sz[i]][0]) else: dheart[i]=0 heart[i]=0 petname.append("空缺") dbag=[[0,0],[0,0],[0,0]] for i in range(3): dbag[i][1]=randint((lv*2-1)*10,(lv*2+1)*10) dbag[i][0]=randint(lv*2-1,lv*2) dheart[i+3]=2*(dpet[i][1]+dbag[i][0]*int(dbag[i][1]/3)) heart[i+3]=2*(dpet[i][1]+dbag[i][0]*int(dbag[i][1]/3)) petname.append(pet[sz[i+3]][0]) sum=end=0 while 1>0: if lv==0: break sum+=1 ene=12 for i in range(3): table(dheart,heart,sum,ene) print("(1):",petname[0],"(4):",petname[3],"(",dbag[0][0],"命",dbag[0][1],"阶",randint(0,9),"星)") print("(2):",petname[1],"(5):",petname[4],"(",dbag[1][0],"命",dbag[1][1],"阶",randint(0,9),"星)") print("(3):",petname[2],"(6):",petname[5],"(",dbag[2][0],"命",dbag[2][1],"阶",randint(0,9),"星)") a=int(input("选择宠物")) if a==0: end=3 break if dheart[a-1]==0 or a>3 or a<1: print("请重新选择") sleep(1) continue b=int(input("选择技能"+"(1)"+pet[sz[a-1]][2][0][0]+str(pet[sz[a-1]][2][0][4])+"点"+"(2)"+pet[sz[a-1]][2][1][0]+str(pet[sz[a-1]][2][1][4])+"点")) if ene>=pet[sz[a-1]][2][b-1][4]: ene-=pet[sz[a-1]][2][b-1][4] elif ene<2: print("能量不足,敌方先动") sleep(1) break c=int(input("选择对象")) clear_history() dheart=petattack(sz,a-1,b,c-1,bag[sz[a-1]+5],dheart,heart,pet[sz[a-1]]) for j in range(6): if dheart[j]<=0: dheart[j]=0 if heart[j]heart[j]: heart[j]=dheart[j] if dheart[0]==dheart[1]==dheart[2]==0: end=2 break table(dheart,heart,sum,ene) back=int(input("任意键确定")) clear_history() if end==2: table(dheart,heart,sum,ene) print("游戏失败,-50$") bag[0]-=50 if bag[0]<0: bag[0]=0 back=int(input("任意键确定")) break return bag def chooselevel(): print("level<<<") print("(0)退出") print("(1)普通(1-2命10-30阶0星)") print("(2)中等(3-4命30-50阶0星)") print("(3)困难(5-6命50-70阶0星)") print("(4)恶梦(7-8命70-90阶0星)") print("(5)炸天(9-10命90-110阶0星)") a=int(input()) return a def choosepet(bag,pet): sz=[0,0,0] for u in range(3): clear_history() print("选择宠物<<<") print("(0) 空缺") f=0 ff=[0 for i in range(len(pet))] for i in range(len(pet)): if bag[i+5][0]>0 and pet[i][3]==0: ff[f]=i f+=1 print("("+str(f)+")",pet[i][0],"(",bag[i+5][0],"命",bag[i+5][1],"阶",bag[i+5][2],"星)") a=int(input("选择上阵宠物"+"("+str(u+1)+")")) if a==0: sz[u]=-1 else: sz[u]=ff[a-1] pet[ff[a-1]][3]=1 clear_history() print("上阵宠物:") for i in range(len(pet)): if pet[i][3]==1: print(pet[i][0]) back=int(input("任意键确定")) return sz def table(dheart,heart,sum,ene): print("(0)退出 回合:",str(sum)," 能量:",str(ene)) print("#########################") print("# (1)"+str(dheart[0])+"/"+str(heart[0])+"hp hp"+str(dheart[3])+"/"+str(heart[3])+"(4)#") print("# (2)"+str(dheart[1])+"/"+str(heart[1])+"hp hp"+str(dheart[4])+"/"+str(heart[4])+"(5) #") print("# (3)"+str(dheart[2])+"/"+str(heart[2])+"hp hp"+str(dheart[5])+"/"+str(heart[5])+"(6) #") print("##########################") def test(bag,pet): sz=choosepet(bag,pet) dheart=[0,0,0,0,0,0] heart=[0,0,0,0,0,0] z=99999 petname=[] for i in range(3): if sz[i]!=-1: dheart[i]=2*(pet[sz[i]][1]+bag[sz[i]+5][0]*int(bag[sz[i]+5][1]/3)) heart[i]=2*(pet[sz[i]][1]+bag[sz[i]+5][0]*int(bag[sz[i]+5][1]/3)) petname.append(pet[sz[i]][0]) else: dheart[i]=0 heart[i]=0 petname.append("空缺") dheart[i+3]=99999 heart[i+3]=99999 while dheart[4]!=0: if sz[0]==sz[1]==sz[2]==-1: break clear_history() print("(0)退出<<<") print("(1)",pet[sz[0]][0],dheart[0],"/",heart[0]," 桩(4)",dheart[3],"/99999") print("(2)",pet[sz[1]][0],dheart[1],"/",heart[1]," 桩(5)",dheart[4],"/99999") print("(3)",pet[sz[2]][0],dheart[2],"/",heart[2]," 桩(6)",dheart[5],"/99999") a=int(input("选择宠物")) if a==0: break b=int(input("选择技能"+"(1)"+pet[sz[a-1]][2][0][0]+str(pet[sz[a-1]][2][0][4])+"点"+"(2)"+pet[sz[a-1]][2][1][0]+str(pet[sz[a-1]][2][1][4])+"点")) c=int(input("选择对象")) clear_history() dheart=petattack(sz,a-1,b,c-1,bag[sz[a]+4],dheart,heart,pet[sz[a]]) for j in range(6): if heart[j]

资源文件列表:

宠物游戏.zip 大约有3个文件
  1. main.py 2.33KB
  2. petf.py 7.95KB
  3. petvs.py 11.51KB
0评论
提交 加载更多评论
其他资源 TT打字 练习工具 TT打字练习工具
TT打字练习工具
TT TT TT TT TT TT TT TT TT
TT
Download-1.zip
Download-1.zip
Download-1.zip Download-1.zip
SXGUI-Simple.X.GUI,应用简单,维护方便的GUI库
功能: 拥有动态创建,删除菜单项(即通过封装好的函数实时操作菜单项)的功能,拥有PID过渡动画,资源占用极低,兼容性好,无限制的菜单扩展,框架清晰高效,支持实时添加菜单项,便于移植到各种平台 视频: 【【开源】【人人可复刻】丝滑GUI库】 https://www.bilibili.com/video/BV1SUbLe4EMa/?share_source=copy_web&vd_source=c98177b8ae11f7f29bdf53d91730327c GitHub地址:https://github.com/SuiXinSc/SXGUI--Simple.X.GUI Gitee:https://gitee.com/SuiXinSc/SXGUI--Simple.X.GUI 简要介绍:http://t.csdnimg.cn/orKNq 讲解:http://t.csdnimg.cn/Sp90x 交流Q群: 659512171
newsgroups数据集下载,机器学习必用
20newsgroups数据集下载,机器学习必用,不需要连外网使用。下载数据集后需要修改代码才能使用。 使用方法: 找到D:\software-1\anaconda\Lib\site-packages\sklearn\datasets\_twenty_newsgroups.py下的_twenty_newsgroups.py文件,找到函数_download_20newsgroups,注释#logger.info("Downloading dataset from %s (14 MB)", ARCHIVE.url)和 # archive_path = _fetch_remote(ARCHIVE, dirname=target_dir),新增archive_path = os.path.join(target_dir, r'20news-bydate.tar.gz')
自己用python制作的文字版控制台传奇,功能比较丰富(原创,仅供学习,请勿抄袭和传播)
简要总结和内容描述: main.py: 这个游戏的主控脚本,负责游戏循环和用户界面显示。它提供了一个菜单系统,允许玩家选择不同的游戏功能,如背包、地图、锻造、商店等。 duplicate.py: 包含有关游戏内“副本”或“挑战”的逻辑。玩家可以挑战不同难度的副本,并根据挑战结果获得奖励或遭受失败。 mob.py: 定义了一个Mob类,可能用于处理游戏中的怪物或其他角色。此类包含有关角色生命值计算、经验处理和皮肤系统的方法。 fight.py: 包含战斗系统的代码,允许玩家与怪物战斗,并根据战斗结果获得奖励。 unfight.py: 包含非战斗相关的功能,如计算角色的生命值、转生系统、商店界面和合成系统。 data.py: 包含游戏的初始数据和一些全局变量,如角色基本属性、背包内容、用户名称、怪物类型和地图数据。 basic_f.py: 提供了一些基础函数,如数组求和、数组相加、数组相乘、移除数组中的元素、展示装备属性和数值显示等。 脚本共同构成了一个具有角色扮演元素的游戏,包括战斗、装备、升级、转生和资源管理等系统。代码中使用了大量的列表和数组来存储游戏状态和玩家数据,并
软件测试基础实验.zip
软件测试实验 软件缺陷报告、等价类划分法、边界值分析法、判定表法、因果图法、正交实验法
python 3.9 dlib whl库,包含 windows 版本 和 linux 版本
python 3.9 dlib whl库,包含 windows 版本 和 linux 版本 (1)下载python-dlib-master.zip文件 (2)解压文件夹 (3)到目录 ./python-dlib-master\python-dlib-master\dist 中,可以看到 whl 文件