Commit c0889d16 by BellCodeEditor

auto save

parent 9a581ef4
Showing with 19 additions and 5 deletions
......@@ -6,9 +6,24 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
???
def combat(self,beida): # 攻击
beida.hp=beida.hp-self.attack
a=self.name+"对"+beida.name+"发起攻击,"
b="造成"+str(self.attack)+"点伤害,"
if beida.hp>0:
c=beida.name+"还剩下"+str(beida.hp)+"血量"
abc=a+b+c
print(abc)
else:
c=beida.name+"阵亡,游戏结束"
abc=a+b+c
print(abc)
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
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