From 3998bddacac95b56257224097cdd91011307a28e Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 23 Jun 2018 22:52:43 +0900 Subject: [PATCH] =?UTF-8?q?npc=20=EB=B0=9C=EB=A0=B9=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD.=20=EC=9C=A0=EC=A0=80=20=EB=AC=B4?= =?UTF-8?q?=EC=A7=80=EC=9E=A5=20=ED=8F=AC=EC=83=81=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_npc.php | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/hwe/func_npc.php b/hwe/func_npc.php index 723b34ee..512622b0 100644 --- a/hwe/func_npc.php +++ b/hwe/func_npc.php @@ -999,17 +999,36 @@ function NPCStaffWork($general, $nation, $dipState){ //금쌀이 부족한 '유저장' 먼저 포상 - if ($nation[$resName] > ($resName=='gold'?1:2)*3000 && $userGeneralsID) { - $compUser = $nationGenerals[$userGeneralsID[0]]; + while ($nation[$resName] > ($resName=='gold'?1:2)*3000 && $userGeneralsID) { + $isWarUser = null; + + foreach($userGeneralsID as $userGeneralID){ + $compUser = $nationGenerals[$userGeneralID]; + if($compUser['leader'] >= 50){ + $isWarUser = true; + break; + } + if(Util::randF(0.2)){ + $isWarUser = false; + break; + } + } + + if($isWarUser === null){ + break; + } + $compRes = $compUser[$resName]; $work = false; - if ($compRes < $avgNpcWarRes*3) { + if(!$isWarUser){ + $work = false; + } else if ($compRes < $avgNpcWarRes*3) { $work = true; } elseif ($compRes < $avgNpcCivilRes * 4) { $work = true; } - + if($compUser[$resName] < 21000){ if($work){ $amount = min(100, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 2000)*10 + 10); @@ -1021,6 +1040,7 @@ function NPCStaffWork($general, $nation, $dipState){ } } + break; } $minRes = $admin['develcost'] * 24 * $tech; @@ -1091,6 +1111,7 @@ function NPCStaffWork($general, $nation, $dipState){ $targetCity = null; $minCity = null; $maxCity = null; + $maxDevCity = null; foreach($nationCities as $nationCity){ if($nationCity['dev']>=95){ continue; @@ -1127,10 +1148,27 @@ function NPCStaffWork($general, $nation, $dipState){ } } + foreach ($nationCities as $nationCity) { + if(!$nationCity['supply']){ + continue; + } + if(count($nationCity['generals']) == 0){ + continue; + } + if($maxDevCity === null || $maxDevCity['dev'] < $nationCity['dev']){ + $maxDevCity = $nationCity; + } + } + if($targetCity === null || (count($targetCity['generals']) >= count($maxCity['generals']) - 1)){ $targetCity = $minCity; } + if($maxDevCity['dev'] >= 95 && $targetCity['city'] != $maxDevCity['city'] && $targetCity['dev'] <= 70){ + $targetGeneral = $nationGenerals[Util::choiceRandom($maxDevCity['generals'])]; + $commandList[EncodeCommand(0, $targetGeneral['no'], $targetCity['city'], 27)] = 2; + } + if(count($targetCity['generals']) < count($maxCity['generals']) - 2){ //세명 이상 차이나야 함 $targetGeneral = $nationGenerals[Util::choiceRandom($maxCity['generals'])];