game: 내정 1% 감소 후, 세율 반영하도록 변경
This commit is contained in:
+19
-19
@@ -4,14 +4,12 @@ namespace sammo;
|
|||||||
* 시간 단위로 일어나는 이벤트들에 대한 함수 모음
|
* 시간 단위로 일어나는 이벤트들에 대한 함수 모음
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//1월마다 실행
|
//1월마다 실행
|
||||||
function processSpring() {
|
function processSpring() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
//인구 증가
|
|
||||||
popIncrease();
|
|
||||||
// 1월엔 무조건 내정 1% 감소
|
// 1월엔 무조건 내정 1% 감소
|
||||||
$db->update('city',[
|
$db->update('city',[
|
||||||
'dead'=>0,
|
'dead'=>0,
|
||||||
@@ -22,6 +20,9 @@ function processSpring() {
|
|||||||
'wall'=>$db->sqleval('wall * 0.99'),
|
'wall'=>$db->sqleval('wall * 0.99'),
|
||||||
],true);
|
],true);
|
||||||
|
|
||||||
|
//인구 증가
|
||||||
|
popIncrease();
|
||||||
|
|
||||||
// > 10000 유지비 3%, > 1000 유지비 1%
|
// > 10000 유지비 3%, > 1000 유지비 1%
|
||||||
// 유지비 1%
|
// 유지비 1%
|
||||||
$db->update('general', [
|
$db->update('general', [
|
||||||
@@ -100,7 +101,7 @@ function processGoldIncome() {
|
|||||||
$generalObj = new General($rawGeneral, null, null, null, $year, $month, false);
|
$generalObj = new General($rawGeneral, null, 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);
|
||||||
|
|
||||||
$logger = $generalObj->getLogger();
|
$logger = $generalObj->getLogger();
|
||||||
if($generalObj->getVar('officer_level') > 4){
|
if($generalObj->getVar('officer_level') > 4){
|
||||||
$logger->pushGeneralActionLog($incomeLog, $logger::PLAIN);
|
$logger->pushGeneralActionLog($incomeLog, $logger::PLAIN);
|
||||||
@@ -121,9 +122,9 @@ function processGoldIncome() {
|
|||||||
|
|
||||||
function popIncrease() {
|
function popIncrease() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
$nationList = $db->queryAllLists('SELECT nation,rate_tmp,type FROM nation');
|
$nationList = $db->queryAllLists('SELECT nation,rate_tmp,type FROM nation');
|
||||||
|
|
||||||
// 인구 및 민심
|
// 인구 및 민심
|
||||||
|
|
||||||
$db->update('city', [
|
$db->update('city', [
|
||||||
@@ -138,7 +139,7 @@ function popIncrease() {
|
|||||||
foreach($nationList as [$nationID, $taxRate, $nationType]){
|
foreach($nationList as [$nationID, $taxRate, $nationType]){
|
||||||
$nationTypeObj = buildNationTypeClass($nationType);
|
$nationTypeObj = buildNationTypeClass($nationType);
|
||||||
|
|
||||||
|
|
||||||
$popRatio = (30 - $taxRate)/200; // 20일때 5% 5일때 12.5% 50일때 -10%
|
$popRatio = (30 - $taxRate)/200; // 20일때 5% 5일때 12.5% 50일때 -10%
|
||||||
$popRatio = $nationTypeObj->onCalcNationalIncome('pop', $popRatio);
|
$popRatio = $nationTypeObj->onCalcNationalIncome('pop', $popRatio);
|
||||||
|
|
||||||
@@ -246,7 +247,7 @@ function getGoldIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
|||||||
}
|
}
|
||||||
|
|
||||||
$cityIncome *= ($taxRate / 20);
|
$cityIncome *= ($taxRate / 20);
|
||||||
|
|
||||||
return $cityIncome;
|
return $cityIncome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,9 +291,6 @@ function getWarGoldIncome(string $nationType, array $cityList){
|
|||||||
function processFall() {
|
function processFall() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
//인구 증가
|
|
||||||
popIncrease();
|
|
||||||
|
|
||||||
// 7월엔 무조건 내정 1% 감소
|
// 7월엔 무조건 내정 1% 감소
|
||||||
$db->update('city',[
|
$db->update('city',[
|
||||||
'dead'=>0,
|
'dead'=>0,
|
||||||
@@ -303,6 +301,8 @@ function processFall() {
|
|||||||
'wall'=>$db->sqleval('wall * 0.99'),
|
'wall'=>$db->sqleval('wall * 0.99'),
|
||||||
],true);
|
],true);
|
||||||
|
|
||||||
|
//인구 증가
|
||||||
|
popIncrease();
|
||||||
|
|
||||||
// > 10000 유지비 3%, > 1000 유지비 1%
|
// > 10000 유지비 3%, > 1000 유지비 1%
|
||||||
// 유지비 1%
|
// 유지비 1%
|
||||||
@@ -378,7 +378,7 @@ function processRiceIncome() {
|
|||||||
$generalObj = new General($rawGeneral, null, null, null, $year, $month, false);
|
$generalObj = new General($rawGeneral, null, 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);
|
||||||
|
|
||||||
$logger = $generalObj->getLogger();
|
$logger = $generalObj->getLogger();
|
||||||
if($generalObj->getVar('officer_level') > 4){
|
if($generalObj->getVar('officer_level') > 4){
|
||||||
$logger->pushGeneralActionLog($incomeLog, $logger::PLAIN);
|
$logger->pushGeneralActionLog($incomeLog, $logger::PLAIN);
|
||||||
@@ -418,7 +418,7 @@ function getRiceIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
|||||||
}
|
}
|
||||||
|
|
||||||
$cityIncome *= ($taxRate / 20);
|
$cityIncome *= ($taxRate / 20);
|
||||||
|
|
||||||
return $cityIncome;
|
return $cityIncome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,12 +439,12 @@ function getWallIncome(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 += calcCityWallRiceIncome($rawCity, $officersCnt[$cityID]??0, $capitalID == $cityID, $nationLevel, $nationTypeObj);
|
$cityIncome += calcCityWallRiceIncome($rawCity, $officersCnt[$cityID]??0, $capitalID == $cityID, $nationLevel, $nationTypeObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cityIncome *= ($taxRate / 20);
|
$cityIncome *= ($taxRate / 20);
|
||||||
|
|
||||||
return $cityIncome;
|
return $cityIncome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,7 +520,7 @@ function disaster() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$raiseProp = 0.06 - ($city['secu'] / $city['secu_max']) * 0.05; // 1 ~ 6%
|
$raiseProp = 0.06 - ($city['secu'] / $city['secu_max']) * 0.05; // 1 ~ 6%
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Util::randBool($raiseProp)) {
|
if(Util::randBool($raiseProp)) {
|
||||||
$targetCityList[] = $city;
|
$targetCityList[] = $city;
|
||||||
@@ -592,11 +592,11 @@ function disaster() {
|
|||||||
'def'=>$db->sqleval('def * %d', $affectRatio),
|
'def'=>$db->sqleval('def * %d', $affectRatio),
|
||||||
'wall'=>$db->sqleval('wall * %d', $affectRatio),
|
'wall'=>$db->sqleval('wall * %d', $affectRatio),
|
||||||
], 'city = %i', $city['city']);
|
], 'city = %i', $city['city']);
|
||||||
|
|
||||||
$generalList = array_map(
|
$generalList = array_map(
|
||||||
function($rawGeneral) use ($city, $year, $month){
|
function($rawGeneral) use ($city, $year, $month){
|
||||||
return new General($rawGeneral, null, $city, null, $year, $month, false);
|
return new General($rawGeneral, null, $city, null, $year, $month, false);
|
||||||
},
|
},
|
||||||
$generalListByCity[$city['city']]??[]
|
$generalListByCity[$city['city']]??[]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -619,7 +619,7 @@ function disaster() {
|
|||||||
'wall'=>$db->sqleval('least(wall * %d, wall_max)', $affectRatio),
|
'wall'=>$db->sqleval('least(wall * %d, wall_max)', $affectRatio),
|
||||||
], 'city = %i', $city['city']);
|
], 'city = %i', $city['city']);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user