forked from devsam/core
버그 수정
This commit is contained in:
@@ -119,14 +119,14 @@ class AutorunNationPolicy {
|
||||
public $DevelopForce = [
|
||||
//123=>true
|
||||
];
|
||||
public $reqHumanWarUrgentGold = 10000;
|
||||
public $reqHumanWarUrgentRice = 10000;
|
||||
public $reqHumanWarRecommandGold = 30000;
|
||||
public $reqHumanWarRecommandRice = 30000;
|
||||
public $reqHumanWarUrgentGold = 0;
|
||||
public $reqHumanWarUrgentRice = 0;
|
||||
public $reqHumanWarRecommandGold = 0;
|
||||
public $reqHumanWarRecommandRice = 0;
|
||||
public $reqHumanDevelGold = 10000;
|
||||
public $reqHumanDevelRice = 10000;
|
||||
public $reqNPCWarGold = 5000;
|
||||
public $reqNPCWarRice = 5000;
|
||||
public $reqNPCWarGold = 0;
|
||||
public $reqNPCWarRice = 0;
|
||||
public $reqNPCDevelGold = 1000;
|
||||
public $reqNPCDevelRice = 500;
|
||||
|
||||
@@ -141,7 +141,7 @@ class AutorunNationPolicy {
|
||||
public $properWarTrainAtmos = 90;
|
||||
|
||||
|
||||
function __construct(General $general, array $nationPolicy, array $serverPolicy)
|
||||
function __construct(General $general, array $nationPolicy, array $serverPolicy, array $nation)
|
||||
{
|
||||
foreach($serverPolicy as $policy=>$value){
|
||||
if(!property_exists($this, $policy)){
|
||||
@@ -160,5 +160,38 @@ class AutorunNationPolicy {
|
||||
if(!$this->priority){
|
||||
$this->priority = $this::$defaultPriority;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($this->reqNPCWarGold === 0 || $this->reqNPCWarRice === 0){
|
||||
$defaultCrewType = GameUnitConst::byID(GameUnitConst::DEFAULT_CREWTYPE);
|
||||
$reqGold = $defaultCrewType->costWithTech($nation['tech'], $this->minNPCWarLeadership * 150);
|
||||
$reqRice = $defaultCrewType->riceWithTech($nation['tech'], $this->minNPCWarLeadership * 150);
|
||||
if($this->reqNPCWarGold === 0){
|
||||
$this->reqNPCWarGold = Util::round($reqGold * 2, -2);
|
||||
}
|
||||
if($this->reqNPCWarRice === 0){
|
||||
$this->reqNPCWarRice = Util::round($reqRice * 2, -2);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->reqHumanWarUrgentGold === 0 || $this->reqHumanWarUrgentRice === 0){
|
||||
$defaultCrewType = GameUnitConst::byID(GameUnitConst::DEFAULT_CREWTYPE);
|
||||
$reqGold = $defaultCrewType->costWithTech($nation['tech'], GameConst::$defaultStatMax * 100);
|
||||
$reqRice = $defaultCrewType->riceWithTech($nation['tech'], GameConst::$defaultStatMax * 100);
|
||||
if($this->reqHumanWarUrgentGold === 0){
|
||||
$this->reqHumanWarUrgentGold = Util::round(max(10000, $reqGold * 4 * 2), -2);
|
||||
}
|
||||
if($this->reqHumanWarUrgentRice === 0){
|
||||
$this->reqHumanWarUrgentRice = Util::round(max(10000, $reqRice * 4 * 2), -2);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->reqHumanWarRecommandGold === 0){
|
||||
$this->reqHumanWarRecommandGold = Util::round(max(30000, $this->reqHumanWarUrgentGold * 3), -2);
|
||||
}
|
||||
if($this->reqHumanWarRecommandRice === 0){
|
||||
$this->reqHumanWarRecommandRice = Util::round(max(30000, $this->reqHumanWarRecommandRice * 3), -2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ class General implements iAction{
|
||||
// 모두 탈퇴
|
||||
$db->update('general', [
|
||||
'troop'=>0
|
||||
], 'troop_leader=%i', $troopLeaderID);
|
||||
], 'troop=%i', $troopLeaderID);
|
||||
// 부대 삭제
|
||||
$db->delete('troop', 'troop_leader=%i', $troopLeaderID);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ 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->nationPolicy = new AutorunNationPolicy($general, $nationPolicy->getAll(), $serverPolicy->getAll(), $this->nation);
|
||||
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options']??[]);
|
||||
|
||||
$this->nation['aux'] = Json::decode($this->nation['aux']??'{}');
|
||||
@@ -3361,7 +3361,7 @@ class GeneralAI
|
||||
|
||||
if (!$userChief) {
|
||||
$candUserChief = $db->queryFirstField(
|
||||
'SELECT no FROM general WHERE nation = %i AND officer_level = 1 AND killturn > %i AND npc < 2 AND belong >= %i ORDER BY leadership DESC LIMIT 1',
|
||||
'SELECT no FROM general WHERE nation = %i AND officer_level = 1 AND killturn > %i AND npc <= 2 AND belong >= %i ORDER BY leadership DESC LIMIT 1',
|
||||
$nationID,
|
||||
$minKillturn,
|
||||
$maxBelong
|
||||
@@ -3376,7 +3376,7 @@ class GeneralAI
|
||||
|
||||
if (!key_exists(11, $chiefCandidate)) {
|
||||
$candChiefHead = $db->queryFirstField(
|
||||
'SELECT no FROM general WHERE nation = %i AND officer_level = 1 AND npc >= 2 AND belong >= %i ORDER BY leadership DESC LIMIT 1',
|
||||
'SELECT no FROM general WHERE nation = %i AND officer_level = 1 AND npc > 2 AND belong >= %i ORDER BY leadership DESC LIMIT 1',
|
||||
$nationID,
|
||||
$maxBelong
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user