diff --git a/hwe/a_genList.php b/hwe/a_genList.php index 36fa50dd..114f8197 100644 --- a/hwe/a_genList.php +++ b/hwe/a_genList.php @@ -129,13 +129,7 @@ echo" foreach($generalList as $general){ $nation = $nationname[$general['nation']]; - if ($general['level'] == 12) { - $lbonus = $nationlevel[$general['nation']] * 2; - } elseif ($general['level'] >= 5) { - $lbonus = $nationlevel[$general['nation']]; - } else { - $lbonus = 0; - } + $lbonus = calcLeadershipBonus($general['level'], $nationlevel[$general['nation']]); if ($lbonus > 0) { $lbonusText = "+{$lbonus}"; } else { diff --git a/hwe/b_genList.php b/hwe/b_genList.php index 7e9a2c34..69b873a2 100644 --- a/hwe/b_genList.php +++ b/hwe/b_genList.php @@ -130,13 +130,7 @@ foreach ($generals as &$general) { $genCntEff += 1; } - if ($general['level'] == 12) { - $lbonus = $nation['level'] * 2; - } elseif ($general['level'] >= 5) { - $lbonus = $nation['level']; - } else { - $lbonus = 0; - } + $lbonus = calcLeadershipBonus($general['level'], $nationlevel[$general['nation']]); if ($lbonus > 0) { $lbonusText = "+{$lbonus}"; } else { diff --git a/hwe/b_myGenInfo.php b/hwe/b_myGenInfo.php index cc976b84..6a42b799 100644 --- a/hwe/b_myGenInfo.php +++ b/hwe/b_myGenInfo.php @@ -122,13 +122,7 @@ echo" "; foreach($generalList as $general){ - if($general['level'] == 12) { - $lbonus = $nationLevel * 2; - } elseif($general['level'] >= 5) { - $lbonus = $nationLevel; - } else { - $lbonus = 0; - } + $lbonus = calcLeadershipBonus($general['level'], $nationLevel); if($lbonus > 0) { $lbonus = "+{$lbonus}"; } else { diff --git a/hwe/func.php b/hwe/func.php index fc8ec6d2..57366ada 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -641,13 +641,7 @@ function generalInfo($no) { $nation = getNationStaticInfo($general['nation']); - if($general['level'] == 12) { - $lbonus = $nation['level'] * 2; - } elseif($general['level'] >= 5) { - $lbonus = $nation['level']; - } else { - $lbonus = 0; - } + $lbonus = calcLeadershipBonus($general['level'], $nation['level']); if($lbonus > 0) { $lbonus = "+{$lbonus}"; } else { diff --git a/hwe/func_process.php b/hwe/func_process.php index 529540bd..45491078 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -62,20 +62,6 @@ function calcLeadershipBonus($generalLevel, $nationLevel):int{ return $lbonus; } -/** - * 수뇌직 통솔 보너스 계산 - * - * @param array &$general 장수 정보. 'lbonus' 값에 통솔 보너스가 입력 됨 - * @param int $nationLevel 국가 등급 - * - * @return int 계산된 $general['lbonus'] 값 - */ -function setLeadershipBonus(&$general, $nationLevel){ - $lbonus = calcLeadershipBonus($general['level'], $nationLevel); - $general['lbonus'] = $lbonus; - return $lbonus; -} - function CriticalScoreEx(string $type):float { if ($type == 'success') { return Util::randRange(2.2, 3.0); diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index 22997baa..295d094b 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -46,7 +46,6 @@ class General implements iAction{ //TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함. $staticNation = getNationStaticInfo($raw['nation']); - setLeadershipBonus($raw, $staticNation['level']); $this->raw = $raw; $this->rawCity = $city; @@ -67,7 +66,7 @@ class General implements iAction{ $nationTypeClass = getNationTypeClass($staticNation['type']); $this->nationType = new $nationTypeClass; - $this->levelObj = new TriggerGeneralLevel($this->raw, $city); + $this->levelObj = new TriggerGeneralLevel($this->raw, $staticNation['level'], $city); $specialDomesticClass = getGeneralSpecialDomesticClass($raw['special']); $this->specialDomesticObj = new $specialDomesticClass; diff --git a/hwe/sammo/TriggerGeneralLevel.php b/hwe/sammo/TriggerGeneralLevel.php index 9a3ab752..5cd3436f 100644 --- a/hwe/sammo/TriggerGeneralLevel.php +++ b/hwe/sammo/TriggerGeneralLevel.php @@ -5,10 +5,14 @@ class TriggerGeneralLevel implements iAction{ use DefaultAction; protected $generalLevel; + protected $nationLevel; + protected $lbonus; - public function __construct(array $general, ?array $city){ + public function __construct(array $general, int $nationLevel, ?array $city){ $this->generalLevel = $general['level']; + $this->nationLevel = $nationLevel; + if($city === null){ if(2 <= $this->generalLevel || $this->generalLevel <= 4){ $this->generalLevel = 1; @@ -31,6 +35,8 @@ class TriggerGeneralLevel implements iAction{ } } } + + $this->lbonus = calcLeadershipBonus($this->generalLevel, $nationLevel); } public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ @@ -57,4 +63,11 @@ class TriggerGeneralLevel implements iAction{ return $value; } + + public function onCalcStat(General $general, string $statName, $value, $aux=null){ + if($statName == 'leadership'){ + return $value + $this->lbonus; + } + return $value; + } } \ No newline at end of file