refac: 유산 포인트 파트를 별도의 Manager로 분리, enum 적용

This commit is contained in:
2022-05-08 04:40:36 +09:00
parent f7776d5067
commit eff79c4778
35 changed files with 463 additions and 345 deletions
+3 -1
View File
@@ -14,6 +14,8 @@ use \sammo\{
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\InheritanceKey;
use function sammo\refreshNationStaticInfo;
use function sammo\getAllNationStaticInfo;
use function sammo\tryUniqueItemLottery;
@@ -162,7 +164,7 @@ class che_거병 extends Command\GeneralCommand{
$exp = 100;
$ded = 100;
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$general->addExperience($exp);
$general->addDedication($ded);
$general->setVar('belong', 1);
+3 -1
View File
@@ -19,6 +19,8 @@ use function \sammo\getAllNationStaticInfo;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\InheritanceKey;
use function sammo\buildNationTypeClass;
use function sammo\refreshNationStaticInfo;
use function sammo\GetNationColors;
@@ -188,7 +190,7 @@ class che_건국 extends Command\GeneralCommand
refreshNationStaticInfo();
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
tryUniqueItemLottery($general, '건국');
@@ -18,7 +18,7 @@ use function \sammo\getNationStaticInfo;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\Enums\InheritanceKey;
class che_등용수락 extends Command\GeneralCommand{
static protected $actionName = '등용 수락';
@@ -194,7 +194,7 @@ class che_등용수락 extends Command\GeneralCommand{
}
$db->update('nation', $setScoutNationValues, 'nation=%i', $destNationID);
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$general->setVar('permission', 'normal');
$general->setVar('belong', 1);
$general->setVar('officer_level', 1);
@@ -19,6 +19,7 @@ use function \sammo\tryUniqueItemLottery;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\InheritanceKey;
use sammo\MustNotBeReachedException;
@@ -285,7 +286,7 @@ class che_랜덤임관 extends Command\GeneralCommand
$general->setAuxVar('joinedNations', $joinedNations);
}
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$general->addExperience($exp);
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
@@ -13,6 +13,7 @@ use \sammo\{
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\Enums\InheritanceKey;
use function sammo\tryRollbackInheritUniqueItem;
@@ -96,7 +97,7 @@ class che_모반시도 extends Command\GeneralCommand{
$lordLogger->pushGeneralHistoryLog("<D><b>{$generalName}</b></>의 모반으로 인해 <D><b>{$nationName}</b></>의 군주자리를 박탈당함");
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$general->checkStatChange();
tryRollbackInheritUniqueItem($general);
$general->applyDB($db);
+3 -1
View File
@@ -13,6 +13,8 @@ use \sammo\{
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\InheritanceKey;
use function sammo\DeleteConflict;
use function sammo\refreshNationStaticInfo;
use function sammo\tryRollbackInheritUniqueItem;
@@ -121,7 +123,7 @@ class che_방랑 extends Command\GeneralCommand{
], 'me=%i OR you=%i', $nationID, $nationID);
refreshNationStaticInfo();
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
tryRollbackInheritUniqueItem($general);
$general->applyDB($db);
+2 -1
View File
@@ -19,6 +19,7 @@ use function\sammo\tryUniqueItemLottery;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\Enums\InheritanceKey;
use function sammo\tryRollbackInheritUniqueItem;
@@ -135,7 +136,7 @@ class che_선양 extends Command\GeneralCommand
$logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>의 군주자리를 <Y>{$destGeneralName}</>에게 선양");
$destLogger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>의 군주자리를 물려 받음");
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
tryRollbackInheritUniqueItem($general);
@@ -17,7 +17,7 @@ use function \sammo\pickGeneralFromPool;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\Enums\InheritanceKey;
class che_인재탐색 extends Command\GeneralCommand
{
@@ -210,7 +210,7 @@ class che_인재탐색 extends Command\GeneralCommand
$exp = 200;
$ded = 300;
$general->increaseInheritancePoint('active_action', Util::valueFit(sqrt(1 / $foundProp), 1));
$general->increaseInheritancePoint(InheritanceKey::active_action, Util::valueFit(sqrt(1 / $foundProp), 1));
$general->increaseVarWithLimit('gold', -$reqGold, 0);
$general->increaseVarWithLimit('rice', -$reqRice, 0);
$general->addExperience($exp);
+2 -3
View File
@@ -23,8 +23,7 @@ use function \sammo\getNationStaticInfo;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\InheritanceKey;
class che_임관 extends Command\GeneralCommand
{
@@ -183,7 +182,7 @@ class che_임관 extends Command\GeneralCommand
$general->setAuxVar('joinedNations', $joinedNations);
}
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$general->addExperience($exp);
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
@@ -21,6 +21,7 @@ use function \sammo\getNationStaticInfo;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\InheritanceKey;
class che_장수대상임관 extends Command\GeneralCommand{
static protected $actionName = '장수를 따라 임관';
@@ -175,7 +176,7 @@ class che_장수대상임관 extends Command\GeneralCommand{
$general->setAuxVar('joinedNations', $joinedNations);
}
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$general->addExperience($exp);
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
+2 -3
View File
@@ -20,8 +20,7 @@ use function sammo\tryRollbackInheritUniqueItem;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\InheritanceKey;
class che_첩보 extends Command\GeneralCommand
{
@@ -211,7 +210,7 @@ class che_첩보 extends Command\GeneralCommand
$ded = Util::randRangeInt(1, 70);
[$reqGold, $reqRice] = $this->getCost();
$general->increaseInheritancePoint('active_action', 0.5);//NOTE: 첩보만 예외!
$general->increaseInheritancePoint(InheritanceKey::active_action, 0.5);//NOTE: 첩보만 예외!
$general->increaseVarWithLimit('gold', -$reqGold, 0);
$general->increaseVarWithLimit('rice', -$reqRice, 0);
$general->addExperience($exp);
+2 -1
View File
@@ -19,6 +19,7 @@ use function \sammo\processWar;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\InheritanceKey;
class che_출병 extends Command\GeneralCommand
{
@@ -226,7 +227,7 @@ class che_출병 extends Command\GeneralCommand
$general->addDex($general->getCrewTypeObj(), $general->getVar('crew') / 100);
if($general->getVar('crew') > 500 && $general->getVar('train') * $general->getVar('atmos') > 70 * 70){
//500명 이상, 모훈출, 모사출
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
}
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
+2 -1
View File
@@ -13,6 +13,7 @@ use \sammo\{
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\InheritanceKey;
use function sammo\tryRollbackInheritUniqueItem;
@@ -113,7 +114,7 @@ class che_하야 extends Command\GeneralCommand{
}
$general->setVar('troop', 0);
$general->increaseInheritancePoint('active_action', 1);
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();