버그 수정

This commit is contained in:
2020-04-27 00:30:48 +09:00
parent 34a863a6ea
commit ad8acaf296
33 changed files with 77 additions and 36 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ class AutorunGeneralPolicy{
}
function __construct(General $general, $aiOptions){
function __construct(General $general, $aiOptions, array $nationPolicy, array $serverPolicy, array $nation, array $env){
//TODO: 국가 정책을 받아와야함
$this->priority = static::$default_priority;
+34 -3
View File
@@ -141,18 +141,18 @@ class AutorunNationPolicy {
public $properWarTrainAtmos = 90;
function __construct(General $general, array $nationPolicy, array $serverPolicy, array $nation, array $env)
function __construct(General $general, $aiOptions, array $nationPolicy, array $serverPolicy, array $nation, array $env)
{
foreach($serverPolicy as $policy=>$value){
if(!property_exists($this, $policy)){
throw new \InvalidArgumentException($policy);
continue;
}
$this->$policy = $value;
}
foreach($nationPolicy as $policy){
if(!property_exists($this, $policy)){
throw new \InvalidArgumentException($policy);
continue;
}
$this->$policy = $value;
}
@@ -197,5 +197,36 @@ class AutorunNationPolicy {
if($this->reqHumanWarRecommandRice === 0){
$this->reqHumanWarRecommandRice = Util::round(max(30000, $this->reqHumanWarRecommandRice * 3), -2);
}
if($general->getVar('npc') >= 2){
return;
}
if(!key_exists('chief', $aiOptions)){
$this->can부대전방발령 = false;
$this->can부대후방발령 = false;
$this->can부대유저장후방발령 = false;
$this->can유저장후방발령 = false;
$this->can유저장전방발령 = false;
$this->can유저장구출발령 = false;
$this->can유저장내정발령 = false;
$this->canNPC후방발령 = false;
$this->canNPC전방발령 = false;
$this->canNPC구출발령 = false;
$this->canNPC내정발령 = false;
$this->can유저장긴급포상 = false;
$this->can유저장포상 = false;
//$this->can유저장몰수 = false;
$this->canNPC긴급포상 = false;
$this->canNPC포상 = false;
$this->canNPC몰수 = false;
$this->can선전포고 = false;
$this->can천도 = false;
}
}
}
+2 -2
View File
@@ -987,7 +987,7 @@ class General implements iAction{
if(key_exists($generalID, $rawRanks) && count($rawRanks[$generalID]??[]) !== count($rankColumn)){
throw new \RuntimeException('column의 수가 일치하지 않음 : '.$generalID);
}
$result[$generalID] = new static($rawGenerals[$generalID], $rawRanks[$generalID]??null, null, $year, $month, $constructMode > 1);
$result[$generalID] = new static($rawGenerals[$generalID], $rawRanks[$generalID]??null, null, null, $year, $month, $constructMode > 1);
}
return $result;
@@ -1020,7 +1020,7 @@ class General implements iAction{
}
$general = new static($rawGeneral, $rawRankValues, null, $year, $month, $constructMode > 1);
$general = new static($rawGeneral, $rawRankValues, null, null, $year, $month, $constructMode > 1);
return $general;
}
+2 -2
View File
@@ -114,8 +114,8 @@ class GeneralAI
$serverPolicy = KVStorage::getStorage($db, 'autorun_nation_policy_0');
$nationPolicy = KVStorage::getStorage($db, "autorun_nation_policy_{$this->nation['nation']}");
$this->nationPolicy = new AutorunNationPolicy($general, $nationPolicy->getAll(), $serverPolicy->getAll(), $this->nation, $this->env);
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options']??[]);
$this->nationPolicy = new AutorunNationPolicy($general, $this->env['autorun_user']['options']??[], $nationPolicy->getAll(), $serverPolicy->getAll(), $this->nation, $this->env);
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options']??[], $nationPolicy->getAll(), $serverPolicy->getAll(), $this->nation, $this->env);
$this->nation['aux'] = Json::decode($this->nation['aux']??'{}');
+8 -2
View File
@@ -33,7 +33,7 @@ class SpecialityHelper{
if(static::$domesticInv){
if(!key_exists($type, static::$domesticInv)){
throw new \InvalidArgumentException('올바르지 않은 특기명:',$type);
throw new \InvalidArgumentException('올바르지 않은 특기명:'.$type);
}
return static::$domesticInv[$type];
}
@@ -43,6 +43,9 @@ class SpecialityHelper{
$cache[$classObj->getName()] = $className;
}
static::$domesticInv = $cache;
if(!key_exists($type, $cache)){
throw new \InvalidArgumentException('올바르지 않은 특기명:'.$type);
}
return $cache[$type];
}
@@ -53,7 +56,7 @@ class SpecialityHelper{
if(static::$warInv){
if(!key_exists($type, static::$warInv)){
throw new \InvalidArgumentException('올바르지 않은 특기명:',$type);
throw new \InvalidArgumentException('올바르지 않은 특기명:'.$type);
}
return static::$warInv[$type];
}
@@ -62,6 +65,9 @@ class SpecialityHelper{
foreach(static::getSpecialWarList(false) as $className=>$classObj){
$cache[$classObj->getName()] = $className;
}
if(!key_exists($type, $cache)){
throw new \InvalidArgumentException('올바르지 않은 특기명:'.$type);
}
static::$warInv = $cache;
return $cache[$type];
}