Commit 8371d9e5 by BellCodeEditor

save project

parent fb746617
Showing with 11 additions and 12 deletions
...@@ -2,15 +2,15 @@ class here: ...@@ -2,15 +2,15 @@ class here:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.level=1 self.level=1
self.name=name self.name=name
self.hp=hp self.hp=250
self.attack=attack self.attack=40
def statin(self):
self.level=self.level+1 def combat(self,enemy):
self.hp=self.hp+20 enemy.hp -= self.attack
self.attack=self.attack+50 info1 = self.name+"对"+enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
info3 = enemy.name+"还剩下"+str(enemy.hp)+"血量"
info = infoin+info2+info3
print(info)
yase=here("亚瑟",20,50)
yase.statin()
print(yase.name)
print(yase.hp)
print(yase.attack)
\ 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