diff --git a/hwe/sammo/Command/che_기술연구.php b/hwe/sammo/Command/che_기술연구.php
new file mode 100644
index 00000000..e134cabb
--- /dev/null
+++ b/hwe/sammo/Command/che_기술연구.php
@@ -0,0 +1,145 @@
+generalObj;
+
+ $this->setCity();
+ $this->setNation();
+
+ $develCost = $this->env['develcost'];
+ $reqGold = $general->onCalcDomestic(static::$actionKey, 'cost', $reqGold);
+
+ $this->constraints=[
+ ['NoNeutral'],
+ ['NoWanderingNation'],
+ ['OccupiedCity'],
+ ['SuppliedCity'],
+ ['ReqGeneralGold', $reqGold]
+ ];
+
+ $this->reqGold = $reqGold;
+ }
+
+ protected function calcBaseScore():float{
+ $general = $this->generalObj;
+
+ if(static::$statKey == 'intel'){
+ $score = getGeneralIntel($general->getRaw(), true, true, true, false);
+ }
+ else{
+ throw new \sammo\MustNotBeReachedException();
+ }
+
+ $trust = Util::valueFit($this->city['trust'], 50);
+ $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('불가능한 커맨드를 강제로 실행 시도');
+ }
+
+ $db = DB::db();
+
+ $general = $this->generalObj;
+
+ $trust = Util::valueFit($this->city['trust'], 50);
+
+ $score = Util::valueFit($this->calcBaseScore(), 1);
+
+ ['succ'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general->getRaw(), static::$statKey);
+ if($trust < 80){
+ $successRatio *= $trust / 80;
+ }
+ $successRatio = $general->onCalcDomestic(static::$cityKey, 'succ', $successRatio);
+ $failRatio = $general->onCalcDomestic(static::$cityKey, 'fail', $failRatio);
+
+ $successRatio = Util::valueFit($successRatio, 0, 1);
+ $failRatio = Util::valueFit($failRatio, 0, 1 - $successRatio);
+ $normalRatio = 1 - $failRatio - $successRatio;
+
+ $pick = Util::choiceRandomUsingWeight([
+ 'fail'=>$failRatio,
+ 'succ'=>$successRatio,
+ 'normal'=>$normalRatio
+ ]);
+
+ $logger = $general->getLogger();
+
+ $date = substr($general->getVar('turntime'),11,5);
+
+ $josaUl = JosaUtil::pick(static::$actionName, '을');
+ if($pick == 'fail'){
+ $score = CriticalScore($score, 1);
+ $logger->pushGeneralActionLog(static::$actionName."{$josaUl} 실패하여 $score> 상승했습니다. <1>$date>");
+ }
+ else if($pick == 'succ'){
+ $score = CriticalScore($score, 1);
+ $logger->pushGeneralActionLog(static::$actionName."{$josaUl} 성공>하여 $score> 상승했습니다. <1>$date>");
+ }
+ else{
+ $score = Util::round($score);
+ $logger->pushGeneralActionLog(static::$actionName."{$josaUl} 하여 $score> 상승했습니다. <1>$date>");
+ }
+
+ $exp = $score * 0.7;
+ $ded = $score * 1.0;
+
+ $exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp);
+ $ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded);
+
+ if(TechLimit($this->env['startyear'], $this->env['year'], $this->nation['tech'])){
+ $score /= 4;
+ }
+
+ $genCount = Util::valueFit(
+ $db->queryFirstField('SELECT count(*) FROM general WHERE nation=%i', $general->getVar('nation')),
+ GameConst::$initialNationGenLimit
+ );
+
+ $nationUpdated = [
+ 'tech' => $this->nation['tech'] + $score/$genCount
+ ];
+ $db->update('nation', $nationUpdated, 'nation=%i', $general->getVar('nation'));
+
+ $general->increaseVarWithLimit('gold', -$this->reqGold, 0);
+ $general->increaseVar('experience', $exp);
+ $general->increaseVar('dedication', $ded);
+ $general->increaseVar(static::$statKey.'2', 1);
+ $general->updateVar('resturn', 'SUCCESS');
+ $general->applyDB($db);
+
+ $this->checkStatChange();
+ uniqueItemEx($general->getVar('no'), $logger);
+ }
+
+
+}
\ No newline at end of file
diff --git a/hwe/sammo/Command/che_상업투자.php b/hwe/sammo/Command/che_상업투자.php
index 3adcdee9..34b2a252 100644
--- a/hwe/sammo/Command/che_상업투자.php
+++ b/hwe/sammo/Command/che_상업투자.php
@@ -8,7 +8,7 @@ use \sammo\{
getGeneralLeadership,getGeneralPower,getGeneralIntel,
getDomesticExpLevelBonus,
CriticalRatioDomestic, CriticalScore,
- checkAbilityEx
+ uniqueItemEx
};
use \sammo\Constraint\Constraint;
@@ -46,6 +46,7 @@ class che_상업투자 extends BaseCommand{
}
protected function calcBaseScore():float{
+ $trust = Util::valueFit($this->city['trust'], 50);
$general = $this->generalObj;
if(static::$statKey == 'intel'){
@@ -80,9 +81,12 @@ class che_상업투자 extends BaseCommand{
$trust = Util::valueFit($this->city['trust'], 50);
- $score = $this->calcBaseScore();
+ $score = Util::valueFit($this->calcBaseScore(), 1);
['succ'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general->getRaw(), static::$statKey);
+ if($trust < 80){
+ $successRatio *= $trust / 80;
+ }
$successRatio = $general->onCalcDomestic(static::$cityKey, 'succ', $successRatio);
$failRatio = $general->onCalcDomestic(static::$cityKey, 'fail', $failRatio);
@@ -128,6 +132,7 @@ class che_상업투자 extends BaseCommand{
$this->city[static::$cityKey.'2']
)
];
+ $db->update('city', $cityUpdated, 'city=%i', $general->getVar('city'));
$general->increaseVarWithLimit('gold', -$this->reqGold, 0);
$general->increaseVar('experience', $exp);