Commit 8fe44369 by BellCodeEditor

save project

parent 9a581ef4
Showing with 11 additions and 3 deletions
......@@ -6,9 +6,16 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
???
def combat(self,df): # 攻击
df.hp-=self.attack
inot1=self.name+'对'+df.name+'攻击'
inot2='造成'+self.attack+'点伤害'
if df.hp>0:
inot3=df.name+'还剩'+df.hp)
inot=inot1+inot2+inot3
print(inot)
else:
inot3='游戏结束'
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ 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