Commit 554eb379 by BellCodeEditor

auto save

parent 9a581ef4
Showing with 14 additions and 3 deletions
......@@ -3,11 +3,22 @@ class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.attack = 250
self.name = name
def combat(): # 攻击
???
def combat(self,name1): # 攻击
name1.hp-=self.attack
xx1=self.name+"对"+name1.name+"发起了进攻"
xx2="造成了"+str(self.attack)+"点伤害"
if name1.hp >0:
xx3=name1.name+"还剩下"+str(name1.hp)+"血量"
xx=xx1+xx2+xx3
print(xx)
else:
xx3=name1.name+"阵亡,游戏结束"
xx=xx1+xx2+xx3
print(xx)
exit()
yase = Hero("垭瑟")
houyi= Hero("后羿")
......
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