농상치성수 내정 코드 구현

This commit is contained in:
2018-09-15 00:40:24 +09:00
parent 00cb10f029
commit 322541b16f
6 changed files with 64 additions and 16 deletions
-9
View File
@@ -199,15 +199,6 @@ function process_1(array $rawGeneral, int $type){
$date = substr($general['turntime'],11,5);
if($type == 1){
$cityKey = 'agri';
$actionName = '농지 개간';
}
else{
$cityKey = 'comm';
$actionName = '상업 투자';
}
$env = $gameStor->getValues(['startyear', 'year', 'month', 'develcost']);
$general = new General($rawGeneral, null, $env['year'], $env['month']);
+1
View File
@@ -6,6 +6,7 @@ use \sammo\JosaUtil;
class che_농지개간 extends che_상업투자{
static $cityKey = 'agri';
static $statKey = 'intel';
static $actionKey = '농업';
static $actionName = '농지 개간';
}
+27 -7
View File
@@ -5,7 +5,7 @@ use \sammo\{
DB, Util, JosaUtil,
General,
ActionLogger,
getGeneralIntel,
getGeneralLeadership,getGeneralPower,getGeneralIntel,
getDomesticExpLevelBonus,
CriticalRatioDomestic, CriticalScore,
checkAbilityEx
@@ -14,10 +14,12 @@ use \sammo\{
use \sammo\Constraint\Constraint;
use function sammo\CriticalScore;
use function sammo\uniqueItemEx;
use function sammo\getGeneralLeadership;
class che_상업투자 extends BaseCommand{
static $cityKey = 'comm';
static $statKey = 'intel';
static $actionKey = '상업';
static $actionName = '상업 투자';
@@ -43,6 +45,28 @@ class che_상업투자 extends BaseCommand{
$this->reqGold = $reqGold;
}
protected function calcBaseScore():float{
if(static::$statKey == 'intel'){
$score = getGeneralIntel($general->getRaw(), true, true, true, false);
}
else if(static::$statKey == 'power'){
$score = getGeneralPower($general->getRaw(), true, true, true, false);
}
else if(static::$statKey == 'leader'){
$score = getGeneralLeadership($general->getRaw(), true, true, true, false);
}
else{
throw new \sammo\MustNotBeReachedException();
}
$score *= $trust / 100;
$score *= getDomesticExpLevelBonus($general['explevel']);
$score *= Util::randRange(0.8, 1.2);
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
return $score;
}
public function run():bool{
if(!$this->isAvailable()){
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
@@ -54,11 +78,7 @@ class che_상업투자 extends BaseCommand{
$trust = Util::valueFit($this->city['trust'], 50);
$score = getGeneralIntel($general->getRaw(), true, true, true, false);
$score *= $trust / 100;
$score *= getDomesticExpLevelBonus($general['explevel']);
$score *= Util::randRange(0.8, 1.2);
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
$score = $this->calcBaseScore();
['succ'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general->getRaw(), 2);
$successRatio = $naionTypeObj->onCalcDomestic(static::$cityKey, 'succ', $successRatio);
@@ -109,7 +129,7 @@ class che_상업투자 extends BaseCommand{
$general->increaseVarWithLimit('gold', -$this->reqGold, 0);
$general->increaseVar('experience', $exp);
$general->increaseVar('dedication', $ded);
$general->increaseVar('intel2', 1);
$general->increaseVar(static::$statKey.'2', 1);
$general->updateVar('resturn', 'SUCCESS');
$general->applyDB($db);
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace sammo\Command;
use \sammo\Util;
use \sammo\JosaUtil;
class che_성벽보수 extends che_상업투자{
static $cityKey = 'wall';
static $statKey = 'power';
static $actionKey = '성벽';
static $actionName = '성벽 보수';
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace sammo\Command;
use \sammo\Util;
use \sammo\JosaUtil;
class che_수비강화 extends che_상업투자{
static $cityKey = 'def';
static $statKey = 'power';
static $actionKey = '수비';
static $actionName = '수비 강화';
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace sammo\Command;
use \sammo\Util;
use \sammo\JosaUtil;
class che_치안강화 extends che_상업투자{
static $cityKey = 'secu';
static $statKey = 'power';
static $actionKey = '치안';
static $actionName = '치안 강화';
}