forked from devsam/core
game: 시간이 지남에 따라 성벽 강화
- 183년 기준 동일. - 220년 기준 40% 전투력 상승
This commit is contained in:
@@ -40,8 +40,6 @@ $admin = getAdmin();
|
||||
<tr>
|
||||
<td width=110 align=right>시작시간변경</td>
|
||||
<td width=285><input type=text size=20 maxlength=20 style=color:white;background-color:black;text-align:right; name=starttime value='<?=substr($admin['starttime'], 0, 19)?>'><input type=submit name=btn value=변경1></td>
|
||||
<td width=110 align=right>현재도시훈사</td>
|
||||
<td width=285><?=$admin['city_rate']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=110 align=right>최대 장수</td>
|
||||
|
||||
@@ -285,13 +285,8 @@ function preUpdateMonthly()
|
||||
'rate_tmp' => $db->sqleval('rate')
|
||||
], true);
|
||||
|
||||
//도시훈사 180년 60, 220년 87, 240년 100
|
||||
$rate = Util::round(($admin['year'] - $admin['startyear']) / 1.5) + 60;
|
||||
if ($rate > 100) $rate = 100;
|
||||
|
||||
// 20 ~ 140원
|
||||
$develcost = ($admin['year'] - $admin['startyear'] + 10) * 2;
|
||||
$gameStor->city_rate = $rate;
|
||||
$gameStor->develcost = $develcost;
|
||||
|
||||
//매달 사망자 수입 결산
|
||||
|
||||
@@ -281,7 +281,6 @@ unset($defenderList);
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$startYear = $gameStor->startyear;
|
||||
$cityRate = Util::round(($year - $startYear) / 1.5) + 60;
|
||||
|
||||
function extractRankVar(array $rawVal):Map{
|
||||
$rankVars = new Map;
|
||||
@@ -298,7 +297,7 @@ function extractRankVar(array $rawVal):Map{
|
||||
function simulateBattle(
|
||||
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
|
||||
$rawDefenderList, $rawDefenderCity, $rawDefenderNation,
|
||||
$startYear, $year, $month, $cityRate
|
||||
$startYear, $year, $month
|
||||
){
|
||||
|
||||
$warSeed = bin2hex(random_bytes(16));
|
||||
@@ -310,7 +309,7 @@ function simulateBattle(
|
||||
$rawAttackerNation,
|
||||
true
|
||||
);
|
||||
$city = new WarUnitCity($warRng, $rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate);
|
||||
$city = new WarUnitCity($warRng, $rawDefenderCity, $rawDefenderNation, $year, $month, $startYear);
|
||||
|
||||
$iterDefender = new \ArrayIterator($rawDefenderList);
|
||||
$iterDefender->rewind();
|
||||
@@ -367,7 +366,7 @@ function simulateBattle(
|
||||
$rice = $city->getKilled() / 100 * 0.8;
|
||||
$rice *= $city->getCrewType()->rice;
|
||||
$rice *= getTechCost($rawDefenderNation['tech']);
|
||||
$rice *= $cityRate / 100 - 0.2;
|
||||
$rice *= $city->getCityTrainAtmos() / 100 - 0.2;
|
||||
Util::setRound($rice);
|
||||
|
||||
$defenderRice += $rice;
|
||||
@@ -406,7 +405,7 @@ foreach(Util::range($repeatCnt) as $repeatIdx){
|
||||
[$attacker, $city, $battleResult, $conquerCity, $attackerRice, $defenderRice] = simulateBattle(
|
||||
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
|
||||
$rawDefenderList, $rawDefenderCity, $rawDefenderNation,
|
||||
$startYear, $year, $month, $cityRate
|
||||
$startYear, $year, $month
|
||||
);
|
||||
$lastWarLog = Util::mapWithKey(function($key, $values){
|
||||
return ConvertLog(join('<br>', $values));
|
||||
|
||||
+3
-4
@@ -29,11 +29,11 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
|
||||
}
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
[$startYear, $year, $month, $cityRate, $joinMode] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'city_rate', 'join_mode']);
|
||||
[$startYear, $year, $month, $joinMode] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'join_mode']);
|
||||
|
||||
$attacker = new WarUnitGeneral($rng, $attackerGeneral,$rawAttackerNation, true);
|
||||
|
||||
$city = new WarUnitCity($rng, $rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate);
|
||||
$city = new WarUnitCity($rng, $rawDefenderCity, $rawDefenderNation, $year, $month, $startYear);
|
||||
|
||||
$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);
|
||||
@@ -90,7 +90,7 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
|
||||
$rice = $city->getKilled() / 100 * 0.8;
|
||||
$rice *= $city->getCrewType()->rice;
|
||||
$rice *= getTechCost($rawDefenderNation['tech']);
|
||||
$rice *= $cityRate / 100 - 0.2;
|
||||
$rice *= $city->getCityTrainAtmos() / 100 - 0.2;
|
||||
Util::setRound($rice);
|
||||
|
||||
$updateDefenderNation['rice'] = max(0, $rawDefenderNation['rice'] - $rice);
|
||||
@@ -175,7 +175,6 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
|
||||
'startyear' => $startYear,
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
'city_rate' => $cityRate,
|
||||
'join_mode' => $joinMode,
|
||||
], $attacker->getGeneral(), $city->getRaw());
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ class WarUnitCity extends WarUnit{
|
||||
|
||||
protected $hp;
|
||||
|
||||
protected $cityRate;
|
||||
protected $cityTrainAtmos;
|
||||
|
||||
function __construct(public readonly RandUtil $rng, $raw, $rawNation, int $year, int $month, $cityRate){
|
||||
function __construct(public readonly RandUtil $rng, $raw, $rawNation, int $year, int $month, int $startYear){
|
||||
$general = new DummyGeneral(false);
|
||||
$general->setVar('city', $raw['city']);
|
||||
$general->setVar('nation', $raw['nation']);
|
||||
@@ -18,7 +18,9 @@ class WarUnitCity extends WarUnit{
|
||||
$this->rawNation = $rawNation;
|
||||
|
||||
$this->isAttacker = false;
|
||||
$this->cityRate = $cityRate;
|
||||
|
||||
//도시 훈사. 181년 60, 201년 80, 221년 100, 231년 110(최대)
|
||||
$this->cityTrainAtmos = Util::clamp($year - $startYear + 59, 60, 110);
|
||||
|
||||
$this->logger = $general->getLogger();
|
||||
$this->crewType = GameUnitConst::byID(GameUnitConst::CREWTYPE_CASTLE);
|
||||
@@ -34,6 +36,10 @@ class WarUnitCity extends WarUnit{
|
||||
}
|
||||
}
|
||||
|
||||
function getCityTrainAtmos(): int{
|
||||
return $this->cityTrainAtmos;
|
||||
}
|
||||
|
||||
function getName():string{
|
||||
return $this->getVar('name');
|
||||
}
|
||||
@@ -57,11 +63,11 @@ class WarUnitCity extends WarUnit{
|
||||
}
|
||||
|
||||
function getComputedTrain(){
|
||||
return $this->cityRate + $this->trainBonus;
|
||||
return $this->cityTrainAtmos + $this->trainBonus;
|
||||
}
|
||||
|
||||
function getComputedAtmos(){
|
||||
return $this->cityRate + $this->atmosBonus;
|
||||
return $this->cityTrainAtmos + $this->atmosBonus;
|
||||
}
|
||||
|
||||
function getHP():int{
|
||||
@@ -69,7 +75,7 @@ class WarUnitCity extends WarUnit{
|
||||
}
|
||||
|
||||
function getDex(GameUnitDetail $crewType){
|
||||
return ($this->cityRate - 60) * 7200;
|
||||
return ($this->cityTrainAtmos - 60) * 7200;
|
||||
}
|
||||
|
||||
function decreaseHP(int $damage):int{
|
||||
|
||||
Reference in New Issue
Block a user