Commit e6bddf22 by BellCodeEditor

save project

parent 95469278
Showing with 5 additions and 7 deletions
# 英雄角色类
class Hero(object):
def __init__(self, name):
def __init__(self,name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def combat(self,name):
enemy.hp-=selfattack
def combat(self,enemy):
enemy.hp-=self.attack
into=str(self.name)+"对"+str(enemy.name)+"发起进攻"
into1=str(enemy.name)+"受到"+str(self.attack)+"伤害"
into2=str(enemy.name)+"还剩下"+str(enemy.hp)
if enemy.hp>0
into=into+into1+into2
if enemy.hp>0:
into3=into+into1+into2
print(into3)
else:
print(into+into1+str(enemy.name)+"已阵亡")
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
class Play)()
\ 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