버그 수정

This commit is contained in:
2020-04-19 05:38:25 +09:00
parent 4d02639985
commit 17d9853e90
10 changed files with 38 additions and 37 deletions
+1 -1
View File
@@ -254,7 +254,7 @@ for($j=0; $j < $gencount; $j++) {
$officerLevel = $general['officer_level'];
$officerLevelText = getOfficerLevelText($officerLevel);
$lerdershipBonus = calcLeadershipBonus($officerLevel, $nationInfo['level']);
$leadershipBonus = calcLeadershipBonus($officerLevel, $nationInfo['level']);
$leadershipBonusText = formatLeadershipBonus($leadershipBonus);
if($ourGeneral){
+13 -13
View File
@@ -93,7 +93,7 @@ function processGoldIncome() {
// 각 장수들에게 지급
foreach ($generalRawList as $rawGeneral) {
$generalObj = new General($rawGeneral, null, $year, $month, false);
$generalObj = new General($rawGeneral, null, null, $year, $month, false);
$gold = Util::round(getBill($generalObj->getVar('dedication'))*$ratio);
$generalObj->increaseVar('gold', $gold);
@@ -236,7 +236,7 @@ function getGoldIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
$cityIncome = 0;
foreach($cityList as $rawCity){
$cityID = $rawCity['city'];
$cityIncome += calcCityGoldIncome($rawCity, $officersCnt[$cityID], $capitalID == $cityID, $nationLevel, $nationTypeObj);
$cityIncome += calcCityGoldIncome($rawCity, $officersCnt[$cityID]??0, $capitalID == $cityID, $nationLevel, $nationTypeObj);
}
$cityIncome *= ($taxRate / 20);
@@ -365,7 +365,7 @@ function processRiceIncome() {
// 각 장수들에게 지급
foreach ($generalRawList as $rawGeneral) {
$generalObj = new General($rawGeneral, null, $year, $month, false);
$generalObj = new General($rawGeneral, null, null, $year, $month, false);
$rice = Util::round(getBill($generalObj->getVar('dedication'))*$ratio);
$generalObj->increaseVar('rice', $rice);
@@ -403,7 +403,7 @@ function getRiceIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
foreach($cityList as $rawCity){
$cityID = $rawCity['city'];
$cityIncome += calcCityRiceIncome($rawCity, $officersCnt[$cityID], $capitalID == $cityID, $nationLevel, $nationTypeObj);
$cityIncome += calcCityRiceIncome($rawCity, $officersCnt[$cityID]??0, $capitalID == $cityID, $nationLevel, $nationTypeObj);
}
$cityIncome *= ($taxRate / 20);
@@ -429,7 +429,7 @@ function getWallIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
foreach($cityList as $rawCity){
$cityID = $rawCity['city'];
$cityIncome += calcCityWallRiceIncome($rawCity, $officersCnt[$cityID], $capitalID == $cityID, $nationLevel, $nationTypeObj);
$cityIncome += calcCityWallRiceIncome($rawCity, $officersCnt[$cityID]??0, $capitalID == $cityID, $nationLevel, $nationTypeObj);
}
$cityIncome *= ($taxRate / 20);
@@ -584,7 +584,7 @@ function disaster() {
$generalList = array_map(
function($rawGeneral) use ($city, $year, $month){
return new General($rawGeneral, $city, $year, $month, false);
return new General($rawGeneral, null, $city, $year, $month, false);
},
$generalListByCity[$city['city']]??[]
);
@@ -599,13 +599,13 @@ function disaster() {
$db->update('city', [
'state'=>$stateCode,
'pop'=>$db->sqleval('greatest(pop * %d, pop_max)', $affectRatio),
'trust'=>$db->sqleval('greatest(trust * %d, 100)', $affectRatio),
'agri'=>$db->sqleval('greatest(agri * %d, agri_max)', $affectRatio),
'comm'=>$db->sqleval('greatest(comm * %d, comm_max)', $affectRatio),
'secu'=>$db->sqleval('greatest(secu * %d, secu_max)', $affectRatio),
'def'=>$db->sqleval('greatest(def * %d, def_max)', $affectRatio),
'wall'=>$db->sqleval('greatest(wall * %d, wall_max)', $affectRatio),
'pop'=>$db->sqleval('least(pop * %d, pop_max)', $affectRatio),
'trust'=>$db->sqleval('least(trust * %d, 100)', $affectRatio),
'agri'=>$db->sqleval('least(agri * %d, agri_max)', $affectRatio),
'comm'=>$db->sqleval('least(comm * %d, comm_max)', $affectRatio),
'secu'=>$db->sqleval('least(secu * %d, secu_max)', $affectRatio),
'def'=>$db->sqleval('least(def * %d, def_max)', $affectRatio),
'wall'=>$db->sqleval('least(wall * %d, wall_max)', $affectRatio),
], 'city = %i', $city['city']);
+1 -1
View File
@@ -50,7 +50,7 @@ $turn = [];
$generals = [];
foreach($db->query('SELECT no,name,turntime,npc,city,nation,officer_level FROM general WHERE nation = %i AND officer_level >= 5',$nationID) as $rawGeneral){
$generals[$rawGeneral['officer_level']] = new General($rawGeneral, null, $year, $month, false);
$generals[$rawGeneral['officer_level']] = new General($rawGeneral, null, null, $year, $month, false);
}
$nationTurnList = [];
+1 -1
View File
@@ -146,7 +146,7 @@ foreach($rawDefenderList as $idx=>$rawDefenderGeneral){
'reason'=>"[수비자{$idx}]".$v->errorStr()
]);
}
$defenderList[] = new General($rawDefenderGeneral, $rawDefenderCity, $year, $month, true);
$defenderList[] = new General($rawDefenderGeneral, null, $rawDefenderCity, $year, $month, true);
}
+4 -2
View File
@@ -265,14 +265,16 @@ foreach(Util::range(GameConst::$maxTurn) as $turnIdx){
}
$db->insert('general_turn', $turnRows);
$rank_data = [];
foreach(array_keys(General::RANK_COLUMN) as $rankColumn){
$db->insert('rank_data', [
$rank_data[] = [
'general_id'=>$generalID,
'nation_id'=>0,
'type'=>$rankColumn,
'value'=>0
]);
];
}
$db->insert('rank_data', $rank_data);
$cityname = CityConst::byID($city)->name;
$me = [
+1 -1
View File
@@ -250,7 +250,7 @@ class che_화계 extends Command\GeneralCommand{
$destCityID,
$destNationID
) as $rawDestCityGeneral){
$destCityGeneralList[] = new General($rawDestCityGeneral, $destCity, $year, $month, true);
$destCityGeneralList[] = new General($rawDestCityGeneral, null, $destCity, $year, $month, true);
//계략에 성공할 경우 logger를 사용해야 하므로 해야하므로, 미리 초기화한다.
//실패하면 날리는거지 뭐~
};
+1 -1
View File
@@ -93,7 +93,7 @@ class General implements iAction{
}
$this->resultTurn = new LastTurn();
if($year !== null || $month !== null){
if($year !== null && $month !== null){
$this->initLogger($year, $month);
}
+10 -14
View File
@@ -2849,8 +2849,8 @@ class GeneralAI
$this->categorizeNationGeneral();
$this->categorizeNationCities();
$month = $this->env['month'];
if($general->getVar('officer_level') == 12){
$month = $this->env['month'];
if (in_array($month, [1, 4, 7, 10])) {
$this->choosePromotion();
} else if ($month == 12) {
@@ -3252,28 +3252,24 @@ class GeneralAI
$nationID = $nation['nation'];
$rate = 15;
//도시
if(!$this->supplyCities){
$db->update('nation', [
'war' => 0,
'rate' => 15
], 'nation=%i', $nationID);
} else {
if($this->supplyCities){
$devRate = $this->calcNationDevelopedRate();
$avg = ($devRate['pop'] + $devRate['all_p']) / 2;
$avg = ($devRate['pop'] + $devRate['all']) / 2;
if ($avg > 0.95) $rate = 25;
elseif ($avg > 0.70) $rate = 20;
elseif ($avg > 0.50) $rate = 15;
else $rate = 10;
$db->update('nation', [
'war' => 0,
'rate' => $rate
], 'nation=%i', $nationID);
return $rate;
}
$db->update('nation', [
'war' => 0,
'rate' => $rate
], 'nation=%i', $nationID);
return $rate;
}
protected function chooseGoldBillRate(): int
+4 -2
View File
@@ -358,14 +358,16 @@ class NPC{
}
$db->insert('general_turn', $turnRows);
$rank_data = [];
foreach(array_keys(\sammo\General::RANK_COLUMN) as $rankColumn){
$db->insert('rank_data', [
$rank_data[] = [
'general_id'=>$this->generalID,
'nation_id'=>0,
'type'=>$rankColumn,
'value'=>0
]);
];
}
$db->insert('rank_data', $rank_data);
return true; //생성되었다.
}
+2 -1
View File
@@ -224,6 +224,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
$currentTurn = null;
$gameStor = KVStorage::getStorage($db, 'game_env');
$autorun_user = $gameStor->autorun_user;
foreach($generalsTodo as $rawGeneral){
$generalCommand = $rawGeneral['action'];
@@ -261,7 +262,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
}
if($general->getVar('npc') >= 2){
if($general->getVar('npc') >= 2 || ($autorun_user['limit_minutes']??false)){
$ai = new GeneralAI($turnObj->getGeneral());
if($hasNationTurn){
$nationCommandObj = $ai->chooseNationTurn($nationCommandObj);