<?php

/**
 * 大乱斗使用骰子随机车
 */

namespace Game\Controller\Activity\Scuffle;

use Framework\Define\ErrorDefine;
use Framework\MVC\ControllerBase;
use Framework\Network\SendMessage;
use Game\Logic\Activity\ScuffleLogic;
use Game\Protobuf\CGRollCar;
use Game\Protobuf\GCRollCar;
use Game\Protobuf\PacketId;

class CG_RollCar extends ControllerBase
{
    use ScuffleLogic;

    private GCRollCar $sendMessage;

    public function __construct()
    {
        $this->message = new CGRollCar();
        $this->sendMessage = new GCRollCar();
    }

    public function run(): int
    {
        $this->sendMessage->setCode($this->playerRollCar());
        SendMessage::getInstance()->sendClient(PacketId::GC_RollCar, $this->sendMessage);
        return ErrorDefine::SUCCESS;
    }
}
