diff --git a/hwe/sammo/Command/General/che_강행.php b/hwe/sammo/Command/General/che_강행.php index 426b7a75..392698f0 100644 --- a/hwe/sammo/Command/General/che_강행.php +++ b/hwe/sammo/Command/General/che_강행.php @@ -13,6 +13,7 @@ use \sammo\LastTurn; use \sammo\Command; use function \sammo\printCitiesBasedOnDistance; +use function sammo\tryUniqueItemLottery; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; @@ -161,6 +162,8 @@ class che_강행 extends Command\GeneralCommand $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_거병.php b/hwe/sammo/Command/General/che_거병.php index 02c3262d..c2dafdca 100644 --- a/hwe/sammo/Command/General/che_거병.php +++ b/hwe/sammo/Command/General/che_거병.php @@ -3,7 +3,7 @@ namespace sammo\Command\General; use \sammo\{ DB, Util, JosaUtil, - General, + General, ActionLogger, GameConst, GameUnitConst, LastTurn, @@ -16,13 +16,12 @@ use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; use function sammo\refreshNationStaticInfo; use function sammo\getAllNationStaticInfo; - - +use function sammo\tryUniqueItemLottery; class che_거병 extends Command\GeneralCommand{ static protected $actionName = '거병'; - protected function argTest():bool{ + protected function argTest():bool{ $this->arg = []; return true; @@ -38,7 +37,7 @@ class che_거병 extends Command\GeneralCommand{ $this->setNation(); $relYear = $env['year'] - $env['startyear']; - + $this->fullConditionConstraints=[ ConstraintHelper::BeNeutral(), ConstraintHelper::BeOpeningPart($relYear+1), @@ -49,7 +48,7 @@ class che_거병 extends Command\GeneralCommand{ public function getCost():array{ return [0, 0]; } - + public function getPreReqTurn():int{ return 0; } @@ -93,15 +92,15 @@ class che_거병 extends Command\GeneralCommand{ DB::db()->insert('nation', [ 'name'=>$nationName, - 'color'=>'#330000', - 'gold'=>0, - 'rice'=>GameConst::$baserice, - 'rate'=>20, - 'bill'=>100, - 'strategic_cmd_limit'=>12, - 'surlimit'=>72, + 'color'=>'#330000', + 'gold'=>0, + 'rice'=>GameConst::$baserice, + 'rate'=>20, + 'bill'=>100, + 'strategic_cmd_limit'=>12, + 'surlimit'=>72, 'secretlimit'=>$secretlimit, - 'type'=>GameConst::$neutralNationType, + 'type'=>GameConst::$neutralNationType, 'gennum'=>1 ]); $nationID = DB::db()->insertId(); @@ -114,7 +113,7 @@ class che_거병 extends Command\GeneralCommand{ if($nationID == $destNationID){ continue; } - + $diplomacyInit[] = [ 'me'=>$destNationID, 'you'=>$nationID, @@ -132,9 +131,9 @@ class che_거병 extends Command\GeneralCommand{ if($diplomacyInit){ $db->insert('diplomacy', $diplomacyInit); } - - + + $turnRows = []; foreach([12, 11] as $chiefLevel){ foreach(Util::range(GameConst::$maxChiefTurn) as $turnIdx){ @@ -147,7 +146,7 @@ class che_거병 extends Command\GeneralCommand{ 'brief'=>'휴식', ]; } - + } $db->insert('nation_turn', $turnRows); @@ -172,10 +171,12 @@ class che_거병 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); return true; } - + } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_견문.php b/hwe/sammo/Command/General/che_견문.php index 480f955f..c7903fd5 100644 --- a/hwe/sammo/Command/General/che_견문.php +++ b/hwe/sammo/Command/General/che_견문.php @@ -3,7 +3,7 @@ namespace sammo\Command\General; use \sammo\{ DB, Util, JosaUtil, - General, + General, ActionLogger, GameConst, GameUnitConst, LastTurn, @@ -14,10 +14,11 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use \sammo\TextDecoration\SightseeingMessage; +use function sammo\tryUniqueItemLottery; class che_견문 extends Command\GeneralCommand{ static protected $actionName = '견문'; - + protected function argTest():bool{ $this->arg = null; return true; @@ -41,7 +42,7 @@ class che_견문 extends Command\GeneralCommand{ public function getCost():array{ return [0, 0]; } - + public function getPreReqTurn():int{ return 0; } @@ -111,10 +112,12 @@ class che_견문 extends Command\GeneralCommand{ $general->addExperience($exp); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); return true; } - + } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_군량매매.php b/hwe/sammo/Command/General/che_군량매매.php index 91e723cc..052d5b17 100644 --- a/hwe/sammo/Command/General/che_군량매매.php +++ b/hwe/sammo/Command/General/che_군량매매.php @@ -5,7 +5,7 @@ namespace sammo\Command\General; use \sammo\{ DB, Util, JosaUtil, - General, + General, ActionLogger, GameConst, GameUnitConst, LastTurn, @@ -16,6 +16,8 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\MustNotBeReachedException; +use function sammo\tryUniqueItemLottery; + class che_군량매매 extends Command\GeneralCommand{ static protected $actionName = '군량매매'; static public $reqArg = true; @@ -57,7 +59,7 @@ class che_군량매매 extends Command\GeneralCommand{ $general = $this->generalObj; $this->setCity(); - $this->setNation(); + $this->setNation(); $this->minConditionConstraints=[ ConstraintHelper::ReqCityTrader($general->getNPCType()), @@ -69,7 +71,7 @@ class che_군량매매 extends Command\GeneralCommand{ protected function initWithArg() { $general = $this->generalObj; - + $this->fullConditionConstraints=[ ConstraintHelper::ReqCityTrader($general->getNPCType()), ConstraintHelper::OccupiedCity(true), @@ -87,7 +89,7 @@ class che_군량매매 extends Command\GeneralCommand{ public function getCost():array{ return [0, 0]; } - + public function getPreReqTurn():int{ return 0; } @@ -120,7 +122,7 @@ class che_군량매매 extends Command\GeneralCommand{ else{ $tradeRate /= 100; } - + if($buyRice){ $buyKey = 'rice'; $sellKey = 'gold'; @@ -153,7 +155,7 @@ class che_군량매매 extends Command\GeneralCommand{ else{ $logger->pushGeneralActionLog("군량 {$sellAmountText}을 팔아 자금 {$buyAmountText}을 얻었습니다. <1>$date"); } - + $general->increaseVar($buyKey, $buyAmount); $general->increaseVarWithLimit($sellKey, -$sellAmount, 0); @@ -163,7 +165,7 @@ class che_군량매매 extends Command\GeneralCommand{ $exp = 30; $ded = 50; - + $incStat = Util::choiceRandomUsingWeight([ 'leadership_exp'=>$general->getLeadership(false, false, false, false), 'strength_exp'=>$general->getStrength(false, false, false, false), @@ -176,6 +178,8 @@ class che_군량매매 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); return true; @@ -199,5 +203,5 @@ class che_군량매매 extends Command\GeneralCommand{ return ob_get_clean(); } - + } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_귀환.php b/hwe/sammo/Command/General/che_귀환.php index b8c97942..7ca7c1f4 100644 --- a/hwe/sammo/Command/General/che_귀환.php +++ b/hwe/sammo/Command/General/che_귀환.php @@ -3,7 +3,7 @@ namespace sammo\Command\General; use \sammo\{ DB, Util, JosaUtil, - General, + General, ActionLogger, GameConst, GameUnitConst, LastTurn, @@ -14,7 +14,7 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; - +use function sammo\tryUniqueItemLottery; class che_귀환 extends Command\GeneralCommand{ static protected $actionName = '귀환'; @@ -33,7 +33,7 @@ class che_귀환 extends Command\GeneralCommand{ $this->setNation(); [$reqGold, $reqRice] = $this->getCost(); - + $this->fullConditionConstraints=[ ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotWanderingNation(), @@ -49,7 +49,7 @@ class che_귀환 extends Command\GeneralCommand{ public function getCost():array{ return [0, 0]; } - + public function getPreReqTurn():int{ return 0; } @@ -87,7 +87,7 @@ class che_귀환 extends Command\GeneralCommand{ $exp = 70; $ded = 100; - + $general->setVar('city', $destCityID); $general->addExperience($exp); @@ -95,10 +95,12 @@ class che_귀환 extends Command\GeneralCommand{ $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); return true; } - + } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_등용.php b/hwe/sammo/Command/General/che_등용.php index ec6b9949..72a4cc77 100644 --- a/hwe/sammo/Command/General/che_등용.php +++ b/hwe/sammo/Command/General/che_등용.php @@ -15,6 +15,7 @@ use \sammo\{ use function \sammo\getAllNationStaticInfo; use function \sammo\getNationStaticInfo; use function \sammo\newColor; +use function sammo\tryUniqueItemLottery; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; @@ -64,7 +65,7 @@ class che_등용 extends Command\GeneralCommand{ $this->minConditionConstraints=[ ConstraintHelper::ReqEnvValue('join_mode', '!=', 'onlyRandom', '랜덤 임관만 가능합니다'), - ConstraintHelper::NotBeNeutral(), + ConstraintHelper::NotBeNeutral(), ConstraintHelper::OccupiedCity(), ConstraintHelper::SuppliedCity(), ]; @@ -80,7 +81,7 @@ class che_등용 extends Command\GeneralCommand{ $this->fullConditionConstraints=[ ConstraintHelper::ReqEnvValue('join_mode', '!=', 'onlyRandom', '랜덤 임관만 가능합니다'), - ConstraintHelper::NotBeNeutral(), + ConstraintHelper::NotBeNeutral(), ConstraintHelper::OccupiedCity(), ConstraintHelper::SuppliedCity(), ConstraintHelper::ExistsDestGeneral(), @@ -110,7 +111,7 @@ class che_등용 extends Command\GeneralCommand{ ) * 10; return [$reqGold, 0]; } - + public function getPreReqTurn():int{ return 0; } @@ -141,7 +142,7 @@ class che_등용 extends Command\GeneralCommand{ $destGeneralName = $this->destGeneralObj->getName(); $destGeneralID = $this->destGeneralObj->getID(); - + $msg = ScoutMessage::buildScoutMessage($general->getID(), $destGeneralID, $reason, new \DateTime($general->getTurnTime())); if($msg){ @@ -164,6 +165,8 @@ class che_등용 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_물자조달.php b/hwe/sammo/Command/General/che_물자조달.php index 6123c5a1..ed63bc7b 100644 --- a/hwe/sammo/Command/General/che_물자조달.php +++ b/hwe/sammo/Command/General/che_물자조달.php @@ -3,7 +3,7 @@ namespace sammo\Command\General; use \sammo\{ DB, Util, JosaUtil, - General, + General, ActionLogger, GameConst, LastTurn, @@ -13,6 +13,7 @@ use \sammo\{ use function \sammo\getDomesticExpLevelBonus; use function \sammo\CriticalScoreEx; +use function sammo\tryUniqueItemLottery; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; @@ -33,9 +34,9 @@ class che_물자조달 extends Command\GeneralCommand{ $this->setCity(); $this->setNation(); - + $this->fullConditionConstraints=[ - ConstraintHelper::NotBeNeutral(), + ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotWanderingNation(), ConstraintHelper::OccupiedCity(), ConstraintHelper::SuppliedCity() @@ -50,7 +51,7 @@ class che_물자조달 extends Command\GeneralCommand{ public function getCost():array{ return [0, 0]; } - + public function getPreReqTurn():int{ return 0; } @@ -84,11 +85,11 @@ class che_물자조달 extends Command\GeneralCommand{ 'normal'=>0.6 ]); $score *= CriticalScoreEx($pick); - + $score = Util::round($score); $scoreText = number_format($score, 0); - + $logger = $general->getLogger(); if($pick == 'fail'){ @@ -120,10 +121,12 @@ class che_물자조달 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); return true; } - + } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_이동.php b/hwe/sammo/Command/General/che_이동.php index 34fed929..db4fc213 100644 --- a/hwe/sammo/Command/General/che_이동.php +++ b/hwe/sammo/Command/General/che_이동.php @@ -13,6 +13,7 @@ use \sammo\LastTurn; use \sammo\Command; use function \sammo\printCitiesBasedOnDistance; +use function sammo\tryUniqueItemLottery; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; @@ -169,6 +170,8 @@ class che_이동 extends Command\GeneralCommand $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_장비매매.php b/hwe/sammo/Command/General/che_장비매매.php index 29879470..9904a40a 100644 --- a/hwe/sammo/Command/General/che_장비매매.php +++ b/hwe/sammo/Command/General/che_장비매매.php @@ -5,7 +5,7 @@ namespace sammo\Command\General; use \sammo\{ DB, Util, JosaUtil, - General, + General, ActionLogger, GameConst, GameUnitConst, LastTurn, @@ -13,6 +13,7 @@ use \sammo\{ }; use function \sammo\buildItemClass; +use function sammo\tryUniqueItemLottery; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; @@ -97,14 +98,14 @@ class che_장비매매 extends Command\GeneralCommand{ if(!$this->isArgValid){ return [0, 0]; } - + $itemCode = $this->arg['itemCode']; $itemObj = buildItemClass($itemCode); $reqGold = $itemObj->getCost(); return [$reqGold, 0]; } - + public function getPreReqTurn():int{ return 0; } @@ -176,6 +177,7 @@ class che_장비매매 extends Command\GeneralCommand{ $general->addExperience($exp); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + tryUniqueItemLottery($general); $general->applyDB($db); return true; @@ -208,7 +210,7 @@ $('#customSubmit').click(function(){ 현재 구입 불가능한 것은 붉은색으로 표시됩니다.
현재 도시 치안 :    현재 자금 :
장비 :