Commit 2762a05e by BellCodeEditor

save project

parent beb166ed
Showing with 8 additions and 7 deletions
......@@ -3,15 +3,15 @@ class Hero(object):
def __init__(self, name):
self.name = name
self.level = 1
self.hp = 250
self.attack = 40
self.hp = 999
self.attack = 87
self.max_hp = self.hp
def cure(self): # 治疗
self.hp+=55
self.hp+=90
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:", 60,",目前的血量为:",self.hp)
print(self.name+"使用了治疗,血量增加:", 90,",目前的血量为:",self.hp)
def combat(self, enemy): # 普通攻击
info1 = self.name+"对"+enemy.name+"发起进攻,"
......@@ -46,8 +46,8 @@ class Player(Hero):
self.hp=self.max_hp
print(self.name+"使用了治疗,血量增加:",str(c),",目前的血量为:",self.hp)
houyi = Player("射手", "后羿")
yase = Hero("垭瑟")
houyi = Player("近战","垭瑟")
yase = Hero("后裔")
while True:
print('-'*30)
a=input("请选择技能:1攻击/2治疗")
......@@ -65,7 +65,7 @@ while True:
if b==3:
yase.cure()
else:
yase.combat(houyi)
yase.combat(yase)
\ No newline at end of file
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