onCalcNationalIncome 버그

This commit is contained in:
2020-05-18 23:17:16 +09:00
parent fed3246c84
commit 1e485a3883
17 changed files with 50 additions and 41 deletions
+4
View File
@@ -87,6 +87,8 @@ function processGoldIncome() {
$incomeText = number_format($income);
$incomeLog = "이번 수입은 금 <C>$incomeText</>입니다.";
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$nationStor->prev_income_gold = $income;
$db->update('nation', [
'gold'=>$nation['gold']
@@ -362,6 +364,8 @@ function processRiceIncome() {
$incomeText = number_format($income);
$incomeLog = "이번 수입은 쌀 <C>$incomeText</>입니다.";
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$nationStor->prev_income_rice = $income;
$db->update('nation', [
'rice'=>$nation['rice']
+4 -4
View File
@@ -29,12 +29,12 @@ class che_덕가 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
if($type == 'rice'){
return Util::toInt($amount * 0.9);
return $amount * 0.9;
}
if($type == 'pop'){
return Util::toInt($amount * 1.2);
if($type == 'pop' && $amount > 0){
return $amount * 1.2;
}
return $amount;
+3 -3
View File
@@ -24,9 +24,9 @@ class che_도가 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
if($type == 'pop'){
return Util::toInt($amount * 1.2);
public function onCalcNationalIncome(string $type, $amount){
if($type == 'pop' && $amount > 0){
return $amount * 1.2;
}
return $amount;
+2 -2
View File
@@ -28,9 +28,9 @@ class che_도적 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
if($type == 'gold'){
return Util::toInt($amount * 0.9);
return $amount * 0.9;
}
return $amount;
+4 -4
View File
@@ -25,12 +25,12 @@ class che_명가 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
if($type == 'rice'){
return Util::toInt($amount * 0.9);
return $amount * 0.9;
}
if($type == 'pop'){
return Util::toInt($amount * 1.2);
if($type == 'pop' && $amount > 0){
return $amount * 1.2;
}
return $amount;
+4 -4
View File
@@ -25,12 +25,12 @@ class che_법가 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
if($type == 'gold'){
return Util::toInt($amount * 1.1);
return $amount * 1.1;
}
if($type == 'pop'){
return Util::toInt($amount * 0.8);
if($type == 'pop' && $amount > 0){
return $amount * 0.8;
}
return $amount;
+3 -3
View File
@@ -29,9 +29,9 @@ class che_병가 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
if($type == 'pop'){
return Util::toInt($amount * 0.8);
public function onCalcNationalIncome(string $type, $amount):int{
if($type == 'pop' && $amount > 0){
return $amount * 0.8;
}
return $amount;
+2 -2
View File
@@ -24,9 +24,9 @@ class che_불가 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
if($type == 'gold'){
return Util::toInt($amount * 0.9);
return $amount * 0.9;
}
return $amount;
@@ -29,12 +29,12 @@ class che_오두미도 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
if($type == 'rice'){
return Util::toInt($amount * 1.1);
return $amount * 1.1;
}
if($type == 'pop'){
return Util::toInt($amount * 1.2);
if($type == 'pop' && $amount > 0){
return $amount * 1.2;
}
return $amount;
+2 -2
View File
@@ -24,9 +24,9 @@ class che_유가 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
if($type == 'rice'){
return Util::toInt($amount * 0.9);
return $amount * 0.9;
}
return $amount;
+3 -3
View File
@@ -25,9 +25,9 @@ class che_음양가 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
if($type == 'pop'){
return Util::toInt($amount * 1.2);
public function onCalcNationalIncome(string $type, $amount){
if($type == 'pop' && $amount > 0){
return $amount * 1.2;
}
return $amount;
+2 -2
View File
@@ -25,9 +25,9 @@ class che_종횡가 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
if($type == 'gold'){
return Util::toInt($amount * 0.9);
return $amount * 0.9;
}
return $amount;
+3 -3
View File
@@ -29,9 +29,9 @@ class che_태평도 extends \sammo\BaseNation{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
if($type == 'pop'){
return Util::toInt($amount * 1.2);
public function onCalcNationalIncome(string $type, $amount){
if($type == 'pop' && $amount > 0){
return $amount * 1.2;
}
return $amount;
+1 -1
View File
@@ -29,7 +29,7 @@ trait DefaultAction{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
return $amount;
}
+1 -1
View File
@@ -821,7 +821,7 @@ class General implements iAction{
return $value;
}
public function onCalcNationalIncome(string $type, int $amount):int{
public function onCalcNationalIncome(string $type, $amount){
foreach(array_merge([
$this->nationType,
$this->officerLevelObj,
+7 -2
View File
@@ -48,6 +48,9 @@ class GeneralAI
protected $warRoute;
protected $prevIncomeGold;
protected $prevIncomeRice;
/** @var General[] */
protected $nationGenerals;
/** @var General[] */
@@ -112,13 +115,15 @@ class GeneralAI
'color' => '#000000',
'name' => '재야',
];
$gameStor = KVStorage::getStorage($db, 'game_env');
$nationStor = KVStorage::getStorage($db, $this->nation['nation'], 'nation_env');
$nationStor->cacheValues(['npc_nation_policy','npc_general_policy','prev_income_gold','prev_income_rice']);
$this->nationPolicy = new AutorunNationPolicy($general, $this->env['autorun_user']['options'], $nationStor->getValue('npc_nation_policy'), $gameStor->getValue('npc_nation_policy'), $this->nation, $this->env);
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options'], $nationStor->getValue('npc_general_policy'), $gameStor->getValue('npc_general_policy'), $this->nation, $this->env);
$this->prevIncomeGold = $nationStor->prev_income_gold??1000;
$this->prevIncomeRice = $nationStor->prev_income_rice??1000;
$this->nation['aux'] = Json::decode($this->nation['aux']??'{}');
$this->leadership = $general->getLeadership();
+1 -1
View File
@@ -11,7 +11,7 @@ interface iAction{
public function onCalcStat(General $general, string $statName, $value, $aux=null);
public function onCalcStrategic(string $turnType, string $varType, $value);
public function onCalcNationalIncome(string $type, int $amount):int;
public function onCalcNationalIncome(string $type, $amount);
public function getWarPowerMultiplier(WarUnit $unit):array;
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller;