Пример #1
0
    def execute(self):
        if as64core.fade_status in (as64core.FADEOUT_PARTIAL, as64core.FADEOUT_COMPLETE):
            return self.signals["FADEOUT"]

        if as64core.fade_status in (as64core.FADEIN_PARTIAL, as64core.FADEIN_COMPLETE):
            return self.signals["FADEIN"]

        if as64core.prediction_info.prediction in (121, 122):
            normalized_prediction = 1
        else:
            normalized_prediction = -1

        if normalized_prediction == self._prev_prediction * -1:
            self._flash_count += 1

        self._running_total += normalized_prediction
        self._prev_prediction = normalized_prediction

        if -10 < self._running_total < 10 and self._flash_count >= 4:
            print("Flash Detected!")
            print("Running Total:", self._running_total, "Flash Count:", self._flash_count)
            if time.time() - as64core.collection_time > 15:
                print("Increment Star from Flash!")
                as64core.set_star_count(as64core.star_count + 1)

                if as64core.current_split().star_count == as64core.star_count:

                    if as64core.current_split().on_fadeout == 1:
                        as64core.skip()
                    else:
                        as64core.fadeout_count += 1

            return self.signals["COMPLETE"]

        if self.loop_time() < 2:
            return self.signals["LOOP"]
        else:
            return self.signals["COMPLETE"]
Пример #2
0
    def execute(self):
        if as64core.fade_status in (as64core.FADEOUT_PARTIAL, as64core.FADEOUT_COMPLETE):
            return self.signals["FADEOUT"]

        #if as64core.fade_status in (as64core.FADEIN_PARTIAL, as64core.FADEIN_COMPLETE):
            #return self.signals["FADEIN"]

        if as64core.incoming_split():
            if as64core.xcam_count == 0 and as64core.in_xcam and as64core.current_time - as64core.collection_time < 1:
                as64core.split()
            elif as64core.xcam_count == as64core.current_split().on_xcam:
                as64core.xcam_count = 0
                as64core.split()

        return self.signals["LOOP"]
Пример #3
0
    def execute(self):
        if as64core.fade_status in (as64core.FADEOUT_PARTIAL, as64core.FADEOUT_COMPLETE):
            return self.signals["FADEOUT"]

        if as64core.fade_status in (as64core.FADEIN_PARTIAL, as64core.FADEIN_COMPLETE):
            return self.signals["FADEIN"]

        if as64core.prediction_info.prediction in (121, 122) and self.loop_time() > 1:
            return self.signals["FLASH"]

        if time.time() - as64core.collection_time > 11:
            self._death_check()

        if as64core.incoming_split():
            if as64core.xcam_count == 0 and as64core.in_xcam:
                as64core.split()
            elif as64core.xcam_count == as64core.current_split().on_xcam:
                as64core.xcam_count = 0
                as64core.split()

        if self.loop_time() < 6:
            return self.signals["LOOP"]
        else:
            return self.signals["COMPLETE"]
Пример #4
0
    def execute(self):
        if as64core.fade_status in (as64core.FADEOUT_COMPLETE, as64core.FADEOUT_PARTIAL):
            return self.signals["FADEOUT"]
        else:
            if as64core.split_index() > 0:
                prev_split_star = as64core.route.splits[as64core.split_index()-1].star_count
            else:
                prev_split_star = as64core.route.initial_star

            if as64core.prediction_info.prediction == as64core.star_count and as64core.prediction_info.probability > config.get("thresholds", "probability_threshold"):
                as64core.enable_fade_count(True)
                as64core.enable_xcam_count(True)
                return self.signals["START"]
            elif self._star_skip_enabled and prev_split_star <= as64core.prediction_info.prediction <= as64core.current_split().star_count and as64core.prediction_info.probability > config.get("thresholds", "probability_threshold"):
                if as64core.prediction_info.prediction == self._prev_prediction:
                    self._jump_predictions += 1
                else:
                    self._jump_predictions = 0

                if self._jump_predictions >= 4:
                    as64core.enable_fade_count(True)
                    as64core.enable_xcam_count(True)
                    as64core.set_star_count(as64core.prediction_info.prediction)
                    self._jump_predictions = 0
                    self._prev_prediction = -1
                    return self.signals["START"]

                self._prev_prediction = as64core.prediction_info.prediction

        return self.signals["LOOP"]
