diff --git a/hwe/func_converter.php b/hwe/func_converter.php index 23f74823..85f991e5 100644 --- a/hwe/func_converter.php +++ b/hwe/func_converter.php @@ -416,6 +416,27 @@ function buildGeneralCommandClass(?string $type, General $generalObj, array $env return new $class($generalObj, $env, $arg); } +function getUserActionCommandClass(?string $type){ + if($type === null || $type === ''){ + $type = '휴식'; + } + + static $basePath = __NAMESPACE__.'\\Command\\UserAction\\'; + $classPath = ($basePath.$type); + + if(class_exists($classPath)){ + return $classPath; + } + + throw new \InvalidArgumentException("{$type}은 올바른 개변 전략 커맨드가 아님"); +} + +function buildUserActionCommandClass(?string $type, General $generalObj, array $env, $arg = null):Command\UserActionCommand{ + $class = getUserActionCommandClass($type); + return new $class($generalObj, $env, $arg); +} + + function getNationCommandClass(?string $type){ if($type === null || $type === ''){ $type = '휴식'; diff --git a/hwe/sammo/API/General/GetUserActionCommandTable.php b/hwe/sammo/API/General/GetUserActionCommandTable.php new file mode 100644 index 00000000..fbf46f8a --- /dev/null +++ b/hwe/sammo/API/General/GetUserActionCommandTable.php @@ -0,0 +1,66 @@ +generalID; + $general = General::createObjFromDB($generalID); + + $db = DB::db(); + $gameStor = KVStorage::getStorage($db, 'game_env'); + $gameStor->turnOnCache(); + $env = $gameStor->getAll(); + + $commandTable = []; + foreach (GameConst::$availableUserActionCommand as $commandCategory => $commandList) { + $subList = []; + foreach ($commandList as $commandClassName) { + $commandObj = buildUserActionCommandClass($commandClassName, $general, $env); + if (!$commandObj->canDisplay()) { + continue; + } + $subList[] = [ + 'value' => Util::getClassNameFromObj($commandObj), + 'compensation' => $commandObj->getCompensationStyle(), + 'possible' => $commandObj->hasMinConditionMet(), + 'title' => $commandObj->getCommandDetailTitle(), + 'simpleName' => $commandObj->getName(), + 'reqArg' => $commandObj::$reqArg, + ]; + } + + $commandTable[] = [ + 'category' => $commandCategory, + 'values' => $subList + ]; + } + + return [ + 'result' => true, + 'commandTable' => $commandTable, + ]; + } +} \ No newline at end of file diff --git a/hwe/sammo/Command/UserAction/휴식.php b/hwe/sammo/Command/UserAction/휴식.php new file mode 100644 index 00000000..ae425434 --- /dev/null +++ b/hwe/sammo/Command/UserAction/휴식.php @@ -0,0 +1,38 @@ +fullConditionConstraints=[]; + + } + + public function getPreReqTurn():int{ + return 0; + } + + public function getPostReqTurn():int{ + return 0; + } + + public function getCost():array{ + return [0, 0]; + } + + public function run(\Sammo\RandUtil $rng):bool{ + $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + return true; + } +} \ No newline at end of file diff --git a/hwe/sammo/Command/UserActionCommand.php b/hwe/sammo/Command/UserActionCommand.php new file mode 100644 index 00000000..7bcb8c6b --- /dev/null +++ b/hwe/sammo/Command/UserActionCommand.php @@ -0,0 +1,37 @@ +getGeneral()->getID(); + $executeKey = "next_execute_{$generalID}_user_action_{$turnKey}"; + return $executeKey; + } + + public function getNextAvailableTurn():?int{ + if($this->isArgValid && !$this->getPostReqTurn()){ + return null; + } + $db = \sammo\DB::db(); + $lastExecuteStor = \sammo\KVStorage::getStorage($db, 'next_execute'); + return $lastExecuteStor->getValue($this->getNextExecuteKey()); + } + + public function setNextAvailable(?int $yearMonth=null){ + if(!$this->getPostReqTurn()){ + return; + } + if($yearMonth === null){ + $yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']) + + $this->getPostReqTurn() - $this->getPreReqTurn(); + } + + $db = \sammo\DB::db(); + $lastExecuteStor = \sammo\KVStorage::getStorage($db, 'next_execute'); + $lastExecuteStor->setValue($this->getNextExecuteKey(), $yearMonth); + } + +}; \ No newline at end of file diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php index 1efc3341..000518a6 100644 --- a/hwe/sammo/GameConstBase.php +++ b/hwe/sammo/GameConstBase.php @@ -223,7 +223,7 @@ class GameConstBase public static $inheritItemRandomPoint = 3000; public static $inheritBuffPoints = [0, 200, 600, 1200, 2000, 3000]; public static $inheritSpecificSpecialPoint = 4000; - public static $inheritResetAttrPointBase = [1000, 1000, 2000, 3000];//필요하면 늘려서 쓰기 + public static $inheritResetAttrPointBase = [1000, 1000, 2000, 3000]; //필요하면 늘려서 쓰기 /** @var ?string */ public static $scenarioEffect = null; @@ -246,7 +246,7 @@ class GameConstBase 'che_명마_07_백마' => 2, 'che_명마_07_기주마' => 2, 'che_명마_07_오환마' => 2, 'che_명마_07_백상' => 2, 'che_명마_08_양주마' => 2, 'che_명마_08_흉노마' => 2, 'che_명마_09_과하마' => 2, 'che_명마_09_의남백마' => 2, 'che_명마_10_대완마' => 2, 'che_명마_10_옥추마' => 2, 'che_명마_11_서량마' => 2, 'che_명마_11_화종마' => 2, - 'che_명마_12_사륜거' => 2, 'che_명마_12_옥란백용구'=> 2, 'che_명마_13_절영' => 2, 'che_명마_13_적로' => 2, + 'che_명마_12_사륜거' => 2, 'che_명마_12_옥란백용구' => 2, 'che_명마_13_절영' => 2, 'che_명마_13_적로' => 2, 'che_명마_14_적란마' => 2, 'che_명마_14_조황비전' => 2, 'che_명마_15_한혈마' => 2, 'che_명마_15_적토마' => 2, ], 'weapon' => [ @@ -278,7 +278,7 @@ class GameConstBase 'che_내정_납금박산로' => 1, 'che_전략_평만지장도' => 1, 'che_숙련_동작' => 1, 'che_명성_구석' => 1, 'che_척사_오악진형도' => 1, 'che_격노_구정신단경' => 1, 'che_징병_낙주' => 1, - 'che_저격_매화수전' => 1, 'che_저격_비도'=>1, 'che_위압_조목삭' => 1, 'che_공성_묵자' => 1, + 'che_저격_매화수전' => 1, 'che_저격_비도' => 1, 'che_위압_조목삭' => 1, 'che_공성_묵자' => 1, 'che_집중_전국책' => 1, 'che_환술_논어집해' => 1, 'che_진압_박혁론' => 1, 'che_부적_태현청생부' => 1, 'che_저지_삼황내문' => 1, @@ -395,6 +395,17 @@ class GameConstBase 'che_국호변경', ] ]; + + /** @var array 개인 전략 커맨드 */ + public static $availableUserActionCommand = [ + '개인 전략' => [ + '휴식', + /*'che_병사연회', + 'che_내정집중', + 'che_즉시치료',*/ + ] + ]; + public static $retirementYear = 80; public static $targetGeneralPool = 'RandomNameGeneral'; diff --git a/hwe/ts/PageUserAction.vue b/hwe/ts/PageUserAction.vue index f2ea70e3..6838af91 100644 --- a/hwe/ts/PageUserAction.vue +++ b/hwe/ts/PageUserAction.vue @@ -1,3 +1,51 @@ - 유저 액션 - \ No newline at end of file + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hwe/ts/ReservedCommandForUserAction.vue b/hwe/ts/ReservedCommandForUserAction.vue new file mode 100644 index 00000000..e9a48a88 --- /dev/null +++ b/hwe/ts/ReservedCommandForUserAction.vue @@ -0,0 +1,424 @@ + + + + 명령 목록 + + + + + + + + + + + {{ turnIdx + 1 }} + + + + + + {{ turnObj.year ? `${turnObj.year}年` : "" }} + {{ turnObj.month ? `${turnObj.month}月` : "" }} + + + + + {{ turnObj.time }} + + + + + + + + + + + + + + + + + + + + + + + + + {{ flippedMaxTurn == viewMaxTurn ? "펼치기" : "접기" }} + + + + + + + + + + diff --git a/hwe/ts/SammoAPI.ts b/hwe/ts/SammoAPI.ts index 626f36d9..5d17fa69 100644 --- a/hwe/ts/SammoAPI.ts +++ b/hwe/ts/SammoAPI.ts @@ -117,6 +117,10 @@ const apiRealPath = { }[], ReserveBulkCommandResponse >, + ReserveUserAction: PUT as APICallT<{ + turnIdx: number; + action: string; + }> }, General: { Join: POST as APICallT, @@ -134,6 +138,7 @@ const apiRealPath = { InstantRetreat: POST as APICallT, BuildNationCandidate: POST as APICallT, GetCommandTable: GET as APICallT, + GetUserActionCommandTable: GET as APICallT, GetFrontInfo: GET as APICallT<{ lastNationNoticeDate?: string, lastGeneralRecordID?: number,