From 9fb477facc3eaab1be86fea5d98dc2cdd19a628b Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 15 Dec 2021 03:34:49 +0900 Subject: [PATCH] =?UTF-8?q?game:=20NPC=EA=B5=AD=EC=9D=B4=20=EC=A0=91?= =?UTF-8?q?=EA=B2=BD=EC=9D=B4=20=EC=82=AC=EB=9D=BC=EC=A0=B8=EB=8F=84=205?= =?UTF-8?q?=EA=B0=9C=EC=9B=94=EA=B0=80=EB=9F=89=EC=9D=80=20=EA=B8=B0?= =?UTF-8?q?=EB=8B=A4=EB=A6=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/GeneralAI.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index ca1accb7..3c8a6e75 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -191,7 +191,9 @@ class GeneralAI $nationID = $this->general->getNationID(); $env = $this->env; - if (Util::joinYearMonth($env['year'], $env['month']) <= Util::joinYearMonth($env['startyear'] + 2, 5)) { + $yearMonth = Util::joinYearMonth($env['year'], $env['month']); + + if ($yearMonth <= Util::joinYearMonth($env['startyear'] + 2, 5)) { $this->dipState = self::d평화; $this->attackable = false; return; @@ -229,6 +231,8 @@ class GeneralAI $this->warTargetNation = $warTargetNation; + + $nationStor = KVStorage::getStorage($db, $nationID, 'nation_env'); $minWarTerm = $db->queryFirstField('SELECT min(term) FROM diplomacy WHERE me = %i AND state=1', $nationID); if ($minWarTerm === null) { $this->dipState = self::d평화; @@ -238,13 +242,21 @@ class GeneralAI $this->dipState = self::d징병; } else { $this->dipState = self::d직전; + $nationStor->last_attackable = $yearMonth; } - if ($this->attackable) { - //전쟁으로 인한 attackable인가? - if ($onWar || (!$onWarReady && !$onWarYet)) { + if ($onWar || (!$onWarReady && !$onWarYet)) { + //확실한 전쟁 상태 + if ($this->attackable) { + //그리고 출병 가능한 도시도 있음 + $this->dipState = self::d전쟁; + $nationStor->last_attackable = $yearMonth; + } + else if($nationStor->last_attackable >= $yearMonth - 5){ + //그러나 접경이 없음. 대신, 접경이 사라진지 아직 5개월 이내. $this->dipState = self::d전쟁; } + //5개월도 넘었다면 다른 국가를 찾아보자. } }