TR
games/sorcery / src / Game / Player.php · commit 613f5fb
<?phpnamespace App\Game;/** The player of the game (the original's player structure). */final class Player{    public int $state = Values::P_WAIT;    public int $y = 0;    public int $x = 0;    public int $frame = 0;    public int $anim = 0;    public int $rows = 24;    public int $aux = 0;    public bool $visible = false;    public int $held = Values::NONE;   // item carried    public int $energy = 99;           // percent    public int $hurt = 0xFF;           // damage accumulator: every underflow costs one point    /** @var array<int, bool> */    public array $items = [];    public function __construct()    {        for ($i = 0; $i < 64; $i++) {            $this->items[$i] = false;        }    }    public function has(int $item): bool    {        return $this->items[$item] ?? false;    }    public function give(int $item): void    {        $this->items[$item] = true;    }}