game: 훈련, 사기진작 시 병력이 낮을 때도 숙련 상승량 조정

This commit is contained in:
2024-07-10 17:00:35 +00:00
parent e395c98a6c
commit 5268ce9b71
2 changed files with 67 additions and 41 deletions
+32 -19
View File
@@ -1,11 +1,15 @@
<?php <?php
namespace sammo\Command\General; namespace sammo\Command\General;
use \sammo\{ use \sammo\{
DB, Util, JosaUtil, DB,
Util,
JosaUtil,
General, General,
ActionLogger, ActionLogger,
GameConst, GameUnitConst, GameConst,
GameUnitConst,
LastTurn, LastTurn,
Command Command
}; };
@@ -16,15 +20,18 @@ use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper; use \sammo\Constraint\ConstraintHelper;
class che_사기진작 extends Command\GeneralCommand{ class che_사기진작 extends Command\GeneralCommand
{
static protected $actionName = '사기진작'; static protected $actionName = '사기진작';
protected function argTest():bool{ protected function argTest(): bool
{
$this->arg = null; $this->arg = null;
return true; return true;
} }
protected function init(){ protected function init()
{
$general = $this->generalObj; $general = $this->generalObj;
@@ -33,13 +40,13 @@ class che_사기진작 extends Command\GeneralCommand{
[$reqGold, $reqRice] = $this->getCost(); [$reqGold, $reqRice] = $this->getCost();
$this->minConditionConstraints=[ $this->minConditionConstraints = [
ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotBeNeutral(),
ConstraintHelper::NotWanderingNation(), ConstraintHelper::NotWanderingNation(),
ConstraintHelper::OccupiedCity(), ConstraintHelper::OccupiedCity(),
]; ];
$this->fullConditionConstraints=[ $this->fullConditionConstraints = [
ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotBeNeutral(),
ConstraintHelper::NotWanderingNation(), ConstraintHelper::NotWanderingNation(),
ConstraintHelper::OccupiedCity(), ConstraintHelper::OccupiedCity(),
@@ -48,31 +55,35 @@ class che_사기진작 extends Command\GeneralCommand{
ConstraintHelper::ReqGeneralRice($reqRice), ConstraintHelper::ReqGeneralRice($reqRice),
ConstraintHelper::ReqGeneralAtmosMargin(GameConst::$maxAtmosByCommand), ConstraintHelper::ReqGeneralAtmosMargin(GameConst::$maxAtmosByCommand),
]; ];
} }
public function getCommandDetailTitle():string{ public function getCommandDetailTitle(): string
{
$name = $this->getName(); $name = $this->getName();
//[$reqGold, $reqRice] = $this->getCost(); //[$reqGold, $reqRice] = $this->getCost();
return "{$name}(통솔경험, 자금↓)"; return "{$name}(통솔경험, 자금↓)";
} }
public function getCost():array{ public function getCost(): array
{
$general = $this->generalObj; $general = $this->generalObj;
return [Util::round($general->getVar('crew')/100), 0]; return [Util::round($general->getVar('crew') / 100), 0];
} }
public function getPreReqTurn():int{ public function getPreReqTurn(): int
{
return 0; return 0;
} }
public function getPostReqTurn():int{ public function getPostReqTurn(): int
{
return 0; return 0;
} }
public function run(\Sammo\RandUtil $rng):bool{ public function run(\Sammo\RandUtil $rng): bool
if(!$this->hasFullConditionMet()){ {
if (!$this->hasFullConditionMet()) {
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
} }
@@ -81,7 +92,11 @@ class che_사기진작 extends Command\GeneralCommand{
$general = $this->generalObj; $general = $this->generalObj;
$date = $general->getTurnTime($general::TURNTIME_HM); $date = $general->getTurnTime($general::TURNTIME_HM);
$score = Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$atmosDelta); $score = Util::clamp(
Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$atmosDelta),
0,
Util::clamp(GameConst::$maxAtmosByCommand - $general->getVar('atmos'), 0),
);
$scoreText = number_format($score, 0); $scoreText = number_format($score, 0);
$sideEffect = Util::valueFit(intval($general->getVar('train') * GameConst::$trainSideEffectByAtmosTurn), 0); $sideEffect = Util::valueFit(intval($general->getVar('train') * GameConst::$trainSideEffectByAtmosTurn), 0);
@@ -93,7 +108,7 @@ class che_사기진작 extends Command\GeneralCommand{
$exp = 100; $exp = 100;
$ded = 70; $ded = 70;
$general->increaseVarWithLimit('atmos', $score, 0, GameConst::$maxAtmosByCommand); $general->increaseVar('atmos', $score);
$general->setVar('train', $sideEffect); $general->setVar('train', $sideEffect);
$general->addDex($general->getCrewTypeObj(), $score, false); $general->addDex($general->getCrewTypeObj(), $score, false);
@@ -111,6 +126,4 @@ class che_사기진작 extends Command\GeneralCommand{
return true; return true;
} }
} }
+33 -20
View File
@@ -1,11 +1,15 @@
<?php <?php
namespace sammo\Command\General; namespace sammo\Command\General;
use \sammo\{ use \sammo\{
DB, Util, JosaUtil, DB,
Util,
JosaUtil,
General, General,
ActionLogger, ActionLogger,
GameConst, GameUnitConst, GameConst,
GameUnitConst,
LastTurn, LastTurn,
Command Command
}; };
@@ -17,66 +21,73 @@ use \sammo\Constraint\ConstraintHelper;
class che_훈련 extends Command\GeneralCommand{ class che_훈련 extends Command\GeneralCommand
{
static protected $actionName = '훈련'; static protected $actionName = '훈련';
protected function argTest():bool{ protected function argTest(): bool
{
$this->arg = null; $this->arg = null;
return true; return true;
} }
protected function init(){ protected function init()
{
$general = $this->generalObj; $general = $this->generalObj;
$this->setCity(); $this->setCity();
$this->setNation(); $this->setNation();
$this->minConditionConstraints=[ $this->minConditionConstraints = [
ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotBeNeutral(),
ConstraintHelper::NotWanderingNation(), ConstraintHelper::NotWanderingNation(),
ConstraintHelper::OccupiedCity(), ConstraintHelper::OccupiedCity(),
]; ];
$this->fullConditionConstraints=[ $this->fullConditionConstraints = [
ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotBeNeutral(),
ConstraintHelper::NotWanderingNation(), ConstraintHelper::NotWanderingNation(),
ConstraintHelper::OccupiedCity(), ConstraintHelper::OccupiedCity(),
ConstraintHelper::ReqGeneralCrew(), ConstraintHelper::ReqGeneralCrew(),
ConstraintHelper::ReqGeneralTrainMargin(GameConst::$maxTrainByCommand), ConstraintHelper::ReqGeneralTrainMargin(GameConst::$maxTrainByCommand),
]; ];
} }
public function getCommandDetailTitle():string{ public function getCommandDetailTitle(): string
{
$name = $this->getName(); $name = $this->getName();
[$reqGold, $reqRice] = $this->getCost(); [$reqGold, $reqRice] = $this->getCost();
$title = "{$name}(통솔경험"; $title = "{$name}(통솔경험";
if($reqGold > 0){ if ($reqGold > 0) {
$title .= ", 자금{$reqGold}"; $title .= ", 자금{$reqGold}";
} }
if($reqRice > 0){ if ($reqRice > 0) {
$title .= ", 군량{$reqRice}"; $title .= ", 군량{$reqRice}";
} }
$title .= ')'; $title .= ')';
return $title; return $title;
} }
public function getCost():array{ public function getCost(): array
{
return [0, 0]; return [0, 0];
} }
public function getPreReqTurn():int{ public function getPreReqTurn(): int
{
return 0; return 0;
} }
public function getPostReqTurn():int{ public function getPostReqTurn(): int
{
return 0; return 0;
} }
public function run(\Sammo\RandUtil $rng):bool{ public function run(\Sammo\RandUtil $rng): bool
if(!$this->hasFullConditionMet()){ {
if (!$this->hasFullConditionMet()) {
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
} }
@@ -85,7 +96,11 @@ class che_훈련 extends Command\GeneralCommand{
$general = $this->generalObj; $general = $this->generalObj;
$date = $general->getTurnTime($general::TURNTIME_HM); $date = $general->getTurnTime($general::TURNTIME_HM);
$score = Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$trainDelta); $score = Util::clamp(
Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$trainDelta),
0,
Util::clamp(GameConst::$maxTrainByCommand - $general->getVar('train'), 0)
);
$scoreText = number_format($score, 0); $scoreText = number_format($score, 0);
$sideEffect = Util::valueFit(intval($general->getVar('atmos') * GameConst::$atmosSideEffectByTraining), 0); $sideEffect = Util::valueFit(intval($general->getVar('atmos') * GameConst::$atmosSideEffectByTraining), 0);
@@ -97,7 +112,7 @@ class che_훈련 extends Command\GeneralCommand{
$exp = 100; $exp = 100;
$ded = 70; $ded = 70;
$general->increaseVarWithLimit('train', $score, 0, GameConst::$maxTrainByCommand); $general->increaseVar('train', $score);
$general->setVar('atmos', $sideEffect); $general->setVar('atmos', $sideEffect);
$general->addDex($general->getCrewTypeObj(), $score, false); $general->addDex($general->getCrewTypeObj(), $score, false);
@@ -112,6 +127,4 @@ class che_훈련 extends Command\GeneralCommand{
return true; return true;
} }
} }