def init(self,
             team_name,
             color=[255, 255, 255],
             is_npc=False,
             position=None):
        GameObject.init(self, ObjectType.ship)

        # used by engine to track ships
        self.id = str(uuid4())

        # used to match NPC client instances to npc ships
        self.is_npc = is_npc

        # allows players to track ships by random id
        #   could be changed to be more readable.
        self.public_id = str(uuid4())
        self.team_name = team_name

        if self.is_npc:
            self.color = None
        else:
            self.color = color

        self.max_hull = GameStats.get_ship_stat(ShipStat.hull,
                                                ModuleLevel.base)
        self.current_hull = self.max_hull

        self.engine_speed = GameStats.get_ship_stat(ShipStat.engine_speed,
                                                    ModuleLevel.base)

        self.weapon_damage = GameStats.get_ship_stat(ShipStat.weapon_damage,
                                                     ModuleLevel.base)
        self.weapon_range = GameStats.get_ship_stat(ShipStat.weapon_range,
                                                    ModuleLevel.base)

        self.cargo_space = GameStats.get_ship_stat(ShipStat.cargo_space,
                                                   ModuleLevel.base)

        self.mining_yield = GameStats.get_ship_stat(ShipStat.mining_yield,
                                                    ModuleLevel.base)

        self.sensor_range = GameStats.get_ship_stat(ShipStat.sensor_range,
                                                    ModuleLevel.base)

        self.module_0 = ModuleType.empty
        self.module_1 = ModuleType.locked
        self.module_2 = ModuleType.locked
        self.module_3 = ModuleType.locked

        self.module_0_level = ModuleLevel.base
        self.module_1_level = ModuleLevel.base
        self.module_2_level = ModuleLevel.base
        self.module_3_level = ModuleLevel.base

        self.action = PlayerAction.none
        self.action_param_1 = None
        self.action_param_2 = None
        self.action_param_3 = None
        self.move_action = None

        # ideally a dictionary of ItemType enums mapped to a count of the number of that item
        self.inventory = {}

        self.position = position

        self.notoriety = 0
        self.legal_standing = LegalStanding.citizen

        self.bounty = 0
        self.bounty_list = []

        self.respawn_counter = -1

        self.credits = 2000

        self.passive_repair_counter = GameStats.passive_repair_counter
Beispiel #2
0
    def init(self, level=1, position=None):
        if level == 1:
            name = "Police"
        elif level == 2:
            name = "Police Elite"
        elif level == 3:
            name = "Enforcer"
        super().init(team_name=name, is_npc=True, position=position)

        if level == 3:
            self.object_type = ObjectType.enforcer
        else:
            self.object_type = ObjectType.police

        # explicitly set ship stats
        if level >= 1:
            self.max_hull = GameStats.get_ship_stat(ShipStat.hull, ModuleLevel.base)
            self.current_hull = self.max_hull
            self.engine_speed = math.floor(GameStats.get_ship_stat(ShipStat.engine_speed, ModuleLevel.base) * 0.8)
            self.weapon_damage = math.floor(GameStats.get_ship_stat(ShipStat.weapon_damage, ModuleLevel.base) * 0.5)
            self.weapon_range = math.floor(GameStats.get_ship_stat(ShipStat.weapon_range, ModuleLevel.base) * 1.25)
            self.cargo_space = math.floor(GameStats.get_ship_stat(ShipStat.cargo_space, ModuleLevel.base) * 0.9)
            self.mining_yield = 0
            self.sensor_range = math.floor(GameStats.get_ship_stat(ShipStat.sensor_range, ModuleLevel.base) * 1.25)

        if level >= 2:
            self.max_hull = GameStats.get_ship_stat(ShipStat.hull, ModuleLevel.one)
            self.current_hull = self.max_hull
            self.engine_speed = GameStats.get_ship_stat(ShipStat.engine_speed, ModuleLevel.one)
            self.weapon_damage = GameStats.get_ship_stat(ShipStat.weapon_damage, ModuleLevel.one)
            self.weapon_range = GameStats.get_ship_stat(ShipStat.weapon_range, ModuleLevel.one)
            self.sensor_range = GameStats.get_ship_stat(ShipStat.sensor_range, ModuleLevel.one)

        if level >= 3:
            self.max_hull = GameStats.get_ship_stat(ShipStat.hull, ModuleLevel.one)
            self.current_hull = self.max_hull
            self.engine_speed = GameStats.get_ship_stat(ShipStat.engine_speed, ModuleLevel.one)
            self.weapon_damage = GameStats.get_ship_stat(ShipStat.weapon_damage, ModuleLevel.one)
            self.weapon_range = GameStats.get_ship_stat(ShipStat.weapon_range, ModuleLevel.one)
            self.sensor_range = GameStats.get_ship_stat(ShipStat.sensor_range, ModuleLevel.one)