feat: 요술, 빠진 부분 채우기
This commit is contained in:
@@ -27,13 +27,15 @@ class GetUserActionCommandTable extends \sammo\BaseAPI
|
|||||||
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||||
{
|
{
|
||||||
$generalID = $session->generalID;
|
$generalID = $session->generalID;
|
||||||
$general = General::createObjFromDB($generalID);
|
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$gameStor->turnOnCache();
|
$gameStor->turnOnCache();
|
||||||
$env = $gameStor->getAll();
|
$env = $gameStor->getAll();
|
||||||
|
|
||||||
|
|
||||||
|
$general = General::createObjFromDB($generalID);
|
||||||
|
|
||||||
$commandTable = [];
|
$commandTable = [];
|
||||||
foreach (GameConst::$availableUserActionCommand as $commandCategory => $commandList) {
|
foreach (GameConst::$availableUserActionCommand as $commandCategory => $commandList) {
|
||||||
$subList = [];
|
$subList = [];
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\ActionBuff;
|
||||||
|
|
||||||
|
use sammo\General;
|
||||||
|
use \sammo\iAction;
|
||||||
|
|
||||||
|
class g65_내정성공 implements iAction
|
||||||
|
{
|
||||||
|
use \sammo\DefaultAction;
|
||||||
|
|
||||||
|
function onCalcDomestic(string $turnType, string $varType, float $value, $aux = null): float
|
||||||
|
{
|
||||||
|
if($turnType == '계략'){
|
||||||
|
if($varType == 'success') return $value + 1;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ class g65_내정성공 implements iAction
|
|||||||
function onCalcDomestic(string $turnType, string $varType, float $value, $aux = null): float
|
function onCalcDomestic(string $turnType, string $varType, float $value, $aux = null): float
|
||||||
{
|
{
|
||||||
if ($varType == 'success' && in_array($turnType, static::$target)) {
|
if ($varType == 'success' && in_array($turnType, static::$target)) {
|
||||||
return 1;
|
return $value + 1;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\UserAction;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
|
class g65_군량급매 extends Command\UserActionCommand{
|
||||||
|
static protected $actionName = '군량급매';
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBrief(): string
|
||||||
|
{
|
||||||
|
return '군량 급매';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCommandDetailTitle(): string
|
||||||
|
{
|
||||||
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
return "금/쌀 동등화(재사용 대기 {$postReqTurn})";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
//아무것도 하지 않음
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
$general = $this->generalObj;
|
||||||
|
|
||||||
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
|
$gold = $general->getVar('gold');
|
||||||
|
$rice = $general->getVar('rice');
|
||||||
|
|
||||||
|
$avg = Util::toInt(($gold + $rice + 1) / 2);
|
||||||
|
$general->setVar('gold', $avg);
|
||||||
|
$general->setVar('rice', $avg);
|
||||||
|
|
||||||
|
$logger = $this->generalObj->getLogger();
|
||||||
|
$logger->pushGeneralActionLog("지나가는 상인과 금과 쌀을 거래합니다. <1>$date</>");
|
||||||
|
$general->applyDB(DB::db());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,9 @@ class g65_병장기지원 extends Command\UserActionCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function init(){
|
protected function init(){
|
||||||
|
$this->setCity();
|
||||||
|
$this->setNation();
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::NotBeNeutral(),
|
ConstraintHelper::NotBeNeutral(),
|
||||||
ConstraintHelper::OccupiedCity()
|
ConstraintHelper::OccupiedCity()
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\UserAction;
|
||||||
|
|
||||||
|
use sammo\ActionBuff\g65_내정성공;
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
|
||||||
|
class g65_요술 extends Command\UserActionCommand{
|
||||||
|
static protected $actionName = '요술';
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBrief(): string
|
||||||
|
{
|
||||||
|
return '요술';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCommandDetailTitle(): string
|
||||||
|
{
|
||||||
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
return "이번 턴의 계략 항상 성공(재사용 대기 {$postReqTurn})";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setCity();
|
||||||
|
$this->setNation();
|
||||||
|
|
||||||
|
$this->fullConditionConstraints = [
|
||||||
|
ConstraintHelper::NotBeNeutral(),
|
||||||
|
ConstraintHelper::OccupiedCity()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if (!$this->hasFullConditionMet()) {
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$general->addInstantBuff(new g65_내정성공(), 2);
|
||||||
|
|
||||||
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
$logger->pushGeneralActionLog("이번 턴의 계략을 집중합니다. <1>$date</>");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,9 @@ class g65_입대독려 extends Command\UserActionCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function init(){
|
protected function init(){
|
||||||
|
$this->setCity();
|
||||||
|
$this->setNation();
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::NotBeNeutral(),
|
ConstraintHelper::NotBeNeutral(),
|
||||||
ConstraintHelper::OccupiedCity()
|
ConstraintHelper::OccupiedCity()
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ class g65_접경귀환 extends Command\UserActionCommand
|
|||||||
|
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
|
$this->setCity();
|
||||||
|
$this->setNation();
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::NotBeNeutral(),
|
ConstraintHelper::NotBeNeutral(),
|
||||||
ConstraintHelper::NotWanderingNation(),
|
ConstraintHelper::NotWanderingNation(),
|
||||||
@@ -94,8 +97,10 @@ class g65_접경귀환 extends Command\UserActionCommand
|
|||||||
$destCityID = $rng->choice($nearestCityList);
|
$destCityID = $rng->choice($nearestCityList);
|
||||||
$destCityName = CityConst::byID($destCityID)->name;
|
$destCityName = CityConst::byID($destCityID)->name;
|
||||||
|
|
||||||
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
$josaRo = JosaUtil::pick($destCityName, '로');
|
$josaRo = JosaUtil::pick($destCityName, '로');
|
||||||
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 접경귀환했습니다.");
|
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 접경귀환했습니다. <1>$date</>");
|
||||||
$general->setVar('city', $destCityID);
|
$general->setVar('city', $destCityID);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ class g65_철야내정 extends Command\UserActionCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function init(){
|
protected function init(){
|
||||||
|
$this->setCity();
|
||||||
|
$this->setNation();
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::NotBeNeutral(),
|
ConstraintHelper::NotBeNeutral(),
|
||||||
ConstraintHelper::OccupiedCity()
|
ConstraintHelper::OccupiedCity()
|
||||||
@@ -50,8 +53,10 @@ class g65_철야내정 extends Command\UserActionCommand{
|
|||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
$general->addInstantBuff(new g65_내정성공(), 2);
|
$general->addInstantBuff(new g65_내정성공(), 2);
|
||||||
|
|
||||||
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
$logger->pushGeneralActionLog("2턴 간 내정을 철저히 지휘합니다.");
|
$logger->pushGeneralActionLog("2턴 간 내정을 철저히 지휘합니다. <1>$date</>");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -402,6 +402,7 @@ class GameConstBase
|
|||||||
'휴식',
|
'휴식',
|
||||||
'g65_의원소환',
|
'g65_의원소환',
|
||||||
'g65_철야내정',
|
'g65_철야내정',
|
||||||
|
'g65_군량급매',
|
||||||
'g65_접경귀환',
|
'g65_접경귀환',
|
||||||
'g65_병장기지원',
|
'g65_병장기지원',
|
||||||
'g65_입대독려',
|
'g65_입대독려',
|
||||||
|
|||||||
Reference in New Issue
Block a user