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