버그 수정

This commit is contained in:
2020-04-24 00:44:31 +09:00
parent 5176d9a97d
commit 7805c4eee6
10 changed files with 114 additions and 46 deletions
@@ -108,6 +108,9 @@ class che_인재탐색 extends Command\GeneralCommand{
$currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2);
$remainSlot = $maxGenCnt - $currCnt;
if($remainSlot < 0){
$remainSlot = 0;
}
$avgCnt = $currCnt / $nationCnt;
+1 -1
View File
@@ -205,7 +205,7 @@ class che_천도 extends Command\NationCommand{
'capset' => $db->sqleval('capset + 1'),
], 'nation=%i', $nationID);
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 천도했습니다. <1>$date</");
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 천도했습니다. <1>$date</>");
$logger->pushGeneralHistoryLog("<G><b>{$destCityName}</b></>{$josaRo} <M>천도</>명령");
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>{$josaRo} <M>천도</> 명령");
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>{$josaRo} <M>천도</>를 명령하였습니다.");
+3
View File
@@ -31,6 +31,9 @@ class che_허보 extends Command\NationCommand{
static public $reqArg = true;
protected function argTest():bool{
if($this->arg === null){
return null;
}
if(!key_exists('destCityID', $this->arg)){
return false;
}
+12 -7
View File
@@ -44,8 +44,10 @@ class General implements iAction{
const RANK_COLUMN = [
'firenum'=>1, 'warnum'=>1, 'killnum'=>1, 'deathnum'=>1, 'killcrew'=>1, 'deathcrew'=>1,
'ttw'=>1, 'ttd'=>1, 'ttl'=>1, 'ttg'=>1, 'ttp'=>1, 'tlw'=>1, 'tld'=>1, 'tll'=>1, 'tlg'=>1, 'tlp'=>1,
'tsw'=>1, 'tsd'=>1, 'tsl'=>1, 'tsg'=>1, 'tsp'=>1, 'tiw'=>1, 'tid'=>1, 'til'=>1, 'tig'=>1, 'tip'=>1,
'ttw'=>1, 'ttd'=>1, 'ttl'=>1, 'ttg'=>1, 'ttp'=>1,
'tlw'=>1, 'tld'=>1, 'tll'=>1, 'tlg'=>1, 'tlp'=>1,
'tsw'=>1, 'tsd'=>1, 'tsl'=>1, 'tsg'=>1, 'tsp'=>1,
'tiw'=>1, 'tid'=>1, 'til'=>1, 'tig'=>1, 'tip'=>1,
'betwin'=>1, 'betgold'=>1, 'betwingold'=>1,
];
@@ -97,6 +99,10 @@ class General implements iAction{
$this->initLogger($year, $month);
}
if($rawRank){
$this->rankVarRead = $rawRank;
}
if(!$fullConstruct){
return;
}
@@ -113,10 +119,6 @@ class General implements iAction{
$this->itemObjs['weapon'] = buildItemClass($raw['weapon']);
$this->itemObjs['book'] = buildItemClass($raw['book']);
$this->itemObjs['item'] = buildItemClass($raw['item']);
if($rawRank){
$this->rankVarRead = $rawRank;
}
}
function initLogger(int $year, int $month){
@@ -978,7 +980,10 @@ class General implements iAction{
$result[$generalID] = new DummyGeneral($constructMode > 0);
continue;
}
$result[$generalID] = new static($rawGenerals[$generalID], $rawRanks[$generalID], null, $year, $month, $constructMode > 1);
if(key_exists($generalID, $rawRanks) && count($rawRanks[$generalID]??[]) !== count($rankColumn)){
throw new \RuntimeException('column의 수가 일치하지 않음 : '.$generalID);
}
$result[$generalID] = new static($rawGenerals[$generalID], $rawRanks[$generalID]??null, null, $year, $month, $constructMode > 1);
}
return $result;
+9 -9
View File
@@ -453,10 +453,10 @@ class GeneralAI
if($generalID == $this->general->getID()){
continue;
}
$city = $this->supplyCities[$userGeneral->getCityID()];
if(!key_exists($generalID, $this->supplyCities)){
if(!key_exists($userGeneral->getCityID(), $this->supplyCities)){
continue;
}
$city = $this->supplyCities[$userGeneral->getCityID()];
$troopLeaderID = $userGeneral->getVar('troop');
if(!$troopLeaderID || !key_exists($troopLeaderID, $this->troopLeaders)){
continue;
@@ -559,10 +559,10 @@ class GeneralAI
if($generalID == $this->general->getID()){
continue;
}
$city = $this->supplyCities[$userGeneral->getCityID()];
if(!key_exists($generalID, $this->supplyCities)){
if(!key_exists($userGeneral->getCityID(), $this->supplyCities)){
continue;
}
$city = $this->supplyCities[$userGeneral->getCityID()];
if($userGeneral->getVar('troop') !== 0){
continue;
}
@@ -1057,7 +1057,7 @@ class GeneralAI
}
$crewtype = $targetUserGeneral->getCrewTypeObj();
$reqMoney = $crewtype->costWithTech($this->nation['tech'], $targetUserGeneral->getLeadership()) * 2 * 4 * 1.1;
$reqMoney = $crewtype->costWithTech($this->nation['tech'], $targetUserGeneral->getLeadership(false)) * 2 * 4 * 1.1;
if ($this->env['year'] > $this->env['startyear'] + 5) {
$reqMoney = max($reqMoney, $reqHumanMinRes);
}
@@ -1157,7 +1157,7 @@ class GeneralAI
}
$crewtype = $targetUserGeneral->getCrewTypeObj();
$reqMoney = $crewtype->costWithTech($this->nation['tech'], $targetUserGeneral->getLeadership()) * 2 * 4 * 1.1;
$reqMoney = $crewtype->costWithTech($this->nation['tech'], $targetUserGeneral->getLeadership(false)) * 2 * 4 * 1.1;
if ($this->env['year'] > $this->env['startyear'] + 5) {
$reqMoney = max($reqMoney, $reqHumanMinRes);
}
@@ -1239,7 +1239,7 @@ class GeneralAI
}
$crewtype = $targetNPCGeneral->getCrewTypeObj();
$reqMoney = $crewtype->costWithTech($this->nation['tech'], $targetNPCGeneral->getLeadership()) * 2 * 4 * 1.1;
$reqMoney = $crewtype->costWithTech($this->nation['tech'], $targetNPCGeneral->getLeadership(false)) * 2 * 4 * 1.1;
if ($this->env['year'] > $this->env['startyear'] + 5) {
$reqMoney = max($reqMoney, $reqNPCMinWarRes);
}
@@ -1325,7 +1325,7 @@ class GeneralAI
}
$crewtype = $targetNPCGeneral->getCrewTypeObj();
$reqMoney = $crewtype->costWithTech($nation['tech'], $targetNPCGeneral->getLeadership()) * 2 * 4 * 1.1;
$reqMoney = $crewtype->costWithTech($nation['tech'], $targetNPCGeneral->getLeadership(false)) * 2 * 4 * 1.1;
if ($this->env['year'] > $this->env['startyear'] + 5) {
$reqMoney = max($reqMoney, $reqNPCMinWarRes);
}
@@ -2995,7 +2995,7 @@ class GeneralAI
else{
$userCivilGenerals[$generalID] = $nationGeneral;
}
} else if ($nationGeneral->getLeadership() >= $this->nationPolicy->minNPCWarLeadership) {
} else if ($nationGeneral->getLeadership(false) >= $this->nationPolicy->minNPCWarLeadership) {
$npcWarGenerals[$generalID] = $nationGeneral;
} else {
$npcCivilGenerals[$generalID] = $nationGeneral;