버그 수정

This commit is contained in:
2019-04-28 02:54:01 +09:00
parent a7f000e51e
commit ab47f40ee1
6 changed files with 18 additions and 21 deletions
+3 -5
View File
@@ -101,8 +101,7 @@ function SetNationFront($nationNo) {
$db = DB::db();
foreach($db->queryFirstColumn(
'SELECT city from city where nation IN
(SELECT you from diplomacy where me = %i and state=0)'
'SELECT city FROM city JOIN diplomacy ON diplomacy.you = city.nation WHERE diplomacy.state = 0 AND me = %i'
, $nationNo
) as $city){
foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){
@@ -110,8 +109,7 @@ function SetNationFront($nationNo) {
}
};
foreach($db->queryFirstColumn(
'SELECT city from city where nation IN
(SELECT you from diplomacy where me = %i and state=1 and term<=5)'
'SELECT city FROM city JOIN diplomacy ON diplomacy.you = city.nation WHERE diplomacy.state = 1 AND diplomacy.term <= 5 AND me = %i'
, $nationNo
) as $city){
foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){
@@ -123,7 +121,7 @@ function SetNationFront($nationNo) {
//NOTE: if, else일 경우 NPC는 전쟁시에는 공백지로 출병하지 않는다는 뜻이 된다.
foreach ($db->queryFirstColumn('SELECT city from city where nation=0') as $city) {
foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){
$adj[$adjKey] = $adjVal;
$adj2[$adjKey] = $adjVal;
}
}
}
@@ -86,7 +86,7 @@ class che_사기진작 extends Command\GeneralCommand{
$exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp);
$ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded);
$general->increaseVarWithLimit('atmos', $score, 0, GameConst::$maAtmosByCommand);
$general->increaseVarWithLimit('atmos', $score, 0, GameConst::$maxAtmosByCommand);
$general->setVar('train', $sideEffect);
$general->addDex($general->getCrewTypeObj(), $score, false);
+3 -4
View File
@@ -48,8 +48,7 @@ class che_출병 extends Command\GeneralCommand{
$this->setCity();
$this->setNation(['war', 'gennum', 'tech', 'gold', 'rice']);
$this->setDestCity($this->arg['destCityID'], []);
$this->setDestNation($this->arg['destNationID'], ['nation' ,'level','name','capital','gennum','tech','type','gold','rice']);
$this->setDestCity($this->arg['destCityID'], ['city', 'name', 'nation']);
[$reqGold, $reqRice] = $this->getCost();
$relYear = $this->env['year'] - $this->env['startyear'];
@@ -67,7 +66,7 @@ class che_출병 extends Command\GeneralCommand{
}
public function getCost():array{
return [0, Util::round($this->general->getVar('crew')/100)];
return [0, Util::round($this->generalObj->getVar('crew')/100)];
}
public function getPreReqTurn():int{
@@ -104,7 +103,7 @@ class che_출병 extends Command\GeneralCommand{
$defenderCityName = $this->destCity['name'];
$defenderCityID = $this->destCity['city'];
$josaRo = JosaUtil::pick($destCityName, '로');
$josaRo = JosaUtil::pick($defenderCityName, '로');
$logger = $general->getLogger();
+7 -7
View File
@@ -904,10 +904,10 @@ class GeneralAI{
$targetCityID = Util::choiceRandom($frontCitiesID);
}
$command = [['che_발령', [
$command = ['che_발령', [
'destGeneralID'=>$nationGeneral->no,
'destCityID'=>$targetCityID
]], 5];
]];
if($nationGeneral->npc<2 && ($workRemain&2)){
$workRemain ^= 2;
@@ -965,10 +965,10 @@ class GeneralAI{
}
$command = [['che_발령', [
$command = ['che_발령', [
'destGeneralID'=>$nationGeneral->no,
'destCityID'=>$targetCity['city']
]], 5];
]];
if($nationGeneral->npc<2 && ($workRemain&2)){
$workRemain ^= 2;
@@ -1482,7 +1482,7 @@ class GeneralAI{
}
}
if($general->getVar('rice') < 90){
if($general->getVar('atmos') < 90 ){
$turnObj = buildGeneralCommandClass('che_사기진작', $general, $env, null);
[$reqGold, $reqRice] = $turnObj->getCost();
if($general->getVar('gold') >= $reqGold && $general->getVar('rice') >= $reqRice){
@@ -1839,7 +1839,7 @@ class GeneralAI{
$nationID = $nation['nation'];
$incomeList = getGoldIncome($nation['nation'], $nation['rate'], $env['gold_rate'], $env['type']);
$incomeList = getGoldIncome($nation['nation'], $nation['rate'], $env['gold_rate'], $nation['type']);
$income = $nation['gold'] + $incomeList[0] + $incomeList[1];
$outcome = getGoldOutcome($nation['nation'], 100); // 100%의 지급량
$bill = intval($income / $outcome * 80); // 수입의 80% 만 지급
@@ -1861,7 +1861,7 @@ class GeneralAI{
$nationID = $nation['nation'];
$incomeList = getRiceIncome($nation['nation'], $nation['rate'], $env['gold_rate'], $env['type']);
$incomeList = getRiceIncome($nation['nation'], $nation['rate'], $env['gold_rate'], $nation['type']);
$income = $nation['rice'] + $incomeList[0] + $incomeList[1];
$outcome = getRiceOutcome($nation['nation'], 100); // 100%의 지급량
$bill = intval($income / $outcome * 80); // 수입의 80% 만 지급
+2 -2
View File
@@ -232,11 +232,11 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
$lastNationTurnKey = "turn_last_{$general->getVar('nation')}_{$general->getVar('level')}";
$lastNationTurn = $nationStor->getValue($lastNationTurnKey);
//수뇌 몇 없는데 매번 left join 하는건 낭비인것 같다.
$rawNationTurn = Json::decode($db->queryFirstRow(
$rawNationTurn = $db->queryFirstRow(
'SELECT action, arg FROM nation_turn WHERE nation_id = %i AND level = %i AND turn_idx =0',
$general->getVar('nation'),
$general->getVar('level')
))??[];
)??[];
$hasNationTurn = true;
$nationCommand = $rawNationTurn['action'];
$nationArg = Json::decode($rawNationTurn['arg']??null);
+2 -2
View File
@@ -4,7 +4,7 @@ namespace sammo;
class WarUnit{
use LazyVarUpdater;
protected $raw;
protected $raw = [];
protected $rawNation;
protected $logger;
@@ -114,7 +114,7 @@ class WarUnit{
return GameConst::$defaultSpecialDomestic;
}
function getSpecialWar():int{
function getSpecialWar():string{
return 0;
}