농지개간, 상업투자 구현, General 클래스로 checkStatChange 이동, uniqueItemEx 추가(및 재구현)

This commit is contained in:
2018-09-14 02:26:41 +09:00
parent 9d1d51d0d7
commit eac0049577
4 changed files with 150 additions and 5 deletions
+3 -1
View File
@@ -5,5 +5,7 @@ use \sammo\Util;
use \sammo\JosaUtil;
class che_농지개간 extends che_상업투자{
static $cityKey = 'agri';
static $actionKey = '농업';
static $actionName = '농지 개간';
}
+19 -4
View File
@@ -2,7 +2,7 @@
namespace sammo\Command;
use \sammo\{
Util, JosaUtil,
DB, Util, JosaUtil,
General,
ActionLogger,
getGeneralIntel,
@@ -13,6 +13,7 @@ use \sammo\{
use \sammo\Constraint\Constraint;
use function sammo\CriticalScore;
use function sammo\uniqueItemEx;
class che_상업투자 extends BaseCommand{
@@ -47,6 +48,8 @@ class che_상업투자 extends BaseCommand{
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
}
$db = DB::db();
$general = $this->generalObj;
$trust = Util::valueFit($this->city['trust'], 50);
@@ -94,12 +97,24 @@ class che_상업투자 extends BaseCommand{
$exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp);
$ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded);
//TODO: 내정량 상승시 초과 가능?
//NOTE: 내정량 상승시 초과 가능?
$cityUpdated = [
static::$cityKey => Util::valueFit(
$this->city[static::$cityKey] + $score,
0,
$this->city[static::$cityKey.'2']
)
];
$general->increaseVarWithLimit('gold', -$this->reqGold, 0);
$general->increaseVar('experience', $exp);
$general->increaseVar('dedication', $ded);
$general->increaseVar('intel2', 1);
$general->updateVar('resturn', 'SUCCESS');
$general->applyDB($db);
//TODO:uniqueItemEx에 해당하는 함수 추가
$this->checkStatChange();
uniqueItemEx($general->getVar('no'), $logger);
}