Example #1
0
    def __init__(self, gameStateObj, upkeep=True):
        # Initial setup
        self.upkeep = upkeep  # Whether I'm running this on upkeep or on endstep
        self.current_phase = gameStateObj.phase.get_current_phase()
        self.previous_phase = gameStateObj.phase.get_previous_phase()
        affected_units = [
            unit for unit in gameStateObj.allunits
            if unit.position and unit.status_effects
        ]
        if self.upkeep:
            self.units = [
                unit for unit in affected_units
                if unit.team == self.current_phase
            ]
        else:
            self.units = [
                unit for unit in affected_units
                if unit.team == self.previous_phase
            ]
        logger.info('Building Status_Processor: %s %s %s', self.upkeep,
                    self.current_phase, self.previous_phase)

        # State control
        self.current_unit = None
        self.current_unit_statuses = []
        self.current_status = None
        self.status_index = 0
        self.state = CustomObjects.StateMachine('begin')
        self.state_buffer = False

        # Animation properties
        self.time_spent_on_each_status = 1200  # Only if it has a onetime animation
        self.start_time_for_this_status = Engine.get_time()

        # Health bar
        self.health_bar = Interaction.HealthBar('splash', None, None)

        # Waiting timer
        self.wait_time = 200
        self.started_waiting = Engine.get_time()