Commit 83578994 by BellCodeEditor

save project

parent 0af8803e
Showing with 20 additions and 3 deletions
# 英雄角色类
import random
class Hero(object):
def __init__(self, name):
self.level = 1
......@@ -19,9 +20,26 @@ class Hero(object):
blon=blon1+blon2+blon3
print(blon)
exit()
def cure(self):
self.hp=self.hp+30
if self.hp>self.max_hp:
self.hp=self.max_hp
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
print("-"*30)
print(" 战斗开始")
while True:
print("-"*30,"战斗开始")
\ No newline at end of file
print("-"*30)
a=input("1、攻击,2、治疗,q、游戏退出")
if a=="q":
exit()
if a=="1":
houyi.combat(yase)
if a=="2":
houyi.cure()
b=random.randint(1,3)
if b==1:
yase.cure()
elif b==2:
yase.combat(houyi)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment