Commit cca56806 by BellCodeEditor

save project

parent 6457c4b1
Showing with 15 additions and 1 deletions
......@@ -7,7 +7,7 @@ class Hero(object):
self.name = name
def combat(self,df): # 攻击
df.hp=df.hp-self.attack
df.hp-=self.attack
a=self.name+'攻击'+df.name
b=df.name+'受到了'+str(self.attack)+'伤害'
if df.hp>0:
......
class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def gongji(self,df):
df.hp -= self.attack
print(df.hp)
ys = Hero('亚瑟')
hy = Hero('后羿')
ys.gongji(hy)
\ 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