From 82a73581d607b8dd4297aa5524af7efcff5b0db3 Mon Sep 17 00:00:00 2001 From: poj5yea9z <641807590@qq.com> Date: Thu, 30 May 2024 20:24:39 +0800 Subject: [PATCH] ADD file via upload --- 代码测试_4.py | 430 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 430 insertions(+) create mode 100644 代码测试_4.py diff --git a/代码测试_4.py b/代码测试_4.py new file mode 100644 index 0000000..194492a --- /dev/null +++ b/代码测试_4.py @@ -0,0 +1,430 @@ +import random +Characher_say=0 +Characher_name=0 +Characher_power=0 +Characher_speed=0 +Characher_MAXHP=0 +Characher_MAXMP=0 +Characher_losthp=0 +Characher_lostmp=0 +Characher_DEF=0 +Characher_skill_name=0 +Characher_skill_say=0 +skill_time=0 +monster_name=0 +monster_power=0 +monster_speed=0 +monster_MAXHP=0 +monster_losthp=0 +monster_lostmp=0 +monster_MAXMP=0 +monster_DEF_LV=0 +monster_skillname=0 +monster_find_id=0 +monster_id=0 +map_name=0 +map_id=0 +Attack=0 +true_Attack=0 +sum_Attack=0 +fight_times=0 +fight_time=0 +game_continue=0 +MAP_NO=0 +def yami(): + global Characher_name + global Characher_power + global Characher_speed + global Characher_MAXHP + global Characher_MAXMP + Characher_name="雅羽千曈" + Characher_power=2 + Characher_speed=1 + Characher_MAXHP=20 + Characher_MAXMP=999 +def yara(): + global Characher_name + Characher_name="雅羽千晹" + global Characher_power + Characher_power=10 + global Characher_speed + Characher_speed=5 + global Characher_MAXHP + Characher_MAXHP=80 + global Characher_MAXMP + Characher_MAXMP=20 +def rin(): + global Characher_name + Characher_name="漓音" + global Characher_power + Characher_power=7 + global Characher_speed + Characher_speed=7 + global Characher_MAXHP + Characher_MAXHP=70 + global Characher_MAXMP + Characher_MAXMP=50 +def Characher_skill(): + global Characher_id + if Characher_id==1: + Characher_skill_yami() + if Characher_id==2: + Characher_skill_yara() + if Characher_id==3: + Characher_skill_rin() +def Characher_skill_yami(): + global Characher_id + global Characher_power + global Characher_Attack + global Characher_DEF + global Characher_MP + global true_Attack + global Characher_HP + global Characher_name + global Characher_skill_say + global Characher_skill_name + i=0 + ring=0 + global skill_time + if Characher_id==1: + print ("0.普通攻击") + print ("1.锐枪式") + print ("2.重锤式") + print ("3.虹光流") + print ("4.虹光风暴") + print ("5.突然白给") + skill_id = eval(input("请选择释放的技能")) + if skill_id==0: + Characher_skill_name="普通攻击" + Characher_skill_say=0 + Characher_Attack=Characher_power/5*3 + skill_time=1 + elif skill_id==1: + Characher_skill_name = "锐枪式" + Characher_skill_say=random.randint(1,2) + Characher_true_Attack=3 + skill_time=1 + elif skill_id==2: + Characher_skill_name = "重锤式" + Characher_skill_say=random.randint(1,2) + Characher_true_Attack=5 + skill_time=1 + elif skill_id==3: + Characher_skill_name = "虹光流" + Characher_skill_say=random.randint(1,2) + true_Attack=3 + skill_time=3 + elif skill_id==4: + Characher_skill_name = "虹光风暴" + true_Attack=10 + skill_time=5 + Characher_skill_say=4 + elif skill_id==5: + Characher_skill_say=5 + Characher_HP-=100000 + skill_yami_say() +def skill_yami_say(): + global Characher_skill_say + if Characher_skill_say==0: + print("嗯......我会加油的!嘿!") + elif Characher_skill_say==1: + print("冲鸭!") + elif Characher_skill_say==2: + print("要上了哦~") + elif Characher_skill_say==3: + print("哪个笨蛋想出的这种东西啊!!!!") + else: + print("虽然聚集起来很麻烦......但总是要用呢~") +def Characher_skill_yara(): + print ("0.普通攻击") + print ("1.崩山") + print ("2.灭尘") + print ("3.寸拳") + print ("4.锻钢剑") + print ("5.紫砂") +def Characher_skill_rin(): + print ("0.普通攻击") + print ("1.家传刀法·寂") + print ("2.紊乱附加") + print ("3.避锋·拔刀") + print ("4.秘技·蝰蛇") + print ("5.阿巴阿巴阿巴") +def monster_1(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + monster_name="草球" + monster_id=1 + monster_MAXHP=20 + monster_MAXMP=1 + monster_power=3 + monster_speed=3 +# def monster_2(): +# +# def monster_3(): +# +# def monster_4(): +# +# def monster_5(): +# +# def monster_6(): +# +# def monster_7(): +# +# def monster_8(): +# +# def monster_9(): +# +# def monster_10(): +def monster_skill(): + global monster_id + global monster_power + global monster_skillname + global Attack + global skill_time + if monster_id==1: + a=random.randint(1,3) + if a==1: + monster_skillname="咬" + Attack=monster_power*2 + skill_time=1 + if a==2: + monster_skillname="撞击" + Attack=monster_power*2.5 + skill_time=1 + if a==3: + monster_skillname="草刺" + Attack=monster_power + skill_time=3 +def skill_times(): + i=0 + global skill_time + global true_Attack + global Attack + global sum_Attack + global Characher_skill_name + global monster_skillname + global Characher_name + global monster_name + if Characher_skill_name!=0 and monster_skillname==0: + print(f"{Characher_name}对{monster_name}使用了{Characher_skill_name}") + elif monster_skillname!=0 and Characher_skill_name==0: + print(f"{monster_name}对{Characher_name}使用了{monster_skillname}") + for i in range(skill_time): + sum_Attack+=true_Attack+Attack + print(f"造成了{sum_Attack}伤害") +def choose_1(CH): + print("1.确定") + print("2.拒绝") + a=int(input(CH)) + if a == 1: + return "YES" + if a == 2: + return "NO" +def say(): + say_id=random.randint(1,4) + if say_id==1: + return say_id + if say_id==2: + return say_id + if say_id==3: + return say_id + if say_id==4: + return say_id +def monster_found_prompt(): + global monster_id + global monster_find_id + global monster_name + global Characher_name + global Characher_true_Attack + if monster_id <= 3: + monster_find_id = random.randint(1, 4) + if monster_find_id == 1 and monster_id == 1: + print(f"一只{monster_name}朝着{Characher_name}滚了过来") + elif monster_find_id == 2: + print(f"一只{monster_name}朝着这里过来了") + elif monster_find_id == 3: + print(f"一只{monster_name}冲过来了!") +def monster_fight_time_now(): + global fight_time + global monster_MAXHP + global monster_losthp + global monster_MAXMP + global monster_lostmp + if fight_time==0: + monster_losthp = monster_MAXHP + fight_time+=1 + print("第{}回合".format(fight_time)) + else: + fight_time+=1 + print("第{}回合".format(fight_time)) +def map_0(): + map +def fight(): + t=True + global Characher_name + global Characher_id + global Characher_speed + global Characher_MAXHP + global Characher_losthp + global Characher_MAXMP + global Characher_lostmp + global monster_speed + global monster_MAXHP + global monster_losthp + global monster_MAXMP + global monster_lostmp + global fight_times + global fight_time + global game_continue + global sum_Attack + monster_found_prompt() + while t==True: + if fight_times==0: + Characher_losthp=Characher_MAXHP + Characher_lostmp=Characher_MAXMP + fight_times+=1 + else: + fight_times+=1 + monster_fight_time_now() + print(f"{Characher_name}血量:{Characher_losthp}/{Characher_MAXHP}") + print(f"{Characher_name}灵子力:{Characher_lostmp}/{Characher_MAXMP}") + print(f"{monster_name}剩余血量:{monster_losthp}") + monster_skill() + if Characher_speed >= monster_speed: + Characher_skill() + skill_times() + monster_losthp-=sum_Attack + return_fight_zero() + if monster_losthp<=0: + print("战斗胜利") + game_continue=1 + t=False + skill_times() + Characher_losthp-=sum_Attack + return_fight_zero() + if Characher_losthp<=0: + print(f"{Characher_name}被打扁了!") + print("游戏结束") + t = False + else: + skill_times() + Characher_losthp-=sum_Attack + return_fight_zero() + print(f"{Characher_name}血量:{Characher_losthp}/{Characher_MAXHP}") + print(f"{Characher_name}灵子力:{Characher_lostmp}/{Characher_MAXMP}") + print(f"{monster_name}剩余血量:{monster_losthp}") + if Characher_losthp<=0: + print(f"{Characher_name}被打扁了!") + print("游戏结束") + t=False + Characher_skill() + skill_times() + monster_losthp-=sum_Attack + return_fight_zero() + if monster_losthp<=0: + print("战斗胜利") + game_continue=1 + t=False + return_zero() +def map_find(): + global MAP_NO + if MAP_NO==0: + home_find=0 + home_find=eval(input("请选择你要探索的")) +def return_fight_zero(): + global Characher_skill_name + Characher_skill_name=0 + global monster_skillname + monster_skillname=0 + global skill_time + skill_time=0 + global sum_Attack + sum_Attack=0 + global Attack + Attack=0 + global true_Attack + true_Attack=0 +def return_zero(): + global Characher_say + Characher_say= 0 + global Characher_true_Attack + Characher_true_Attack= 0 + global Characher_skill_name + Characher_skill_name= 0 + global Characher_skill_say + Characher_skill_say= 0 + global monster_name + monster_name= 0 + global monster_power + monster_power= 0 + global monster_speed + monster_speed= 0 + global monster_MAXHP + monster_MAXHP= 0 + global monster_losthp + monster_losthp= 0 + global monster_lostmp + monster_lostmp= 0 + global monster_MAXMP + monster_MAXMP= 0 + global monster_Attack + monster_Attack= 0 + global monster_DEF_LV + monster_DEF_LV= 0 + global monster_skillname + monster_skillname= 0 + global monster_find_id + monster_find_id= 0 + global monster_id + monster_id= 0 + global fight_time + fight_time= 0 + +print("1.开始游戏") +print("2.继续游戏") +print("3.结束游戏") +choose_begin=int(input("请选择")) +if choose_begin==1: + print("1.雅羽千曈") + print("2.雅羽千晹") + print("3.漓音") + Characher_id = int(input("请选择你的角色:")) + if Characher_id == 1: + print("开始冒险了~") + yami() + elif Characher_id == 2: + print("开始吧。") + yara() + elif (Characher_id == 3): + print("(安静地拿起刀)") + rin() + if choose_1("你好,我是向导梦花")=="YES": + if choose_1("因为这是第一次的测试版,所以并没有额外的新手向导员之类的东西")=="YES": + if choose_1("以后的版本更新这个地方大概会由拾羽凝,也就是千曈千晹的妈妈负责引导吧......") == "YES": + if choose_1("闲话到此为止哦,下面开始进行游戏的大概内容") =="YES": + if choose_1("接下来我将投放一只鸦伶世界的代表怪物'草球作为第一次战斗的对象,没关系,很好打的")=="YES": + monster_1() + fight() + if game_continue==1: + print("看来你已经熟悉游戏的大致流程了,接下来就开始你的冒险吧") + #map_find() + else: + print("是吗......那下次再见") + else: + print("是吗......那下次再见") + else: + print("是吗......那下次再见") + else: + print("是吗......那下次再见") + else: + print("是吗......那下次再见") + + +# print("1.继续") +# print("2.结束游戏") +# int(input("因为这是第一次的测试版,所以并没有额外的新手向导员之类的东西")) +# print("请选择需要探索的地图") \ No newline at end of file