lbonus를TriggerGeneralLevel, calcLeadershipBonus로통합
This commit is contained in:
+1
-7
@@ -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 = "<font color=cyan>+{$lbonus}</font>";
|
||||
} else {
|
||||
|
||||
+1
-7
@@ -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 = "<font color=cyan>+{$lbonus}</font>";
|
||||
} else {
|
||||
|
||||
+1
-7
@@ -122,13 +122,7 @@ echo"
|
||||
</tr>";
|
||||
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 = "<font color=cyan>+{$lbonus}</font>";
|
||||
} else {
|
||||
|
||||
+1
-7
@@ -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 = "<font color=cyan>+{$lbonus}</font>";
|
||||
} else {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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