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