인탐, 의병모집 수정, npcMin, npcTotal 추가
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\Command\General;
|
namespace sammo\Command\General;
|
||||||
|
|
||||||
use \sammo\{
|
use\sammo\{
|
||||||
DB, Util, JosaUtil,
|
DB,
|
||||||
General,
|
Util,
|
||||||
|
JosaUtil,
|
||||||
|
General,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst,
|
GameConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
@@ -11,9 +14,9 @@ use \sammo\{
|
|||||||
Command
|
Command
|
||||||
};
|
};
|
||||||
|
|
||||||
use function \sammo\{
|
use function\sammo\{
|
||||||
getDomesticExpLevelBonus,
|
getDomesticExpLevelBonus,
|
||||||
CriticalRatioDomestic,
|
CriticalRatioDomestic,
|
||||||
CriticalScoreEx,
|
CriticalScoreEx,
|
||||||
tryUniqueItemLottery,
|
tryUniqueItemLottery,
|
||||||
getAllNationStaticInfo
|
getAllNationStaticInfo
|
||||||
@@ -23,40 +26,43 @@ 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;
|
||||||
|
|
||||||
$this->setNation(['gennum', 'scout']);
|
$this->setNation(['gennum', 'scout']);
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
|
|
||||||
[$reqGold, $reqRice] = $this->getCost();
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
$this->fullConditionConstraints=[
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::NotBeNeutral(),
|
ConstraintHelper::NotBeNeutral(),
|
||||||
ConstraintHelper::NotWanderingNation(),
|
ConstraintHelper::NotWanderingNation(),
|
||||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||||
];
|
];
|
||||||
|
|
||||||
$relYear = $env['year'] - $env['startyear'];
|
$relYear = $env['year'] - $env['startyear'];
|
||||||
if($this->nation['nation'] != 0 && $relYear < 3 && $this->nation['gennum'] >= GameConst::$initialNationGenLimit){
|
if ($this->nation['nation'] != 0 && $relYear < 3 && $this->nation['gennum'] >= GameConst::$initialNationGenLimit) {
|
||||||
$nationName = $this->nation['name'];
|
$nationName = $this->nation['name'];
|
||||||
$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;
|
||||||
|
|
||||||
@@ -68,13 +74,13 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
[$reqGold, $reqRice] = $this->getCost();
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
$foundProp = $this->calcFoundProp($maxGenCnt, $totalGenCnt, $totalNpcCnt);
|
$foundProp = $this->calcFoundProp($maxGenCnt, $totalGenCnt, $totalNpcCnt);
|
||||||
$foundPropText = number_format($foundProp*100, 1);
|
$foundPropText = number_format($foundProp * 100, 1);
|
||||||
|
|
||||||
$title = "{$name}(랜덤경험";
|
$title = "{$name}(랜덤경험";
|
||||||
if($reqGold > 0){
|
if ($reqGold > 0) {
|
||||||
$title .= ", 자금{$reqGold}";
|
$title .= ", 자금{$reqGold}";
|
||||||
}
|
}
|
||||||
if($reqRice > 0){
|
if ($reqRice > 0) {
|
||||||
$title .= ", 군량{$reqRice}";
|
$title .= ", 군량{$reqRice}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,24 +88,28 @@ 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);
|
||||||
$remainSlot = $maxGenCnt - $currCnt;
|
$remainSlot = $maxGenCnt - $currCnt;
|
||||||
if($remainSlot < 0){
|
if ($remainSlot < 0) {
|
||||||
$remainSlot = 0;
|
$remainSlot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,17 +117,17 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
$foundPropSmall = 1 / ($totalNpcCnt / 3 + 1);
|
$foundPropSmall = 1 / ($totalNpcCnt / 3 + 1);
|
||||||
$foundPropBig = 1 / $maxGenCnt;
|
$foundPropBig = 1 / $maxGenCnt;
|
||||||
|
|
||||||
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('불가능한 커맨드를 강제로 실행 시도');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,16 +155,16 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
if(!$foundNpc){
|
if (!$foundNpc) {
|
||||||
$logger->pushGeneralActionLog("인재를 찾을 수 없었습니다. <1>$date</>");
|
$logger->pushGeneralActionLog("인재를 찾을 수 없었습니다. <1>$date</>");
|
||||||
|
|
||||||
$incStat = Util::choiceRandomUsingWeight([
|
$incStat = Util::choiceRandomUsingWeight([
|
||||||
'leadership_exp'=>$general->getLeadership(false, false, false, false),
|
'leadership_exp' => $general->getLeadership(false, false, false, false),
|
||||||
'strength_exp'=>$general->getStrength(false, false, false, false),
|
'strength_exp' => $general->getStrength(false, false, false, false),
|
||||||
'intel_exp'=>$general->getIntel(false, false, false, false)
|
'intel_exp' => $general->getIntel(false, false, false, false)
|
||||||
]);
|
]);
|
||||||
[$reqGold, $reqRice] = $this->getCost();
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
$exp = 100;
|
$exp = 100;
|
||||||
$ded = 70;
|
$ded = 70;
|
||||||
|
|
||||||
@@ -174,18 +184,21 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
$exp = 200;
|
$exp = 200;
|
||||||
$ded = 300;
|
$ded = 300;
|
||||||
|
|
||||||
$pickTypeList = ['무'=>6, '지'=>6, '무지'=>3];
|
$pickTypeList = ['무' => 6, '지' => 6, '무지' => 3];
|
||||||
|
|
||||||
$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('기본 스탯 설정값이 잘못되어 있음');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,36 +211,34 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
);
|
);
|
||||||
$dexTotal = $avgGen['dex_t'];
|
$dexTotal = $avgGen['dex_t'];
|
||||||
|
|
||||||
if($pickType == '무'){
|
if ($pickType == '무') {
|
||||||
$leadership = $subStat;
|
$leadership = $subStat;
|
||||||
$strength = $mainStat;
|
$strength = $mainStat;
|
||||||
$intel = $otherStat;
|
$intel = $otherStat;
|
||||||
$dexVal = Util::choiceRandom([
|
$dexVal = Util::choiceRandom([
|
||||||
[$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, $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;
|
||||||
$dexVal = [$dexTotal/4, $dexTotal/4, $dexTotal/4, $dexTotal/4];
|
$dexVal = [$dexTotal / 4, $dexTotal / 4, $dexTotal / 4, $dexTotal / 4];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 국내 최고능치 기준으로 랜덤성 스케일링
|
// 국내 최고능치 기준으로 랜덤성 스케일링
|
||||||
$maxLPI = $avgGen['stat_sum'];
|
$maxLPI = $avgGen['stat_sum'];
|
||||||
if($maxLPI > 210) {
|
if ($maxLPI > 210) {
|
||||||
$leadership *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
$leadership *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
||||||
$strength *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
$strength *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
||||||
$intel *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
$intel *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
||||||
} elseif($maxLPI > 180) {
|
} elseif ($maxLPI > 180) {
|
||||||
$leadership *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
$leadership *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
||||||
$strength *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
$strength *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
||||||
$intel *= $avgGen['stat_sum'] / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
$intel *= $avgGen['stat_sum'] / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
||||||
@@ -243,14 +254,13 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
$joinProp = 0.55 * $avgCnt / (Util::valueFit($genCnt + $npcCnt, 1) / 2);
|
$joinProp = 0.55 * $avgCnt / (Util::valueFit($genCnt + $npcCnt, 1) / 2);
|
||||||
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($noScout || !Util::randBool($joinProp)) {
|
if ($noScout || !Util::randBool($joinProp)) {
|
||||||
$scoutType = "발견";
|
$scoutType = "발견";
|
||||||
$scoutLevel = 0;
|
$scoutLevel = 0;
|
||||||
$scoutNation = 0;
|
$scoutNation = 0;
|
||||||
@@ -259,7 +269,7 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
$scoutLevel = 1;
|
$scoutLevel = 1;
|
||||||
$scoutNation = $nationID;
|
$scoutNation = $nationID;
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'gennum'=>$db->sqleval('gennum + 1')
|
'gennum' => $db->sqleval('gennum + 1')
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,8 +296,8 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
$newNPC->setMoney(100, 100);
|
$newNPC->setMoney(100, 100);
|
||||||
$newNPC->setExpDed($avgGen['exp'], $avgGen['ded']);
|
$newNPC->setExpDed($avgGen['exp'], $avgGen['ded']);
|
||||||
$newNPC->setSpecYear(
|
$newNPC->setSpecYear(
|
||||||
Util::round((GameConst::$retirementYear - $age)/12) + $age,
|
Util::round((GameConst::$retirementYear - $age) / 12) + $age,
|
||||||
Util::round((GameConst::$retirementYear - $age)/3) + $age
|
Util::round((GameConst::$retirementYear - $age) / 3) + $age
|
||||||
);
|
);
|
||||||
$newNPC->setDex(
|
$newNPC->setDex(
|
||||||
$dexVal[0],
|
$dexVal[0],
|
||||||
@@ -309,9 +319,9 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
$logger->pushGeneralHistoryLog("<Y>$npcName</>{$josaRa}는 <C>인재</>를 {$scoutType}");
|
$logger->pushGeneralHistoryLog("<Y>$npcName</>{$josaRa}는 <C>인재</>를 {$scoutType}");
|
||||||
|
|
||||||
$incStat = Util::choiceRandomUsingWeight([
|
$incStat = Util::choiceRandomUsingWeight([
|
||||||
'leadership_exp'=>$general->getLeadership(false, false, false, false),
|
'leadership_exp' => $general->getLeadership(false, false, false, false),
|
||||||
'strength_exp'=>$general->getStrength(false, false, false, false),
|
'strength_exp' => $general->getStrength(false, false, false, false),
|
||||||
'intel_exp'=>$general->getIntel(false, false, false, false)
|
'intel_exp' => $general->getIntel(false, false, false, false)
|
||||||
]);
|
]);
|
||||||
[$reqGold, $reqRice] = $this->getCost();
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
@@ -329,6 +339,4 @@ class che_인재탐색 extends Command\GeneralCommand{
|
|||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\Command\Nation;
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
use \sammo\{
|
use\sammo\{
|
||||||
DB, Util, JosaUtil,
|
DB,
|
||||||
General,
|
Util,
|
||||||
|
JosaUtil,
|
||||||
|
General,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst,
|
GameConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
@@ -12,9 +15,9 @@ use \sammo\{
|
|||||||
KVStorage
|
KVStorage
|
||||||
};
|
};
|
||||||
|
|
||||||
use function \sammo\{
|
use function\sammo\{
|
||||||
getDomesticExpLevelBonus,
|
getDomesticExpLevelBonus,
|
||||||
CriticalRatioDomestic,
|
CriticalRatioDomestic,
|
||||||
CriticalScoreEx,
|
CriticalScoreEx,
|
||||||
tryUniqueItemLottery
|
tryUniqueItemLottery
|
||||||
};
|
};
|
||||||
@@ -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;
|
||||||
|
|
||||||
@@ -39,42 +45,47 @@ class che_의병모집 extends Command\NationCommand{
|
|||||||
$this->setCity();
|
$this->setCity();
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
$relYear = $env['year'] - $env['startyear'];
|
$relYear = $env['year'] - $env['startyear'];
|
||||||
|
|
||||||
$this->fullConditionConstraints=[
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::NotBeNeutral(),
|
ConstraintHelper::NotBeNeutral(),
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::AvailableStrategicCommand(),
|
ConstraintHelper::AvailableStrategicCommand(),
|
||||||
ConstraintHelper::NotOpeningPart($relYear),
|
ConstraintHelper::NotOpeningPart($relYear),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
$nextTerm = $this->generalObj->onCalcStrategic($this->getName(), 'delay', $nextTerm);
|
$nextTerm = $this->generalObj->onCalcStrategic($this->getName(), 'delay', $nextTerm);
|
||||||
return $nextTerm;
|
return $nextTerm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run():bool{
|
public function run(): bool
|
||||||
if(!$this->hasFullConditionMet()){
|
{
|
||||||
|
if (!$this->hasFullConditionMet()) {
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +125,7 @@ class che_의병모집 extends Command\NationCommand{
|
|||||||
$broadcastMessage = "<Y>{$generalName}</>{$josaYi} <M>{$commandName}</>{$josaUl} 발동하였습니다.";
|
$broadcastMessage = "<Y>{$generalName}</>{$josaYi} <M>{$commandName}</>{$josaUl} 발동하였습니다.";
|
||||||
|
|
||||||
$nationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
$nationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
||||||
foreach($nationGeneralList as $nationGeneralID){
|
foreach ($nationGeneralList as $nationGeneralID) {
|
||||||
$nationGeneralLogger = new ActionLogger($nationGeneralID, $nationID, $year, $month);
|
$nationGeneralLogger = new ActionLogger($nationGeneralID, $nationID, $year, $month);
|
||||||
$nationGeneralLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
$nationGeneralLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
||||||
$nationGeneralLogger->flush();
|
$nationGeneralLogger->flush();
|
||||||
@@ -133,7 +144,7 @@ class che_의병모집 extends Command\NationCommand{
|
|||||||
$createGenIdx = $gameStor->npccount + 1;
|
$createGenIdx = $gameStor->npccount + 1;
|
||||||
$lastCreatGenIdx = $createGenIdx + $createGenCnt;
|
$lastCreatGenIdx = $createGenIdx + $createGenCnt;
|
||||||
|
|
||||||
$pickTypeList = ['무'=>5, '지'=>5];
|
$pickTypeList = ['무' => 5, '지' => 5];
|
||||||
|
|
||||||
$avgGen = $db->queryFirstRow(
|
$avgGen = $db->queryFirstRow(
|
||||||
'SELECT max(leadership+strength+intel) as stat_sum, avg(dedication) as ded,avg(experience) as exp,
|
'SELECT max(leadership+strength+intel) as stat_sum, avg(dedication) as ded,avg(experience) as exp,
|
||||||
@@ -143,51 +154,52 @@ class che_의병모집 extends Command\NationCommand{
|
|||||||
);
|
);
|
||||||
$dexTotal = $avgGen['dex_t'];
|
$dexTotal = $avgGen['dex_t'];
|
||||||
|
|
||||||
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('기본 스탯 설정값이 잘못되어 있음');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($pickType == '무'){
|
if ($pickType == '무') {
|
||||||
$leadership = $subStat;
|
$leadership = $subStat;
|
||||||
$strength = $mainStat;
|
$strength = $mainStat;
|
||||||
$intel = $otherStat;
|
$intel = $otherStat;
|
||||||
$dexVal = Util::choiceRandom([
|
$dexVal = Util::choiceRandom([
|
||||||
[$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, $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;
|
||||||
$dexVal = [$dexTotal/4, $dexTotal/4, $dexTotal/4, $dexTotal/4];
|
$dexVal = [$dexTotal / 4, $dexTotal / 4, $dexTotal / 4, $dexTotal / 4];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 국내 최고능치 기준으로 랜덤성 스케일링
|
// 국내 최고능치 기준으로 랜덤성 스케일링
|
||||||
$maxLPI = $avgGen['stat_sum'];
|
$maxLPI = $avgGen['stat_sum'];
|
||||||
if($maxLPI > 210) {
|
if ($maxLPI > 210) {
|
||||||
$leadership *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
$leadership *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
||||||
$strength *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
$strength *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
||||||
$intel *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
$intel *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.6, 0.9);
|
||||||
} elseif($maxLPI > 180) {
|
} elseif ($maxLPI > 180) {
|
||||||
$leadership *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
$leadership *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
||||||
$strength *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
$strength *= $maxLPI / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
||||||
$intel *= $avgGen['stat_sum'] / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
$intel *= $avgGen['stat_sum'] / GameConst::$defaultStatTotal * Util::randRange(0.75, 0.95);
|
||||||
@@ -199,9 +211,9 @@ class che_의병모집 extends Command\NationCommand{
|
|||||||
$leadership = Util::round($leadership);
|
$leadership = Util::round($leadership);
|
||||||
$strength = Util::round($strength);
|
$strength = Util::round($strength);
|
||||||
$intel = Util::round($intel);
|
$intel = Util::round($intel);
|
||||||
|
|
||||||
$age = $avgGen['age'];
|
$age = $avgGen['age'];
|
||||||
|
|
||||||
$newNPC = new \sammo\Scenario\NPC(
|
$newNPC = new \sammo\Scenario\NPC(
|
||||||
Util::randRangeInt(1, 150),
|
Util::randRangeInt(1, 150),
|
||||||
"의병장{$createGenIdx}",
|
"의병장{$createGenIdx}",
|
||||||
@@ -228,21 +240,19 @@ class che_의병모집 extends Command\NationCommand{
|
|||||||
$dexVal[3],
|
$dexVal[3],
|
||||||
$avgGen['dex5']
|
$avgGen['dex5']
|
||||||
);
|
);
|
||||||
|
|
||||||
$newNPC->build($this->env);
|
$newNPC->build($this->env);
|
||||||
}
|
}
|
||||||
|
|
||||||
$gameStor->npccount = $lastCreatGenIdx;
|
$gameStor->npccount = $lastCreatGenIdx;
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'gennum'=>$db->sqleval('gennum + %i', $createGenCnt),
|
'gennum' => $db->sqleval('gennum + %i', $createGenCnt),
|
||||||
'strategic_cmd_limit' => $this->getPostReqTurn()
|
'strategic_cmd_limit' => $this->getPostReqTurn()
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -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,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":"."
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -7,7 +7,9 @@
|
|||||||
"diplomacy":[
|
"diplomacy":[
|
||||||
],
|
],
|
||||||
"stat":{
|
"stat":{
|
||||||
|
"npcTotal":120,
|
||||||
"npcMax":65,
|
"npcMax":65,
|
||||||
|
"npcMin":10,
|
||||||
"chiefMin":55
|
"chiefMin":55
|
||||||
},
|
},
|
||||||
"const":{
|
"const":{
|
||||||
|
|||||||
@@ -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":{
|
||||||
|
|||||||
@@ -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":{
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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":[
|
||||||
|
|||||||
@@ -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":[
|
||||||
|
|||||||
@@ -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, "의협", "집중"],
|
||||||
|
|||||||
@@ -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],
|
||||||
|
|||||||
@@ -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, "의협", "집중"],
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
"total": 225,
|
"total": 225,
|
||||||
"min": 40,
|
"min": 40,
|
||||||
"max": 95,
|
"max": 95,
|
||||||
"npcMax": 90,
|
"npcTotal":190,
|
||||||
|
"npcMax":90,
|
||||||
|
"npcMin":30,
|
||||||
"chiefMin": 65
|
"chiefMin": 65
|
||||||
},
|
},
|
||||||
"iconPath": "스타1프로게이머",
|
"iconPath": "스타1프로게이머",
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
"total": 240,
|
"total": 240,
|
||||||
"min": 40,
|
"min": 40,
|
||||||
"max": 110,
|
"max": 110,
|
||||||
"npcMax": 90,
|
"npcTotal":200,
|
||||||
|
"npcMax":90,
|
||||||
|
"npcMin":20,
|
||||||
"chiefMin": 65
|
"chiefMin": 65
|
||||||
},
|
},
|
||||||
"iconPath": "포켓몬스터",
|
"iconPath": "포켓몬스터",
|
||||||
|
|||||||
Reference in New Issue
Block a user