lbonus를TriggerGeneralLevel, calcLeadershipBonus로통합

This commit is contained in:
2019-10-04 13:02:16 +09:00
parent 674f3b95c5
commit 7abcbcda15
7 changed files with 19 additions and 45 deletions
+14 -1
View File
@@ -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;
}
}