import time
class Bullet:
def init(self):
self.clip = None
def install_clip_clip(self,clip):
if not self . clip:
print(“装弹成功”)
else:
print(“枪已经有弹夹”)
class Actor:
def init(self,name):
self .name = name #姓名
self . HP = 100 #血量
self . PP = 0 #护甲
def install_clip(self,clip,bullet):
clip .install_bullet(bullet)
def install_gun(self,clip,gun,Gun):
gun.instll_clip(bullet)
def fire(self):
pass
class Gun:
def init(self):
self . clip = None
class Bullte:
def init(self):
self . damage = 40
class Clip:
def init(self):
self.buttle_list =[]
self . capacity = 100
def install_bullet(self,bullet):
if len(self.buttle_list) <self.capacity:
time.sleep(1)
print(“装弹中<<<<<<<<<<<<<”)
self.buttle_list.append(bullet)
print(“当前子弹容量{}/{}”.format(len(self.buttle_list),self.capacity))
else:
print(“弹夹已满,装弹失败”)
actor = Actor(“ZM”)
gun = Gun()
bullet = Bullte()
clip = Clip()
while True:
bullet = Bullte()
actor .install_clip(clip.buttle)
if len (clip.buttle_list) > 19:
break
actor.install_clip(clip,bullet)