fix: 유니크를 얻는 턴이 아니더라도 환불은 하도록 수정
This commit is contained in:
+13
-6
@@ -1286,12 +1286,11 @@ function addAge()
|
||||
$generalAux = Json::decode($general['aux']);
|
||||
|
||||
$updateVars = [];
|
||||
if(key_exists('inheritSpecificSpecialWar', $generalAux)){
|
||||
if (key_exists('inheritSpecificSpecialWar', $generalAux)) {
|
||||
$special2 = $generalAux['inheritSpecificSpecialWar'];
|
||||
unset($generalAux['inheritSpecificSpecialWar']);
|
||||
$updateVars['aux'] = Json::encode($generalAux);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$special2 = SpecialityHelper::pickSpecialWar(
|
||||
$general,
|
||||
($generalAux['prev_types_special2']) ?? []
|
||||
@@ -1666,7 +1665,12 @@ function rollbackInheritUniqueTrial(General $general, string $itemKey, string $r
|
||||
$general->applyDB($db);
|
||||
}
|
||||
|
||||
function tryInheritUniqueItem(General $general, string $acquireType = '아이템'): bool
|
||||
function tryRollbackInheritUniqueItem(General $general): void
|
||||
{
|
||||
tryInheritUniqueItem($general, 'Rollback', true);
|
||||
}
|
||||
|
||||
function tryInheritUniqueItem(General $general, string $acquireType = '아이템', bool $justRollback = false): bool
|
||||
{
|
||||
$ownerID = $general->getVar('owner');
|
||||
if (!$ownerID) {
|
||||
@@ -1769,6 +1773,9 @@ function tryInheritUniqueItem(General $general, string $acquireType = '아이템
|
||||
if ($ownTarget === null) {
|
||||
return false;
|
||||
}
|
||||
if ($justRollback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LogText("선택유니크획득{$ownerID}", $ownTarget);
|
||||
|
||||
@@ -1859,9 +1866,9 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
|
||||
$result = false;
|
||||
|
||||
$prob /= sqrt(2);
|
||||
$moreProb = pow(2, 1/4);
|
||||
$moreProb = pow(2, 1 / 4);
|
||||
|
||||
if($general->getAuxVar('inheritRandomUnique')){
|
||||
if ($general->getAuxVar('inheritRandomUnique')) {
|
||||
//포인트로 랜덤 유니크 획득
|
||||
$prob = 1;
|
||||
LogText("{$general->getName()}, {$general->getID()} 유산 포인트 유니크", $prob);
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace sammo\Command\General;
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
General,
|
||||
CityConst,
|
||||
CityConst,
|
||||
ActionLogger,
|
||||
LastTurn,
|
||||
Command
|
||||
@@ -13,6 +13,7 @@ use \sammo\{
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
class che_NPC능동 extends Command\GeneralCommand{
|
||||
static protected $actionName = 'NPC능동';
|
||||
@@ -46,7 +47,7 @@ class che_NPC능동 extends Command\GeneralCommand{
|
||||
|
||||
$general = $this->generalObj;
|
||||
$this->setNation();
|
||||
|
||||
|
||||
|
||||
$this->permissionConstraints=[
|
||||
ConstraintHelper::MustBeNPC()
|
||||
@@ -65,7 +66,7 @@ class che_NPC능동 extends Command\GeneralCommand{
|
||||
public function getCost():array{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
return 0;
|
||||
}
|
||||
@@ -97,11 +98,11 @@ class che_NPC능동 extends Command\GeneralCommand{
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
}
|
||||
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -14,6 +14,8 @@ use \sammo\{
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
class che_모반시도 extends Command\GeneralCommand{
|
||||
static protected $actionName = '모반시도';
|
||||
|
||||
@@ -29,7 +31,7 @@ class che_모반시도 extends Command\GeneralCommand{
|
||||
|
||||
$this->setCity();
|
||||
$this->setNation();
|
||||
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::BeChief(),
|
||||
@@ -43,7 +45,7 @@ class che_모반시도 extends Command\GeneralCommand{
|
||||
public function getCost():array{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
return 0;
|
||||
}
|
||||
@@ -72,7 +74,7 @@ class che_모반시도 extends Command\GeneralCommand{
|
||||
$lordName = $lordGeneral->getName();
|
||||
|
||||
$nationName = $this->nation['name'];
|
||||
|
||||
|
||||
$logger = $general->getLogger();
|
||||
$lordLogger = $lordGeneral->getLogger();
|
||||
|
||||
@@ -82,7 +84,7 @@ class che_모반시도 extends Command\GeneralCommand{
|
||||
$lordGeneral->setVar('officer_city', 0);
|
||||
$lordGeneral->multiplyVar('experience', 0.7);
|
||||
|
||||
|
||||
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
$logger->pushGlobalHistoryLog("<Y><b>【모반】</b></><Y>{$generalName}</>{$josaYi} <D><b>{$nationName}</b></>의 군주 자리를 찬탈했습니다.");
|
||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <Y>{$lordName}</>에게서 군주자리를 찬탈");
|
||||
@@ -95,11 +97,12 @@ class che_모반시도 extends Command\GeneralCommand{
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
$lordGeneral->applyDB($db);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
General,
|
||||
General,
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
LastTurn,
|
||||
@@ -15,7 +15,7 @@ use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
use function sammo\DeleteConflict;
|
||||
use function sammo\refreshNationStaticInfo;
|
||||
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
class che_방랑 extends Command\GeneralCommand{
|
||||
static protected $actionName = '방랑';
|
||||
@@ -34,7 +34,7 @@ class che_방랑 extends Command\GeneralCommand{
|
||||
$this->setNation();
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
ConstraintHelper::BeLord(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
@@ -48,7 +48,7 @@ class che_방랑 extends Command\GeneralCommand{
|
||||
public function getCost():array{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
return 0;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ class che_방랑 extends Command\GeneralCommand{
|
||||
$logger->pushGlobalHistoryLog("<R><b>【방랑】</b></><D><b>{$generalName}</b></>{$josaUn} <R>방랑</>의 길을 떠납니다.");
|
||||
$logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>{$josaUl} 버리고 방랑");
|
||||
|
||||
|
||||
|
||||
//분쟁기록 모두 지움
|
||||
DeleteConflict($nationID);
|
||||
// 국명, 색깔 바꿈 국가 레벨 0, 성향리셋, 기술0
|
||||
@@ -123,6 +123,7 @@ class che_방랑 extends Command\GeneralCommand{
|
||||
refreshNationStaticInfo();
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -20,6 +20,7 @@ use function\sammo\tryUniqueItemLottery;
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
class che_선양 extends Command\GeneralCommand
|
||||
{
|
||||
@@ -136,6 +137,7 @@ class che_선양 extends Command\GeneralCommand
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
$destGeneral->applyDB($db);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
General,
|
||||
General,
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
LastTurn,
|
||||
@@ -13,6 +13,8 @@ use \sammo\{
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
class che_소집해제 extends Command\GeneralCommand{
|
||||
static protected $actionName = '소집해제';
|
||||
|
||||
@@ -27,7 +29,7 @@ class che_소집해제 extends Command\GeneralCommand{
|
||||
|
||||
$this->setCity();
|
||||
$this->setNation();
|
||||
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
ConstraintHelper::ReqGeneralCrew(),
|
||||
];
|
||||
@@ -43,7 +45,7 @@ class che_소집해제 extends Command\GeneralCommand{
|
||||
public function getCost():array{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
return 0;
|
||||
}
|
||||
@@ -70,7 +72,7 @@ class che_소집해제 extends Command\GeneralCommand{
|
||||
|
||||
$exp = 70;
|
||||
$ded = 100;
|
||||
|
||||
|
||||
$db->update('city', [
|
||||
'pop'=>$db->sqleval('pop + %i', $crew)
|
||||
], 'city=%i', $general->getCityID());
|
||||
@@ -80,10 +82,11 @@ class che_소집해제 extends Command\GeneralCommand{
|
||||
$general->addDedication($ded);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
General,
|
||||
General,
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
LastTurn,
|
||||
@@ -13,7 +13,7 @@ use \sammo\{
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
class che_요양 extends Command\GeneralCommand{
|
||||
static protected $actionName = '요양';
|
||||
@@ -28,7 +28,7 @@ class che_요양 extends Command\GeneralCommand{
|
||||
$general = $this->generalObj;
|
||||
|
||||
$this->setNation();
|
||||
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
];
|
||||
|
||||
@@ -37,7 +37,7 @@ class che_요양 extends Command\GeneralCommand{
|
||||
public function getCost():array{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
return 0;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class che_요양 extends Command\GeneralCommand{
|
||||
$general = $this->generalObj;
|
||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||
|
||||
|
||||
|
||||
$crew = $general->getVar('crew');
|
||||
|
||||
$logger = $general->getLogger();
|
||||
@@ -71,10 +71,11 @@ class che_요양 extends Command\GeneralCommand{
|
||||
$general->addDedication($ded);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ use \sammo\Json;
|
||||
|
||||
use function \sammo\searchDistance;
|
||||
use function \sammo\printCitiesBasedOnDistance;
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
@@ -217,6 +218,7 @@ class che_첩보 extends Command\GeneralCommand
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
General,
|
||||
General,
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
LastTurn,
|
||||
@@ -14,7 +14,7 @@ use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
|
||||
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
class che_하야 extends Command\GeneralCommand{
|
||||
static protected $actionName = '하야';
|
||||
@@ -32,7 +32,7 @@ class che_하야 extends Command\GeneralCommand{
|
||||
$this->setNation();
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotOpeningPart($relYear),
|
||||
@@ -43,7 +43,7 @@ class che_하야 extends Command\GeneralCommand{
|
||||
public function getCost():array{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
return 0;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ class che_하야 extends Command\GeneralCommand{
|
||||
|
||||
$nationID = $this->nation['nation'];
|
||||
$nationName = $this->nation['name'];
|
||||
|
||||
|
||||
$logger = $general->getLogger();
|
||||
|
||||
$logger->pushGeneralActionLog("<D><b>{$nationName}</b></>에서 하야했습니다. <1>$date</>");
|
||||
@@ -101,13 +101,14 @@ class che_하야 extends Command\GeneralCommand{
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->setVar('belong', 0);
|
||||
$general->setVar('makelimit', 12);
|
||||
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
General,
|
||||
General,
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
LastTurn,
|
||||
@@ -16,13 +16,12 @@ use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
use function sammo\refreshNationStaticInfo;
|
||||
use function sammo\deleteNation;
|
||||
|
||||
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
class che_해산 extends Command\GeneralCommand{
|
||||
static protected $actionName = '해산';
|
||||
|
||||
protected function argTest():bool{
|
||||
protected function argTest():bool{
|
||||
$this->arg = [];
|
||||
|
||||
return true;
|
||||
@@ -45,7 +44,7 @@ class che_해산 extends Command\GeneralCommand{
|
||||
public function getCost():array{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
return 0;
|
||||
}
|
||||
@@ -96,11 +95,11 @@ class che_해산 extends Command\GeneralCommand{
|
||||
$oldGeneral->setVar('makelimit', 12);
|
||||
$oldGeneral->applyDB($db);
|
||||
}
|
||||
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ use \sammo\Command;
|
||||
|
||||
use function \sammo\searchDistance;
|
||||
use function \sammo\printCitiesBasedOnDistance;
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
@@ -294,6 +295,7 @@ class che_화계 extends Command\GeneralCommand
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
return false;
|
||||
}
|
||||
@@ -327,6 +329,7 @@ class che_화계 extends Command\GeneralCommand
|
||||
$general->increaseRankVar('firenum', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -7,9 +7,11 @@ use \sammo\JosaUtil;
|
||||
use \sammo\LastTurn;
|
||||
use \sammo\DB;
|
||||
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
|
||||
class 휴식 extends Command\GeneralCommand{
|
||||
static protected $actionName = '휴식';
|
||||
|
||||
|
||||
protected function argTest():bool{
|
||||
return true;
|
||||
}
|
||||
@@ -39,7 +41,7 @@ class 휴식 extends Command\GeneralCommand{
|
||||
$logger->pushGeneralActionLog("아무것도 실행하지 않았습니다. <1>$date</>");
|
||||
|
||||
$this->setResultTurn(new LastTurn());
|
||||
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB(DB::db());
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user