trigger 타입에서 $tunType을 한글로 변경. 성격 추가. 계략 성공 확률을 onCalcDomestic으로 통합.

This commit is contained in:
2018-09-13 01:43:32 +09:00
parent 89bf457878
commit 981e42c5a9
37 changed files with 366 additions and 52 deletions
+3
View File
@@ -79,6 +79,9 @@ abstract class Constraint{
static public function build(array $input):this{
$self = new static();
foreach($input as $key=>$value){
if($value === null){
continue;
}
switch($key){
case 'general': $self->general($value); break;
case 'city': $self->city($value); break;
-4
View File
@@ -9,10 +9,6 @@ trait DefaultActionTrigger{
return $value;
}
public function onCalcSabotageProp(float $successRate):float{
return $successRate;
}
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
return $value;
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
class None implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = -1;
static $name = '-';
static $info = '';
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_대의 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 1;
static $name = '대의';
static $info = '명성 +10%, 훈련 -5';
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'experience'){
return $value * 1.1;
}
if($statName == 'bonusTrain'){
return $value - 5;
}
return $value;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_안전 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 9;
static $name = '안전';
static $info = '사기 -5, 징·모병 비용 -20%';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost'){
return $value * 0.8;
}
}
return $value;
}
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'bonusAtmos'){
return $value - 5;
}
return $value;
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_대의 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 0;
static $name = '왕좌';
static $info = '명성 +10%, 사기 -5';
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'experience'){
return $value * 1.1;
}
if($statName == 'bonusAtmos'){
return $value - 5;
}
return $value;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_유지 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 8;
static $name = '안전';
static $info = '훈련 -5, 징·모병 비용 -20%';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost'){
return $value * 0.8;
}
}
return $value;
}
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'bonusTrain'){
return $value - 5;
}
return $value;
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_대의 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 0;
static $name = '왕좌';
static $info = '명성 +10%, 사기 -5';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == '단련'){
if($varType == 'succ'){
return $value + 0.1;
}
}
return $value;
}
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'bonusAtmos'){
return $value - 5;
}
if($statName == 'bonusTrain'){
return $value - 5;
}
if($statName == 'experience'){
return $value * 0.9;
}
if($statName == 'dedication'){
return $value * 0.9;
}
return $value;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_의협 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 2;
static $name = '의협';
static $info = '사기 +5, 징·모병 비용 +20%';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost'){
return $value * 1.2;
}
}
return $value;
}
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'bonusAtmos'){
return $value + 5;
}
return $value;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_재간 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 7;
static $name = '재간';
static $info = '명성 -10%, 징·모병 비용 -20%';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost'){
return $value * 0.8;
}
}
return $value;
}
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'experience'){
return $value * 0.9;
}
return $value;
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_정복 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 4;
static $name = '정복';
static $info = '명성 -10%, 사기 +5';
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'experience'){
return $value * 0.9;
}
if($statName == 'bonusAtmos'){
return $value + 5;
}
return $value;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_출세 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 6;
static $name = '출세';
static $info = '명성 +10%, 징·모병 비용 +20%';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost'){
return $value * 1.2;
}
}
return $value;
}
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'experience'){
return $value * 1.1;
}
return $value;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_패권 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 3;
static $name = '패권';
static $info = '훈련 +5, 징·모병 비용 +20%';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost'){
return $value * 1.2;
}
}
return $value;
}
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'bonusTrain'){
return $value + 5;
}
return $value;
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace sammo\TriggerCharacter;
use \sammo\iActionTrigger;
use \sammo\General;
class che_할거 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
static $id = 5;
static $name = '할거';
static $info = '명성 -10%, 훈련 +5';
public function onPreGeneralStatUpdate(General $general, string $statName, $value){
if($statName == 'experience'){
return $value * 0.9;
}
if($statName == 'bonusTrain'){
return $value + 5;
}
return $value;
}
}
+4 -4
View File
@@ -34,22 +34,22 @@ class TriggerGeneralLevel implements iActionTrigger{
}
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'agri' || $turnType == 'comm'){
if($turnType == '농업' || $turnType == '상업'){
if(in_array($this->generalLevel, [12, 11, 9, 7, 5, 3])){
return $value * 1.05;
}
}
else if($turnType == 'tech'){
else if($turnType == '기술'){
if(in_array($this->generalLevel, [12, 11, 9, 7, 5])){
return $value * 1.05;
}
}
else if($turnType == 'trust' || $turnType == 'pop'){
else if($turnType == '민심' || $turnType == '인구'){
if(in_array($this->generalLevel, [12, 11, 2])){
return $value * 1.05;
}
}
else if($turnType == 'def' || $turnType == 'wall' || $turnType == 'secu'){
else if($turnType == '수비' || $turnType == '성벽' || $turnType == '치안'){
if(in_array($this->generalLevel, [12, 11, 10, 8, 6, 4])){
return $value * 1.05;
}
+3 -3
View File
@@ -12,16 +12,16 @@ class che_덕가 implements iActionTrigger{
static $cons = '쌀수입↓ 수성↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'secu'){
if($turnType == '치안'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'trust' || $turnType == 'pop'){
else if($turnType == '민심' || $turnType == '인구'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'def' || $turnType == 'wall'){
else if($turnType == '수비' || $turnType == '성벽'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
+2 -2
View File
@@ -12,11 +12,11 @@ class che_도가 implements iActionTrigger{
static $cons = '기술↓ 치안↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'tech'){
if($turnType == '기술'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
else if($turnType == 'secu'){
else if($turnType == '치안'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
+6 -6
View File
@@ -12,14 +12,18 @@ class che_도적 implements iActionTrigger{
static $cons = '금수입↓ 치안↓ 민심↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'secu'){
if($turnType == '치안'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
else if($turnType == 'trust' || $turnType == 'pop'){
else if($turnType == '민심' || $turnType == '인구'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
else if($turnType == '계략'){
if($varType == 'succ') return $value + 0.1;
}
return $value;
}
@@ -31,8 +35,4 @@ class che_도적 implements iActionTrigger{
return $amount;
}
public function onCalcSabotageProp(float $successRate):float{
return $successRate + 0.1;
}
}
+2 -2
View File
@@ -12,12 +12,12 @@ class che_명가 implements iActionTrigger{
static $cons = '쌀수입↓ 수성↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'tech'){
if($turnType == '기술'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'def' || $turnType == 'wall'){
else if($turnType == '수비' || $turnType == '성벽'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
+2 -2
View File
@@ -12,12 +12,12 @@ class che_묵가 implements iActionTrigger{
static $cons = '기술↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'def' || $turnType == 'wall'){
if($turnType == '수비' || $turnType == '성벽'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'tech'){
else if($turnType == '기술'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
+2 -2
View File
@@ -12,12 +12,12 @@ class che_법가 implements iActionTrigger{
static $cons = '인구↓ 민심↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'secu'){
if($turnType == '치안'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'trust' || $turnType == 'pop'){
else if($turnType == '민심' || $turnType == '인구'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
+3 -3
View File
@@ -12,16 +12,16 @@ class che_병가 implements iActionTrigger{
static $cons = '인구↓ 민심↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'tech'){
if($turnType == '기술'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'def' || $turnType == 'wall'){
else if($turnType == '수비' || $turnType == '성벽'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'trust' || $turnType == 'pop'){
else if($turnType == '민심' || $turnType == '인구'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
+2 -2
View File
@@ -12,11 +12,11 @@ class che_불가 implements iActionTrigger{
static $cons = '금수입↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'trust' || $turnType == 'pop'){
if($turnType == '민심' || $turnType == '인구'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'def' || $turnType == 'wall'){
else if($turnType == '수비' || $turnType == '성벽'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
@@ -13,15 +13,15 @@ class che_오두미도 implements iActionTrigger{
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'tech'){
if($turnType == '기술'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
else if($turnType == 'def' || $turnType == 'wall'){
else if($turnType == '수비' || $turnType == '성벽'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
else if($turnType == 'agri' || $turnType == 'comm'){
else if($turnType == '농업' || $turnType == '상업'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
+2 -2
View File
@@ -12,11 +12,11 @@ class che_유가 implements iActionTrigger{
static $cons = '쌀수입↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'agri' || $turnType == 'comm'){
if($turnType == '농업' || $turnType == '상업'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'trust' || $turnType == 'pop'){
else if($turnType == '민심' || $turnType == '인구'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
@@ -12,12 +12,12 @@ class che_음양가 implements iActionTrigger{
static $cons = '기술↓ 전략↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'agri' || $turnType == 'comm'){
if($turnType == '농업' || $turnType == '상업'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'tech'){
else if($turnType == '기술'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
@@ -12,12 +12,12 @@ class che_종횡가 implements iActionTrigger{
static $cons = '금수입↓ 내정↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'def' || $turnType == 'wall'){
if($turnType == '수비' || $turnType == '성벽'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'agri' || $turnType == 'comm'){
else if($turnType == '농업' || $turnType == '상업'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
@@ -12,16 +12,16 @@ class che_태평도 implements iActionTrigger{
static $cons = '기술↓ 수성↓';
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'trust' || $turnType == 'pop'){
if($turnType == '민심' || $turnType == '인구'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
}
else if($turnType == 'tech'){
else if($turnType == '기술'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
else if($turnType == 'def' || $turnType == 'wall'){
else if($turnType == '수비' || $turnType == '성벽'){
if($varType == 'score') return $value * 0.9;
if($varType == 'cost') return $value * 1.2;
}
@@ -18,7 +18,7 @@ class che_경작 implements iActionTrigger{
];
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'agri'){
if($turnType == '농업'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
if($varType == 'succ') return $value + 0.1;
@@ -19,7 +19,12 @@ class che_귀모 implements iActionTrigger{
SpecialityConst::STAT_INTEL
];
public function onCalcSabotageProp(float $successRate):float{
return $successRate + 0.2;
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == '계략'){
if($varType == 'succ') return $value + 0.1;
}
return $value;
}
}
@@ -18,7 +18,7 @@ class che_발명 implements iActionTrigger{
];
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'tech'){
if($turnType == '기술'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
if($varType == 'succ') return $value + 0.1;
@@ -18,7 +18,7 @@ class che_상재 implements iActionTrigger{
];
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'comm'){
if($turnType == '상업'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
if($varType == 'succ') return $value + 0.1;
@@ -18,7 +18,7 @@ class che_수비 implements iActionTrigger{
];
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'def'){
if($turnType == '수비'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
if($varType == 'succ') return $value + 0.1;
@@ -18,7 +18,7 @@ class che_통찰 implements iActionTrigger{
];
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'trust' || $turnType == 'pop'){
if($turnType == '민심' || $turnType == '인구'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
if($varType == 'succ') return $value + 0.1;
@@ -18,7 +18,7 @@ class che_축성 implements iActionTrigger{
];
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'wall'){
if($turnType == '성벽'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
if($varType == 'succ') return $value + 0.1;
@@ -18,7 +18,7 @@ class che_통찰 implements iActionTrigger{
];
public function onCalcDomestic(string $turnType, string $varType, float $value):float{
if($turnType == 'secu'){
if($turnType == '치안'){
if($varType == 'score') return $value * 1.1;
if($varType == 'cost') return $value * 0.8;
if($varType == 'succ') return $value + 0.1;
-1
View File
@@ -12,7 +12,6 @@ interface iActionTrigger{
//TODO: 능력치는?
public function onPreTurnExecute(General $general, ?array $nation):array;
public function onCalcDomestic(string $turnType, string $varType, float $value):float;
public function onCalcSabotageProp(float $successRate):float;
public function onPreGeneralStatUpdate(General $general, string $statName, $value);