CS编写
菜鸟级别的我。。。。。
嘻嘻嘻。。。。
class Person:
def __init__(self,name):
self.name=name
self.blood=100
def install_bullet(self,clip,bullet):
clip.save_bullets(bullet)
def install_clip(self,gun,clip):
gun.mounting_clip(clip)
def take_gun(self,gun):
self.gun=gun
def fire(self,enemy):
self.gun.shoot(enemy)
def __str__(self):
return self.name+"剩余血量为:"+str(self.blood)
def lose_blood(self,damage):
self.blood-=damage
class Clip:
def __init__(self,capacity):
self.capacity=capacity
self.current_list=[]
def save_bullets(self,bullet):
if len(self.current_list)<self.capacity:
self.current_list.append(bullet)
def __str__(self):
return "弹夹当前的子弹数量为:"+str(len(self.current_list))+"/"+str(self.capacity)
def launch_bu