Пример #5
0
    def execute(self):
        region = as64core.get_region(as64core.FADEOUT_REGION)

        if as64core.fade_status in (as64core.FADEOUT_COMPLETE, as64core.FADEOUT_PARTIAL):
            return self.signals["FADEOUT"]
        else:
            if as64core.split_index() > 0:
                prev_split_star = as64core.route.splits[as64core.split_index() - 1].star_count
            else:
                prev_split_star = as64core.route.initial_star

            if as64core.prediction_info.prediction == as64core.star_count and as64core.prediction_info.probability > config.get(
                    "thresholds", "probability_threshold"):
                as64core.enable_fade_count(True)
                as64core.enable_xcam_count(True)
                as64core.set_in_game(True)
                return self.signals["COMPLETE"]
            elif self._star_skip_enabled and prev_split_star <= as64core.prediction_info.prediction <= as64core.current_split().star_count and as64core.prediction_info.probability > config.get(
                    "thresholds", "probability_threshold"):
                if as64core.prediction_info.prediction == self._prev_prediction:
                    self._jump_predictions += 1
                else:
                    self._jump_predictions = 0

                if self._jump_predictions >= 4:
                    as64core.enable_fade_count(True)
                    as64core.enable_xcam_count(True)
                    as64core.set_star_count(as64core.prediction_info.prediction)
                    self._jump_predictions = 0
                    self._prev_prediction = -1
                    as64core.set_in_game(True)
                    return self.signals["COMPLETE"]

                self._prev_prediction = as64core.prediction_info.prediction

        if as64core.fadein_count == 2:
            region_int = region.astype(int)
            region_int_b, region_int_g, region_int_r = region_int.transpose(2, 0, 1)
            mask = (np.abs(region_int_r - region_int_g) > 25)

            region[mask] = [0, 0, 0]

            if np.any(region == [0, 0, 0]):
                try:
                    time.sleep(self._restart_split_delay)
                except ValueError:
                    pass
                as64core.fadein_count = 0
                as64core.fadeout_count = 0
                as64core.split()
                as64core.set_in_game(True)
                return self.signals["COMPLETE"]

        return self.signals["LOOP"]
Пример #6
0
    def execute(self):
        reset_region = as64core.get_region(as64core.RESET_REGION)
        # TODO: SWITCH TO USING FADE_STATUS
        # If centre of screen is black, and the current split conditions are met, trigger split
        if is_black(reset_region, self._black_threshold) and as64core.incoming_split(star_count=False) and as64core.current_split().split_type == as64core.SPLIT_FADE_ONLY:
            as64core.split()
            self._split_occurred = True

        # Check for a match against the reset_template (SM64 logo)
        if as64core.fade_status == self._is_reset(reset_region, self._reset_template):
            as64core.enable_predictions(True)
            self._split_occurred = False
            self._reset()
            return self.signals["RESET"]
        elif self._is_reset(reset_region, self._reset_template_2):
            as64core.enable_predictions(True)
            self._split_occurred = False
            self._reset()
            return self.signals["RESET"]

        # If both star count, and life count are still black, reprocess fadeout, otherwise fadeout completed
        if as64core.fade_status in (as64core.FADEOUT_COMPLETE, as64core.FADEOUT_PARTIAL):
            return self.signals["LOOP"]
        else:
            as64core.enable_predictions(True)
            self._split_occurred = False
            return self.signals["COMPLETE"]