Commit d2f60f56 by BellCodeEditor

save project

parent 9a581ef4
Showing with 14 additions and 3 deletions
......@@ -6,9 +6,19 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
???
def combat(self,hou): # 😍
hou.hp-=self.attack
if self.hp>0:
i1= str(self.name) +"对"+ str(hou.name) +"发动攻击\n"
i2= str(self.name) +"对"+ str(hou.name)+ "造成伤害\n"
i3= str(hou.name) +"还剩下"+str(hou.hp)
print(i1+i2+i3)
if self.hp<0:
i1= str(self.name) +"对"+ str(hou.name)+ "发动攻击\n"
i2= str(self.name) +"对"+ str(hou.name)+ "造成伤害\n"
i3= str(hou.name) +"你已死亡,游戏结束"
print(i1+i2+i3)
exit()
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