diff --git a/hwe/func_process.php b/hwe/func_process.php
index 6a2ecd68..af2eeb69 100644
--- a/hwe/func_process.php
+++ b/hwe/func_process.php
@@ -186,18 +186,6 @@ function setLeadershipBonus(&$general, $nationLevel){
return $lbonus;
}
-function CriticalScore($score, $type) {
- switch($type) {
- case 0:
- $ratio = Util::randF()*0.8 + 2.2; // 2.2~3.0
- break;
- case 1:
- $ratio = Util::randF()*0.2 + 0.2; // 0.2~0.4
- break;
- }
- return Util::round($score * $ratio);
-}
-
function CriticalScoreEx(string $type):float {
if($type == 'success'){
return Util::randRange(2.2, 3.0);
diff --git a/hwe/sammo/Command/General/che_NPC능동.php b/hwe/sammo/Command/General/che_NPC능동.php
index 58e7bc12..d02dd8dc 100644
--- a/hwe/sammo/Command/General/che_NPC능동.php
+++ b/hwe/sammo/Command/General/che_NPC능동.php
@@ -6,14 +6,11 @@ use \sammo\{
General,
CityConst,
ActionLogger,
- LastTurn
+ LastTurn,
+ Command
};
-use \sammo\Command;
use \sammo\Constraint\Constraint;
-use function sammo\CriticalScore;
-use function sammo\uniqueItemEx;
-use function sammo\getGeneralLeadership;
class che_NPC능동 extends Command\GeneralCommand{
diff --git a/hwe/sammo/Command/General/che_기술연구.php b/hwe/sammo/Command/General/che_기술연구.php
index bd8960b5..cfad970d 100644
--- a/hwe/sammo/Command/General/che_기술연구.php
+++ b/hwe/sammo/Command/General/che_기술연구.php
@@ -5,18 +5,19 @@ use \sammo\{
DB, Util, JosaUtil,
General,
ActionLogger,
- getGeneralLeadership,getGeneralPower,getGeneralIntel,
+ LastTurn,
+ Command
+};
+
+use function sammo\{
+ TechLimit,
getDomesticExpLevelBonus,
- CriticalRatioDomestic, CriticalScore, TechLimit,
- uniqueItemEx,
- LastTurn
+ CriticalRatioDomestic,
+ CriticalScoreEx,
+ uniqueItemEx
};
-use \sammo\Command;
use \sammo\Constraint\Constraint;
-use function sammo\CriticalScore;
-use function sammo\uniqueItemEx;
-use function sammo\getGeneralLeadership;
class che_기술연구 extends che_상업투자{
diff --git a/hwe/sammo/Command/General/che_농지개간.php b/hwe/sammo/Command/General/che_농지개간.php
index 6821fa52..401f36de 100644
--- a/hwe/sammo/Command/General/che_농지개간.php
+++ b/hwe/sammo/Command/General/che_농지개간.php
@@ -1,9 +1,6 @@
generalObj;
+
+ $this->setCity();
+ $this->setNation();
+
+ $this->runnableConstraints=[
+ ['NoNeutral'],
+ ['NoWanderingNation'],
+ ['OccupiedCity'],
+ ['SuppliedCity']
+ ];
+
+ }
+
+ protected function argTest():bool{
+ $this->arg = null;
+ return true;
+ }
+
+ public function getCost():array{
+ return [0, 0];
+ }
+
+ public function getPreReqTurn():int{
+ return 0;
+ }
+
+ public function getPostReqTurn():int{
+ return 0;
+ }
+
+ public function run():bool{
+ if(!$this->isRunnable()){
+ throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
+ }
+
+ $db = DB::db();
+
+ $general = $this->generalObj;
+ $date = substr($general->getVar('turntime'),11,5);
+
+ [$resName, $resKey] = Util::choiceRandom([
+ ['금', 'gold'],
+ ['쌀', 'rice']
+ ]);
+
+ $score = $general->getLeadership() + $general->getPower() + $general->getIntel();
+ $score *= getDomesticExpLevelBonus($general->getVar('explevel'));
+ $score *= Util::randRange(0.8, 1.2);
+
+ $pick = Util::choiceRandomUsingWeight([
+ 'fail'=>0.3,
+ 'success'=>0.1,
+ 'normal'=>0.6
+ ]);
+ $score *= CriticalScoreEx($pick);
+
+
+ $score = Util::round($score);
+ $scoreText = number_format($score, 0);
+
+ $logger = $general->getLogger();
+
+ if($pick == 'fail'){
+ $logger->pushGeneralActionLog("조달을 실패하여 {$resName}을 $scoreText> 조달했습니다. <1>$date>");
+ }
+ else if($pick == 'success'){
+ $logger->pushGeneralActionLog("조달을 성공>하여 {$resName}을 $scoreText> 조달했습니다. <1>$date>");
+ }
+ else{
+ $logger->pushGeneralActionLog("{$resName}을 $scoreText> 조달했습니다. <1>$date>");
+ }
+
+ $exp = $score * 0.7 / 3;
+ $ded = $score * 1.0 / 3;
+
+ $exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp);
+ $ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded);
+
+ $incStat = Util::choiceRandomUsingWeight([
+ 'leader2'=>$general->getLeadership(false, false, false, false),
+ 'power2'=>$general->getPower(false, false, false, false),
+ 'intel2'=>$general->getIntel(false, false, false, false)
+ ]);
+
+ $general->increaseVar('experience', $exp);
+ $general->increaseVar('dedication', $ded);
+ $general->increaseVar($incStat, 1);
+
+ $db->update('nation', [
+ $resKey=>$db->sqleval('%b + %i', $resKey, $score)
+ ], 'nation=%i',$general->getNationID());
+
+ $general->setResultTurn(new LastTurn(static::getName(), $this->arg));
+ $general->applyDB($db);
+
+ $this->checkStatChange();
+ }
+
+
+}
\ No newline at end of file
diff --git a/hwe/sammo/Command/General/che_사기진작.php b/hwe/sammo/Command/General/che_사기진작.php
index 05af08b7..9005d305 100644
--- a/hwe/sammo/Command/General/che_사기진작.php
+++ b/hwe/sammo/Command/General/che_사기진작.php
@@ -5,20 +5,17 @@ use \sammo\{
DB, Util, JosaUtil,
General,
ActionLogger,
- GameConst,
- getGeneralLeadership,getGeneralPower,getGeneralIntel,
- getDomesticExpLevelBonus,
- CriticalRatioDomestic, CriticalScore,
- uniqueItemEx,
- LastTurn
+ GameConst, GameUnitConst,
+ LastTurn,
+ Command
+};
+
+
+use function \sammo\{
+ uniqueItemEx
};
-use \sammo\Command;
use \sammo\Constraint\Constraint;
-use function sammo\CriticalScore;
-use function sammo\uniqueItemEx;
-use function sammo\getGeneralLeadership;
-use sammo\GameUnitConst;
class che_사기진작 extends Command\GeneralCommand{
diff --git a/hwe/sammo/Command/General/che_상업투자.php b/hwe/sammo/Command/General/che_상업투자.php
index a9c19fee..b749dd60 100644
--- a/hwe/sammo/Command/General/che_상업투자.php
+++ b/hwe/sammo/Command/General/che_상업투자.php
@@ -5,18 +5,20 @@ use \sammo\{
DB, Util, JosaUtil,
General,
ActionLogger,
- getGeneralLeadership,getGeneralPower,getGeneralIntel,
+ GameConst,
+ LastTurn,
+ GameUnitConst,
+ Command
+};
+
+use function \sammo\{
getDomesticExpLevelBonus,
- CriticalRatioDomestic, CriticalScore,
- uniqueItemEx,
- LastTurn
+ CriticalRatioDomestic,
+ CriticalScoreEx,
+ uniqueItemEx
};
-use \sammo\Command;
use \sammo\Constraint\Constraint;
-use function sammo\CriticalScore;
-use function sammo\uniqueItemEx;
-use function sammo\getGeneralLeadership;
class che_상업투자 extends Command\GeneralCommand{
@@ -74,20 +76,20 @@ class che_상업투자 extends Command\GeneralCommand{
$general = $this->generalObj;
if(static::$statKey == 'intel'){
- $score = getGeneralIntel($general->getRaw(), true, true, true, false);
+ $score = $general->getIntel(true, true, true, false);
}
else if(static::$statKey == 'power'){
- $score = getGeneralPower($general->getRaw(), true, true, true, false);
+ $score = $general->getPower(true, true, true, false);
}
else if(static::$statKey == 'leader'){
- $score = getGeneralLeadership($general->getRaw(), true, true, true, false);
+ $score = $general->getLeadership(true, true, true, false);
}
else{
throw new \sammo\MustNotBeReachedException();
}
$score *= $trust / 100;
- $score *= getDomesticExpLevelBonus($general['explevel']);
+ $score *= getDomesticExpLevelBonus($general->getVar('explevel'));
$score *= Util::randRange(0.8, 1.2);
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
diff --git a/hwe/sammo/Command/General/che_성벽보수.php b/hwe/sammo/Command/General/che_성벽보수.php
index 5c14165d..74e6ef10 100644
--- a/hwe/sammo/Command/General/che_성벽보수.php
+++ b/hwe/sammo/Command/General/che_성벽보수.php
@@ -1,9 +1,6 @@
generalObj;
if(static::$statKey == 'leader'){
- $score = getGeneralLeadership($general->getRaw(), true, true, true, false);
+ $score = $general->getLeadership(true, true, true, false);
}
else{
throw new \sammo\MustNotBeReachedException();
}
- $score *= getDomesticExpLevelBonus($general['explevel']);
+ $score *= getDomesticExpLevelBonus($general->getVar('explevel'));
$score *= Util::randRange(0.8, 1.2);
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
diff --git a/hwe/sammo/Command/General/che_주민선정.php b/hwe/sammo/Command/General/che_주민선정.php
index bd833475..f2fd60f6 100644
--- a/hwe/sammo/Command/General/che_주민선정.php
+++ b/hwe/sammo/Command/General/che_주민선정.php
@@ -5,18 +5,20 @@ use \sammo\{
DB, Util, JosaUtil,
General,
ActionLogger,
- getGeneralLeadership,getGeneralPower,getGeneralIntel,
+ GameConst,
+ LastTurn,
+ GameUnitConst,
+ Command
+};
+
+use function \sammo\{
getDomesticExpLevelBonus,
- CriticalRatioDomestic, CriticalScore,
- uniqueItemEx,
- LastTurn
+ CriticalRatioDomestic,
+ CriticalScoreEx,
+ uniqueItemEx
};
-use \sammo\Command;
use \sammo\Constraint\Constraint;
-use function sammo\CriticalScore;
-use function sammo\uniqueItemEx;
-use function sammo\getGeneralLeadership;
class che_주민선정 extends Command\GeneralCommand{
@@ -72,13 +74,13 @@ class che_주민선정 extends Command\GeneralCommand{
$general = $this->generalObj;
if(static::$statKey == 'leader'){
- $score = getGeneralLeadership($general->getRaw(), true, true, true, false);
+ $score = $general->getLeadership(true, true, true, false);
}
else{
throw new \sammo\MustNotBeReachedException();
}
- $score *= getDomesticExpLevelBonus($general['explevel']);
+ $score *= getDomesticExpLevelBonus($general->getVar('explevel'));
$score *= Util::randRange(0.8, 1.2);
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
$score = Util::valutFit($score, 1);
diff --git a/hwe/sammo/Command/General/che_치안강화.php b/hwe/sammo/Command/General/che_치안강화.php
index 1a5567d3..a5de71ad 100644
--- a/hwe/sammo/Command/General/che_치안강화.php
+++ b/hwe/sammo/Command/General/che_치안강화.php
@@ -1,9 +1,6 @@