Ejemplo n.º 1
0
 def ignore_client(self, dt, actions):
     if self.warning < 1:
         if self.current_encounter.has_boss_complain():
             self.dialog = DialogSubState(
                 "[INTERCOM] Boss Daniel",
                 self.current_encounter.say_boss_complain(), self,
                 self.wait_for_player_input)
         self.warning += 1
     else:
         Blackboard().flags += self.current_encounter.ignore_client_flag
         Blackboard().add_tips(-self.current_encounter.penality)
         self.change_substate(self.introduce_next_client)
     return ButtonReleasedAction(Blackboard().stage)
Ejemplo n.º 2
0
 def wait_for_player_input_with_encounter(self, dt, actions):
     for action in actions:
         if isinstance(action, FloorSelected):
             animation = FloorIndicatorAction(Blackboard().stage,
                                              action.data['floor'])
             Blackboard().stage = action.data['floor']
             if action.data['floor'] == self.current_encounter.stage_dest:
                 self.anime = AnimationSubState(animation, self,
                                                self.reach_dest)
             else:
                 self.anime = AnimationSubState(animation, self,
                                                self.ignore_dest)
             return ButtonPushedAction(action.data['floor'])
Ejemplo n.º 3
0
 def wait_for_player_input(self, dt, actions):
     for action in actions:
         if isinstance(action, FloorSelected):
             animation = FloorIndicatorAction(Blackboard().stage,
                                              action.data['floor'])
             if action.data['floor'] == self.current_encounter.stage_src:
                 self.anime = AnimationSubState(animation, self,
                                                self.open_door)
             elif action.data['floor'] == Blackboard().stage:
                 self.change_substate(self.ignore_client)
             else:
                 self.anime = AnimationSubState(animation, self,
                                                self.ignore_client)
             Blackboard().stage = action.data['floor']
             return ButtonPushedAction(action.data['floor'])
Ejemplo n.º 4
0
 def finish_highlight_stage_number(self, dt, actions):
     if Blackboard().stage == self.current_encounter.stage_src:
         self.change_substate(self.open_door)
     else:
         self.warning = 0
         self.change_substate(self.wait_for_player_input)
         return FloorCallAction(self.current_encounter.stage_src)
Ejemplo n.º 5
0
 def give_tips(self, dt, actions):
     if self.current_encounter.tips != 0:
         Blackboard().add_tips(self.current_encounter.tips)
         self.anime = AnimationSubState(CashInAction(), self,
                                        self.open_door_encounter_leave)
     else:
         self.change_substate(self.open_door_encounter_leave)
Ejemplo n.º 6
0
    def open_door(self, dt, actions):
        self.anime = AnimationSubState(ElevatorGateOpenAction(), self,
                                       self.encounter_enter_elevator)

        return [
            ButtonReleasedAction(Blackboard().stage),
            FloorCallAction(None)
        ]
Ejemplo n.º 7
0
    def introduce_next_client(self, dt, actions):
        self.current_encounter = self.day.pop_triggable_encounter(
            Blackboard().flags)

        if self.current_encounter is None:
            self.next_substate = self.end_day
        else:
            print(">>> Level: {} Blinking".format(
                self.current_encounter.raw_json['stage_src']))
            self.change_substate(self.finish_highlight_stage_number)
Ejemplo n.º 8
0
    def main(self):

        game_display: Surface = display.set_mode((self.display_width, self.display_height))
        display.set_caption('Natural 20: Challenge Pixel 2017')
        clock: Clock = pygame.time.Clock()

        self.construct_background(game_display)
        self.init_keypad(game_display)

        crashed = False
        _ = BackgroundMusicTrack()
        while not crashed:
            game_display.fill(color.BLACK)
            self.compute_delta_t()

            for displayable in self.persistent_display.values():
                displayable()
            for displayable in self.temporary_display:
                displayable()
            self.temporary_display.clear()

            str_tips = "{:>6.2f}$".format(Blackboard().tips)
            self.temporary_display.append(drawer.add_text(game_display, str_tips, Vector(90, 380), color.MONEY_COLOR))

            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    crashed = True
                else:
                    self.actions.append(handler.handle(game_display, event, self.persistent_display))

            self.actions = [action for action in self.actions if action]

            domain_actions = self.state_executor.exec(self.delta_t, self.actions)
            self.actions.clear()
            for domain_action in domain_actions:
                if domain_action.persistent_name:
                    self.persistent_display[domain_action.persistent_name] =\
                        domain_action.display(game_display, self.delta_t)
                else:
                    self.temporary_display.append(domain_action.display(game_display, self.delta_t))

            # TEST

            pygame.display.update()

            clock.tick(FPS)
Ejemplo n.º 9
0
 def __init__(self, day):
     super().__init__(self.start)
     self.day = day
     self.finish = False
     self.warning = 0
     Blackboard().stage = self.day.start_stage
Ejemplo n.º 10
0
 def ignore_dest(self, dt, actions):
     Blackboard().flags += self.current_encounter.ignore_dest_flag
     self.dialog = DialogSubState(self.current_encounter.name,
                                  self.current_encounter.say_insult(), self,
                                  self.open_door_encounter_leave)
     return ButtonReleasedAction(Blackboard().stage)
Ejemplo n.º 11
0
 def reach_dest(self, dt, actions):
     Blackboard().flags += self.current_encounter.happy_ending_flag
     self.dialog = DialogSubState(self.current_encounter.name,
                                  self.current_encounter.say_farewell(),
                                  self, self.give_tips)
     return ButtonReleasedAction(Blackboard().stage)