버그 수정

This commit is contained in:
2019-04-24 01:17:21 +09:00
parent 3f2cf23f47
commit 5d1b39ca49
29 changed files with 79 additions and 51 deletions
+3 -1
View File
@@ -7,6 +7,8 @@ use \sammo\{
ActionLogger
};
use function \sammo\getNationStaticInfo;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
@@ -261,7 +263,7 @@ abstract class BaseCommand{
public function testRunnable():?string{
if(!$this->isArgValid()){
throw new \InvalidArgumentException('인자가 제대로 설정되지 않았습니다');
throw new \InvalidArgumentException('인자가 제대로 설정되지 않았습니다'.\sammo\Json::encode($this->arg));
}
if($this->runnableConstraints === null){
throw new \InvalidArgumentException('runnableConstraits가 제대로 설정되지 않았습니다');
+3 -1
View File
@@ -29,7 +29,7 @@ class che_NPC능동 extends Command\GeneralCommand{
if(!key_exists('destCityID', $this->arg)){
return false;
}
if(!key_exists($this->arg['destCityID'], CityConst::all())){
if(CityConst::byID($this->arg['destCityID']) === null){
return false;
}
$this->arg = [
@@ -45,6 +45,8 @@ class che_NPC능동 extends Command\GeneralCommand{
protected function init(){
$general = $this->generalObj;
$this->setNation();
$this->runnableConstraints=[
ConstraintHelper::MustBeNPC()
+1 -1
View File
@@ -113,7 +113,7 @@ class che_강행 extends Command\GeneralCommand{
if($generalList){
$db->update('general', [
'city'=>$destCityID
], 'no IN %li', $generalList);
], 'no IN %li and nation=%i', $generalList, $general->getNationID());
}
foreach($generalList as $targetGeneralID){
$targetGeneral = General::createGeneralObjFromDB($targetGeneralID, [], 1);
+1 -1
View File
@@ -96,7 +96,7 @@ class che_거병 extends Command\GeneralCommand{
'bill'=>100,
'strategic_cmd_limit'=>12,
'surlimit'=>72,
'type'=>0,
'type'=>GameConst::$neutralNationType,
'gennum'=>1
]);
$nationID = DB::db()->insertId();
+10 -10
View File
@@ -34,13 +34,13 @@ class che_건국 extends Command\GeneralCommand{
}
$nationName = $this->arg['nationName']??null;
$nationType = $this->arg['nationType']??null;
$colorType = $this->arg['colorType']??null;
$nationColor = $this->arg['nationColor']??null;
if($nationName === null || $nationType === null || $colorType === null){
if($nationName === null || $nationType === null || $nationColor === null){
return false;
}
if(!is_string($nationName) || !is_string($nationType) || !is_int($colorType)){
if(!is_string($nationName) || !is_string($nationType) || !is_int($nationColor)){
return false;
}
@@ -48,7 +48,7 @@ class che_건국 extends Command\GeneralCommand{
return false;
}
if(!key_exists($colorType, GetNationColors())){
if(!key_exists($nationColor, GetNationColors())){
return false;
}
@@ -62,7 +62,7 @@ class che_건국 extends Command\GeneralCommand{
$this->arg = [
'nationName'=>$nationName,
'nationType'=>$nationType,
'colorType'=>$colorType
'nationColor'=>$nationColor
];
return true;
@@ -75,10 +75,10 @@ class che_건국 extends Command\GeneralCommand{
$nationName = $this->arg['nationName'];
$nationType = $this->arg['nationType'];
$colorType = $this->arg['colorType'];
$nationColor = $this->arg['nationColor'];
$this->setCity();
$this->setNation();
$this->setNation(['gennum']);
$relYear = $env['year'] - $env['startyear'];
@@ -120,7 +120,7 @@ class che_건국 extends Command\GeneralCommand{
$nationName = $this->arg['nationName'];
$nationType = $this->arg['nationType'];
$nationColor = GetNationColors()[$this->arg['colorType']];
$nationColor = GetNationColors()[$this->arg['nationColor']];
$cityName = $this->city['name'];
@@ -152,10 +152,10 @@ class che_건국 extends Command\GeneralCommand{
$db->update('city', [
'nation'=>$general->getNationID(),
'conflict'=>'{}'
], $general->getCityID());
], 'city=%i', $general->getCityID());
$db->update('nation', [
'nation'=>$nationName,
'name'=>$nationName,
'color'=>$nationColor,
'level'=>1,
'type'=>$nationType,
@@ -6,7 +6,7 @@ use \sammo\{
General,
ActionLogger,
LastTurn,
Command
Command, GameConst
};
use function sammo\{
@@ -201,15 +201,20 @@ class che_랜덤임관 extends Command\GeneralCommand{
$destNation = Util::choiceRandomUsingWeightPair($randVals);
}
$logger = $general->getLogger();
if(!$destNation){
throw new MustNotBeReachedException();
//임관 가능한 국가가 없다!
$logger->pushGeneralActionLog("임관 가능한 국가가 없습니다. <1>$date</>");
$this->alternative = new che_요양($general, $this->env, null);
return false;
}
$gennum = $destNation['gennum'];
$destNationID = $destNation['nation'];
$destNationName = $destNation['name'];
$logger = $general->getLogger();
$talkList = [
'어쩌다 보니',
@@ -81,8 +81,8 @@ class che_인재탐색 extends Command\GeneralCommand{
$nationID = $general->getNationID();
$genCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc < 2', $nationID);
$npcCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc == 3', $nationID);
$npcOtherCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation!=%i AND npc == 32', $nationID);
$npcCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc = 3', $nationID);
$npcOtherCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation!=%i AND npc = 3', $nationID);
$genCount = Util::valueFit($genCount, 1);
@@ -84,7 +84,7 @@ class che_주민선정 extends Command\GeneralCommand{
$score *= getDomesticExpLevelBonus($general->getVar('explevel'));
$score *= Util::randRange(0.8, 1.2);
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
$score = Util::valutFit($score, 1);
$score = Util::valueFit($score, 1);
return $score;
}
+2
View File
@@ -92,6 +92,8 @@ class che_해산 extends Command\GeneralCommand{
refreshNationStaticInfo();
$logger = $general->getLogger();
$logger->pushGeneralActionLog("세력을 해산했습니다. <1>$date</>");
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} 세력을 해산했습니다.");
+1 -2
View File
@@ -15,8 +15,7 @@ class 휴식 extends Command\GeneralCommand{
}
protected function init(){
$this->runnableConstraints=[
];
$this->runnableConstraints=[];
}
public function getCost():array{
+1 -1
View File
@@ -33,7 +33,7 @@ class che_발령 extends Command\NationCommand{
if(!key_exists('destCityID', $this->arg)){
return false;
}
if(!key_exists($this->arg['destCityID'], CityConst::all())){
if(CityConst::byID($this->arg['destCityID']) === null){
return false;
}
$destGeneralID = $this->arg['destGeneralID'];
@@ -8,13 +8,15 @@ use \sammo\{
GameConst,
LastTurn,
GameUnitConst,
Command
Command,
Message, MessageTarget
};
use function \sammo\{
getDomesticExpLevelBonus,
CriticalRatioDomestic,
CriticalScoreEx
CriticalScoreEx,
GetImageURL
};
use \sammo\Constraint\Constraint;
+3 -1
View File
@@ -15,6 +15,8 @@ class 휴식 extends Command\NationCommand{
protected function init(){
//아무것도 하지 않음
$this->runnableConstraints=[];
}
public function getPreReqTurn():int{
@@ -24,7 +26,7 @@ class 휴식 extends Command\NationCommand{
public function getPostReqTurn():int{
return 0;
}
public function getCost():array{
return [0, 0];
}