python反恐精英
class Actor:
def init(self,name):
self.name=name
self.HP=100
self.pp=0
def install_clip(self,clip,bullet):
pass
class Gun:
def init(self):
self.clip=None
class Bullet:
def init(self):
self.damage=40
class Clip:
def init(self):
self.bullet_list=[]
self.capacity=35
def install_bullet(self,bullet):
if len(self.bullet_list)<self.capacity:
self.bullet_list.append(bullet)
print(“当前子弹容量{}/{}”.format(len(self.bullet_list),self.capacity))
else:
print(“弹夹已满,装弹失败”)
actor=Actor(“马保国”)
gun=Gun()
bullet=Bullet()
clip=Clip()
while True:
clip.install_bullet(bullet)
if len(clip.bullet_list)>29:
break