forked from devsam/core
round(something, 0); 을 Util::round(somehing); 으로 변경.
This commit is contained in:
+24
-24
@@ -300,9 +300,9 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
$cityCrew *= (rand() % 21 + 90)/100; // 90~110%
|
||||
$myCrew *= (rand() % 21 + 90)/100; // 90~110%
|
||||
|
||||
$general['crew'] -= round($myCrew);
|
||||
$city['def'] -= round($cityCrew);
|
||||
$city['wall'] -= round($cityCrew);
|
||||
$general['crew'] -= Util::round($myCrew);
|
||||
$city['def'] -= Util::round($cityCrew);
|
||||
$city['wall'] -= Util::round($cityCrew);
|
||||
|
||||
$tempMyCrew = $myCrew; $tempCityCrew = $cityCrew;
|
||||
$tempGeneralCrew = $general['crew']; $tempCityDef = $city['def'];
|
||||
@@ -310,14 +310,14 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
if($city['wall'] <= 0) { $city['wall'] = 0; }
|
||||
|
||||
if($city['def'] < 0) {
|
||||
$offset = round($tempCityDef*$tempMyCrew/$tempCityCrew);
|
||||
$offset = Util::round($tempCityDef*$tempMyCrew/$tempCityCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$cityCrew += $tempCityDef;
|
||||
$city['def'] = 0;
|
||||
}
|
||||
if($general['crew'] < 0) {
|
||||
$offset = round($tempGeneralCrew*$tempCityCrew/$tempMyCrew);
|
||||
$offset = Util::round($tempGeneralCrew*$tempCityCrew/$tempMyCrew);
|
||||
$cityCrew += $offset;
|
||||
$city['def'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
@@ -326,9 +326,9 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
|
||||
$exp += $cityCrew;
|
||||
$opexp += $myCrew;
|
||||
$general['crew'] = round($general['crew']);
|
||||
$cityCrew = round($cityCrew);
|
||||
$myCrew = round($myCrew);
|
||||
$general['crew'] = Util::round($general['crew']);
|
||||
$cityCrew = Util::round($cityCrew);
|
||||
$myCrew = Util::round($myCrew);
|
||||
$myAtt = round($myAtt, 2);
|
||||
$myDef = round($myDef, 2);
|
||||
$cityAtt = round($cityAtt, 2);
|
||||
@@ -342,14 +342,14 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
}
|
||||
|
||||
// 도시쌀 소모 계산
|
||||
$opexp = round($opexp / 50);
|
||||
$rice = round($opexp * 4 * getCrewtypeRice($game, 0, 0) * ($train3/100 - 0.2));
|
||||
$opexp = Util::round($opexp / 50);
|
||||
$rice = Util::round($opexp * 4 * getCrewtypeRice($game, 0, 0) * ($train3/100 - 0.2));
|
||||
|
||||
//원래대로 스케일링
|
||||
$city['def'] = round($city['def'] / 10);
|
||||
$city['wall'] = round($city['wall'] / 10);
|
||||
$city['def'] = Util::round($city['def'] / 10);
|
||||
$city['wall'] = Util::round($city['wall'] / 10);
|
||||
//내정 감소
|
||||
$dec = round($cityCrew / 10);
|
||||
$dec = Util::round($cityCrew / 10);
|
||||
$city['agri'] -= $dec;
|
||||
$city['comm'] -= $dec;
|
||||
$city['secu'] -= $dec;
|
||||
@@ -672,8 +672,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
$opCrew *= (rand() % 21 + 90)/100; // 90~110%
|
||||
$myCrew *= (rand() % 21 + 90)/100; // 90~110%
|
||||
|
||||
$general['crew'] -= round($myCrew);
|
||||
$oppose['crew'] -= round($opCrew);
|
||||
$general['crew'] -= Util::round($myCrew);
|
||||
$oppose['crew'] -= Util::round($opCrew);
|
||||
$tempMyCrew = $myCrew; $tempOpCrew = $opCrew;
|
||||
$tempGeneralCrew = $general['crew']; $tempOpposeCrew = $oppose['crew'];
|
||||
if($general['crew'] <= 0 && $oppose['crew'] <= 0) {
|
||||
@@ -681,13 +681,13 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
$r2 = $tempOpposeCrew / $tempOpCrew;
|
||||
|
||||
if($r1 > $r2) {
|
||||
$offset = round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$offset = Util::round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$opCrew += $tempOpposeCrew;
|
||||
$oppose['crew'] = 0;
|
||||
} else {
|
||||
$offset = round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$offset = Util::round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$opCrew += $offset;
|
||||
$oppose['crew'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
@@ -695,14 +695,14 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
}
|
||||
} elseif($general['crew'] * $oppose['crew'] <= 0) {
|
||||
if($oppose['crew'] < 0) {
|
||||
$offset = round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$offset = Util::round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$opCrew += $tempOpposeCrew;
|
||||
$oppose['crew'] = 0;
|
||||
}
|
||||
if($general['crew'] < 0) {
|
||||
$offset = round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$offset = Util::round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$opCrew += $offset;
|
||||
$oppose['crew'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
@@ -712,10 +712,10 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
|
||||
$exp += $opCrew;
|
||||
$opexp += $myCrew;
|
||||
$general['crew'] = round($general['crew']);
|
||||
$oppose['crew'] = round($oppose['crew']);
|
||||
$myCrew = round($myCrew);
|
||||
$opCrew = round($opCrew);
|
||||
$general['crew'] = Util::round($general['crew']);
|
||||
$oppose['crew'] = Util::round($oppose['crew']);
|
||||
$myCrew = Util::round($myCrew);
|
||||
$opCrew = Util::round($opCrew);
|
||||
$myAtt = round($myAtt, 2);
|
||||
$myDef = round($myDef, 2);
|
||||
$opAtt = round($opAtt, 2);
|
||||
@@ -734,7 +734,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
}
|
||||
|
||||
// 공헌, 명성 상승
|
||||
$exp = round($exp / 50);
|
||||
$exp = Util::round($exp / 50);
|
||||
$ricing = ($exp * 5 * getCrewtypeRice($game, $general['crewtype'], $tech1));
|
||||
$msg .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricing<br>";
|
||||
// $msg2 .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricing<br>";
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ for($j=0; $j < $gencount; $j++) {
|
||||
elseif($general['npc'] == 1) { $name = "<font color=skyblue>{$general['name']}</font>"; }
|
||||
else { $name = "{$general['name']}"; }
|
||||
|
||||
$general['connect'] = round($general['connect'] / 10, 0) * 10;
|
||||
$general['connect'] = Util::round($general['connect'] / 10) * 10;
|
||||
|
||||
$imageTemp = GetImageURL($general['imgsvr']);
|
||||
echo "
|
||||
|
||||
+1
-1
@@ -267,7 +267,7 @@ for ($i=0; $i < 16; $i++) {
|
||||
}
|
||||
|
||||
for ($i=0; $i < 16; $i++) {
|
||||
$gold[$i] = round($myBet[$i] * $bet[$i]);
|
||||
$gold[$i] = Util::round($myBet[$i] * $bet[$i]);
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
|
||||
+4
-4
@@ -52,10 +52,10 @@ $btCount = $tradeCount + $bidCount;
|
||||
|
||||
$unit = $admin['turnterm'] * 60;
|
||||
|
||||
$amount = round($amount / 10) * 10;
|
||||
$cost = round($cost / 10) * 10;
|
||||
$topv = round($topv / 10) * 10;
|
||||
$value = round($value / 10) * 10;
|
||||
$amount = Util::round($amount / 10) * 10;
|
||||
$cost = Util::round($cost / 10) * 10;
|
||||
$topv = Util::round($topv / 10) * 10;
|
||||
$value = Util::round($value / 10) * 10;
|
||||
if ($term > 24) {
|
||||
$term = 24;
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,9 +16,9 @@ if($command < 0) { $command = 0; }
|
||||
if($double < 0) { $double = 0; }
|
||||
if($third < 0) { $third = 0; }
|
||||
if($fourth < 0) { $fourth = 0; }
|
||||
$double = round($double, 0);
|
||||
$third = round($third, 0);
|
||||
$fourth = round($fourth, 0);
|
||||
$double = Util::round($double);
|
||||
$third = Util::round($third);
|
||||
$fourth = Util::round($fourth);
|
||||
if($command > 99) { $command = 0; }
|
||||
if($double > 9999) { $double = 9999; }
|
||||
if($third > 9999) { $third = 9999; }
|
||||
|
||||
+20
-20
@@ -458,11 +458,11 @@ function commandTable() {
|
||||
if($nation['type'] == 2 || $nation['type'] == 4 || $nation['type'] == 7 || $nation['type'] == 10) { $develcostE *= 0.8; $colorE = 1; }
|
||||
if($nation['type'] == 1 || $nation['type'] == 3 || $nation['type'] == 9) { $develcostE *= 1.2; $colorE = 2; }
|
||||
|
||||
$develcostA = round($develcostA);
|
||||
$develcostB = round($develcostB);
|
||||
$develcostC = round($develcostC);
|
||||
$develcostD = round($develcostD);
|
||||
$develcostE = round($develcostE);
|
||||
$develcostA = Util::round($develcostA);
|
||||
$develcostB = Util::round($develcostB);
|
||||
$develcostC = Util::round($develcostC);
|
||||
$develcostD = Util::round($develcostD);
|
||||
$develcostE = Util::round($develcostE);
|
||||
|
||||
echo "
|
||||
<select name=commandtype size=1 style=width:260px;color:white;background-color:black;font-size:12;>";
|
||||
@@ -701,22 +701,22 @@ function CoreCommandTable() {
|
||||
addCommand("감축/6턴", 68, $valid);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 전 략 ======");
|
||||
$term = round(sqrt($genCount*8)*10);
|
||||
$term = Util::round(sqrt($genCount*8)*10);
|
||||
addCommand("필사즉생/3턴(전략{$term})", 71, $valid);
|
||||
$term = round(sqrt($genCount*4)*10);
|
||||
$term = Util::round(sqrt($genCount*4)*10);
|
||||
addCommand("백성동원/1턴(전략{$term})", 72, $valid);
|
||||
$term = round(sqrt($genCount*4)*10);
|
||||
$term = Util::round(sqrt($genCount*4)*10);
|
||||
addCommand("수몰/3턴(전략{$term})", 73, $valid);
|
||||
$term = round(sqrt($genCount*4)*10);
|
||||
$term = Util::round(sqrt($genCount*4)*10);
|
||||
addCommand("허보/2턴(전략{$term})", 74, $valid);
|
||||
$term = round(sqrt($genCount*2)*10);
|
||||
$term = Util::round(sqrt($genCount*2)*10);
|
||||
if($term < 72) { $term = 72; }
|
||||
addCommand("피장파장/3턴(전략{$term})", 75, $valid);
|
||||
$term = round(sqrt($genCount*10)*10);
|
||||
$term = Util::round(sqrt($genCount*10)*10);
|
||||
addCommand("의병모집/3턴(전략{$term})", 76, $valid);
|
||||
$term = round(sqrt($genCount*16)*10);
|
||||
$term = Util::round(sqrt($genCount*16)*10);
|
||||
addCommand("이호경식/1턴(전략{$term})", 77, $valid);
|
||||
$term = round(sqrt($genCount*16)*10);
|
||||
$term = Util::round(sqrt($genCount*16)*10);
|
||||
addCommand("급습/1턴(전략{$term})", 78, $valid);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 기 타 ======");
|
||||
@@ -819,7 +819,7 @@ function generalInfo($no) {
|
||||
elseif($general['age'] < 80) { $general['age'] = "<font color=yellow>{$general['age']} 세</font>"; }
|
||||
else { $general['age'] = "<font color=red>{$general['age']} 세</font>"; }
|
||||
|
||||
$general['connect'] = round($general['connect'] / 10, 0) * 10;
|
||||
$general['connect'] = Util::round($general['connect'] / 10) * 10;
|
||||
$special = $general['special'] == 0 ? "{$general['specage']}세" : "<font color=limegreen>".getGenSpecial($general['special'])."</font>";
|
||||
$special2 = $general['special2'] == 0 ? "{$general['specage2']}세" : "<font color=limegreen>".getGenSpecial($general['special2'])."</font>";
|
||||
|
||||
@@ -1838,7 +1838,7 @@ function PreprocessCommand($no) {
|
||||
|
||||
if($patientCount > 0) {
|
||||
// 50% 확률로 치료
|
||||
$patientCount = round($patientCount * 0.5);
|
||||
$patientCount = Util::round($patientCount * 0.5);
|
||||
|
||||
$patientName = "";
|
||||
for($i=0; $i < $patientCount; $i++) {
|
||||
@@ -2165,9 +2165,9 @@ function uniqueItem($general, $log, $vote=0) {
|
||||
if($game['scenario'] == 0) { $prob = $gen['cnt'] * 5; } // 5~6개월에 하나씩 등장
|
||||
else { $prob = $gen['cnt']; } // 1~2개월에 하나씩 등장
|
||||
|
||||
if($vote == 1) { $prob = round($gen['cnt'] * 0.7 / 3); } // 투표율 70%, 투표 한번에 2~3개 등장
|
||||
elseif($vote == 2) { $prob = round($gen['cnt'] / 10 / 2); } // 랜임시 2개(10%) 등장(200명중 20명 랜임시도?)
|
||||
elseif($vote == 3) { $prob = round($gen['cnt'] / 10 / 4); } // 건국시 4개(20%) 등장(200명시 20국 정도 됨)
|
||||
if($vote == 1) { $prob = Util::round($gen['cnt'] * 0.7 / 3); } // 투표율 70%, 투표 한번에 2~3개 등장
|
||||
elseif($vote == 2) { $prob = Util::round($gen['cnt'] / 10 / 2); } // 랜임시 2개(10%) 등장(200명중 20명 랜임시도?)
|
||||
elseif($vote == 3) { $prob = Util::round($gen['cnt'] / 10 / 4); } // 건국시 4개(20%) 등장(200명시 20국 정도 됨)
|
||||
|
||||
if($prob < 3) { $prob = 3; }
|
||||
//아이템 습득 상황
|
||||
@@ -2588,7 +2588,7 @@ function CharExperience($exp, $personal) {
|
||||
case 4: case 5: case 7: case 10:
|
||||
$exp *= 0.9; break;
|
||||
}
|
||||
$exp = round($exp);
|
||||
$exp = Util::round($exp);
|
||||
|
||||
return $exp;
|
||||
}
|
||||
@@ -2598,7 +2598,7 @@ function CharDedication($ded, $personal) {
|
||||
case 10:
|
||||
$ded *= 0.9; break;
|
||||
}
|
||||
$ded = round($ded);
|
||||
$ded = Util::round($ded);
|
||||
|
||||
return $ded;
|
||||
}
|
||||
|
||||
+13
-13
@@ -75,8 +75,8 @@ function registerAuction() {
|
||||
if($cost < 5000) { $cost = 5000; }
|
||||
if($topv < 10000) { $topv = 10000; }
|
||||
|
||||
$cost = round($cost / 10) * 10;
|
||||
$topv = round($topv / 10) * 10;
|
||||
$cost = Util::round($cost / 10) * 10;
|
||||
$topv = Util::round($topv / 10) * 10;
|
||||
|
||||
$term = 12;
|
||||
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term);
|
||||
@@ -105,9 +105,9 @@ function registerAuction() {
|
||||
if($cost <= $amount*0.8) { $cost = $amount*0.8; }
|
||||
if($cost >= $amount*1.2) { $cost = $amount*1.2; }
|
||||
|
||||
$amount = round($amount / 10) * 10;
|
||||
$cost = round($cost / 10) * 10;
|
||||
$topv = round($topv / 10) * 10;
|
||||
$amount = Util::round($amount / 10) * 10;
|
||||
$cost = Util::round($cost / 10) * 10;
|
||||
$topv = Util::round($topv / 10) * 10;
|
||||
|
||||
$term = 3 + rand() % 10;
|
||||
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term);
|
||||
@@ -129,9 +129,9 @@ function registerAuction() {
|
||||
if($cost <= $amount*0.8) { $cost = $amount*0.8; }
|
||||
if($cost >= $amount*1.2) { $cost = $amount*1.2; }
|
||||
|
||||
$amount = round($amount / 10) * 10;
|
||||
$cost = round($cost / 10) * 10;
|
||||
$topv = round($topv / 10) * 10;
|
||||
$amount = Util::round($amount / 10) * 10;
|
||||
$cost = Util::round($cost / 10) * 10;
|
||||
$topv = Util::round($topv / 10) * 10;
|
||||
|
||||
$term = 3 + rand() % 10;
|
||||
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term);
|
||||
@@ -198,7 +198,7 @@ function processAuction() {
|
||||
$bidderLog[0] = "<S>◆</>{$auction['no']}번 거래 <M>유찰</>! 이미 아이템을 누군가가 가로챘습니다!";
|
||||
$auctionLog[0] = "<S>◆</>{$admin['year']}년 {$admin['month']}월, {$auction['no']}번 <span class='sell'>판매</span> <M>유찰</> : <Y>{$auction['name1']}</>(이)가 <C>".GetStuffName($auction['stuff'])."</>(을)를 판매, <Y>{$auction['name2']}</>(이)가 금 <C>{$auction['value']}</>(으)로 입찰, 그러나 아이템 이미 매진!";
|
||||
} elseif($auction['value'] > $bidder['gold'] - 1000) {
|
||||
$gold = round($auction['value'] * 0.01);
|
||||
$gold = Util::round($auction['value'] * 0.01);
|
||||
$bidder['gold'] -= $gold;
|
||||
if($bidder['gold'] < 0) $bidder['gold'] = 0;
|
||||
$query = "update general set gold='{$bidder['gold']}' where no='{$auction['no2']}'";
|
||||
@@ -261,7 +261,7 @@ function processAuction() {
|
||||
//판매거래
|
||||
if($auction['type'] == 0) {
|
||||
if($auction['amount'] > $trader['rice'] - 1000) {
|
||||
$gold = round($auction['value'] * 0.01);
|
||||
$gold = Util::round($auction['value'] * 0.01);
|
||||
$trader['gold'] -= $gold;
|
||||
if($trader['gold'] < 0) $trader['gold'] = 0;
|
||||
$query = "update general set gold='{$trader['gold']}' where no='{$auction['no1']}'";
|
||||
@@ -271,7 +271,7 @@ function processAuction() {
|
||||
$bidderLog[0] = "<S>◆</>판매자의 군량 부족으로 {$auction['no']}번 거래 <M>유찰</>!";
|
||||
$auctionLog[0] = "<S>◆</>{$admin['year']}년 {$admin['month']}월, {$auction['no']}번 <span class='sell'>판매</span> <M>유찰</> : <Y>{$auction['name1']}</>(이)가 쌀 <C>{$auction['amount']}</>(을)를 판매, <Y>{$auction['name2']}</>(이)가 금 <C>{$auction['value']}</>(으)로 입찰, 그러나 판매자 군량부족, 벌금 <C>{$gold}</>";
|
||||
} elseif($auction['value'] > $bidder['gold'] - 1000) {
|
||||
$gold = round($auction['value'] * 0.01);
|
||||
$gold = Util::round($auction['value'] * 0.01);
|
||||
$bidder['gold'] -= $gold;
|
||||
if($bidder['gold'] < 0) $bidder['gold'] = 0;
|
||||
$query = "update general set gold='{$bidder['gold']}' where no='{$auction['no2']}'";
|
||||
@@ -302,7 +302,7 @@ function processAuction() {
|
||||
//구매거래
|
||||
} else {
|
||||
if($auction['amount'] > $bidder['rice'] - 1000) {
|
||||
$gold = round($auction['value'] * 0.01);
|
||||
$gold = Util::round($auction['value'] * 0.01);
|
||||
$bidder['gold'] -= $gold;
|
||||
if($bidder['gold'] < 0) $bidder['gold'] = 0;
|
||||
$query = "update general set gold='{$bidder['gold']}' where no='{$auction['no2']}'";
|
||||
@@ -312,7 +312,7 @@ function processAuction() {
|
||||
$bidderLog[0] = "<S>◆</>입찰자의 군량 부족으로 {$auction['no']}번 거래 <M>유찰</>! 벌금 <C>{$gold}</>";
|
||||
$auctionLog[0] = "<S>◆</>{$admin['year']}년 {$admin['month']}월, {$auction['no']}번 <S>구매</> <M>유찰</> : <Y>{$auction['name1']}</>(이)가 쌀 <C>{$auction['amount']}</>(을)를 구매, <Y>{$auction['name2']}</>(이)가 금 <C>{$auction['value']}</>(으)로 입찰, 그러나 입찰자 군량부족, 벌금 <C>{$gold}</>";
|
||||
} elseif($auction['value'] > $trader['gold'] - 1000) {
|
||||
$gold = round($auction['value'] * 0.01);
|
||||
$gold = Util::round($auction['value'] * 0.01);
|
||||
$trader['gold'] -= $gold;
|
||||
if($trader['gold'] < 0) $trader['gold'] = 0;
|
||||
$query = "update general set gold='{$trader['gold']}' where no='{$auction['no1']}'";
|
||||
|
||||
+18
-18
@@ -130,7 +130,7 @@ function getSpecial2($leader, $power, $intel, $nodex=1, $dex0=0, $dex10=0, $dex2
|
||||
$special2 = 70;
|
||||
// 숙련 10,000: 25%, 40,000: 50%, 100,000: 79%, 160,000: 100%
|
||||
$dex = sqrt($dex0 + $dex10 + $dex20 + $dex30 + $dex40);
|
||||
$dex = round($dex / 4);
|
||||
$dex = Util::round($dex / 4);
|
||||
// 숙련 10,000: 75%, 40,000: 50%, 100,000: 21%, 160,000: 0%
|
||||
// 그중 20%만
|
||||
if($nodex == 0 && rand()%100 < 20 && rand()%100 > $dex) {
|
||||
@@ -194,8 +194,8 @@ function addGenDex($no, $type, $exp) {
|
||||
|
||||
$type = intdiv($type, 10) * 10;
|
||||
$dexType = "dex{$type}";
|
||||
if($type == 30) { $exp = round($exp * 0.90); } //귀병은 90%효율
|
||||
elseif($type == 40) { $exp = round($exp * 0.90); } //차병은 90%효율
|
||||
if($type == 30) { $exp = Util::round($exp * 0.90); } //귀병은 90%효율
|
||||
elseif($type == 40) { $exp = Util::round($exp * 0.90); } //차병은 90%효율
|
||||
|
||||
$query = "update general set {$dexType}={$dexType}+{$exp} where no='$no'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -421,7 +421,7 @@ function preUpdateMonthly() {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//도시훈사 180년 60, 220년 87, 240년 100
|
||||
$rate = round(($admin['year'] - $admin['startyear']) / 1.5) + 60;
|
||||
$rate = Util::round(($admin['year'] - $admin['startyear']) / 1.5) + 60;
|
||||
if($rate > 100) $rate = 100;
|
||||
|
||||
$ratio = 100;
|
||||
@@ -549,7 +549,7 @@ group by A.nation
|
||||
if($nation['chemi'] > 100) { $nation['chemi'] = 100; }
|
||||
|
||||
//약간의 랜덤치 부여 (95% ~ 105%)
|
||||
$nation['power'] = round($nation['power'] * (rand()%101 + 950) / 1000);
|
||||
$nation['power'] = Util::round($nation['power'] * (rand()%101 + 950) / 1000);
|
||||
$query = "update nation set power='{$nation['power']}',gennum2='{$nation['gennum']}',chemi='{$nation['chemi']}' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
@@ -563,7 +563,7 @@ group by A.nation
|
||||
$genCount = $genNum[$dip['me']];
|
||||
// 25% 참여율일때 두당 10턴에 4000명 소모한다고 계산
|
||||
// 4000 / 10 * 0.25 = 100
|
||||
$term = round($dip['dead'] / 100 / $genCount) + 1;
|
||||
$term = Util::round($dip['dead'] / 100 / $genCount) + 1;
|
||||
if($dip['term'] > $term) { $term = $dip['term']; }
|
||||
if($term > 13) { $term = 13; }
|
||||
$query = "update diplomacy set term='{$term}' where (me='{$dip['me']}' and you='{$dip['you']}')";
|
||||
@@ -746,7 +746,7 @@ function checkMerge() {
|
||||
$newGenCount = $gencount + $gencount2;
|
||||
if($newGenCount < 10) { $newGenCount = 10; }
|
||||
$newTotalTech = $younation['totaltech'] + $mynation['totaltech'];
|
||||
$newTech = round($newTotalTech / $newGenCount);
|
||||
$newTech = Util::round($newTotalTech / $newGenCount);
|
||||
// 자금 통합, 외교제한 5년, 기술유지
|
||||
$query = "update nation set name='{$you['makenation']}',gold=gold+'{$mynation['gold']}',rice=rice+'{$mynation['rice']}',surlimit='24',totaltech='$newTotalTech',tech='$newTech',gennum='{$newGenCount}' where nation='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -775,9 +775,9 @@ function checkMerge() {
|
||||
// NPC들 일부 하야 (양국중 큰쪽 장수수의 90~110%만큼)
|
||||
$resignCount = 0;
|
||||
if($npccount >= $npccount2) {
|
||||
$resignCount = round($npccount*(rand()%21+90)/100);
|
||||
$resignCount = Util::round($npccount*(rand()%21+90)/100);
|
||||
} else {
|
||||
$resignCount = round($npccount2*(rand()%21+90)/100);
|
||||
$resignCount = Util::round($npccount2*(rand()%21+90)/100);
|
||||
}
|
||||
$resignCommand = EncodeCommand(0, 0, 0, 45); //하야
|
||||
$query = "update general set turn0='$resignCommand' where nation='{$you['nation']}' and npc>=2 order by rand() limit {$resignCount}";
|
||||
@@ -867,7 +867,7 @@ function checkSurrender() {
|
||||
$newGenCount = $gencount + $gencount2;
|
||||
if($newGenCount < 10) { $newGenCount = 10; }
|
||||
$newTotalTech = $younation['totaltech'] + $mynation['totaltech'];
|
||||
$newTech = round($newTotalTech / $newGenCount);
|
||||
$newTech = Util::round($newTotalTech / $newGenCount);
|
||||
// 자금 통합, 외교제한 5년, 기술유지
|
||||
$query = "update nation set gold=gold+'{$mynation['gold']}',rice=rice+'{$mynation['rice']}',surlimit='24',totaltech='$newTotalTech',tech='$newTech',gennum='{$newGenCount}' where nation='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -903,9 +903,9 @@ function checkSurrender() {
|
||||
// NPC들 일부 하야 (양국중 큰쪽 장수수의 90~110%만큼)
|
||||
$resignCount = 0;
|
||||
if($npccount >= $npccount2) {
|
||||
$resignCount = round($npccount*(rand()%21+90)/100);
|
||||
$resignCount = Util::round($npccount*(rand()%21+90)/100);
|
||||
} else {
|
||||
$resignCount = round($npccount2*(rand()%21+90)/100);
|
||||
$resignCount = Util::round($npccount2*(rand()%21+90)/100);
|
||||
}
|
||||
$resignCommand = EncodeCommand(0, 0, 0, 45); //하야
|
||||
$query = "update general set turn0='$resignCommand' where nation='{$you['nation']}' and npc>=2 order by rand() limit {$resignCount}";
|
||||
@@ -1018,17 +1018,17 @@ function checkStatistic() {
|
||||
$query = "select avg(gold) as avggold, avg(rice) as avgrice, avg(dex0+dex10+dex20+dex30) as avgdex, max(dex0+dex10+dex20+dex30) as maxdex, avg(experience+dedication) as avgexpded, max(experience+dedication) as maxexpded from general";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
$general['avggold'] = round($general['avggold']);
|
||||
$general['avgrice'] = round($general['avgrice']);
|
||||
$general['avgdex'] = round($general['avgdex']);
|
||||
$general['avgexpded'] = round($general['avgexpded']);
|
||||
$general['avggold'] = Util::round($general['avggold']);
|
||||
$general['avgrice'] = Util::round($general['avgrice']);
|
||||
$general['avgdex'] = Util::round($general['avgdex']);
|
||||
$general['avgexpded'] = Util::round($general['avgexpded']);
|
||||
$etc .= "평균 금/쌀 ({$general['avggold']}/{$general['avgrice']}), 평균/최고 숙련({$general['avgdex']}/{$general['maxdex']}), 평균/최고 경험공헌({$general['avgexpded']}/{$general['maxexpded']}), ";
|
||||
|
||||
$query = "select min(tech) as mintech, max(tech) as maxtech, avg(tech) as avgtech, min(power) as minpower, max(power) as maxpower, avg(power) as avgpower from nation where level>0";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
$nation['avgtech'] = round($nation['avgtech']);
|
||||
$nation['avgpower'] = round($nation['avgpower']);
|
||||
$nation['avgtech'] = Util::round($nation['avgtech']);
|
||||
$nation['avgpower'] = Util::round($nation['avgpower']);
|
||||
$etc .= "최저/평균/최고 기술({$nation['mintech']}/{$nation['avgtech']}/{$nation['maxtech']}), ";
|
||||
$etc .= "최저/평균/최고 국력({$nation['minpower']}/{$nation['avgpower']}/{$nation['maxpower']}), ";
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ function bar($per, $h=7) {
|
||||
else { $bd = 1; $h = 12; $h2 = 8; }
|
||||
|
||||
$per = round($per, 1);
|
||||
if($per < 1 || $per > 99) { $per = round($per); }
|
||||
if($per < 1 || $per > 99) { $per = Util::round($per); }
|
||||
$str1 = "<td width={$per}% background=".ServConfig::$gameImagePath."/pb{$h2}.gif></td>";
|
||||
$str2 = "<td width=*% background=".ServConfig::$gameImagePath."/pr{$h2}.gif></td>";
|
||||
if($per <= 0) { $str1 = ""; }
|
||||
|
||||
+7
-7
@@ -68,7 +68,7 @@ function SetDevelop($genType, $no, $city, $tech) {
|
||||
$result = MYDB_query($query, $connect) or Error("processAI04 ".MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
|
||||
$ratio = round($genCount / 600 * 100);
|
||||
$ratio = Util::round($genCount / 600 * 100);
|
||||
|
||||
if(rand() % 100 < $ratio) {
|
||||
$command = EncodeCommand(0, 0, 0, 9);
|
||||
@@ -333,8 +333,8 @@ function processAI($no) {
|
||||
$query = "select nation from general where level=12 and npc>0";
|
||||
$result = MYDB_query($query, $connect) or Error("processAI06 ".MYDB_error($connect),"");
|
||||
$npcCount = MYDB_num_rows($result);
|
||||
$ratio = round($npcCount / ($nonCount + $npcCount) * 100);
|
||||
$ratio = round($ratio * 1.0);
|
||||
$ratio = Util::round($npcCount / ($nonCount + $npcCount) * 100);
|
||||
$ratio = Util::round($ratio * 1.0);
|
||||
//NPC우선임관
|
||||
$query = "select nation,ABS(IF(ABS(affinity-'{$general['affinity']}')>75,150-ABS(affinity-'{$general['affinity']}'),ABS(affinity-'{$general['affinity']}'))) as npcmatch2 from general where level=12 and npc>0 and nation not in (0{$general['nations']}0) order by npcmatch2,rand() limit 0,1";
|
||||
$result = MYDB_query($query, $connect) or Error("processAI06 ".MYDB_error($connect),"");
|
||||
@@ -355,7 +355,7 @@ function processAI($no) {
|
||||
case 2: case 3: //거병이나 견문 40%
|
||||
// 초반이면서 능력이 좋은놈 위주로 1%확률로 거병 (300명 재야시 2년간 약 10개 거병 예상)
|
||||
$prop = rand() % 100;
|
||||
$ratio = round(($general['leader'] + $general['power'] + $general['intel']) / 3);
|
||||
$ratio = Util::round(($general['leader'] + $general['power'] + $general['intel']) / 3);
|
||||
if($admin['startyear']+2 > $admin['year'] && $prop < $ratio && rand()%100 < 1 && $general['makelimit'] == 0) {
|
||||
//거병
|
||||
$command = EncodeCommand(0, 0, 0, 55);
|
||||
@@ -798,9 +798,9 @@ function processAI($no) {
|
||||
$result = MYDB_query($query, $connect) or Error("processAI16 ".MYDB_error($connect),"");
|
||||
$sumCity = MYDB_fetch_array($result);
|
||||
// 현도시 인구 비율
|
||||
$ratio = round($city['pop'] / $sumCity['sum'] * 100);
|
||||
$ratio = Util::round($city['pop'] / $sumCity['sum'] * 100);
|
||||
// 현도시 장수 비율
|
||||
$ratio2 = round($genCount2 / $genCount * 100);
|
||||
$ratio2 = Util::round($genCount2 / $genCount * 100);
|
||||
$ratio3 = rand() % 100;
|
||||
// 전체 인구 대비 확률로 현지에서 징병
|
||||
if($city['pop'] > 40000 && 100 + $ratio - $ratio2 > $ratio3) {
|
||||
@@ -868,7 +868,7 @@ function processAI($no) {
|
||||
$query = "select city from city where nation='{$general['nation']}' and supply='1'";
|
||||
$result = MYDB_query($query, $connect) or Error("processAI10 ".MYDB_error($connect),"");
|
||||
$cityCount = MYDB_num_rows($result);
|
||||
$citySelect = rand() % (round($cityCount/5) + 1);
|
||||
$citySelect = rand() % (Util::round($cityCount/5) + 1);
|
||||
|
||||
$query = "select city,(def+wall)/(def2+wall2) as dev from city where nation='{$general['nation']}' and supply='1' order by dev limit {$citySelect},1";
|
||||
$result = MYDB_query($query, $connect) or Error("processAI10 ".MYDB_error($connect),"");
|
||||
|
||||
+36
-36
@@ -58,7 +58,7 @@ function getGeneralPower(&$general, $withInjury, $withItem, $withStatAdjust, $us
|
||||
}
|
||||
|
||||
if($withStatAdjust){
|
||||
$power += round(getGeneralIntel($general, $withInjury, $withItem, false, false) / 4);
|
||||
$power += Util::round(getGeneralIntel($general, $withInjury, $withItem, false, false) / 4);
|
||||
}
|
||||
|
||||
if($useFloor){
|
||||
@@ -89,7 +89,7 @@ function getGeneralIntel(&$general, $withInjury, $withItem, $withStatAdjust, $us
|
||||
}
|
||||
|
||||
if($withStatAdjust){
|
||||
$intel += round(getGeneralPower($general, $withInjury, $withItem, false, false) / 4);
|
||||
$intel += Util::round(getGeneralPower($general, $withInjury, $withItem, false, false) / 4);
|
||||
}
|
||||
|
||||
if($useFloor){
|
||||
@@ -173,7 +173,7 @@ function CriticalScore($score, $type) {
|
||||
$ratio = (rand()%3 + 2)/10; // 0.2~0.4
|
||||
break;
|
||||
}
|
||||
return round($score * $ratio);
|
||||
return Util::round($score * $ratio);
|
||||
}
|
||||
|
||||
function process_1(&$general, $type) {
|
||||
@@ -247,7 +247,7 @@ function process_1(&$general, $type) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}{$atype} <S>성공</>하여 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
} else {
|
||||
$score = round($score);
|
||||
$score = Util::round($score);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}{$atype} 하여 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ function process_3(&$general) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}를 <S>성공</>하여 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
} else {
|
||||
$score = round($score);
|
||||
$score = Util::round($score);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}를 하여 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ function process_4(&$general) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:선정을 <S>성공</>하여 민심이 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
} else {
|
||||
$score = round($score);
|
||||
$score = Util::round($score);
|
||||
$log[] = "<C>●</>{$admin['month']}월:민심이 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ function process_5(&$general, $type) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}를 <S>성공</>하여 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
} else {
|
||||
$score = round($score);
|
||||
$score = Util::round($score);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}를 하여 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ function process_7(&$general) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:장려를 <S>성공</>하여 주민이 <C>{$score}0</>명 증가했습니다. <1>$date</>";
|
||||
} else {
|
||||
$score = round($score);
|
||||
$score = Util::round($score);
|
||||
$log[] = "<C>●</>{$admin['month']}월:주민이 <C>{$score}0</>명 증가했습니다. <1>$date</>";
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ function process_8(&$general) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}을 <S>성공</>하여 <C>$score</> 강화했습니다. <1>$date</>";
|
||||
} else {
|
||||
$score = round($score);
|
||||
$score = Util::round($score);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}을 <C>$score</> 강화했습니다. <1>$date</>";
|
||||
}
|
||||
|
||||
@@ -801,7 +801,7 @@ function process_9(&$general) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:조달을 <S>성공</>하여 {$stype}을 <C>$score</> 조달했습니다. <1>$date</>";
|
||||
} else {
|
||||
$score = round($score);
|
||||
$score = Util::round($score);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$stype}을 <C>$score</> 조달했습니다. <1>$date</>";
|
||||
}
|
||||
|
||||
@@ -876,7 +876,7 @@ function process_11(&$general, $type) {
|
||||
if($armtype != $general['crewtype']) { $general['crew'] = 0; $general['train'] = $defaulttrain; $general['atmos'] = $defaultatmos; }
|
||||
|
||||
if($crew*100 + $general['crew'] > getGeneralLeadership($general, true, true, true)*100) {
|
||||
$crew = round(getGeneralLeadership($general, true, true, true) - $general['crew']/100);
|
||||
$crew = Util::round(getGeneralLeadership($general, true, true, true) - $general['crew']/100);
|
||||
}
|
||||
if($crew < 0) { $crew = 0; }
|
||||
$cost = $crew * getCost($armtype);
|
||||
@@ -884,7 +884,7 @@ function process_11(&$general, $type) {
|
||||
$cost *= getTechCost($nation['tech']);
|
||||
//성격 보정
|
||||
$cost = CharCost($cost, $general['personal']);
|
||||
$cost = round($cost);
|
||||
$cost = Util::round($cost);
|
||||
|
||||
//특기 보정 : 보병, 궁병, 기병, 귀병, 공성, 징병
|
||||
if(intdiv($armtype, 10) == 0 && $general['special2'] == 50) { $cost *= 0.9; }
|
||||
@@ -1006,13 +1006,13 @@ function process_11(&$general, $type) {
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
$atmos = round(($general['atmos'] * $general['crew'] + $defaultatmos * $crew*100) / ($general['crew'] + $crew*100));
|
||||
$train = round(($general['train'] * $general['crew'] + $defaulttrain * $crew*100) / ($general['crew'] + $crew*100));
|
||||
$atmos = Util::round(($general['atmos'] * $general['crew'] + $defaultatmos * $crew*100) / ($general['crew'] + $crew*100));
|
||||
$train = Util::round(($general['train'] * $general['crew'] + $defaulttrain * $crew*100) / ($general['crew'] + $crew*100));
|
||||
$general['crew'] += $crew*100;
|
||||
$general['gold'] -= $cost;
|
||||
// 주민수 감소 // 민심 김소
|
||||
if($type == 1) { $city['rate'] = $city['rate'] - round(($crew*100 / $city['pop'])*100); }
|
||||
else { $city['rate'] = $city['rate'] - round(($crew*100 / $city['pop'])*50); }
|
||||
if($type == 1) { $city['rate'] = $city['rate'] - Util::round(($crew*100 / $city['pop'])*100); }
|
||||
else { $city['rate'] = $city['rate'] - Util::round(($crew*100 / $city['pop'])*50); }
|
||||
if($city['rate'] < 0) { $city['rate'] = 0; }
|
||||
$query = "update city set pop=pop-({$crew}*100),rate='{$city['rate']}' where city='{$general['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1065,13 +1065,13 @@ function process_13(&$general) {
|
||||
// $log[] = "<C>●</>{$admin['month']}월:병기는 훈련이 불가능합니다. <1>$date</>";
|
||||
} else {
|
||||
// 훈련시
|
||||
$score = round(getGeneralLeadership($general, true, true, true) * 100 / $general['crew'] * $_training);
|
||||
$score = Util::round(getGeneralLeadership($general, true, true, true) * 100 / $general['crew'] * $_training);
|
||||
|
||||
$log[] = "<C>●</>{$admin['month']}월:훈련치가 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
$exp = 100;
|
||||
$ded = 70;
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['crewtype'], round($general['crew']/100));
|
||||
addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100));
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
@@ -1136,14 +1136,14 @@ function process_14(&$general) {
|
||||
// } elseif(intdiv($general['crewtype'], 10) == 4) {
|
||||
// $log[] = "<C>●</>{$admin['month']}월:병기는 사기 진작이 불가능합니다. <1>$date</>";
|
||||
} else {
|
||||
$score = round(getGeneralLeadership($general, true, true, true)*100 / $general['crew'] * $_training);
|
||||
$gold = $general['gold'] - round($general['crew']/100);
|
||||
$score = Util::round(getGeneralLeadership($general, true, true, true)*100 / $general['crew'] * $_training);
|
||||
$gold = $general['gold'] - Util::round($general['crew']/100);
|
||||
|
||||
$log[] = "<C>●</>{$admin['month']}월:사기치가 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
$exp = 100;
|
||||
$ded = 70;
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['crewtype'], round($general['crew']/100));
|
||||
addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100));
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
@@ -1192,7 +1192,7 @@ function process_15(&$general) {
|
||||
$code = 100 + 15;
|
||||
}
|
||||
|
||||
$cost = round($general['crew']/100 * 3 * getTechCost($nation['tech']));
|
||||
$cost = Util::round($general['crew']/100 * 3 * getTechCost($nation['tech']));
|
||||
|
||||
if($general['level'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:재야입니다. 전투태세 실패. <1>$date</>";
|
||||
@@ -1219,7 +1219,7 @@ function process_15(&$general) {
|
||||
$exp = 100 * 3;
|
||||
$ded = 70 * 3;
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['crewtype'], round($general['crew']/100 * 3));
|
||||
addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100 * 3));
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
@@ -1287,7 +1287,7 @@ function process_16(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:재야입니다. <G><b>{$destcity['name']}</b></>(으)로 출병 실패. <1>$date</>";
|
||||
} elseif($general['crew'] <= 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:병사가 없습니다. <G><b>{$destcity['name']}</b></>(으)로 출병 실패. <1>$date</>";
|
||||
} elseif($general['rice'] <= round($general['crew']/100)) {
|
||||
} elseif($general['rice'] <= Util::round($general['crew']/100)) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:군량이 모자랍니다. <G><b>{$destcity['name']}</b></>(으)로 출병 실패. <1>$date</>";
|
||||
} elseif($dip['state'] != 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:교전중인 국가가 아닙니다. <G><b>{$destcity['name']}</b></>(으)로 출병 실패. <1>$date</>";
|
||||
@@ -1305,13 +1305,13 @@ function process_16(&$general) {
|
||||
$query = "update city set state=43,term=3 where city='{$destcity['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['crewtype'], round($general['crew']/100));
|
||||
addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100));
|
||||
// 전투 처리
|
||||
$dead = processWar($general, $destcity);
|
||||
|
||||
// 기술력 따라서 보정
|
||||
$dead['att'] = round($dead['att'] * getTechCost($nation['tech']));
|
||||
$dead['def'] = round($dead['def'] * getTechCost($dnation['tech']));
|
||||
$dead['att'] = Util::round($dead['att'] * getTechCost($nation['tech']));
|
||||
$dead['def'] = Util::round($dead['def'] * getTechCost($dnation['tech']));
|
||||
|
||||
// 사상자 누적
|
||||
if($nation['nation'] > 0 && $dnation['nation'] > 0) {
|
||||
@@ -1776,8 +1776,8 @@ function process_41(&$general) {
|
||||
$exp = $general['crew'] / 400;
|
||||
$crewexp = $general['crew'] * $general['train'] * $general['atmos'] / 20 / 10000;
|
||||
// 랜덤치
|
||||
$exp = round($exp * (80 + rand() % 41)/100); // 80 ~ 120%
|
||||
$crewexp = round($crewexp * (80 + rand() % 41)/100); // 80 ~ 120%
|
||||
$exp = Util::round($exp * (80 + rand() % 41)/100); // 80 ~ 120%
|
||||
$crewexp = Util::round($crewexp * (80 + rand() % 41)/100); // 80 ~ 120%
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
@@ -2284,7 +2284,7 @@ function process_48(&$general) {
|
||||
$query = "update general set resturn='SUCCESS',weap='$type',gold=gold-'$cost' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$cost = round(getItemCost($general['weap']) / 2, 0);
|
||||
$cost = Util::round(getItemCost($general['weap']) / 2);
|
||||
$log[] = "<C>●</>{$admin['month']}월:<C>".getWeapName($general['weap'])."</>(을)를 판매했습니다. <1>$date</>";
|
||||
$query = "update general set resturn='SUCCESS',weap='0',gold=gold+'$cost' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -2295,7 +2295,7 @@ function process_48(&$general) {
|
||||
$query = "update general set resturn='SUCCESS',book='$type',gold=gold-'$cost' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$cost = round(getItemCost($general['book']) / 2, 0);
|
||||
$cost = Util::round(getItemCost($general['book']) / 2);
|
||||
$log[] = "<C>●</>{$admin['month']}월:<C>".getBookName($general['book'])."</>(을)를 판매했습니다. <1>$date</>";
|
||||
$query = "update general set resturn='SUCCESS',book='0',gold=gold+'$cost' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -2306,7 +2306,7 @@ function process_48(&$general) {
|
||||
$query = "update general set resturn='SUCCESS',horse='$type',gold=gold-'$cost' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$cost = round(getItemCost($general['horse']) / 2, 0);
|
||||
$cost = Util::round(getItemCost($general['horse']) / 2);
|
||||
$log[] = "<C>●</>{$admin['month']}월:<C>".getHorseName($general['horse'])."</>(을)를 판매했습니다. <1>$date</>";
|
||||
$query = "update general set resturn='SUCCESS',horse='0',gold=gold+'$cost' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -2317,7 +2317,7 @@ function process_48(&$general) {
|
||||
$query = "update general set resturn='SUCCESS',item='$type',gold=gold-'$cost' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$cost = round(getItemCost2($general['item']) / 2, 0);
|
||||
$cost = Util::round(getItemCost2($general['item']) / 2);
|
||||
$log[] = "<C>●</>{$admin['month']}월:<C>".getItemName($general['item'])."</>(을)를 판매했습니다. <1>$date</>";
|
||||
$query = "update general set resturn='SUCCESS',item='0',gold=gold+'$cost' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -2402,9 +2402,9 @@ function process_49(&$general) {
|
||||
}
|
||||
}
|
||||
|
||||
$cost = round($cost);
|
||||
$amount = round($amount);
|
||||
$tax = round($tax);
|
||||
$cost = Util::round($cost);
|
||||
$amount = Util::round($amount);
|
||||
$tax = Util::round($tax);
|
||||
|
||||
if($city['trade'] == 0 && $general['special'] != 30 && $general['npc'] < 2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:도시에 상인이 없습니다. $dtype 실패. <1>$date</>";
|
||||
|
||||
+33
-33
@@ -926,7 +926,7 @@ function process_65(&$general) {
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>(이)가 <G><b>{$destcity['name']}</b></>의 <R>초토화</>를 명령");
|
||||
|
||||
//외교제한 24
|
||||
$amount = round($destcity['pop'] * 0.1);
|
||||
$amount = Util::round($destcity['pop'] * 0.1);
|
||||
$query = "update nation set surlimit='24',gold=gold+'$amount',rice=rice+'$amount' where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
@@ -1268,10 +1268,10 @@ function process_71(&$general) {
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
|
||||
//$term2 = round($genCount / 10);
|
||||
//$term2 = Util::round($genCount / 10);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
$term2 = 3;
|
||||
$term3 = round(sqrt($genCount*8)*10);
|
||||
$term3 = Util::round(sqrt($genCount*8)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
if($code%100 == 71) {
|
||||
@@ -1324,7 +1324,7 @@ function process_71(&$general) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 국가보정
|
||||
if($nation['type'] == 11) { $term3 = round($term3 / 2); }
|
||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
@@ -1381,10 +1381,10 @@ function process_72(&$general) {
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
|
||||
//$term2 = round($genCount / 20);
|
||||
//$term2 = Util::round($genCount / 20);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
$term2 = 1;
|
||||
$term3 = round(sqrt($genCount*4)*10);
|
||||
$term3 = Util::round(sqrt($genCount*4)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
if($code%100 == 72) {
|
||||
@@ -1439,7 +1439,7 @@ function process_72(&$general) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 국가보정
|
||||
if($nation['type'] == 11) { $term3 = round($term3 / 2); }
|
||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
@@ -1500,10 +1500,10 @@ function process_73(&$general) {
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
|
||||
//$term2 = round($genCount / 20);
|
||||
//$term2 = Util::round($genCount / 20);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
$term2 = 3;
|
||||
$term3 = round(sqrt($genCount*4)*10);
|
||||
$term3 = Util::round(sqrt($genCount*4)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
if($code%100 == 73) {
|
||||
@@ -1570,7 +1570,7 @@ function process_73(&$general) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 국가보정
|
||||
if($nation['type'] == 11) { $term3 = round($term3 / 2); }
|
||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
@@ -1631,10 +1631,10 @@ function process_74(&$general) {
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
|
||||
//$term2 = round($genCount / 20);
|
||||
//$term2 = Util::round($genCount / 20);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
$term2 = 2;
|
||||
$term3 = round(sqrt($genCount*4)*10);
|
||||
$term3 = Util::round(sqrt($genCount*4)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
if($code%100 == 74) {
|
||||
@@ -1714,7 +1714,7 @@ function process_74(&$general) {
|
||||
}
|
||||
|
||||
// 국가보정
|
||||
if($nation['type'] == 11) { $term3 = round($term3 / 2); }
|
||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
@@ -1771,10 +1771,10 @@ function process_75(&$general) {
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
|
||||
//$term2 = round($genCount / 40);
|
||||
//$term2 = Util::round($genCount / 40);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
$term2 = 3;
|
||||
$term3 = round(sqrt($genCount*2)*10);
|
||||
$term3 = Util::round(sqrt($genCount*2)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
if($code%100 == 75) {
|
||||
@@ -1839,7 +1839,7 @@ function process_75(&$general) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 국가보정
|
||||
if($nation['type'] == 11) { $term3 = round($term3 / 2); }
|
||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한, 최소72
|
||||
@@ -1886,10 +1886,10 @@ function process_76(&$general) {
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
|
||||
//$term2 = round($genCount / 10);
|
||||
//$term2 = Util::round($genCount / 10);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
$term2 = 3;
|
||||
$term3 = round(sqrt($genCount*10)*10);
|
||||
$term3 = Util::round(sqrt($genCount*10)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
if($code%100 == 76) {
|
||||
@@ -1940,7 +1940,7 @@ function process_76(&$general) {
|
||||
$query = "select avg(gennum) as gennum from nation";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$avgNation = MYDB_fetch_array($result);
|
||||
$gencount = 5 + round($avgNation['gennum'] / 10);
|
||||
$gencount = 5 + Util::round($avgNation['gennum'] / 10);
|
||||
|
||||
$query = "select avg(age) as age, max(leader+power+intel) as lpi, avg(dedication) as ded,avg(experience) as exp, avg(dex0) as dex0, avg(dex10) as dex10, avg(dex20) as dex20, avg(dex30) as dex30, avg(dex40) as dex40 from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1971,17 +1971,17 @@ function process_76(&$general) {
|
||||
}
|
||||
// 국내 최고능치 기준으로 랜덤성 스케일링
|
||||
if($avgGen['lpi'] > 210) {
|
||||
$leader = round($leader * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$power = round($power * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$intel = round($intel * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$leader = Util::round($leader * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$power = Util::round($power * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$intel = Util::round($intel * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
} elseif($avgGen['lpi'] > 180) {
|
||||
$leader = round($leader * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$power = round($power * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$intel = round($intel * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$leader = Util::round($leader * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$power = Util::round($power * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$intel = Util::round($intel * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
} else {
|
||||
$leader = round($leader * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$power = round($power * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$intel = round($intel * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$leader = Util::round($leader * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$power = Util::round($power * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$intel = Util::round($intel * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
}
|
||||
$over1 = 0;
|
||||
$over2 = 0;
|
||||
@@ -2059,7 +2059,7 @@ function process_76(&$general) {
|
||||
if($gencount < 10) $gencount = 10;
|
||||
|
||||
// 국가보정
|
||||
if($nation['type'] == 11) { $term3 = round($term3 / 2); }
|
||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한, 국가 기술력 그대로
|
||||
@@ -2117,7 +2117,7 @@ function process_77(&$general) {
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
|
||||
$term2 = 1;
|
||||
$term3 = round(sqrt($genCount*16)*10);
|
||||
$term3 = Util::round(sqrt($genCount*16)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
if($code%100 == 77) {
|
||||
@@ -2187,7 +2187,7 @@ function process_77(&$general) {
|
||||
}
|
||||
|
||||
// 국가보정
|
||||
if($nation['type'] == 11) { $term3 = round($term3 / 2); }
|
||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
@@ -2245,7 +2245,7 @@ function process_78(&$general) {
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
|
||||
$term2 = 1;
|
||||
$term3 = round(sqrt($genCount*16)*10);
|
||||
$term3 = Util::round(sqrt($genCount*16)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
if($code%100 == 78) {
|
||||
@@ -2312,7 +2312,7 @@ function process_78(&$general) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 국가보정
|
||||
if($nation['type'] == 11) { $term3 = round($term3 / 2); }
|
||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
|
||||
@@ -25,7 +25,7 @@ function process_22(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$you = MYDB_fetch_array($result);
|
||||
|
||||
$cost = round($admin['develcost'] + ($you['experience'] + $you['dedication'])/1000) * 10;
|
||||
$cost = Util::round($admin['develcost'] + ($you['experience'] + $you['dedication'])/1000) * 10;
|
||||
|
||||
if(!$you) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:없는 장수입니다. 등용 실패. <1>$date</>";
|
||||
@@ -217,7 +217,7 @@ function process_29(&$general) {
|
||||
$query = "select no from general where nation!='{$general['nation']}' and npc=3";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$otherNpccount = MYDB_num_rows($result);
|
||||
$otherNpccount = round(sqrt($otherNpccount + 1)) - 1;
|
||||
$otherNpccount = Util::round(sqrt($otherNpccount + 1)) - 1;
|
||||
|
||||
if($gencount <= 0) { $gencount = 1; }
|
||||
if($npccount <= 0) { $npccount = 1; }
|
||||
@@ -314,17 +314,17 @@ function process_29(&$general) {
|
||||
}
|
||||
// 국내 최고능치 기준으로 랜덤성 스케일링
|
||||
if($avgGen['lpi'] > 210) {
|
||||
$leader = round($leader * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$power = round($power * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$intel = round($intel * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$leader = Util::round($leader * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$power = Util::round($power * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
$intel = Util::round($intel * $avgGen['lpi'] / 150 * (60+rand()%31)/100);
|
||||
} elseif($avgGen['lpi'] > 180) {
|
||||
$leader = round($leader * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$power = round($power * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$intel = round($intel * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$leader = Util::round($leader * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$power = Util::round($power * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
$intel = Util::round($intel * $avgGen['lpi'] / 150 * (75+rand()%21)/100);
|
||||
} else {
|
||||
$leader = round($leader * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$power = round($power * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$intel = round($intel * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$leader = Util::round($leader * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$power = Util::round($power * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
$intel = Util::round($intel * $avgGen['lpi'] / 150 * (90+rand()%11)/100);
|
||||
}
|
||||
$over1 = 0;
|
||||
$over2 = 0;
|
||||
@@ -370,8 +370,8 @@ function process_29(&$general) {
|
||||
$bornyear = $admin['year'];
|
||||
$deadyear = $admin['year'] + 3;
|
||||
$age = 20;
|
||||
$specage = round((80 - $age)/12) + $age;
|
||||
$specage2 = round((80 - $age)/3) + $age;
|
||||
$specage = Util::round((80 - $age)/12) + $age;
|
||||
$specage2 = Util::round((80 - $age)/3) + $age;
|
||||
//$specage = $age + 1 + rand() % 3;
|
||||
//$specage2 = $age + 5 + rand() % 5;
|
||||
// 10년 ~ 50년
|
||||
|
||||
@@ -57,7 +57,7 @@ function process_32(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$intelgen = MYDB_fetch_array($result);
|
||||
|
||||
$ratio = round(((getGeneralIntel($general, true, true, true, false) - getGeneralIntel($intelgen, true, true, true, false)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio = Util::round(((getGeneralIntel($general, true, true, true, false) - getGeneralIntel($intelgen, true, true, true, false)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio2 = rand() % 100;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -187,7 +187,7 @@ function process_33(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$powergen = MYDB_fetch_array($result);
|
||||
|
||||
$ratio = round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio2 = rand() % 100;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -334,7 +334,7 @@ function process_34(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$powergen = MYDB_fetch_array($result);
|
||||
|
||||
$ratio = round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio2 = rand() % 100;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -462,7 +462,7 @@ function process_35(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gen = MYDB_fetch_array($result);
|
||||
|
||||
$ratio = round(((getGeneralLeadership($general, true, true, true) - getGeneralLeadership($gen, true, true, true)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio = Util::round(((getGeneralLeadership($general, true, true, true) - getGeneralLeadership($gen, true, true, true)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio2 = rand() % 100;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -499,8 +499,8 @@ function process_35(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 선동이 성공했습니다. <1>$date</>";
|
||||
|
||||
// 선동 최대 10
|
||||
$destcity['secu'] -= rand() % round($_firingpower/2) + $_firingbase;
|
||||
$destcity['rate'] -= rand() % round($_firingpower/50) + $_firingbase/50;
|
||||
$destcity['secu'] -= rand() % Util::round($_firingpower/2) + $_firingbase;
|
||||
$destcity['rate'] -= rand() % Util::round($_firingpower/50) + $_firingbase/50;
|
||||
if($destcity['secu'] < 0) { $destcity['secu'] = 0; }
|
||||
if($destcity['rate'] < 0) { $destcity['rate'] = 0; }
|
||||
$query = "update city set state=32,rate='{$destcity['rate']}',secu='{$destcity['secu']}' where city='$destination'";
|
||||
|
||||
+13
-13
@@ -64,7 +64,7 @@ function processGoldIncome() {
|
||||
$incomeList = getGoldIncome($nation['nation'], $nation['rate_tmp'], $admin['gold_rate'], $nation['type']);
|
||||
$income = $incomeList[0] + $incomeList[1];
|
||||
$originoutcome = getGoldOutcome($nation['nation'], 100); // 100%의 지급량
|
||||
$outcome = round($originoutcome * $nation['bill'] / 100); // 지급량에 따른 요구량
|
||||
$outcome = Util::round($originoutcome * $nation['bill'] / 100); // 지급량에 따른 요구량
|
||||
// 실제 지급량 계산
|
||||
$nation['gold'] += $income;
|
||||
// 기본량도 안될경우
|
||||
@@ -110,7 +110,7 @@ function processGoldIncome() {
|
||||
// 각 장수들에게 지급
|
||||
for($j=0; $j < $gencount; $j++) {
|
||||
$general = MYDB_fetch_array($genresult);
|
||||
$gold = round(getBill($general['dedication'])*$ratio);
|
||||
$gold = Util::round(getBill($general['dedication'])*$ratio);
|
||||
$general['gold'] += $gold;
|
||||
|
||||
$query = "update general set gold='{$general['gold']}' where no='{$general['no']}'";
|
||||
@@ -263,8 +263,8 @@ function getGoldIncome($nationNo, $rate, $admin_rate, $type) {
|
||||
if($type == 1) { $income[0] *= 1.1; $income[1] *= 1.1; }
|
||||
if($type == 9 || $type == 10 || $type == 11) { $income[0] *= 0.9; $income[1] *= 0.9; }
|
||||
|
||||
$income[0] = round($income[0] * ($admin_rate/100));
|
||||
$income[1] = round($income[1] * ($admin_rate/100));
|
||||
$income[0] = Util::round($income[0] * ($admin_rate/100));
|
||||
$income[1] = Util::round($income[1] * ($admin_rate/100));
|
||||
|
||||
return $income;
|
||||
}
|
||||
@@ -310,7 +310,7 @@ function getDeadIncome($nation, $type, $admin_rate) {
|
||||
if($type == 1) { $income *= 1.1; }
|
||||
if($type == 9 || $type == 10) { $income *= 0.9; }
|
||||
|
||||
$income = round($income * $admin_rate / 100);
|
||||
$income = Util::round($income * $admin_rate / 100);
|
||||
}
|
||||
return $income;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ function getGoldOutcome($nation, $bill) {
|
||||
$outcome += getBill($general['dedication']);
|
||||
}
|
||||
|
||||
$outcome = round($outcome * $bill / 100);
|
||||
$outcome = Util::round($outcome * $bill / 100);
|
||||
|
||||
return $outcome;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ function processRiceIncome() {
|
||||
$incomeList = getRiceIncome($nation['nation'], $nation['rate_tmp'], $admin['rice_rate'], $nation['type']);
|
||||
$income = $incomeList[0] + $incomeList[1];
|
||||
$originoutcome = getRiceOutcome($nation['nation'], 100); // 100%의 지급량
|
||||
$outcome = round($originoutcome * $nation['bill'] / 100); // 지급량에 따른 요구량
|
||||
$outcome = Util::round($originoutcome * $nation['bill'] / 100); // 지급량에 따른 요구량
|
||||
|
||||
// 실제 지급량 계산
|
||||
$nation['rice'] += $income;
|
||||
@@ -434,7 +434,7 @@ function processRiceIncome() {
|
||||
// 각 장수들에게 지급
|
||||
for($j=0; $j < $gencount; $j++) {
|
||||
$general = MYDB_fetch_array($genresult);
|
||||
$rice = round(getBill($general['dedication'])*$ratio);
|
||||
$rice = Util::round(getBill($general['dedication'])*$ratio);
|
||||
$general['rice'] += $rice;
|
||||
|
||||
$query = "update general set rice='{$general['rice']}' where no='{$general['no']}'";
|
||||
@@ -510,8 +510,8 @@ function getRiceIncome($nationNo, $rate, $admin_rate, $type) {
|
||||
if($type == 8) { $income[0] *= 1.1; $income[1] *= 1.1; }
|
||||
if($type == 2 || $type == 4 || $type == 13) { $income[0] *= 0.9; $income[1] *= 0.9; }
|
||||
|
||||
$income[0] = round($income[0] * ($admin_rate/100));
|
||||
$income[1] = round($income[1] * ($admin_rate/100));
|
||||
$income[0] = Util::round($income[0] * ($admin_rate/100));
|
||||
$income[1] = Util::round($income[1] * ($admin_rate/100));
|
||||
|
||||
return $income;
|
||||
}
|
||||
@@ -531,7 +531,7 @@ function getRiceOutcome($nation, $bill) {
|
||||
$outcome += getBill($general['dedication']);
|
||||
}
|
||||
|
||||
$outcome = round($outcome * $bill / 100);
|
||||
$outcome = Util::round($outcome * $bill / 100);
|
||||
|
||||
return $outcome;
|
||||
}
|
||||
@@ -600,8 +600,8 @@ function disaster() {
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
//호황 발생 도시 선택 ( 기본 3% 이므로 약 3개 도시 )
|
||||
//재해 발생 도시 선택 ( 기본 6% 이므로 약 6개 도시 )
|
||||
if($isgood == 1) { $ratio = 3 + round(1.0*$city['secu']/$city['secu2']*3); } // 3 ~ 6%
|
||||
else { $ratio = 6 - round(1.0*$city['secu']/$city['secu2']*3); } // 3 ~ 6%
|
||||
if($isgood == 1) { $ratio = 3 + Util::round(1.0*$city['secu']/$city['secu2']*3); } // 3 ~ 6%
|
||||
else { $ratio = 6 - Util::round(1.0*$city['secu']/$city['secu2']*3); } // 3 ~ 6%
|
||||
|
||||
if(rand()%100+1 < $ratio) {
|
||||
$disastercity[] = $city['city'];
|
||||
|
||||
+20
-20
@@ -708,7 +708,7 @@ function setGift($tnmt_type, $tnmt, $phase) {
|
||||
$count = MYDB_num_rows($result);
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
$gold = round($gen['bet'] * $bet);
|
||||
$gold = Util::round($gen['bet'] * $bet);
|
||||
//금 지급
|
||||
$query = "update general set gold=gold+'$gold',betwingold=betwingold+'$gold',betwin=betwin+1 where no='{$gen['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -777,8 +777,8 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
elseif($tnmt_type == 3) { $tp = "itl"; $tp2 = "ti"; }
|
||||
else /*$tnmt_type == 0*/{ $tp = "tot"; $tp2 = "tt"; }
|
||||
|
||||
$e1 = $energy1 = round($gen1[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
|
||||
$e2 = $energy2 = round($gen2[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
|
||||
$e1 = $energy1 = Util::round($gen1[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
|
||||
$e2 = $energy2 = Util::round($gen2[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
|
||||
|
||||
//아이템 로그
|
||||
if($gen1['h'] > 6 && ($tnmt_type == 0 || $tnmt_type == 1)) {
|
||||
@@ -837,18 +837,18 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
while($phase < $turn) {
|
||||
$phase++;
|
||||
//평타
|
||||
$damage1 = round($gen2[$tp] * (rand() % 21 + 90) / 130); // 90~110%
|
||||
$damage2 = round($gen1[$tp] * (rand() % 21 + 90) / 130); // 90~110%
|
||||
$damage1 = Util::round($gen2[$tp] * (rand() % 21 + 90) / 130); // 90~110%
|
||||
$damage2 = Util::round($gen1[$tp] * (rand() % 21 + 90) / 130); // 90~110%
|
||||
//보너스타
|
||||
$ratio = rand() % 100;
|
||||
if($gen1[$tp] >= $ratio) { $damage2 += round($gen1[$tp] * (rand() % 41 + 10) / 130); } // 10~50
|
||||
if($gen1[$tp] >= $ratio) { $damage2 += Util::round($gen1[$tp] * (rand() % 41 + 10) / 130); } // 10~50
|
||||
$ratio = rand() % 100;
|
||||
if($gen2[$tp] >= $ratio) { $damage1 += round($gen2[$tp] * (rand() % 41 + 10) / 130); } // 10~50
|
||||
if($gen2[$tp] >= $ratio) { $damage1 += Util::round($gen2[$tp] * (rand() % 41 + 10) / 130); } // 10~50
|
||||
$critical1 = 0; $critical2 = 0;
|
||||
//막판 분노
|
||||
$ratio = rand() % 300;
|
||||
if($e1 / 5 > $energy1 && $damage1 > $damage2 && $gen1[$tp] >= $ratio) {
|
||||
$damage2 *= round((rand() % 301 + 200) / 100); // 200 ~ 500%
|
||||
$damage2 *= Util::round((rand() % 301 + 200) / 100); // 200 ~ 500%
|
||||
$critical1 = 1;
|
||||
if ($tnmt_type == 0) { switch(rand()%2) { case 0: $str = "전력"; break; case 1: $str = "집중"; break; } }
|
||||
elseif($tnmt_type == 1) { switch(rand()%2) { case 0: $str = "봉시진"; break; case 1: $str = "어린진"; break; } }
|
||||
@@ -858,7 +858,7 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
}
|
||||
$ratio = rand() % 300;
|
||||
if($e2 / 5 > $energy2 && $damage2 > $damage1 && $gen2[$tp] >= $ratio) {
|
||||
$damage1 *= round((rand() % 301 + 200) / 100); // 200 ~ 500%
|
||||
$damage1 *= Util::round((rand() % 301 + 200) / 100); // 200 ~ 500%
|
||||
$critical2 = 1;
|
||||
if($tnmt_type == 0) { switch(rand()%2) { case 0: $str = "전력"; break; case 1: $str = "집중"; break; } }
|
||||
elseif($tnmt_type == 1) { switch(rand()%2) { case 0: $str = "봉시진"; break; case 1: $str = "어린진"; break; } }
|
||||
@@ -886,7 +886,7 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
} else {
|
||||
$ratio = rand() % 1000;
|
||||
if($critical1 == 0 && $gen1[$tp] >= $ratio) {
|
||||
$damage2 *= round((rand() % 151 + 150) / 100); // 150 ~ 300%
|
||||
$damage2 *= Util::round((rand() % 151 + 150) / 100); // 150 ~ 300%
|
||||
$critical1 = 1;
|
||||
if ($tnmt_type == 0) { switch(rand()%6) { case 0: $str = "참격"; break; case 1: $str = "집중"; break; case 2: $str = "역공"; break; case 3: $str = "반격"; break; case 4: $str = "선제"; break; case 5: $str = "도발"; break; } }
|
||||
elseif($tnmt_type == 1) { switch(rand()%6) { case 0: $str = "추행진"; break; case 1: $str = "학익진"; break; case 2: $str = "장사진"; break; case 3: $str = "형액진"; break; case 4: $str = "기형진"; break; case 5: $str = "구행진"; break; } }
|
||||
@@ -896,7 +896,7 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
}
|
||||
$ratio = rand() % 1000;
|
||||
if($critical2 == 0 && $gen2[$tp] >= $ratio) {
|
||||
$damage1 *= round((rand() % 151 + 150) / 100); // 150 ~ 300%
|
||||
$damage1 *= Util::round((rand() % 151 + 150) / 100); // 150 ~ 300%
|
||||
$critical2 = 1;
|
||||
if ($tnmt_type == 0) { switch(rand()%6) { case 0: $str = "참격"; break; case 1: $str = "집중"; break; case 2: $str = "역공"; break; case 3: $str = "반격"; break; case 4: $str = "선제"; break; case 5: $str = "도발"; break; } }
|
||||
elseif($tnmt_type == 1) { switch(rand()%6) { case 0: $str = "추행진"; break; case 1: $str = "학익진"; break; case 2: $str = "장사진"; break; case 3: $str = "형액진"; break; case 4: $str = "기형진"; break; case 5: $str = "구행진"; break; } }
|
||||
@@ -915,29 +915,29 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
$r2 = $tEnergy2 / $tDamage2;
|
||||
|
||||
if($r1 > $r2) {
|
||||
$offset = round($tEnergy2*$tDamage1/$tDamage2);
|
||||
$offset = Util::round($tEnergy2*$tDamage1/$tDamage2);
|
||||
$damage1 += $offset; $energy1 -= $offset;
|
||||
$damage2 += $tEnergy2; $energy2 = 0;
|
||||
} else {
|
||||
$offset = round($tEnergy1*$tDamage2/$tDamage1);
|
||||
$offset = Util::round($tEnergy1*$tDamage2/$tDamage1);
|
||||
$damage2 += $offset; $energy2 -= $offset;
|
||||
$damage1 += $tEnergy1; $energy1 = 0;
|
||||
}
|
||||
} elseif($energy1 * $energy2 <= 0) {
|
||||
if($energy2 < 0) {
|
||||
$offset = round($tEnergy2*$tDamage1/$tDamage2);
|
||||
$offset = Util::round($tEnergy2*$tDamage1/$tDamage2);
|
||||
$damage1 += $offset; $energy1 -= $offset;
|
||||
$damage2 += $tEnergy2; $energy2 = 0;
|
||||
}
|
||||
if($energy1 < 0) {
|
||||
$offset = round($tEnergy1*$tDamage2/$tDamage1);
|
||||
$offset = Util::round($tEnergy1*$tDamage2/$tDamage1);
|
||||
$damage2 += $offset; $energy2 -= $offset;
|
||||
$damage1 += $tEnergy1; $energy1 = 0;
|
||||
}
|
||||
}
|
||||
$gd1 += $damage1; $gd2 += $damage2;
|
||||
$energy1 = round($energy1); $energy2 = round($energy2);
|
||||
$damage1 = round($damage1); $damage2 = round($damage2);
|
||||
$energy1 = Util::round($energy1); $energy2 = Util::round($energy2);
|
||||
$damage1 = Util::round($damage1); $damage2 = Util::round($damage2);
|
||||
|
||||
$log[] = '<S>●</> '
|
||||
.StringUtil::padStringAlignRight($phase, 2, "0").'合 : '
|
||||
@@ -950,7 +950,7 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
if($energy1 <= 0 && $energy2 <= 0) {
|
||||
if($type == 0) { $sel = 2; break; }
|
||||
else {
|
||||
$energy1 = round($e1 / 2); $energy2 = round($e2 / 2);
|
||||
$energy1 = Util::round($e1 / 2); $energy2 = Util::round($e2 / 2);
|
||||
$log[] = "<S>●</> <span class='ev_highlight'>재대결</span>!";
|
||||
}
|
||||
}
|
||||
@@ -970,7 +970,7 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
case 0:
|
||||
$log[] = "<S>●</> <Y>{$gen1['name']}</> <S>승리</>!";
|
||||
|
||||
$gl = round(($gd2 - $gd1) / 50);
|
||||
$gl = Util::round(($gd2 - $gd1) / 50);
|
||||
$query = "update tournament set win=win+1,gl=gl+'$gl' where grp='$group' and grp_no='$g1'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update tournament set lose=lose+1,gl=gl-'$gl' where grp='$group' and grp_no='$g2'";
|
||||
@@ -988,7 +988,7 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
case 1:
|
||||
$log[] = "<S>●</> <Y>{$gen2['name']}</> <S>승리</>!";
|
||||
|
||||
$gl = round(($gd1 - $gd2) / 50);
|
||||
$gl = Util::round(($gd1 - $gd2) / 50);
|
||||
$query = "update tournament set win=win+1,gl=gl+'$gl' where grp='$group' and grp_no='$g2'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update tournament set lose=lose+1,gl=gl-'$gl' where grp='$group' and grp_no='$g1'";
|
||||
|
||||
+2
-2
@@ -159,11 +159,11 @@ if ($genius) {
|
||||
$specage2 = $age;
|
||||
$special2 = getSpecial2($leader, $power, $intel);
|
||||
} else {
|
||||
$specage2 = round((80 - $age)/3) + $age;
|
||||
$specage2 = Util::round((80 - $age)/3) + $age;
|
||||
$special2 = 0;
|
||||
}
|
||||
//내특
|
||||
$specage = round((80 - $age)/12) + $age;
|
||||
$specage = Util::round((80 - $age)/12) + $age;
|
||||
$special = 0;
|
||||
|
||||
if ($admin['scenario'] > 0) {
|
||||
|
||||
+53
-53
@@ -195,7 +195,7 @@ function processWar($general, $city) {
|
||||
$avoid = 1;
|
||||
// 병종간 특성
|
||||
if(intdiv($general['crewtype'], 10) == 3) { // 귀병
|
||||
$int = round(getGeneralIntel($general, true, true, true, false));
|
||||
$int = Util::round(getGeneralIntel($general, true, true, true, false));
|
||||
if($general['crewtype'] == 30) {
|
||||
$ratio2 = $int * 5; // 0~500 즉 50%
|
||||
} elseif($general['crewtype'] == 31) {
|
||||
@@ -332,9 +332,9 @@ function processWar($general, $city) {
|
||||
$myCrew = 0;
|
||||
}
|
||||
|
||||
$general['crew'] -= round($myCrew);
|
||||
$city['def'] -= round($cityCrew);
|
||||
$city['wall'] -= round($cityCrew);
|
||||
$general['crew'] -= Util::round($myCrew);
|
||||
$city['def'] -= Util::round($cityCrew);
|
||||
$city['wall'] -= Util::round($cityCrew);
|
||||
|
||||
$tempMyCrew = $myCrew; $tempCityCrew = $cityCrew;
|
||||
$tempGeneralCrew = $general['crew']; $tempCityDef = $city['def'];
|
||||
@@ -346,13 +346,13 @@ function processWar($general, $city) {
|
||||
$r2 = $tempCityDef / $tempCityCrew;
|
||||
|
||||
if($r1 > $r2) {
|
||||
$offset = round($tempCityDef*$tempMyCrew/$tempCityCrew);
|
||||
$offset = Util::round($tempCityDef*$tempMyCrew/$tempCityCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$cityCrew += $tempCityDef;
|
||||
$city['def'] = 0;
|
||||
} else {
|
||||
$offset = round($tempGeneralCrew*$tempCityCrew/$tempMyCrew);
|
||||
$offset = Util::round($tempGeneralCrew*$tempCityCrew/$tempMyCrew);
|
||||
$cityCrew += $offset;
|
||||
$city['def'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
@@ -360,14 +360,14 @@ function processWar($general, $city) {
|
||||
}
|
||||
} elseif($general['crew'] * $city['def'] <= 0) {
|
||||
if($city['def'] < 0) {
|
||||
$offset = round($tempCityDef*$tempMyCrew/$tempCityCrew);
|
||||
$offset = Util::round($tempCityDef*$tempMyCrew/$tempCityCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$cityCrew += $tempCityDef;
|
||||
$city['def'] = 0;
|
||||
}
|
||||
if($general['crew'] < 0) {
|
||||
$offset = round($tempGeneralCrew*$tempCityCrew/$tempMyCrew);
|
||||
$offset = Util::round($tempGeneralCrew*$tempCityCrew/$tempMyCrew);
|
||||
$cityCrew += $offset;
|
||||
$city['def'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
@@ -377,15 +377,15 @@ function processWar($general, $city) {
|
||||
|
||||
$exp += $cityCrew;
|
||||
$opexp += $myCrew;
|
||||
$general['crew'] = round($general['crew']);
|
||||
$cityCrew = round($cityCrew);
|
||||
$myCrew = round($myCrew);
|
||||
$general['crew'] = Util::round($general['crew']);
|
||||
$cityCrew = Util::round($cityCrew);
|
||||
$myCrew = Util::round($myCrew);
|
||||
$batlog[] = "<C>●</> $phase : <Y1>【{$general['name']}】</> <C>{$general['crew']} (-$myCrew)</> VS <C>{$city['def']} (-$cityCrew)</> <Y1>【{$city['name']}】</>";
|
||||
|
||||
$mykillnum += $cityCrew; $mydeathnum += $myCrew;
|
||||
|
||||
// 중간 쌀 체크
|
||||
$myRice = round($exp / 50);
|
||||
$myRice = Util::round($exp / 50);
|
||||
// 성격 보정
|
||||
$myRice = CharExperience($myRice, $general['personal']);
|
||||
// 쌀 소모
|
||||
@@ -393,7 +393,7 @@ function processWar($general, $city) {
|
||||
// 결과 쌀
|
||||
$myRice = $general['rice'] - $myRice;
|
||||
|
||||
if($myRice <= round($general['crew']/100)) { break; }
|
||||
if($myRice <= Util::round($general['crew']/100)) { break; }
|
||||
|
||||
if($city['def'] <= 0) { break; }
|
||||
if($general['crew'] <= 0) { break; }
|
||||
@@ -428,8 +428,8 @@ function processWar($general, $city) {
|
||||
$deadAmount['def'] = $deadAmount['def'] + $mykillnum;
|
||||
|
||||
// 도시쌀 소모 계산
|
||||
$opexp = intval(round($opexp / 50 * 0.8));
|
||||
$rice = intval(round($opexp * 5 * getCrewtypeRice($game, 0, 0) * ($game['city_rate']/100 - 0.2)));
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
$rice = Util::round($opexp * 5 * getCrewtypeRice($game, 0, 0) * ($game['city_rate']/100 - 0.2));
|
||||
$destnation['rice'] -= $rice;
|
||||
if($destnation['rice'] < 0) { $destnation['rice'] = 0; }
|
||||
$query = "update nation set rice='{$destnation['rice']}' where nation='{$destnation['nation']}'";
|
||||
@@ -438,10 +438,10 @@ function processWar($general, $city) {
|
||||
pushAdminLog(["성벽 쌀 소모 : $rice"]);
|
||||
|
||||
//원래대로 스케일링
|
||||
$city['def'] = intval(round($city['def'] / 10));
|
||||
$city['wall'] = intval(round($city['wall'] / 10));
|
||||
$city['def'] = Util::round($city['def'] / 10);
|
||||
$city['wall'] = Util::round($city['wall'] / 10);
|
||||
//내정 감소
|
||||
$dec = round($cityCrew / 10);
|
||||
$dec = Util::round($cityCrew / 10);
|
||||
$city['agri'] -= $dec;
|
||||
$city['comm'] -= $dec;
|
||||
$city['secu'] -= $dec;
|
||||
@@ -455,7 +455,7 @@ function processWar($general, $city) {
|
||||
addGenDex($general['no'], $general['crewtype'], $mykillnum);
|
||||
addGenDex($general['no'], 40, $mydeathnum);
|
||||
// 죽은수 기술로 누적
|
||||
$num = intval(round($mydeathnum * 0.01));
|
||||
$num = Util::round($mydeathnum * 0.01);
|
||||
// 국가보정
|
||||
if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; }
|
||||
if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; }
|
||||
@@ -464,7 +464,7 @@ function processWar($general, $city) {
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 죽은수 기술로 누적
|
||||
$num = round($mykillnum * 0.01);
|
||||
$num = Util::round($mykillnum * 0.01);
|
||||
// 국가보정
|
||||
if($destnation['type'] == 3 || $destnation['type'] == 13) { $num *= 1.1; }
|
||||
if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) { $num *= 0.9; }
|
||||
@@ -476,14 +476,14 @@ function processWar($general, $city) {
|
||||
//$techRatio = (getTechCost($nation['tech']) + getTechCost($destnation['tech'])) / 2;
|
||||
$techRatio = 1.0;
|
||||
// 죽은수 도시 재정으로 누적 60%
|
||||
$num = round(($mykillnum+$mydeathnum) * 0.6 * $techRatio);
|
||||
$num = Util::round(($mykillnum+$mydeathnum) * 0.6 * $techRatio);
|
||||
// 국가보정
|
||||
if($destnation['type'] == 1) { $num *= 1.1; }
|
||||
if($destnation['type'] == 9 || $destnation['type'] == 10) { $num *= 0.9; }
|
||||
$query = "update city set dead=dead+'$num',def='{$city['def']}',wall='{$city['wall']}',agri='{$city['agri']}',comm='{$city['comm']}',secu='{$city['secu']}' where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 죽은수 도시 재정으로 누적 40%
|
||||
$num = round(($mykillnum+$mydeathnum) * 0.4 * $techRatio);
|
||||
$num = Util::round(($mykillnum+$mydeathnum) * 0.4 * $techRatio);
|
||||
// 국가보정
|
||||
if($nation['type'] == 1) { $num *= 1.1; }
|
||||
if($nation['type'] == 9 || $nation['type'] == 10) { $num *= 0.9; }
|
||||
@@ -519,7 +519,7 @@ function processWar($general, $city) {
|
||||
$query = "update general set deathnum=deathnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
} elseif($myRice <= round($general['crew']/100)) {
|
||||
} elseif($myRice <= Util::round($general['crew']/100)) {
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$log[] = "<C>●</>군량 부족으로 퇴각합니다.";
|
||||
|
||||
@@ -670,7 +670,7 @@ function processWar($general, $city) {
|
||||
$opAvoid = 1;
|
||||
// 병종간 특성
|
||||
if(intdiv($general['crewtype'], 10) == 3) { // 귀병
|
||||
$int = round(getGeneralIntel($general, true, true, true, false));
|
||||
$int = Util::round(getGeneralIntel($general, true, true, true, false));
|
||||
if($general['crewtype'] == 30) {
|
||||
$ratio2 = $int * 5; // 0~500 즉 50%
|
||||
} elseif($general['crewtype'] == 31) {
|
||||
@@ -811,7 +811,7 @@ function processWar($general, $city) {
|
||||
|
||||
// 상대 장수 병종간 특성
|
||||
if(intdiv($oppose['crewtype'], 10) == 3) { // 귀병
|
||||
$int = round(getGeneralIntel($oppose, true, true, true, false));
|
||||
$int = Util::round(getGeneralIntel($oppose, true, true, true, false));
|
||||
if($oppose['crewtype'] == 30) {
|
||||
$ratio2 = $int * 5; // 0~500 즉 50%
|
||||
} elseif($oppose['crewtype'] == 31) {
|
||||
@@ -1200,8 +1200,8 @@ function processWar($general, $city) {
|
||||
$opCrew = 0;
|
||||
}
|
||||
|
||||
$general['crew'] -= round($myCrew);
|
||||
$oppose['crew'] -= round($opCrew);
|
||||
$general['crew'] -= Util::round($myCrew);
|
||||
$oppose['crew'] -= Util::round($opCrew);
|
||||
$tempMyCrew = $myCrew; $tempOpCrew = $opCrew;
|
||||
$tempGeneralCrew = $general['crew']; $tempOpposeCrew = $oppose['crew'];
|
||||
if($general['crew'] <= 0 && $oppose['crew'] <= 0) {
|
||||
@@ -1209,13 +1209,13 @@ function processWar($general, $city) {
|
||||
$r2 = $tempOpposeCrew / $tempOpCrew;
|
||||
|
||||
if($r1 > $r2) {
|
||||
$offset = round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$offset = Util::round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$opCrew += $tempOpposeCrew;
|
||||
$oppose['crew'] = 0;
|
||||
} else {
|
||||
$offset = round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$offset = Util::round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$opCrew += $offset;
|
||||
$oppose['crew'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
@@ -1223,14 +1223,14 @@ function processWar($general, $city) {
|
||||
}
|
||||
} elseif($general['crew'] * $oppose['crew'] <= 0) {
|
||||
if($oppose['crew'] < 0) {
|
||||
$offset = round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$offset = Util::round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$opCrew += $tempOpposeCrew;
|
||||
$oppose['crew'] = 0;
|
||||
}
|
||||
if($general['crew'] < 0) {
|
||||
$offset = round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$offset = Util::round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$opCrew += $offset;
|
||||
$oppose['crew'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
@@ -1240,10 +1240,10 @@ function processWar($general, $city) {
|
||||
|
||||
$exp += $opCrew;
|
||||
$opexp += $myCrew;
|
||||
$general['crew'] = round($general['crew']);
|
||||
$oppose['crew'] = round($oppose['crew']);
|
||||
$myCrew = round($myCrew);
|
||||
$opCrew = round($opCrew);
|
||||
$general['crew'] = Util::round($general['crew']);
|
||||
$oppose['crew'] = Util::round($oppose['crew']);
|
||||
$myCrew = Util::round($myCrew);
|
||||
$opCrew = Util::round($opCrew);
|
||||
$batlog[] = "<C>●</> $phase : <Y1>【{$general['name']}】</> <C>{$general['crew']} (-$myCrew)</> VS <C>{$oppose['crew']} (-$opCrew)</> <Y1>【{$oppose['name']}】</>";
|
||||
$oppbatlog[] = "<C>●</> $phase : <Y1>【{$oppose['name']}】</> <C>{$oppose['crew']} (-$opCrew)</> VS <C>{$general['crew']} (-$myCrew)</> <Y1>【{$general['name']}】</>";
|
||||
|
||||
@@ -1251,7 +1251,7 @@ function processWar($general, $city) {
|
||||
$opkillnum += $myCrew; $opdeathnum += $opCrew;
|
||||
|
||||
// 중간 쌀 체크
|
||||
$myRice = round($exp / 50);
|
||||
$myRice = Util::round($exp / 50);
|
||||
// 성격 보정
|
||||
$myRice = CharExperience($myRice, $general['personal']);
|
||||
// 쌀 소모
|
||||
@@ -1260,7 +1260,7 @@ function processWar($general, $city) {
|
||||
$myRice = $general['rice'] - $myRice;
|
||||
|
||||
// 중간 쌀 체크
|
||||
$opRice = round($opexp / 50 * 0.8);
|
||||
$opRice = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opRice = CharExperience($opRice, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
@@ -1268,8 +1268,8 @@ function processWar($general, $city) {
|
||||
// 결과 쌀
|
||||
$opRice = $oppose['rice'] - $opRice;
|
||||
|
||||
if($opRice <= round($oppose['crew']/100)) { break; }
|
||||
if($myRice <= round($general['crew']/100)) { break; }
|
||||
if($opRice <= Util::round($oppose['crew']/100)) { break; }
|
||||
if($myRice <= Util::round($general['crew']/100)) { break; }
|
||||
|
||||
if($oppose['crew'] <= 0) { break; }
|
||||
if($general['crew'] <= 0) { break; }
|
||||
@@ -1330,7 +1330,7 @@ function processWar($general, $city) {
|
||||
addGenDex($oppose['no'], $oppose['crewtype'], $opkillnum * 0.9);
|
||||
addGenDex($oppose['no'], $general['crewtype'], $opdeathnum * 0.9);
|
||||
// 죽은수 기술로 누적
|
||||
$num = round($mydeathnum * 0.01);
|
||||
$num = Util::round($mydeathnum * 0.01);
|
||||
// 국가보정
|
||||
if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; }
|
||||
if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; }
|
||||
@@ -1353,7 +1353,7 @@ function processWar($general, $city) {
|
||||
addGenDex($general['no'], $general['crewtype'], $mykillnum);
|
||||
addGenDex($general['no'], $oppose['crewtype'], $mydeathnum);
|
||||
// 죽은수 기술로 누적
|
||||
$num = round($opdeathnum * 0.01);
|
||||
$num = Util::round($opdeathnum * 0.01);
|
||||
// 국가보정
|
||||
if($destnation['type'] == 3 || $destnation['type'] == 13) { $num *= 1.1; }
|
||||
if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) { $num *= 0.9; }
|
||||
@@ -1365,14 +1365,14 @@ function processWar($general, $city) {
|
||||
//$techRatio = (getTechCost($nation['tech']) + getTechCost($destnation['tech'])) / 2;
|
||||
$techRatio = 1.0;
|
||||
// 죽은수 도시 재정으로 누적 60%
|
||||
$num = round(($mykillnum+$mydeathnum) * 0.6 * $techRatio);
|
||||
$num = Util::round(($mykillnum+$mydeathnum) * 0.6 * $techRatio);
|
||||
// 국가보정
|
||||
if($destnation['type'] == 1) { $num *= 1.1; }
|
||||
if($destnation['type'] == 9 || $destnation['type'] == 10) { $num *= 0.9; }
|
||||
$query = "update city set dead=dead+'$num' where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 죽은수 도시 재정으로 누적 40%
|
||||
$num = round(($mykillnum+$mydeathnum) * 0.4 * $techRatio);
|
||||
$num = Util::round(($mykillnum+$mydeathnum) * 0.4 * $techRatio);
|
||||
// 국가보정
|
||||
if($nation['type'] == 1) { $num *= 1.1; }
|
||||
if($nation['type'] == 9 || $nation['type'] == 10) { $num *= 0.9; }
|
||||
@@ -1380,8 +1380,8 @@ function processWar($general, $city) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 상대 병사 소진이나 쌀 소진시 다음 장수
|
||||
if($oppose['crew'] <= 0 || ($opRice <= round($oppose['crew']/100) && $general['crew'] > 0)) {
|
||||
if($opRice <= round($oppose['crew']/100)) {
|
||||
if($oppose['crew'] <= 0 || ($opRice <= Util::round($oppose['crew']/100) && $general['crew'] > 0)) {
|
||||
if($opRice <= Util::round($oppose['crew']/100)) {
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 패퇴했습니다.";
|
||||
$log[] = "<C>●</><Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 패퇴했습니다.";
|
||||
$opplog[] = "<C>●</>군량 부족으로 패퇴합니다.";
|
||||
@@ -1400,7 +1400,7 @@ function processWar($general, $city) {
|
||||
|
||||
$exp2++;
|
||||
// 상대장수 경험 등등 증가
|
||||
$opexp = round($opexp / 50 * 0.8);
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
@@ -1418,8 +1418,8 @@ function processWar($general, $city) {
|
||||
unset($oppbatlog);
|
||||
unset($oppbatres);
|
||||
// 공격 장수 병사 소진이나 쌀 소진시 실패 처리
|
||||
} elseif($general['crew'] <= 0 || $myRice <= round($general['crew']/100)) {
|
||||
if($myRice <= round($general['crew']/100)) {
|
||||
} elseif($general['crew'] <= 0 || $myRice <= Util::round($general['crew']/100)) {
|
||||
if($myRice <= Util::round($general['crew']/100)) {
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$log[] = "<C>●</>군량 부족으로 퇴각합니다.";
|
||||
$opplog[] = "<C>●</><Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
@@ -1442,7 +1442,7 @@ function processWar($general, $city) {
|
||||
if($oppose['atmos'] > $_maximumatmos) { $oppose['atmos'] = $_maximumatmos; }
|
||||
|
||||
// 상대장수 경험 등등 증가
|
||||
$opexp = round($opexp / 50 * 0.8);
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
@@ -1478,7 +1478,7 @@ function processWar($general, $city) {
|
||||
}
|
||||
|
||||
// 상대장수 경험 등등 증가(페이즈 초과시)
|
||||
$opexp = round($opexp / 50 * 0.8);
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
@@ -1500,7 +1500,7 @@ function processWar($general, $city) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 공헌, 명성 상승
|
||||
$exp = round($exp / 50);
|
||||
$exp = Util::round($exp / 50);
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
// 쌀 소모
|
||||
@@ -1539,7 +1539,7 @@ function CriticalRatio2($leader, $power, $intel) {
|
||||
}
|
||||
|
||||
function CriticalScore2($score) {
|
||||
$score = round($score * (rand()%8 + 13)/10); // 1.3~2.0
|
||||
$score = Util::round($score * (rand()%8 + 13)/10); // 1.3~2.0
|
||||
return $score;
|
||||
}
|
||||
|
||||
@@ -1633,7 +1633,7 @@ function addConflict($city, $nationnum, $mykillnum) {
|
||||
|
||||
$nationlist[$i] = $nationnum;
|
||||
if($i == 0 || $city['def'] == 0) { // 선타, 막타 보너스
|
||||
$killnum[$i] += round($mykillnum * 1.05);
|
||||
$killnum[$i] += Util::round($mykillnum * 1.05);
|
||||
} else {
|
||||
$killnum[$i] += $mykillnum;
|
||||
}
|
||||
|
||||
+1
-1
@@ -270,7 +270,7 @@ function command_11($turn, $command) {
|
||||
}
|
||||
|
||||
$leader = intdiv($me['leader'] * (100 - $me['injury']), 100) + getHorseEff($me['horse']) + $lbonus;
|
||||
$crew = $leader - round($me['crew']/100);
|
||||
$crew = $leader - Util::round($me['crew']/100);
|
||||
$abil = getTechAbil($nation['tech']);
|
||||
$cost = getTechCost($nation['tech']);
|
||||
echo "
|
||||
|
||||
@@ -74,7 +74,7 @@ class ChangeCity extends \sammo\Event\Action{
|
||||
|
||||
$matches = null;
|
||||
if(preg_match(self::REGEXP_PERCENT, $value, $matches)){
|
||||
$value = (int)round((float)$matches[1], 0);
|
||||
$value = Util::round((float)$matches[1]);
|
||||
return DB::db()->sqleval('%i', Util::valueFit($value, 0, 100));
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class ChangeCity extends \sammo\Event\Action{
|
||||
|
||||
$matches = null;
|
||||
if(preg_match(self::REGEXP_PERCENT, $value, $matches)){
|
||||
$value = (int)round((float)$matches[1], 0);
|
||||
$value = Util::round((float)$matches[1]);
|
||||
return DB::db()->sqleval('ROUND(%b * %d, 0)', $keyMax, $value/100);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user