feat: 요술, 빠진 부분 채우기

This commit is contained in:
2023-12-25 15:45:02 +00:00
parent 05eb4366b1
commit 4edb994ac9
10 changed files with 165 additions and 4 deletions
@@ -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(){
$this->setCity();
$this->setNation();
$this->fullConditionConstraints = [
ConstraintHelper::NotBeNeutral(),
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(){
$this->setCity();
$this->setNation();
$this->fullConditionConstraints = [
ConstraintHelper::NotBeNeutral(),
ConstraintHelper::OccupiedCity()
@@ -32,6 +32,9 @@ class g65_접경귀환 extends Command\UserActionCommand
protected function init()
{
$this->setCity();
$this->setNation();
$this->fullConditionConstraints = [
ConstraintHelper::NotBeNeutral(),
ConstraintHelper::NotWanderingNation(),
@@ -94,8 +97,10 @@ class g65_접경귀환 extends Command\UserActionCommand
$destCityID = $rng->choice($nearestCityList);
$destCityName = CityConst::byID($destCityID)->name;
$date = $general->getTurnTime($general::TURNTIME_HM);
$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->applyDB($db);
@@ -24,6 +24,9 @@ class g65_철야내정 extends Command\UserActionCommand{
}
protected function init(){
$this->setCity();
$this->setNation();
$this->fullConditionConstraints = [
ConstraintHelper::NotBeNeutral(),
ConstraintHelper::OccupiedCity()
@@ -50,8 +53,10 @@ class g65_철야내정 extends Command\UserActionCommand{
$general = $this->generalObj;
$general->addInstantBuff(new g65_내정성공(), 2);
$date = $general->getTurnTime($general::TURNTIME_HM);
$logger = $general->getLogger();
$logger->pushGeneralActionLog("2턴 간 내정을 철저히 지휘합니다.");
$logger->pushGeneralActionLog("2턴 간 내정을 철저히 지휘합니다. <1>$date</>");
return true;
}
}