getNationTypeList 변경
This commit is contained in:
@@ -90,8 +90,9 @@ $startYear = $gameStor->getValue('startyear');
|
||||
<span class="input-group-text">국가 성향</span>
|
||||
</div>
|
||||
<select class="custom-select form_nation_type" style="width:25ch;">
|
||||
<?php foreach(getNationTypeList() as $typeID => [$name,$pros,$cons]): ?>
|
||||
<option value="<?=$typeID?>"><?=$name?> (<?=$pros?>, <?=$cons?>)</option>
|
||||
<?php foreach(getNationTypeList() as $typeID): ?>
|
||||
<?php $typeRealID = '\\sammo\\TriggerNationType\\'.$typeID ?>
|
||||
<option value="<?=$typeID?>"><?=($typeRealID)::$name?> (<?=($typeRealID)::$pros?>, <?=($typeRealID)::$cons?>)</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
|
||||
@@ -20,6 +20,8 @@ function getNationLevelList():array{
|
||||
}
|
||||
|
||||
function getNationTypeList():array{
|
||||
return GameConst::$availableNationType;
|
||||
|
||||
$table = [
|
||||
13=>['명가', '기술↑ 인구↑', '쌀수입↓ 수성↓'],
|
||||
12=>['음양가', '내정↑ 인구↑', '기술↓ 전략↓'],
|
||||
|
||||
+19
-11
@@ -14,7 +14,7 @@ use Constraint\Constraint;
|
||||
*
|
||||
* @return int|float 계산된 능력치
|
||||
*/
|
||||
function getGeneralLeadership(&$general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
|
||||
function getGeneralLeadership($general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
|
||||
if($general === null){
|
||||
return 0;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ function getGeneralLeadership(&$general, $withInjury, $withItem, $withStatAdjust
|
||||
*
|
||||
* @return int|float 계산된 능력치
|
||||
*/
|
||||
function getGeneralPower(&$general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
|
||||
function getGeneralPower($general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
|
||||
if($general === null){
|
||||
return 0;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ function getGeneralPower(&$general, $withInjury, $withItem, $withStatAdjust, $us
|
||||
*
|
||||
* @return int|float 계산된 능력치
|
||||
*/
|
||||
function getGeneralIntel(&$general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
|
||||
function getGeneralIntel($general, $withInjury, $withItem, $withStatAdjust, $useFloor = true){
|
||||
if($general === null){
|
||||
return 0;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ function CriticalScore($score, $type) {
|
||||
return Util::round($score * $ratio);
|
||||
}
|
||||
|
||||
function process_1(array $general, int $type){
|
||||
function process_1(array $rawGeneral, int $type){
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
@@ -212,11 +212,12 @@ function process_1(array $general, int $type){
|
||||
|
||||
[$startYear, $year, $month, $develCost] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'develcost']);
|
||||
|
||||
$city = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $general['city']);
|
||||
$nation = getNationStaticInfo($general['nation']);
|
||||
$lbonus = setLeadershipBonus($general, $nation['level']);
|
||||
$general = new General($rawGeneral, $yera, $month);
|
||||
$logger = $general->getLogger();
|
||||
|
||||
$logger = new ActionLogger($general['id'], $general['nation'], $year, $month);
|
||||
|
||||
|
||||
$city = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $general->getCityID());
|
||||
|
||||
$constraints = [
|
||||
['NoNeutral'],
|
||||
@@ -226,10 +227,10 @@ function process_1(array $general, int $type){
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['RemainCityCapacity', [$cityKey, $actionName]]
|
||||
];
|
||||
$failReason =Constraint::testAll($constraints, [
|
||||
'nation'=>$nation,
|
||||
$failReason = Constraint::testAll($constraints, [
|
||||
'nation'=>$general->getStaticNation(),
|
||||
'city'=>$city,
|
||||
'general'=>$general,
|
||||
'general'=>$general->getRaw(),
|
||||
]);
|
||||
|
||||
if($failReason !== null){
|
||||
@@ -237,6 +238,13 @@ function process_1(array $general, int $type){
|
||||
return;
|
||||
}
|
||||
|
||||
$trust = Util::valutFit($city['trust'], 50);
|
||||
|
||||
$score = getGeneralIntel($general, true, true, true, false);
|
||||
$score *= $trust / 100;
|
||||
$score *= getDomesticExpLevelBonus($general['explevel']);
|
||||
$score *= Util::randRange(0.8, 1.2);
|
||||
|
||||
}
|
||||
|
||||
function process_1_old(&$general, $type) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
@@ -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_법가'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user