From 8248ccbcd5f35fd4ffbf3d729dd8406f0b930915 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sat, 20 Aug 2022 15:03:58 +0900 Subject: [PATCH] =?UTF-8?q?game:=20=EC=8B=9C=EA=B0=84=EC=9D=B4=20=EC=A7=80?= =?UTF-8?q?=EB=82=A8=EC=97=90=20=EB=94=B0=EB=9D=BC=20=EC=84=B1=EB=B2=BD=20?= =?UTF-8?q?=EA=B0=95=ED=99=94=20-=20183=EB=85=84=20=EA=B8=B0=EC=A4=80=20?= =?UTF-8?q?=EB=8F=99=EC=9D=BC.=20-=20220=EB=85=84=20=EA=B8=B0=EC=A4=80=204?= =?UTF-8?q?0%=20=EC=A0=84=ED=88=AC=EB=A0=A5=20=EC=83=81=EC=8A=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/_admin1.php | 2 -- hwe/func_gamerule.php | 5 ----- hwe/j_simulate_battle.php | 9 ++++----- hwe/process_war.php | 7 +++---- hwe/sammo/WarUnitCity.php | 18 ++++++++++++------ 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/hwe/_admin1.php b/hwe/_admin1.php index 8e9fd584..4ad6e2d3 100644 --- a/hwe/_admin1.php +++ b/hwe/_admin1.php @@ -40,8 +40,6 @@ $admin = getAdmin(); 시작시간변경 '> - 현재도시훈사 - 최대 장수 diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 218386f6..b01cf691 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -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; //매달 사망자 수입 결산 diff --git a/hwe/j_simulate_battle.php b/hwe/j_simulate_battle.php index ab9ffccf..e405be56 100644 --- a/hwe/j_simulate_battle.php +++ b/hwe/j_simulate_battle.php @@ -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('
', $values)); diff --git a/hwe/process_war.php b/hwe/process_war.php index 03058321..9885ebb8 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -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()); } diff --git a/hwe/sammo/WarUnitCity.php b/hwe/sammo/WarUnitCity.php index a53f44da..efe90307 100644 --- a/hwe/sammo/WarUnitCity.php +++ b/hwe/sammo/WarUnitCity.php @@ -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{