stat 관련 데이터 수정

This commit is contained in:
2019-10-04 12:50:48 +09:00
parent 512266abf4
commit 4aef22aac8
9 changed files with 74 additions and 136 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ class che_징병 implements iAction{
}
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'rawLeadership'){
if($statName === 'leadership'){
return $value *= 1.15;
}
return $value;
@@ -65,7 +65,7 @@ class che_기술연구 extends che_상업투자{
$score = Util::valueFit($this->calcBaseScore(), 1);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general->getRaw(), static::$statKey);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
if($trust < 80){
$successRatio *= $trust / 80;
}
@@ -131,7 +131,7 @@ class che_상업투자 extends Command\GeneralCommand{
$score = Util::valueFit($this->calcBaseScore(), 1);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general->getRaw(), static::$statKey);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
if($trust < 80){
$successRatio *= $trust / 80;
}
@@ -99,7 +99,7 @@ class che_정착장려 extends Command\GeneralCommand{
$score = Util::valueFit($this->calcBaseScore(), 1);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general->getRaw(), static::$statKey);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
$successRatio = $general->onCalcDomestic(static::$cityKey, 'success', $successRatio);
$failRatio = $general->onCalcDomestic(static::$cityKey, 'fail', $failRatio);
@@ -100,7 +100,7 @@ class che_주민선정 extends Command\GeneralCommand{
$score = Util::valueFit($this->calcBaseScore(), 1);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general->getRaw(), static::$statKey);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
$successRatio = $general->onCalcDomestic(static::$cityKey, 'success', $successRatio);
$failRatio = $general->onCalcDomestic(static::$cityKey, 'fail', $failRatio);
+60 -4
View File
@@ -10,6 +10,9 @@ class General implements iAction{
* @var iAction $nationType
* @var iAction $levelObj
* @var iAction $specialDomesticObj
* @var iAction $specialWarObj
* @var iAction $personalityObj
* @var iAction[] $itemObjs
*/
protected $raw = [];
@@ -195,17 +198,70 @@ class General implements iAction{
return GameUnitConst::byID($this->getVar('crewtype'));
}
//TODO: 장기적으로 General 클래스로 모두 옮겨와야함.
/**
* 장수의 스탯을 계산해옴
*
* @param string $statName 스탯값, leadership, power, intel 가능
* @param bool $withInjury 부상값 사용 여부
* @param bool $withItem 아이템 적용 여부
* @param bool $withStatAdjust 추가 능력치 보정 사용 여부
* @param bool $useFloor 내림 사용 여부, false시 float 값을 반환할 수도 있음
*
* @return int|float 계산된 능력치
*/
protected function getStatValue(string $statName, $withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
$statValue = $this->getVar($statName);
if($withInjury){
$statValue *= (100 - $this->getVar('injury')) / 100;
}
if($withStatAdjust){
if($statName === 'power'){
$statValue *= Util::round($this->getStatValue('intel', $withInjury, $withItem, false, false) / 4);
}
else if($statName === 'intel'){
$statValue *= Util::round($this->getStatValue('power', $withInjury, $withItem, false, false) / 4);
}
}
foreach([
$this->nationType,
$this->levelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj
] as $actionObj){
if($actionObj !== null){
$statValue = $actionObj->onCalcStat($this, $statName, $statValue);
}
}
if($withItem){
foreach($this->itemObjs as $actionObj){
if($actionObj !== null){
$statValue = $actionObj->onCalcStat($this, $statName, $statValue);
}
}
}
if($useFloor){
return Util::toInt($statValue);
}
return $statValue;
}
function getLeadership($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
return getGeneralLeadership($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
return $this->getStatValue('leadership', $withInjury, $withItem, $withStatAdjust, $useFloor);
}
function getPower($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
return getGeneralPower($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
return $this->getStatValue('power', $withInjury, $withItem, $withStatAdjust, $useFloor);
}
function getIntel($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
return getGeneralIntel($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
return $this->getStatValue('intel', $withInjury, $withItem, $withStatAdjust, $useFloor);
}
function addDex(GameUnitDetail $crewType, float $exp, bool $affectTrainAtmos=false){
-3
View File
@@ -319,9 +319,6 @@ class NPC{
'crewtype'=>GameUnitConst::DEFAULT_CREWTYPE,
'train'=>0,
'atmos'=>0,
'weap'=>0,
'book'=>0,
'horse'=>0,
'turntime'=>$turntime,
'killturn'=>$killturn,
'age'=>$age,
+1 -1
View File
@@ -512,7 +512,7 @@ class WarUnitGeneral extends WarUnit{
//계략
if($crewType->magicCoef){
$magicRatio = getGeneralIntel($this->raw, true, true, true, false) / 100;
$magicRatio = $this->getGeneral()->getIntel(true, true, true, false) / 100;
$magicRatio *= $crewType->magicCoef;
if($specialWar == 41){