onCalcDomesticTurnScore 변경 TriggerNationType에서 숫자 id 제거
This commit is contained in:
+8
-9
@@ -31,14 +31,6 @@ require_once('func_command.php');
|
||||
function getNationStaticInfo($nationID, $forceRefresh=false)
|
||||
{
|
||||
static $nationList = null;
|
||||
static $freeNation = [
|
||||
'nation'=>0,
|
||||
'name'=>'재야',
|
||||
'color'=>'#000000',
|
||||
'type'=>0,
|
||||
'level'=>0,
|
||||
'capital'=>0
|
||||
];
|
||||
|
||||
if ($forceRefresh) {
|
||||
$nationList = null;
|
||||
@@ -48,7 +40,14 @@ function getNationStaticInfo($nationID, $forceRefresh=false)
|
||||
return null;
|
||||
}
|
||||
if($nationID === 0){
|
||||
return $freeNation;
|
||||
return [
|
||||
'nation'=>0,
|
||||
'name'=>'재야',
|
||||
'color'=>'#000000',
|
||||
'type'=>GameConst::$neutralNationType,
|
||||
'level'=>0,
|
||||
'capital'=>0
|
||||
];
|
||||
}
|
||||
|
||||
if($nationList === null){
|
||||
|
||||
@@ -5,7 +5,7 @@ trait DefaultActionTrigger{
|
||||
public function onPreTurnExecute(General $general, ?array $nation):array{
|
||||
return [];
|
||||
}
|
||||
public function onCalcDomesticTurnScore(General $general, string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
|
||||
public function onCalcDomesticTurnScore(string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
|
||||
return [$score, $cost, $successRate, $failRate];
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ class General{
|
||||
use LazyVarUpdater;
|
||||
|
||||
protected $raw = [];
|
||||
protected $rawNation;
|
||||
|
||||
protected $logger;
|
||||
|
||||
@@ -14,14 +13,16 @@ class General{
|
||||
protected $logActivatedSkill = [];
|
||||
protected $isFinished = false;
|
||||
|
||||
protected $nationType;
|
||||
|
||||
public function __construct(array $raw, int $year, int $month){
|
||||
//TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함.
|
||||
if($raw['nation']){
|
||||
$staticNation = getNationStaticInfo($raw['nation']);
|
||||
setLeadershipBonus($raw, $staticNation['level']);
|
||||
}
|
||||
|
||||
$staticNation = getNationStaticInfo($raw['nation']);
|
||||
setLeadershipBonus($raw, $staticNation['level']);
|
||||
$this->raw = $raw;
|
||||
|
||||
|
||||
$this->logger = new ActionLogger(
|
||||
$this->getVar('no'),
|
||||
$this->getVar('nation'),
|
||||
@@ -29,6 +30,9 @@ class General{
|
||||
$month,
|
||||
false
|
||||
);
|
||||
|
||||
$nationTypeClass = getNationTypeClass($staticNation['type']);
|
||||
$this->nationType = new $nationTypeClass;
|
||||
}
|
||||
|
||||
protected function clearActivatedSkill(){
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
namespace sammo\TriggerNationType;
|
||||
use \sammo\iActionTrigger;
|
||||
|
||||
class che_유가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 2;
|
||||
static $name = '유가';
|
||||
static $info = '';
|
||||
static $pros = '내정↑ 민심↑';
|
||||
static $cons = '쌀수입↓';
|
||||
|
||||
public function onCalcDomesticTurnScore(General $general, string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
|
||||
if($turnType == 'agri' || $turnType == 'comm'){
|
||||
$score *= 1.1;
|
||||
$cost *= 0.8;
|
||||
}
|
||||
|
||||
return [$score, $cost, $successRate, $failRate];
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class Nation{
|
||||
int $rice = 2000,
|
||||
string $infoText = '국가 설명',
|
||||
int $tech = 0,
|
||||
string $type = '유가',
|
||||
?string $type = null,
|
||||
int $nationLevel = 0,
|
||||
array $cities = []
|
||||
){
|
||||
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_덕가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 4;
|
||||
static $name = '덕가';
|
||||
static $info = '';
|
||||
static $pros = '치안↑ 인구↑ 민심↑';
|
||||
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_도가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 6;
|
||||
static $name = '도가';
|
||||
static $info = '';
|
||||
static $pros = '인구↑';
|
||||
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_도적 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 9;
|
||||
static $name = '도적';
|
||||
static $info = '';
|
||||
static $pros = '계략↑';
|
||||
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_명가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 13;
|
||||
static $name = '명가';
|
||||
static $info = '';
|
||||
static $pros = '기술↑ 인구↑';
|
||||
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_묵가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 5;
|
||||
static $name = '묵가';
|
||||
static $info = '';
|
||||
static $pros = '수성↑';
|
||||
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_법가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 1;
|
||||
static $name = '법가';
|
||||
static $info = '';
|
||||
static $pros = '금수입↑ 치안↑';
|
||||
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_병가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 3;
|
||||
static $name = '병가';
|
||||
static $info = '';
|
||||
static $pros = '기술↑ 수성↑';
|
||||
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_불가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 10;
|
||||
static $name = '불가';
|
||||
static $info = '';
|
||||
static $pros = '민심↑ 수성↑';
|
||||
|
||||
@@ -6,11 +6,19 @@ use \sammo\General;
|
||||
class che_오두미도 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 8;
|
||||
static $name = '중립';
|
||||
static $name = '오두미도';
|
||||
static $info = '';
|
||||
static $pros = '쌀수입↑ 인구↑';
|
||||
static $cons = '기술↓ 수성↓ 내정↓';
|
||||
|
||||
|
||||
public function onCalcDomesticTurnScore(string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
|
||||
if($turnType == 'agri' || $turnType == 'comm'){
|
||||
$score *= 0.9;
|
||||
$cost *= 1.2;
|
||||
}
|
||||
|
||||
return [$score, $cost, $successRate, $failRate];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,13 +6,12 @@ use \sammo\General;
|
||||
class che_유가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 2;
|
||||
static $name = '유가';
|
||||
static $info = '';
|
||||
static $pros = '내정↑ 민심↑';
|
||||
static $cons = '쌀수입↓';
|
||||
|
||||
public function onCalcDomesticTurnScore(General $general, string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
|
||||
public function onCalcDomesticTurnScore(string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
|
||||
if($turnType == 'agri' || $turnType == 'comm'){
|
||||
$score *= 1.1;
|
||||
$cost *= 0.8;
|
||||
|
||||
@@ -6,11 +6,17 @@ use \sammo\General;
|
||||
class che_음양가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 12;
|
||||
static $name = '음양가';
|
||||
static $info = '';
|
||||
static $pros = '내정↑ 인구↑';
|
||||
static $cons = '기술↓ 전략↓';
|
||||
|
||||
|
||||
public function onCalcDomesticTurnScore(string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
|
||||
if($turnType == 'agri' || $turnType == 'comm'){
|
||||
$score *= 1.1;
|
||||
$cost *= 0.8;
|
||||
}
|
||||
|
||||
return [$score, $cost, $successRate, $failRate];
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,17 @@ use \sammo\General;
|
||||
class che_종횡가 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 11;
|
||||
static $name = '종횡가';
|
||||
static $info = '';
|
||||
static $pros = '전략↑ 수성↑';
|
||||
static $cons = '금수입↓ 내정↓';
|
||||
|
||||
|
||||
public function onCalcDomesticTurnScore(string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
|
||||
if($turnType == 'agri' || $turnType == 'comm'){
|
||||
$score *= 0.9;
|
||||
$cost *= 1.2;
|
||||
}
|
||||
|
||||
return [$score, $cost, $successRate, $failRate];
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_중립 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 0;
|
||||
static $name = '중립';
|
||||
static $info = '';
|
||||
static $pros = '-';
|
||||
|
||||
@@ -6,7 +6,6 @@ use \sammo\General;
|
||||
class che_태평도 implements iActionTrigger{
|
||||
use \sammo\DefaultActionTrigger;
|
||||
|
||||
static $id = 7;
|
||||
static $name = '태평도';
|
||||
static $info = '';
|
||||
static $pros = '인구↑ 민심↑';
|
||||
|
||||
@@ -11,7 +11,7 @@ interface iActionTrigger{
|
||||
|
||||
//TODO: 능력치는?
|
||||
public function onPreTurnExecute(General $general, ?array $nation):array;
|
||||
public function onCalcDomesticTurnScore(General $general, string $turnType, float $score, float $cost, float $successRate, float $failRate):array;
|
||||
public function onCalcDomesticTurnScore(string $turnType, float $score, float $cost, float $successRate, float $failRate):array;
|
||||
|
||||
public function onPreGeneralStatUpdate(General $general, string $statName, $value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user