Commit 2e356ea6 by BellCodeEditor

save project

parent 2f402e9f
Showing with 4 additions and 3 deletions
# 英雄角色类 # 英雄角色类
def __init__(self, name): class Hero(object):
def __init__(self, name):
self.level = 1 self.level = 1
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 40
...@@ -7,9 +8,9 @@ def __init__(self, name): ...@@ -7,9 +8,9 @@ def __init__(self, name):
def combat(self,enemy): def combat(self,enemy):
enemy.hp-=self.attack enemy.hp-=self.attack
jl1=self+"使用了龟派气功"+enemy jl1=self.name+"对"+enemy.name+"使用了龟派气功"
jl2="造成"+str(self.attack)+"的血量" jl2="造成"+str(self.attack)+"的血量"
if enemyen.hp>0: if enemy.hp>0:
jl3=enemy.name+"还剩下"+str(enemy.hp)+"血量" jl3=enemy.name+"还剩下"+str(enemy.hp)+"血量"
jl=jl1+jl2+jl3 jl=jl1+jl2+jl3
print(jl) print(jl)
......
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