<?php

namespace SpaceDrift;


use System\Arr;

class Spaceship {
    private $health, $currentProblems = [];
    private static $problems = [
        [
            'text' => "A blonde kid with a scarf on a little planet is looking for a fox!",
            'type' => "military"
        ],
        [
            'text' => "An horrible creature with a shiny finger is trying to steal our phone!",
            'type' => "military"
        ],
        [
            'text' => "They’re coming outta the goddamn walls! ",
            'type' => "military"
        ],
        [
            'text' => "Little green guy weirdly speaking is!",
            'type' => "military"
        ],
        [
            'text' => "A humanoid duck is passing us on a flying armchair!",
            'type' => "military"
        ],
        [
            'text' => "A cyberguy says all our base are belong to them!",
            'type' => "discipline"
        ],
        [
            'text' => "A fish headed dude insists that it’s a trap!",
            'type' => "discipline"
        ],
        [
            'text' => "An englishman with a towel is panicking!",
            'type' => "discipline"
        ],
        [
            'text' => "Space pirates ahoy!",
            'type' => "discipline"
        ],
        [
            'text' => "Balding guy with a goatee wants you to kneel!",
            'type' => "discipline"
        ],
        [
            'text' => "The coffee machine has become self-aware!",
            'type' => "tecnical"
        ],
        [
            'text' => "We need a bathroom here!",
            'type' => "tecnical"
        ],
        [
            'text' => "Washing machine has grown legs and arms!",
            'type' => "tecnical"
        ],
        [
            'text' => "Nuclear launch detected!",
            'type' => "tecnical"
        ],
        [
            'text' => "There are no seatbelts!",
            'type' => "tecnical"
        ],
        [
            'text' => "Space hamsters infestation!",
            'type' => "environment"
        ],
        [
            'text' => "Our cat mascotte has tummy ache!",
            'type' => "environment"
        ],
        [
            'text' => "Monkeys are throwing...Well, you know what.",
            'type' => "environment"
        ],
        [
            'text' => "Flying ponies attack!",
            'type' => "environment"
        ],
        [
            'text' => "Laser pterodactyls incoming!",
            'type' => "environment"
        ],
        [
            'text' => "Timey wimey wibbly wobbly singularity!",
            'type' => "scientific"
        ],
        [
            'text' => "Proton Polarity inversion!",
            'type' => "scientific"
        ],
        [
            'text' => "N-dimensional strings tangled!",
            'type' => "scientific"
        ],
        [
            'text' => "Black Hole Vortexing Counterclockwise!",
            'type' => "scientific"
        ],
        [
            'text' => "Quantum Uncertain Whatever!",
            'type' => "scientific"
        ],
    ];

    function __construct($health = 100){
        $this->health = $health;
    }

    function setInitalStatus(){
        $roomsOld = array_keys($this->currentProblems);
        $roomsPossible = array_diff(Game::$rooms, $roomsOld);

        $newProblemNum = 3 - count($this->currentProblems);

        shuffle(self::$problems);
        shuffle($roomsPossible);

        $newProblems = array_slice(self::$problems, 0, $newProblemNum);

        foreach($newProblems as $k => $newProblem){
            $this->currentProblems[$roomsPossible[$k]] = $newProblems;
        }
    }

    function getShipProblems(){
        return $this->currentProblems;
    }
} 