feat: scenarioEffect 추가

- 모든 General에 iAction으로 작동
This commit is contained in:
2023-08-05 06:53:19 +00:00
parent e54a0a6668
commit 16cfa46864
5 changed files with 66 additions and 14 deletions
+9 -14
View File
@@ -42,6 +42,9 @@ class General extends GeneralBase implements iAction
protected $itemObjs = [];
/** @var ?iAction */
protected $inheritBuffObj = null;
/** @var ?iAction */
protected $scenarioEffect = null;
/** @var ?GameUnitDetail */
protected $crewType = null;
@@ -108,6 +111,10 @@ class General extends GeneralBase implements iAction
if ($rawInheritBuff !== null) {
$this->inheritBuffObj = new TriggerInheritBuff($rawInheritBuff);
}
if(GameConst::$scenarioEffectName){
$this->scenarioEffect = buildScenarioEffectClass(GameConst::$scenarioEffectName);
}
}
function setItem(string $itemKey = 'item', ?string $itemCode)
@@ -351,20 +358,7 @@ class General extends GeneralBase implements iAction
$statValue = Util::clamp($statValue, 0, GameConst::$maxLevel);
if ($withIActionObj) {
foreach ([
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->inheritBuffObj,
] as $actionObj) {
if ($actionObj !== null) {
$statValue = $actionObj->onCalcStat($this, $statName, $statValue);
}
}
foreach ($this->itemObjs as $actionObj) {
foreach ($this->getActionList() as $actionObj) {
if ($actionObj !== null) {
$statValue = $actionObj->onCalcStat($this, $statName, $statValue);
}
@@ -774,6 +768,7 @@ class General extends GeneralBase implements iAction
$this->personalityObj,
$this->crewType,
$this->inheritBuffObj,
$this->scenarioEffect
], $this->itemObjs);
}