balance: 유니크 아이템을 얻을 수 있는 커맨드 증가

- 강행, 거병, 견문, 군량매매, 귀환, 등용, 물자조달, 이동, 장비매매, 증여, 헌납
This commit is contained in:
2021-09-15 19:06:15 +00:00
committed by Gitea
parent 08f4a2e8bf
commit 1dc67317dc
11 changed files with 82 additions and 52 deletions
+3
View File
@@ -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;
+20 -19
View File
@@ -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;
}
}
+7 -4
View File
@@ -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;
}
}
+12 -8
View File
@@ -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("군량 <C>{$sellAmountText}</>을 팔아 자금 <C>{$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();
}
}
+8 -6
View File
@@ -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;
}
}
+7 -4
View File
@@ -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;
+10 -7
View File
@@ -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;
}
}
+3
View File
@@ -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;
@@ -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(){
현재 구입 불가능한 것은 <font color=red>붉은색</font>으로 표시됩니다.<br>
현재 도시 치안 : <?=$citySecu?> &nbsp;&nbsp;&nbsp;현재 자금 : <?=$gold?><br>
장비 : <select class='formInput' name="itemCode" id="itemCode" onchange='updateItemType();' size='1' style='color:white;background-color:black;'>
<?php foreach(GameConst::$allItems as $itemType=>$itemCategories):
<?php foreach(GameConst::$allItems as $itemType=>$itemCategories):
//매각
$typeName = static::$itemMap[$itemType];
?>
+3
View File
@@ -16,6 +16,7 @@ use \sammo\Command;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use function sammo\tryUniqueItemLottery;
class che_증여 extends Command\GeneralCommand
{
@@ -168,6 +169,8 @@ class che_증여 extends Command\GeneralCommand
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
tryUniqueItemLottery($general);
$general->applyDB($db);
$destGeneral->applyDB($db);
+3
View File
@@ -15,6 +15,7 @@ use \sammo\Command;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use function sammo\tryUniqueItemLottery;
class che_헌납 extends Command\GeneralCommand
{
@@ -144,6 +145,8 @@ class che_헌납 extends Command\GeneralCommand
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
tryUniqueItemLottery($general);
$general->applyDB($db);
return true;