Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

bellcode / lesson12-4

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • lesson12-4
  • srh.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    save project · da8e5c54
    BellCodeEditor committed 2 years ago
    da8e5c54
srh.py 589 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
class Hero:
    def _init_(self,name,hp,attack):
        self.level = 1
        self.name = name
        self.hp = hp
        self.attack = attack
    def combat(self,enemy):
        info1 = self.name+"对"+enemy.name+"发起进攻,"
        info2 = "造成"+str(self.attack)+"点伤害,"
        enemy.hp -= self.attack
        if enemy.hp > 0:
            info3 = enemy.name+
def upgerde():
    self.level=self.level+1
    self.hp=self.hp+50
    self.attack=self.attack+4

houyi = Hero("后羿",240,23)
houyi.upgerde()    
print("亚瑟的血量值为:",yase.hp)