버그 수정
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\Constraint;
|
||||
use \sammo\GameConst;
|
||||
|
||||
class BeOpeningPart extends Constraint{
|
||||
const REQ_VALUES = Constraint::REQ_INT_ARG;
|
||||
|
||||
@@ -26,6 +26,8 @@ abstract class Constraint{
|
||||
protected $nation = null;
|
||||
protected $arg = null;
|
||||
|
||||
protected $cmd_arg = null;
|
||||
|
||||
protected $destGeneral = null;
|
||||
protected $destCity = null;
|
||||
protected $destNation = null;
|
||||
@@ -40,38 +42,43 @@ abstract class Constraint{
|
||||
return static::REQ_VALUES;
|
||||
}
|
||||
|
||||
public function general(array $general){
|
||||
public function setGeneral(array $general){
|
||||
$this->general = $general;
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
}
|
||||
public function city(array $city){
|
||||
public function setCity(array $city){
|
||||
$this->city = $city;
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
}
|
||||
public function nation(array $nation){
|
||||
public function setNation(array $nation){
|
||||
$this->nation = $nation;
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
}
|
||||
public function arg($arg){
|
||||
public function setArg($arg){
|
||||
$this->arg = $arg;
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
}
|
||||
public function setCmdArg($cmd_arg){
|
||||
$this->cmd_arg = $cmd_arg;
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
}
|
||||
|
||||
public function destGeneral(array $general){
|
||||
public function setDestGeneral(array $general){
|
||||
$this->destGeneral = $general;
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
}
|
||||
public function destCity(array $city){
|
||||
public function setDestCity(array $city){
|
||||
$this->destCity = $city;
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
}
|
||||
public function destNation(array $nation){
|
||||
public function setDestNation(array $nation){
|
||||
$this->destNation = $nation;
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
@@ -84,14 +91,14 @@ abstract class Constraint{
|
||||
continue;
|
||||
}
|
||||
switch($key){
|
||||
case 'general': $self->general($value); break;
|
||||
case 'city': $self->city($value); break;
|
||||
case 'nation': $self->nation($value); break;
|
||||
case 'arg': $self->arg($value); break;
|
||||
case 'general': $self->setGeneral($value); break;
|
||||
case 'city': $self->setCity($value); break;
|
||||
case 'nation': $self->setNation($value); break;
|
||||
case 'cmd_arg': $self->setCmdArg($value); break;
|
||||
|
||||
case 'destGeneral': $self->destGeneral($value); break;
|
||||
case 'destCity': $self->destCity($value); break;
|
||||
case 'destNation': $self->destNation($value); break;
|
||||
case 'destGeneral': $self->setDestGeneral($value); break;
|
||||
case 'destCity': $self->setDestCity($value); break;
|
||||
case 'destNation': $self->setDestNation($value); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +176,7 @@ abstract class Constraint{
|
||||
}
|
||||
|
||||
public function reason():?string{
|
||||
if(!$this->tested === false){
|
||||
if($this->tested === false){
|
||||
throw new \RuntimeException(get_class($this).'::test가 실행되지 않음');
|
||||
}
|
||||
return $this->reason;
|
||||
@@ -186,11 +193,13 @@ abstract class Constraint{
|
||||
/** @var \sammo\Constraint\Constraint $contraint */
|
||||
$constraint = call_user_func($method,$input);
|
||||
|
||||
assert($constraint !== null);
|
||||
assert($constraint instanceof Constraint);
|
||||
assert(count($constraintArgs) < 3);
|
||||
|
||||
if(count($constraintArgs) > 1){
|
||||
if(count($constraintArgs) == 2){
|
||||
$arg = $constraintArgs[1];
|
||||
$constraint->arg($arg);
|
||||
$constraint->setArg($arg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,11 +69,11 @@ class ConstraintHelper{
|
||||
}
|
||||
|
||||
static function DisallowDiplomacyStatus(int $nationID, array $disallowList):array{
|
||||
return [__FUNCTION__, $nationID, $disallowList];
|
||||
return [__FUNCTION__, [$nationID, $disallowList]];
|
||||
}
|
||||
|
||||
static function ExistsAllowJoinNation(int $relYear, array $excludeNationList):array{
|
||||
return [__FUNCTION__, $relYear, $excludeNationList];
|
||||
return [__FUNCTION__, [$relYear, $excludeNationList]];
|
||||
}
|
||||
|
||||
static function ExistsDestGeneral():array{
|
||||
@@ -145,7 +145,7 @@ class ConstraintHelper{
|
||||
}
|
||||
|
||||
static function RemainCityCapacity($key, string $actionName):array{
|
||||
return [__FUNCTION__, $key, $actionName];
|
||||
return [__FUNCTION__, [$key, $actionName]];
|
||||
}
|
||||
|
||||
static function RemainCityTrust(string $actionName):array{
|
||||
@@ -153,7 +153,7 @@ class ConstraintHelper{
|
||||
}
|
||||
|
||||
static function ReqCityCapacity($key, string $keyNick, $reqVal):array{
|
||||
return [__FUNCTION__, $key, $keyNick, $reqVal];
|
||||
return [__FUNCTION__, [$key, $keyNick, $reqVal]];
|
||||
}
|
||||
|
||||
static function ReqCityTrust(float $minTrust):array{
|
||||
@@ -165,7 +165,7 @@ class ConstraintHelper{
|
||||
}
|
||||
|
||||
static function ReqEnvValue($key, string $keyNick, string $comp, $reqVal, string $failMessage):array{
|
||||
return [__FUNCTION__, $key, $keyNick, $comp, $reqVal, $failMessage];
|
||||
return [__FUNCTION__, [$key, $keyNick, $comp, $reqVal, $failMessage]];
|
||||
}
|
||||
|
||||
static function ReqGeneralAtmosMargin(int $maxAtmos):array{
|
||||
@@ -193,7 +193,7 @@ class ConstraintHelper{
|
||||
}
|
||||
|
||||
static function ReqGeneralValue($key, string $keyNick, string $comp, $reqVal):array{
|
||||
return [__FUNCTION__, $key, $keyNick, $comp, $reqVal];
|
||||
return [__FUNCTION__, [$key, $keyNick, $comp, $reqVal]];
|
||||
}
|
||||
|
||||
static function ReqNationGold(int $reqGold):array{
|
||||
@@ -205,7 +205,7 @@ class ConstraintHelper{
|
||||
}
|
||||
|
||||
static function ReqNationValue($key, string $keyNick, string $comp, $reqVal):array{
|
||||
return [__FUNCTION__, $key, $keyNick, $comp, $reqVal];
|
||||
return [__FUNCTION__, [$key, $keyNick, $comp, $reqVal]];
|
||||
}
|
||||
|
||||
static function ReqTroopMembers():array{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\Constraint;
|
||||
use \sammo\GameConst;
|
||||
|
||||
class NotOpeningPart extends Constraint{
|
||||
const REQ_VALUES = Constraint::REQ_INT_ARG;
|
||||
|
||||
Reference in New Issue
Block a user