diff --git a/hwe/func.php b/hwe/func.php index bb81fdae..f8ea7945 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1288,7 +1288,7 @@ function CheckHall($no) { ["firenum", 'rank'], ["warnum", 'rank'], ["killnum", 'rank'], - ["winrate", 'rank'], + ["winrate", 'calc'], ["killcrew", 'rank'], ["killrate", 'calc'], ["dex1", 'natural'], @@ -1298,7 +1298,7 @@ function CheckHall($no) { ["dex5", 'natural'], ["ttrate", 'calc'], ["tlrate", 'calc'], - ["tprate", 'calc'], + ["tsrate", 'calc'], ["tirate", 'calc'], ["betgold", 'rank'], ["betwin", 'rank'], @@ -1324,16 +1324,28 @@ function CheckHall($no) { $tid = $generalObj->getRankVar('tid'); $til = $generalObj->getRankVar('til'); - $tt = max($ttw+$ttd+$ttl, 1); - $tl = max($tlw+$tld+$tll, 1); - $ts = max($tsw+$tsd+$tsl, 1); - $ti = max($tiw+$tid+$til, 1); + $betWinGold = $generalObj->getRankVar('betwingold'); + $betGold = Util::valueFit($generalObj->getRankVar('betgold'), 1); + + $win = $generalObj->getRankVar('killnum'); + $war = Util::valueFit($generalObj->getRankVar('warnum'), 1); + + $kill = $generalObj->getRankVar('killcrew'); + $death = Util::valueFit($generalObj->getRankVar('deathcrew'), 1); + + $tt = Util::valueFit($ttw+$ttd+$ttl, 1); + $tl = Util::valueFit($tlw+$tld+$tll, 1); + $ts = Util::valueFit($tsw+$tsd+$tsl, 1); + $ti = Util::valueFit($tiw+$tid+$til, 1); $calcVar = []; $calcVar['ttrate'] = $ttw/$tt; $calcVar['tlrate'] = $tlw/$tl; $calcVar['tsrate'] = $tsw/$ts; $calcVar['tirate'] = $tiw/$ti; + $calcVar['betrate'] = $betWinGold/$betGold; + $calcVar['winrate'] = $win/$war; + $calcVar['killrate'] = $kill/($kill+$death); if($generalObj instanceof DummyGeneral){ return; diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 95de7bfd..1219cc00 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -330,16 +330,13 @@ function preUpdateMonthly() { $rate = Util::round(($admin['year'] - $admin['startyear']) / 1.5) + 60; if($rate > 100) $rate = 100; - $ratio = 100; // 20 ~ 140원 $develcost = ($admin['year'] - $admin['startyear'] + 10) * 2; - $gameStor->gold_rate = $ratio; - $gameStor->rice_rate = $ratio; $gameStor->city_rate = $rate; $gameStor->develcost = $develcost; //매달 사망자 수입 결산 - processWarIncome($ratio); + processWarIncome(); //계략, 전쟁표시 해제 $db->update('city', [ diff --git a/hwe/func_time_event.php b/hwe/func_time_event.php index 2598afd4..193c7cad 100644 --- a/hwe/func_time_event.php +++ b/hwe/func_time_event.php @@ -48,7 +48,7 @@ function processGoldIncome() { $nationList = $db->query('SELECT name,nation,capital,gold,level,rate_tmp,bill,type from nation'); $cityListByNation = Util::arrayGroupBy($db->query('SELECT * FROM city'), 'nation'); - $generalRawListByNation = Util::arrayGroupBy($db->query('SELECT no,name,nation,gold,officer_level,dedication,city FROM general'), 'nation'); + $generalRawListByNation = Util::arrayGroupBy($db->query('SELECT no,name,nation,gold,officer_level,dedication,city FROM general WHERE npc != 5'), 'nation'); //국가별 처리 foreach($nationList as $nation) { diff --git a/hwe/process_war.php b/hwe/process_war.php index 5fd56e0a..8ccc6df5 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -153,11 +153,11 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r $db->update('nation', $updateDefenderNation, 'nation=%i', $defenderNationID); $db->update('diplomacy', [ - 'dead'=>$db->sqleval('dead + %i', $attacker->getDead() * getTechCost($rawAttackerNation['tech'])) + 'dead'=>$db->sqleval('dead + %i', $attacker->getDead()) ], 'me = %i and you = %i', $attackerNationID, $defenderNationID); $db->update('diplomacy', [ - 'dead'=>$db->sqleval('dead + %i', $attacker->getKilled() * getTechCost($rawDefenderNation['tech'])) + 'dead'=>$db->sqleval('dead + %i', $attacker->getKilled()) ], 'me = %i and you = %i', $defenderNationID, $attackerNationID); if(!$conquerCity){ diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php index c6a2d349..162c704f 100644 --- a/hwe/sammo/Command/General/che_징병.php +++ b/hwe/sammo/Command/General/che_징병.php @@ -35,7 +35,9 @@ class che_징병 extends Command\GeneralCommand{ static protected $defaultAtmos; protected $reqCrew = 0; + /** @var \sammo\GameUnitDetail */ protected $reqCrewType; + /** @var \sammo\GameUnitDetail */ protected $currCrewType; static protected $isInitStatic = false; diff --git a/hwe/sammo/Command/Nation/che_포상.php b/hwe/sammo/Command/Nation/che_포상.php index 4184b69a..aaf9119e 100644 --- a/hwe/sammo/Command/Nation/che_포상.php +++ b/hwe/sammo/Command/Nation/che_포상.php @@ -145,7 +145,7 @@ class che_포상 extends Command\NationCommand{ $logger = $general->getLogger(); - $destGeneral->increaseVarWithLimit($resKey, $amount); + $destGeneral->increaseVar($resKey, $amount); $db->update('nation', [ $resKey=>$db->sqleval('%b - %i', $resKey, $amount) ], 'nation=%i', $nationID); diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index a5cdbc6c..bdfbcd57 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -681,6 +681,7 @@ class General implements iAction{ $this->rankVarSet = []; $this->getLogger()->flush(); + $this->flushUpdateValues(); return $db->affectedRows() > 0; } diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 7417883b..d8b4885e 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -3326,6 +3326,31 @@ class GeneralAI ]; } + protected function newChoosePromotion(){ + $db = DB::db(); + + $nation = $this->nation; + $nationID = $nation['nation']; + $minChiefLevel = getNationChiefLevel($nation['level']); + + $userChiefCnt = 0; + + $strengthSort = []; + $intelSort = []; + + foreach(Util::range($minChiefLevel, 12) as $chiefLevel){ + if(!key_exists($chiefLevel, $this->chiefGenerals)){ + continue; + } + $chief = $this->chiefGenerals[$chiefLevel]; + if($chief->getVar('npc') < 2){ + $userChiefCnt[$chiefLevel] = $chief; + } + } + + + } + protected function choosePromotion() { $db = DB::db(); diff --git a/hwe/sammo/LazyVarUpdater.php b/hwe/sammo/LazyVarUpdater.php index e89b7c40..8a7a7768 100644 --- a/hwe/sammo/LazyVarUpdater.php +++ b/hwe/sammo/LazyVarUpdater.php @@ -136,4 +136,12 @@ trait LazyVarUpdater{ } return $updateVals; } + + function flushUpdateValues():void { + $this->updatedVar = []; + if(key_exists('auxVar', $this->raw)){ + $this->auxUpdated = false; + unset($this->raw['auxVar']); + } + } } \ No newline at end of file diff --git a/hwe/sammo/ResetHelper.php b/hwe/sammo/ResetHelper.php index 39a27c96..88f02099 100644 --- a/hwe/sammo/ResetHelper.php +++ b/hwe/sammo/ResetHelper.php @@ -241,8 +241,6 @@ class ResetHelper{ 'maxgeneral'=>GameConst::$defaultMaxGeneral, 'maxnation'=>GameConst::$defaultMaxNation, 'conlimit'=>30000, - 'gold_rate'=>100, - 'rice_rate'=>100, 'develcost'=>$develcost, 'turntime'=>$turntime, 'starttime'=>$starttime, diff --git a/hwe/sammo/WarUnit.php b/hwe/sammo/WarUnit.php index 74927f72..8f7f6e4e 100644 --- a/hwe/sammo/WarUnit.php +++ b/hwe/sammo/WarUnit.php @@ -80,6 +80,10 @@ class WarUnit{ function getUpdatedValues():array { return $this->general->getUpdatedValues(); } + + function flushUpdateValues():void { + $this->general->flushUpdateValues(); + } protected function clearActivatedSkill(){ foreach($this->activatedSkill as $skillName=>$state){ diff --git a/hwe/sammo/WarUnitCity.php b/hwe/sammo/WarUnitCity.php index 172223ff..8cc10ec2 100644 --- a/hwe/sammo/WarUnitCity.php +++ b/hwe/sammo/WarUnitCity.php @@ -154,6 +154,7 @@ class WarUnitCity extends WarUnit{ } $db->update('city', $updateVals, 'city=%i', $this->raw['city']); + $this->flushUpdateValues(); return $db->affectedRows() > 0; }