'지난 턴'을 관리하는 기능 추가
This commit is contained in:
@@ -28,6 +28,9 @@ class General implements iAction{
|
||||
protected $personalityObj = null;
|
||||
protected $itemObjs = [];
|
||||
|
||||
protected $lastTurn = null;
|
||||
protected $resultTurn = null;
|
||||
|
||||
public function __construct(array $raw, ?array $city, int $year, int $month){
|
||||
//TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함.
|
||||
|
||||
@@ -36,6 +39,11 @@ class General implements iAction{
|
||||
$this->raw = $raw;
|
||||
$this->rawCity = $city;
|
||||
|
||||
if(key_exists('last_turn', $this->raw)){
|
||||
$this->lastTurn = LastTurn::fromJson($this->raw['last_turn']);
|
||||
}
|
||||
$this->resultTurn = new LastTurn();
|
||||
|
||||
|
||||
$this->logger = new ActionLogger(
|
||||
$this->getVar('no'),
|
||||
@@ -61,6 +69,18 @@ class General implements iAction{
|
||||
//TODO: $specialItemClass 설정
|
||||
}
|
||||
|
||||
function getLastTurn():LastTurn{
|
||||
return $this->lastTurn;
|
||||
}
|
||||
|
||||
function setResultTurn(LastTurn $resultTurn){
|
||||
$this->resultTurn = $resultTurn;
|
||||
}
|
||||
|
||||
function getResultTurn():LastTurn{
|
||||
return $this->resultTurn;
|
||||
}
|
||||
|
||||
function clearActivatedSkill(){
|
||||
foreach ($this->activatedSkill as $skillName=>$state) {
|
||||
if (!$state) {
|
||||
@@ -234,6 +254,9 @@ class General implements iAction{
|
||||
* @param \MeekroDB $db
|
||||
*/
|
||||
function applyDB($db):bool{
|
||||
if($this->lastTurn && $this->getLastTurn() != $this->getResultTurn()){
|
||||
$this->setVar('last_turn', $this->getResultTurn()->toJson());
|
||||
}
|
||||
$updateVals = $this->getUpdatedValues();
|
||||
|
||||
if(!$updateVals){
|
||||
|
||||
Reference in New Issue
Block a user