From 1b46a06eee87d4c528b195a9d6b282485acd2ce3 Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 18 Aug 2021 20:26:31 +0900 Subject: [PATCH 01/11] =?UTF-8?q?fix:=20=EC=95=84=EC=9D=B4=ED=85=9C?= =?UTF-8?q?=EC=A4=91=20WarActivateSkill=20=EA=B4=80=EB=A0=A8=20=EC=A4=91?= =?UTF-8?q?=EC=B2=A9=20=ED=95=B4=EC=A0=9C=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/ActionItem/che_부적_태현청생부.php | 21 +++++++++++------- hwe/sammo/ActionItem/event_전투특기_반계.php | 2 +- .../ActionSpecialDomestic/che_event_견고.php | 6 ++--- .../ActionSpecialDomestic/che_event_반계.php | 17 +++++++++----- hwe/sammo/ActionSpecialWar/che_견고.php | 22 ++++++++++++------- hwe/sammo/ActionSpecialWar/che_반계.php | 2 +- 6 files changed, 43 insertions(+), 27 deletions(-) diff --git a/hwe/sammo/ActionItem/che_부적_태현청생부.php b/hwe/sammo/ActionItem/che_부적_태현청생부.php index 4badf3a7..1094880a 100644 --- a/hwe/sammo/ActionItem/che_부적_태현청생부.php +++ b/hwe/sammo/ActionItem/che_부적_태현청생부.php @@ -1,5 +1,7 @@ Date: Wed, 18 Aug 2021 20:32:47 +0900 Subject: [PATCH 02/11] =?UTF-8?q?fix:=207.2=EC=97=90=EC=84=9C=20=EC=98=A4?= =?UTF-8?q?=EB=8F=99=EC=9E=91=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/BaseCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hwe/sammo/Command/BaseCommand.php b/hwe/sammo/Command/BaseCommand.php index 65ead2ee..5bc25663 100644 --- a/hwe/sammo/Command/BaseCommand.php +++ b/hwe/sammo/Command/BaseCommand.php @@ -18,7 +18,7 @@ abstract class BaseCommand{ static protected $actionName = 'CommandName'; static public $reqArg = false; static protected $isLazyCalcReqTurn = false; - public ?string $reason; + public $reason; public function getCommandDetailTitle():string{ return $this->getName(); From 2d41bf8f2fc37bcd7cc7eaeed3b9a3bff8f6c9d7 Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 18 Aug 2021 20:40:37 +0900 Subject: [PATCH 03/11] =?UTF-8?q?Revert=20"fix:=207.2=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=98=A4=EB=8F=99=EC=9E=91=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9997675b1d7d35708a2129fe4d3b1ce2b59c79c9. --- hwe/sammo/Command/BaseCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hwe/sammo/Command/BaseCommand.php b/hwe/sammo/Command/BaseCommand.php index 5bc25663..65ead2ee 100644 --- a/hwe/sammo/Command/BaseCommand.php +++ b/hwe/sammo/Command/BaseCommand.php @@ -18,7 +18,7 @@ abstract class BaseCommand{ static protected $actionName = 'CommandName'; static public $reqArg = false; static protected $isLazyCalcReqTurn = false; - public $reason; + public ?string $reason; public function getCommandDetailTitle():string{ return $this->getName(); From a18baf2ffeae94a1d902c8765053cbbdebd81e48 Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 19 Aug 2021 14:51:50 +0900 Subject: [PATCH 04/11] =?UTF-8?q?REAMDME.md=20=EB=B2=84=EC=A0=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3efbf0f6..a93a0ef2 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ * Apache2 * mpm_event 권장 -* PHP 7.3 이상 +* PHP 8.0 이상 * php-fpm 권장 * php에서 curl, pdo-sqlite을 실행가능해야 합니다. * mysqli, mysqlnd @@ -18,9 +18,9 @@ * git * curl -Linux는 Ubuntu 18.04, 20.04, Windows는 Windows 10에서 XAMPP, WSL2를 사용한 환경에서 테스트되었습니다. +Linux는 Ubuntu 18.04, 20.04, Windows는 WSL2를 사용한 환경에서 테스트되었습니다. -Docker를 이용한 설치는 테스트버전만 제공됩니다. +Docker를 이용한 설치도 제공하고 있습니다. ## Docker를 이용한 설치 From 323b3d9d1670eb6bd02a639f17404680680e0c3c Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 21 Aug 2021 02:50:54 +0900 Subject: [PATCH 05/11] =?UTF-8?q?=ED=97=88=EB=B3=B4=EC=97=90=20=EC=88=98?= =?UTF-8?q?=EB=AA=B0=EC=9D=B4=20=EA=B0=99=EC=9D=B4=20=EB=93=A4=EC=96=B4?= =?UTF-8?q?=EA=B0=84=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/Nation/che_허보.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hwe/sammo/Command/Nation/che_허보.php b/hwe/sammo/Command/Nation/che_허보.php index fb007f28..ed7eadef 100644 --- a/hwe/sammo/Command/Nation/che_허보.php +++ b/hwe/sammo/Command/Nation/che_허보.php @@ -55,7 +55,7 @@ class che_허보 extends Command\NationCommand $this->setCity(); $this->setNation(['strategic_cmd_limit']); - + $this->minConditionConstraints = [ ConstraintHelper::OccupiedCity(), ConstraintHelper::BeChief(), @@ -184,12 +184,6 @@ class che_허보 extends Command\NationCommand ); $destNationLogger->flush(); - - $db->update('city', [ - 'def' => $db->sqleval('def * 0.2'), - 'wall' => $db->sqleval('wall * 0.2'), - ], 'city=%i', $destCityID); - $josaYiNation = JosaUtil::pick($nationName, '이'); $logger->pushGeneralHistoryLog("{$destCityName}허보를 발동"); From 96b60ce0f5a896fd4d2f6be569a53aca7829038f Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 21 Aug 2021 16:04:03 +0900 Subject: [PATCH 06/11] =?UTF-8?q?fix:=20=EB=AA=A8=EB=B3=91/=EC=A7=95?= =?UTF-8?q?=EB=B3=91=EC=97=90=EC=84=9C=20=EC=A1=B0=EA=B1=B4=20=EA=B2=80?= =?UTF-8?q?=EC=82=AC=EB=B6=80=20=ED=86=B5=EC=86=94=20=EA=B3=84=EC=82=B0?= =?UTF-8?q?=EA=B0=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Constraint/ReqGeneralCrewMargin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hwe/sammo/Constraint/ReqGeneralCrewMargin.php b/hwe/sammo/Constraint/ReqGeneralCrewMargin.php index 1381ffa6..d1d141e2 100644 --- a/hwe/sammo/Constraint/ReqGeneralCrewMargin.php +++ b/hwe/sammo/Constraint/ReqGeneralCrewMargin.php @@ -38,7 +38,8 @@ class ReqGeneralCrewMargin extends Constraint{ $reqCrewType = GameUnitConst::byID($this->arg); //XXX: 왜 General -> obj -> General 변환을 하고 있나? - $generalObj = new General($this->general, null, null, null, null, null, false); + //FIXME: RankVar, city에 따라 통솔이 바뀐다면 이 부분에 문제가 발생. + $generalObj = new General($this->general, null, null, null, null, null, true); if($reqCrewType->id != $generalObj->getCrewTypeObj()->id){ return true; From 6402028c176f4ad596770f07cf19488aa8b44d94 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 4 Sep 2021 03:42:09 +0900 Subject: [PATCH 07/11] =?UTF-8?q?fix:=20m=EC=9E=A5,=20=EC=9D=98=EB=B3=91?= =?UTF-8?q?=EC=9E=A5=20=EC=88=99=EB=A0=A8=EC=9D=B4=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Scenario/GeneralBuilder.php | 47 +++++++++++++-------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/hwe/sammo/Scenario/GeneralBuilder.php b/hwe/sammo/Scenario/GeneralBuilder.php index 59d26349..c3e744bf 100644 --- a/hwe/sammo/Scenario/GeneralBuilder.php +++ b/hwe/sammo/Scenario/GeneralBuilder.php @@ -16,22 +16,22 @@ class GeneralBuilder{ protected $owner = 0; protected $ownerName = null; - protected $affinity=null; + protected $affinity=null; protected $nameCustomPrefix=null; - protected $name; + protected $name; protected $imgsvr = 0; - protected $picturePath; - protected $nationID; - protected $cityID; - protected $leadership=null; - protected $strength=null; - protected $intel=null; + protected $picturePath; + protected $nationID; + protected $cityID; + protected $leadership=null; + protected $strength=null; + protected $intel=null; protected $officerLevel; - protected $birth=null; - protected $death=null; + protected $birth=null; + protected $death=null; protected $ego=null; - protected $specialDomestic=null; - protected $specialWar=null; + protected $specialDomestic=null; + protected $specialWar=null; protected $npc = 2; protected $text; static $prefixList = [ @@ -42,7 +42,7 @@ class GeneralBuilder{ 4 => 'ⓖ', //의병장(전략) 5 => '㉥', //부대장 6 => 'ⓤ', //unselectable npc, 빙의 불가 npc - + 9 => 'ⓞ', //오랑캐? ]; @@ -66,12 +66,12 @@ class GeneralBuilder{ protected $aux = []; public function __construct( - string $name, + string $name, bool $isDynamicImageSvr, - $picturePath, + $picturePath, int $nationID ){ - + $this->name = $name; $this->imgsvr = $isDynamicImageSvr; $this->picturePath = $picturePath; @@ -144,7 +144,7 @@ class GeneralBuilder{ $this->specialDomestic = $specialDomestic; $this->specialWar = $specialWar; return $this; - + } public function setOfficerLevel(int $level):self{ @@ -380,7 +380,7 @@ class GeneralBuilder{ if($this->specialWar === null){ $this->specialWar = GameConst::$defaultSpecialWar; } - + if($this->killturn === null && $this->owner){ $this->killturn = 5; } @@ -408,7 +408,7 @@ class GeneralBuilder{ $this->death = $this->birth+Util::randRangeInt(60, 80); } - + if($this->specAge===null){ $age = $env['year']-$this->birth; $relYear = Util::valueFit($env['year'] - $env['startyear'], 0); @@ -459,7 +459,7 @@ class GeneralBuilder{ } } - if($this->dex1 === null){ + if(!$this->dex1 && in_array('dex_t', $avgGen)){ $dexTotal = $avgGen['dex_t']; if ($pickType == '무') { $dexVal = Util::choiceRandom([ @@ -532,7 +532,7 @@ class GeneralBuilder{ public function build($env){ //scenario에 life==1인 경우 수명 제한이 없어지는 모양. - + if(!key_exists('stored_icons', $env)){ try{ @@ -542,7 +542,7 @@ class GeneralBuilder{ catch(\Exception $e){ $storedIcons = []; } - + $env['stored_icons'] = $storedIcons; } @@ -559,7 +559,7 @@ class GeneralBuilder{ else{ $name = $this->nameCustomPrefix.$this->name; } - + $this->realName = $name; if($this->death <= $year){ @@ -635,7 +635,6 @@ class GeneralBuilder{ '@phan-var array $cityObj'; $this->cityID = $cityObj['id']; } - $experience = $this->experience?:$age * 100; $dedication = $this->dedication?:$age * 100; From eae48f9564b64b417966e1dfd55c138a0af24ebc Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 5 Sep 2021 23:02:52 +0900 Subject: [PATCH 08/11] =?UTF-8?q?warning=20=EB=A9=94=EC=8B=9C=EC=A7=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_currentCity.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hwe/b_currentCity.php b/hwe/b_currentCity.php index 827d7b34..c8a62618 100644 --- a/hwe/b_currentCity.php +++ b/hwe/b_currentCity.php @@ -229,7 +229,7 @@ $generalTurnList = []; if($generals){ foreach($db->queryAllLists( - 'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC', + 'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC', array_column($generals, 'no') ) as [$generalID, $turnIdx, $brief] ){ @@ -268,7 +268,7 @@ foreach($generals as $general){ $isNPC = $general['npc']>1; $wounded = $general['injury']; - + $name = $general['name']; $nameText = formatName($name, $general['npc']); @@ -325,7 +325,7 @@ foreach($generals as $general){ else{ $turnText = ''; } - + $generalsFormat[] = [ 'ourGeneral'=>$ourGeneral, 'iconPath'=>GetImageURL($general['imgsvr']).'/'.$general['picture'], @@ -377,7 +377,7 @@ $genTotal = 0; foreach($generalsFormat as $general){ - if($general['nation'] == 0){ + if(!$general['nation'] || !$myNation['nation']){ continue; } if($general['nation'] != $myNation['nation']){ @@ -407,7 +407,7 @@ foreach($generalsFormat as $general){ } $chkDef = false; - + if($minTrain >= 80){ $crew80 += $general['crew']; $gen80 += 1; @@ -424,7 +424,7 @@ foreach($generalsFormat as $general){ $chkDef = true; } - + } @@ -520,4 +520,3 @@ foreach($generalsFormat as $general){ - From 90dea7517b3005ca6b037ed502f593b6d37b8bf6 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 5 Sep 2021 23:05:06 +0900 Subject: [PATCH 09/11] fix: div 0 --- hwe/sammo/GeneralAI.php | 152 ++++++++++++++++++++-------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 511cf223..273f9755 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -97,7 +97,7 @@ class GeneralAI else{ $this->city = $general->getRawCity(); } - + $this->nation = $db->queryFirstRow( 'SELECT nation,name,color,capital,capset,gennum,gold,rice,bill,rate,rate_tmp,scout,war,strategic_cmd_limit,surlimit,tech,power,level,chief_set,type,aux FROM nation WHERE nation = %i', $general->getNationID() @@ -144,7 +144,7 @@ class GeneralAI $this->fullStrength = $general->getStrength(false); $this->fullIntel = $general->getIntel(false); - + $this->genType = $this->calcGenType($general); $this->calcDiplomacyState(); @@ -184,7 +184,7 @@ class GeneralAI $genType |= self::t통솔장; } return $genType; - + } protected function calcDiplomacyState() @@ -228,9 +228,9 @@ class GeneralAI if(!$onWar && !$onWarReady && !$onWarYet){ $warTargetNation[0] = 1; } - + $this->warTargetNation = $warTargetNation; - + $minWarTerm = $db->queryFirstField('SELECT min(term) FROM diplomacy WHERE me = %i AND state=1', $nationID); if ($minWarTerm === null) { @@ -271,7 +271,7 @@ class GeneralAI } $this->calcWarRoute(); $troopCandidate = []; - + $chiefTurn = cutTurn($this->general->getTurnTime(), $this->env['turnterm']); $yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']); @@ -319,8 +319,8 @@ class GeneralAI $troopCandidate[] = [$leaderID, Util::choiceRandom($this->frontCities)['city']]; continue; } - - + + //출발지가 아국땅이 아닌경우 수도->출발지 if(!key_exists($fromCityID, $this->supplyCities)){ $toCityID = $fromCityID; @@ -377,7 +377,7 @@ class GeneralAI $chiefTurn = cutTurn($this->general->getTurnTime(), $this->env['turnterm']); $yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']); - + $troopCandidate = []; foreach($this->troopLeaders as $troopLeader){ $leaderID = $troopLeader->getID(); @@ -416,7 +416,7 @@ class GeneralAI if(!$troopCandidate){ return null; } - + if(count($this->supplyCities) == 1){ return null; } @@ -485,7 +485,7 @@ class GeneralAI if(!$troopCandidate){ return null; } - + $cityCandidates = []; foreach($this->frontCities as $city){ @@ -679,7 +679,7 @@ class GeneralAI if($pop_ratio < $this->nationPolicy->safeRecruitCityPopulationRatio){ $pop_ratio /= 4; } - + $recruitableCityList[$cityID] = $pop_ratio; } @@ -746,9 +746,9 @@ class GeneralAI $troopID = $lostGeneral->getVar('troop'); if($troopID && key_exists($troopID, $this->troopLeaders)){ $troopLeader = $this->troopLeaders[$troopID]; - + if( - key_exists($troopLeader->getCityID(), $this->supplyCities) && + key_exists($troopLeader->getCityID(), $this->supplyCities) && $this->troopLeaders[$troopID]->getTurnTime() < $lostGeneral->getTurnTime() ){ //이미 탈출 가능한 부대를 탔다 @@ -770,10 +770,10 @@ class GeneralAI if(!$args){ return null; } - + $arg = Util::choiceRandom($args); $cmd = buildNationCommandClass('che_발령', $this->general, $this->env, $lastTurn, $arg); - + if(!$cmd->hasFullConditionMet()){ LogText('구출실패', [$arg, $cmd->getFailString()]); return null; @@ -840,7 +840,7 @@ class GeneralAI return $cmd; } - + protected function do유저장내정발령(LastTurn $lastTurn): ?NationCommand { if(!$this->nation['capital']){ @@ -870,7 +870,7 @@ class GeneralAI if(!key_exists($cityID, $this->supplyCities)){ continue; } - + $city = $this->supplyCities[$cityID]; if($city['dev'] < 0.95){ @@ -980,7 +980,7 @@ class GeneralAI if($pop_ratio < $this->nationPolicy->safeRecruitCityPopulationRatio){ continue; } - + $recruitableCityList[$cityID] = $pop_ratio; } @@ -1227,7 +1227,7 @@ class GeneralAI $reqMoney = max($reqMoney, $reqHumanMinRes); } $enoughMoney = $reqMoney * 1.1; - + if ($targetUserGeneral->getVar($resName) >= $reqMoney) { continue; } @@ -1257,9 +1257,9 @@ class GeneralAI if(!$candidateArgs){ return null; } - + $cmd = buildNationCommandClass( - 'che_포상', $this->general, $this->env, $lastTurn, + 'che_포상', $this->general, $this->env, $lastTurn, Util::choiceRandomUsingWeightPair($candidateArgs) ); if(!$cmd->hasFullConditionMet()){ @@ -1295,7 +1295,7 @@ class GeneralAI $userGenerals = $this->userGenerals; - + foreach($remainResource as $resName=>[$reqNationRes, $resVal,$reqHumanMinWarRes,$reqHumanMinDevelRes]){ if($resVal < $reqNationRes){ @@ -1333,7 +1333,7 @@ class GeneralAI $reqMoney = max($reqMoney, $reqHumanMinRes); } $enoughMoney = $reqMoney * 1.2; - + if ($targetUserGeneral->getVar($resName) >= $reqMoney) { continue; } @@ -1360,13 +1360,13 @@ class GeneralAI ]; } } - + if(!$candidateArgs){ return null; } - + $cmd = buildNationCommandClass( - 'che_포상', $this->general, $this->env, $lastTurn, + 'che_포상', $this->general, $this->env, $lastTurn, Util::choiceRandomUsingWeightPair($candidateArgs) ); if(!$cmd->hasFullConditionMet()){ @@ -1422,7 +1422,7 @@ class GeneralAI $reqMoney = max($reqMoney, $reqNPCMinWarRes); } $enoughMoney = $reqMoney * 1.2; - + if ($targetNPCGeneral->getVar($resName) >= $reqMoney) { continue; } @@ -1453,9 +1453,9 @@ class GeneralAI if(!$candidateArgs){ return null; } - + $cmd = buildNationCommandClass( - 'che_포상', $this->general, $this->env, $lastTurn, + 'che_포상', $this->general, $this->env, $lastTurn, Util::choiceRandomUsingWeightPair($candidateArgs) ); if(!$cmd->hasFullConditionMet()){ @@ -1514,7 +1514,7 @@ class GeneralAI $reqMoney = max($reqMoney, $reqNPCMinWarRes); } $enoughMoney = $reqMoney * 1.5; - + if ($targetNPCGeneral->getVar($resName) >= $reqMoney) { continue; } @@ -1570,9 +1570,9 @@ class GeneralAI if(!$candidateArgs){ return null; } - + $cmd = buildNationCommandClass( - 'che_포상', $this->general, $this->env, $lastTurn, + 'che_포상', $this->general, $this->env, $lastTurn, Util::choiceRandomUsingWeightPair($candidateArgs) ); if(!$cmd->hasFullConditionMet()){ @@ -1654,14 +1654,14 @@ class GeneralAI return -($lhs->getVar($resName) <=> $rhs->getVar($resName)); }); - + foreach($npcWarGenerals as $idx=>$targetNPCGeneral){ if($willTakeSmallAmount){ if($targetNPCGeneral->getVar($resName) <= $reqNPCMinWarRes * 2){ break; } - + } else if($targetNPCGeneral->getVar($resName) <= $reqNPCMinWarRes){ break; @@ -1700,9 +1700,9 @@ class GeneralAI if(!$candidateArgs){ return null; } - + $cmd = buildNationCommandClass( - 'che_몰수', $this->general, $this->env, $lastTurn, + 'che_몰수', $this->general, $this->env, $lastTurn, Util::choiceRandomUsingWeightPair($candidateArgs) ); if(!$cmd->hasFullConditionMet()){ @@ -1777,7 +1777,7 @@ class GeneralAI return null; } - + [$targetYear, $targetMonth] = Util::parseYearMonth($yearMonth + $diplomatMonth); $cmd = buildNationCommandClass('che_불가침제의', $this->general, $this->env, $lastTurn, [ @@ -1788,10 +1788,10 @@ class GeneralAI if(!$cmd->hasFullConditionMet()){ return null; } - + $respAssistTry["n{$destNationID}"] = [$destNationID, $yearMonth]; $nationStor->setValue('resp_assist_try', $respAssistTry); - + return $cmd; } @@ -1900,7 +1900,7 @@ class GeneralAI else{ $warNations[$destNationID] = 1 / sqrt($destNationPower + 1); } - + } if (!$nations) { if(!$warNations){ @@ -1964,7 +1964,7 @@ class GeneralAI //checkSupply()와 비슷하면서 다름 - + $nationCityIDList = []; $this->categorizeNationCities(); foreach($this->nationCities as $city){ @@ -1987,7 +1987,7 @@ class GeneralAI //수도와 연결된 도시 탐색 while(!$queue->isEmpty()){ $cityID = $queue->dequeue(); - + foreach(array_keys(CityConst::byID($cityID)->path) as $nextCityID){ if(!key_exists($nextCityID, $nationCityIDList)){ continue; @@ -2049,7 +2049,7 @@ class GeneralAI } $targetCityID = Util::choiceRandom($candidates); } - + $cmd = buildNationCommandClass('che_천도', $this->general, $this->env, $lastTurn, [ 'destCityID'=>$targetCityID ]); @@ -2058,7 +2058,7 @@ class GeneralAI return null; } - + $nationStor->last천도Trial = [$general->getVar('officer_level'), $general->getTurnTime()]; return $cmd; } @@ -2332,7 +2332,7 @@ class GeneralAI $absGold = $general->getVar('gold'); $absRice = $general->getVar('rice'); - + $relGold = $absGold; $relRice = $absRice * $deathRate; @@ -2374,7 +2374,7 @@ class GeneralAI { $tryBuying = true; } - + } else{ if($relRice * 2 < $relGold && $relRice < $riceCost * 3) @@ -2409,7 +2409,7 @@ class GeneralAI { $trySelling = true; } - + } else{ if($relGold * 2 < $relRice && $relGold < $goldCost * 3) @@ -2433,7 +2433,7 @@ class GeneralAI } } - + return null; } @@ -2448,7 +2448,7 @@ class GeneralAI return null; } - + $general = $this->getGeneralObj(); $city = $this->city; @@ -2470,7 +2470,7 @@ class GeneralAI (Util::randF($remainPop/$maxPop))){ return null; } - + } $nationID = $general->getNationID(); @@ -2499,7 +2499,7 @@ class GeneralAI GameUnitConst::T_WIZARD => sqrt($general->getVar('dex4') + 500), GameUnitConst::T_SIEGE => sqrt($general->getVar('dex5') + 500), ]; - + $availableArmType = []; if($this->fullStrength > $this->fullIntel * 0.9){ $availableArmType[GameUnitConst::T_FOOTMAN] = $dex[GameUnitConst::T_FOOTMAN] * $this->fullStrength; @@ -2548,7 +2548,7 @@ class GeneralAI //굳이 뽑은 이유가 있겠지 $type = $currCrewType->id; } - } + } } //XXX: 훈련, 사기진작 금액을 하드코딩으로 계산중 @@ -2566,7 +2566,7 @@ class GeneralAI $riceCost = $crewType->riceWithTech( $this->nation['tech'], - $this->fullLeadership*100 * + $this->fullLeadership*100 * $general->getRankVar('killcrew')/max($general->getRankVar('deathcrew'),1)*1.2 ); @@ -2584,7 +2584,7 @@ class GeneralAI ]); } else if($gold < $cost && $gold * 2 >= $cost){ - $crew *= 0.5; + $crew *= 0.5; $riceCost *= 0.5; $crew = Util::round($crew-49, -2); $cmd = buildGeneralCommandClass('che_징병', $general, $env, [ @@ -2597,7 +2597,7 @@ class GeneralAI //이 쌀도 없어? return null; } - + if(!$cmd->hasFullConditionMet()){ return null; } @@ -2749,7 +2749,7 @@ class GeneralAI foreach($resourceMap as [$resKey, $reqNation, $reqNPCWar, $reqNPCDevel]){ $genRes = $general->getVar($resKey); - + if($this->genType & self::t통솔장){ $reqRes = $reqNPCWar; } @@ -2794,7 +2794,7 @@ class GeneralAI if($genRes < $reqRes * 1.5){ continue; } - if(!Util::randBool(($genRes / $reqRes)-0.5)){ + if($reqRes > 0 && !Util::randBool(($genRes / $reqRes)-0.5)){ continue; } $amount = $genRes - $reqRes; @@ -2917,7 +2917,7 @@ class GeneralAI 'optionText' => '순간이동', 'destCityID' => Util::choiceRandomUsingWeight($recruitableCityList), ]); - + if(!$cmd->hasFullConditionMet()){ LogText("{$this->general->getName()}, {$this->general->getID()} 후방워프 불가: 조건 불충족", $cmd->getArg()); @@ -2969,7 +2969,7 @@ class GeneralAI 'optionText' => '순간이동', 'destCityID' => Util::choiceRandomUsingWeight($candidateCities), ]); - + if(!$cmd->hasFullConditionMet()){ return null; @@ -2986,7 +2986,7 @@ class GeneralAI if(($this->genType & self::t통솔장)&&in_array($this->dipState, [self::d징병, self::d직전, self::d전쟁])){ return null; } - + $city = $this->city; if(Util::randBool(0.6)){ return null; @@ -3028,9 +3028,9 @@ class GeneralAI $realDevelRate += $develVal; } - + $realDevelRate /= $availableTypeCnt; - + if($realDevelRate >= 0.95){ continue; } @@ -3158,7 +3158,7 @@ class GeneralAI $prop = Util::randF() * (GameConst::$defaultStatNPCMax + GameConst::$chiefStatMin) / 2; $ratio = ($this->fullLeadership + $this->fullStrength + $this->fullIntel) / 3; - + if($prop >= $ratio){ return null; @@ -3251,7 +3251,7 @@ class GeneralAI if ($nationCnt == 0 || $notFullNationCnt == 0) { return null; } - + if (Util::randBool(pow(1 / ($nationCnt + 1) / pow($notFullNationCnt, 3), 1 / 4))) { return null; } @@ -3355,7 +3355,7 @@ class GeneralAI $nationID = $nation['nation']; $db = DB::db(); - + $nationCities = []; $frontCities = []; $supplyCities = []; @@ -3399,7 +3399,7 @@ class GeneralAI $userGenerals = []; $userCivilGenerals = []; $userWarGenerals = []; - + $lostGenerals = []; $npcCivilGenerals = []; $npcWarGenerals = []; @@ -3541,7 +3541,7 @@ class GeneralAI } foreach($this->nationPolicy->priority as $actionName){ - + if(!property_exists($this->nationPolicy, 'can'.$actionName)){ trigger_error ("can{$actionName}이 없음", E_USER_NOTICE ); continue; @@ -3625,7 +3625,7 @@ class GeneralAI return $result; } } - + if($npcType == 5){ if($general->getNationID()==0){ $general->setVar('killturn', 1); @@ -3765,10 +3765,10 @@ class GeneralAI continue; } - + $picked = false; foreach(Util::range(5) as $idx){ - + /** @var General */ if($this->npcWarGenerals){ $randGeneral = Util::choiceRandom($this->npcWarGenerals); @@ -3785,7 +3785,7 @@ class GeneralAI else{ break; } - + if($randGeneral->getVar('officer_level') != 1){ continue; } @@ -3864,7 +3864,7 @@ class GeneralAI } } - + $minBelong = min($this->general->getVar('belong') - 1, 3); $updatedChiefSet = 0; @@ -3910,7 +3910,7 @@ class GeneralAI }); - + foreach(Util::range(11, $minChiefLevel-1, -1) as $chiefLevel) { if(isOfficerSet($nation['chief_set'], $chiefLevel)){ continue; @@ -3918,7 +3918,7 @@ class GeneralAI if($this->general->getVar('officer_level') === $chiefLevel){ continue; } - + if(key_exists($chiefLevel, $this->chiefGenerals)){ $oldChief = $this->chiefGenerals[$chiefLevel]; if($oldChief->getNPCType() < 2 && $oldChief->getVar('killturn') >= $minChiefLevel){ @@ -3964,7 +3964,7 @@ class GeneralAI } $newChief = $general; - break; + break; } if(!$newChief){ From 7ebb22b89240cbe4d643542ccdc323e97fc6a45d Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 6 Sep 2021 02:17:56 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=EC=9E=AC=EC=95=BC=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=8F=84=EC=8B=9C=EB=B3=B4=EA=B8=B0=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_currentCity.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hwe/b_currentCity.php b/hwe/b_currentCity.php index c8a62618..8e8d178e 100644 --- a/hwe/b_currentCity.php +++ b/hwe/b_currentCity.php @@ -16,7 +16,11 @@ $db = DB::db(); increaseRefresh("현재도시", 1); $me = $db->queryFirstRow('SELECT no,nation,officer_level,city from general where owner=%i', $userID); -$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation']); +$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation'])??[ + 'nation'=>0, + 'level'=>0, + 'spy'=>'' +]; $templates = new \League\Plates\Engine('templates'); From 0a9c59f91ed342d67e0d2493a999a60c883045c2 Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 6 Sep 2021 02:30:00 +0900 Subject: [PATCH 11/11] =?UTF-8?q?fix:=20=EC=9D=80=ED=87=B4=20=EC=8B=9C=20?= =?UTF-8?q?=EC=88=99=EB=A0=A8=20=ED=8F=AC=EC=9D=B8=ED=8A=B8=EB=A5=BC=20?= =?UTF-8?q?=EC=A7=80=EB=82=98=EC=B9=98=EA=B2=8C=20=EB=A7=8E=EC=9D=B4=20?= =?UTF-8?q?=EB=B0=9B=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_gamerule.php | 23 ++++-- hwe/sammo/General.php | 174 +++++++++++++++++++++--------------------- 2 files changed, 102 insertions(+), 95 deletions(-) diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 3cf32b26..30d4d685 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -654,7 +654,7 @@ function updateNationState() } $score *= $trialCnt; - + $uniqueLotteryWeightList[$nationGen->getID()] = [$nationGen, $score]; } @@ -745,7 +745,7 @@ function checkStatistic() ]; $avgGeneral = $db->queryFirstRow( - 'SELECT avg(gold) as avggold, avg(rice) as avgrice, avg(dex1+dex2+dex3+dex4) as avgdex, + 'SELECT avg(gold) as avggold, avg(rice) as avgrice, avg(dex1+dex2+dex3+dex4) as avgdex, max(dex1+dex2+dex3+dex4) as maxdex, avg(experience+dedication) as avgexpded, max(experience+dedication) as maxexpded FROM general' ); @@ -1022,8 +1022,8 @@ function checkEmperior() $nation['generals'] = $nationGenerals; $tigers = $db->query( - 'SELECT value, name - FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no + 'SELECT value, name + FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no WHERE rank_data.nation_id = %i AND rank_data.type = "killnum" AND value > 0 ORDER BY value DESC LIMIT 5', $nationID ); // 오호장군 @@ -1034,8 +1034,8 @@ function checkEmperior() }, $tigers)); $eagles = $db->query( - 'SELECT value, name - FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no + 'SELECT value, name + FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7', $nationID ); // 건안칠자 @@ -1150,10 +1150,17 @@ function checkEmperior() LogHistory(); } -function resetInheritanceUser(int $userID){ +function resetInheritanceUser(int $userID, bool $isRebirth=false){ + $rebirthDegraded = [ + 'dex'=>0.5, + ]; + $inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$userID}"); $totalPoint = 0; - foreach($inheritStor->getAll() as [$value,]){ + foreach($inheritStor->getAll() as $key=>[$value,]){ + if(key_exists($key, $rebirthDegraded)){ + $value *= $rebirthDegraded[$key]; + } $totalPoint += $value; } $totalPoint = Util::toInt($totalPoint); diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index 0adfb822..206a2b8d 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -46,7 +46,7 @@ class General implements iAction{ 'tsw'=>1, 'tsd'=>1, 'tsl'=>1, 'tsg'=>1, 'tsp'=>1, 'tiw'=>1, 'tid'=>1, 'til'=>1, 'tig'=>1, 'tip'=>1, 'betwin'=>1, 'betgold'=>1, 'betwingold'=>1, - 'killcrew_person'=>1, 'deathcrew_person'=>1, + 'killcrew_person'=>1, 'deathcrew_person'=>1, 'occupied'=>1, ]; @@ -102,7 +102,7 @@ class General implements iAction{ if($nation === null){ $nation = getNationStaticInfo($raw['nation']); } - + $this->raw = $raw; $this->rawCity = $city; @@ -131,7 +131,7 @@ class General implements iAction{ $this->specialWarObj = buildGeneralSpecialWarClass($raw['special2']); $this->personalityObj = buildPersonalityClass($raw['personal']); - + $this->itemObjs['horse'] = buildItemClass($raw['horse']); $this->itemObjs['weapon'] = buildItemClass($raw['weapon']); $this->itemObjs['book'] = buildItemClass($raw['book']); @@ -140,9 +140,9 @@ class General implements iAction{ function initLogger(int $year, int $month){ $this->logger = new ActionLogger( - $this->getVar('no'), - $this->getVar('nation'), - $year, + $this->getVar('no'), + $this->getVar('nation'), + $year, $month, false ); @@ -330,10 +330,10 @@ class General implements iAction{ } /** - * @param General[] $generalList + * @param General[] $generalList * @param int $turnIdxFrom [$turnIdxFrom, $turnIdxTo) * @param int $turnIdxTo [$turnIdxFrom, $turnIdxTo) - * @param array $env + * @param array $env * @return GeneralCommand[] */ public function getReservedTurnList(int $turnIdxFrom, int $turnIdxTo, array $env){ @@ -346,9 +346,9 @@ class General implements iAction{ } $db = DB::db(); - + $generalID = $this->getID(); - + $result = []; $rawCmds = $db->queryFirstRow('SELECT * FROM general_turn WHERE general_id = %i AND %i <= turn_idx AND turn_idx < %i ORDER BY turn_idx ASC', $generalID, $turnIdxFrom, $turnIdxTo); @@ -359,23 +359,23 @@ class General implements iAction{ } return $result; } - + foreach($rawCmds as $turnIdx=>$rawCmd){ $result[$turnIdx] = buildGeneralCommandClass($rawCmd['action'], $this, $env, Json::decode($rawCmd['arg']??null)); } - + return $result; } /** * 장수의 스탯을 계산해옴 - * + * * @param string $statName 스탯값, leadership, strength, intel 가능 * @param bool $withInjury 부상값 사용 여부 * @param bool $withIActionObj 아이템, 특성, 성격 등 보정치 적용 여부 * @param bool $withStatAdjust 능력치간 보정 사용 여부 * @param bool $useFloor 내림 사용 여부, false시 float 값을 반환할 수도 있음 - * + * * @return int|float 계산된 능력치 */ @@ -416,7 +416,7 @@ class General implements iAction{ $statValue = $actionObj->onCalcStat($this, $statName, $statValue); } } - + foreach($this->itemObjs as $actionObj){ if($actionObj !== null){ $statValue = $actionObj->onCalcStat($this, $statName, $statValue); @@ -429,7 +429,7 @@ class General implements iAction{ if($useFloor){ return Util::toInt($statValue); } - + return $statValue; } @@ -486,7 +486,7 @@ class General implements iAction{ if($affectTrigger){ $experience = $this->onCalcStat($this, 'experience', $experience); } - + $this->increaseVar('experience', $experience); $nextExpLevel = getExpLevel($this->getVar('experience')); $comp = $nextExpLevel <=> $this->getVar('explevel'); @@ -503,14 +503,14 @@ class General implements iAction{ else{ $this->getLogger()->pushGeneralActionLog("Lv {$nextExpLevel}{$josaRo} 레벨다운!", ActionLogger::PLAIN); } - + } function addDedication(float $dedication, bool $affectTrigger=true){ if($affectTrigger){ $dedication = $this->onCalcStat($this, 'dedication', $dedication); } - + $this->increaseVar('dedication', $dedication); $nextDedLevel = getDedLevel($this->getVar('dedication')); $comp = $nextDedLevel <=> $this->getVar('dedlevel'); @@ -530,7 +530,7 @@ class General implements iAction{ else{ $this->getLogger()->pushGeneralActionLog("{$dedLevelText}{$josaRoDed} 강등되어 봉록이 {$billText}{$josaRoBill} 하락했습니다!", ActionLogger::PLAIN); } - + } function updateVar(string $key, $value){ @@ -583,7 +583,7 @@ class General implements iAction{ $dyingMessageObj = new TextDecoration\DyingMessage($this); $logger->pushGlobalActionLog($dyingMessageObj->getText()); } - $logger->flush(); + $logger->flush(); } $db->update('select_pool', [ @@ -611,7 +611,7 @@ class General implements iAction{ $ownerID = $this->getVar('owner'); if($ownerID){ $this->mergeTotalInheritancePoint(); - resetInheritanceUser($ownerID); + resetInheritanceUser($ownerID, true); } $this->multiplyVarWithLimit('leadership', 0.85, 10); @@ -701,7 +701,7 @@ class General implements iAction{ $this->setVar('last_turn', $this->getResultTurn()->toJson()); } $updateVals = $this->getUpdatedValues(); - + $generalID = $this->getID(); $result = false; @@ -726,7 +726,7 @@ class General implements iAction{ } $result = true; } - + if($this->rankVarSet){ foreach($this->rankVarSet as $rankKey => $rankVal){ $db->update('rank_data', [ @@ -736,7 +736,7 @@ class General implements iAction{ } $result = true; } - + $this->rankVarIncrease = []; $this->rankVarSet = []; @@ -779,14 +779,14 @@ class General implements iAction{ public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{ $caller = new GeneralTriggerCaller(); foreach(array_merge([ - $this->nationType, - $this->officerLevelObj, - $this->specialDomesticObj, - $this->specialWarObj, - $this->personalityObj, + $this->nationType, + $this->officerLevelObj, + $this->specialDomesticObj, + $this->specialWarObj, + $this->personalityObj, $this->getCrewTypeObj(), ], $this->itemObjs) as $iObj){ - + if(!$iObj){ continue; } @@ -798,11 +798,11 @@ class General implements iAction{ } public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ foreach(array_merge([ - $this->nationType, - $this->officerLevelObj, - $this->specialDomesticObj, - $this->specialWarObj, - $this->personalityObj, + $this->nationType, + $this->officerLevelObj, + $this->specialDomesticObj, + $this->specialWarObj, + $this->personalityObj, $this->getCrewTypeObj(), ], $this->itemObjs) as $iObj){ if(!$iObj){ @@ -817,11 +817,11 @@ class General implements iAction{ public function onCalcStat(General $general, string $statName, $value, $aux=null){ //xxx: $general? foreach(array_merge([ - $this->nationType, - $this->officerLevelObj, - $this->specialDomesticObj, - $this->specialWarObj, - $this->personalityObj, + $this->nationType, + $this->officerLevelObj, + $this->specialDomesticObj, + $this->specialWarObj, + $this->personalityObj, $this->getCrewTypeObj(), ], $this->itemObjs) as $iObj){ if(!$iObj){ @@ -835,11 +835,11 @@ class General implements iAction{ public function onCalcStrategic(string $turnType, string $varType, $value){ foreach(array_merge([ - $this->nationType, - $this->officerLevelObj, - $this->specialDomesticObj, - $this->specialWarObj, - $this->personalityObj, + $this->nationType, + $this->officerLevelObj, + $this->specialDomesticObj, + $this->specialWarObj, + $this->personalityObj, $this->getCrewTypeObj(), ], $this->itemObjs) as $iObj){ if(!$iObj){ @@ -853,11 +853,11 @@ class General implements iAction{ public function onCalcNationalIncome(string $type, $amount){ foreach(array_merge([ - $this->nationType, - $this->officerLevelObj, - $this->specialDomesticObj, - $this->specialWarObj, - $this->personalityObj, + $this->nationType, + $this->officerLevelObj, + $this->specialDomesticObj, + $this->specialWarObj, + $this->personalityObj, $this->getCrewTypeObj(), ], $this->itemObjs) as $iObj){ if(!$iObj){ @@ -874,11 +874,11 @@ class General implements iAction{ $att = 1; $def = 1; foreach(array_merge([ - $this->nationType, - $this->officerLevelObj, - $this->specialDomesticObj, - $this->specialWarObj, - $this->personalityObj, + $this->nationType, + $this->officerLevelObj, + $this->specialDomesticObj, + $this->specialWarObj, + $this->personalityObj, $this->getCrewTypeObj(), ], $this->itemObjs) as $iObj){ if(!$iObj){ @@ -894,11 +894,11 @@ class General implements iAction{ public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ $caller = new WarUnitTriggerCaller(); foreach(array_merge([ - $this->nationType, - $this->officerLevelObj, - $this->specialDomesticObj, - $this->specialWarObj, - $this->personalityObj, + $this->nationType, + $this->officerLevelObj, + $this->specialDomesticObj, + $this->specialWarObj, + $this->personalityObj, $this->getCrewTypeObj(), ], $this->itemObjs) as $iObj){ if(!$iObj){ @@ -921,11 +921,11 @@ class General implements iAction{ new WarUnitTrigger\che_계략실패($unit) ); foreach(array_merge([ - $this->nationType, - $this->officerLevelObj, - $this->specialDomesticObj, - $this->specialWarObj, - $this->personalityObj, + $this->nationType, + $this->officerLevelObj, + $this->specialDomesticObj, + $this->specialWarObj, + $this->personalityObj, $this->getCrewTypeObj(), ], $this->itemObjs) as $iObj){ if(!$iObj){ @@ -946,8 +946,8 @@ class General implements iAction{ 'horse', 'weapon', 'book', 'item', 'last_turn' ]; $fullColumn = [ - 'no', 'name', 'owner', 'owner_name', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity', - 'leadership', 'leadership_exp', 'strength', 'strength_exp', 'intel', 'intel_exp', 'weapon', 'book', 'horse', 'item', + 'no', 'name', 'owner', 'owner_name', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity', + 'leadership', 'leadership_exp', 'strength', 'strength_exp', 'intel', 'intel_exp', 'weapon', 'book', 'horse', 'item', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime', 'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong', 'personal', 'special', 'special2', 'defence_train', 'tnmt', 'npc', 'npc_org', 'deadyear', 'npcmsg', @@ -979,17 +979,17 @@ class General implements iAction{ } /** - * @param ?int[] $generalIDList - * @param null|string[] $column - * @param int $constructMode + * @param ?int[] $generalIDList + * @param null|string[] $column + * @param int $constructMode * @return \sammo\General[] - * @throws MustNotBeReachedException + * @throws MustNotBeReachedException */ static public function createGeneralObjListFromDB(?array $generalIDList, ?array $column=null, int $constructMode=2):array{ if($generalIDList === []){ return []; } - + $db = DB::db(); if($constructMode > 0){ $gameStor = KVStorage::getStorage($db, 'game_env'); @@ -999,7 +999,7 @@ class General implements iAction{ $year = null; $month = null; } - + [$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode); if($generalIDList === null){ @@ -1015,7 +1015,7 @@ class General implements iAction{ 'no' ); } - + $rawRanks = []; if($rankColumn){ @@ -1043,7 +1043,7 @@ class General implements iAction{ } $result[$generalID] = new static($rawGenerals[$generalID], $rawRanks[$generalID]??null, null, null, $year, $month, $constructMode > 1); } - + return $result; } @@ -1057,7 +1057,7 @@ class General implements iAction{ $year = null; $month = null; } - + [$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode); $rawGeneral = $db->queryFirstRow('SELECT %l FROM general WHERE no = %i', Util::formatListOfBackticks($column), $generalID); @@ -1072,17 +1072,17 @@ class General implements iAction{ $rawRankValues[$rankType] = $rankValue; } } - + $general = new static($rawGeneral, $rawRankValues, null, null, $year, $month, $constructMode > 1); - + return $general; } /** - * @param General[] $generalList - * @param int $turnIdx - * @param array $env + * @param General[] $generalList + * @param int $turnIdx + * @param array $env * @return GeneralCommand[] */ static public function getReservedTurnByGeneralList(array $generalList, int $turnIdx, array $env){ @@ -1110,10 +1110,10 @@ class General implements iAction{ } /** - * @param General[] $generalList + * @param General[] $generalList * @param int $turnIdxFrom [$turnIdxFrom, $turnIdxTo) * @param int $turnIdxTo [$turnIdxFrom, $turnIdxTo) - * @param array $env + * @param array $env * @return GeneralCommand[][] */ static public function getReservedTurnListByGeneralList(array $generalList, int $turnIdxFrom, int $turnIdxTo, array $env){ @@ -1135,7 +1135,7 @@ class General implements iAction{ }, $generalList); $db = DB::db(); - + $rawCmds = $db->queryFirstRow('SELECT * FROM general_turn WHERE general_id IN %i AND %i <= turn_idx AND turn_idx < %i ORDER BY general_id ASC, turn_idx ASC', $generalIDList, $turnIdxFrom, $turnIdxTo); $orderedRawCmds = []; foreach($rawCmds as $rawCmd){ @@ -1224,7 +1224,7 @@ class General implements iAction{ $extractFn = function() use ($multiplier){ $betWin = $this->getRankVar('betwin'); $betWinRate = $this->getRankVar('betwingold')/max(1, $this->getRankVar('betgold')); - + return [$betWin * $multiplier * pow($betWinRate, 2), null]; }; break; @@ -1272,7 +1272,7 @@ class General implements iAction{ if($gameStor->isunited != 0){ return; } - + $inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}"); $inheritStor->setValue($key, [$value, $aux]); }