Commit fc72bde8 by BellCodeEditor

save project

parent f2b8c4bd
Showing with 15 additions and 14 deletions
class a:
def __init__(delf,name,hp,attack):
delf.level=1
delf.name=name
delf.hp=hp
delf.attack=attack
def up(delf):
delf.level=delf.level+1
delf.hp=delf.hp+50
delf.attack=delf.attack+4
q=a("jj",30,20)
q.up()
print("jrjk",q.level)
\ No newline at end of file
class hero:
def __init__(self,name):
self.name=name
self.level=1
self.hp=300
self.ak=40
def pk(self,b):
b.hp=b.hp-self.ak
ee1=self.name+'对'+b.name+'点伤害'
ee2='造成'+b.name+'的'+str(self.ak)+'点伤害'
ee3=b.name+'剩余'+str(b.hp)+'血量'
print(ee1+ee2+ee3)
yase=hero('亚瑟')
houyi=hero('后裔')
yase.pk(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