내특을 iActionTrigger로 구현
This commit is contained in:
@@ -183,7 +183,6 @@ function getSpecialInfo(?int $type):?string{
|
|||||||
|
|
||||||
20 => ['인덕', '[내정] 주민 선정·정착 장려 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'],
|
20 => ['인덕', '[내정] 주민 선정·정착 장려 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'],
|
||||||
|
|
||||||
30 => ['거상', '이것 저것'],
|
|
||||||
31 => ['귀모', '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'],
|
31 => ['귀모', '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'],
|
||||||
|
|
||||||
40 => ['귀병', '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p'],
|
40 => ['귀병', '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p'],
|
||||||
|
|||||||
+13
-3
@@ -208,14 +208,16 @@ function process_1(array $rawGeneral, int $type){
|
|||||||
$actionName = '상업 투자';
|
$actionName = '상업 투자';
|
||||||
}
|
}
|
||||||
|
|
||||||
$reqGold = $develCost;
|
|
||||||
|
|
||||||
[$startYear, $year, $month, $develCost] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'develcost']);
|
[$startYear, $year, $month, $develCost] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'develcost']);
|
||||||
|
|
||||||
$general = new General($rawGeneral, $yera, $month);
|
$general = new General($rawGeneral, $year, $month);
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$nationTypeObj = $general->getNationTypeObj();
|
||||||
|
$generalLevelObj = $general->getGeneralLevelObj();
|
||||||
|
|
||||||
|
$reqGold = $nationTypeObj->onCalcDomestic($cityKey, 'cost', $develCost);
|
||||||
|
$reqGold = $generalLevelObj->onCalcDomestic($cityKey, 'cost', $develCost);
|
||||||
|
|
||||||
$city = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $general->getCityID());
|
$city = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $general->getCityID());
|
||||||
|
|
||||||
@@ -244,6 +246,14 @@ function process_1(array $rawGeneral, int $type){
|
|||||||
$score *= $trust / 100;
|
$score *= $trust / 100;
|
||||||
$score *= getDomesticExpLevelBonus($general['explevel']);
|
$score *= getDomesticExpLevelBonus($general['explevel']);
|
||||||
$score *= Util::randRange(0.8, 1.2);
|
$score *= Util::randRange(0.8, 1.2);
|
||||||
|
$score = $nationTypeObj->onCalcDomestic($cityKey, 'score', $score);
|
||||||
|
$score = $generalLevelObj->onCalcDomestic($cityKey, 'score', $score);
|
||||||
|
|
||||||
|
['succ'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, 2);
|
||||||
|
$successRatio = $naionTypeObj->onCalcDomestic($cityKey, 'success', $successRatio);
|
||||||
|
$successRatio = $generalLevelObj->onCalcDomestic($cityKey, 'success', $successRatio);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-1
@@ -6,6 +6,7 @@ class General{
|
|||||||
use LazyVarUpdater;
|
use LazyVarUpdater;
|
||||||
|
|
||||||
protected $raw = [];
|
protected $raw = [];
|
||||||
|
protected $rawCity = null;
|
||||||
|
|
||||||
protected $logger;
|
protected $logger;
|
||||||
|
|
||||||
@@ -14,13 +15,15 @@ class General{
|
|||||||
protected $isFinished = false;
|
protected $isFinished = false;
|
||||||
|
|
||||||
protected $nationType;
|
protected $nationType;
|
||||||
|
protected $levelObj;
|
||||||
|
|
||||||
public function __construct(array $raw, int $year, int $month){
|
public function __construct(array $raw, ?array $city, int $year, int $month){
|
||||||
//TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함.
|
//TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함.
|
||||||
|
|
||||||
$staticNation = getNationStaticInfo($raw['nation']);
|
$staticNation = getNationStaticInfo($raw['nation']);
|
||||||
setLeadershipBonus($raw, $staticNation['level']);
|
setLeadershipBonus($raw, $staticNation['level']);
|
||||||
$this->raw = $raw;
|
$this->raw = $raw;
|
||||||
|
$this->rawCity = $city;
|
||||||
|
|
||||||
|
|
||||||
$this->logger = new ActionLogger(
|
$this->logger = new ActionLogger(
|
||||||
@@ -33,6 +36,7 @@ class General{
|
|||||||
|
|
||||||
$nationTypeClass = getNationTypeClass($staticNation['type']);
|
$nationTypeClass = getNationTypeClass($staticNation['type']);
|
||||||
$this->nationType = new $nationTypeClass;
|
$this->nationType = new $nationTypeClass;
|
||||||
|
$this->levelObj = new TriggerGeneralLevel($this->raw, $city);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function clearActivatedSkill(){
|
protected function clearActivatedSkill(){
|
||||||
@@ -90,6 +94,14 @@ class General{
|
|||||||
return $this->logger;
|
return $this->logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNationTypeObj():iActionTrigger{
|
||||||
|
return $this->nationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGeneralLevelObj():iActionTrigger{
|
||||||
|
return $this->levelObj;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: 장기적으로 General 클래스로 모두 옮겨와야함.
|
//TODO: 장기적으로 General 클래스로 모두 옮겨와야함.
|
||||||
function getLeadership($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
|
function getLeadership($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
|
||||||
return getGeneralLeadership($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
|
return getGeneralLeadership($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ class SpecialityConst{
|
|||||||
|
|
||||||
const REQ_DEXTERITY = 0x4000;
|
const REQ_DEXTERITY = 0x4000;
|
||||||
|
|
||||||
|
const WEIGHT_NORM = 1;
|
||||||
|
const WEIGHT_PERCENT = 2;
|
||||||
|
|
||||||
private $invDomestic = null;
|
private $invDomestic = null;
|
||||||
private $invWar = null;
|
private $invWar = null;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo;
|
||||||
|
|
||||||
|
class TriggerGeneralLevel implements iActionTrigger{
|
||||||
|
use DefaultActionTrigger;
|
||||||
|
|
||||||
|
protected $generalLevel;
|
||||||
|
|
||||||
|
public function __construct(array $general, ?array $city){
|
||||||
|
$this->generalLevel = $general['level'];
|
||||||
|
|
||||||
|
if($city === null){
|
||||||
|
if(2 <= $this->generalLevel || $this->generalLevel <= 4){
|
||||||
|
$this->generalLevel = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if($this->generalLevel == 2){
|
||||||
|
if($city['gen3'] != $general['no']){
|
||||||
|
$this->generalLevel = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if($this->generalLevel == 3){
|
||||||
|
if($city['gen2'] != $general['no']){
|
||||||
|
$this->generalLevel = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if($this->generalLevel == 4){
|
||||||
|
if($city['gen1'] != $general['no']){
|
||||||
|
$this->generalLevel = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
|
||||||
|
if($turnType == 'agri' || $turnType == 'comm'){
|
||||||
|
if(in_array($this->generalLevel, [12, 11, 9, 7, 5, 3])){
|
||||||
|
return $value * 1.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if($turnType == 'tech'){
|
||||||
|
if(in_array($this->generalLevel, [12, 11, 9, 7, 5])){
|
||||||
|
return $value * 1.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if($turnType == 'trust' || $turnType == 'pop'){
|
||||||
|
if(in_array($this->generalLevel, [12, 11, 2])){
|
||||||
|
return $value * 1.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if($turnType == 'def' || $turnType == 'wall' || $turnType == 'secu'){
|
||||||
|
if(in_array($this->generalLevel, [12, 11, 10, 8, 6, 4])){
|
||||||
|
return $value * 1.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\TriggerSpecialDomestic;
|
||||||
|
use \sammo\iActionTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityConst;
|
||||||
|
|
||||||
|
class None implements iActionTrigger{
|
||||||
|
use \sammo\DefaultActionTrigger;
|
||||||
|
|
||||||
|
static $id = 0;
|
||||||
|
static $name = '-';
|
||||||
|
static $info = null;
|
||||||
|
|
||||||
|
static $selectWeightType = SpecialityConst::WEIGHT_NORM;
|
||||||
|
static $selectWeight = 0;
|
||||||
|
static $type = [
|
||||||
|
SpecialityConst::DISABLED
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\TriggerSpecialDomestic;
|
||||||
|
use \sammo\iActionTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityConst;
|
||||||
|
|
||||||
|
class che_경작 implements iActionTrigger{
|
||||||
|
use \sammo\DefaultActionTrigger;
|
||||||
|
|
||||||
|
static $id = 1;
|
||||||
|
static $name = '경작';
|
||||||
|
static $info = '[내정] 농지 개간 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
|
||||||
|
|
||||||
|
static $selectWeightType = SpecialityConst::WEIGHT_NORM;
|
||||||
|
static $selectWeight = 1;
|
||||||
|
static $type = [
|
||||||
|
SpecialityConst::STAT_INTEL
|
||||||
|
];
|
||||||
|
|
||||||
|
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
|
||||||
|
if($turnType == 'agri'){
|
||||||
|
if($varType == 'score') return $value * 1.1;
|
||||||
|
if($varType == 'cost') return $value * 0.8;
|
||||||
|
if($varType == 'succ') return $value + 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\TriggerSpecialDomestic;
|
||||||
|
use \sammo\iActionTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityConst;
|
||||||
|
|
||||||
|
class che_귀모 implements iActionTrigger{
|
||||||
|
use \sammo\DefaultActionTrigger;
|
||||||
|
|
||||||
|
static $id = 31;
|
||||||
|
static $name = '귀모';
|
||||||
|
static $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p';
|
||||||
|
|
||||||
|
static $selectWeightType = SpecialityConst::WEIGHT_PERCENT;
|
||||||
|
static $selectWeight = 2.5;
|
||||||
|
static $type = [
|
||||||
|
SpecialityConst::STAT_LEADERSHIP,
|
||||||
|
SpecialityConst::STAT_POWER,
|
||||||
|
SpecialityConst::STAT_INTEL
|
||||||
|
];
|
||||||
|
|
||||||
|
public function onCalcSabotageProp(float $successRate):float{
|
||||||
|
return $successRate + 0.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\TriggerSpecialDomestic;
|
||||||
|
use \sammo\iActionTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityConst;
|
||||||
|
|
||||||
|
class che_발명 implements iActionTrigger{
|
||||||
|
use \sammo\DefaultActionTrigger;
|
||||||
|
|
||||||
|
static $id = 3;
|
||||||
|
static $name = '발명';
|
||||||
|
static $info = '[내정] 기술 연구 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
|
||||||
|
|
||||||
|
static $selectWeightType = SpecialityConst::WEIGHT_NORM;
|
||||||
|
static $selectWeight = 1;
|
||||||
|
static $type = [
|
||||||
|
SpecialityConst::STAT_INTEL
|
||||||
|
];
|
||||||
|
|
||||||
|
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
|
||||||
|
if($turnType == 'tech'){
|
||||||
|
if($varType == 'score') return $value * 1.1;
|
||||||
|
if($varType == 'cost') return $value * 0.8;
|
||||||
|
if($varType == 'succ') return $value + 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\TriggerSpecialDomestic;
|
||||||
|
use \sammo\iActionTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityConst;
|
||||||
|
|
||||||
|
class che_상재 implements iActionTrigger{
|
||||||
|
use \sammo\DefaultActionTrigger;
|
||||||
|
|
||||||
|
static $id = 2;
|
||||||
|
static $name = '상재';
|
||||||
|
static $info = '[내정] 상업 투자 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
|
||||||
|
|
||||||
|
static $selectWeightType = SpecialityConst::WEIGHT_NORM;
|
||||||
|
static $selectWeight = 1;
|
||||||
|
static $type = [
|
||||||
|
SpecialityConst::STAT_INTEL
|
||||||
|
];
|
||||||
|
|
||||||
|
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
|
||||||
|
if($turnType == 'comm'){
|
||||||
|
if($varType == 'score') return $value * 1.1;
|
||||||
|
if($varType == 'cost') return $value * 0.8;
|
||||||
|
if($varType == 'succ') return $value + 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\TriggerSpecialDomestic;
|
||||||
|
use \sammo\iActionTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityConst;
|
||||||
|
|
||||||
|
class che_수비 implements iActionTrigger{
|
||||||
|
use \sammo\DefaultActionTrigger;
|
||||||
|
|
||||||
|
static $id = 11;
|
||||||
|
static $name = '수비';
|
||||||
|
static $info = '[내정] 수비 강화 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
|
||||||
|
|
||||||
|
static $selectWeightType = SpecialityConst::WEIGHT_NORM;
|
||||||
|
static $selectWeight = 1;
|
||||||
|
static $type = [
|
||||||
|
SpecialityConst::STAT_POWER
|
||||||
|
];
|
||||||
|
|
||||||
|
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
|
||||||
|
if($turnType == 'def'){
|
||||||
|
if($varType == 'score') return $value * 1.1;
|
||||||
|
if($varType == 'cost') return $value * 0.8;
|
||||||
|
if($varType == 'succ') return $value + 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\TriggerSpecialDomestic;
|
||||||
|
use \sammo\iActionTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityConst;
|
||||||
|
|
||||||
|
class che_통찰 implements iActionTrigger{
|
||||||
|
use \sammo\DefaultActionTrigger;
|
||||||
|
|
||||||
|
static $id = 20;
|
||||||
|
static $name = '인덕';
|
||||||
|
static $info = '[내정] 주민 선정·정착 장려 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
|
||||||
|
|
||||||
|
static $selectWeightType = SpecialityConst::WEIGHT_NORM;
|
||||||
|
static $selectWeight = 1;
|
||||||
|
static $type = [
|
||||||
|
SpecialityConst::STAT_LEADERSHIP
|
||||||
|
];
|
||||||
|
|
||||||
|
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
|
||||||
|
if($turnType == 'trust' || $turnType == 'pop'){
|
||||||
|
if($varType == 'score') return $value * 1.1;
|
||||||
|
if($varType == 'cost') return $value * 0.8;
|
||||||
|
if($varType == 'succ') return $value + 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\TriggerSpecialDomestic;
|
||||||
|
use \sammo\iActionTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityConst;
|
||||||
|
|
||||||
|
class che_축성 implements iActionTrigger{
|
||||||
|
use \sammo\DefaultActionTrigger;
|
||||||
|
|
||||||
|
static $id = 10;
|
||||||
|
static $name = '축성';
|
||||||
|
static $info = '[내정] 기술 연구 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
|
||||||
|
|
||||||
|
static $selectWeightType = SpecialityConst::WEIGHT_NORM;
|
||||||
|
static $selectWeight = 1;
|
||||||
|
static $type = [
|
||||||
|
SpecialityConst::STAT_POWER
|
||||||
|
];
|
||||||
|
|
||||||
|
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
|
||||||
|
if($turnType == 'wall'){
|
||||||
|
if($varType == 'score') return $value * 1.1;
|
||||||
|
if($varType == 'cost') return $value * 0.8;
|
||||||
|
if($varType == 'succ') return $value + 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\TriggerSpecialDomestic;
|
||||||
|
use \sammo\iActionTrigger;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityConst;
|
||||||
|
|
||||||
|
class che_통찰 implements iActionTrigger{
|
||||||
|
use \sammo\DefaultActionTrigger;
|
||||||
|
|
||||||
|
static $id = 12;
|
||||||
|
static $name = '통찰';
|
||||||
|
static $info = '[내정] 치안 강화 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
|
||||||
|
|
||||||
|
static $selectWeightType = SpecialityConst::WEIGHT_NORM;
|
||||||
|
static $selectWeight = 1;
|
||||||
|
static $type = [
|
||||||
|
SpecialityConst::STAT_POWER
|
||||||
|
];
|
||||||
|
|
||||||
|
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
|
||||||
|
if($turnType == 'secu'){
|
||||||
|
if($varType == 'score') return $value * 1.1;
|
||||||
|
if($varType == 'cost') return $value * 0.8;
|
||||||
|
if($varType == 'succ') return $value + 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user