diff --git a/Python程序设计课程设计报告模板 2024年.doc b/Python程序设计课程设计报告模板 2024年.doc deleted file mode 100644 index 0102ae5..0000000 Binary files a/Python程序设计课程设计报告模板 2024年.doc and /dev/null differ diff --git a/代码测试.py b/代码测试.py index 5549bc7..9ccb512 100644 --- a/代码测试.py +++ b/代码测试.py @@ -7,11 +7,10 @@ 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 +skill_time=0 monster_name=0 monster_power=0 monster_speed=0 @@ -19,13 +18,23 @@ 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 +map_name=0 +map_id=0 +Attack=0 +true_Attack=0 +sum_Attack=0 fight_times=0 fight_time=0 +game_continue=0 +map_id=0 +map_name=0 +map_active_id=0 +map_now_id=0 + def yami(): global Characher_name global Characher_power @@ -73,36 +82,48 @@ def Characher_skill_yami(): global Characher_Attack global Characher_DEF global Characher_MP - global Characher_true_Attack + global true_Attack global Characher_HP global Characher_name global Characher_skill_say + global Characher_skill_name i=0 - ring=0 - if Characher_id==1: - print ("0.普通攻击") - print ("1.锐枪式") - print ("2.重锤式") - print ("3.虹光流") - print ("4.虹光风暴") - print ("5.突然白给") + global skill_time + print ("0.普通攻击") + print ("1.锐枪式") + print ("2.重锤式") + print ("3.虹光流") + print ("4.虹光风暴") + print ("5.突然白给") skill_id = eval(input("请选择释放的技能")) - if skill_id==1: + if skill_id==0: + Characher_skill_name="普通攻击" Characher_skill_say=0 Characher_Attack=Characher_power/5*3 - elif skill_id==2: + skill_time=1 + elif skill_id==1: + Characher_skill_name = "锐枪式" Characher_skill_say=random.randint(1,2) Characher_true_Attack=3 - elif skill_id==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_say=3 - for ring in range (5): - Characher_true_Attack+=10 + Characher_skill_name = "虹光风暴" + true_Attack=10 + skill_time=5 + Characher_skill_say=4 elif skill_id==5: + Characher_skill_say=5 Characher_HP-=100000 - print (Characher_skill_say) skill_yami_say() def skill_yami_say(): global Characher_skill_say @@ -112,6 +133,8 @@ def skill_yami_say(): print("冲鸭!") elif Characher_skill_say==2: print("要上了哦~") + elif Characher_skill_say==3: + print("哪个笨蛋想出的这种东西啊!!!!") else: print("虽然聚集起来很麻烦......但总是要用呢~") def Characher_skill_yara(): @@ -120,14 +143,12 @@ def Characher_skill_yara(): 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 @@ -135,7 +156,6 @@ def monster_1(): global monster_MAXMP global monster_power global monster_name - monster_name="草球" monster_id=1 monster_MAXHP=20 @@ -159,23 +179,43 @@ def monster_1(): # def monster_9(): # # def monster_10(): - def monster_skill(): global monster_id - global monster_Attack 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="咬" - monster_Attack=monster_power*2 + Attack=monster_power*2 + skill_time=1 if a==2: monster_skillname="撞击" - monster_Attack=monster_power*2.5 + Attack=monster_power*2.5 + skill_time=1 if a==3: monster_skillname="草刺" - monster_Attack=monster_power*3 + 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.拒绝") @@ -184,7 +224,7 @@ def choose_1(CH): return "YES" if a == 2: return "NO" -def say(say): +def say(): say_id=random.randint(1,4) if say_id==1: return say_id @@ -208,7 +248,7 @@ def monster_found_prompt(): print(f"一只{monster_name}朝着这里过来了") elif monster_find_id == 3: print(f"一只{monster_name}冲过来了!") -def fight_time_now(): +def monster_fight_time_now(): global fight_time global monster_MAXHP global monster_losthp @@ -221,19 +261,46 @@ def fight_time_now(): else: fight_time+=1 print("第{}回合".format(fight_time)) +def map_now(): + if map_id==0: + map_0() + if map_id==1: + map_1() + if map_id==2: + map_2() + if map_id==3: + map_3() + print(f"当前区域:{map_name}") +def map_find(): + + + global map_id + map_id=int(input("请")) + +def map_0(): + global + + global map_id + map_id=0 + global map_name + map_name="雅家" + global Characher_id + if Characher_id==1: + home_thing_id=random.randint(1,3) + print("1.离开家") + print("2.拾羽凝正坐在沙发上笑盈盈地看着你") + + 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 @@ -241,44 +308,111 @@ def fight(): global monster_lostmp global fight_times global fight_time + global game_continue + global sum_Attack + monster_found_prompt() while t==True: - monster_found_prompt() if fight_times==0: - Characher_losthp = Characher_MAXHP - Characher_lostmp = Characher_MAXMP - fight_times += 1 + 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_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() - fight_time_now() if Characher_speed >= monster_speed: - a=Characher_true_Attack+Characher_Attack - monster_losthp -= a - print(f"对{monster_name}造成了{a}点伤害") + Characher_skill() + skill_times() + monster_losthp-=sum_Attack + return_fight_zero() if monster_losthp<=0: print("战斗胜利") + game_continue=1 t=False - Characher_losthp-=monster_Attack + skill_times() + Characher_losthp-=sum_Attack + return_fight_zero() if Characher_losthp<=0: print(f"{Characher_name}被打扁了!") print("游戏结束") t = False else: - Characher_losthp-=monster_Attack - print(f"{monster_name}对{Characher_name}造成了{monster_Attack}点伤害") + 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 - a=Characher_true_Attack+Characher_Attack - monster_losthp -= a - print(f"对{monster_name}造成了{a}点伤害") + 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.结束游戏") @@ -297,8 +431,6 @@ if choose_begin==1: elif (Characher_id == 3): print("(安静地拿起刀)") rin() - print(Characher_MAXMP) - print(Characher_MAXHP) if choose_1("你好,我是向导梦花")=="YES": if choose_1("因为这是第一次的测试版,所以并没有额外的新手向导员之类的东西")=="YES": if choose_1("以后的版本更新这个地方大概会由拾羽凝,也就是千曈千晹的妈妈负责引导吧......") == "YES": @@ -306,6 +438,9 @@ if choose_begin==1: if choose_1("接下来我将投放一只鸦伶世界的代表怪物'草球作为第一次战斗的对象,没关系,很好打的")=="YES": monster_1() fight() + if game_continue==1: + print("看来你已经熟悉游戏的大致流程了,接下来就开始你的冒险吧") + #map_find() else: print("是吗......那下次再见") else: