Commit 9c92ad28 by BellCodeEditor

save project

parent 9a581ef4
Showing with 15 additions and 5 deletions
......@@ -5,10 +5,20 @@ class Hero(object):
self.hp = 250
self.attack = 40
self.name = name
def combat(): # 攻击
???
def combat(self): # 攻击
self.hp-=self.attack
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
yase.combat(houyi)
s1=str(yase)+"攻击了"+str(houyi)+","
s2="造成"+str(self.attack)+"点伤害,"
s3=str(houyi)+'还剩下'+str(houyi.hp)+'点血量。'
s=s1+s2+s3
print(s)
\ 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