From 1301b379010498e342d7422cf9b1b485aefa702e Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 3 Sep 2018 01:03:51 +0900 Subject: [PATCH] =?UTF-8?q?=EB=82=B4=ED=8A=B9=EC=9D=84=20iActionTrigger?= =?UTF-8?q?=EB=A1=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_converter.php | 3 +- hwe/func_process.php | 18 ++++-- hwe/sammo/General.php | 14 ++++- hwe/sammo/SpecialityConst.php | 3 + hwe/sammo/TriggerGeneralLevel.php | 60 +++++++++++++++++++ hwe/sammo/TriggerSpecialDomestic/None.php | 20 +++++++ hwe/sammo/TriggerSpecialDomestic/che_경작.php | 29 +++++++++ hwe/sammo/TriggerSpecialDomestic/che_귀모.php | 25 ++++++++ hwe/sammo/TriggerSpecialDomestic/che_발명.php | 29 +++++++++ hwe/sammo/TriggerSpecialDomestic/che_상재.php | 29 +++++++++ hwe/sammo/TriggerSpecialDomestic/che_수비.php | 29 +++++++++ hwe/sammo/TriggerSpecialDomestic/che_인덕.php | 29 +++++++++ hwe/sammo/TriggerSpecialDomestic/che_축성.php | 29 +++++++++ hwe/sammo/TriggerSpecialDomestic/che_통찰.php | 29 +++++++++ 14 files changed, 339 insertions(+), 7 deletions(-) create mode 100644 hwe/sammo/TriggerGeneralLevel.php create mode 100644 hwe/sammo/TriggerSpecialDomestic/None.php create mode 100644 hwe/sammo/TriggerSpecialDomestic/che_경작.php create mode 100644 hwe/sammo/TriggerSpecialDomestic/che_귀모.php create mode 100644 hwe/sammo/TriggerSpecialDomestic/che_발명.php create mode 100644 hwe/sammo/TriggerSpecialDomestic/che_상재.php create mode 100644 hwe/sammo/TriggerSpecialDomestic/che_수비.php create mode 100644 hwe/sammo/TriggerSpecialDomestic/che_인덕.php create mode 100644 hwe/sammo/TriggerSpecialDomestic/che_축성.php create mode 100644 hwe/sammo/TriggerSpecialDomestic/che_통찰.php diff --git a/hwe/func_converter.php b/hwe/func_converter.php index 06ebdc27..1cd2112e 100644 --- a/hwe/func_converter.php +++ b/hwe/func_converter.php @@ -182,8 +182,7 @@ function getSpecialInfo(?int $type):?string{ 12 => ['통찰', '[내정] 치안 강화 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'], 20 => ['인덕', '[내정] 주민 선정·정착 장려 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'], - - 30 => ['거상', '이것 저것'], + 31 => ['귀모', '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'], 40 => ['귀병', '[군사] 귀병 계통 징·모병비 -10%
[전투] 계략 성공 확률 +20%p'], diff --git a/hwe/func_process.php b/hwe/func_process.php index 68f0ed02..328e1bec 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -208,14 +208,16 @@ function process_1(array $rawGeneral, int $type){ $actionName = '상업 투자'; } - $reqGold = $develCost; - [$startYear, $year, $month, $develCost] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'develcost']); - $general = new General($rawGeneral, $yera, $month); + $general = new General($rawGeneral, $year, $month); $logger = $general->getLogger(); - + $nationTypeObj = $general->getNationTypeObj(); + $generalLevelObj = $general->getGeneralLevelObj(); + + $reqGold = $nationTypeObj->onCalcDomestic($cityKey, 'cost', $develCost); + $reqGold = $generalLevelObj->onCalcDomestic($cityKey, 'cost', $develCost); $city = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $general->getCityID()); @@ -244,6 +246,14 @@ function process_1(array $rawGeneral, int $type){ $score *= $trust / 100; $score *= getDomesticExpLevelBonus($general['explevel']); $score *= Util::randRange(0.8, 1.2); + $score = $nationTypeObj->onCalcDomestic($cityKey, 'score', $score); + $score = $generalLevelObj->onCalcDomestic($cityKey, 'score', $score); + + ['succ'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, 2); + $successRatio = $naionTypeObj->onCalcDomestic($cityKey, 'success', $successRatio); + $successRatio = $generalLevelObj->onCalcDomestic($cityKey, 'success', $successRatio); + + } diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index ed32e31a..debf71b3 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -6,6 +6,7 @@ class General{ use LazyVarUpdater; protected $raw = []; + protected $rawCity = null; protected $logger; @@ -14,13 +15,15 @@ class General{ protected $isFinished = false; protected $nationType; + protected $levelObj; - public function __construct(array $raw, int $year, int $month){ + public function __construct(array $raw, ?array $city, int $year, int $month){ //TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함. $staticNation = getNationStaticInfo($raw['nation']); setLeadershipBonus($raw, $staticNation['level']); $this->raw = $raw; + $this->rawCity = $city; $this->logger = new ActionLogger( @@ -33,6 +36,7 @@ class General{ $nationTypeClass = getNationTypeClass($staticNation['type']); $this->nationType = new $nationTypeClass; + $this->levelObj = new TriggerGeneralLevel($this->raw, $city); } protected function clearActivatedSkill(){ @@ -90,6 +94,14 @@ class General{ return $this->logger; } + public function getNationTypeObj():iActionTrigger{ + return $this->nationType; + } + + public function getGeneralLevelObj():iActionTrigger{ + return $this->levelObj; + } + //TODO: 장기적으로 General 클래스로 모두 옮겨와야함. function getLeadership($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{ return getGeneralLeadership($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor); diff --git a/hwe/sammo/SpecialityConst.php b/hwe/sammo/SpecialityConst.php index 6fea7a21..9c406b18 100644 --- a/hwe/sammo/SpecialityConst.php +++ b/hwe/sammo/SpecialityConst.php @@ -18,6 +18,9 @@ class SpecialityConst{ const REQ_DEXTERITY = 0x4000; + const WEIGHT_NORM = 1; + const WEIGHT_PERCENT = 2; + private $invDomestic = null; private $invWar = null; diff --git a/hwe/sammo/TriggerGeneralLevel.php b/hwe/sammo/TriggerGeneralLevel.php new file mode 100644 index 00000000..b6466c7a --- /dev/null +++ b/hwe/sammo/TriggerGeneralLevel.php @@ -0,0 +1,60 @@ +generalLevel = $general['level']; + + if($city === null){ + if(2 <= $this->generalLevel || $this->generalLevel <= 4){ + $this->generalLevel = 1; + } + } + else{ + if($this->generalLevel == 2){ + if($city['gen3'] != $general['no']){ + $this->generalLevel = 1; + } + } + else if($this->generalLevel == 3){ + if($city['gen2'] != $general['no']){ + $this->generalLevel = 1; + } + } + else if($this->generalLevel == 4){ + if($city['gen1'] != $general['no']){ + $this->generalLevel = 1; + } + } + } + } + + public function onCalcDomestic(string $turnType, string $varType, float $value):float{ + if($turnType == 'agri' || $turnType == 'comm'){ + if(in_array($this->generalLevel, [12, 11, 9, 7, 5, 3])){ + return $value * 1.05; + } + } + else if($turnType == 'tech'){ + if(in_array($this->generalLevel, [12, 11, 9, 7, 5])){ + return $value * 1.05; + } + } + else if($turnType == 'trust' || $turnType == 'pop'){ + if(in_array($this->generalLevel, [12, 11, 2])){ + return $value * 1.05; + } + } + else if($turnType == 'def' || $turnType == 'wall' || $turnType == 'secu'){ + if(in_array($this->generalLevel, [12, 11, 10, 8, 6, 4])){ + return $value * 1.05; + } + } + + return $value; + } +} \ No newline at end of file diff --git a/hwe/sammo/TriggerSpecialDomestic/None.php b/hwe/sammo/TriggerSpecialDomestic/None.php new file mode 100644 index 00000000..06ad95bd --- /dev/null +++ b/hwe/sammo/TriggerSpecialDomestic/None.php @@ -0,0 +1,20 @@ +