npc 발령 로직 변경. 유저 무지장 포상 로직 변경

This commit is contained in:
2018-06-23 22:52:43 +09:00
parent 65d817624e
commit e4ad779b37
+42 -4
View File
@@ -999,17 +999,36 @@ function NPCStaffWork($general, $nation, $dipState){
//금쌀이 부족한 '유저장' 먼저 포상 //금쌀이 부족한 '유저장' 먼저 포상
if ($nation[$resName] > ($resName=='gold'?1:2)*3000 && $userGeneralsID) { while ($nation[$resName] > ($resName=='gold'?1:2)*3000 && $userGeneralsID) {
$compUser = $nationGenerals[$userGeneralsID[0]]; $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]; $compRes = $compUser[$resName];
$work = false; $work = false;
if ($compRes < $avgNpcWarRes*3) { if(!$isWarUser){
$work = false;
} else if ($compRes < $avgNpcWarRes*3) {
$work = true; $work = true;
} elseif ($compRes < $avgNpcCivilRes * 4) { } elseif ($compRes < $avgNpcCivilRes * 4) {
$work = true; $work = true;
} }
if($compUser[$resName] < 21000){ if($compUser[$resName] < 21000){
if($work){ if($work){
$amount = min(100, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 2000)*10 + 10); $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; $minRes = $admin['develcost'] * 24 * $tech;
@@ -1091,6 +1111,7 @@ function NPCStaffWork($general, $nation, $dipState){
$targetCity = null; $targetCity = null;
$minCity = null; $minCity = null;
$maxCity = null; $maxCity = null;
$maxDevCity = null;
foreach($nationCities as $nationCity){ foreach($nationCities as $nationCity){
if($nationCity['dev']>=95){ if($nationCity['dev']>=95){
continue; 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)){ if($targetCity === null || (count($targetCity['generals']) >= count($maxCity['generals']) - 1)){
$targetCity = $minCity; $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){ if(count($targetCity['generals']) < count($maxCity['generals']) - 2){
//세명 이상 차이나야 함 //세명 이상 차이나야 함
$targetGeneral = $nationGenerals[Util::choiceRandom($maxCity['generals'])]; $targetGeneral = $nationGenerals[Util::choiceRandom($maxCity['generals'])];