Commit c8210c0d by BellCodeEditor

save project

parent c4a35718
Showing with 25 additions and 6 deletions
......@@ -2,13 +2,33 @@
class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
self.h = 250
self.a = 40
self.n = name
def combat(): # 攻击
def c(self,e): # 攻击
e.h -= self.a
if e.h > 0 :
info = e.n + '剩' + str(e.h) + '血'
print(info)
else:
info = e.n + '卒'
print(info)
exit()
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
yase.c(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