game: NPC는 건국 한턴 기다림

This commit is contained in:
2024-02-24 11:45:08 +00:00
parent 40ecca5440
commit 66b2f1a8f2
+16 -5
View File
@@ -82,7 +82,8 @@ class GeneralAI
const d직전 = 3; const d직전 = 3;
const d전쟁 = 4; const d전쟁 = 4;
protected function updateInstance(): void{ protected function updateInstance(): void
{
if (!$this->reqUpdateInstance) { if (!$this->reqUpdateInstance) {
return; return;
} }
@@ -218,8 +219,7 @@ class GeneralAI
if (!$warTarget) { if (!$warTarget) {
$this->dipState = self::d평화; $this->dipState = self::d평화;
$this->attackable = false; $this->attackable = false;
} } else {
else{
$this->dipState = self::d선포; $this->dipState = self::d선포;
$this->attackable = false; $this->attackable = false;
} }
@@ -3120,6 +3120,11 @@ class GeneralAI
{ {
$db = DB::db(); $db = DB::db();
$dupLord = $db->queryFirstField('SELECT COUNT(*) FROM general WHERE officer_level = 12 AND city = %i', $this->general->getCityID());
if($dupLord <= 1) {
return null;
}
$general = $this->general; $general = $this->general;
$lordCities = $db->queryFirstColumn('SELECT city.city as city FROM general LEFT JOIN city ON general.city = city.city WHERE general.officer_level = 12 AND city.nation = 0'); $lordCities = $db->queryFirstColumn('SELECT city.city as city FROM general LEFT JOIN city ON general.city = city.city WHERE general.officer_level = 12 AND city.nation = 0');
$nationCities = $db->queryFirstColumn('SELECT city FROM city WHERE nation != 0'); $nationCities = $db->queryFirstColumn('SELECT city FROM city WHERE nation != 0');
@@ -3352,8 +3357,7 @@ class GeneralAI
if ($this->rng->nextBool(pow(1 / ($nationCnt + 1) / pow($notFullNationCnt, 3), 1 / 4))) { if ($this->rng->nextBool(pow(1 / ($nationCnt + 1) / pow($notFullNationCnt, 3), 1 / 4))) {
return null; return null;
} }
} } else {
else{
//임관 기간이 끝나면 고정 확률로 낮춤 0.3 * 0.5 = 0.15 //임관 기간이 끝나면 고정 확률로 낮춤 0.3 * 0.5 = 0.15
if ($this->rng->nextBool()) { if ($this->rng->nextBool()) {
return null; return null;
@@ -3783,23 +3787,30 @@ class GeneralAI
if ($npcType >= 2 && $general->getVar('officer_level') == 12 && !$this->nation['capital']) { if ($npcType >= 2 && $general->getVar('officer_level') == 12 && !$this->nation['capital']) {
//방랑군 건국 //방랑군 건국
$relYearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']) - Util::joinYearMonth($this->env['init_year'], $this->env['init_month']);
if ($relYearMonth > 1) {
$result = $this->do건국(); $result = $this->do건국();
if ($result !== null) { if ($result !== null) {
$result->reason = 'do건국'; $result->reason = 'do건국';
return $result; return $result;
} }
}
$result = $this->do방랑군이동(); $result = $this->do방랑군이동();
if ($result !== null) { if ($result !== null) {
$result->reason = 'do방랑군이동'; $result->reason = 'do방랑군이동';
return $result; return $result;
} }
if ($relYearMonth > 1) {
$result = $this->do해산(); $result = $this->do해산();
if ($result !== null) { if ($result !== null) {
$result->reason = 'do해산'; $result->reason = 'do해산';
return $result; return $result;
} }
} }
}
foreach ($this->generalPolicy->priority as $actionName) { foreach ($this->generalPolicy->priority as $actionName) {
if (!property_exists($this->generalPolicy, 'can' . $actionName)) { if (!property_exists($this->generalPolicy, 'can' . $actionName)) {