forked from devsam/core
feat: event용 연구 추가
This commit is contained in:
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Enums\InheritanceKey;
|
||||||
|
use sammo\Enums\NationAuxKey;
|
||||||
|
use \sammo\Util;
|
||||||
|
use \sammo\JosaUtil;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\StaticEventHandler;
|
||||||
|
|
||||||
|
class event_극병연구 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '극병 연구';
|
||||||
|
static protected $auxType = NationAuxKey::can_극병사용;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setNation(['gold','rice','aux']);
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
$name = static::$actionName;
|
||||||
|
|
||||||
|
$this->minConditionConstraints = [
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::ReqNationAuxValue(static::$auxType->value, 0, "<", 1, "{$name}가 이미 완료되었습니다."),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 23;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [100000, 100000];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if(!$this->hasFullConditionMet()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
|
$actionName = static::$actionName;
|
||||||
|
|
||||||
|
$aux = $this->nation['aux'];
|
||||||
|
$aux[static::$auxType->value] = 1;
|
||||||
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
|
$generalName = $general->getName();
|
||||||
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold' => $db->sqleval('gold - %i', $reqGold),
|
||||||
|
'rice' => $db->sqleval('rice - %i', $reqRice),
|
||||||
|
'aux' => Json::encode($aux),
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushGeneralHistoryLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>{$actionName}</> 완료");
|
||||||
|
|
||||||
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
|
StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg ?? []);
|
||||||
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Enums\InheritanceKey;
|
||||||
|
use sammo\Enums\NationAuxKey;
|
||||||
|
use \sammo\Util;
|
||||||
|
use \sammo\JosaUtil;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\StaticEventHandler;
|
||||||
|
|
||||||
|
class event_대검병연구 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '대검병 연구';
|
||||||
|
static protected $auxType = NationAuxKey::can_대검병사용;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setNation(['gold','rice','aux']);
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
$name = static::$actionName;
|
||||||
|
|
||||||
|
$this->minConditionConstraints = [
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::ReqNationAuxValue(static::$auxType->value, 0, "<", 1, "{$name}가 이미 완료되었습니다."),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [50000, 50000];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if(!$this->hasFullConditionMet()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
|
$actionName = static::$actionName;
|
||||||
|
|
||||||
|
$aux = $this->nation['aux'];
|
||||||
|
$aux[static::$auxType->value] = 1;
|
||||||
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
|
$generalName = $general->getName();
|
||||||
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold' => $db->sqleval('gold - %i', $reqGold),
|
||||||
|
'rice' => $db->sqleval('rice - %i', $reqRice),
|
||||||
|
'aux' => Json::encode($aux),
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushGeneralHistoryLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>{$actionName}</> 완료");
|
||||||
|
|
||||||
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
|
StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg ?? []);
|
||||||
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Enums\InheritanceKey;
|
||||||
|
use sammo\Enums\NationAuxKey;
|
||||||
|
use \sammo\Util;
|
||||||
|
use \sammo\JosaUtil;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\StaticEventHandler;
|
||||||
|
|
||||||
|
class event_무희연구 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '무희 연구';
|
||||||
|
static protected $auxType = NationAuxKey::can_무희사용;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setNation(['gold','rice','aux']);
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
$name = static::$actionName;
|
||||||
|
|
||||||
|
$this->minConditionConstraints = [
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::ReqNationAuxValue(static::$auxType->value, 0, "<", 1, "{$name}가 이미 완료되었습니다."),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 23;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [100000, 100000];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if(!$this->hasFullConditionMet()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
|
$actionName = static::$actionName;
|
||||||
|
|
||||||
|
$aux = $this->nation['aux'];
|
||||||
|
$aux[static::$auxType->value] = 1;
|
||||||
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
|
$generalName = $general->getName();
|
||||||
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold' => $db->sqleval('gold - %i', $reqGold),
|
||||||
|
'rice' => $db->sqleval('rice - %i', $reqRice),
|
||||||
|
'aux' => Json::encode($aux),
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushGeneralHistoryLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>{$actionName}</> 완료");
|
||||||
|
|
||||||
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
|
StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg ?? []);
|
||||||
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Enums\InheritanceKey;
|
||||||
|
use sammo\Enums\NationAuxKey;
|
||||||
|
use \sammo\Util;
|
||||||
|
use \sammo\JosaUtil;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\StaticEventHandler;
|
||||||
|
|
||||||
|
class event_산저병연구 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '산저병 연구';
|
||||||
|
static protected $auxType = NationAuxKey::can_산저병사용;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setNation(['gold','rice','aux']);
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
$name = static::$actionName;
|
||||||
|
|
||||||
|
$this->minConditionConstraints = [
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::ReqNationAuxValue(static::$auxType->value, 0, "<", 1, "{$name}가 이미 완료되었습니다."),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [50000, 50000];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if(!$this->hasFullConditionMet()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
|
$actionName = static::$actionName;
|
||||||
|
|
||||||
|
$aux = $this->nation['aux'];
|
||||||
|
$aux[static::$auxType->value] = 1;
|
||||||
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
|
$generalName = $general->getName();
|
||||||
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold' => $db->sqleval('gold - %i', $reqGold),
|
||||||
|
'rice' => $db->sqleval('rice - %i', $reqRice),
|
||||||
|
'aux' => Json::encode($aux),
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushGeneralHistoryLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>{$actionName}</> 완료");
|
||||||
|
|
||||||
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
|
StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg ?? []);
|
||||||
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Enums\InheritanceKey;
|
||||||
|
use sammo\Enums\NationAuxKey;
|
||||||
|
use \sammo\Util;
|
||||||
|
use \sammo\JosaUtil;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\StaticEventHandler;
|
||||||
|
|
||||||
|
class event_상병연구 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '상병 연구';
|
||||||
|
static protected $auxType = NationAuxKey::can_상병사용;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setNation(['gold','rice','aux']);
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
$name = static::$actionName;
|
||||||
|
|
||||||
|
$this->minConditionConstraints = [
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::ReqNationAuxValue(static::$auxType->value, 0, "<", 1, "{$name}가 이미 완료되었습니다."),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 23;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [100000, 100000];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if(!$this->hasFullConditionMet()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
|
$actionName = static::$actionName;
|
||||||
|
|
||||||
|
$aux = $this->nation['aux'];
|
||||||
|
$aux[static::$auxType->value] = 1;
|
||||||
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
|
$generalName = $general->getName();
|
||||||
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold' => $db->sqleval('gold - %i', $reqGold),
|
||||||
|
'rice' => $db->sqleval('rice - %i', $reqRice),
|
||||||
|
'aux' => Json::encode($aux),
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushGeneralHistoryLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>{$actionName}</> 완료");
|
||||||
|
|
||||||
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
|
StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg ?? []);
|
||||||
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Enums\InheritanceKey;
|
||||||
|
use sammo\Enums\NationAuxKey;
|
||||||
|
use \sammo\Util;
|
||||||
|
use \sammo\JosaUtil;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\StaticEventHandler;
|
||||||
|
|
||||||
|
class event_원융노병연구 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '원융노병 연구';
|
||||||
|
static protected $auxType = NationAuxKey::can_원융노병사용;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setNation(['gold','rice','aux']);
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
$name = static::$actionName;
|
||||||
|
|
||||||
|
$this->minConditionConstraints = [
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::ReqNationAuxValue(static::$auxType->value, 0, "<", 1, "{$name}가 이미 완료되었습니다."),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 23;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [100000, 100000];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if(!$this->hasFullConditionMet()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
|
$actionName = static::$actionName;
|
||||||
|
|
||||||
|
$aux = $this->nation['aux'];
|
||||||
|
$aux[static::$auxType->value] = 1;
|
||||||
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
|
$generalName = $general->getName();
|
||||||
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold' => $db->sqleval('gold - %i', $reqGold),
|
||||||
|
'rice' => $db->sqleval('rice - %i', $reqRice),
|
||||||
|
'aux' => Json::encode($aux),
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushGeneralHistoryLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>{$actionName}</> 완료");
|
||||||
|
|
||||||
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
|
StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg ?? []);
|
||||||
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Enums\InheritanceKey;
|
||||||
|
use sammo\Enums\NationAuxKey;
|
||||||
|
use \sammo\Util;
|
||||||
|
use \sammo\JosaUtil;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\StaticEventHandler;
|
||||||
|
|
||||||
|
class event_음귀병연구 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '음귀병 연구';
|
||||||
|
static protected $auxType = NationAuxKey::can_음귀병사용;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setNation(['gold','rice','aux']);
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
$name = static::$actionName;
|
||||||
|
|
||||||
|
$this->minConditionConstraints = [
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::ReqNationAuxValue(static::$auxType->value, 0, "<", 1, "{$name}가 이미 완료되었습니다."),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [50000, 50000];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if(!$this->hasFullConditionMet()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
|
$actionName = static::$actionName;
|
||||||
|
|
||||||
|
$aux = $this->nation['aux'];
|
||||||
|
$aux[static::$auxType->value] = 1;
|
||||||
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
|
$generalName = $general->getName();
|
||||||
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold' => $db->sqleval('gold - %i', $reqGold),
|
||||||
|
'rice' => $db->sqleval('rice - %i', $reqRice),
|
||||||
|
'aux' => Json::encode($aux),
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushGeneralHistoryLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>{$actionName}</> 완료");
|
||||||
|
|
||||||
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
|
StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg ?? []);
|
||||||
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Enums\InheritanceKey;
|
||||||
|
use sammo\Enums\NationAuxKey;
|
||||||
|
use \sammo\Util;
|
||||||
|
use \sammo\JosaUtil;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\StaticEventHandler;
|
||||||
|
|
||||||
|
class event_화륜차연구 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '화륜차 연구';
|
||||||
|
static protected $auxType = NationAuxKey::can_화륜차사용;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setNation(['gold','rice','aux']);
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
$name = static::$actionName;
|
||||||
|
|
||||||
|
$this->minConditionConstraints = [
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::ReqNationAuxValue(static::$auxType->value, 0, "<", 1, "{$name}가 이미 완료되었습니다."),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 23;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [100000, 100000];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if(!$this->hasFullConditionMet()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
|
$actionName = static::$actionName;
|
||||||
|
|
||||||
|
$aux = $this->nation['aux'];
|
||||||
|
$aux[static::$auxType->value] = 1;
|
||||||
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
|
$generalName = $general->getName();
|
||||||
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold' => $db->sqleval('gold - %i', $reqGold),
|
||||||
|
'rice' => $db->sqleval('rice - %i', $reqRice),
|
||||||
|
'aux' => Json::encode($aux),
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushGeneralHistoryLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>{$actionName}</> 완료");
|
||||||
|
|
||||||
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
|
StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg ?? []);
|
||||||
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\Command;
|
||||||
|
use sammo\Constraint\ConstraintHelper;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Enums\InheritanceKey;
|
||||||
|
use sammo\Enums\NationAuxKey;
|
||||||
|
use \sammo\Util;
|
||||||
|
use \sammo\JosaUtil;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\StaticEventHandler;
|
||||||
|
|
||||||
|
class event_화시병연구 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '화시병 연구';
|
||||||
|
static protected $auxType = NationAuxKey::can_화시병사용;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$this->setNation(['gold','rice','aux']);
|
||||||
|
$this->fullConditionConstraints=[];
|
||||||
|
|
||||||
|
$name = static::$actionName;
|
||||||
|
|
||||||
|
$this->minConditionConstraints = [
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::ReqNationAuxValue(static::$auxType->value, 0, "<", 1, "{$name}가 이미 완료되었습니다."),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [50000, 50000];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(\Sammo\RandUtil $rng):bool{
|
||||||
|
if(!$this->hasFullConditionMet()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
|
$actionName = static::$actionName;
|
||||||
|
|
||||||
|
$aux = $this->nation['aux'];
|
||||||
|
$aux[static::$auxType->value] = 1;
|
||||||
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
|
$generalName = $general->getName();
|
||||||
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold' => $db->sqleval('gold - %i', $reqGold),
|
||||||
|
'rice' => $db->sqleval('rice - %i', $reqRice),
|
||||||
|
'aux' => Json::encode($aux),
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushGeneralHistoryLog("<M>{$actionName}</> 완료");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>{$actionName}</> 완료");
|
||||||
|
|
||||||
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
|
StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg ?? []);
|
||||||
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -440,7 +440,7 @@ class GameUnitConst extends GameUnitConstBase
|
|||||||
[
|
[
|
||||||
91500, self::T_SIEGE, '화륜차',
|
91500, self::T_SIEGE, '화륜차',
|
||||||
300, 0, 5, 0, 0, 40, 5,
|
300, 0, 5, 0, 0, 40, 5,
|
||||||
[new ReqTech(5000), new ReqNationAux(NationAuxKey::did_특성초토화, '>=', 1), new ReqChief()],
|
[new ReqTech(5000), new ReqNationAux(NationAuxKey::did_특성초토화, '>=', 1), new ReqChief(), new ReqNationAux(NationAuxKey::can_화륜차사용, '==', 1)],
|
||||||
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.25, 1106=>1.112],
|
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.25, 1106=>1.112],
|
||||||
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2, 1106=>1.067],
|
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2, 1106=>1.067],
|
||||||
['불타는 바퀴로 적진을 붕괴시킵니다.'],
|
['불타는 바퀴로 적진을 붕괴시킵니다.'],
|
||||||
|
|||||||
Reference in New Issue
Block a user