feat(WIP): 증여,헌납,백성동원,수몰,천도,초토화,허보
This commit is contained in:
@@ -177,40 +177,22 @@ class che_증여 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getForm(): string
|
public function exportJSVars(): array
|
||||||
{
|
{
|
||||||
//TODO: 암행부처럼 보여야...
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
$nationID = $this->getNationID();
|
||||||
$destRawGenerals = $db->query('SELECT no,name,officer_level,npc,gold,rice FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)', $this->generalObj->getNationID(), $this->generalObj->getID());
|
$troops = Util::convertArrayToDict($db->query('SELECT * FROM troop WHERE nation=%i', $nationID), 'troop_leader');
|
||||||
ob_start();
|
$destRawGenerals = $db->queryAllLists('SELECT no,name,officer_level,npc,gold,rice,leadership,strength,intel,city,crew,train,atmos,troop FROM general WHERE nation = %i ORDER BY npc,binary(name)', $nationID);
|
||||||
?>
|
return [
|
||||||
자신의 자금이나 군량을 다른 장수에게 증여합니다.<br>
|
'procRes' => [
|
||||||
장수를 선택하세요.<br>
|
'troops' => $troops,
|
||||||
<select class='formInput' name="destGeneralID" id="destGeneralID" size='1' style='color:white;background-color:black;'>
|
'generals' => $destRawGenerals,
|
||||||
<?php foreach ($destRawGenerals as $destGeneral) :
|
'generalsKey' => ['no', 'name', 'officerLevel', 'npc', 'gold', 'rice', 'leadership', 'strength', 'intel', 'cityID', 'crew', 'train', 'atmos', 'troopID'],
|
||||||
$color = \sammo\getNameColor($destGeneral['npc']);
|
'cities' => \sammo\JSOptionsForCities(),
|
||||||
if ($color) {
|
'minAmount' => 100,
|
||||||
$color = " style='color:{$color}'";
|
'maxAmount' => GameConst::$maxResourceActionAmount,
|
||||||
}
|
'amountGuide' => GameConst::$resourceActionAmountGuide,
|
||||||
$name = $destGeneral['name'];
|
]
|
||||||
if ($destGeneral['officer_level'] >= 5) {
|
];
|
||||||
$name = "*{$name}*";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<option value='<?= $destGeneral['no'] ?>' <?= $color ?>><?= $name ?>(금:<?= $destGeneral['gold'] ?>, 쌀:<?= $destGeneral['rice'] ?>)</option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
<select class='formInput' name="isGold" id="isGold" size='1' style='color:white;background-color:black;'>
|
|
||||||
<option value="true">금</option>
|
|
||||||
<option value="false">쌀</option>
|
|
||||||
</select>
|
|
||||||
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
|
||||||
<?php foreach (GameConst::$resourceActionAmountGuide as $amount) : ?>
|
|
||||||
<option value='<?= $amount ?>'><?= $amount ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
|
||||||
<?php
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,6 +152,17 @@ class che_헌납 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportJSVars(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'procRes' => [
|
||||||
|
'minAmount' => 100,
|
||||||
|
'maxAmount' => GameConst::$maxResourceActionAmount,
|
||||||
|
'amountGuide' => GameConst::$resourceActionAmountGuide,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function getForm(): string
|
public function getForm(): string
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\Command\Nation;
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
use \sammo\{
|
use \sammo\{
|
||||||
DB, Util, JosaUtil,
|
DB,
|
||||||
General, DummyGeneral,
|
Util,
|
||||||
|
JosaUtil,
|
||||||
|
General,
|
||||||
|
DummyGeneral,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst,
|
GameConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
@@ -18,30 +22,33 @@ use \sammo\Constraint\Constraint;
|
|||||||
use \sammo\Constraint\ConstraintHelper;
|
use \sammo\Constraint\ConstraintHelper;
|
||||||
use sammo\Event\Action;
|
use sammo\Event\Action;
|
||||||
|
|
||||||
class che_백성동원 extends Command\NationCommand{
|
class che_백성동원 extends Command\NationCommand
|
||||||
|
{
|
||||||
static protected $actionName = '백성동원';
|
static protected $actionName = '백성동원';
|
||||||
static public $reqArg = true;
|
static public $reqArg = true;
|
||||||
|
|
||||||
protected function argTest():bool{
|
protected function argTest(): bool
|
||||||
if($this->arg === null){
|
{
|
||||||
|
if ($this->arg === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!key_exists('destCityID', $this->arg)){
|
if (!key_exists('destCityID', $this->arg)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(CityConst::byID($this->arg['destCityID']) === null){
|
if (CityConst::byID($this->arg['destCityID']) === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$destCityID = $this->arg['destCityID'];
|
$destCityID = $this->arg['destCityID'];
|
||||||
|
|
||||||
$this->arg = [
|
$this->arg = [
|
||||||
'destCityID'=>$destCityID,
|
'destCityID' => $destCityID,
|
||||||
];
|
];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function init(){
|
protected function init()
|
||||||
|
{
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
|
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
@@ -49,7 +56,7 @@ class che_백성동원 extends Command\NationCommand{
|
|||||||
$this->setCity();
|
$this->setCity();
|
||||||
$this->setNation(['strategic_cmd_limit']);
|
$this->setNation(['strategic_cmd_limit']);
|
||||||
|
|
||||||
$this->minConditionConstraints=[
|
$this->minConditionConstraints = [
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::AvailableStrategicCommand()
|
ConstraintHelper::AvailableStrategicCommand()
|
||||||
@@ -61,7 +68,7 @@ class che_백성동원 extends Command\NationCommand{
|
|||||||
$this->setDestCity($this->arg['destCityID']);
|
$this->setDestCity($this->arg['destCityID']);
|
||||||
$this->setDestNation($this->destCity['nation']);
|
$this->setDestNation($this->destCity['nation']);
|
||||||
|
|
||||||
$this->fullConditionConstraints=[
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::OccupiedDestCity(),
|
ConstraintHelper::OccupiedDestCity(),
|
||||||
@@ -69,38 +76,44 @@ class che_백성동원 extends Command\NationCommand{
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCommandDetailTitle():string{
|
public function getCommandDetailTitle(): string
|
||||||
|
{
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
$reqTurn = $this->getPreReqTurn()+1;
|
$reqTurn = $this->getPreReqTurn() + 1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
{
|
||||||
$genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit);
|
$genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit);
|
||||||
$nextTerm = Util::round(sqrt($genCount*4)*10);
|
$nextTerm = Util::round(sqrt($genCount * 4) * 10);
|
||||||
|
|
||||||
$nextTerm = $this->generalObj->onCalcStrategic($this->getName(), 'delay', $nextTerm);
|
$nextTerm = $this->generalObj->onCalcStrategic($this->getName(), 'delay', $nextTerm);
|
||||||
return $nextTerm;
|
return $nextTerm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBrief():string{
|
public function getBrief(): string
|
||||||
|
{
|
||||||
$commandName = $this->getName();
|
$commandName = $this->getName();
|
||||||
$destCityName = CityConst::byID($this->arg['destCityID'])->name;
|
$destCityName = CityConst::byID($this->arg['destCityID'])->name;
|
||||||
return "【{$destCityName}】에 {$commandName}";
|
return "【{$destCityName}】에 {$commandName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run():bool{
|
public function run(): bool
|
||||||
if(!$this->hasFullConditionMet()){
|
{
|
||||||
|
if (!$this->hasFullConditionMet()) {
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +145,7 @@ class che_백성동원 extends Command\NationCommand{
|
|||||||
$broadcastMessage = "<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>에 <M>백성동원</>을 하였습니다.";
|
$broadcastMessage = "<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>에 <M>백성동원</>을 하였습니다.";
|
||||||
|
|
||||||
$targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
$targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
||||||
foreach($targetGeneralList as $targetGeneralID){
|
foreach ($targetGeneralList as $targetGeneralID) {
|
||||||
$targetLogger = new ActionLogger($targetGeneralID, $nationID, $year, $month);
|
$targetLogger = new ActionLogger($targetGeneralID, $nationID, $year, $month);
|
||||||
$targetLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
$targetLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
||||||
$targetLogger->flush();
|
$targetLogger->flush();
|
||||||
@@ -159,27 +172,14 @@ class che_백성동원 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSPlugins(): array
|
public function exportJSVars(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'defaultSelectCityByMap'
|
'mapTheme' => \sammo\getMapTheme(),
|
||||||
|
'procRes' => [
|
||||||
|
'cities' => \sammo\JSOptionsForCities(),
|
||||||
|
'distanceList' => new \stdClass(),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getForm(): string
|
|
||||||
{
|
|
||||||
ob_start();
|
|
||||||
?>
|
|
||||||
<?=\sammo\getMapHtml()?><br>
|
|
||||||
선택된 도시에 백성을 동원해 성벽을 쌓습니다.<br>
|
|
||||||
아국 도시만 가능합니다.<br>
|
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
|
||||||
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
|
||||||
<?=\sammo\optionsForCities()?><br>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
|
||||||
<br>
|
|
||||||
<?php
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\Command\Nation;
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
use \sammo\{
|
use \sammo\{
|
||||||
DB, Util, JosaUtil,
|
DB,
|
||||||
General, DummyGeneral,
|
Util,
|
||||||
|
JosaUtil,
|
||||||
|
General,
|
||||||
|
DummyGeneral,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst,
|
GameConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
@@ -20,30 +24,33 @@ use \sammo\Constraint\Constraint;
|
|||||||
use \sammo\Constraint\ConstraintHelper;
|
use \sammo\Constraint\ConstraintHelper;
|
||||||
use sammo\Event\Action;
|
use sammo\Event\Action;
|
||||||
|
|
||||||
class che_수몰 extends Command\NationCommand{
|
class che_수몰 extends Command\NationCommand
|
||||||
|
{
|
||||||
static protected $actionName = '수몰';
|
static protected $actionName = '수몰';
|
||||||
static public $reqArg = true;
|
static public $reqArg = true;
|
||||||
|
|
||||||
protected function argTest():bool{
|
protected function argTest(): bool
|
||||||
if($this->arg === null){
|
{
|
||||||
|
if ($this->arg === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!key_exists('destCityID', $this->arg)){
|
if (!key_exists('destCityID', $this->arg)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(CityConst::byID($this->arg['destCityID']) === null){
|
if (CityConst::byID($this->arg['destCityID']) === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$destCityID = $this->arg['destCityID'];
|
$destCityID = $this->arg['destCityID'];
|
||||||
|
|
||||||
$this->arg = [
|
$this->arg = [
|
||||||
'destCityID'=>$destCityID,
|
'destCityID' => $destCityID,
|
||||||
];
|
];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function init(){
|
protected function init()
|
||||||
|
{
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
|
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
@@ -51,7 +58,7 @@ class che_수몰 extends Command\NationCommand{
|
|||||||
$this->setCity();
|
$this->setCity();
|
||||||
$this->setNation(['strategic_cmd_limit']);
|
$this->setNation(['strategic_cmd_limit']);
|
||||||
|
|
||||||
$this->minConditionConstraints=[
|
$this->minConditionConstraints = [
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::AvailableStrategicCommand(),
|
ConstraintHelper::AvailableStrategicCommand(),
|
||||||
@@ -63,7 +70,7 @@ class che_수몰 extends Command\NationCommand{
|
|||||||
$this->setDestCity($this->arg['destCityID']);
|
$this->setDestCity($this->arg['destCityID']);
|
||||||
$this->setDestNation($this->destCity['nation']);
|
$this->setDestNation($this->destCity['nation']);
|
||||||
|
|
||||||
$this->fullConditionConstraints=[
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::NotNeutralDestCity(),
|
ConstraintHelper::NotNeutralDestCity(),
|
||||||
@@ -73,39 +80,45 @@ class che_수몰 extends Command\NationCommand{
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCommandDetailTitle():string{
|
public function getCommandDetailTitle(): string
|
||||||
|
{
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
$reqTurn = $this->getPreReqTurn()+1;
|
$reqTurn = $this->getPreReqTurn() + 1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost():array{
|
public function getCost(): array
|
||||||
|
{
|
||||||
return [0, 0];
|
return [0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
public function getPreReqTurn(): int
|
||||||
|
{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
public function getPostReqTurn(): int
|
||||||
|
{
|
||||||
$genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit);
|
$genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit);
|
||||||
$nextTerm = Util::round(sqrt($genCount*4)*10);
|
$nextTerm = Util::round(sqrt($genCount * 4) * 10);
|
||||||
|
|
||||||
$nextTerm = $this->generalObj->onCalcStrategic($this->getName(), 'delay', $nextTerm);
|
$nextTerm = $this->generalObj->onCalcStrategic($this->getName(), 'delay', $nextTerm);
|
||||||
return $nextTerm;
|
return $nextTerm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBrief():string{
|
public function getBrief(): string
|
||||||
|
{
|
||||||
$commandName = $this->getName();
|
$commandName = $this->getName();
|
||||||
$destCityName = CityConst::byID($this->arg['destCityID'])->name;
|
$destCityName = CityConst::byID($this->arg['destCityID'])->name;
|
||||||
$josaUl = JosaUtil::pick($destCityName, '을');
|
$josaUl = JosaUtil::pick($destCityName, '을');
|
||||||
return "【{$destCityName}】{$josaUl} {$commandName}";
|
return "【{$destCityName}】{$josaUl} {$commandName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run():bool{
|
public function run(): bool
|
||||||
if(!$this->hasFullConditionMet()){
|
{
|
||||||
|
if (!$this->hasFullConditionMet()) {
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +153,7 @@ class che_수몰 extends Command\NationCommand{
|
|||||||
$broadcastMessage = "<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>에 <M>수몰</>을 발동하였습니다.";
|
$broadcastMessage = "<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>에 <M>수몰</>을 발동하였습니다.";
|
||||||
|
|
||||||
$targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
$targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
||||||
foreach($targetGeneralList as $targetGeneralID){
|
foreach ($targetGeneralList as $targetGeneralID) {
|
||||||
$targetLogger = new ActionLogger($targetGeneralID, $nationID, $year, $month);
|
$targetLogger = new ActionLogger($targetGeneralID, $nationID, $year, $month);
|
||||||
$targetLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
$targetLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
||||||
$targetLogger->flush();
|
$targetLogger->flush();
|
||||||
@@ -150,12 +163,13 @@ class che_수몰 extends Command\NationCommand{
|
|||||||
|
|
||||||
$targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i', $destNationID);
|
$targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i', $destNationID);
|
||||||
$destNationLogged = false;
|
$destNationLogged = false;
|
||||||
foreach($targetGeneralList as $targetGeneralID){
|
foreach ($targetGeneralList as $targetGeneralID) {
|
||||||
$targetLogger = new ActionLogger($targetGeneralID, $destNationID, $year, $month);
|
$targetLogger = new ActionLogger($targetGeneralID, $destNationID, $year, $month);
|
||||||
$targetLogger->pushGeneralActionLog($destBroadcastMessage, ActionLogger::PLAIN);
|
$targetLogger->pushGeneralActionLog($destBroadcastMessage, ActionLogger::PLAIN);
|
||||||
if(!$destNationLogged){
|
if (!$destNationLogged) {
|
||||||
$targetLogger->pushNationalHistoryLog(
|
$targetLogger->pushNationalHistoryLog(
|
||||||
"<D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} 아국의 <G><b>{$destCityName}</b></>에 <M>수몰</>을 발동", ActionLogger::PLAIN
|
"<D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} 아국의 <G><b>{$destCityName}</b></>에 <M>수몰</>을 발동",
|
||||||
|
ActionLogger::PLAIN
|
||||||
);
|
);
|
||||||
$destNationLogged = true;
|
$destNationLogged = true;
|
||||||
}
|
}
|
||||||
@@ -182,27 +196,14 @@ class che_수몰 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSPlugins(): array
|
public function exportJSVars(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'defaultSelectCityByMap'
|
'mapTheme' => \sammo\getMapTheme(),
|
||||||
|
'procRes' => [
|
||||||
|
'cities' => \sammo\JSOptionsForCities(),
|
||||||
|
'distanceList' => new \stdClass(),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getForm(): string
|
|
||||||
{
|
|
||||||
ob_start();
|
|
||||||
?>
|
|
||||||
<?=\sammo\getMapHtml()?><br>
|
|
||||||
선택된 도시에 수몰을 발동합니다.<br>
|
|
||||||
전쟁중인 상대국 도시만 가능합니다.<br>
|
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
|
||||||
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
|
||||||
<?=\sammo\optionsForCities()?><br>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
|
||||||
<br>
|
|
||||||
<?php
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -230,27 +230,14 @@ class che_천도 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSPlugins(): array
|
public function exportJSVars(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'defaultSelectCityByMap'
|
'mapTheme' => \sammo\getMapTheme(),
|
||||||
|
'procRes' => [
|
||||||
|
'cities' => \sammo\JSOptionsForCities(),
|
||||||
|
'distanceList' => new \stdClass(),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getForm(): string
|
|
||||||
{
|
|
||||||
ob_start();
|
|
||||||
?>
|
|
||||||
<?= \sammo\getMapHtml() ?><br>
|
|
||||||
선택된 도시로 천도합니다.<br>
|
|
||||||
현재 수도에서 연결된 도시만 가능하며, 1+2×거리만큼의 턴이 필요합니다.<br>
|
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
|
||||||
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
|
||||||
<?= \sammo\optionsForCities() ?><br>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
|
||||||
<br>
|
|
||||||
<?php
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,38 +196,14 @@ class che_초토화 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSPlugins(): array
|
public function exportJSVars(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'defaultSelectCityByMap'
|
'mapTheme' => \sammo\getMapTheme(),
|
||||||
|
'procRes' => [
|
||||||
|
'cities' => \sammo\JSOptionsForCities(),
|
||||||
|
'distanceList' => new \stdClass(),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getForm(): string
|
|
||||||
{
|
|
||||||
|
|
||||||
$cities = Util::convertArrayToDict(DB::db()->query('SELECT * FROM city WHERE nation =%i', $this->generalObj->getNationID()), 'city');
|
|
||||||
$calc = function(CityInitialDetail $constCity)use($cities){
|
|
||||||
if(!key_exists($constCity->id, $cities)){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$amount = $this->calcReturnAmount($cities[$constCity->id]);
|
|
||||||
$amountText = number_format($amount);
|
|
||||||
return "금쌀 각 {$amountText} 회수";
|
|
||||||
};
|
|
||||||
ob_start();
|
|
||||||
?>
|
|
||||||
<?=\sammo\getMapHtml()?><br>
|
|
||||||
선택된 도시를 초토화 시킵니다.<br>
|
|
||||||
도시가 공백지가 되며, 도시의 인구, 내정 상태에 따라 상당량의 국고가 확보됩니다.<br>
|
|
||||||
국가의 수뇌들은 명성을 잃고, 모든 장수들은 배신 수치가 1 증가합니다.<br>
|
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
|
||||||
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
|
||||||
<?=\sammo\optionsForCities($calc)?><br>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
|
||||||
<br>
|
|
||||||
<?php
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -199,27 +199,14 @@ class che_허보 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSPlugins(): array
|
public function exportJSVars(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'defaultSelectCityByMap'
|
'mapTheme' => \sammo\getMapTheme(),
|
||||||
|
'procRes' => [
|
||||||
|
'cities' => \sammo\JSOptionsForCities(),
|
||||||
|
'distanceList' => new \stdClass(),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getForm(): string
|
|
||||||
{
|
|
||||||
ob_start();
|
|
||||||
?>
|
|
||||||
<?= \sammo\getMapHtml() ?><br>
|
|
||||||
선택된 도시에 허보를 발동합니다.<br>
|
|
||||||
전쟁중인 상대국 도시만 가능합니다.<br>
|
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
|
||||||
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
|
||||||
<?= \sammo\optionsForCities() ?><br>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
|
||||||
<br>
|
|
||||||
<?php
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<template>
|
||||||
|
<TopBackBar :title="commandName" type="chief" />
|
||||||
|
<div class="bg0">
|
||||||
|
<div>
|
||||||
|
자신의 자금이나 군량을 국가 재산으로 헌납합니다.
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2 col-md-1">
|
||||||
|
자원 :
|
||||||
|
<b-button-group>
|
||||||
|
<b-button :pressed="isGold" @click="isGold = true">금</b-button>
|
||||||
|
<b-button :pressed="!isGold" @click="isGold = false">쌀</b-button>
|
||||||
|
</b-button-group>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-md-4">
|
||||||
|
금액 :
|
||||||
|
<SelectAmount
|
||||||
|
:amountGuide="amountGuide"
|
||||||
|
v-model="amount"
|
||||||
|
:maxAmount="maxAmount"
|
||||||
|
:minAmount="minAmount"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-4 col-md-2 d-grid">
|
||||||
|
<b-button variant="primary" @click="submit">{{ commandName }}</b-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<BottomBar :title="commandName" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import SelectAmount from "@/processing/SelectAmount.vue";
|
||||||
|
import { defineComponent, ref } from "vue";
|
||||||
|
import { unwrap } from "@/util/unwrap";
|
||||||
|
import { Args } from "@/processing/args";
|
||||||
|
import TopBackBar from "@/components/TopBackBar.vue";
|
||||||
|
import BottomBar from "@/components/BottomBar.vue";
|
||||||
|
declare const commandName: string;
|
||||||
|
|
||||||
|
declare const procRes: {
|
||||||
|
minAmount: number;
|
||||||
|
maxAmount: number;
|
||||||
|
amountGuide: number[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
components: {
|
||||||
|
SelectAmount,
|
||||||
|
TopBackBar,
|
||||||
|
BottomBar,
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
const amount = ref(1000);
|
||||||
|
const isGold = ref(true);
|
||||||
|
|
||||||
|
|
||||||
|
async function submit(e: Event) {
|
||||||
|
const event = new CustomEvent<Args>("customSubmit", {
|
||||||
|
detail: {
|
||||||
|
amount: amount.value,
|
||||||
|
isGold: isGold.value,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
unwrap(e.target).dispatchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
amount,
|
||||||
|
isGold,
|
||||||
|
minAmount: ref(procRes.minAmount),
|
||||||
|
maxAmount: ref(procRes.maxAmount),
|
||||||
|
amountGuide: procRes.amountGuide,
|
||||||
|
commandName,
|
||||||
|
submit,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -2,12 +2,13 @@ import { default as che_건국 } from "./che_건국.vue";
|
|||||||
import { default as che_군량매매 } from "./che_군량매매.vue";
|
import { default as che_군량매매 } from "./che_군량매매.vue";
|
||||||
import { default as che_등용 } from "./che_등용.vue";
|
import { default as che_등용 } from "./che_등용.vue";
|
||||||
import { default as che_선양 } from "./che_선양.vue";
|
import { default as che_선양 } from "./che_선양.vue";
|
||||||
|
|
||||||
import { default as che_임관 } from "./che_임관.vue";
|
import { default as che_임관 } from "./che_임관.vue";
|
||||||
import { default as che_장수대상임관 } from "./che_장수대상임관.vue";
|
import { default as che_장수대상임관 } from "./che_장수대상임관.vue";
|
||||||
import { default as che_징병 } from "./che_징병.vue";
|
import { default as che_징병 } from "./che_징병.vue";
|
||||||
|
import { default as che_헌납 } from "./che_헌납.vue";
|
||||||
|
|
||||||
import { default as ProcessCity } from "../ProcessCity.vue";
|
import { default as ProcessCity } from "../ProcessCity.vue";
|
||||||
|
import { default as ProcessGeneralAmount } from "../ProcessGeneralAmount.vue";
|
||||||
|
|
||||||
|
|
||||||
//TODO: 자주 쓰는 녀석들은 Slot으로 변경
|
//TODO: 자주 쓰는 녀석들은 Slot으로 변경
|
||||||
@@ -24,20 +25,16 @@ export const commandMap: Record<string, typeof ProcessCity> = {
|
|||||||
che_임관,
|
che_임관,
|
||||||
che_장수대상임관,
|
che_장수대상임관,
|
||||||
che_징병,
|
che_징병,
|
||||||
|
che_증여: ProcessGeneralAmount,
|
||||||
che_첩보: ProcessCity,
|
che_첩보: ProcessCity,
|
||||||
che_출병: ProcessCity,
|
che_출병: ProcessCity,
|
||||||
che_탈취: ProcessCity,
|
che_탈취: ProcessCity,
|
||||||
che_파괴: ProcessCity,
|
che_파괴: ProcessCity,
|
||||||
che_화계: ProcessCity,
|
che_화계: ProcessCity,
|
||||||
|
che_헌납,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- 항목들
|
- 항목들
|
||||||
장수/금쌀/분량 - 증여(포상 이식)
|
|
||||||
금쌀/분량 - 헌납(군량매매 또는 포상 수정)
|
|
||||||
|
|
||||||
고유 양식 - 숙련전환, 장비매매
|
고유 양식 - 숙련전환, 장비매매
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@@ -4,8 +4,9 @@ import { default as che_물자원조 } from "./che_물자원조.vue";
|
|||||||
import { default as che_피장파장 } from "./che_피장파장.vue";
|
import { default as che_피장파장 } from "./che_피장파장.vue";
|
||||||
|
|
||||||
import { default as ProcessNation } from "../ProcessNation.vue";
|
import { default as ProcessNation } from "../ProcessNation.vue";
|
||||||
import { default as ProcessGeneralAmount } from "./che_몰수.vue";
|
import { default as ProcessGeneralAmount } from "../ProcessGeneralAmount.vue";
|
||||||
import { default as ProcessGeneralCity } from "./che_발령.vue";
|
import { default as ProcessGeneralCity } from "./che_발령.vue";
|
||||||
|
import { default as ProcessCity } from "../ProcessCity.vue";
|
||||||
|
|
||||||
export const commandMap: Record<string, typeof ProcessNation> = {
|
export const commandMap: Record<string, typeof ProcessNation> = {
|
||||||
che_국기변경,
|
che_국기변경,
|
||||||
@@ -14,17 +15,20 @@ export const commandMap: Record<string, typeof ProcessNation> = {
|
|||||||
che_몰수: ProcessGeneralAmount,
|
che_몰수: ProcessGeneralAmount,
|
||||||
che_물자원조,
|
che_물자원조,
|
||||||
che_발령: ProcessGeneralCity,
|
che_발령: ProcessGeneralCity,
|
||||||
|
che_백성동원: ProcessCity,
|
||||||
che_불가침파기제의: ProcessNation,
|
che_불가침파기제의: ProcessNation,
|
||||||
che_선전포고: ProcessNation,
|
che_선전포고: ProcessNation,
|
||||||
|
che_수몰: ProcessCity,
|
||||||
che_이호경식: ProcessNation,
|
che_이호경식: ProcessNation,
|
||||||
che_종전제의: ProcessNation,
|
che_종전제의: ProcessNation,
|
||||||
|
che_천도: ProcessCity,
|
||||||
|
che_초토화: ProcessCity,
|
||||||
che_포상: ProcessGeneralAmount,
|
che_포상: ProcessGeneralAmount,
|
||||||
che_피장파장,
|
che_피장파장,
|
||||||
|
che_허보: ProcessCity,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- 항목들
|
- 항목들
|
||||||
도시 - 백성동원, 수몰, 천도, 초토화, 허보
|
|
||||||
고유 양식 - 불가침제의
|
고유 양식 - 불가침제의
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@@ -31,8 +31,35 @@
|
|||||||
목록을 선택하거나 도시를 클릭하세요.<br />
|
목록을 선택하거나 도시를 클릭하세요.<br />
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="commandName in { 화계: 1, 탈취: 1, 파괴: 1, 선동: 1 }">
|
<div v-else-if="commandName in { 화계: 1, 탈취: 1, 파괴: 1, 선동: 1 }">
|
||||||
선택된 도시에 {{ commandName }}{{JosaPick(commandName, '을')}}
|
선택된 도시에 {{ commandName
|
||||||
실행합니다.<br />
|
}}{{ JosaPick(commandName, "을") }} 실행합니다.<br />
|
||||||
|
목록을 선택하거나 도시를 클릭하세요.<br />
|
||||||
|
</div>
|
||||||
|
<div v-else-if="commandName == '수몰'">
|
||||||
|
선택된 도시에 수몰을 발동합니다.<br />
|
||||||
|
전쟁중인 상대국 도시만 가능합니다.<br />
|
||||||
|
목록을 선택하거나 도시를 클릭하세요.<br />
|
||||||
|
</div>
|
||||||
|
<div v-else-if="commandName == '백성동원'">
|
||||||
|
선택된 도시에 백성을 동원해 성벽을 쌓습니다.<br />
|
||||||
|
아국 도시만 가능합니다.<br />
|
||||||
|
목록을 선택하거나 도시를 클릭하세요.<br />
|
||||||
|
</div>
|
||||||
|
<div v-else-if="commandName == '천도'">
|
||||||
|
선택된 도시로 천도합니다.<br />
|
||||||
|
현재 수도에서 연결된 도시만 가능하며, 1+2×거리만큼의 턴이 필요합니다.<br />
|
||||||
|
목록을 선택하거나 도시를 클릭하세요.<br />
|
||||||
|
</div>
|
||||||
|
<div v-else-if="commandName == '허보'">
|
||||||
|
선택된 도시에 허보를 발동합니다.<br />
|
||||||
|
전쟁중인 상대국 도시만 가능합니다.<br />
|
||||||
|
목록을 선택하거나 도시를 클릭하세요.<br />
|
||||||
|
</div>
|
||||||
|
<div v-else-if="commandName == '초토화'">
|
||||||
|
선택된 도시를 초토화 시킵니다.<br />
|
||||||
|
도시가 공백지가 되며, 도시의 인구, 내정 상태에 따라 상당량의 국고가
|
||||||
|
확보됩니다.<br />
|
||||||
|
국가의 수뇌들은 명성을 잃고, 모든 장수들은 배신 수치가 1 증가합니다.<br />
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br />
|
목록을 선택하거나 도시를 클릭하세요.<br />
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -8,13 +8,15 @@
|
|||||||
<div v-else-if="commandName == '포상'">
|
<div v-else-if="commandName == '포상'">
|
||||||
국고로 장수에게 자금이나 군량을 지급합니다.<br />
|
국고로 장수에게 자금이나 군량을 지급합니다.<br />
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="commandName == '증여'">
|
||||||
|
자신의 자금이나 군량을 다른 장수에게 증여합니다.<br>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-md-5">
|
<div class="col-12 col-md-5">
|
||||||
장수 :
|
장수 :
|
||||||
<SelectGeneral
|
<SelectGeneral
|
||||||
:cities="citiesMap"
|
:cities="citiesMap"
|
||||||
:generals="generalList"
|
:generals="generalList"
|
||||||
:troops="troops"
|
|
||||||
v-model="selectedGeneralID"
|
v-model="selectedGeneralID"
|
||||||
:textHelper="textHelpGeneral"
|
:textHelper="textHelpGeneral"
|
||||||
/>
|
/>
|
||||||
@@ -56,7 +58,7 @@ import {
|
|||||||
procGeneralItem,
|
procGeneralItem,
|
||||||
procGeneralKey,
|
procGeneralKey,
|
||||||
procGeneralRawItemList,
|
procGeneralRawItemList,
|
||||||
} from "../processingRes";
|
} from "./processingRes";
|
||||||
import { getNpcColor } from "@/common_legacy";
|
import { getNpcColor } from "@/common_legacy";
|
||||||
declare const commandName: string;
|
declare const commandName: string;
|
||||||
|
|
||||||
@@ -147,7 +147,6 @@ export default defineComponent({
|
|||||||
groupArray.push(obj);
|
groupArray.push(obj);
|
||||||
targets.set(gen.no, obj);
|
targets.set(gen.no, obj);
|
||||||
}
|
}
|
||||||
console.log(forFind);
|
|
||||||
return {
|
return {
|
||||||
selectedGeneral,
|
selectedGeneral,
|
||||||
searchMode: true,
|
searchMode: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user