diff --git a/代码测试.py b/代码测试.py index b5ccade..467d689 100644 --- a/代码测试.py +++ b/代码测试.py @@ -25,6 +25,7 @@ monster_id=0 map_name=0 map_id=0 Attack=0 +Cost_mp=0 true_Attack=0 sum_Attack=0 fight_times=0 @@ -43,18 +44,18 @@ def yami(): global Characher_MAXMP Characher_name="雅羽千曈" Characher_power=2 - Characher_speed=1 - Characher_MAXHP=20 + Characher_speed=4 + Characher_MAXHP=45 Characher_MAXMP=999 def yara(): global Characher_name Characher_name="雅羽千晹" global Characher_power - Characher_power=10 + Characher_power=8 global Characher_speed Characher_speed=5 global Characher_MAXHP - Characher_MAXHP=80 + Characher_MAXHP=75 global Characher_MAXMP Characher_MAXMP=20 def rin(): @@ -65,7 +66,7 @@ def rin(): global Characher_speed Characher_speed=7 global Characher_MAXHP - Characher_MAXHP=70 + Characher_MAXHP=65 global Characher_MAXMP Characher_MAXMP=50 def Characher_skill(): @@ -84,16 +85,17 @@ def Characher_skill_yami(): global Characher_MP global true_Attack global Characher_HP + global Characher_lostmp global Characher_name global Characher_skill_say global Characher_skill_name - i=0 + global Cost_mp global skill_time print ("0.普通攻击") - print ("1.锐枪式") - print ("2.重锤式") - print ("3.虹光流") - print ("4.虹光风暴") + print ("1.锐枪式(15灵子能)") + print ("2.重锤式(25灵子能)") + print ("3.虹光流(40灵子能)") + print ("4.虹光风暴(100灵子能)") print ("5.突然白给") skill_id = eval(input("请选择释放的技能")) if skill_id==0: @@ -102,24 +104,56 @@ def Characher_skill_yami(): Characher_Attack=Characher_power/5*3 skill_time=1 elif skill_id==1: - Characher_skill_name = "锐枪式" + Cost_mp=15 + Characher_skill_name="锐枪式" Characher_skill_say=random.randint(1,2) - Characher_true_Attack=3 + true_Attack=3*Characher_power + if Cost_mp>Characher_lostmp: + print("剩余灵子能不足将自动释放普通攻击!") + Characher_skill_say = 0 + Characher_Attack = Characher_power / 5 * 3 + skill_time = 1 + else: + Characher_lostmp-=Cost_mp skill_time=1 elif skill_id==2: - Characher_skill_name = "重锤式" + Cost_mp=25 + Characher_skill_name="重锤式" Characher_skill_say=random.randint(1,2) - Characher_true_Attack=5 + true_Attack=5*Characher_power + if Cost_mp>Characher_lostmp: + print("剩余灵子能不足将自动释放普通攻击!") + Characher_skill_say = 0 + Characher_Attack = Characher_power / 5 * 3 + skill_time = 1 + else: + Characher_lostmp-=Cost_mp skill_time=1 elif skill_id==3: - Characher_skill_name = "虹光流" + Cost_mp=40 + Characher_skill_name="虹光流" Characher_skill_say=random.randint(1,2) - true_Attack=3 + true_Attack=3*Characher_power + if Cost_mp>Characher_lostmp: + print("剩余灵子能不足将自动释放普通攻击!") + Characher_skill_say = 0 + Characher_Attack = Characher_power / 5 * 3 + skill_time = 1 + else: + Characher_lostmp-=Cost_mp skill_time=3 elif skill_id==4: - Characher_skill_name = "虹光风暴" - true_Attack=10 + Cost_mp=100 + Characher_skill_name="虹光风暴" + true_Attack=4*Characher_power skill_time=5 + if Cost_mp>Characher_lostmp: + print("剩余灵子能不足将自动释放普通攻击!") + Characher_skill_say = 0 + Characher_Attack = Characher_power / 5 * 3 + skill_time = 1 + else: + Characher_lostmp-=Cost_mp Characher_skill_say=4 elif skill_id==5: Characher_skill_say=5 @@ -156,29 +190,150 @@ def monster_1(): global monster_MAXMP global monster_power global monster_name - monster_name="草球" + global monster_DEF_LV + monster_DEF_LV=0 + monster_name="大黄" monster_id=1 + monster_MAXHP=18 + monster_MAXMP=5 + monster_power=5 + monster_DEF_LV=0 + monster_speed=3 +def monster_2(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + global monster_DEF_LV + monster_name="草球" + monster_id=2 monster_MAXHP=20 monster_MAXMP=1 monster_power=3 + monster_DEF_LV=1 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_3(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + global monster_DEF_LV + monster_name="狼" + monster_id=3 + monster_MAXHP=30 + monster_MAXMP=5 + monster_power=5 + monster_DEF_LV=1 + monster_speed=5 +def monster_4(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + global monster_DEF_LV + monster_name="野猪" + monster_id=4 + monster_MAXHP=50 + monster_MAXMP=7 + monster_power=4 + monster_DEF_LV=2 + monster_speed=4 +def monster_5(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + global monster_DEF_LV + monster_name="牛" + monster_id=5 + monster_MAXHP=55 + monster_MAXMP=10 + monster_power=4 + monster_DEF_LV=2 + monster_speed=5 +def monster_6(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + global monster_DEF_LV + monster_name="蛇" + monster_id=6 + monster_MAXHP=40 + monster_MAXMP=5 + monster_power=6 + monster_DEF_LV=1 + monster_speed=6 +def monster_7(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + global monster_DEF_LV + monster_name="蜘蛛" + monster_id=7 + monster_MAXHP=45 + monster_MAXMP=5 + monster_power=4 + monster_DEF_LV=1 + monster_speed=5 +def monster_8(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + global monster_DEF_LV + monster_name="熊" + monster_id=8 + monster_MAXHP=70 + monster_MAXMP=15 + monster_power=5 + monster_DEF_LV=2 + monster_speed=4 +def monster_9(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + global monster_DEF_LV + monster_name="虚灵武士" + monster_id=9 + monster_MAXHP=80 + monster_MAXMP=20 + monster_power=8 + monster_DEF_LV=2 + monster_speed=4 +def monster_10(): + global monster_id + global monster_speed + global monster_MAXHP + global monster_MAXMP + global monster_power + global monster_name + global monster_DEF_LV + monster_name="观察者" + monster_id=10 + monster_MAXHP=500 + monster_MAXMP=550 + monster_power=10 + monster_DEF_LV=3 + monster_speed=7 def monster_skill(): global monster_id global monster_power @@ -191,31 +346,24 @@ def monster_skill(): monster_skillname="咬" Attack=monster_power*2 skill_time=1 - if a==2: + elif a==2: monster_skillname="撞击" Attack=monster_power*2.5 skill_time=1 - if a==3: + elif monster_id==2: + a=random.randint(1,2) + if a==1: + monster_skillname="咬" + Attack=monster_power*2 + skill_time=1 + elif a==2: + monster_skillname="撞击" + Attack=monster_power*2.5 + skill_time=1 + elif 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.拒绝") @@ -261,7 +409,100 @@ def monster_fight_time_now(): else: fight_time+=1 print("第{}回合".format(fight_time)) +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 + global monster_DEF_LV + if monster_DEF_LV == 1: + Attack =Attack/10*9 + elif monster_DEF_LV == 2: + Attack =Attack/10*8 + elif monster_DEF_LV == 3: + Attack =Attack/10*7 + 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 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}") + 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 + monster_skill() + skill_times() + Characher_losthp-=sum_Attack + return_fight_zero() + if Characher_losthp<=0: + print(f"{Characher_name}被打扁了!") + print("游戏结束") + t = False + else: + monster_skill() + 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_now(): + global map_name if map_id==0: map_0() elif map_id==1: @@ -271,9 +512,9 @@ def map_now(): else: map_3() print(f"当前区域:{map_name}") -def map_find(): - global map_id - map_id=int(input("请")) +# def map_find(): +# global map_id +# map_id=int(input("请选择你需要探索的区域")) def map_0(): global Characher_id @@ -327,7 +568,6 @@ def map_0(): if rin_say==3: print("漓音:真的愿意......成为我的鸦吗?") print("雅羽千曈:嗯......这个嘛......以后再说吧~") - print("1.离开家") def map_1(): global map_id @@ -339,73 +579,7 @@ def map_2(): global map_name map_id=2 map_name="平原" -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: @@ -483,11 +657,12 @@ if choose_begin==1: if choose_1("以后的版本更新这个地方大概会由拾羽凝,也就是千曈千晹的妈妈负责引导吧......") == "YES": if choose_1("闲话到此为止哦,下面开始进行游戏的大概内容") =="YES": if choose_1("接下来我将投放一只鸦伶世界的代表怪物'草球作为第一次战斗的对象,没关系,很好打的")=="YES": - monster_1() + monster_2() fight() if game_continue==1: print("看来你已经熟悉游戏的大致流程了,接下来就开始你的冒险吧") map_0() + map_now() map_find() else: print("是吗......那下次再见") diff --git a/工作簿2.xlsx b/工作簿2.xlsx new file mode 100644 index 0000000..31ac638 Binary files /dev/null and b/工作簿2.xlsx differ