장수 수 적용 관련 변경

This commit is contained in:
2020-05-09 23:09:36 +09:00
parent 8eb2380542
commit d083dc36b2
8 changed files with 43 additions and 12 deletions
+2 -2
View File
@@ -64,11 +64,11 @@ switch ($btn) {
case "메세지 전달":
$date = TimeUtil::now();
$src = MessageTarget::buildQuick($session->generalID);
for ($i = 0; $i < count($genlist); $i++) {
foreach($genlist as $generalID){
$msgObj = new Message(
Message::MSGTYPE_PRIVATE,
$src,
MessageTarget::buildQuick($genlist[$i]),
MessageTarget::buildQuick($generalID),
$msg,
new \DateTime(),
new \DateTime('9999-12-31'),
+2 -2
View File
@@ -127,7 +127,7 @@ var nations = <?=$nations?$history['nations']:'{}'?>;
<tr><td>연 감<br><?=closeButton()?></td></tr>
<tr><td>
<form name=form1 method=post>
월 선택 :
월 선택 :
<input type=submit name=btn value="◀◀ 이전달">
<select id='yearmonth' name=yearmonth size=1>
<option selected='selected'><?=$year?>년 <?=$month?>월</option>
@@ -160,7 +160,7 @@ var nations = <?=$nations?$history['nations']:'{}'?>;
<tr>
<td><span style='color:<?=newColor($nation['color'])?>;background-color:<?=$nation['color']?>'><?=$nation['name']?></td>
<td style='text-align:right'><?=number_format($nation['power'])?></td>
<td style='text-align:right'><?=number_format(count($nation['generals']??[]))?></td>
<td style='text-align:right'><?=number_format($nation['gennum'])?></td>
<td style='text-align:right'><?=number_format(count($nation['cities']??[]))?></td>
</tr>
<?php endforeach; ?>
+2 -2
View File
@@ -99,7 +99,7 @@ foreach ($nations as $nation) {
<td width=80 align=center id=bg1>국 력</td>
<td width=170 align=center>{$nation['power']}</td>
<td width=80 align=center id=bg1>장수 / 속령</td>
<td width=170 align=center>".count($generals??[])." / ".count($nation['cities']??[])."</td>
<td width=170 align=center>{$nation['gennum']} / ".count($nation['cities']??[])."</td>
";
for($chiefLevel = 12; $chiefLevel >= 5; $chiefLevel--){
if($chiefLevel % 4 == 0){
@@ -161,7 +161,7 @@ echo "
<tr>
<td width=498 align=center>&nbsp;</td>
<td width=123 align=center id=bg1>장 수</td>
<td width=123 align=center>".count($nations[0]['generals'])."</td>
<td width=123 align=center>{$nations[0]['gennum']}</td>
<td width=123 align=center id=bg1>속 령</td>
<td width=123 align=center>".count($nations[0]['cities']??[])."</td>
</tr>
+4 -1
View File
@@ -170,7 +170,7 @@ foreach ($generals as &$general) {
}
unset($general);
$genCnt = count($generals);
$genCnt = countPureGeneralFromRawList($generals);
$totalGold = 0;
$totalRice = 0;
$crew90 = 0;
@@ -182,6 +182,9 @@ $gen60 = 0;
$crewTotal = 0;
//$genTotal = 0;
foreach($generals as $general){
if($general['npc']==5){
continue;
}
$totalGold += $general['gold'];
$totalRice += $general['rice'];
+4 -4
View File
@@ -285,19 +285,19 @@ function setGeneralCommand(int $generalID, array $rawTurnList, string $command,
}
else if($turnIdx == -1){
//홀수
for ($subIdx = 1; $subIdx < GameConst::$maxTurn; $subIdx+=2) {
$turnList[$subIdx] = true;
foreach(Util::range(1, GameConst::$maxTurn, 2) as $subIdx){
$turnList[$subIdx] = true;
}
}
else if($turnIdx == -2){
//짝수
for ($subIdx = 0; $subIdx < GameConst::$maxTurn; $subIdx+=2) {
foreach(Util::range(0, GameConst::$maxTurn, 2) as $subIdx){
$turnList[$subIdx] = true;
}
}
else if($turnIdx == -3){
//모두
for ($subIdx = 0; $subIdx < GameConst::$maxTurn; $subIdx++) {
foreach(Util::range(GameConst::$maxTurn) as $subIdx){
$turnList[$subIdx] = true;
}
}
+15
View File
@@ -378,6 +378,21 @@ function buildWarUnitTriggerClass(?string $type, WarUnit $unit, ?array $args = n
return $class->newInstanceArgs(array_merge([$unit], $args));
}
function countPureGeneralFromRawList(?array $rawGeneralList=null):int{
if(!$rawGeneralList){
return 0;
}
$result = 0;
foreach($rawGeneralList as $rawGeneral){
if(!$rawGeneral['npc'] === 5){
continue;
}
$result+=1;
}
return $result;
}
function getOfficerLevelText($officerLevel, $nlevel=8) {
if($officerLevel >= 0 && $officerLevel <= 4) { $nlevel = 0; }
$code = $nlevel * 100 + $officerLevel;
+13
View File
@@ -167,6 +167,18 @@ function checkSupply()
}
}
function updateGeneralNumber(){
$db = DB::db();
foreach($db->queryAllLists('SELECT nation, count(*) FROM general WHERE npc != 5 GROUP BY nation') as [$nationID, $gennum]){
if($nationID === 0){
continue;
}
$db->update('nation', [
'gennum'=>$gennum
], 'nation=%i', $nationID);
}
refreshNationStaticInfo();
}
function updateYearly()
{
@@ -471,6 +483,7 @@ function postUpdateMonthly()
}
// 작위 업데이트
updateNationState();
updateGeneralNumber();
refreshNationStaticInfo();
// 천통여부 검사
checkEmperior();
+1 -1
View File
@@ -133,7 +133,7 @@ if (!$city) {
$pleadership = 0;
$pstrength = 0;
$pintel = 0;
for ($statBonusCnt = 3 + mt_rand(0, 2); $statBonusCnt > 0; $statBonusCnt--) {
foreach(Util::range(Util::randRangeInt(3, 5)) as $statIdx){
switch (Util::choiceRandomUsingWeight([$leadership, $strength, $intel])) {
case 0:
$pleadership++;