PHPWarrior\Game::play_current_level PHP Method

play_current_level() public method

public play_current_level ( )
    public function play_current_level()
    {
        $continue = true;
        $this->current_level()->load_player();
        UI::puts(sprintf(__("Starting Level %s"), $this->current_level()->number));
        $this->current_level()->play();
        if ($this->current_level()->is_passed()) {
            if ($this->next_level()->is_exists()) {
                UI::puts(__('Success! You have found the stairs.'));
            } else {
                UI::puts(__('CONGRATULATIONS! You have climbed to the top of the tower and rescued the fair maiden PHP.'));
                $continue = false;
            }
            $this->current_level()->tally_points();
            if ($this->profile->is_epic()) {
                if (!$continue) {
                    UI::puts($this->final_report());
                }
            } else {
                $this->request_next_level();
            }
        } else {
            $continue = false;
            UI::puts(sprintf(__("Sorry, you failed level %s. Change your script and try again."), $this->current_level()->number));
            if (!Config::$skip_input && $this->current_level()->clue && UI::ask(__("Would you like to read the additional clues for this level?"))) {
                UI::puts($this->current_level()->clue);
            }
        }
        return $continue;
    }