Commit 2c0a9d18 by BellCodeEditor

save project

parent 93372fd1
Showing with 14 additions and 14 deletions
class Hero: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name):
self.level=1 self.level=1
self.hp=300
self.attack=40
self.name=name self.name=name
self.hp=hp yase=Hero("yase")
self.attack=attack houyi=Hero("houyi")
def shengji(self): while True:
self.level+=1 choice=input("choose 1 or 2")
self.hp+=50 if choice=="1":
self.attack+=4 houyi.hp-=yase.attack
yase=Hero('yase',300,20) say1="你对"+"对方"+"造成了"+str(yase.attack)+"点伤害"+"现在对方血量为"+str(houyi.hp)
hy=Hero('hy',250,23) print(say1)
k=Hero('K',5600,199) if choice=="2":
yase.hp+=50
say2="你为自己增加了"+str(50)+"点血量"
Hero.shengji(yase)
print(yase.attack)
print(hy.attack)
print(k.attack)
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