인탐, 의병모집 수정, npcMin, npcTotal 추가

This commit is contained in:
2020-05-16 18:59:10 +09:00
parent b4d5fbcb61
commit 5c2d9dddb0
19 changed files with 184 additions and 132 deletions
+35 -27
View File
@@ -1,8 +1,11 @@
<?php <?php
namespace sammo\Command\General; namespace sammo\Command\General;
use\sammo\{ use\sammo\{
DB, Util, JosaUtil, DB,
Util,
JosaUtil,
General, General,
ActionLogger, ActionLogger,
GameConst, GameConst,
@@ -23,15 +26,18 @@ use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper; use \sammo\Constraint\ConstraintHelper;
class che_인재탐색 extends Command\GeneralCommand{ class che_인재탐색 extends Command\GeneralCommand
{
static protected $actionName = '인재탐색'; static protected $actionName = '인재탐색';
protected function argTest():bool{ protected function argTest(): bool
{
$this->arg = null; $this->arg = null;
return true; return true;
} }
protected function init(){ protected function init()
{
$general = $this->generalObj; $general = $this->generalObj;
@@ -53,10 +59,10 @@ class che_인재탐색 extends Command\GeneralCommand{
$josaUn = JosaUtil::pick($nationName, '은'); $josaUn = JosaUtil::pick($nationName, '은');
$this->fullConditionConstraints[] = ConstraintHelper::AlwaysFail("현재 <D>{$nationName}</>{$josaUn} 탐색이 제한되고 있습니다."); $this->fullConditionConstraints[] = ConstraintHelper::AlwaysFail("현재 <D>{$nationName}</>{$josaUn} 탐색이 제한되고 있습니다.");
} }
} }
public function getCommandDetailTitle():string{ public function getCommandDetailTitle(): string
{
$db = DB::db(); $db = DB::db();
$env = $this->env; $env = $this->env;
@@ -82,19 +88,23 @@ class che_인재탐색 extends Command\GeneralCommand{
return $title; return $title;
} }
public function getCost():array{ public function getCost(): array
{
return [$this->env['develcost'], 0]; return [$this->env['develcost'], 0];
} }
public function getPreReqTurn():int{ public function getPreReqTurn(): int
{
return 0; return 0;
} }
public function getPostReqTurn():int{ public function getPostReqTurn(): int
{
return 0; return 0;
} }
public function calcFoundProp(int $maxGenCnt, int $totalGenCnt, int $totalNpcCnt):float{ public function calcFoundProp(int $maxGenCnt, int $totalGenCnt, int $totalNpcCnt): float
{
$currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2); $currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2);
@@ -109,14 +119,14 @@ class che_인재탐색 extends Command\GeneralCommand{
if ($totalNpcCnt < 50) { if ($totalNpcCnt < 50) {
$foundProp = max($foundPropMain, $foundPropSmall); $foundProp = max($foundPropMain, $foundPropSmall);
} } else {
else{
$foundProp = max($foundPropMain, $foundPropBig); $foundProp = max($foundPropMain, $foundPropBig);
} }
return $foundProp; return $foundProp;
} }
public function run():bool{ public function run(): bool
{
if (!$this->hasFullConditionMet()) { if (!$this->hasFullConditionMet()) {
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
} }
@@ -178,13 +188,16 @@ class che_인재탐색 extends Command\GeneralCommand{
$pickType = Util::choiceRandomUsingWeight($pickTypeList); $pickType = Util::choiceRandomUsingWeight($pickTypeList);
$mainStat = GameConst::$defaultStatMax - Util::randRangeInt(0, 10); $totalStat = GameConst::$defaultStatNPCMax * 2 + 10;
$otherStat = GameConst::$defaultStatMin + Util::randRangeInt(0, 5); $minStat = 10;
$subStat = GameConst::$defaultStatTotal - $mainStat - $otherStat; $mainStat = GameConst::$defaultStatNPCMax - Util::randRangeInt(0, 10);
if($subStat < GameConst::$defaultStatMin){ //TODO: defaultStatNPCTotal, defaultStatNPCMin 추가
$otherStat = $minStat + Util::randRangeInt(0, 5);
$subStat = $totalStat - $mainStat - $otherStat;
if ($subStat < $minStat) {
$subStat = $otherStat; $subStat = $otherStat;
$otherStat = GameConst::$defaultStatMin; $otherStat = $minStat;
$mainStat = GameConst::$defaultStatTotal - $subStat - $otherStat; $mainStat = $totalStat - $subStat - $otherStat;
if ($mainStat) { if ($mainStat) {
throw new \LogicException('기본 스탯 설정값이 잘못되어 있음'); throw new \LogicException('기본 스탯 설정값이 잘못되어 있음');
} }
@@ -207,14 +220,12 @@ class che_인재탐색 extends Command\GeneralCommand{
[$dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8], [$dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8],
[$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8], [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8],
]); ]);
} } else if ($pickType == '지') {
else if($pickType == '지'){
$leadership = $subStat; $leadership = $subStat;
$strength = $otherStat; $strength = $otherStat;
$intel = $mainStat; $intel = $mainStat;
$dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8]; $dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8];
} } else {
else{
$leadership = $otherStat; $leadership = $otherStat;
$strength = $subStat; $strength = $subStat;
$intel = $mainStat; $intel = $mainStat;
@@ -245,8 +256,7 @@ class che_인재탐색 extends Command\GeneralCommand{
$noScout = false; $noScout = false;
if ($this->nation['scout'] != 0) { if ($this->nation['scout'] != 0) {
$noScout = true; $noScout = true;
} } else if ($relYear < 3 && $this->nation['gennum'] >= GameConst::$initialNationGenLimit) {
else if($relYear < 3 && $this->nation['gennum'] >= GameConst::$initialNationGenLimit){
$noScout = true; $noScout = true;
} }
@@ -329,6 +339,4 @@ class che_인재탐색 extends Command\GeneralCommand{
$general->applyDB($db); $general->applyDB($db);
return true; return true;
} }
} }
+31 -21
View File
@@ -1,8 +1,11 @@
<?php <?php
namespace sammo\Command\Nation; namespace sammo\Command\Nation;
use\sammo\{ use\sammo\{
DB, Util, JosaUtil, DB,
Util,
JosaUtil,
General, General,
ActionLogger, ActionLogger,
GameConst, GameConst,
@@ -23,15 +26,18 @@ use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper; use \sammo\Constraint\ConstraintHelper;
class che_의병모집 extends Command\NationCommand{ class che_의병모집 extends Command\NationCommand
{
static protected $actionName = '의병모집'; static protected $actionName = '의병모집';
protected function argTest():bool{ protected function argTest(): bool
{
$this->arg = null; $this->arg = null;
return true; return true;
} }
protected function init(){ protected function init()
{
$general = $this->generalObj; $general = $this->generalObj;
@@ -49,7 +55,8 @@ class che_의병모집 extends Command\NationCommand{
]; ];
} }
public function getCommandDetailTitle():string{ public function getCommandDetailTitle(): string
{
$name = $this->getName(); $name = $this->getName();
$reqTurn = $this->getPreReqTurn() + 1; $reqTurn = $this->getPreReqTurn() + 1;
$postReqTurn = $this->getPostReqTurn(); $postReqTurn = $this->getPostReqTurn();
@@ -57,15 +64,18 @@ class che_의병모집 extends Command\NationCommand{
return "{$name}/{$reqTurn}턴(전략$postReqTurn)"; return "{$name}/{$reqTurn}턴(전략$postReqTurn)";
} }
public function getCost():array{ public function getCost(): array
{
return [0, 0]; return [0, 0];
} }
public function getPreReqTurn():int{ public function getPreReqTurn(): int
{
return 2; return 2;
} }
public function getPostReqTurn():int{ public function getPostReqTurn(): int
{
$genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit); $genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit);
$nextTerm = Util::round(sqrt($genCount * 10) * 10); $nextTerm = Util::round(sqrt($genCount * 10) * 10);
@@ -73,7 +83,8 @@ class che_의병모집 extends Command\NationCommand{
return $nextTerm; return $nextTerm;
} }
public function run():bool{ public function run(): bool
{
if (!$this->hasFullConditionMet()) { if (!$this->hasFullConditionMet()) {
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
} }
@@ -146,13 +157,16 @@ class che_의병모집 extends Command\NationCommand{
for (; $createGenIdx <= $lastCreatGenIdx; $createGenIdx++) { for (; $createGenIdx <= $lastCreatGenIdx; $createGenIdx++) {
$pickType = Util::choiceRandomUsingWeight($pickTypeList); $pickType = Util::choiceRandomUsingWeight($pickTypeList);
$mainStat = GameConst::$defaultStatMax - Util::randRangeInt(0, 10); $totalStat = GameConst::$defaultStatNPCMax * 2 + 10;
$otherStat = GameConst::$defaultStatMin + Util::randRangeInt(0, 5); $minStat = 10;
$subStat = GameConst::$defaultStatTotal - $mainStat - $otherStat; $mainStat = GameConst::$defaultStatNPCMax - Util::randRangeInt(0, 10);
if($subStat < GameConst::$defaultStatMin){ //TODO: defaultStatNPCTotal, defaultStatNPCMin 추가
$otherStat = $minStat + Util::randRangeInt(0, 5);
$subStat = $totalStat - $mainStat - $otherStat;
if ($subStat < $minStat) {
$subStat = $otherStat; $subStat = $otherStat;
$otherStat = GameConst::$defaultStatMin; $otherStat = $minStat;
$mainStat = GameConst::$defaultStatTotal - $subStat - $otherStat; $mainStat = $totalStat - $subStat - $otherStat;
if ($mainStat) { if ($mainStat) {
throw new \LogicException('기본 스탯 설정값이 잘못되어 있음'); throw new \LogicException('기본 스탯 설정값이 잘못되어 있음');
} }
@@ -167,14 +181,12 @@ class che_의병모집 extends Command\NationCommand{
[$dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8], [$dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8],
[$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8], [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8],
]); ]);
} } else if ($pickType == '지') {
else if($pickType == '지'){
$leadership = $subStat; $leadership = $subStat;
$strength = $otherStat; $strength = $otherStat;
$intel = $mainStat; $intel = $mainStat;
$dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8]; $dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8];
} } else {
else{
$leadership = $otherStat; $leadership = $otherStat;
$strength = $subStat; $strength = $subStat;
$intel = $mainStat; $intel = $mainStat;
@@ -243,6 +255,4 @@ class che_의병모집 extends Command\NationCommand{
return true; return true;
} }
} }
+2
View File
@@ -235,7 +235,9 @@ class Scenario{
'defaultStatTotal'=>$this->data['stat']['total']??$default['stat']['total'], 'defaultStatTotal'=>$this->data['stat']['total']??$default['stat']['total'],
'defaultStatMin'=>$this->data['stat']['min']??$default['stat']['min'], 'defaultStatMin'=>$this->data['stat']['min']??$default['stat']['min'],
'defaultStatMax'=>$this->data['stat']['max']??$default['stat']['max'], 'defaultStatMax'=>$this->data['stat']['max']??$default['stat']['max'],
'defaultStatNPCTotal'=>$this->data['stat']['npcTotal']??$default['stat']['npcTotal'],
'defaultStatNPCMax'=>$this->data['stat']['npcMax']??$default['stat']['npcMax'], 'defaultStatNPCMax'=>$this->data['stat']['npcMax']??$default['stat']['npcMax'],
'defaultStatNPCMin'=>$this->data['stat']['npcMin']??$default['stat']['npcMin'],
'chiefStatMin'=>$this->data['stat']['chiefMin']??$default['stat']['chiefMin'], 'chiefStatMin'=>$this->data['stat']['chiefMin']??$default['stat']['chiefMin'],
]; ];
+3 -1
View File
@@ -3,7 +3,9 @@
"total":150, "total":150,
"min":10, "min":10,
"max":75, "max":75,
"npcMax":95, "npcTotal":155,
"npcMax":80,
"npcMin":10,
"chiefMin":65 "chiefMin":65
}, },
"iconPath":"." "iconPath":"."
+3 -1
View File
@@ -10,7 +10,9 @@
"total":220, "total":220,
"min":40, "min":40,
"max":95, "max":95,
"npcMax":95 "npcTotal":170,
"npcMax":95,
"npcMin":10
}, },
"const":{ "const":{
"defaultMaxGeneral":800 "defaultMaxGeneral":800
+3 -1
View File
@@ -10,7 +10,9 @@
"total":220, "total":220,
"min":40, "min":40,
"max":95, "max":95,
"npcMax":95 "npcTotal":170,
"npcMax":95,
"npcMin":10
}, },
"map":{ "map":{
"mapName":"miniche" "mapName":"miniche"
+2
View File
@@ -7,7 +7,9 @@
"diplomacy":[ "diplomacy":[
], ],
"stat":{ "stat":{
"npcTotal":120,
"npcMax":65, "npcMax":65,
"npcMin":10,
"chiefMin":55 "chiefMin":55
}, },
"const":{ "const":{
+2
View File
@@ -10,7 +10,9 @@
"total":260, "total":260,
"min":40, "min":40,
"max":120, "max":120,
"npcTotal":120,
"npcMax":65, "npcMax":65,
"npcMin":10,
"chiefMin":55 "chiefMin":55
}, },
"const":{ "const":{
+2
View File
@@ -10,7 +10,9 @@
"total":260, "total":260,
"min":40, "min":40,
"max":120, "max":120,
"npcTotal":120,
"npcMax":65, "npcMax":65,
"npcMin":10,
"chiefMin":55 "chiefMin":55
}, },
"map":{ "map":{
+3 -1
View File
@@ -10,7 +10,9 @@
"total":220, "total":220,
"min":40, "min":40,
"max":95, "max":95,
"npcMax":95 "npcTotal":170,
"npcMax":95,
"npcMin":10
}, },
"const":{ "const":{
"defaultMaxGeneral":600 "defaultMaxGeneral":600
+3 -1
View File
@@ -10,7 +10,9 @@
"total":220, "total":220,
"min":40, "min":40,
"max":95, "max":95,
"npcMax":95 "npcTotal":170,
"npcMax":95,
"npcMin":10
}, },
"const":{ "const":{
"defaultMaxGeneral":800 "defaultMaxGeneral":800
+3 -1
View File
@@ -10,7 +10,9 @@
"total":220, "total":220,
"min":40, "min":40,
"max":95, "max":95,
"npcMax":95 "npcTotal":170,
"npcMax":95,
"npcMin":10
}, },
"const":{ "const":{
"defaultMaxGeneral":800 "defaultMaxGeneral":800
+3 -1
View File
@@ -6,7 +6,9 @@
"total":250, "total":250,
"min":60, "min":60,
"max":110, "max":110,
"npcMax":100 "npcTotal":190,
"npcMax":100,
"npcMin":10
}, },
"iconPath":"환상향", "iconPath":"환상향",
"nation":[ "nation":[
+3 -1
View File
@@ -6,7 +6,9 @@
"total":250, "total":250,
"min":60, "min":60,
"max":110, "max":110,
"npcMax":100 "npcTotal":190,
"npcMax":100,
"npcMin":10
}, },
"iconPath":"환상향", "iconPath":"환상향",
"nation":[ "nation":[
+3 -1
View File
@@ -11,7 +11,9 @@
"total":220, "total":220,
"min":40, "min":40,
"max":95, "max":95,
"npcMax":95 "npcTotal":210,
"npcMax":95,
"npcMin":40
}, },
"general":[ "general":[
[0, "아이유", null, 0, null, 90, 56, 100, 0, 160, 250, "의협", "집중"], [0, "아이유", null, 0, null, 90, 56, 100, 0, 160, 250, "의협", "집중"],
+3 -1
View File
@@ -10,7 +10,9 @@
"total":220, "total":220,
"min":40, "min":40,
"max":95, "max":95,
"npcMax":95 "npcTotal":200,
"npcMax":95,
"npcMin":20
}, },
"general":[ "general":[
[0, "모에", null, 0, null, 68, 55, 82, 0, 160, 300, null, null], [0, "모에", null, 0, null, 68, 55, 82, 0, 160, 300, null, null],
+3 -1
View File
@@ -10,7 +10,9 @@
"total":220, "total":220,
"min":40, "min":40,
"max":95, "max":95,
"npcMax":95 "npcTotal":200,
"npcMax":95,
"npcMin":20
}, },
"general":[ "general":[
[0, "흑뢰의라이제", null, 0, null, 91, 71, 93, 0, 160, 300, "의협", "집중"], [0, "흑뢰의라이제", null, 0, null, 91, 71, 93, 0, 160, 300, "의협", "집중"],
+2
View File
@@ -9,7 +9,9 @@
"total": 225, "total": 225,
"min": 40, "min": 40,
"max": 95, "max": 95,
"npcTotal":190,
"npcMax":90, "npcMax":90,
"npcMin":30,
"chiefMin": 65 "chiefMin": 65
}, },
"iconPath": "스타1프로게이머", "iconPath": "스타1프로게이머",
+2
View File
@@ -9,7 +9,9 @@
"total": 240, "total": 240,
"min": 40, "min": 40,
"max": 110, "max": 110,
"npcTotal":200,
"npcMax":90, "npcMax":90,
"npcMin":20,
"chiefMin": 65 "chiefMin": 65
}, },
"iconPath": "포켓몬스터", "iconPath": "포켓몬스터",