Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac6e1d2525 | ||
|
|
610b74d3a5 | ||
|
|
7f295aaacf | ||
|
|
a47669ff75 | ||
|
|
9f84eb8d4d | ||
|
|
5f36143b44 | ||
|
|
2d491dd393 | ||
|
|
63845afdc3 | ||
|
|
3cfcfff786 | ||
|
|
9f801df5dc | ||
|
|
21b8c6ea8f | ||
|
|
0807f9912c | ||
|
|
90a71ba75d | ||
|
|
2e26244992 | ||
|
|
8f1e713451 | ||
|
|
b7b5c7b0da | ||
|
|
cb42813597 | ||
|
|
91c46f465b | ||
|
|
435044dddd | ||
|
|
cccf9968e7 | ||
|
|
f1e4185193 | ||
|
|
dc538af7ba | ||
|
|
574ca07afe | ||
|
|
f18b2ed1a5 | ||
|
|
bc568e2083 | ||
|
|
bffdf9d190 | ||
|
|
e7af4563a2 | ||
|
|
5fc5adb14d | ||
|
|
f3ccf5e633 | ||
|
|
46cacc4a7d | ||
|
|
ac8edcee32 | ||
|
|
919c44c727 | ||
|
|
95921ae727 | ||
|
|
134f043e9c | ||
|
|
a7a14a66a6 | ||
|
|
148d92164a | ||
|
|
5ea1b0bce4 | ||
|
|
65aefadcdc | ||
|
|
1bc324fb9f | ||
|
|
28953ae1d9 | ||
|
|
3760e244a9 | ||
|
|
e86d755b69 | ||
|
|
6f560a1b34 | ||
|
|
6fe573ef7b | ||
|
|
2a7baf020f | ||
|
|
2e1815783a | ||
|
|
bab86c9f0b | ||
|
|
2716e9af39 | ||
|
|
9a303c4510 | ||
|
|
e547971a6f | ||
|
|
e9108ead86 | ||
|
|
6bbcb25138 | ||
|
|
98462ca34d | ||
|
|
7939dd0b44 | ||
|
|
3d966ec076 | ||
|
|
6afedb35df | ||
|
|
cdac63e05a | ||
|
|
8040cc28c4 | ||
|
|
264db40bdc | ||
|
|
2da1957c28 | ||
|
|
2297fa9c13 | ||
|
|
8175e76a77 | ||
|
|
2709dde8fa | ||
|
|
7c518efba8 | ||
|
|
b5fa2aef91 | ||
|
|
d2f6c34e85 | ||
|
|
cd1ccfadaf | ||
|
|
8ff6bff252 | ||
|
|
52f6cb2f30 | ||
|
|
e7af718a0f | ||
|
|
d211c92bf8 | ||
|
|
4acc988cfe | ||
|
|
270f236f95 | ||
|
|
2da12bb71f | ||
|
|
b479add03d | ||
|
|
ca9db6dc18 | ||
|
|
12c7c7b4ed | ||
|
|
e12c0e51c8 | ||
|
|
6683c70195 | ||
|
|
aef1cbd201 | ||
|
|
06786aff28 | ||
|
|
55439c268f | ||
|
|
3e4cf764c8 | ||
|
|
4e359f5eb9 | ||
|
|
2ff3746df2 | ||
|
|
62982d7ffb | ||
|
|
ec49cdb6ad | ||
|
|
4b64827f20 | ||
|
|
944c4cb564 | ||
|
|
db19655b60 | ||
|
|
1975f11338 | ||
|
|
59515d5276 | ||
|
|
fea9529bc8 |
@@ -1,6 +1,6 @@
|
|||||||
The MIT License
|
The MIT License
|
||||||
|
|
||||||
Copyright (c) 2021 Hide_D, 62che
|
Copyright (c) 2022 Hide_D, 62che
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+2
-1
@@ -29,7 +29,8 @@
|
|||||||
"erusev/parsedown-extra": "^0.8.1",
|
"erusev/parsedown-extra": "^0.8.1",
|
||||||
"nette/caching": "^3.0",
|
"nette/caching": "^3.0",
|
||||||
"illuminate/database": "^8.61",
|
"illuminate/database": "^8.61",
|
||||||
"illuminate/events": "^8.61"
|
"illuminate/events": "^8.61",
|
||||||
|
"spatie/data-transfer-object": "^3.7"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
Generated
+64
-1
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "94cfbcb22b9f475e421ad5009391006f",
|
"content-hash": "1983b89436fd8017db508592ddf542e4",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brandonwamboldt/utilphp",
|
"name": "brandonwamboldt/utilphp",
|
||||||
@@ -2636,6 +2636,69 @@
|
|||||||
},
|
},
|
||||||
"time": "2021-06-29T04:31:23+00:00"
|
"time": "2021-06-29T04:31:23+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "spatie/data-transfer-object",
|
||||||
|
"version": "3.7.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/spatie/data-transfer-object.git",
|
||||||
|
"reference": "341f72c77e0fce40ea2e0dcb212cb54dc27bbe72"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/spatie/data-transfer-object/zipball/341f72c77e0fce40ea2e0dcb212cb54dc27bbe72",
|
||||||
|
"reference": "341f72c77e0fce40ea2e0dcb212cb54dc27bbe72",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"illuminate/collections": "^8.36",
|
||||||
|
"jetbrains/phpstorm-attributes": "^1.0",
|
||||||
|
"larapack/dd": "^1.1",
|
||||||
|
"phpunit/phpunit": "^9.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Spatie\\DataTransferObject\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Brent Roose",
|
||||||
|
"email": "brent@spatie.be",
|
||||||
|
"homepage": "https://spatie.be",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Data transfer objects with batteries included",
|
||||||
|
"homepage": "https://github.com/spatie/data-transfer-object",
|
||||||
|
"keywords": [
|
||||||
|
"data-transfer-object",
|
||||||
|
"spatie"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/spatie/data-transfer-object/issues",
|
||||||
|
"source": "https://github.com/spatie/data-transfer-object/tree/3.7.3"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://spatie.be/open-source/support-us",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/spatie",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-12-30T20:31:10+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v5.3.10",
|
"version": "v5.3.10",
|
||||||
|
|||||||
+4
-4
@@ -59,10 +59,10 @@ $db = DB::db();
|
|||||||
if ($general['block'] > 0) {
|
if ($general['block'] > 0) {
|
||||||
$style .= "background-color:red;";
|
$style .= "background-color:red;";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
|
||||||
$style .= "color:cyan;";
|
$npcColor = getNPCColor($general['npc']);
|
||||||
} elseif ($general['npc'] == 1) {
|
if($npcColor !== null){
|
||||||
$style .= "color:skyblue;";
|
$style .= "color:{$npcColor};";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
|
|||||||
+4
-7
@@ -70,13 +70,10 @@ function colorBlockedName($general)
|
|||||||
if ($general['block'] > 0) {
|
if ($general['block'] > 0) {
|
||||||
$style .= "background-color:red;";
|
$style .= "background-color:red;";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
|
||||||
$style .= "color:cyan;";
|
$npcColor = getNPCColor($general['npc']);
|
||||||
} elseif ($general['npc'] == 1) {
|
if($npcColor !== null){
|
||||||
$style .= "color:skyblue;";
|
$style .= "color:{$npcColor};";
|
||||||
}
|
|
||||||
if ($general['con'] > $conlimit) {
|
|
||||||
$style .= "color:red;";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
|
|||||||
+1
-7
@@ -155,13 +155,7 @@ if ($gameStor->isunited) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($general['npc'] >= 2) {
|
$name = formatName($general['name'], $general['npc']);
|
||||||
$name = "<font color=cyan>{$general['name']}</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$name = "<font color=skyblue>{$general['name']}</font>";
|
|
||||||
} else {
|
|
||||||
$name = "{$general['name']}";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key_exists($general['owner'], $ownerNameList)) {
|
if (key_exists($general['owner'], $ownerNameList)) {
|
||||||
$name = $name . '<br><small>(' . $ownerNameList[$general['owner']] . ')</small>';
|
$name = $name . '<br><small>(' . $ownerNameList[$general['owner']] . ')</small>';
|
||||||
|
|||||||
+43
-29
@@ -5,7 +5,7 @@ namespace sammo;
|
|||||||
include "lib.php";
|
include "lib.php";
|
||||||
include "func.php";
|
include "func.php";
|
||||||
$btn = Util::getReq('btn');
|
$btn = Util::getReq('btn');
|
||||||
$yearmonth = Util::getReq('yearmonth', 'int');
|
$yearMonth = Util::getReq('yearmonth', 'int');
|
||||||
$serverID = Util::getReq('serverID', 'string', null);
|
$serverID = Util::getReq('serverID', 'string', null);
|
||||||
|
|
||||||
//로그인 검사
|
//로그인 검사
|
||||||
@@ -36,7 +36,7 @@ if ($con >= 2) {
|
|||||||
|
|
||||||
|
|
||||||
[$s_year, $s_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID);
|
[$s_year, $s_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID);
|
||||||
$s = $s_year * 12 + $s_month;
|
$s = Util::joinYearMonth($s_year, $s_month);
|
||||||
|
|
||||||
if ($s_year === null) {
|
if ($s_year === null) {
|
||||||
echo '인자 에러';
|
echo '인자 에러';
|
||||||
@@ -44,7 +44,7 @@ if ($s_year === null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[$e_year, $e_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID);
|
[$e_year, $e_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID);
|
||||||
$e = $e_year * 12 + $e_month;
|
$e = Util::joinYearMonth($e_year, $e_month);
|
||||||
|
|
||||||
if ($serverID !== UniqueConst::$serverID) {
|
if ($serverID !== UniqueConst::$serverID) {
|
||||||
$mapTheme = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID) ?: 'che';
|
$mapTheme = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID) ?: 'che';
|
||||||
@@ -53,42 +53,47 @@ if ($serverID !== UniqueConst::$serverID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요.
|
//FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요.
|
||||||
if ($serverID !== UniqueConst::$serverID && !$yearmonth) {
|
if ($serverID !== UniqueConst::$serverID && !$yearMonth) {
|
||||||
$year = $s_year;
|
$yearMonth = $s;
|
||||||
$month = $s_month;
|
} else if (!$yearMonth) {
|
||||||
} else if (!$yearmonth) {
|
$yearMonth = Util::joinYearMonth($admin['year'], $admin['month']);
|
||||||
$year = $admin['year'];
|
|
||||||
$month = $admin['month'] - 1;
|
|
||||||
} else {
|
} else {
|
||||||
$year = intdiv($yearmonth, 100);
|
|
||||||
$month = $yearmonth % 100;
|
|
||||||
|
|
||||||
if ($btn == "◀◀ 이전달") {
|
if ($btn == "◀◀ 이전달") {
|
||||||
$month -= 1;
|
$yearMonth -= 1;
|
||||||
} elseif ($btn == "다음달 ▶▶") {
|
} elseif ($btn == "다음달 ▶▶") {
|
||||||
$month += 1;
|
$yearMonth += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$now = ($year * 12) + $month;
|
|
||||||
|
|
||||||
if ($now < $s) {
|
$isCurrent = false;
|
||||||
$now = $s;
|
if ($yearMonth < $s) {
|
||||||
|
$yearMonth = $s;
|
||||||
}
|
}
|
||||||
if ($now > $e) {
|
if ($yearMonth > $e) {
|
||||||
$now = $e;
|
$isCurrent = true;
|
||||||
|
$yearMonth = $e + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$year = intdiv($now, 12);
|
[$year, $month] = Util::parseYearMonth($yearMonth);
|
||||||
$month = $now % 12;
|
|
||||||
if ($month <= 0) {
|
function getHistory($serverID, $year, $month):array{
|
||||||
$year -= 1;
|
$db = DB::db();
|
||||||
$month += 12;
|
$history = $db->queryFirstRow('SELECT * FROM ng_history WHERE server_id = %s AND year = %i AND month = %i', $serverID, $year, $month);
|
||||||
|
$history['global_history'] = Json::decode($history['global_history']);
|
||||||
|
$history['global_action'] = Json::decode($history['global_action']);
|
||||||
|
$history['nations'] = Json::decode($history['nations']);
|
||||||
|
return $history;
|
||||||
}
|
}
|
||||||
|
|
||||||
$history = $db->queryFirstRow('SELECT * FROM ng_history WHERE server_id = %s AND year = %i AND month = %i', $serverID, $year, $month);
|
|
||||||
|
|
||||||
|
if($isCurrent){
|
||||||
|
$history = getCurrentHistory();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$history = getHistory($serverID, $year, $month);
|
||||||
|
}
|
||||||
|
|
||||||
$nations = Json::decode($history['nations']);
|
$nations = $history['nations'];
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@@ -129,7 +134,7 @@ $nations = Json::decode($history['nations']);
|
|||||||
<input type=submit name=btn value="◀◀ 이전달">
|
<input type=submit name=btn value="◀◀ 이전달">
|
||||||
<select id='yearmonth' name=yearmonth size=1>
|
<select id='yearmonth' name=yearmonth size=1>
|
||||||
<option selected='selected'><?= $year ?>년 <?= $month ?>월</option>
|
<option selected='selected'><?= $year ?>년 <?= $month ?>월</option>
|
||||||
<option><?= $e_year ?>년 12월</option>
|
<option><?= $e_year ?>년 12월 (현재)</option>
|
||||||
</select>
|
</select>
|
||||||
<input type=submit name=btn value='조회하기'>
|
<input type=submit name=btn value='조회하기'>
|
||||||
<input type=submit name=btn value="다음달 ▶▶">
|
<input type=submit name=btn value="다음달 ▶▶">
|
||||||
@@ -177,7 +182,7 @@ $nations = Json::decode($history['nations']);
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=5 valign=top>
|
<td colspan=5 valign=top>
|
||||||
<?= formatHistoryToHTML(Json::decode($history['global_history'])) ?>
|
<?= formatHistoryToHTML($history['global_history']) ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -185,7 +190,7 @@ $nations = Json::decode($history['nations']);
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=5 valign=top>
|
<td colspan=5 valign=top>
|
||||||
<?= formatHistoryToHTML(Json::decode($history['global_action'])) ?>
|
<?= formatHistoryToHTML($history['global_action']) ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -201,6 +206,13 @@ $nations = Json::decode($history['nations']);
|
|||||||
<script>
|
<script>
|
||||||
window.serverNick = '<?= DB::prefix() ?>';
|
window.serverNick = '<?= DB::prefix() ?>';
|
||||||
window.serverID = '<?= UniqueConst::$serverID ?>';
|
window.serverID = '<?= UniqueConst::$serverID ?>';
|
||||||
|
<?php if($isCurrent): ?>
|
||||||
|
reloadWorldMap({
|
||||||
|
showMe: false,
|
||||||
|
neutralView: true,
|
||||||
|
useCachedMap: true,
|
||||||
|
});
|
||||||
|
<?php else: ?>
|
||||||
reloadWorldMap({
|
reloadWorldMap({
|
||||||
targetJson: 'j_map_history.php?year=<?= $year ?>&month=<?= $month ?>&serverID=<?= $serverID ?>',
|
targetJson: 'j_map_history.php?year=<?= $year ?>&month=<?= $month ?>&serverID=<?= $serverID ?>',
|
||||||
showMe: false,
|
showMe: false,
|
||||||
@@ -209,6 +221,8 @@ $nations = Json::decode($history['nations']);
|
|||||||
year: <?= $year ?>,
|
year: <?= $year ?>,
|
||||||
month: <?= $month ?>,
|
month: <?= $month ?>,
|
||||||
});
|
});
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ $userID = Session::getUserID();
|
|||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
$gameStor->cacheValues(['killturn', 'autorun_user', 'turnterm']);
|
||||||
increaseRefresh("세력일람", 2);
|
increaseRefresh("세력일람", 2);
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner=%i', $userID);
|
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner=%i', $userID);
|
||||||
@@ -33,6 +33,7 @@ if ($con >= 2) {
|
|||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
<?= WebUtil::printDist('ts', ['common', 'extKingdoms']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'extKingdoms']) ?>
|
||||||
|
<?= WebUtil::printStaticValues($gameStor->getValues(['killturn', 'autorun_user', 'turnterm'])) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -144,13 +145,7 @@ if ($con >= 2) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan=8> 장수 일람 : ";
|
<td colspan=8> 장수 일람 : ";
|
||||||
foreach ($generals as $general) {
|
foreach ($generals as $general) {
|
||||||
if ($general['npc'] >= 2) {
|
echo formatName($general['name'], $general['npc']).', ';
|
||||||
echo "<font color=cyan>{$general['name']}</font>, ";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
echo "<font color=skyblue>{$general['name']}</font>, ";
|
|
||||||
} else {
|
|
||||||
echo "{$general['name']}, ";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
//로그인 검사
|
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
|
|
||||||
increaseRefresh("세력도", 2);
|
|
||||||
TurnExecutionHelper::executeAllCommand();
|
|
||||||
|
|
||||||
$mapTheme = $gameStor->map_theme ?? 'che';
|
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT con,turntime from general where owner=%i', $userID);
|
|
||||||
|
|
||||||
$con = checkLimit($me['con']);
|
|
||||||
if ($con >= 2) {
|
|
||||||
printLimitMsg($me['turntime']);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=1024" />
|
|
||||||
<title><?= UniqueConst::$serverName ?>: 세력도</title>
|
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
|
||||||
<?= WebUtil::printCSS('css/normalize.css') ?>
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
|
||||||
<?= WebUtil::printCSS('css/map.css') ?>
|
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
|
||||||
<?= WebUtil::printJS('d_shared/base_map.js') ?>
|
|
||||||
<?= WebUtil::printDist('ts', ['common', 'map']) ?>
|
|
||||||
<script>
|
|
||||||
window.serverNick = '<?= DB::prefix() ?>';
|
|
||||||
window.serverID = '<?= UniqueConst::$serverID ?>';
|
|
||||||
$(function() {
|
|
||||||
|
|
||||||
reloadWorldMap({
|
|
||||||
neutralView: true,
|
|
||||||
showMe: true,
|
|
||||||
useCachedMap: true
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<table align=center width=1200 class='tb_layout bg0'>
|
|
||||||
<tr>
|
|
||||||
<td>세 력 도<br><?= closeButton() ?></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<table align=center width=1200 height=520 class='tb_layout bg0'>
|
|
||||||
<tr height=520>
|
|
||||||
<td width=498 valign=top>
|
|
||||||
<?= formatHistoryToHTML(getGlobalActionLogRecent(34)) ?>
|
|
||||||
</td>
|
|
||||||
<td width=698>
|
|
||||||
<?= getMapHtml($mapTheme) ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan=2 valign=top>
|
|
||||||
<?= formatHistoryToHTML(getGlobalHistoryLogRecent(34)) ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<table align=center width=1200 class='tb_layout bg0'>
|
|
||||||
<tr>
|
|
||||||
<td><?= closeButton() ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?= banner() ?> </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
+7
-26
@@ -69,7 +69,7 @@ $str2 = getTournamentTime();
|
|||||||
if ($str2) {
|
if ($str2) {
|
||||||
$str2 = ', ' . $str2;
|
$str2 = ', ' . $str2;
|
||||||
}
|
}
|
||||||
$str3 = getTournamentTerm();
|
$str3 = getTournamentTermText();
|
||||||
if ($str3) {
|
if ($str3) {
|
||||||
$str3 = ', ' . $str3;
|
$str3 = ', ' . $str3;
|
||||||
}
|
}
|
||||||
@@ -132,11 +132,8 @@ if ($str3) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
echo "<td colspan=16>{$general['name']}</td>";
|
echo "<td colspan=16>{$general['name']}</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,11 +159,7 @@ if ($str3) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
if ($general['win'] > 0) {
|
if ($general['win'] > 0) {
|
||||||
$line[$i] = "<font color=red>";
|
$line[$i] = "<font color=red>";
|
||||||
$cent[intdiv($i, 2)] = "<font color=red>";
|
$cent[intdiv($i, 2)] = "<font color=red>";
|
||||||
@@ -208,11 +201,7 @@ if ($str3) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
if ($general['win'] > 0) {
|
if ($general['win'] > 0) {
|
||||||
$line[$i] = "<font color=red>";
|
$line[$i] = "<font color=red>";
|
||||||
$cent[intdiv($i, 2)] = "<font color=red>";
|
$cent[intdiv($i, 2)] = "<font color=red>";
|
||||||
@@ -254,11 +243,7 @@ if ($str3) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
if ($general['win'] > 0) {
|
if ($general['win'] > 0) {
|
||||||
$line[$i] = "<font color=red>";
|
$line[$i] = "<font color=red>";
|
||||||
$cent[intdiv($i, 2)] = "<font color=red>";
|
$cent[intdiv($i, 2)] = "<font color=red>";
|
||||||
@@ -300,11 +285,7 @@ if ($str3) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
if ($general['win'] > 0) {
|
if ($general['win'] > 0) {
|
||||||
$line[$i] = "<font color=red>";
|
$line[$i] = "<font color=red>";
|
||||||
$cent[intdiv($i, 2)] = "<font color=red>";
|
$cent[intdiv($i, 2)] = "<font color=red>";
|
||||||
|
|||||||
+1
-7
@@ -146,13 +146,7 @@ if ($gameStor->isunited) {
|
|||||||
$intel = "{$general['intel']}";
|
$intel = "{$general['intel']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($general['npc'] >= 2) {
|
$name = formatName($general['name'], $general['npc']);
|
||||||
$name = "<font color=cyan>{$general['name']}</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$name = "<font color=skyblue>{$general['name']}</font>";
|
|
||||||
} else {
|
|
||||||
$name = "{$general['name']}";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key_exists($general['owner'], $ownerNameList)) {
|
if (key_exists($general['owner'], $ownerNameList)) {
|
||||||
$name = $name . '<br><small>(' . $ownerNameList[$general['owner']] . ')</small>';
|
$name = $name . '<br><small>(' . $ownerNameList[$general['owner']] . ')</small>';
|
||||||
|
|||||||
+6
-26
@@ -198,7 +198,7 @@ switch ($admin['tnmt_type']) {
|
|||||||
if ($str2) {
|
if ($str2) {
|
||||||
$str2 = ', ' . $str2;
|
$str2 = ', ' . $str2;
|
||||||
}
|
}
|
||||||
$str3 = getTournamentTerm();
|
$str3 = getTournamentTermText();
|
||||||
if ($str3) {
|
if ($str3) {
|
||||||
$str3 = ', ' . $str3;
|
$str3 = ', ' . $str3;
|
||||||
}
|
}
|
||||||
@@ -240,11 +240,7 @@ switch ($admin['tnmt_type']) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
echo "<td colspan=16>{$general['name']}</td>";
|
echo "<td colspan=16>{$general['name']}</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,11 +266,7 @@ switch ($admin['tnmt_type']) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
if ($general['win'] > 0) {
|
if ($general['win'] > 0) {
|
||||||
$line[$i] = "<font color=red>";
|
$line[$i] = "<font color=red>";
|
||||||
$cent[intdiv($i, 2)] = "<font color=red>";
|
$cent[intdiv($i, 2)] = "<font color=red>";
|
||||||
@@ -316,11 +308,7 @@ switch ($admin['tnmt_type']) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
if ($general['win'] > 0) {
|
if ($general['win'] > 0) {
|
||||||
$line[$i] = "<font color=red>";
|
$line[$i] = "<font color=red>";
|
||||||
$cent[intdiv($i, 2)] = "<font color=red>";
|
$cent[intdiv($i, 2)] = "<font color=red>";
|
||||||
@@ -363,11 +351,7 @@ switch ($admin['tnmt_type']) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
if ($general['win'] > 0) {
|
if ($general['win'] > 0) {
|
||||||
$line[$i] = "<font color=red>";
|
$line[$i] = "<font color=red>";
|
||||||
$cent[intdiv($i, 2)] = "<font color=red>";
|
$cent[intdiv($i, 2)] = "<font color=red>";
|
||||||
@@ -409,11 +393,7 @@ switch ($admin['tnmt_type']) {
|
|||||||
if ($general['name'] == "") {
|
if ($general['name'] == "") {
|
||||||
$general['name'] = "-";
|
$general['name'] = "-";
|
||||||
}
|
}
|
||||||
if ($general['npc'] >= 2) {
|
$general['name'] = formatName($general['name'], $general['npc']);
|
||||||
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
|
|
||||||
} elseif ($general['npc'] == 1) {
|
|
||||||
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
|
|
||||||
}
|
|
||||||
if ($general['win'] > 0) {
|
if ($general['win'] > 0) {
|
||||||
$line[$i] = "<font color=red>";
|
$line[$i] = "<font color=red>";
|
||||||
$cent[intdiv($i, 2)] = "<font color=red>";
|
$cent[intdiv($i, 2)] = "<font color=red>";
|
||||||
|
|||||||
+10
-2
@@ -15,7 +15,7 @@ $sel = Util::getPost('sel', 'int');
|
|||||||
$trig = Util::getPost('trig', 'int');
|
$trig = Util::getPost('trig', 'int');
|
||||||
|
|
||||||
//로그인 검사
|
//로그인 검사
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
$session = Session::requireGameLogin();
|
||||||
$userID = Session::getUserID();
|
$userID = Session::getUserID();
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
@@ -24,7 +24,11 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
|
|||||||
$admin = $gameStor->getValues(['tournament','phase','tnmt_type','develcost']);
|
$admin = $gameStor->getValues(['tournament','phase','tnmt_type','develcost']);
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT no,name,tournament from general where owner=%i',$userID);
|
$me = $db->queryFirstRow('SELECT no,name,tournament from general where owner=%i',$userID);
|
||||||
|
if(!$me){
|
||||||
|
$session->logoutGame();
|
||||||
|
header('location:b_tournament.php');
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
switch($admin['tnmt_type']) {
|
switch($admin['tnmt_type']) {
|
||||||
case 0: $tp = "total"; $tp2 = "전력전"; $tp3 = "leadership+strength+intel"; break;
|
case 0: $tp = "total"; $tp2 = "전력전"; $tp3 = "leadership+strength+intel"; break;
|
||||||
case 1: $tp = "leadership"; $tp2 = "통솔전"; $tp3 = "leadership"; break;
|
case 1: $tp = "leadership"; $tp2 = "통솔전"; $tp3 = "leadership"; break;
|
||||||
@@ -40,6 +44,10 @@ if($btn == '참가') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$general = $db->queryFirstRow('SELECT no,name,npc,leadership,strength,intel,explevel,gold,horse,weapon,book FROM general WHERE `no`=%i', $me['no']);
|
$general = $db->queryFirstRow('SELECT no,name,npc,leadership,strength,intel,explevel,gold,horse,weapon,book FROM general WHERE `no`=%i', $me['no']);
|
||||||
|
if(!$general){
|
||||||
|
header('location:b_tournament.php');
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
//{$admin['develcost']}원 참가비
|
//{$admin['develcost']}원 참가비
|
||||||
if($general['gold'] < $admin['develcost']) {
|
if($general['gold'] < $admin['develcost']) {
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
<div class="buttonPlate">
|
<?=$btnBegin??''?><a href="v_nationBetting.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">천통국 베팅</a><?=$btnEnd??''?>
|
||||||
<a href="a_status.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">세력도</button></a>
|
<?=$btnBegin??''?><a href="a_kingdomList.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">세력일람</a><?=$btnEnd??''?>
|
||||||
<a href="a_kingdomList.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">세력일람</button></a>
|
<?=$btnBegin??''?><a href="a_genList.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">장수일람</a><?=$btnEnd??''?>
|
||||||
<a href="a_genList.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">장수일람</button></a>
|
<?=$btnBegin??''?><a href="a_bestGeneral.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">명장일람</a><?=$btnEnd??''?>
|
||||||
<a href="a_bestGeneral.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">명장일람</button></a>
|
<?=$btnBegin??''?><a href="a_history.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">연감</a><?=$btnEnd??''?>
|
||||||
<a href="a_history.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">연감</button></a>
|
<?=$btnBegin??''?><a href="a_hallOfFame.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">명예의전당</a><?=$btnEnd??''?>
|
||||||
<a href="a_hallOfFame.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">명예의전당</button></a>
|
<?=$btnBegin??''?><a href="a_emperior.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">왕조일람</a><?=$btnEnd??''?>
|
||||||
<a href="a_emperior.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">왕조일람</button></a>
|
<?=$btnBegin??''?><a href="a_traffic.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">접속량정보</a><?=$btnEnd??''?>
|
||||||
<a href="a_traffic.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">접속량정보</button></a>
|
<?=$btnBegin??''?><a href="/bbs/board" target="_blank" class="toolbarButton2 <?=$btnClass??""?>">삼모게시판</a><?=$btnEnd??''?>
|
||||||
<a href="/bbs/board" target="_blank"><button type="button" class="toolbarButton2">삼모게시판</button></a>
|
<?=$btnBegin??''?><a href="/bbs/tip" target="_blank" class="toolbarButton <?=$btnClass??""?>">팁/강좌</a><?=$btnEnd??''?>
|
||||||
<a href="/bbs/tip" target="_blank"><button type="button" class="toolbarButton">팁/강좌</button></a>
|
<?=$btnBegin??''?><a href="/bbs/news" target="_blank" class="toolbarButton <?=$btnClass??""?>">삼국 일보</a><?=$btnEnd??''?>
|
||||||
<a href="/bbs/news" target="_blank"><button type="button" class="toolbarButton">삼국 일보</button></a>
|
<?=$btnBegin??''?><a href="/bbs/history2" target="_blank" class="toolbarButton <?=$btnClass??""?>">개인 열전</a><?=$btnEnd??''?>
|
||||||
<a href="/bbs/history2" target="_blank"><button type="button" class="toolbarButton">개인 열전</button></a>
|
<?=$btnBegin??''?><a href="/bbs/history3" target="_blank" class="toolbarButton <?=$btnClass??""?>">국가 열전</a><?=$btnEnd??''?>
|
||||||
<a href="/bbs/history3" target="_blank"><button type="button" class="toolbarButton">국가 열전</button></a>
|
<?=$btnBegin??''?><a href="/bbs/patch" target="_blank" class="toolbarButton <?=$btnClass??""?>">패치 내역</a><?=$btnEnd??''?>
|
||||||
<a href="/bbs/patch" target="_blank"><button type="button" class="toolbarButton">패치 내역</button></a>
|
<?=$btnBegin??''?><a href="battle_simulator.php" target="_blank" class="toolbarButton <?=$btnClass??""?>">전투 시뮬레이터</a><?=$btnEnd??''?>
|
||||||
<a href="battle_simulator.php" target="_blank"><button type="button" class="toolbarButton">전투 시뮬레이터</button></a>
|
<?=$btnBegin??''?><a href="<?= $site ?>" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>"><?= $call ?></a><?=$btnEnd??''?>
|
||||||
<a href="<?=$site?>" target="_blank" class="open-window"><button type="button" class="toolbarButton"><?=$call?></button></a>
|
|
||||||
</div>
|
|
||||||
+5
-3
@@ -1937,8 +1937,8 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
|
|||||||
$prob = Util::valueFit($prob, null, 1 / 4); //최대치 감소
|
$prob = Util::valueFit($prob, null, 1 / 4); //최대치 감소
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
$prob /= sqrt(2);
|
$prob /= sqrt(7);
|
||||||
$moreProb = pow(2, 1 / 4);
|
$moreProb = pow(10, 1 / 4);
|
||||||
|
|
||||||
if ($general->getAuxVar('inheritRandomUnique') && $availableBuyUnique) {
|
if ($general->getAuxVar('inheritRandomUnique') && $availableBuyUnique) {
|
||||||
//포인트로 랜덤 유니크 획득
|
//포인트로 랜덤 유니크 획득
|
||||||
@@ -2415,7 +2415,9 @@ function SabotageInjury(array $cityGeneralList, string $reason): int
|
|||||||
|
|
||||||
foreach ($cityGeneralList as $general) {
|
foreach ($cityGeneralList as $general) {
|
||||||
/** @var General $general */
|
/** @var General $general */
|
||||||
if (!Util::randBool(0.3)) {
|
$injuryProb = 0.3;
|
||||||
|
$injuryProb = $general->onCalcStat($general, 'injuryProb', $injuryProb);
|
||||||
|
if (!Util::randBool($injuryProb)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$general->getLogger()->pushGeneralActionLog($text);
|
$general->getLogger()->pushGeneralActionLog($text);
|
||||||
|
|||||||
@@ -673,17 +673,17 @@ function updateNationState()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$score = $nationGen->getVar('belong') + 5;
|
$score = $nationGen->getVar('belong') + 10;
|
||||||
|
|
||||||
if ($nationGen->getVar('officer_level') == 12) {
|
if ($nationGen->getVar('officer_level') == 12) {
|
||||||
$score += 100; //NOTE: 꼬우면 군주하세요.
|
$score += 60;
|
||||||
} else if ($nationGen->getVar('officer_level') == 11) {
|
} else if ($nationGen->getVar('officer_level') == 11) {
|
||||||
$score += 50;
|
$score += 30;
|
||||||
} else if ($nationGen->getVar('officer_level') > 4) {
|
} else if ($nationGen->getVar('officer_level') > 4) {
|
||||||
$score += 35;
|
$score += 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
$score *= $trialCnt;
|
$score *= 2**$trialCnt;
|
||||||
|
|
||||||
$uniqueLotteryWeightList[$nationGen->getID()] = [$nationGen, $score];
|
$uniqueLotteryWeightList[$nationGen->getID()] = [$nationGen, $score];
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-21
@@ -371,10 +371,11 @@ function getGlobalActionLogWithDate(int $year, int $month):array {
|
|||||||
return $texts;
|
return $texts;
|
||||||
}
|
}
|
||||||
|
|
||||||
function LogHistory($isFirst=0) {
|
function getCurrentHistory($isFirst=false) {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$obj = $gameStor->getValues(['startyear', 'year', 'month']);
|
[$startYear, $year, $month]= $gameStor->getValuesAsArray(['startyear', 'year', 'month']);
|
||||||
|
$yearMonth = Util::joinYearMonth($year, $month);
|
||||||
|
|
||||||
$map = getWorldMap([
|
$map = getWorldMap([
|
||||||
'year'=>null,
|
'year'=>null,
|
||||||
@@ -384,21 +385,14 @@ function LogHistory($isFirst=0) {
|
|||||||
'aux'=>[]
|
'aux'=>[]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if($isFirst){
|
||||||
$map['month'] = $obj['month'];
|
$yearMonth -= 1;
|
||||||
$map['year'] = $obj['year'];
|
|
||||||
$map['startYear'] = $obj['startyear'];
|
|
||||||
if($isFirst == 1){
|
|
||||||
$map['month'] -= 1;
|
|
||||||
if($map['month'] == 0){
|
|
||||||
$map['month'] = 12;
|
|
||||||
$map['year'] -= 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$year = $map['year'];
|
[$year, $month] = Util::parseYearMonth($yearMonth);
|
||||||
$month = $map['month'];
|
$map['startYear'] = $startYear;
|
||||||
|
$map['year'] = $year;
|
||||||
|
$map['month'] = $month;
|
||||||
|
|
||||||
$globalHistory = getGlobalHistoryLogWithDate($year, $month);
|
$globalHistory = getGlobalHistoryLogWithDate($year, $month);
|
||||||
$globalAction = getGlobalActionLogWithDate($year, $month);
|
$globalAction = getGlobalActionLogWithDate($year, $month);
|
||||||
@@ -418,15 +412,27 @@ function LogHistory($isFirst=0) {
|
|||||||
return -($lhs['power']<=>$rhs['power']);
|
return -($lhs['power']<=>$rhs['power']);
|
||||||
});
|
});
|
||||||
|
|
||||||
$db->insert('ng_history', [
|
return [
|
||||||
'server_id' => UniqueConst::$serverID,
|
'server_id' => UniqueConst::$serverID,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'month' => $month,
|
'month' => $month,
|
||||||
'map' => Json::encode($map),
|
'map' => $map,
|
||||||
'global_history' => Json::encode($globalHistory),
|
'global_history' => $globalHistory,
|
||||||
'global_action' => Json::encode($globalAction),
|
'global_action' => $globalAction,
|
||||||
'nations' => Json::encode($nations),
|
'nations' => $nations,
|
||||||
]);
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function LogHistory($isFirst=false) {
|
||||||
|
$history = getCurrentHistory($isFirst);
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$history['map'] = Json::encode($history['map']);
|
||||||
|
$history['global_history'] = Json::encode($history['global_history']);
|
||||||
|
$history['global_action'] = Json::encode($history['global_action']);
|
||||||
|
$history['nations'] = Json::encode($history['nations']);
|
||||||
|
|
||||||
|
$db->insert('ng_history', $history);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-5
@@ -215,14 +215,35 @@ function formatLeadershipBonus(int $value): string
|
|||||||
return "<font color=cyan>+{$value}</font>";
|
return "<font color=cyan>+{$value}</font>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getNPCColor(int $npc): ?string{
|
||||||
|
if ($npc == 1) {
|
||||||
|
return 'skyblue';
|
||||||
|
}
|
||||||
|
if ($npc == 4){
|
||||||
|
return 'deepskyblue';
|
||||||
|
}
|
||||||
|
if ($npc == 5){
|
||||||
|
return 'darkcyan';
|
||||||
|
}
|
||||||
|
if ($npc == 6){
|
||||||
|
return 'mediumaquamarine';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($npc > 1) {
|
||||||
|
return 'cyan';
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
function formatName(string $name, int $npc): string
|
function formatName(string $name, int $npc): string
|
||||||
{
|
{
|
||||||
if ($npc == 1) {
|
$color = getNPCColor($npc);
|
||||||
$name = "<font color='skyblue'>$name</font>";
|
if($color === null){
|
||||||
} else if ($npc > 1) {
|
return $name;
|
||||||
$name = "<font color='cyan'>$name</font>";
|
|
||||||
}
|
}
|
||||||
return $name;
|
|
||||||
|
return "<span style='color:{$color}'>$name</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMapTheme(): string
|
function getMapTheme(): string
|
||||||
|
|||||||
@@ -576,7 +576,7 @@ function disaster() {
|
|||||||
$logger->flush();
|
$logger->flush();
|
||||||
|
|
||||||
if (!$isGood) {
|
if (!$isGood) {
|
||||||
$generalListByCity = Util::arrayGroupBy($db->query('SELECT no, nation, city, injury, crew, atmos, train FROM general WHERE city IN %li', Util::squeezeFromArray($targetCityList, 'city')), 'city');
|
$generalListByCity = Util::arrayGroupBy($db->query('SELECT no, name, nation, city, officer_level, injury, leadership, strength, intel, horse, weapon, book, item, crew, crewtype, atmos, train, special, special2 FROM general WHERE city IN %li', Util::squeezeFromArray($targetCityList, 'city')), 'city');
|
||||||
//NOTE: 쿼리 1번이지만 복잡하기 vs 쿼리 여러번이지만 조금 더 깔끔하기
|
//NOTE: 쿼리 1번이지만 복잡하기 vs 쿼리 여러번이지만 조금 더 깔끔하기
|
||||||
foreach ($targetCityList as $city) {
|
foreach ($targetCityList as $city) {
|
||||||
$affectRatio = Util::valueFit($city['secu'] / $city['secu_max'] / 0.8, 0, 1);
|
$affectRatio = Util::valueFit($city['secu'] / $city['secu_max'] / 0.8, 0, 1);
|
||||||
|
|||||||
+38
-33
@@ -164,40 +164,47 @@ function processTournament()
|
|||||||
$gameStor->tnmt_time = (new \DateTimeImmutable($admin['tnmt_time']))->add(new \DateInterval("PT{$second}S"))->format('Y-m-d H:i:s');
|
$gameStor->tnmt_time = (new \DateTimeImmutable($admin['tnmt_time']))->add(new \DateInterval("PT{$second}S"))->format('Y-m-d H:i:s');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTournamentTerm()
|
function getTournamentTerm(): ?int{
|
||||||
{
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
$tnmt_auto = $gameStor->tnmt_auto;
|
$tnmt_auto = $gameStor->tnmt_auto;
|
||||||
|
if($tnmt_auto === null){
|
||||||
switch ($tnmt_auto) {
|
$tnmt_auto = $gameStor->tnmt_trig;
|
||||||
case 0:
|
|
||||||
$str = '';
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
$str = "경기당 12분";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$str = "경기당 7분";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
$str = "경기당 3분";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
$str = "경기당 1분";
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
$str = "경기당 30초";
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
$str = "경기당 15초";
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
$str = "경기당 5초";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return $str;
|
switch($tnmt_auto){
|
||||||
|
case 0: return null;
|
||||||
|
case 1: return 12 * 60;
|
||||||
|
case 2: return 7 * 60;
|
||||||
|
case 3: return 3 * 60;
|
||||||
|
case 4: return 1 * 60;
|
||||||
|
case 5: return 30;
|
||||||
|
case 6: return 15;
|
||||||
|
case 7: return 5;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTournamentTermText()
|
||||||
|
{
|
||||||
|
$term = getTournamentTerm();
|
||||||
|
|
||||||
|
if($term === null){
|
||||||
|
return '수동';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($term % 60 === 0){
|
||||||
|
$termMin = intdiv($term, 60);
|
||||||
|
return "경기당 {$termMin}분";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($term > 60){
|
||||||
|
$termSec = $term % 60;
|
||||||
|
$termMin = intdiv($term, 60);
|
||||||
|
return "경기당 {$termMin}분 {$termSec}초";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "경기당 {$term}초";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTournamentTime()
|
function getTournamentTime()
|
||||||
@@ -261,10 +268,8 @@ function printRow($k, $npc, $name, $abil, $tgame, $win, $draw, $lose, $gd, $gl,
|
|||||||
$k += 1;
|
$k += 1;
|
||||||
if ($prmt > 0) {
|
if ($prmt > 0) {
|
||||||
$name = "<font color=orange>" . $name . "</font>";
|
$name = "<font color=orange>" . $name . "</font>";
|
||||||
} elseif ($npc >= 2) {
|
} else if($npc > 0){
|
||||||
$name = "<font color=cyan>" . $name . "</font>";
|
$name = formatName($name, $npc);
|
||||||
} elseif ($npc == 1) {
|
|
||||||
$name = "<font color=skyblue>" . $name . "</font>";
|
|
||||||
}
|
}
|
||||||
echo "<tr align=center><td class='bg2'>$k</td><td style='font-size:80%;'>$name</td><td>$abil</td><td>$tgame</td><td>$win</td><td>$draw</td><td>$lose</td><td>$gd</td><td>$gl</td></tr>";
|
echo "<tr align=center><td class='bg2'>$k</td><td style='font-size:80%;'>$name</td><td>$abil</td><td>$tgame</td><td>$win</td><td>$draw</td><td>$lose</td><td>$gd</td><td>$gl</td></tr>";
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -149,14 +149,14 @@ if (!$otherTextInfo) {
|
|||||||
<?= $scenario ?>
|
<?= $scenario ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
||||||
NPC수 : <?= $extend ?>
|
NPC 수, 상성 : <?= $extend ?>,<?= $fiction ?>
|
||||||
</div>
|
|
||||||
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
|
||||||
NPC상성 : <?= $fiction ?>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
||||||
NPC선택 : <?= $npcmode ?>
|
NPC선택 : <?= $npcmode ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
||||||
|
토너먼트 : <?= getTournamentTermText() ?>
|
||||||
|
</div>
|
||||||
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
||||||
기타 설정: <?= $otherTextInfo ?>
|
기타 설정: <?= $otherTextInfo ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+182
-147
@@ -1,28 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo;
|
namespace sammo;
|
||||||
|
|
||||||
|
|
||||||
function processWar(General $attackerGeneral, array $rawAttackerNation, array $rawDefenderCity){
|
function processWar(General $attackerGeneral, array $rawAttackerNation, array $rawDefenderCity)
|
||||||
|
{
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
$attackerNationID = $attackerGeneral->getNationID();
|
$attackerNationID = $attackerGeneral->getNationID();
|
||||||
$defenderNationID = $rawDefenderCity['nation'];
|
$defenderNationID = $rawDefenderCity['nation'];
|
||||||
|
|
||||||
if($defenderNationID == 0){
|
if ($defenderNationID == 0) {
|
||||||
$rawDefenderNation = [
|
$rawDefenderNation = [
|
||||||
'nation'=>0,
|
'nation' => 0,
|
||||||
'name'=>'재야',
|
'name' => '재야',
|
||||||
'capital'=>0,
|
'capital' => 0,
|
||||||
'level'=>0,
|
'level' => 0,
|
||||||
'gold'=>0,
|
'gold' => 0,
|
||||||
'rice'=>10000,
|
'rice' => 10000,
|
||||||
'type'=>GameConst::$neutralNationType,
|
'type' => GameConst::$neutralNationType,
|
||||||
'tech'=>0,
|
'tech' => 0,
|
||||||
'gennum'=>1
|
'gennum' => 1
|
||||||
];
|
];
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$rawDefenderNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $defenderNationID);
|
$rawDefenderNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $defenderNationID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,29 +37,29 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
|
|||||||
$defenderIDList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND city=%i AND nation!=0 and crew > 0 and rice>(crew/100) and train>=defence_train and atmos>=defence_train', $city->getVar('nation'), $city->getVar('city'));
|
$defenderIDList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND city=%i AND nation!=0 and crew > 0 and rice>(crew/100) and train>=defence_train and atmos>=defence_train', $city->getVar('nation'), $city->getVar('city'));
|
||||||
$defenderList = General::createGeneralObjListFromDB($defenderIDList, null, 2);
|
$defenderList = General::createGeneralObjListFromDB($defenderIDList, null, 2);
|
||||||
|
|
||||||
usort($defenderList, function(General $lhs, General $rhs){
|
usort($defenderList, function (General $lhs, General $rhs) {
|
||||||
return -(extractBattleOrder($lhs) <=> extractBattleOrder($rhs));
|
return - (extractBattleOrder($lhs) <=> extractBattleOrder($rhs));
|
||||||
});
|
});
|
||||||
|
|
||||||
$iterDefender = new \ArrayIterator($defenderList);
|
$iterDefender = new \ArrayIterator($defenderList);
|
||||||
$iterDefender->rewind();
|
$iterDefender->rewind();
|
||||||
|
|
||||||
$getNextDefender = function(?WarUnit $prevDefender, bool $reqNext) use ($iterDefender, $rawDefenderNation, $rawDefenderCity, $db) {
|
$getNextDefender = function (?WarUnit $prevDefender, bool $reqNext) use ($iterDefender, $rawDefenderNation, $rawDefenderCity, $db) {
|
||||||
if($prevDefender !== null){
|
if ($prevDefender !== null) {
|
||||||
$prevDefender->applyDB($db);
|
$prevDefender->applyDB($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$reqNext){
|
if (!$reqNext) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$iterDefender->valid()){
|
if (!$iterDefender->valid()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$nextDefender = $iterDefender->current();
|
$nextDefender = $iterDefender->current();
|
||||||
$nextDefender->setRawCity($rawDefenderCity);
|
$nextDefender->setRawCity($rawDefenderCity);
|
||||||
if(extractBattleOrder($nextDefender) <= 0){
|
if (extractBattleOrder($nextDefender) <= 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,8 +83,8 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
|
|||||||
$updateAttackerNation = [];
|
$updateAttackerNation = [];
|
||||||
$updateDefenderNation = [];
|
$updateDefenderNation = [];
|
||||||
|
|
||||||
if($city->getVar('supply')){
|
if ($city->getVar('supply')) {
|
||||||
if($city->getPhase() > 0){
|
if ($city->getPhase() > 0) {
|
||||||
$rice = $city->getKilled() / 100 * 0.8;
|
$rice = $city->getKilled() / 100 * 0.8;
|
||||||
$rice *= $city->getCrewType()->rice;
|
$rice *= $city->getCrewType()->rice;
|
||||||
$rice *= getTechCost($rawDefenderNation['tech']);
|
$rice *= getTechCost($rawDefenderNation['tech']);
|
||||||
@@ -91,12 +92,10 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
|
|||||||
Util::setRound($rice);
|
Util::setRound($rice);
|
||||||
|
|
||||||
$updateDefenderNation['rice'] = max(0, $rawDefenderNation['rice'] - $rice);
|
$updateDefenderNation['rice'] = max(0, $rawDefenderNation['rice'] - $rice);
|
||||||
}
|
} else if ($conquerCity) {
|
||||||
else if($conquerCity){
|
if ($rawDefenderNation['capital'] == $rawDefenderCity['city']) {
|
||||||
if($rawDefenderNation['capital'] == $rawDefenderCity['city']){
|
|
||||||
$updateDefenderNation['rice'] = $rawDefenderNation['rice'] + 1000;
|
$updateDefenderNation['rice'] = $rawDefenderNation['rice'] + 1000;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$updateDefenderNation['rice'] = $rawDefenderNation['rice'] + 500;
|
$updateDefenderNation['rice'] = $rawDefenderNation['rice'] + 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,29 +119,29 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
|
|||||||
$attackerGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawAttackerNation['nation']);
|
$attackerGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawAttackerNation['nation']);
|
||||||
$defenderGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawDefenderNation['nation']);
|
$defenderGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawDefenderNation['nation']);
|
||||||
|
|
||||||
if($attackerGenCnt_eff < GameConst::$initialNationGenLimit){
|
if ($attackerGenCnt_eff < GameConst::$initialNationGenLimit) {
|
||||||
$attackerGenCnt = GameConst::$initialNationGenLimit;
|
$attackerGenCnt = GameConst::$initialNationGenLimit;
|
||||||
$attackerGenCnt_eff = GameConst::$initialNationGenLimit;
|
$attackerGenCnt_eff = GameConst::$initialNationGenLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($defenderGenCnt_eff < GameConst::$initialNationGenLimit){
|
if ($defenderGenCnt_eff < GameConst::$initialNationGenLimit) {
|
||||||
$defenderGenCnt = GameConst::$initialNationGenLimit;
|
$defenderGenCnt = GameConst::$initialNationGenLimit;
|
||||||
$defenderGenCnt_eff = GameConst::$initialNationGenLimit;
|
$defenderGenCnt_eff = GameConst::$initialNationGenLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($attackerGenCnt != $attackerGenCnt_eff){
|
if ($attackerGenCnt != $attackerGenCnt_eff) {
|
||||||
$attackerIncTech *= $attackerGenCnt / $attackerGenCnt_eff;
|
$attackerIncTech *= $attackerGenCnt / $attackerGenCnt_eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($defenderGenCnt != $defenderGenCnt_eff){
|
if ($defenderGenCnt != $defenderGenCnt_eff) {
|
||||||
$defenderIncTech *= $defenderGenCnt / $defenderGenCnt_eff;
|
$defenderIncTech *= $defenderGenCnt / $defenderGenCnt_eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(TechLimit($startYear, $year, $rawAttackerNation['tech'])){
|
if (TechLimit($startYear, $year, $rawAttackerNation['tech'])) {
|
||||||
$attackerIncTech /= 4;
|
$attackerIncTech /= 4;
|
||||||
}
|
}
|
||||||
if(TechLimit($startYear, $year, $rawDefenderNation['tech'])){
|
if (TechLimit($startYear, $year, $rawDefenderNation['tech'])) {
|
||||||
$defenderIncTech /= 4;
|
$defenderIncTech /= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,41 +158,42 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
|
|||||||
$db->update('nation', $updateDefenderNation, 'nation=%i', $defenderNationID);
|
$db->update('nation', $updateDefenderNation, 'nation=%i', $defenderNationID);
|
||||||
|
|
||||||
$db->update('diplomacy', [
|
$db->update('diplomacy', [
|
||||||
'dead'=>$db->sqleval('dead + %i', $attacker->getDead())
|
'dead' => $db->sqleval('dead + %i', $attacker->getDead())
|
||||||
], 'me = %i and you = %i', $attackerNationID, $defenderNationID);
|
], 'me = %i and you = %i', $attackerNationID, $defenderNationID);
|
||||||
|
|
||||||
$db->update('diplomacy', [
|
$db->update('diplomacy', [
|
||||||
'dead'=>$db->sqleval('dead + %i', $attacker->getKilled())
|
'dead' => $db->sqleval('dead + %i', $attacker->getKilled())
|
||||||
], 'me = %i and you = %i', $defenderNationID, $attackerNationID);
|
], 'me = %i and you = %i', $defenderNationID, $attackerNationID);
|
||||||
|
|
||||||
if(!$conquerCity){
|
if (!$conquerCity) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConquerCity([
|
ConquerCity([
|
||||||
'startyear'=>$startYear,
|
'startyear' => $startYear,
|
||||||
'year'=>$year,
|
'year' => $year,
|
||||||
'month'=>$month,
|
'month' => $month,
|
||||||
'city_rate'=>$cityRate,
|
'city_rate' => $cityRate,
|
||||||
'join_mode'=>$joinMode,
|
'join_mode' => $joinMode,
|
||||||
], $attacker->getGeneral(), $city->getRaw());
|
], $attacker->getGeneral(), $city->getRaw());
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractBattleOrder(General $general){
|
function extractBattleOrder(General $general)
|
||||||
if($general->getVar('crew') == 0){
|
{
|
||||||
|
if ($general->getVar('crew') == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($general->getVar('rice') <= $general->getVar('crew') / 100){
|
if ($general->getVar('rice') <= $general->getVar('crew') / 100) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$defence_train = $general->getVar('defence_train');
|
$defence_train = $general->getVar('defence_train');
|
||||||
if($general->getVar('train') < $defence_train){
|
if ($general->getVar('train') < $defence_train) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($general->getVar('atmos') < $defence_train){
|
if ($general->getVar('atmos') < $defence_train) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,8 +210,8 @@ function processWar_NG(
|
|||||||
callable $getNextDefender,
|
callable $getNextDefender,
|
||||||
WarUnitCity $city,
|
WarUnitCity $city,
|
||||||
int $relYear
|
int $relYear
|
||||||
):bool{
|
): bool {
|
||||||
$templates = new \League\Plates\Engine(__DIR__.'/templates');
|
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
|
||||||
|
|
||||||
$logger = $attacker->getLogger();
|
$logger = $attacker->getLogger();
|
||||||
|
|
||||||
@@ -231,11 +231,11 @@ function processWar_NG(
|
|||||||
$logger->pushGlobalActionLog("<D><b>{$attacker->getNationVar('name')}</b></>의 <Y>{$attacker->getName()}</>{$josaYi} <G><b>{$city->getName()}</b></>{$josaRo} 진격합니다.");
|
$logger->pushGlobalActionLog("<D><b>{$attacker->getNationVar('name')}</b></>의 <Y>{$attacker->getName()}</>{$josaYi} <G><b>{$city->getName()}</b></>{$josaRo} 진격합니다.");
|
||||||
$logger->pushGeneralActionLog("<G><b>{$city->getName()}</b></>{$josaRo} <M>진격</>합니다. <1>$date</>");
|
$logger->pushGeneralActionLog("<G><b>{$city->getName()}</b></>{$josaRo} <M>진격</>합니다. <1>$date</>");
|
||||||
|
|
||||||
for($currPhase = 0; $currPhase < $attacker->getMaxPhase(); $currPhase+=1){
|
for ($currPhase = 0; $currPhase < $attacker->getMaxPhase(); $currPhase += 1) {
|
||||||
if($defender === null){
|
if ($defender === null) {
|
||||||
$defender = $city;
|
$defender = $city;
|
||||||
|
|
||||||
if($city->getNationVar('rice') <= 0 && $city->getVar('supply')){
|
if ($city->getNationVar('rice') <= 0 && $city->getVar('supply')) {
|
||||||
//병량 패퇴
|
//병량 패퇴
|
||||||
$attacker->setOppose($defender);
|
$attacker->setOppose($defender);
|
||||||
$defender->setOppose($attacker);
|
$defender->setOppose($attacker);
|
||||||
@@ -256,7 +256,7 @@ function processWar_NG(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($defender->getPhase() == 0){
|
if ($defender->getPhase() == 0) {
|
||||||
$defender->setPrePhase($currPhase);
|
$defender->setPrePhase($currPhase);
|
||||||
|
|
||||||
$attacker->addTrain(1);
|
$attacker->addTrain(1);
|
||||||
@@ -276,7 +276,7 @@ function processWar_NG(
|
|||||||
$attackerName = $attacker->getName();
|
$attackerName = $attacker->getName();
|
||||||
$attackerCrewTypeName = $attacker->getCrewTypeName();
|
$attackerCrewTypeName = $attacker->getCrewTypeName();
|
||||||
|
|
||||||
if($defender instanceof WarUnitGeneral){
|
if ($defender instanceof WarUnitGeneral) {
|
||||||
$defenderName = $defender->getName();
|
$defenderName = $defender->getName();
|
||||||
$defenderCrewTypeName = $defender->getCrewTypeName();
|
$defenderCrewTypeName = $defender->getCrewTypeName();
|
||||||
|
|
||||||
@@ -291,8 +291,7 @@ function processWar_NG(
|
|||||||
$josaRo = JosaUtil::pick($defenderCrewTypeName, '로');
|
$josaRo = JosaUtil::pick($defenderCrewTypeName, '로');
|
||||||
$josaUl = JosaUtil::pick($attackerCrewTypeName, '을');
|
$josaUl = JosaUtil::pick($attackerCrewTypeName, '을');
|
||||||
$defender->getLogger()->pushGeneralActionLog("{$defenderCrewTypeName}{$josaRo} <Y>{$attackerName}</>의 {$attackerCrewTypeName}{$josaUl} <M>수비</>합니다.");
|
$defender->getLogger()->pushGeneralActionLog("{$defenderCrewTypeName}{$josaRo} <Y>{$attackerName}</>의 {$attackerCrewTypeName}{$josaUl} <M>수비</>합니다.");
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$josaYi = JosaUtil::pick($attackerName, '이');
|
$josaYi = JosaUtil::pick($attackerName, '이');
|
||||||
$josaRo = JosaUtil::pick($attackerCrewTypeName, '로');
|
$josaRo = JosaUtil::pick($attackerCrewTypeName, '로');
|
||||||
$logger->pushGlobalActionLog("<Y>{$attackerName}</>{$josaYi} {$attackerCrewTypeName}{$josaRo} 성벽을 공격합니다.");
|
$logger->pushGlobalActionLog("<Y>{$attackerName}</>{$josaYi} {$attackerCrewTypeName}{$josaRo} 성벽을 공격합니다.");
|
||||||
@@ -324,16 +323,15 @@ function processWar_NG(
|
|||||||
$attackerHP = $attacker->getHP();
|
$attackerHP = $attacker->getHP();
|
||||||
$defenderHP = $defender->getHP();
|
$defenderHP = $defender->getHP();
|
||||||
|
|
||||||
if($deadAttacker > $attackerHP || $deadDefender > $defenderHP){
|
if ($deadAttacker > $attackerHP || $deadDefender > $defenderHP) {
|
||||||
$deadAttackerRatio = $deadAttacker / max(1, $attackerHP);
|
$deadAttackerRatio = $deadAttacker / max(1, $attackerHP);
|
||||||
$deadDefenderRatio = $deadDefender / max(1, $defenderHP);
|
$deadDefenderRatio = $deadDefender / max(1, $defenderHP);
|
||||||
|
|
||||||
if($deadDefenderRatio > $deadAttackerRatio){
|
if ($deadDefenderRatio > $deadAttackerRatio) {
|
||||||
//수비자가 더 병력 부족
|
//수비자가 더 병력 부족
|
||||||
$deadAttacker /= $deadDefenderRatio;
|
$deadAttacker /= $deadDefenderRatio;
|
||||||
$deadDefender = $defenderHP;
|
$deadDefender = $defenderHP;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
//공격자가 더 병력 부족
|
//공격자가 더 병력 부족
|
||||||
$deadDefender /= $deadAttackerRatio;
|
$deadDefender /= $deadAttackerRatio;
|
||||||
$deadAttacker = $attackerHP;
|
$deadAttacker = $attackerHP;
|
||||||
@@ -351,7 +349,7 @@ function processWar_NG(
|
|||||||
|
|
||||||
$phaseNickname = $currPhase + 1;
|
$phaseNickname = $currPhase + 1;
|
||||||
|
|
||||||
if($deadAttacker > 0 || $deadDefender > 0){
|
if ($deadAttacker > 0 || $deadDefender > 0) {
|
||||||
$attacker->getLogger()->pushGeneralBattleDetailLog(
|
$attacker->getLogger()->pushGeneralBattleDetailLog(
|
||||||
"$phaseNickname : <Y1>【{$attacker->getName()}】</> <C>{$attacker->getHP()} (-$deadAttacker)</> VS <C>{$defender->getHP()} (-$deadDefender)</> <Y1>【{$defender->getName()}】</>"
|
"$phaseNickname : <Y1>【{$attacker->getName()}】</> <C>{$attacker->getHP()} (-$deadAttacker)</> VS <C>{$defender->getHP()} (-$deadDefender)</> <Y1>【{$defender->getName()}】</>"
|
||||||
);
|
);
|
||||||
@@ -365,7 +363,7 @@ function processWar_NG(
|
|||||||
$attacker->addPhase();
|
$attacker->addPhase();
|
||||||
$defender->addPhase();
|
$defender->addPhase();
|
||||||
|
|
||||||
if(!$attacker->continueWar($noRice)){
|
if (!$attacker->continueWar($noRice)) {
|
||||||
$attacker->logBattleResult();
|
$attacker->logBattleResult();
|
||||||
$defender->logBattleResult();
|
$defender->logBattleResult();
|
||||||
|
|
||||||
@@ -377,10 +375,9 @@ function processWar_NG(
|
|||||||
|
|
||||||
$josaYi = JosaUtil::pick($attacker->getCrewTypeName(), '이');
|
$josaYi = JosaUtil::pick($attacker->getCrewTypeName(), '이');
|
||||||
$logger->pushGlobalActionLog("<Y>{$attacker->getName()}</>의 {$attacker->getCrewTypeName()}{$josaYi} 퇴각했습니다.");
|
$logger->pushGlobalActionLog("<Y>{$attacker->getName()}</>의 {$attacker->getCrewTypeName()}{$josaYi} 퇴각했습니다.");
|
||||||
if($noRice){
|
if ($noRice) {
|
||||||
$attacker->getLogger()->pushGeneralActionLog("군량 부족으로 퇴각합니다.", ActionLogger::PLAIN);
|
$attacker->getLogger()->pushGeneralActionLog("군량 부족으로 퇴각합니다.", ActionLogger::PLAIN);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$attacker->getLogger()->pushGeneralActionLog("퇴각했습니다.", ActionLogger::PLAIN);
|
$attacker->getLogger()->pushGeneralActionLog("퇴각했습니다.", ActionLogger::PLAIN);
|
||||||
}
|
}
|
||||||
$defender->getLogger()->pushGeneralActionLog("<Y>{$attacker->getName()}</>의 {$attacker->getCrewTypeName()}{$josaYi} 퇴각했습니다.", ActionLogger::PLAIN);
|
$defender->getLogger()->pushGeneralActionLog("<Y>{$attacker->getName()}</>의 {$attacker->getCrewTypeName()}{$josaYi} 퇴각했습니다.", ActionLogger::PLAIN);
|
||||||
@@ -388,7 +385,7 @@ function processWar_NG(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$defender->continueWar($noRice)){
|
if (!$defender->continueWar($noRice)) {
|
||||||
|
|
||||||
$attacker->logBattleResult();
|
$attacker->logBattleResult();
|
||||||
$defender->logBattleResult();
|
$defender->logBattleResult();
|
||||||
@@ -399,7 +396,7 @@ function processWar_NG(
|
|||||||
$attacker->tryWound();
|
$attacker->tryWound();
|
||||||
$defender->tryWound();
|
$defender->tryWound();
|
||||||
|
|
||||||
if($defender === $city){
|
if ($defender === $city) {
|
||||||
$attacker->addLevelExp(1000);
|
$attacker->addLevelExp(1000);
|
||||||
$conquerCity = true;
|
$conquerCity = true;
|
||||||
break;
|
break;
|
||||||
@@ -407,33 +404,30 @@ function processWar_NG(
|
|||||||
|
|
||||||
$josaYi = JosaUtil::pick($defender->getCrewTypeName(), '이');
|
$josaYi = JosaUtil::pick($defender->getCrewTypeName(), '이');
|
||||||
|
|
||||||
if($noRice){
|
if ($noRice) {
|
||||||
$logger->pushGlobalActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 패퇴했습니다.");
|
$logger->pushGlobalActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 패퇴했습니다.");
|
||||||
$attacker->getLogger()->pushGeneralActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 패퇴했습니다.", ActionLogger::PLAIN);
|
$attacker->getLogger()->pushGeneralActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 패퇴했습니다.", ActionLogger::PLAIN);
|
||||||
$defender->getLogger()->pushGeneralActionLog("군량 부족으로 패퇴합니다.", ActionLogger::PLAIN);
|
$defender->getLogger()->pushGeneralActionLog("군량 부족으로 패퇴합니다.", ActionLogger::PLAIN);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$logger->pushGlobalActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 전멸했습니다.");
|
$logger->pushGlobalActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 전멸했습니다.");
|
||||||
$attacker->getLogger()->pushGeneralActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 전멸했습니다.", ActionLogger::PLAIN);
|
$attacker->getLogger()->pushGeneralActionLog("<Y>{$defender->getName()}</>의 {$defender->getCrewTypeName()}{$josaYi} 전멸했습니다.", ActionLogger::PLAIN);
|
||||||
$defender->getLogger()->pushGeneralActionLog("전멸했습니다.", ActionLogger::PLAIN);
|
$defender->getLogger()->pushGeneralActionLog("전멸했습니다.", ActionLogger::PLAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($currPhase + 1 == $attacker->getMaxPhase()){
|
if ($currPhase + 1 == $attacker->getMaxPhase()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$defender->finishBattle();
|
$defender->finishBattle();
|
||||||
$defender = ($getNextDefender)($defender, true);
|
$defender = ($getNextDefender)($defender, true);
|
||||||
|
|
||||||
if($defender !== null && !($defender instanceof WarUnitGeneral)){
|
if ($defender !== null && !($defender instanceof WarUnitGeneral)) {
|
||||||
throw new \RuntimeException('다음 수비자를 받아오는데 실패');
|
throw new \RuntimeException('다음 수비자를 받아오는데 실패');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($currPhase == $attacker->getMaxPhase()){
|
if ($currPhase == $attacker->getMaxPhase()) {
|
||||||
//마지막 페이즈의 전투 마무리
|
//마지막 페이즈의 전투 마무리
|
||||||
$attacker->logBattleResult();
|
$attacker->logBattleResult();
|
||||||
$defender->logBattleResult();
|
$defender->logBattleResult();
|
||||||
@@ -445,9 +439,9 @@ function processWar_NG(
|
|||||||
$attacker->finishBattle();
|
$attacker->finishBattle();
|
||||||
$defender->finishBattle();
|
$defender->finishBattle();
|
||||||
|
|
||||||
if($defender instanceof WarUnitCity){
|
if ($defender instanceof WarUnitCity) {
|
||||||
$newConflict = $defender->addConflict();
|
$newConflict = $defender->addConflict();
|
||||||
if($newConflict){
|
if ($newConflict) {
|
||||||
$nationName = $attacker->getNationVar('name');
|
$nationName = $attacker->getNationVar('name');
|
||||||
$josaYi = JosaUtil::pick($nationName, '이');
|
$josaYi = JosaUtil::pick($nationName, '이');
|
||||||
$logger->pushGlobalHistoryLog("<M><b>【분쟁】</b></><D><b>{$nationName}</b></>{$josaYi} <G><b>{$defender->getName()}</b></> 공략에 가담하여 분쟁이 발생하고 있습니다.");
|
$logger->pushGlobalHistoryLog("<M><b>【분쟁】</b></><D><b>{$nationName}</b></>{$josaYi} <G><b>{$defender->getName()}</b></> 공략에 가담하여 분쟁이 발생하고 있습니다.");
|
||||||
@@ -459,33 +453,36 @@ function processWar_NG(
|
|||||||
return $conquerCity;
|
return $conquerCity;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DeleteConflict($nation) {
|
function DeleteConflict($nation)
|
||||||
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
foreach($db->queryAllLists('SELECT city, conflict FROM city WHERE conflict!=%s', '{}') as list($cityID, $rawConflict)){
|
foreach ($db->queryAllLists('SELECT city, conflict FROM city WHERE conflict!=%s', '{}') as list($cityID, $rawConflict)) {
|
||||||
$conflict = Json::decode($rawConflict);
|
$conflict = Json::decode($rawConflict);
|
||||||
|
|
||||||
if(!$conflict || !is_array($conflict)){
|
if (!$conflict || !is_array($conflict)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!key_exists($nation, $conflict)){
|
if (!key_exists($nation, $conflict)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($conflict[$nation]);
|
unset($conflict[$nation]);
|
||||||
|
|
||||||
$db->update('city', [
|
$db->update('city', [
|
||||||
'conflict'=>Json::encode($conflict)
|
'conflict' => Json::encode($conflict)
|
||||||
], 'city=%i', $cityID);
|
], 'city=%i', $cityID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConquerNation($city) : int {
|
function getConquerNation($city): int
|
||||||
|
{
|
||||||
$conflict = Json::decode($city['conflict']);
|
$conflict = Json::decode($city['conflict']);
|
||||||
return Util::array_first_key($conflict);
|
return Util::array_first_key($conflict);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConquerCity(array $admin, General $general, array $city) {
|
function ConquerCity(array $admin, General $general, array $city)
|
||||||
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
$year = $admin['year'];
|
$year = $admin['year'];
|
||||||
@@ -506,7 +503,7 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
|
|
||||||
$defenderNationLogger = new ActionLogger(0, $defenderNationID, $year, $month);
|
$defenderNationLogger = new ActionLogger(0, $defenderNationID, $year, $month);
|
||||||
|
|
||||||
if($defenderNationID) {
|
if ($defenderNationID) {
|
||||||
$defenderNationDecoration = "<D><b>{$defenderNationName}</b></>의";
|
$defenderNationDecoration = "<D><b>{$defenderNationName}</b></>의";
|
||||||
} else {
|
} else {
|
||||||
$defenderNationDecoration = "공백지인";
|
$defenderNationDecoration = "공백지인";
|
||||||
@@ -524,8 +521,29 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
|
|
||||||
$defenderNationLogger->pushNationalHistoryLog("<D><b>{$attackerNationName}</b></>의 <Y>{$attackerGeneralName}</>에 의해 <G><b>{$cityName}</b></>{$josaYiCity} <O>함락</>");
|
$defenderNationLogger->pushNationalHistoryLog("<D><b>{$attackerNationName}</b></>의 <Y>{$attackerGeneralName}</>에 의해 <G><b>{$cityName}</b></>{$josaYiCity} <O>함락</>");
|
||||||
|
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
|
// 이벤트 핸들러 동작
|
||||||
|
$e_env = null;
|
||||||
|
foreach (DB::db()->query('SELECT * FROM event WHERE target = "OCCUPY_CITY" ORDER BY `priority` DESC, `id` ASC') as $rawEvent) {
|
||||||
|
if ($e_env === null) {
|
||||||
|
$e_env = $gameStor->getAll(false);
|
||||||
|
}
|
||||||
|
$eventID = $rawEvent['id'];
|
||||||
|
$cond = Json::decode($rawEvent['condition']);
|
||||||
|
$action = Json::decode($rawEvent['action']);
|
||||||
|
$event = new Event\EventHandler($cond, $action);
|
||||||
|
$e_env['currentEventID'] = $eventID;
|
||||||
|
|
||||||
|
$event->tryRunEvent($e_env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($e_env !== null) {
|
||||||
|
$gameStor->resetCache();
|
||||||
|
}
|
||||||
|
|
||||||
// 국가 멸망시
|
// 국가 멸망시
|
||||||
if($defenderNationID && $db->queryFirstField('SELECT count(city) FROM city WHERE nation = %i', $defenderNationID) === 1) {
|
if ($defenderNationID && $db->queryFirstField('SELECT count(city) FROM city WHERE nation = %i', $defenderNationID) === 1) {
|
||||||
$defenderNationLogger->flush();
|
$defenderNationLogger->flush();
|
||||||
unset($defenderNationLogger);
|
unset($defenderNationLogger);
|
||||||
|
|
||||||
@@ -545,17 +563,17 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
|
|
||||||
$loseGeneralGold = 0;
|
$loseGeneralGold = 0;
|
||||||
$loseGeneralRice = 0;
|
$loseGeneralRice = 0;
|
||||||
foreach($oldNationGenerals as $oldGeneral){
|
foreach ($oldNationGenerals as $oldGeneral) {
|
||||||
$loseGold = intdiv($oldGeneral->getVar('gold') * (rand()%30+20), 100);
|
$loseGold = intdiv($oldGeneral->getVar('gold') * (rand() % 30 + 20), 100);
|
||||||
$loseRice = intdiv($oldGeneral->getVar('rice') * (rand()%30+20), 100);
|
$loseRice = intdiv($oldGeneral->getVar('rice') * (rand() % 30 + 20), 100);
|
||||||
$oldGeneral->getLogger()->pushGeneralActionLog(
|
$oldGeneral->getLogger()->pushGeneralActionLog(
|
||||||
"도주하며 금<C>$loseGold</> 쌀<C>$loseRice</>을 분실했습니다.",
|
"도주하며 금<C>$loseGold</> 쌀<C>$loseRice</>을 분실했습니다.",
|
||||||
ActionLogger::PLAIN
|
ActionLogger::PLAIN
|
||||||
);
|
);
|
||||||
$oldGeneral->increaseVar('gold', -$loseGold);
|
$oldGeneral->increaseVar('gold', -$loseGold);
|
||||||
$oldGeneral->increaseVar('rice', -$loseRice);
|
$oldGeneral->increaseVar('rice', -$loseRice);
|
||||||
$oldGeneral->addExperience(-$oldGeneral->getVar('experience')*0.1, false);
|
$oldGeneral->addExperience(-$oldGeneral->getVar('experience') * 0.1, false);
|
||||||
$oldGeneral->addDedication(-$oldGeneral->getVar('dedication')*0.5, false);
|
$oldGeneral->addDedication(-$oldGeneral->getVar('dedication') * 0.5, false);
|
||||||
|
|
||||||
$loseGeneralGold += $loseGold;
|
$loseGeneralGold += $loseGold;
|
||||||
$loseGeneralRice += $loseRice;
|
$loseGeneralRice += $loseRice;
|
||||||
@@ -563,21 +581,21 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
$oldGeneral->applyDB($db);
|
$oldGeneral->applyDB($db);
|
||||||
|
|
||||||
//모두 등용장 발부
|
//모두 등용장 발부
|
||||||
if($admin['join_mode'] != 'onlyRandom' && Util::randBool(0.5)) {
|
if ($admin['join_mode'] != 'onlyRandom' && Util::randBool(0.5)) {
|
||||||
$msg = ScoutMessage::buildScoutMessage($attackerID, $oldGeneral->getID());
|
$msg = ScoutMessage::buildScoutMessage($attackerID, $oldGeneral->getID());
|
||||||
if($msg){
|
if ($msg) {
|
||||||
$msg->send(true);
|
$msg->send(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//NPC인 경우 일정 확률로 임관(엔장, 인재, 의병)
|
//NPC인 경우 일정 확률로 임관(엔장, 인재, 의병)
|
||||||
$npcType = $oldGeneral->getNPCType();
|
$npcType = $oldGeneral->getNPCType();
|
||||||
if($admin['join_mode'] != 'onlyRandom' && 2 <= $npcType && $npcType <= 8 && $npcType != 5 && Util::randBool(GameConst::$joinRuinedNPCProp)) {
|
if ($admin['join_mode'] != 'onlyRandom' && 2 <= $npcType && $npcType <= 8 && $npcType != 5 && Util::randBool(GameConst::$joinRuinedNPCProp)) {
|
||||||
$cmd = buildGeneralCommandClass('che_임관', $oldGeneral, $admin, [
|
$cmd = buildGeneralCommandClass('che_임관', $oldGeneral, $admin, [
|
||||||
'destNationID'=>$attackerNationID
|
'destNationID' => $attackerNationID
|
||||||
]);
|
]);
|
||||||
$joinTurn = Util::randRangeInt(0, 12);
|
$joinTurn = Util::randRangeInt(0, 12);
|
||||||
if($joinTurn){
|
if ($joinTurn) {
|
||||||
_setGeneralCommand(buildGeneralCommandClass('che_견문', $oldGeneral, $admin), iterator_to_array(Util::range($joinTurn)));
|
_setGeneralCommand(buildGeneralCommandClass('che_견문', $oldGeneral, $admin), iterator_to_array(Util::range($joinTurn)));
|
||||||
}
|
}
|
||||||
_setGeneralCommand($cmd, [$joinTurn]);
|
_setGeneralCommand($cmd, [$joinTurn]);
|
||||||
@@ -596,37 +614,56 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
|
|
||||||
// 기본량 제외 금쌀50% + 장수들 분실 금쌀50% 흡수
|
// 기본량 제외 금쌀50% + 장수들 분실 금쌀50% 흡수
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'gold'=>$db->sqleval('gold + %i', $loseNationGold),
|
'gold' => $db->sqleval('gold + %i', $loseNationGold),
|
||||||
'rice'=>$db->sqleval('rice + %i', $loseNationRice),
|
'rice' => $db->sqleval('rice + %i', $loseNationRice),
|
||||||
], 'nation=%i', $attackerNationID);
|
], 'nation=%i', $attackerNationID);
|
||||||
|
|
||||||
//아국 수뇌부에게 로그 전달
|
//아국 수뇌부에게 로그 전달
|
||||||
$loseNationGoldText = number_format($loseNationGold);
|
$loseNationGoldText = number_format($loseNationGold);
|
||||||
$loseNationRiceText = number_format($loseNationRice);
|
$loseNationRiceText = number_format($loseNationRice);
|
||||||
$resourceLog = "<D><b>{$defenderNationName}</b></> 정복으로 금<C>{$loseNationGoldText}</> 쌀<C>{$loseNationRiceText}</>을 획득했습니다.";
|
$resourceLog = "<D><b>{$defenderNationName}</b></> 정복으로 금<C>{$loseNationGoldText}</> 쌀<C>{$loseNationRiceText}</>을 획득했습니다.";
|
||||||
foreach($db->queryFirstColumn(
|
foreach ($db->queryFirstColumn(
|
||||||
'SELECT no FROM general WHERE nation=%i AND officer_level>=5', $attackerNationID
|
'SELECT no FROM general WHERE nation=%i AND officer_level>=5',
|
||||||
) as $attackerChiefID
|
$attackerNationID
|
||||||
){
|
) as $attackerChiefID) {
|
||||||
if($attackerChiefID == $attackerID){
|
if ($attackerChiefID == $attackerID) {
|
||||||
$attackerLogger->pushGeneralActionLog($resourceLog, ActionLogger::PLAIN);
|
$attackerLogger->pushGeneralActionLog($resourceLog, ActionLogger::PLAIN);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$chiefLogger = new ActionLogger($attackerChiefID, $attackerNationID, $year, $month);
|
$chiefLogger = new ActionLogger($attackerChiefID, $attackerNationID, $year, $month);
|
||||||
$chiefLogger->pushGeneralActionLog($resourceLog, ActionLogger::PLAIN);
|
$chiefLogger->pushGeneralActionLog($resourceLog, ActionLogger::PLAIN);
|
||||||
$chiefLogger->flush();
|
$chiefLogger->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 멸망이 아니면
|
|
||||||
|
// 이벤트 핸들러 동작
|
||||||
|
$e_env = null;
|
||||||
|
foreach (DB::db()->query('SELECT * FROM event WHERE target = "DESTROY_NATION" ORDER BY `priority` DESC, `id` ASC') as $rawEvent) {
|
||||||
|
if ($e_env === null) {
|
||||||
|
$e_env = $gameStor->getAll(false);
|
||||||
|
}
|
||||||
|
$eventID = $rawEvent['id'];
|
||||||
|
$cond = Json::decode($rawEvent['condition']);
|
||||||
|
$action = Json::decode($rawEvent['action']);
|
||||||
|
$event = new Event\EventHandler($cond, $action);
|
||||||
|
$e_env['currentEventID'] = $eventID;
|
||||||
|
|
||||||
|
$event->tryRunEvent($e_env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($e_env !== null) {
|
||||||
|
$gameStor->resetCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 멸망이 아니면
|
||||||
} else {
|
} else {
|
||||||
// 태수,군사,종사은 일반으로...
|
// 태수,군사,종사은 일반으로...
|
||||||
$db->update('general',[
|
$db->update('general', [
|
||||||
'officer_level'=>1,
|
'officer_level' => 1,
|
||||||
'officer_city'=>0,
|
'officer_city' => 0,
|
||||||
], 'officer_city = %i',$cityID);
|
], 'officer_city = %i', $cityID);
|
||||||
|
|
||||||
//수도였으면 긴급 천도
|
//수도였으면 긴급 천도
|
||||||
if($defenderNationID && $defenderStaticNation['capital'] == $cityID) {
|
if ($defenderNationID && $defenderStaticNation['capital'] == $cityID) {
|
||||||
$minCity = findNextCapital($cityID, $defenderNationID);
|
$minCity = findNextCapital($cityID, $defenderNationID);
|
||||||
|
|
||||||
$minCityName = CityConst::byID($minCity)->name;
|
$minCityName = CityConst::byID($minCity)->name;
|
||||||
@@ -636,10 +673,10 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
|
|
||||||
$moveLog = "수도가 함락되어 <G><b>$minCityName</b></>으로 <M>긴급천도</>합니다.";
|
$moveLog = "수도가 함락되어 <G><b>$minCityName</b></>으로 <M>긴급천도</>합니다.";
|
||||||
//아국 수뇌부에게 로그 전달
|
//아국 수뇌부에게 로그 전달
|
||||||
foreach($db->queryFirstColumn(
|
foreach ($db->queryFirstColumn(
|
||||||
'SELECT no FROM general WHERE nation=%i AND officer_level>=5', $defenderNationID
|
'SELECT no FROM general WHERE nation=%i AND officer_level>=5',
|
||||||
) as $defenderChiefID
|
$defenderNationID
|
||||||
){
|
) as $defenderChiefID) {
|
||||||
$chiefLogger = new ActionLogger($defenderChiefID, $defenderNationID, $year, $month);
|
$chiefLogger = new ActionLogger($defenderChiefID, $defenderNationID, $year, $month);
|
||||||
$chiefLogger->pushGeneralActionLog($moveLog, ActionLogger::PLAIN);
|
$chiefLogger->pushGeneralActionLog($moveLog, ActionLogger::PLAIN);
|
||||||
$chiefLogger->flush();
|
$chiefLogger->flush();
|
||||||
@@ -647,22 +684,22 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
|
|
||||||
//천도
|
//천도
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'capital'=>$minCity,
|
'capital' => $minCity,
|
||||||
'gold'=>$db->sqleval('gold * 0.5'),
|
'gold' => $db->sqleval('gold * 0.5'),
|
||||||
'rice'=>$db->sqleval('rice * 0.5'),
|
'rice' => $db->sqleval('rice * 0.5'),
|
||||||
], 'nation=%i', $defenderNationID);
|
], 'nation=%i', $defenderNationID);
|
||||||
//보급도시로 만듬
|
//보급도시로 만듬
|
||||||
$db->update('city', [
|
$db->update('city', [
|
||||||
'supply'=>1
|
'supply' => 1
|
||||||
], 'city=%i', $minCity);
|
], 'city=%i', $minCity);
|
||||||
//수뇌부 이동
|
//수뇌부 이동
|
||||||
$db->update('general', [
|
$db->update('general', [
|
||||||
'city'=>$minCity
|
'city' => $minCity
|
||||||
], 'nation=%i AND officer_level>=5',$defenderNationID);
|
], 'nation=%i AND officer_level>=5', $defenderNationID);
|
||||||
//장수 사기 감소
|
//장수 사기 감소
|
||||||
$db->update('general', [
|
$db->update('general', [
|
||||||
'atmos'=>$db->sqleval('atmos*0.8')
|
'atmos' => $db->sqleval('atmos*0.8')
|
||||||
], 'nation=%i',$defenderNationID);
|
], 'nation=%i', $defenderNationID);
|
||||||
|
|
||||||
refreshNationStaticInfo();
|
refreshNationStaticInfo();
|
||||||
}
|
}
|
||||||
@@ -673,10 +710,9 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
if ($conquerNation == $attackerNationID) {
|
if ($conquerNation == $attackerNationID) {
|
||||||
// 이동
|
// 이동
|
||||||
$db->update('general', [
|
$db->update('general', [
|
||||||
'city'=>$cityID
|
'city' => $cityID
|
||||||
], 'no=%i', $attackerID);
|
], 'no=%i', $attackerID);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$conquerNationName = getNationStaticInfo($conquerNation)['name'];
|
$conquerNationName = getNationStaticInfo($conquerNation)['name'];
|
||||||
$conquerNationLogger = new ActionLogger(0, $conquerNation, $year, $month);
|
$conquerNationLogger = new ActionLogger(0, $conquerNation, $year, $month);
|
||||||
|
|
||||||
@@ -690,16 +726,16 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$query = [
|
$query = [
|
||||||
'supply'=>1,
|
'supply' => 1,
|
||||||
'term'=>0,
|
'term' => 0,
|
||||||
'conflict'=>'{}',
|
'conflict' => '{}',
|
||||||
'agri'=>$db->sqleval('agri*0.7'),
|
'agri' => $db->sqleval('agri*0.7'),
|
||||||
'comm'=>$db->sqleval('comm*0.7'),
|
'comm' => $db->sqleval('comm*0.7'),
|
||||||
'secu'=>$db->sqleval('secu*0.7'),
|
'secu' => $db->sqleval('secu*0.7'),
|
||||||
'nation'=>$conquerNation,
|
'nation' => $conquerNation,
|
||||||
'officer_set'=>0,
|
'officer_set' => 0,
|
||||||
];
|
];
|
||||||
if($city['level'] > 3) {
|
if ($city['level'] > 3) {
|
||||||
$query['def'] = 1000;
|
$query['def'] = 1000;
|
||||||
$query['wall'] = 1000;
|
$query['wall'] = 1000;
|
||||||
} else {
|
} else {
|
||||||
@@ -717,43 +753,42 @@ function ConquerCity(array $admin, General $general, array $city) {
|
|||||||
|
|
||||||
$nearNationsID[] = $conquerNation;
|
$nearNationsID[] = $conquerNation;
|
||||||
$nearNationsID = array_unique($nearNationsID);
|
$nearNationsID = array_unique($nearNationsID);
|
||||||
foreach($nearNationsID as $nationNationID){
|
foreach ($nearNationsID as $nationNationID) {
|
||||||
SetNationFront($nationNationID);
|
SetNationFront($nationNationID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findNextCapital(int $capitalID, int $nationID):int{
|
function findNextCapital(int $capitalID, int $nationID): int
|
||||||
|
{
|
||||||
$distList = searchDistance($capitalID, 99, true);
|
$distList = searchDistance($capitalID, 99, true);
|
||||||
|
|
||||||
$cities = [];
|
$cities = [];
|
||||||
foreach(
|
foreach (DB::db()->query(
|
||||||
DB::db()->query(
|
|
||||||
'SELECT city, pop FROM city WHERE nation=%i and city!=%i',
|
'SELECT city, pop FROM city WHERE nation=%i and city!=%i',
|
||||||
$nationID,
|
$nationID,
|
||||||
$capitalID
|
$capitalID
|
||||||
) as $row
|
) as $row) {
|
||||||
){
|
|
||||||
$cities[$row['city']] = $row['pop'];
|
$cities[$row['city']] = $row['pop'];
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach($distList as $dist=>$distSubList){
|
foreach ($distList as $dist => $distSubList) {
|
||||||
$maxCityPop = 0;
|
$maxCityPop = 0;
|
||||||
$minCity = 0;
|
$minCity = 0;
|
||||||
|
|
||||||
foreach($distSubList as $cityID){
|
foreach ($distSubList as $cityID) {
|
||||||
if(!key_exists($cityID, $cities)){
|
if (!key_exists($cityID, $cities)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$cityPop = $cities[$cityID];
|
$cityPop = $cities[$cityID];
|
||||||
|
|
||||||
if($cityPop < $maxCityPop){
|
if ($cityPop < $maxCityPop) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$minCity = $cityID;
|
$minCity = $cityID;
|
||||||
$maxCityPop = $cityPop;
|
$maxCityPop = $cityPop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($minCity){
|
if ($minCity) {
|
||||||
return $minCity;
|
return $minCity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Betting;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\Betting;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\DTO\BettingItem;
|
||||||
|
use sammo\Validator;
|
||||||
|
use sammo\GameConst;
|
||||||
|
use sammo\KVStorage;
|
||||||
|
use sammo\UserLogger;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
|
class Bet extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('required', [
|
||||||
|
'bettingID',
|
||||||
|
'bettingType',
|
||||||
|
'amount'
|
||||||
|
])
|
||||||
|
->rule('integer', 'bettingID')
|
||||||
|
->rule('integerArray', 'bettingType')
|
||||||
|
->rule('integer', 'amount')
|
||||||
|
->rule('min', 'amount', 1);
|
||||||
|
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
/** @var int */
|
||||||
|
$bettingID = $this->args['bettingID'];
|
||||||
|
/** @var int[] */
|
||||||
|
$bettingType = $this->args['bettingType'];
|
||||||
|
/** @var int */
|
||||||
|
$amount = $this->args['amount'];
|
||||||
|
|
||||||
|
$bettingHelper = new Betting($bettingID);
|
||||||
|
try{
|
||||||
|
$bettingHelper->bet($session->generalID, $session->userID, $bettingType, $amount);
|
||||||
|
}
|
||||||
|
catch(\Throwable $e){
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'result' => true
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Betting;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\DTO\BettingInfo;
|
||||||
|
use sammo\General;
|
||||||
|
use sammo\KVStorage;
|
||||||
|
use sammo\Util;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
|
use function sammo\increaseRefresh;
|
||||||
|
|
||||||
|
class GetBettingDetail extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('required', [
|
||||||
|
'betting_id',
|
||||||
|
])
|
||||||
|
->rule('integer', 'betting_id');
|
||||||
|
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
$bettingID = $this->args['betting_id'];
|
||||||
|
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
$bettingStor = KVStorage::getStorage($db, 'betting');
|
||||||
|
$rawBettingInfo = $bettingStor->getValue("id_{$bettingID}");
|
||||||
|
if($rawBettingInfo === null){
|
||||||
|
return '해당 베팅이 없습니다';
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$bettingInfo = new BettingInfo($rawBettingInfo);
|
||||||
|
}
|
||||||
|
catch(\Error $e){
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
|
||||||
|
|
||||||
|
$bettingDetail = [];
|
||||||
|
|
||||||
|
foreach ($db->queryAllLists(
|
||||||
|
'SELECT betting_type, sum(amount) as sum_amount FROM ng_betting WHERE betting_id = %i GROUP BY betting_type',
|
||||||
|
$bettingID
|
||||||
|
) as [$bettingType, $amount]) {
|
||||||
|
$bettingDetail[] = [$bettingType, Util::toInt($amount)];
|
||||||
|
}
|
||||||
|
|
||||||
|
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
|
||||||
|
|
||||||
|
$myBetting = [];
|
||||||
|
foreach($db->queryAllLists(
|
||||||
|
'SELECT betting_type, sum(amount) as sum_amount FROM ng_betting WHERE betting_id = %i AND user_id = %i GROUP BY betting_type',
|
||||||
|
$bettingID, $session->userID
|
||||||
|
) as [$bettingType, $amount]){
|
||||||
|
$myBetting[] = [$bettingType, Util::toInt($amount)];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($bettingInfo->reqInheritancePoint){
|
||||||
|
$inheritStor = KVStorage::getStorage($db, "inheritance_{$session->userID}");
|
||||||
|
$remainPoint = ($inheritStor->getValue('previous') ?? [0,0])[0];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$remainPoint = $db->queryFirstField('SELECT gold FROM general WHERE no = %i', $session->generalID)??0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'result' => true,
|
||||||
|
'bettingInfo' => $rawBettingInfo,
|
||||||
|
'bettingDetail' => $bettingDetail,
|
||||||
|
'myBetting' => $myBetting,
|
||||||
|
'remainPoint' => $remainPoint,
|
||||||
|
'year' => $year,
|
||||||
|
'month' => $month,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Betting;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\DTO\BettingInfo;
|
||||||
|
use sammo\KVStorage;
|
||||||
|
|
||||||
|
use function sammo\checkLimit;
|
||||||
|
use function sammo\increaseRefresh;
|
||||||
|
|
||||||
|
class GetBettingList extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
increaseRefresh("베팅장", 1);
|
||||||
|
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
$bettingStor = KVStorage::getStorage($db, 'betting');
|
||||||
|
$userID = $session->userID;
|
||||||
|
|
||||||
|
$me = $db->queryFirstRow('SELECT no,nation,officer_level,con,turntime,belong,penalty,permission FROM general WHERE owner=%i', $userID);
|
||||||
|
$con = checkLimit($me['con']);
|
||||||
|
if ($con >= 2) {
|
||||||
|
return "접속 제한중입니다.";
|
||||||
|
}
|
||||||
|
|
||||||
|
$bettingList = [];
|
||||||
|
foreach ($bettingStor->getAll() as $_key => $rawItem) {
|
||||||
|
$item = new BettingInfo($rawItem);
|
||||||
|
unset($rawItem['candidates']);
|
||||||
|
$bettingList[$item->id] = $rawItem;
|
||||||
|
$bettingList[$item->id]['totalAmount'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
|
||||||
|
|
||||||
|
if(!$bettingList){
|
||||||
|
return [
|
||||||
|
'result' => true,
|
||||||
|
'bettingList' => $bettingList,
|
||||||
|
'year' => $year,
|
||||||
|
'month' => $month,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$bettingIDList = array_keys($bettingList);
|
||||||
|
// XXX: query cache만 믿고 sum을 하는 짓을 벌여도 되는가?
|
||||||
|
foreach ($db->queryAllLists(
|
||||||
|
'SELECT betting_id, sum(amount) as total_amount FROM ng_betting WHERE betting_id IN %li GROUP BY betting_id',
|
||||||
|
$bettingIDList
|
||||||
|
) as [$bettingID, $totalAmount]) {
|
||||||
|
if (!key_exists($bettingID, $bettingList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$bettingList[$bettingID]['totalAmount'] = $totalAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'result' => true,
|
||||||
|
'bettingList' => $bettingList,
|
||||||
|
'year' => $year,
|
||||||
|
'month' => $month,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Global;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
|
||||||
|
use function sammo\getAllNationStaticInfo;
|
||||||
|
use function sammo\getNationStaticInfo;
|
||||||
|
|
||||||
|
class GetNationList extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_LOGIN | static::REQ_READ_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$nations = getAllNationStaticInfo();
|
||||||
|
uasort($nations, function ($lhs, $rhs) {
|
||||||
|
return $rhs['power'] <=> $lhs['power'];
|
||||||
|
});
|
||||||
|
|
||||||
|
$nations[0] = getNationStaticInfo(0);
|
||||||
|
|
||||||
|
foreach ($db->query('SELECT npc,name,nation,officer_level,permission FROM `general` ORDER BY dedication DESC') as $general) {
|
||||||
|
$nationID = $general['nation'];
|
||||||
|
|
||||||
|
$permission = $general['permission'];
|
||||||
|
if($permission != 'auditor' && $permission != 'ambassador'){
|
||||||
|
unset($general['permission']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($general['officer_level'] < 5){
|
||||||
|
$general['officer_level'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!key_exists('generals', $nations[$nationID])) {
|
||||||
|
$nations[$nationID]['generals'] = [];
|
||||||
|
}
|
||||||
|
$nations[$nationID]['generals'][] = $general;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($db->queryAllLists('SELECT city, name, nation FROM city') as [$cityID, $cityName, $nationID]) {
|
||||||
|
if (!key_exists('cities', $nations[$nationID])) {
|
||||||
|
$nations[$nationID]['cities'] = [];
|
||||||
|
}
|
||||||
|
$nations[$nationID]['cities'][$cityID] = $cityName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'result' => true,
|
||||||
|
'nations' => $nations,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,7 +53,7 @@ class SetSecretLimit extends \sammo\BaseAPI
|
|||||||
$nationID = $me['nation'];
|
$nationID = $me['nation'];
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'bill' => $amount
|
'secretlimit' => $amount
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class None extends \sammo\BaseItem{
|
class None extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 0;
|
|
||||||
protected $name = '-';
|
protected $name = '-';
|
||||||
protected $info = null;
|
protected $info = null;
|
||||||
protected $cost = 0;
|
protected $cost = 0;
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
|
||||||
|
class che_간파_노군입산부 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '노군입산부';
|
||||||
|
protected $name = '노군입산부(간파)';
|
||||||
|
protected $info = '[전투] 상대 회피 확률 -30%p, 상대 필살 확률 -10%p';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcOpposeStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'warAvoidRatio'){
|
||||||
|
return $value - 0.30;
|
||||||
|
}
|
||||||
|
if($statName === 'warCriticalRatio'){
|
||||||
|
return $value - 0.10;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityHelper;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
use sammo\WarUnitTrigger\che_격노시도;
|
||||||
|
use sammo\WarUnitTrigger\che_격노발동;
|
||||||
|
|
||||||
|
class che_격노_구정신단경 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '구정신단경';
|
||||||
|
protected $name = '구정신단경(격노)';
|
||||||
|
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가)';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_격노시도($unit, che_격노시도::TYPE_ITEM),
|
||||||
|
new che_격노발동($unit)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_계략_삼략 extends \sammo\BaseItem{
|
class che_계략_삼략 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 22;
|
|
||||||
protected $rawName = '삼략';
|
protected $rawName = '삼략';
|
||||||
protected $name = '삼략(계략)';
|
protected $name = '삼략(계략)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p<br>[전투] 계략 시도 확률 +10%p, 계략 성공 확률 +10%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p<br>[전투] 계략 시도 확률 +10%p, 계략 성공 확률 +10%p';
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_계략_육도 extends \sammo\BaseItem{
|
class che_계략_육도 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 21;
|
|
||||||
protected $rawName = '육도';
|
protected $rawName = '육도';
|
||||||
protected $name = '육도(계략)';
|
protected $name = '육도(계략)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p<br>[전투] 계략 시도 확률 +10%p, 계략 성공 확률 +10%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p<br>[전투] 계략 시도 확률 +10%p, 계략 성공 확률 +10%p';
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_계략_이추 extends \sammo\BaseItem{
|
class che_계략_이추 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 5;
|
|
||||||
protected $rawName = '이추';
|
protected $rawName = '이추';
|
||||||
protected $name = '이추(계략)';
|
protected $name = '이추(계략)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p';
|
||||||
@@ -22,7 +21,7 @@ class che_계략_이추 extends \sammo\BaseItem{
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isConsumableNow(string $actionType, string $command):bool{
|
function tryConsumeNow(General $general, string $actionType, string $command):bool{
|
||||||
if($actionType == 'GeneralCommand' && $command == '계략'){
|
if($actionType == 'GeneralCommand' && $command == '계략'){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_계략_향낭 extends \sammo\BaseItem{
|
class che_계략_향낭 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 5;
|
|
||||||
protected $rawName = '항냥';
|
protected $rawName = '항냥';
|
||||||
protected $name = '항냥(계략)';
|
protected $name = '항냥(계략)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +50%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +50%p';
|
||||||
@@ -22,7 +21,7 @@ class che_계략_향낭 extends \sammo\BaseItem{
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isConsumableNow(string $actionType, string $command):bool{
|
function tryConsumeNow(General $general, string $actionType, string $command):bool{
|
||||||
if($actionType == 'GeneralCommand' && $command == '계략'){
|
if($actionType == 'GeneralCommand' && $command == '계략'){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityHelper;
|
||||||
|
use \sammo\GameUnitConst;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
use \sammo\WarUnitCity;
|
||||||
|
|
||||||
|
class che_공성_묵자 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '묵자';
|
||||||
|
protected $name = '묵자(공성)';
|
||||||
|
protected $info = '[전투] 성벽 공격 시 대미지 +50%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||||
|
if($unit->getOppose() instanceof WarUnitCity){
|
||||||
|
return [1.5, 1];
|
||||||
|
}
|
||||||
|
return [1, 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
|
class che_내정_납금박산로 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '납금박산로';
|
||||||
|
protected $name = '납금박산로(내정)';
|
||||||
|
protected $info = '[내정] 내정 성공률 +20%p';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStrategic(string $turnType, string $varType, $value){
|
||||||
|
if(in_array($turnType, ['상업', '농업', '기술', '성벽', '수비', '치안', '민심', '인구'])){
|
||||||
|
if($varType == 'success') return $value + 0.2;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\WarUnit;
|
||||||
|
|
||||||
|
class che_농성_위공자병법 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '위공자병법';
|
||||||
|
protected $name = '위공자병법(농성)';
|
||||||
|
protected $info = '[계략] 장수 주둔 도시 화계·탈취·파괴·선동 : 성공률 -30%p<br>[전투] 상대 계략 시도 확률 -10%p, 상대 계략 성공 확률 -10%p';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'sabotageDefence'){
|
||||||
|
return $value + 0.3;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onCalcOpposeStat(General $general, string $statName, $value, $aux = null)
|
||||||
|
{
|
||||||
|
if($statName === 'warMagicTrialProb'){
|
||||||
|
return $value - 0.1;
|
||||||
|
}
|
||||||
|
if($statName === 'warMagicSuccessProb'){
|
||||||
|
return $value - 0.1;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\WarUnit;
|
||||||
|
|
||||||
|
class che_농성_주서음부 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '주서음부';
|
||||||
|
protected $name = '주서음부(농성)';
|
||||||
|
protected $info = '[계략] 장수 주둔 도시 화계·탈취·파괴·선동 : 성공률 -30%p<br>[전투] 상대 계략 시도 확률 -10%p, 상대 계략 성공 확률 -10%p';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'sabotageDefence'){
|
||||||
|
return $value + 0.3;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onCalcOpposeStat(General $general, string $statName, $value, $aux = null)
|
||||||
|
{
|
||||||
|
if($statName === 'warMagicTrialProb'){
|
||||||
|
return $value - 0.1;
|
||||||
|
}
|
||||||
|
if($statName === 'warMagicSuccessProb'){
|
||||||
|
return $value - 0.1;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\GameConst;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\KVStorage;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
|
class che_능력치_무력_두강주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '두강주';
|
||||||
|
protected $name = '두강주(무력)';
|
||||||
|
protected $info = '[능력치] 무력 +5 +(5년마다 +1)';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'strength'){
|
||||||
|
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||||
|
[$year, $startYear] = $gameStor->getValuesAsArray(['year', 'startyear']);
|
||||||
|
$relYear = $year - $startYear;
|
||||||
|
return $value + 5 + Util::valueFit(intdiv($relYear, 5), 0, GameConst::$maxTechLevel);
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\GameConst;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\KVStorage;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
|
class che_능력치_지력_이강주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '이강주';
|
||||||
|
protected $name = '이강주(지력)';
|
||||||
|
protected $info = '[능력치] 지력 +5 +(5년마다 +1)';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'intel'){
|
||||||
|
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||||
|
[$year, $startYear] = $gameStor->getValuesAsArray(['year', 'startyear']);
|
||||||
|
$relYear = $year - $startYear;
|
||||||
|
return $value + 5 + Util::valueFit(intdiv($relYear, 5), 0, GameConst::$maxTechLevel);
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\GameConst;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\KVStorage;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
|
class che_능력치_통솔_보령압주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '보령압주';
|
||||||
|
protected $name = '보령압주(통솔)';
|
||||||
|
protected $info = '[능력치] 통솔 +5 +(5년마다 +1)';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'leadership'){
|
||||||
|
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||||
|
[$year, $startYear] = $gameStor->getValuesAsArray(['year', 'startyear']);
|
||||||
|
$relYear = $year - $startYear;
|
||||||
|
return $value + 5 + Util::valueFit(intdiv($relYear, 5), 0, GameConst::$maxTechLevel);
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ class che_명마_12_옥란백용구 extends \sammo\BaseStatItem{
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->info .= "<br>[전투] 남은 병력에 따라 회피 확률 증가. 최대 +30%p";
|
$this->info .= "<br>[전투] 남은 병력이 적을수록 회피 확률 증가. 최대 +30%p";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux = null)
|
public function onCalcStat(General $general, string $statName, $value, $aux = null)
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
|
||||||
|
class che_명성_구석 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '구석';
|
||||||
|
protected $name = '구석(명성)';
|
||||||
|
protected $info = '명성 +15%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName == 'experience'){
|
||||||
|
return $value * 1.15;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,10 +12,9 @@ use \sammo\WarUnitTrigger\che_반계발동;
|
|||||||
|
|
||||||
class che_반계_백우선 extends \sammo\BaseItem{
|
class che_반계_백우선 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 45;
|
|
||||||
protected $rawName = '백우선';
|
protected $rawName = '백우선';
|
||||||
protected $name = '백우선(반계)';
|
protected $name = '백우선(반계)';
|
||||||
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 20% 확률로 되돌림';
|
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 30% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%), 소모 군량 +10%';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
@@ -27,9 +26,19 @@ class che_반계_백우선 extends \sammo\BaseItem{
|
|||||||
return $value - $debuff;
|
return $value - $debuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName == 'killRice'){
|
||||||
|
return $value * 1.1;
|
||||||
|
}
|
||||||
|
if($statName === 'warMagicSuccessDamage' && $aux === '반목'){
|
||||||
|
return $value + 0.4;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new che_반계시도($unit, BaseWarUnitTrigger::TYPE_ITEM +BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE*301, 0.2),
|
new che_반계시도($unit, BaseWarUnitTrigger::TYPE_ITEM +BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE*301, 0.3),
|
||||||
new che_반계발동($unit)
|
new che_반계발동($unit)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ use \sammo\WarUnitTrigger\che_반계발동;
|
|||||||
|
|
||||||
class che_반계_파초선 extends \sammo\BaseItem{
|
class che_반계_파초선 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 45;
|
|
||||||
protected $rawName = '파초선';
|
protected $rawName = '파초선';
|
||||||
protected $name = '파초선(반계)';
|
protected $name = '파초선(반계)';
|
||||||
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 20% 확률로 되돌림';
|
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 20% 확률로 되돌림';
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use sammo\BaseWarUnitTrigger;
|
||||||
|
use sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTrigger\che_저지발동;
|
||||||
|
use sammo\WarUnitTrigger\WarActivateSkills;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
|
||||||
|
class che_반계저지_박혁론 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '박혁론';
|
||||||
|
protected $name = '박혁론(반계저지)';
|
||||||
|
protected $info = '[전투] 상대의 계략 되돌림 불가';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '반계불가'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use sammo\DB;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\KVStorage;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
|
class che_보물_도기 extends \sammo\BaseItem
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $rawName = '도기';
|
||||||
|
protected $name = '도기(보물)';
|
||||||
|
protected $info = '[개인] 판매 시 국고에 금, 쌀 중 하나를 추가 (+10,000, 5년마다 +10,000)';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onArbitraryAction(General $general, string $actionType, ?string $phase = null, $aux = null): ?array
|
||||||
|
{
|
||||||
|
if ($aux === null){
|
||||||
|
return $aux;
|
||||||
|
}
|
||||||
|
if ($actionType !== '장비매매') {
|
||||||
|
return $aux;
|
||||||
|
}
|
||||||
|
if ($phase !== '판매') {
|
||||||
|
return $aux;
|
||||||
|
}
|
||||||
|
if (($aux['itemCode']??'') !== Util::getClassNameFromObj($this)){
|
||||||
|
return $aux;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
[$year, $startYear] = $gameStor->getValuesAsArray(['year', 'startyear']);
|
||||||
|
$relYear = $year - $startYear;
|
||||||
|
|
||||||
|
$score = 10000 * (1 + Util::valueFit(intdiv($relYear, 5), 0));
|
||||||
|
|
||||||
|
[$resName, $resKey] = Util::choiceRandom([
|
||||||
|
['금', 'gold'],
|
||||||
|
['쌀', 'rice']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
$resKey => $db->sqleval('%b + %i', $resKey, $score)
|
||||||
|
]);
|
||||||
|
|
||||||
|
$score = Util::round($score);
|
||||||
|
$scoreText = number_format($score, 0);
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
$logger->pushGeneralActionLog("국고에 {$resName} <C>{$scoreText}</>을 보충합니다.");
|
||||||
|
return $aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,13 +15,20 @@ use sammo\WarUnitTrigger\WarActivateSkills;
|
|||||||
class che_부적_태현청생부 extends \sammo\BaseItem
|
class che_부적_태현청생부 extends \sammo\BaseItem
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $id = 9;
|
|
||||||
protected $rawName = '태현청생부';
|
protected $rawName = '태현청생부';
|
||||||
protected $name = '태현청생부(부적)';
|
protected $name = '태현청생부(부적)';
|
||||||
protected $info = '[전투] 저격 불가, 부상 없음';
|
protected $info = '[전투] 저격 불가, 부상 없음';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux = null)
|
||||||
|
{
|
||||||
|
if($statName === 'injuryProb'){
|
||||||
|
return $value -= 1;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
public function getBattleInitSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
public function getBattleInitSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||||
{
|
{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\Util;
|
||||||
|
use sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTrigger\전투력보정;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
|
||||||
|
class che_불굴_상편 extends \sammo\BaseItem
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $rawName = '상편';
|
||||||
|
protected $name = '상편(불굴)';
|
||||||
|
protected $info = '[전투] 남은 병력이 적을수록 공격력 증가. 최대 +50%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||||
|
{
|
||||||
|
$leadership = $unit->getGeneral()->getLeadership();
|
||||||
|
$crew = $unit->getGeneral()->getVar('crew');
|
||||||
|
|
||||||
|
$crewRatio = Util::valueFit($crew / ($leadership * 100), 0, 1);
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new 전투력보정($unit, 1 + 0.5 * (1 - $crewRatio))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_사기_두강주 extends \sammo\BaseItem{
|
class che_사기_두강주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 15;
|
|
||||||
protected $rawName = '두강주';
|
protected $rawName = '두강주';
|
||||||
protected $name = '두강주(사기)';
|
protected $name = '두강주(사기)';
|
||||||
protected $info = '[전투] 사기 보정 +10';
|
protected $info = '[전투] 사기 보정 +10';
|
||||||
@@ -19,3 +18,5 @@ class che_사기_두강주 extends \sammo\BaseItem{
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOTE: 구버전
|
||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_사기_보령압주 extends \sammo\BaseItem{
|
class che_사기_보령압주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 16;
|
|
||||||
protected $rawName = '보령압주';
|
protected $rawName = '보령압주';
|
||||||
protected $name = '보령압주(사기)';
|
protected $name = '보령압주(사기)';
|
||||||
protected $info = '[전투] 사기 보정 +10';
|
protected $info = '[전투] 사기 보정 +10';
|
||||||
@@ -19,3 +18,5 @@ class che_사기_보령압주 extends \sammo\BaseItem{
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOTE: 구버전
|
||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_사기_의적주 extends \sammo\BaseItem{
|
class che_사기_의적주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 14;
|
|
||||||
protected $rawName = '의적주';
|
protected $rawName = '의적주';
|
||||||
protected $name = '의적주(사기)';
|
protected $name = '의적주(사기)';
|
||||||
protected $info = '[전투] 사기 보정 +10';
|
protected $info = '[전투] 사기 보정 +10';
|
||||||
|
|||||||
@@ -5,16 +5,15 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_사기_초선화 extends \sammo\BaseItem{
|
class che_사기_초선화 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 20;
|
|
||||||
protected $rawName = '초선화';
|
protected $rawName = '초선화';
|
||||||
protected $name = '초선화(사기)';
|
protected $name = '초선화(사기)';
|
||||||
protected $info = '[전투] 사기 보정 +14';
|
protected $info = '[전투] 사기 보정 +15';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'bonusAtmos'){
|
if($statName === 'bonusAtmos'){
|
||||||
return $value + 14;
|
return $value + 15;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,15 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_사기_춘화첩 extends \sammo\BaseItem{
|
class che_사기_춘화첩 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 19;
|
|
||||||
protected $rawName = '춘화첩';
|
protected $rawName = '춘화첩';
|
||||||
protected $name = '춘화첩(사기)';
|
protected $name = '춘화첩(사기)';
|
||||||
protected $info = '[전투] 사기 보정 +14';
|
protected $info = '[전투] 사기 보정 +15';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'bonusAtmos'){
|
if($statName === 'bonusAtmos'){
|
||||||
return $value + 14;
|
return $value + 15;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ namespace sammo\ActionItem;
|
|||||||
use \sammo\iAction;
|
use \sammo\iAction;
|
||||||
use \sammo\General;
|
use \sammo\General;
|
||||||
use \sammo\BaseWarUnitTrigger;
|
use \sammo\BaseWarUnitTrigger;
|
||||||
|
use sammo\GameConst;
|
||||||
use \sammo\WarUnit;
|
use \sammo\WarUnit;
|
||||||
use \sammo\WarUnitTriggerCaller;
|
use \sammo\WarUnitTriggerCaller;
|
||||||
use \sammo\WarUnitTrigger\능력치변경;
|
use \sammo\WarUnitTrigger\능력치변경;
|
||||||
|
|
||||||
class che_사기_탁주 extends \sammo\BaseItem{
|
class che_사기_탁주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 3;
|
|
||||||
protected $rawName = '탁주';
|
protected $rawName = '탁주';
|
||||||
protected $name = '탁주(사기)';
|
protected $name = '탁주(사기)';
|
||||||
protected $info = '[전투] 사기 +6. 1회용';
|
protected $info = '[전투] 사기 +30(한도 내). 1회용';
|
||||||
protected $cost = 1000;
|
protected $cost = 1000;
|
||||||
protected $consumable = true;
|
protected $consumable = true;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
@@ -20,7 +20,7 @@ class che_사기_탁주 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new 능력치변경($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 'atmos', '+', 6)
|
new 능력치변경($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 'atmos', '+', 30, null, GameConst::$maxAtmosByWar)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTrigger\전투력보정;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
|
||||||
|
class che_상성보정_과실주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '과실주';
|
||||||
|
protected $name = '과실주(상성)';
|
||||||
|
protected $info = '[전투] 유리한 병종 전투시 공격력 +10%, 피해 -10%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||||
|
{
|
||||||
|
$oppose = $unit->getOppose();
|
||||||
|
$attackCoef = $unit->getCrewType()->getAttackCoef($oppose->getCrewType());
|
||||||
|
if($attackCoef <= 1){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new 전투력보정($unit, 1.1, 0.9)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
|
||||||
|
class che_숙련_동작 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '동작';
|
||||||
|
protected $name = '동작(숙련)';
|
||||||
|
protected $info = '숙련 +15%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName == 'addDex'){
|
||||||
|
return $value * 1.15;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTrigger\che_약탈발동;
|
||||||
|
use sammo\WarUnitTrigger\che_약탈시도;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
|
||||||
|
class che_약탈_옥벽 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '옥벽';
|
||||||
|
protected $name = '옥벽(약탈)';
|
||||||
|
protected $info = '[전투] 새로운 상대와 전투 시 20% 확률로 상대 금, 쌀 10% 약탈';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_약탈시도($unit, che_약탈시도::TYPE_ITEM, 0.2, 0.1),
|
||||||
|
new che_약탈발동($unit, che_약탈발동::TYPE_ITEM)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityHelper;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
use \sammo\WarUnitTrigger\che_위압시도;
|
||||||
|
use \sammo\WarUnitTrigger\che_위압발동;
|
||||||
|
|
||||||
|
class che_위압_조목삭 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '조목삭';
|
||||||
|
protected $name = '조목삭(위압)';
|
||||||
|
protected $info = '[전투] 첫 페이즈 위압 발동(적 공격, 회피 불가, 사기 5 감소)';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_위압시도($unit),
|
||||||
|
new che_위압발동($unit)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@ use sammo\WarUnitTrigger\che_전투치료시도;
|
|||||||
|
|
||||||
class che_의술_상한잡병론 extends \sammo\BaseItem{
|
class che_의술_상한잡병론 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 24;
|
|
||||||
protected $rawName = '상한잡병론';
|
protected $rawName = '상한잡병론';
|
||||||
protected $name = '상한잡병론(의술)';
|
protected $name = '상한잡병론(의술)';
|
||||||
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\GeneralTrigger;
|
||||||
|
use \sammo\GeneralTriggerCaller;
|
||||||
|
use sammo\WarUnitTrigger\che_전투치료발동;
|
||||||
|
use sammo\WarUnitTrigger\che_전투치료시도;
|
||||||
|
use sammo\BaseWarUnitTrigger;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
|
||||||
|
class che_의술_정력견혈산 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '정력견혈산';
|
||||||
|
protected $name = '정력견혈산(의술)';
|
||||||
|
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
|
||||||
|
return new GeneralTriggerCaller(
|
||||||
|
new GeneralTrigger\che_도시치료($general)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(\sammo\WarUnit $unit): ?WarUnitTriggerCaller
|
||||||
|
{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_전투치료시도($unit, BaseWarUnitTrigger::TYPE_ITEM+BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE*302),
|
||||||
|
new che_전투치료발동($unit, BaseWarUnitTrigger::TYPE_ITEM)
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@ use sammo\WarUnitTriggerCaller;
|
|||||||
|
|
||||||
class che_의술_청낭서 extends \sammo\BaseItem{
|
class che_의술_청낭서 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 23;
|
|
||||||
protected $rawName = '청낭서';
|
protected $rawName = '청낭서';
|
||||||
protected $name = '청낭서(의술)';
|
protected $name = '청낭서(의술)';
|
||||||
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use sammo\WarUnitTrigger\che_전투치료시도;
|
|||||||
|
|
||||||
class che_의술_태평청령 extends \sammo\BaseItem{
|
class che_의술_태평청령 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 24;
|
|
||||||
protected $rawName = '태평청령';
|
protected $rawName = '태평청령';
|
||||||
protected $name = '태평청령(의술)';
|
protected $name = '태평청령(의술)';
|
||||||
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ use \sammo\WarUnitTrigger\che_저격발동;
|
|||||||
|
|
||||||
class che_저격_매화수전 extends \sammo\BaseItem{
|
class che_저격_매화수전 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 70;
|
|
||||||
protected $rawName = '매화수전';
|
protected $rawName = '매화수전';
|
||||||
protected $name = '매화수전(저격)';
|
protected $name = '매화수전(저격)';
|
||||||
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+20';
|
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+20';
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ use \sammo\WarUnitTrigger\che_저격발동;
|
|||||||
|
|
||||||
class che_저격_비도 extends \sammo\BaseItem{
|
class che_저격_비도 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 70;
|
|
||||||
protected $rawName = '비도';
|
protected $rawName = '비도';
|
||||||
protected $name = '비도(저격)';
|
protected $name = '비도(저격)';
|
||||||
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+20';
|
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+20';
|
||||||
|
|||||||
@@ -10,10 +10,9 @@ use \sammo\BaseWarUnitTrigger;
|
|||||||
|
|
||||||
class che_저격_수극 extends \sammo\BaseItem{
|
class che_저격_수극 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 2;
|
|
||||||
protected $rawName = '수극';
|
protected $rawName = '수극';
|
||||||
protected $name = '수극(저격)';
|
protected $name = '수극(저격)';
|
||||||
protected $info = '[전투] 전투 개시 전 50% 확률로 저격 시도. 1회용';
|
protected $info = '[전투] 전투 개시 시 저격. 1회용';
|
||||||
protected $cost = 1000;
|
protected $cost = 1000;
|
||||||
protected $consumable = true;
|
protected $consumable = true;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
@@ -21,12 +20,12 @@ class che_저격_수극 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new che_저격시도($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 0.5, 20, 40),
|
new che_저격시도($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 1, 20, 40),
|
||||||
new che_저격발동($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM)
|
new che_저격발동($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isConsumableNow(string $actionType, string $command):bool{
|
function tryConsumeNow(General $general, string $actionType, string $command):bool{
|
||||||
if($actionType == 'GeneralTrigger' && $command == 'che_아이템치료'){
|
if($actionType == 'GeneralTrigger' && $command == 'che_아이템치료'){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use sammo\BaseWarUnitTrigger;
|
||||||
|
use sammo\Util;
|
||||||
|
use sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTrigger\che_저지발동;
|
||||||
|
use sammo\WarUnitTrigger\WarActivateSkills;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
|
||||||
|
class che_저지_삼황내문 extends \sammo\BaseItem{
|
||||||
|
protected $rawName = '삼황내문';
|
||||||
|
protected $name = '삼황내문(저지)';
|
||||||
|
protected $info = '[전투] 수비 시 첫 페이즈 저지, 50% 확률로 2 페이즈 저지';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
if($unit->isAttacker()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if($unit->getPhase() >= 2){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if($unit->getPhase() == 1 && Util::randBool(0.5)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, true, '특수', '저지'),
|
||||||
|
new che_저지발동($unit)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
|
class che_전략_평만지장도 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '평만지장도';
|
||||||
|
protected $name = '평만지장도(전략)';
|
||||||
|
protected $info = '[전략] 국가전략 사용시 재사용 대기 기간 -15%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStrategic(string $turnType, string $varType, $value){
|
||||||
|
if($varType == 'delay'){
|
||||||
|
return Util::round($value * 0.85);
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
|
class che_조달_주판 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '주판';
|
||||||
|
protected $name = '주판(조달)';
|
||||||
|
protected $info = '[내정] 물자조달 성공 확률 +20%p, 물자조달 획득량 +100%p';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStrategic(string $turnType, string $varType, $value){
|
||||||
|
if($turnType === '조달'){
|
||||||
|
if($varType == 'success') return $value + 0.2;
|
||||||
|
if($varType == 'score') return $value * 2;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use \sammo\General;
|
||||||
|
|
||||||
|
class che_집중_전국책 extends \sammo\BaseItem
|
||||||
|
{
|
||||||
|
protected $rawName = '전국책';
|
||||||
|
protected $name = '전국책(집중)';
|
||||||
|
protected $info = '[전투] 계략 성공 시 대미지 +30%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux = null)
|
||||||
|
{
|
||||||
|
if ($statName === 'warMagicSuccessDamage') {
|
||||||
|
return $value * 1.3;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityHelper;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
|
||||||
|
class che_징병_낙주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '낙주';
|
||||||
|
protected $name = '낙주(징병)';
|
||||||
|
protected $info = '[군사] 징·모병비 -50%, 통솔 순수 능력치 보정 +15%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||||
|
if(in_array($turnType, ['징병', '모병'])){
|
||||||
|
if($varType == 'cost') return $value * 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'leadership'){
|
||||||
|
return $value + $general->getVar('leadership') * 0.15;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityHelper;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
|
||||||
|
class che_척사_오악진형도 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '오악진형도';
|
||||||
|
protected $name = '오악진형도(척사)';
|
||||||
|
protected $info = '[전투] 지역·도시 병종 상대로 대미지 +15%, 아군 피해 -15%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||||
|
$opposeCrewType = $unit->getOppose()->getCrewType();
|
||||||
|
if($opposeCrewType->reqCities || $opposeCrewType->reqRegions){
|
||||||
|
return [1.15, 0.85];
|
||||||
|
}
|
||||||
|
return [1, 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,6 @@ use \sammo\GeneralTriggerCaller;
|
|||||||
|
|
||||||
class che_치료_도소연명 extends \sammo\BaseItem{
|
class che_치료_도소연명 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 9;
|
|
||||||
protected $rawName = '도소연명';
|
protected $rawName = '도소연명';
|
||||||
protected $name = '도소연명(치료)';
|
protected $name = '도소연명(치료)';
|
||||||
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use \sammo\GeneralTriggerCaller;
|
|||||||
|
|
||||||
class che_치료_무후행군 extends \sammo\BaseItem{
|
class che_치료_무후행군 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 8;
|
|
||||||
protected $rawName = '무후행군';
|
protected $rawName = '무후행군';
|
||||||
protected $name = '무후행군(치료)';
|
protected $name = '무후행군(치료)';
|
||||||
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use \sammo\GeneralTriggerCaller;
|
|||||||
|
|
||||||
class che_치료_오석산 extends \sammo\BaseItem{
|
class che_치료_오석산 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 7;
|
|
||||||
protected $rawName = '오석산';
|
protected $rawName = '오석산';
|
||||||
protected $name = '오석산(치료)';
|
protected $name = '오석산(치료)';
|
||||||
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use \sammo\GeneralTriggerCaller;
|
|||||||
|
|
||||||
class che_치료_정력견혈 extends \sammo\BaseItem{
|
class che_치료_정력견혈 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 11;
|
|
||||||
protected $rawName = '정력견혈';
|
protected $rawName = '정력견혈';
|
||||||
protected $name = '정력견혈(치료)';
|
protected $name = '정력견혈(치료)';
|
||||||
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use \sammo\GeneralTriggerCaller;
|
|||||||
|
|
||||||
class che_치료_칠엽청점 extends \sammo\BaseItem{
|
class che_치료_칠엽청점 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 10;
|
|
||||||
protected $rawName = '칠엽청점';
|
protected $rawName = '칠엽청점';
|
||||||
protected $name = '칠엽청점(치료)';
|
protected $name = '칠엽청점(치료)';
|
||||||
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
protected $info = '[군사] 턴 실행 전 부상 회복.';
|
||||||
|
|||||||
@@ -7,25 +7,49 @@ use \sammo\GeneralTriggerCaller;
|
|||||||
|
|
||||||
class che_치료_환약 extends \sammo\BaseItem{
|
class che_치료_환약 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 1;
|
|
||||||
protected $rawName = '환약';
|
protected $rawName = '환약';
|
||||||
protected $name = '환약(치료)';
|
protected $name = '환약(치료)';
|
||||||
protected $info = '[군사] 턴 실행 전 부상 회복. 1회용';
|
protected $info = '[군사] 턴 실행 전 부상 회복. 3회용';
|
||||||
protected $cost = 100;
|
protected $cost = 200;
|
||||||
protected $consumable = true;
|
protected $consumable = true;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $reqSecu = 0;
|
protected $reqSecu = 0;
|
||||||
|
|
||||||
|
const REMAIN_KEY = 'remain환약';
|
||||||
|
|
||||||
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
|
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
|
||||||
return new GeneralTriggerCaller(
|
return new GeneralTriggerCaller(
|
||||||
new GeneralTrigger\che_아이템치료($general, $general->getAuxVar('use_treatment')??10)
|
new GeneralTrigger\che_아이템치료($general, $general->getAuxVar('use_treatment')??10)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isConsumableNow(string $actionType, string $command):bool{
|
function onArbitraryAction(General $general, string $actionType, ?string $phase = null, $aux = null): ?array
|
||||||
if($actionType == 'GeneralTrigger' && $command == 'che_아이템치료'){
|
{
|
||||||
return true;
|
if($actionType != '장비매매'){
|
||||||
|
return $aux;
|
||||||
}
|
}
|
||||||
return false;
|
if($phase != '구매'){
|
||||||
|
return $aux;
|
||||||
|
}
|
||||||
|
|
||||||
|
$general->setAuxVar(static::REMAIN_KEY, 3);
|
||||||
|
return $aux;
|
||||||
|
}
|
||||||
|
|
||||||
|
function tryConsumeNow(General $general, string $actionType, string $command):bool{
|
||||||
|
if($actionType != 'GeneralTrigger'){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($command != 'che_아이템치료'){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$remainCnt = $general->getAuxVar(static::REMAIN_KEY)??1;
|
||||||
|
if($remainCnt > 1){
|
||||||
|
$general->setAuxVar(static::REMAIN_KEY, $remainCnt - 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$general->setAuxVar(static::REMAIN_KEY, null);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
|
||||||
|
class che_필살_둔갑천서 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '둔갑천서';
|
||||||
|
protected $name = '둔갑천서(필살)';
|
||||||
|
protected $info = '[전투] 필살 확률 +25%p';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'warCriticalRatio'){
|
||||||
|
return $value + 0.25;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_행동_서촉지형도 extends \sammo\BaseItem{
|
class che_행동_서촉지형도 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 22;
|
|
||||||
protected $rawName = '서촉지형도';
|
protected $rawName = '서촉지형도';
|
||||||
protected $name = '서촉지형도(행동)';
|
protected $name = '서촉지형도(행동)';
|
||||||
protected $info = '[전투] 공격 시 페이즈 + 2';
|
protected $info = '[전투] 공격 시 페이즈 + 2';
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use \sammo\General;
|
||||||
|
|
||||||
|
class che_환술_논어집해 extends \sammo\BaseItem
|
||||||
|
{
|
||||||
|
protected $rawName = '논어집해';
|
||||||
|
protected $name = '논어집해(환술)';
|
||||||
|
protected $info = '[전투] 계략 성공 확률 +10%p, 계략 성공 시 대미지 +20%';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux = null)
|
||||||
|
{
|
||||||
|
if ($statName === 'warMagicSuccessProb') {
|
||||||
|
return $value + 0.1;
|
||||||
|
}
|
||||||
|
if ($statName === 'warMagicSuccessDamage') {
|
||||||
|
return $value * 1.2;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_회피_둔갑천서 extends \sammo\BaseItem{
|
class che_회피_둔갑천서 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 26;
|
|
||||||
protected $rawName = '둔갑천서';
|
protected $rawName = '둔갑천서';
|
||||||
protected $name = '둔갑천서(회피)';
|
protected $name = '둔갑천서(회피)';
|
||||||
protected $info = '[전투] 회피 확률 +20%p';
|
protected $info = '[전투] 회피 확률 +20%p';
|
||||||
@@ -19,3 +18,5 @@ class che_회피_둔갑천서 extends \sammo\BaseItem{
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOTE: 구버전
|
||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_회피_태평요술 extends \sammo\BaseItem{
|
class che_회피_태평요술 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 25;
|
|
||||||
protected $rawName = '태평요술';
|
protected $rawName = '태평요술';
|
||||||
protected $name = '태평요술(회피)';
|
protected $name = '태평요술(회피)';
|
||||||
protected $info = '[전투] 회피 확률 +20%p';
|
protected $info = '[전투] 회피 확률 +20%p';
|
||||||
@@ -14,7 +13,7 @@ class che_회피_태평요술 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'warAvoidRatio'){
|
if($statName === 'warAvoidRatio'){
|
||||||
return $value + 0.2;
|
return $value + 0.20;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_훈련_과실주 extends \sammo\BaseItem{
|
class che_훈련_과실주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 12;
|
|
||||||
protected $rawName = '과실주';
|
protected $rawName = '과실주';
|
||||||
protected $name = '과실주(훈련)';
|
protected $name = '과실주(훈련)';
|
||||||
protected $info = '[전투] 훈련 보정 +10';
|
protected $info = '[전투] 훈련 보정 +10';
|
||||||
@@ -19,3 +18,5 @@ class che_훈련_과실주 extends \sammo\BaseItem{
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOTE: 구버전
|
||||||
@@ -5,16 +5,15 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_훈련_단결도 extends \sammo\BaseItem{
|
class che_훈련_단결도 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 18;
|
|
||||||
protected $rawName = '단결도';
|
protected $rawName = '단결도';
|
||||||
protected $name = '단결도(훈련)';
|
protected $name = '단결도(훈련)';
|
||||||
protected $info = '[전투] 훈련 보정 +14';
|
protected $info = '[전투] 훈련 보정 +15';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'bonusTrain'){
|
if($statName === 'bonusTrain'){
|
||||||
return $value + 14;
|
return $value + 15;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_훈련_이강주 extends \sammo\BaseItem{
|
class che_훈련_이강주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 13;
|
|
||||||
protected $rawName = '이강주';
|
protected $rawName = '이강주';
|
||||||
protected $name = '이강주(훈련)';
|
protected $name = '이강주(훈련)';
|
||||||
protected $info = '[전투] 훈련 보정 +10';
|
protected $info = '[전투] 훈련 보정 +10';
|
||||||
@@ -19,3 +18,5 @@ class che_훈련_이강주 extends \sammo\BaseItem{
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOTE: 구버전
|
||||||
@@ -5,16 +5,15 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_훈련_철벽서 extends \sammo\BaseItem{
|
class che_훈련_철벽서 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 17;
|
|
||||||
protected $rawName = '철벽서';
|
protected $rawName = '철벽서';
|
||||||
protected $name = '철벽서(훈련)';
|
protected $name = '철벽서(훈련)';
|
||||||
protected $info = '[전투] 훈련 보정 +14';
|
protected $info = '[전투] 훈련 보정 +15';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'bonusTrain'){
|
if($statName === 'bonusTrain'){
|
||||||
return $value + 14;
|
return $value + 15;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ namespace sammo\ActionItem;
|
|||||||
use \sammo\iAction;
|
use \sammo\iAction;
|
||||||
use \sammo\General;
|
use \sammo\General;
|
||||||
use \sammo\BaseWarUnitTrigger;
|
use \sammo\BaseWarUnitTrigger;
|
||||||
|
use sammo\GameConst;
|
||||||
use \sammo\WarUnit;
|
use \sammo\WarUnit;
|
||||||
use \sammo\WarUnitTriggerCaller;
|
use \sammo\WarUnitTriggerCaller;
|
||||||
use \sammo\WarUnitTrigger\능력치변경;
|
use \sammo\WarUnitTrigger\능력치변경;
|
||||||
|
|
||||||
class che_훈련_청주 extends \sammo\BaseItem{
|
class che_훈련_청주 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 4;
|
|
||||||
protected $rawName = '청주';
|
protected $rawName = '청주';
|
||||||
protected $name = '청주(훈련)';
|
protected $name = '청주(훈련)';
|
||||||
protected $info = '[전투] 훈련 +6. 1회용';
|
protected $info = '[전투] 훈련 +40(한도 내). 1회용';
|
||||||
protected $cost = 1000;
|
protected $cost = 1000;
|
||||||
protected $consumable = true;
|
protected $consumable = true;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
@@ -20,7 +20,7 @@ class che_훈련_청주 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new 능력치변경($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 'train', '+', 6)
|
new 능력치변경($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 'train', '+', 40, null, GameConst::$maxTrainByWar)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,6 @@ use sammo\WarUnitTrigger\che_격노발동;
|
|||||||
|
|
||||||
class event_빼빼로 extends \sammo\BaseItem{
|
class event_빼빼로 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 75;
|
|
||||||
protected $rawName = '빼빼로';
|
protected $rawName = '빼빼로';
|
||||||
protected $name = '빼빼로';
|
protected $name = '빼빼로';
|
||||||
protected $info = '1의 상징입니다.<br>통솔 +1, 무력 +1, 지력 +1';
|
protected $info = '1의 상징입니다.<br>통솔 +1, 무력 +1, 지력 +1';
|
||||||
|
|||||||
@@ -10,10 +10,9 @@ use sammo\WarUnitTrigger\che_격노발동;
|
|||||||
|
|
||||||
class event_전투특기_격노 extends \sammo\BaseItem{
|
class event_전투특기_격노 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 74;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(격노)';
|
protected $name = '비급(격노)';
|
||||||
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가)';
|
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가), 격노마다 대미지 20% 추가 중첩';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
|
||||||
|
use sammo\BaseWarUnitTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTrigger\che_부상무효;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
|
||||||
|
class event_전투특기_견고 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $rawName = '비급';
|
||||||
|
protected $name = '비급(견고)';
|
||||||
|
protected $info = '[전투] 상대 필살 확률 -20%p, 상대 계략 시도시 성공 확률 -10%p, 부상 없음, 아군 피해 -10%';
|
||||||
|
protected $cost = 100;
|
||||||
|
protected $buyable = true;
|
||||||
|
protected $consumable = false;
|
||||||
|
protected $reqSecu = 3000;
|
||||||
|
|
||||||
|
public function onCalcOpposeStat(General $general, string $statName, $value, $aux = null)
|
||||||
|
{
|
||||||
|
$debuff = [
|
||||||
|
'warMagicSuccessProb' => 0.1,
|
||||||
|
'warCriticalRatio' => 0.20,
|
||||||
|
][$statName] ?? 0;
|
||||||
|
return $value - $debuff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBattleInitSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||||
|
{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_NONE + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 404),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||||
|
{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_NONE + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 404),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWarPowerMultiplier(WarUnit $unit): array
|
||||||
|
{
|
||||||
|
return [1, 0.9];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ use \sammo\WarUnitCity;
|
|||||||
|
|
||||||
class event_전투특기_공성 extends \sammo\BaseItem{
|
class event_전투특기_공성 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 53;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(공성)';
|
protected $name = '비급(공성)';
|
||||||
protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 차병 숙련을 가산';
|
protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 차병 숙련을 가산';
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use \sammo\GameUnitConst;
|
|||||||
|
|
||||||
class event_전투특기_궁병 extends \sammo\BaseItem{
|
class event_전투특기_궁병 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 51;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(궁병)';
|
protected $name = '비급(궁병)';
|
||||||
protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 궁병 숙련을 가산';
|
protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 궁병 숙련을 가산';
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use \sammo\WarUnit;
|
|||||||
|
|
||||||
class event_전투특기_귀병 extends \sammo\BaseItem{
|
class event_전투특기_귀병 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 40;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(귀병)';
|
protected $name = '비급(귀병)';
|
||||||
protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 귀병 숙련을 가산';
|
protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 귀병 숙련을 가산';
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use \sammo\WarUnit;
|
|||||||
|
|
||||||
class event_전투특기_기병 extends \sammo\BaseItem{
|
class event_전투특기_기병 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 52;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(기병)';
|
protected $name = '비급(기병)';
|
||||||
protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 기병 숙련을 가산';
|
protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 기병 숙련을 가산';
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use \sammo\WarUnitTrigger\che_돌격지속;
|
|||||||
|
|
||||||
class event_전투특기_돌격 extends \sammo\BaseItem{
|
class event_전투특기_돌격 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 60;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(돌격)';
|
protected $name = '비급(돌격)';
|
||||||
protected $info = '[전투] 공격 시 대등/유리한 병종에게는 퇴각 전까지 전투, 공격 시 페이즈 + 2, 공격 시 대미지 +5%';
|
protected $info = '[전투] 공격 시 대등/유리한 병종에게는 퇴각 전까지 전투, 공격 시 페이즈 + 2, 공격 시 대미지 +5%';
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use \sammo\Util;
|
|||||||
|
|
||||||
class event_전투특기_무쌍 extends \sammo\BaseItem{
|
class event_전투특기_무쌍 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 61;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(무쌍)';
|
protected $name = '비급(무쌍)';
|
||||||
protected $info = '[전투] 대미지 +5%, 피해 -2%, 공격 시 필살 확률 +10%p, <br>승리 수의 로그 비례로 대미지 상승(10회 ⇒ +5%, 40회 ⇒ +15%)<br>승리 수의 로그 비례로 피해 감소(10회 ⇒ -2%, 40회 ⇒ -6%)';
|
protected $info = '[전투] 대미지 +5%, 피해 -2%, 공격 시 필살 확률 +10%p, <br>승리 수의 로그 비례로 대미지 상승(10회 ⇒ +5%, 40회 ⇒ +15%)<br>승리 수의 로그 비례로 피해 감소(10회 ⇒ -2%, 40회 ⇒ -6%)';
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ use \sammo\WarUnitTrigger\che_반계발동;
|
|||||||
|
|
||||||
class event_전투특기_반계 extends \sammo\BaseItem{
|
class event_전투특기_반계 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 45;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(반계)';
|
protected $name = '비급(반계)';
|
||||||
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +150%)';
|
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +150%)';
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use \sammo\WarUnit;
|
|||||||
|
|
||||||
class event_전투특기_보병 extends \sammo\BaseItem{
|
class event_전투특기_보병 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 50;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(보병)';
|
protected $name = '비급(보병)';
|
||||||
protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 보병 숙련을 가산';
|
protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 보병 숙련을 가산';
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use \sammo\WarUnit;
|
|||||||
|
|
||||||
class event_전투특기_신산 extends \sammo\BaseItem{
|
class event_전투특기_신산 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 41;
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(신산)';
|
protected $name = '비급(신산)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p<br>[전투] 계략 시도 확률 +20%p, 계략 성공 확률 +20%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p<br>[전투] 계략 시도 확률 +20%p, 계략 성공 확률 +20%p';
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user