정책 반영
This commit is contained in:
@@ -124,7 +124,9 @@ class AutorunGeneralPolicy{
|
||||
}
|
||||
$priority[] = $priorityItem;
|
||||
}
|
||||
$this->priority = $priority;
|
||||
if($priority){
|
||||
$this->priority = $priority;
|
||||
}
|
||||
}
|
||||
|
||||
if($nationPolicy && key_exists('priority', $nationPolicy)){
|
||||
@@ -135,7 +137,9 @@ class AutorunGeneralPolicy{
|
||||
}
|
||||
$priority[] = $priorityItem;
|
||||
}
|
||||
$this->priority = $priority;
|
||||
if($priority){
|
||||
$this->priority = $priority;
|
||||
}
|
||||
}
|
||||
|
||||
if($general->getNPCType() >= 2){
|
||||
|
||||
@@ -174,13 +174,13 @@ class AutorunNationPolicy {
|
||||
foreach(static::$defaultPolicy as $policy=>$value){
|
||||
$this->{$policy} = $value;
|
||||
}
|
||||
|
||||
|
||||
if($serverPolicy){
|
||||
foreach($serverPolicy['values']??[] as $policy=>$value){
|
||||
if(!property_exists($this, $policy)){
|
||||
continue;
|
||||
}
|
||||
$this->$policy = $value;
|
||||
$this->{$policy} = $value;
|
||||
}
|
||||
|
||||
if(key_exists('priority', $serverPolicy)){
|
||||
@@ -194,7 +194,7 @@ class AutorunNationPolicy {
|
||||
if(!property_exists($this, $policy)){
|
||||
continue;
|
||||
}
|
||||
$this->$policy = $value;
|
||||
$this->{$policy} = $value;
|
||||
}
|
||||
|
||||
if(key_exists('priority', $nationPolicy)){
|
||||
|
||||
+10
-4
@@ -116,8 +116,8 @@ class GeneralAI
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$nationStor = KVStorage::getStorage($db, $this->nation['nation'], 'nation_env');
|
||||
|
||||
$this->nationPolicy = new AutorunNationPolicy($general, $this->env['autorun_user']['options'], $nationStor->getValue('npc_general_policy'), $gameStor->getValue('npc_general_policy'), $this->nation, $this->env);
|
||||
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options'], $nationStor->getValue('npc_nation_policy'), $gameStor->getValue('npc_nation_policy'), $this->nation, $this->env);
|
||||
$this->nationPolicy = new AutorunNationPolicy($general, $this->env['autorun_user']['options'], $gameStor->getValue('npc_nation_policy'), $nationStor->getValue('npc_nation_policy'), $this->nation, $this->env);
|
||||
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options'], $gameStor->getValue('npc_general_policy'), $nationStor->getValue('npc_general_policy'), $this->nation, $this->env);
|
||||
|
||||
$this->nation['aux'] = Json::decode($this->nation['aux']??'{}');
|
||||
|
||||
@@ -3126,7 +3126,10 @@ class GeneralAI
|
||||
|
||||
foreach($this->nationPolicy->priority as $actionName){
|
||||
|
||||
if(property_exists($this->nationPolicy, 'can'.$actionName) && !$this->nationPolicy->{'can'.$actionName}){
|
||||
if(!property_exists($this->nationPolicy, 'can'.$actionName)){
|
||||
continue;
|
||||
}
|
||||
if(!$this->nationPolicy->{'can'.$actionName}){
|
||||
continue;
|
||||
}
|
||||
if($npcType < 2 && !($this->nationPolicy::$availableInstantTurn[$actionName]??false)){
|
||||
@@ -3276,7 +3279,10 @@ class GeneralAI
|
||||
}
|
||||
|
||||
foreach($this->generalPolicy->priority as $actionName){
|
||||
if(!$this->generalPolicy->{'can'.$actionName}){
|
||||
if(!property_exists($this->generalPolicy, 'can'.$actionName)){
|
||||
continue;
|
||||
}
|
||||
if(!($this->generalPolicy->{'can'.$actionName})){
|
||||
continue;
|
||||
}
|
||||
/** @var ?GeneralCommand */
|
||||
|
||||
Reference in New Issue
Block a user