버그 수정

This commit is contained in:
2020-04-19 06:18:35 +09:00
parent 17d9853e90
commit e63b46b004
7 changed files with 38 additions and 45 deletions
+3 -2
View File
@@ -39,7 +39,7 @@ class AutorunGeneralPolicy{
static public $priority = [
static public $default_priority = [
'NPC사망대비',
'귀환',
'금쌀구매',
@@ -114,7 +114,8 @@ class AutorunGeneralPolicy{
}
function __construct(General $general, $aiOptions){
//TODO: 국가 정책을 받아와야함
$this->priority = static::$default_priority;
if($general->getVar('npc') >= 2){
$this->doNPCState($general);
@@ -38,7 +38,7 @@ class che_군량매매 extends Command\GeneralCommand{
if(!is_int($amount)){
return false;
}
$amount = Util::valueFit($amount, 100, GameConst::$maxIncentiveAmount);
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
$this->arg = [
'buyRice'=>$buyRice,
+2 -3
View File
@@ -165,12 +165,11 @@ class che_징병 extends Command\GeneralCommand{
$currCrewType = $this->currCrewType;
$crewTypeName = $reqCrewType->name;
$josaUl = JosaUtil::pick($crewTypeName, '을');
$logger = $general->getLogger();
if($reqCrewType->id == $currCrewType->id && $currCrew > 0){
$logger->pushGeneralActionLog("{$crewTypeName}{$josaUl} <C>{$reqCrewText}</>명을 추가{$this->getName()}했습니다. <1>$date</>");
$logger->pushGeneralActionLog("{$crewTypeName} <C>{$reqCrewText}</>명을 추가{$this->getName()}했습니다. <1>$date</>");
$train = ($currCrew * $general->getVar('train') + $reqCrew * static::$defaultTrain) / ($currCrew + $reqCrew);
$atmos = ($currCrew * $general->getVar('atmos') + $reqCrew * static::$defaultAtmos) / ($currCrew + $reqCrew);
@@ -179,7 +178,7 @@ class che_징병 extends Command\GeneralCommand{
$general->setVar('atmos', $atmos);
}
else{
$logger->pushGeneralActionLog("{$crewTypeName}{$josaUl} <C>{$reqCrewText}</>명을 {$this->getName()}했습니다. <1>$date</>");
$logger->pushGeneralActionLog("{$crewTypeName} <C>{$reqCrewText}</>명을 {$this->getName()}했습니다. <1>$date</>");
$general->setVar('crewtype', $reqCrewType->id);
$general->setVar('crew', $reqCrew);
$general->setVar('train', static::$defaultTrain);
+16 -16
View File
@@ -85,7 +85,7 @@ class GeneralAI
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$this->env = $gameStor->getValues(['startyear', 'year', 'month', 'turnterm', 'killturn', 'scenario', 'gold_rate', 'rice_rate', 'develcost', 'autorun_user']);
$this->env = $gameStor->getAll(true);
$this->baseDevelCost = $this->env['develcost'] * 12;
$this->general = $general;
if ($general->getRawCity() === null) {
@@ -1684,6 +1684,10 @@ class GeneralAI
}
}
if(!$cmdList){
return null;
}
return Util::choiceRandomUsingWeightPair($cmdList);
}
@@ -2093,7 +2097,7 @@ class GeneralAI
}
}
if(!$cmd){
if(!$cmdList){
return null;
}
return Util::choiceRandomUsingWeightPair($cmdList);
@@ -2251,7 +2255,7 @@ class GeneralAI
return null;
}
if($this->general['crew'] >= $this->nationPolicy->minWarCrew){
if($this->general->getVar('crew') >= $this->nationPolicy->minWarCrew){
return null;
}
@@ -2427,8 +2431,9 @@ class GeneralAI
protected function do귀환(GeneralCommand $reservedCommand): ?GeneralCommand
{
$cityID = $this->general->getCityID();
if(key_exists($cityID, $this->supplyCities)){
$general = $this->general;
$city = $this->city;
if($city['nation'] == $general->getNationID() && $city['supply']){
return null;
}
@@ -2456,7 +2461,7 @@ class GeneralAI
$general = $this->general;
$lordCities = $db->queryFirstColumn('SELECT city.city as city FROM general LEFT JOIN city ON general.city = city.city WHERE general.officer_level = 12 AND city.nation = 0');
$nationCities = $db->queryFirstColumn('SELECT city a FROM city WHERE nation != 0');+
$nationCities = $db->queryFirstColumn('SELECT city a FROM city WHERE nation != 0');
$occupiedCities = [];
foreach ($lordCities as $tCityId) {
@@ -2636,7 +2641,7 @@ class GeneralAI
return null;
}
protected function NPC사망대비(): ?GeneralCommand
protected function doNPC사망대비(): ?GeneralCommand
{
$general = $this->getGeneralObj();
@@ -2865,7 +2870,7 @@ class GeneralAI
$this->chooseNonLordPromotion();
}
if($reservedCommand->isRunnable()){
if(!($reservedCommand instanceof Command\NationCommand\휴식) && $reservedCommand->isRunnable()){
return $reservedCommand;
}
@@ -2911,11 +2916,6 @@ class GeneralAI
$npcType = $general->getVar('npc');
$nationID = $general->getNationID();
$cmd = $this->NPC사망대비();
if($cmd){
return $cmd;
}
//특별 메세지 있는 경우 출력 하루 4번
$term = $this->env['turnterm'];
if ($general->getVar('npcmsg') && Util::randBool($term / (6 * 60))) {
@@ -2955,14 +2955,14 @@ class GeneralAI
return $this->do집합($reservedCommand);
}
if($reservedCommand->isRunnable()){
if(!($reservedCommand instanceof Command\General\휴식) && $reservedCommand->isRunnable()){
return $reservedCommand;
}
if ($general->getVar('injury') > 10) {
return buildGeneralCommandClass('che_요양', $general, $this->env);
}
if($npcType == 2 && $nationID == 0){
$result = $this->do거병($reservedCommand);
if($result !== null){
@@ -2977,7 +2977,7 @@ class GeneralAI
}
return $this->do중립($reservedCommand);
}
if($npcType >= 2 && $general->getVar('officer_level') == 12 && !$this->nation['capital']){
//방랑군 건국
$result = $this->do건국($reservedCommand);
+1 -1
View File
@@ -269,7 +269,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
}
$generalCommandObj = $ai->chooseGeneralTurn($generalCommandObj); // npc AI 처리
LogText("turn", "General: {$general->getName()}[{$general->getID()},{$general->getStaticNation()['name']}]; run; {$generalCommandObj->getBrief()}");
}
if(!$turnObj->processBlocked()){