Commit 83e071ab by BellCodeEditor

save project

parent 2d1d6216
Showing with 36 additions and 8 deletions
class hero: t=input("请出拳(石头/剪刀/布)")
def __init__(self): print("玩家出拳:"+t)
self.leve=1
self.hp=999999999999999 import random
self.attack=999999999999999999999999999999999 a=["石头","剪刀","布"]
self.defense=99999999999999999999999999999900000000000000 computer=random.choice(a)
后羿=hero() print("计算机出的是:"+computer)
print(yase.attack)
if t==computer:
print("平局")
elif t=="石头"and computer=="剪刀":
print("哈哈哈哈哈,你赢了!")
elif t=="布"and computer=="石头":
print("哈哈哈哈哈,你赢了!")
elif t=="剪刀"and computer=="布":
print("哈哈哈哈哈,你赢了!")
else:
print("哈哈哈哈哈,你输了!")
......
class hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def fanffa(self):
self.level=self.level+1
self.hp=self.hp+200
self.attack=self.attack+4
def combat(self,enemy):
enemy.hp -= self.attack
info1 = self.name+"对"+enemy.name+"发起攻击"
info2 = "造成"+str(self.attack)+"伤害"
info3 = enemy.name+"还剩下"+str(enemy.py)+"血量"
info = info1 + info2 +info3
print(info)
\ 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