요양 헌납 추가
This commit is contained in:
@@ -1333,32 +1333,6 @@ function process_49(&$general) {
|
|||||||
pushGenLog($general, $log);
|
pushGenLog($general, $log);
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_50(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$month = $gameStor->month;
|
|
||||||
|
|
||||||
$log[] = "<C>●</>{$month}월:건강 회복을 위해 요양합니다. <1>$date</>";
|
|
||||||
// 경험치 상승 // 공헌도, 명성 상승
|
|
||||||
$exp = 10;
|
|
||||||
$ded = 7;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
$query = "update general set resturn='SUCCESS',injury='0',dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_99(&$general) {
|
function process_99(&$general) {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\GeneralCommand;
|
||||||
|
|
||||||
|
use \sammo\{
|
||||||
|
DB, Util, JosaUtil,
|
||||||
|
General,
|
||||||
|
ActionLogger,
|
||||||
|
GameConst, GameUnitConst,
|
||||||
|
LastTurn,
|
||||||
|
Command
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
use function \sammo\{
|
||||||
|
uniqueItemEx
|
||||||
|
};
|
||||||
|
|
||||||
|
use \sammo\Constraint\Constraint;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class che_요양 extends Command\GeneralCommand{
|
||||||
|
static protected $actionName = '요양';
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
|
||||||
|
$general = $this->generalObj;
|
||||||
|
|
||||||
|
$this->setCity();
|
||||||
|
$this->setNation();
|
||||||
|
|
||||||
|
$this->runnableConstraints=[
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
$this->arg = null;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run():bool{
|
||||||
|
if(!$this->isRunnable()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$date = substr($general->getVar('turntime'),11,5);
|
||||||
|
|
||||||
|
|
||||||
|
$crew = $general->getVar('crew');
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("건강 회복을 위해 요양합니다. <1>$date</>");
|
||||||
|
|
||||||
|
$exp = 10;
|
||||||
|
$ded = 7;
|
||||||
|
|
||||||
|
$exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp);
|
||||||
|
$ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded);
|
||||||
|
|
||||||
|
$general->setVar('injury', 0);
|
||||||
|
$general->increaseVar('experience', $exp);
|
||||||
|
$general->increaseVar('dedication', $ded);
|
||||||
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\GeneralCommand;
|
||||||
|
|
||||||
|
use \sammo\{
|
||||||
|
DB, Util, JosaUtil,
|
||||||
|
General,
|
||||||
|
ActionLogger,
|
||||||
|
GameConst,
|
||||||
|
LastTurn,
|
||||||
|
GameUnitConst,
|
||||||
|
Command
|
||||||
|
};
|
||||||
|
|
||||||
|
use function \sammo\{
|
||||||
|
getDomesticExpLevelBonus,
|
||||||
|
CriticalRatioDomestic,
|
||||||
|
CriticalScoreEx,
|
||||||
|
uniqueItemEx
|
||||||
|
};
|
||||||
|
|
||||||
|
use \sammo\Constraint\Constraint;
|
||||||
|
|
||||||
|
|
||||||
|
class che_헌납 extends Command\GeneralCommand{
|
||||||
|
static protected $actionName = '헌납';
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
|
||||||
|
$general = $this->generalObj;
|
||||||
|
|
||||||
|
$this->setCity();
|
||||||
|
$this->setNation();
|
||||||
|
|
||||||
|
$this->runnableConstraints=[
|
||||||
|
['NoNeutral'],
|
||||||
|
['OccupiedCity'],
|
||||||
|
['SuppliedCity'],
|
||||||
|
];
|
||||||
|
if($this->arg['isGold']){
|
||||||
|
$this->runnableConstraints[] = ['ReqGeneralGold', 1];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->runnableConstraints[] = ['ReqGeneralRice', 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
if(!key_exists('isGold', $this->arg)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!key_exists('amount', $this->arg)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$isGold = $this->arg['isGold'];
|
||||||
|
$amount = $this->arg['amount'];
|
||||||
|
if(!is_int($amount)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($amount < 100){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($amount > 10000){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$amount = (int)$amount;
|
||||||
|
if(!is_bool($isGold)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->arg = [
|
||||||
|
'isGold'=>$isGold,
|
||||||
|
'amount'=>$amount
|
||||||
|
];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run():bool{
|
||||||
|
if(!$this->isRunnable()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$date = substr($general->getVar('turntime'),11,5);
|
||||||
|
|
||||||
|
$isGold = $this->arg['isGold'];
|
||||||
|
$amount = $this->arg['amount'];
|
||||||
|
$resKey = $isGold?'gold':'rice';
|
||||||
|
$resName = $isGold?'금':'쌀';
|
||||||
|
|
||||||
|
$amount = Util::valueFit($amount, $general->getVar($resKey));
|
||||||
|
$amountText = number_format($amount, 0);
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
$resourceKey=>$db->sqleval('%b + %i', $reKey, $amount)
|
||||||
|
], 'nation=%i', $general->getNationID());
|
||||||
|
|
||||||
|
$general->increaseVarWithLimit($resourceKey, -$amount, 0);
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("{$resName} <C>$amountText</>을 헌납했습니다. <1>$date</>");
|
||||||
|
|
||||||
|
$exp = 70;
|
||||||
|
$ded = 100;
|
||||||
|
|
||||||
|
$exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp);
|
||||||
|
$ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded);
|
||||||
|
|
||||||
|
$general->increaseVar('experience', $exp);
|
||||||
|
$general->increaseVar('dedication', $ded);
|
||||||
|
$general->increaseVar('leader2', 1);
|
||||||
|
|
||||||
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user