lbonus를TriggerGeneralLevel, calcLeadershipBonus로통합
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user