Commit 7c583e33 by BellCodeEditor

save project

parent a3c5abff
Showing with 19 additions and 14 deletions
class Hero:
def __init__(self, name, hp, attack):
def __init__(self, name):
self.level = 1
self.name = name
self.hp=hp
self.attack=attack
self.hp=9000
self.attack=200000
def upgrade():
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
houyi = Hero("pafa", 300, 20)
houyi.upgrade()
print("pafa's leval is", houyi.level)
print("pafa's hap is", houyi.hp)
print("pafa's THATS ALOTA DAMAGE is", houyi.attack)
\ No newline at end of file
def combat(self,enemy):
enemy.hp -= self.attack
info1 = self.name +"start BATTLIN "+ enemy.name
info2 = "u made " +str(self.attack)+"FLEX TAPE"
if enemy.hp > 0:
info3 = enemy.name +"AQUIRED FLEX TAPE AND HAS" + str(enemy.hp)+ "hp left"
info = info1+ info2+ info3
print(info)
else:
info3 = enemy.name + "LOST HIS FLEX PASTE AND DIED"
info=info1+info2+info3
print(info)
yase = Hero("Muffin God ")
houyi= Hero(" Yogurt God ")
yase.combat(houyi)
\ 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