From 60e9657dfbf75a08484e5b50ea6cfd3f798b2a75 Mon Sep 17 00:00:00 2001 From: xzy Date: Mon, 27 May 2024 11:26:37 +0800 Subject: [PATCH] first commit --- 代码测试.py | 324 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 代码测试.py diff --git a/代码测试.py b/代码测试.py new file mode 100644 index 0000000..5549bc7 --- /dev/null +++ b/代码测试.py @@ -0,0 +1,324 @@ +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_Attack=0 +Characher_DEF=0 +Characher_true_Attack=0 +Characher_skill_name=0 +Characher_skill_say=0 +monster_name=0 +monster_power=0 +monster_speed=0 +monster_MAXHP=0 +monster_losthp=0 +monster_lostmp=0 +monster_MAXMP=0 +monster_Attack=0 +monster_DEF_LV=0 +monster_skillname=0 +monster_find_id=0 +monster_id=0 +fight_times=0 +fight_time=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 Characher_true_Attack + global Characher_HP + global Characher_name + global Characher_skill_say + i=0 + ring=0 + if Characher_id==1: + print ("0.普通攻击") + print ("1.锐枪式") + print ("2.重锤式") + print ("3.虹光流") + print ("4.虹光风暴") + print ("5.突然白给") + skill_id = eval(input("请选择释放的技能")) + if skill_id==1: + Characher_skill_say=0 + Characher_Attack=Characher_power/5*3 + elif skill_id==2: + Characher_skill_say=random.randint(1,2) + Characher_true_Attack=3 + elif skill_id==3: + Characher_skill_say=random.randint(1,2) + Characher_true_Attack=5 + elif skill_id==4: + Characher_skill_say=3 + for ring in range (5): + Characher_true_Attack+=10 + elif skill_id==5: + Characher_HP-=100000 + print (Characher_skill_say) + 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("要上了哦~") + 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_Attack + global monster_power + global monster_skillname + if monster_id==1: + a=random.randint(1,3) + if a==1: + monster_skillname="咬" + monster_Attack=monster_power*2 + if a==2: + monster_skillname="撞击" + monster_Attack=monster_power*2.5 + if a==3: + monster_skillname="草刺" + monster_Attack=monster_power*3 +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): + 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 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 fight(): + t=True + global Characher_name + global Characher_id + global Characher_true_Attack + global Characher_Attack + global Characher_speed + global Characher_MAXHP + global Characher_losthp + global Characher_MAXMP + global Characher_lostmp + global monster_Attack + global monster_speed + global monster_MAXHP + global monster_losthp + global monster_MAXMP + global monster_lostmp + global fight_times + global fight_time + while t==True: + monster_found_prompt() + if fight_times==0: + Characher_losthp = Characher_MAXHP + Characher_lostmp = Characher_MAXMP + fight_times += 1 + else: + fight_times+=1 + print(f"{Characher_name}:当前的血量:{Characher_losthp}/{Characher_MAXHP}") + print(f"{Characher_name}:当前的灵子力:{Characher_lostmp}/{Characher_MAXMP}") + Characher_skill() + monster_skill() + fight_time_now() + if Characher_speed >= monster_speed: + a=Characher_true_Attack+Characher_Attack + monster_losthp -= a + print(f"对{monster_name}造成了{a}点伤害") + if monster_losthp<=0: + print("战斗胜利") + t=False + Characher_losthp-=monster_Attack + if Characher_losthp<=0: + print(f"{Characher_name}被打扁了!") + print("游戏结束") + t = False + else: + Characher_losthp-=monster_Attack + print(f"{monster_name}对{Characher_name}造成了{monster_Attack}点伤害") + if Characher_losthp<=0: + print(f"{Characher_name}被打扁了!") + print("游戏结束") + t=False + a=Characher_true_Attack+Characher_Attack + monster_losthp -= a + print(f"对{monster_name}造成了{a}点伤害") + if monster_losthp<=0: + print("战斗胜利") + t=False +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() + print(Characher_MAXMP) + print(Characher_MAXHP) + if choose_1("你好,我是向导梦花")=="YES": + if choose_1("因为这是第一次的测试版,所以并没有额外的新手向导员之类的东西")=="YES": + if choose_1("以后的版本更新这个地方大概会由拾羽凝,也就是千曈千晹的妈妈负责引导吧......") == "YES": + if choose_1("闲话到此为止哦,下面开始进行游戏的大概内容") =="YES": + if choose_1("接下来我将投放一只鸦伶世界的代表怪物'草球作为第一次战斗的对象,没关系,很好打的")=="YES": + monster_1() + fight() + else: + print("是吗......那下次再见") + else: + print("是吗......那下次再见") + else: + print("是吗......那下次再见") + else: + print("是吗......那下次再见") + else: + print("是吗......那下次再见") + + +# print("1.继续") +# print("2.结束游戏") +# int(input("因为这是第一次的测试版,所以并没有额外的新手向导员之类的东西")) +# print("请选择需要探索的地图") \ No newline at end of file