버그 수정
This commit is contained in:
@@ -258,11 +258,6 @@ abstract class BaseCommand{
|
||||
}
|
||||
|
||||
public function testReservable():?string{
|
||||
if(!$this->isArgValid()){
|
||||
$this->reasonNotReservable = '인자가 올바르지 않습니다.';
|
||||
$this->reservable = false;
|
||||
return $this->reasonNotReservable;
|
||||
}
|
||||
if($this->reservableConstraints === null){
|
||||
return null;
|
||||
}
|
||||
@@ -271,6 +266,7 @@ abstract class BaseCommand{
|
||||
return $this->reasonNotReservable;
|
||||
}
|
||||
|
||||
$this->generalObj->unpackAux();
|
||||
$constraintInput = [
|
||||
'general'=>$this->generalObj->getRaw(),
|
||||
'city'=>$this->city,
|
||||
@@ -305,6 +301,7 @@ abstract class BaseCommand{
|
||||
return $this->reasonNotRunnable;
|
||||
}
|
||||
|
||||
$this->generalObj->unpackAux();
|
||||
$constraintInput = [
|
||||
'general'=>$this->generalObj->getRaw(),
|
||||
'city'=>$this->city,
|
||||
|
||||
@@ -19,11 +19,6 @@ class AllowJoinDestNation extends Constraint{
|
||||
throw new \InvalidArgumentException("require auxVar in general");
|
||||
}
|
||||
|
||||
if(!key_exists('joinedNations', $this->general['auxVar'])){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("require joinedNations in general['auxVar']");
|
||||
}
|
||||
|
||||
if(!key_exists('scout', $this->destNation)){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("require scout in nation");
|
||||
@@ -55,7 +50,7 @@ class AllowJoinDestNation extends Constraint{
|
||||
return false;
|
||||
}
|
||||
|
||||
$joinedNations = $this->general['auxVar']['joinedNations'];
|
||||
$joinedNations = $this->general['auxVar']['joinedNations']??[];
|
||||
if(in_array($this->destNation['nation'], $joinedNations)){
|
||||
$this->reason = "이미 임관했었던 국가입니다.";
|
||||
return false;
|
||||
|
||||
+35
-9
@@ -130,6 +130,7 @@ class GeneralAI
|
||||
$this->genType = $this->calcGenType($general);
|
||||
|
||||
$this->calcDiplomacyState();
|
||||
LogText('전쟁상태', "{$this->general->getName()} {$this->nation['name']} {$this->dipState}");
|
||||
}
|
||||
|
||||
public function getGeneralObj(): General
|
||||
@@ -190,13 +191,15 @@ class GeneralAI
|
||||
$nationID
|
||||
);
|
||||
|
||||
$onWar = false;
|
||||
$onWar = 0;
|
||||
$onWarReady = 0;
|
||||
$warTargetNation = [];
|
||||
foreach ($warTarget as [$warNationID, $warState]) {
|
||||
if ($warState == 0) {
|
||||
$onWar = true;
|
||||
$onWar += 1;
|
||||
$warTargetNation[$warNationID] = 2;
|
||||
} else {
|
||||
$onWarReady += 1;
|
||||
$warTargetNation[$warNationID] = 1;
|
||||
}
|
||||
}
|
||||
@@ -221,10 +224,8 @@ class GeneralAI
|
||||
|
||||
if ($this->attackable) {
|
||||
//전쟁으로 인한 attackable인가?
|
||||
if ($onWar) {
|
||||
if ($onWar || !$onWarReady) {
|
||||
$this->dipState = self::d전쟁;
|
||||
} else {
|
||||
$this->dipState = self::d징병;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1108,6 +1109,13 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
if($this->nation['gold'] < $this->nationPolicy->reqNationGold){
|
||||
return null;
|
||||
}
|
||||
if($this->nation['rice'] < $this->nationPolicy->reqNationRice){
|
||||
return null;
|
||||
}
|
||||
|
||||
$nation = $this->nation;
|
||||
$candidateArgs = [];
|
||||
$remainResource = [
|
||||
@@ -1202,6 +1210,13 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
if($this->nation['gold'] < $this->nationPolicy->reqNationGold){
|
||||
return null;
|
||||
}
|
||||
if($this->nation['rice'] < $this->nationPolicy->reqNationRice){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$nation = $this->nation;
|
||||
$candidateArgs = [];
|
||||
@@ -1281,6 +1296,13 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
if($this->nation['gold'] < $this->nationPolicy->reqNationGold){
|
||||
return null;
|
||||
}
|
||||
if($this->nation['rice'] < $this->nationPolicy->reqNationRice){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$nation = $this->nation;
|
||||
$candidateArgs = [];
|
||||
@@ -2172,7 +2194,7 @@ class GeneralAI
|
||||
}
|
||||
}
|
||||
|
||||
if($train < $this->nationPolicy->properWarTrainAtmos){
|
||||
if($atmos < $this->nationPolicy->properWarTrainAtmos){
|
||||
$cmd = buildGeneralCommandClass('che_사기진작', $general, $this->env);
|
||||
if($cmd->isRunnable()){
|
||||
$cmdList[] = [$cmd, GameConst::$maxAtmosByCommand / Util::valueFit($atmos, 1)];
|
||||
@@ -2213,6 +2235,10 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
if($this->dipState !== self::d전쟁){
|
||||
return null;
|
||||
}
|
||||
|
||||
$general = $this->getGeneralObj();
|
||||
$city = $this->city;
|
||||
$nation = $this->nation;
|
||||
@@ -2233,13 +2259,13 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($city['front'] === 1 && $this->dipState === self::d전쟁) {
|
||||
if ($city['front'] === 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$attackableNations = [];
|
||||
foreach ($this->warTargetNation as $targetNationID => $state) {
|
||||
if ($this->dipState === self::d전쟁 && $state == 1) {
|
||||
if ($state == 1) {
|
||||
continue;
|
||||
}
|
||||
$attackableNations[] = $targetNationID;
|
||||
@@ -2247,7 +2273,7 @@ class GeneralAI
|
||||
$nearCities = array_keys(CityConst::byID($cityID)->path);
|
||||
|
||||
$attackableCities = $db->queryFirstColumn(
|
||||
'SELECT city FROM city WHERE nation IN %li AND city IN %li',
|
||||
'SELECT city, nation FROM city WHERE nation IN %li AND city IN %li',
|
||||
$attackableNations,
|
||||
$nearCities
|
||||
);
|
||||
|
||||
@@ -31,7 +31,7 @@ trait LazyVarUpdater{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function unpackAux(){
|
||||
function unpackAux(){
|
||||
if($this->raw['auxVar']??null === null){
|
||||
if(!key_exists('aux', $this->raw)){
|
||||
throw new \RuntimeException('aux is not set');
|
||||
|
||||
Reference in New Issue
Block a user