getNationTypeList 변경

This commit is contained in:
2018-09-02 20:54:32 +09:00
parent e8dab58dec
commit 27295d69c3
23 changed files with 100 additions and 17 deletions
+2 -2
View File
@@ -172,8 +172,8 @@ abstract class Constraint{
return $this->reason;
}
public static function testAll(array $contraintPacks, array $input):?string{
foreach($contraintPacks as $constraintArgs){
public static function testAll(array $constraintPacks, array $input):?string{
foreach($constraintPacks as $constraintArgs){
if (!$constraintArgs){
continue;
}
+1 -1
View File
@@ -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){
public function onCalcDomesticTurnScore(General $general, string $turnType, float $score, float $cost, float $successRate, float $failRate):array{
return [$score, $cost, $successRate, $failRate];
}
+6
View File
@@ -93,4 +93,10 @@ class GameConstBase
/** @var int 초반 제한 기간 */
public static $openingPartYear = 3;
/** @var array 선택 가능한 국가 성향 */
public static $availableNationType = [
'che_명가', 'che_음양가', 'che_종횡가', 'che_불가', 'che_도적', 'che_오두미도', 'che_태평도', 'che_도가',
'che_묵가', 'che_덕가', 'che_병가', 'che_유가', 'che_법가'
];
}
+29
View File
@@ -50,6 +50,22 @@ class General{
return $this->logActivatedSkill;
}
function hasActivatedSkill(string $skillName):bool{
return $this->activatedSkill[$skillName] ?? false;
}
function activateSkill(... $skillNames){
foreach($skillNames as $skillName){
$this->activatedSkill[$skillName] = true;
}
}
function deactivateSkill(... $skillNames){
foreach($skillNames as $skillName){
$this->activatedSkill[$skillName] = false;
}
}
function getName():string{
return $this->raw['name'];
}
@@ -70,6 +86,19 @@ class General{
return $this->logger;
}
//TODO: 장기적으로 General 클래스로 모두 옮겨와야함.
function getLeadership($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
return getGeneralLeadership($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
}
function getPower($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
return getGeneralPower($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
}
function getIntel($withInjury = true, $withItem = true, $withStatAdjust = true, $useFloor = true):float{
return getGeneralIntel($this->raw, $withInjury, $withItem, $withStatAdjust, $useFloor);
}
/**
* @param \MeekroDB $db
+22
View File
@@ -0,0 +1,22 @@
<?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];
}
}
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_덕가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_도가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_도적 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_명가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_묵가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_법가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_병가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_불가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_오두미도 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
+2 -1
View File
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_유가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -11,7 +12,7 @@ class che_유가 implements iActionTrigger{
static $pros = '내정↑ 민심↑';
static $cons = '쌀수입↓';
public function onCalcDomesticTurnScore(General $general, string $turnType, float $score, float $cost, float $successRate, float $failRate){
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;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_음양가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_종횡가 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_중립 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
@@ -1,6 +1,7 @@
<?php
namespace sammo\TriggerNationType;
use \sammo\iActionTrigger;
use \sammo\General;
class che_태평도 implements iActionTrigger{
use \sammo\DefaultActionTrigger;
+1
View File
@@ -9,6 +9,7 @@ interface iActionTrigger{
const PRIORITY_POST = 20000;
const PRIORITY_FINAL = 10000;
//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;