Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d573e9f98a | ||
|
|
3ad16d96be | ||
|
|
d8870caf29 | ||
|
|
7c9d5d34f6 | ||
|
|
5268ce9b71 | ||
|
|
e395c98a6c | ||
|
|
d5897e2a49 | ||
|
|
c82003f982 | ||
|
|
5447274aa8 | ||
|
|
688162ffbf | ||
|
|
87294d5477 |
+3
-2
@@ -1669,8 +1669,6 @@ function tryUniqueItemLottery(RandUtil $rng, General $general, string $acquireTy
|
||||
$prob = 1 / ($genCount * $itemTypeCnt * 0.7 / 3); // 투표율 70%, 설문조사 한번에 2~3개 등장
|
||||
} else if ($acquireType == '랜덤 임관') {
|
||||
$prob = 1 / ($genCount * $itemTypeCnt / 10 / 2); // 랜임시 2개(10%) 등장(200명중 20명 랜임시도?)
|
||||
} else if ($acquireType == '건국') {
|
||||
$prob = 1 / ($genCount * $itemTypeCnt / 10 / 4); // 건국시 4개(20%) 등장(200명시 20국 정도 됨)
|
||||
}
|
||||
|
||||
$prob *= GameConst::$uniqueTrialCoef;
|
||||
@@ -1684,6 +1682,9 @@ function tryUniqueItemLottery(RandUtil $rng, General $general, string $acquireTy
|
||||
//포인트로 랜덤 유니크 획득
|
||||
$prob = 1;
|
||||
}
|
||||
else if ($acquireType == '건국') {
|
||||
$prob = 1; // 건국시 100%
|
||||
}
|
||||
|
||||
foreach (Util::range($maxCnt) as $_idx) {
|
||||
if ($rng->nextBool($prob)) {
|
||||
|
||||
@@ -481,6 +481,13 @@ function setNationCommand(int $generalID, array $turnList, string $command, ?arr
|
||||
}
|
||||
|
||||
_setNationCommand($commandObj, $turnList);
|
||||
|
||||
if($general->getNPCType() < 2){
|
||||
//유저장인 경우에는 턴 리필
|
||||
$general->updateVarWithLimit('killturn', $env['killturn'], $general->getVar('killturn'));
|
||||
$general->applyDB($db);
|
||||
}
|
||||
|
||||
return [
|
||||
'result'=>true,
|
||||
'brief'=>$commandObj->getBrief(),
|
||||
|
||||
+14
-2
@@ -24,9 +24,9 @@ $userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->cacheValues(['startyear', 'year', 'month', 'scenario']);
|
||||
$gameStor->cacheValues(['startyear', 'year', 'month', 'scenario', 'killturn']);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level,penalty from general where owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no,npc,nation,officer_level,penalty from general where owner=%i', $userID);
|
||||
$myOfficerLevel = $me['officer_level'];
|
||||
$nationID = $me['nation'];
|
||||
$myPenalty = Json::decode($me['penalty'] ?? '{}');
|
||||
@@ -342,6 +342,10 @@ if ($action == "임명") {
|
||||
'reason' => $result
|
||||
]);
|
||||
}
|
||||
//수뇌의 삭턴 리필
|
||||
$db->update('general', [
|
||||
'killturn' => $db->sqleval('GREATEST(%b, %i)', 'killturn', $gameStor->getValue('killturn')),
|
||||
], 'no=%i', $me['no']);
|
||||
Json::die([
|
||||
'result' => true,
|
||||
'reason' => 'success'
|
||||
@@ -356,6 +360,10 @@ if ($action == "임명") {
|
||||
'reason' => $result
|
||||
]);
|
||||
}
|
||||
//수뇌의 삭턴 리필
|
||||
$db->update('general', [
|
||||
'killturn' => $db->sqleval('GREATEST(%b, %i)', 'killturn', $gameStor->getValue('killturn')),
|
||||
], 'no=%i', $me['no']);
|
||||
Json::die([
|
||||
'result' => true,
|
||||
'reason' => 'success'
|
||||
@@ -376,6 +384,10 @@ if ($action == "추방") {
|
||||
'reason' => $result
|
||||
]);
|
||||
}
|
||||
//수뇌의 삭턴 리필
|
||||
$db->update('general', [
|
||||
'killturn' => $db->sqleval('GREATEST(%b, %i)', 'killturn', $gameStor->getValue('killturn')),
|
||||
], 'no=%i', $me['no']);
|
||||
Json::die([
|
||||
'result' => true,
|
||||
'reason' => 'success'
|
||||
|
||||
+10
-7
@@ -718,14 +718,17 @@ function ConquerCity(array $admin, General $general, array $city, array $defende
|
||||
$attackerLogger->pushGlobalHistoryLog("<M><b>【긴급천도】</b></><D><b>{$defenderNationName}</b></>{$josaYi} 수도가 함락되어 <G><b>$minCityName</b></>{$josaRo} 긴급천도하였습니다.");
|
||||
|
||||
$moveLog = "수도가 함락되어 <G><b>$minCityName</b></>{$josaRo} <M>긴급천도</>합니다.";
|
||||
//아국 수뇌부에게 로그 전달
|
||||
foreach ($db->queryFirstColumn(
|
||||
'SELECT no FROM general WHERE nation=%i AND officer_level>=5',
|
||||
foreach ($db->queryAllLists(
|
||||
'SELECT no, officer_level FROM general WHERE nation=%i',
|
||||
$defenderNationID
|
||||
) as $defenderChiefID) {
|
||||
$chiefLogger = new ActionLogger($defenderChiefID, $defenderNationID, $year, $month);
|
||||
$chiefLogger->pushGeneralActionLog($moveLog, ActionLogger::PLAIN);
|
||||
$chiefLogger->flush();
|
||||
) as [$defenderGeneralID, $defenderGeneralChiefLevel]) {
|
||||
$defenderLogger = new ActionLogger($defenderGeneralID, $defenderNationID, $year, $month);
|
||||
$defenderLogger->pushGeneralActionLog($moveLog, ActionLogger::PLAIN);
|
||||
if($defenderGeneralChiefLevel >= 5){
|
||||
$defenderLogger->pushGeneralActionLog("수뇌는 <G><b>{$minCityName}</b></>{$josaRo} 집합되었습니다.");
|
||||
}
|
||||
|
||||
$defenderLogger->flush();
|
||||
}
|
||||
|
||||
//천도
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\API\InheritAction;
|
||||
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Enums\RankColumn;
|
||||
use sammo\GameConst;
|
||||
use sammo\General;
|
||||
use sammo\KVStorage;
|
||||
use sammo\LiteHashDRBG;
|
||||
use sammo\RandUtil;
|
||||
use sammo\UniqueConst;
|
||||
use sammo\UserLogger;
|
||||
use sammo\Util;
|
||||
use sammo\Validator;
|
||||
|
||||
class ResetStat extends \sammo\BaseAPI
|
||||
{
|
||||
public function validateArgs(): ?string
|
||||
{
|
||||
$v = new Validator($this->args);
|
||||
$v->rule('required', [
|
||||
'leadership',
|
||||
'strength',
|
||||
'intel',
|
||||
])
|
||||
->rule('int', [
|
||||
'leadership',
|
||||
'strength',
|
||||
'intel',
|
||||
])
|
||||
->rule('min', [
|
||||
'leadership',
|
||||
'strength',
|
||||
'intel'
|
||||
], GameConst::$defaultStatMin)
|
||||
->rule('max', [
|
||||
'leadership',
|
||||
'strength',
|
||||
'intel'
|
||||
], GameConst::$defaultStatMax)
|
||||
->rule('integerArray', 'inheritBonusStat');
|
||||
|
||||
if (!$v->validate()) {
|
||||
return $v->errorStr();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getRequiredSessionMode(): int
|
||||
{
|
||||
//General.aux 쓰므로 lock;
|
||||
return static::REQ_GAME_LOGIN;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$userID = $session->userID;
|
||||
$generalID = $session->generalID;
|
||||
|
||||
|
||||
$leadership = $this->args['leadership'];
|
||||
$strength = $this->args['strength'];
|
||||
$intel = $this->args['intel'];
|
||||
$inheritBonusStat = $this->args['inheritBonusStat'] ?? null;
|
||||
|
||||
if ($leadership + $strength + $intel != GameConst::$defaultStatTotal) {
|
||||
return "능력치 총합이 " . GameConst::$defaultStatTotal . "이 아닙니다. 다시 입력해주세요!";
|
||||
}
|
||||
|
||||
if ($inheritBonusStat) {
|
||||
if (count($inheritBonusStat) != 3) {
|
||||
return "보너스 능력치가 잘못 지정되었습니다. 다시 입력해주세요!";
|
||||
}
|
||||
foreach ($inheritBonusStat as $stat) {
|
||||
if ($stat < 0) {
|
||||
return "보너스 능력치가 음수입니다. 다시 입력해주세요!";
|
||||
}
|
||||
}
|
||||
$sum = array_sum($inheritBonusStat);
|
||||
if ($sum == 0) {
|
||||
$inheritBonusStat = null;
|
||||
} else if ($sum < 3 || $sum > 5) {
|
||||
return "보너스 능력치 합이 잘못 지정되었습니다. 다시 입력해주세요!";
|
||||
}
|
||||
}
|
||||
|
||||
$general = General::createObjFromDB($generalID);
|
||||
if ($userID != $general->getVar('owner')) {
|
||||
return '로그인 상태가 이상합니다. 다시 로그인해 주세요.';
|
||||
}
|
||||
$userLogger = new UserLogger($userID);
|
||||
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->cacheValues([
|
||||
'isunited',
|
||||
'season',
|
||||
]);
|
||||
if ($gameStor->isunited) {
|
||||
return '이미 천하가 통일되었습니다.';
|
||||
}
|
||||
$userStor = KVStorage::getStorage($db, "user_{$userID}");
|
||||
|
||||
$lastUserStatReset = $userStor->getValue('last_stat_reset') ?? [];
|
||||
$gameSeason = $gameStor->getValue('season');
|
||||
|
||||
if (array_search($gameSeason, $lastUserStatReset) !== false) {
|
||||
return '이번 시즌에 이미 능력치를 초기화하셨습니다.';
|
||||
}
|
||||
|
||||
|
||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
||||
$reqAmount = 0;
|
||||
if ($inheritBonusStat !== null) {
|
||||
$reqAmount += GameConst::$inheritBornStatPoint;
|
||||
}
|
||||
|
||||
if ($previousPoint < $reqAmount) {
|
||||
return '충분한 유산 포인트를 가지고 있지 않습니다.';
|
||||
}
|
||||
|
||||
$userLogger->push("통솔 {$leadership}, 무력 {$strength}, 지력 {$intel} 스탯 재설정", "inheritPoint");
|
||||
|
||||
if ($inheritBonusStat) {
|
||||
$pleadership = $inheritBonusStat[0] ?? 0;
|
||||
$pstrength = $inheritBonusStat[1] ?? 0;
|
||||
$pintel = $inheritBonusStat[2] ?? 0;
|
||||
$userLogger->push("{$reqAmount}로 통솔 {$pleadership}, 무력 {$pstrength}, 지력 {$pintel} 보너스 능력치 적용", "inheritPoint");
|
||||
} else {
|
||||
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||
UniqueConst::$hiddenSeed,
|
||||
'ResetStat',
|
||||
$userID,
|
||||
)));
|
||||
$pleadership = 0;
|
||||
$pstrength = 0;
|
||||
$pintel = 0;
|
||||
foreach (Util::range($rng->nextRangeInt(3, 5)) as $statIdx) {
|
||||
switch ($rng->choiceUsingWeight([$leadership, $strength, $intel])) {
|
||||
case 0:
|
||||
$pleadership++;
|
||||
break;
|
||||
case 1:
|
||||
$pstrength++;
|
||||
break;
|
||||
case 2:
|
||||
$pintel++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$userLogger->push("통솔 {$pleadership}, 무력 {$pstrength}, 지력 {$pintel} 보너스 능력치 적용", "inheritPoint");
|
||||
}
|
||||
|
||||
$leadership += $pleadership;
|
||||
$strength += $pstrength;
|
||||
$intel += $pintel;
|
||||
|
||||
$lastUserStatReset[] = $gameSeason;
|
||||
|
||||
|
||||
$general->setVar('leadership', $leadership);
|
||||
$general->setVar('strength', $strength);
|
||||
$general->setVar('intel', $intel);
|
||||
|
||||
$userLogger->flush();
|
||||
|
||||
$inheritStor->setValue('previous', [$previousPoint - $reqAmount, null]);
|
||||
$userStor->setValue('last_stat_reset', $lastUserStatReset);
|
||||
$general->increaseRankVar(RankColumn::inherit_point_spent_dynamic, $reqAmount);
|
||||
$general->applyDB($db);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class che_병가 extends \sammo\BaseNation{
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function onCalcNationalIncome(string $type, $amount):int{
|
||||
public function onCalcNationalIncome(string $type, $amount){
|
||||
if($type == 'pop' && $amount > 0){
|
||||
return $amount * 0.8;
|
||||
}
|
||||
|
||||
@@ -202,6 +202,7 @@ class che_건국 extends Command\GeneralCommand
|
||||
refreshNationStaticInfo();
|
||||
|
||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||
$general->increaseInheritancePoint(InheritanceKey::unifier, 250);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국');
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
DB,
|
||||
Util,
|
||||
JosaUtil,
|
||||
General,
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
GameConst,
|
||||
GameUnitConst,
|
||||
LastTurn,
|
||||
Command
|
||||
};
|
||||
@@ -16,15 +20,18 @@ use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_사기진작 extends Command\GeneralCommand{
|
||||
class che_사기진작 extends Command\GeneralCommand
|
||||
{
|
||||
static protected $actionName = '사기진작';
|
||||
|
||||
protected function argTest():bool{
|
||||
protected function argTest(): bool
|
||||
{
|
||||
$this->arg = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function init(){
|
||||
protected function init()
|
||||
{
|
||||
|
||||
$general = $this->generalObj;
|
||||
|
||||
@@ -33,13 +40,13 @@ class che_사기진작 extends Command\GeneralCommand{
|
||||
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->minConditionConstraints=[
|
||||
$this->minConditionConstraints = [
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
];
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
$this->fullConditionConstraints = [
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
@@ -48,31 +55,35 @@ class che_사기진작 extends Command\GeneralCommand{
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
ConstraintHelper::ReqGeneralAtmosMargin(GameConst::$maxAtmosByCommand),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function getCommandDetailTitle():string{
|
||||
public function getCommandDetailTitle(): string
|
||||
{
|
||||
$name = $this->getName();
|
||||
//[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
return "{$name}(통솔경험, 자금↓)";
|
||||
}
|
||||
|
||||
public function getCost():array{
|
||||
public function getCost(): array
|
||||
{
|
||||
$general = $this->generalObj;
|
||||
return [Util::round($general->getVar('crew')/100), 0];
|
||||
return [Util::round($general->getVar('crew') / 100), 0];
|
||||
}
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
public function getPreReqTurn(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getPostReqTurn():int{
|
||||
public function getPostReqTurn(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function run(\Sammo\RandUtil $rng):bool{
|
||||
if(!$this->hasFullConditionMet()){
|
||||
public function run(\Sammo\RandUtil $rng): bool
|
||||
{
|
||||
if (!$this->hasFullConditionMet()) {
|
||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||
}
|
||||
|
||||
@@ -81,7 +92,11 @@ class che_사기진작 extends Command\GeneralCommand{
|
||||
$general = $this->generalObj;
|
||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||
|
||||
$score = Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$atmosDelta);
|
||||
$score = Util::clamp(
|
||||
Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$atmosDelta),
|
||||
0,
|
||||
Util::clamp(GameConst::$maxAtmosByCommand - $general->getVar('atmos'), 0),
|
||||
);
|
||||
$scoreText = number_format($score, 0);
|
||||
|
||||
$sideEffect = Util::valueFit(intval($general->getVar('train') * GameConst::$trainSideEffectByAtmosTurn), 0);
|
||||
@@ -93,7 +108,7 @@ class che_사기진작 extends Command\GeneralCommand{
|
||||
$exp = 100;
|
||||
$ded = 70;
|
||||
|
||||
$general->increaseVarWithLimit('atmos', $score, 0, GameConst::$maxAtmosByCommand);
|
||||
$general->increaseVar('atmos', $score);
|
||||
$general->setVar('train', $sideEffect);
|
||||
|
||||
$general->addDex($general->getCrewTypeObj(), $score, false);
|
||||
@@ -111,6 +126,4 @@ class che_사기진작 extends Command\GeneralCommand{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +74,15 @@ class che_화계 extends Command\GeneralCommand
|
||||
|
||||
$maxGenScore = 0;
|
||||
$probCorrection = 0;
|
||||
$affectGeneralCount = 0;
|
||||
foreach ($destCityGeneralList as $destGeneral) {
|
||||
/** @var General $destGeneral */
|
||||
if ($destGeneral->getNationID() != $destNationID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$affectGeneralCount++;
|
||||
|
||||
if ($statType === 'leadership') {
|
||||
$genScore = $destGeneral->getLeadership();
|
||||
} else if ($statType === 'strength') {
|
||||
@@ -95,7 +98,7 @@ class che_화계 extends Command\GeneralCommand
|
||||
|
||||
$prob = $maxGenScore / GameConst::$sabotageProbCoefByStat;
|
||||
$prob += $probCorrection;
|
||||
$prob += (log(count($destCityGeneralList) + 1, 2) - 1.25) * GameConst::$sabotageDefenceCoefByGeneralCnt;
|
||||
$prob += (log($affectGeneralCount + 1, 2) - 1.25) * GameConst::$sabotageDefenceCoefByGeneralCnt;
|
||||
|
||||
$prob += $destCity['secu'] / $destCity['secu_max'] / 5; //최대 20%p
|
||||
$prob += $destCity['supply'] ? 0.1 : 0;
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
DB,
|
||||
Util,
|
||||
JosaUtil,
|
||||
General,
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
GameConst,
|
||||
GameUnitConst,
|
||||
LastTurn,
|
||||
Command
|
||||
};
|
||||
@@ -17,66 +21,73 @@ use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
|
||||
class che_훈련 extends Command\GeneralCommand{
|
||||
class che_훈련 extends Command\GeneralCommand
|
||||
{
|
||||
static protected $actionName = '훈련';
|
||||
|
||||
protected function argTest():bool{
|
||||
protected function argTest(): bool
|
||||
{
|
||||
$this->arg = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function init(){
|
||||
protected function init()
|
||||
{
|
||||
|
||||
$general = $this->generalObj;
|
||||
|
||||
$this->setCity();
|
||||
$this->setNation();
|
||||
|
||||
$this->minConditionConstraints=[
|
||||
$this->minConditionConstraints = [
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
];
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
$this->fullConditionConstraints = [
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::ReqGeneralCrew(),
|
||||
ConstraintHelper::ReqGeneralTrainMargin(GameConst::$maxTrainByCommand),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function getCommandDetailTitle():string{
|
||||
public function getCommandDetailTitle(): string
|
||||
{
|
||||
$name = $this->getName();
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$title = "{$name}(통솔경험";
|
||||
if($reqGold > 0){
|
||||
if ($reqGold > 0) {
|
||||
$title .= ", 자금{$reqGold}";
|
||||
}
|
||||
if($reqRice > 0){
|
||||
if ($reqRice > 0) {
|
||||
$title .= ", 군량{$reqRice}";
|
||||
}
|
||||
$title .= ')';
|
||||
return $title;
|
||||
}
|
||||
|
||||
public function getCost():array{
|
||||
public function getCost(): array
|
||||
{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
public function getPreReqTurn(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getPostReqTurn():int{
|
||||
public function getPostReqTurn(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function run(\Sammo\RandUtil $rng):bool{
|
||||
if(!$this->hasFullConditionMet()){
|
||||
public function run(\Sammo\RandUtil $rng): bool
|
||||
{
|
||||
if (!$this->hasFullConditionMet()) {
|
||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||
}
|
||||
|
||||
@@ -85,7 +96,11 @@ class che_훈련 extends Command\GeneralCommand{
|
||||
$general = $this->generalObj;
|
||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||
|
||||
$score = Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$trainDelta);
|
||||
$score = Util::clamp(
|
||||
Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$trainDelta),
|
||||
0,
|
||||
Util::clamp(GameConst::$maxTrainByCommand - $general->getVar('train'), 0)
|
||||
);
|
||||
$scoreText = number_format($score, 0);
|
||||
|
||||
$sideEffect = Util::valueFit(intval($general->getVar('atmos') * GameConst::$atmosSideEffectByTraining), 0);
|
||||
@@ -97,7 +112,7 @@ class che_훈련 extends Command\GeneralCommand{
|
||||
$exp = 100;
|
||||
$ded = 70;
|
||||
|
||||
$general->increaseVarWithLimit('train', $score, 0, GameConst::$maxTrainByCommand);
|
||||
$general->increaseVar('train', $score);
|
||||
$general->setVar('atmos', $sideEffect);
|
||||
|
||||
$general->addDex($general->getCrewTypeObj(), $score, false);
|
||||
@@ -112,6 +127,4 @@ class che_훈련 extends Command\GeneralCommand{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+103
-2
@@ -172,6 +172,56 @@
|
||||
<BButton class="col-6 offset-6" variant="primary" @click="checkOwner"> 소유자 찾기 </BButton>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col col-lg-4 col-sm-6 col-12 py-2">
|
||||
<div class="row px-4">
|
||||
<div class="a-right col-6 align-self-center">능력치 초기화</div>
|
||||
<div class="col-6">
|
||||
<div class="row">기본 능력치</div>
|
||||
<div class="row">
|
||||
<div class="col col-2 center align-self-center">통</div>
|
||||
<div class="col col-10"><b-form-input v-model.number="resetStatArgs.leadership" type="number"
|
||||
:min="currentStat.statMin" :max="currentStat.statMax" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-2 center align-self-center">무</div>
|
||||
<div class="col col-10"><b-form-input v-model.number="resetStatArgs.strength" type="number"
|
||||
:min="currentStat.statMin" :max="currentStat.statMax" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-2 center align-self-center">지</div>
|
||||
<div class="col col-10"><b-form-input v-model.number="resetStatArgs.intel" type="number"
|
||||
:min="currentStat.statMin" :max="currentStat.statMax" /></div>
|
||||
</div>
|
||||
<div class="row">추가 능력치</div>
|
||||
<div class="row">
|
||||
<div class="col col-2 center align-self-center">통</div>
|
||||
<div class="col col-10"><b-form-input v-model.number="resetStatArgs.inheritBonusStat[0]" type="number"
|
||||
min="0" max="5" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-2 center align-self-center">무</div>
|
||||
<div class="col col-10"><b-form-input v-model.number="resetStatArgs.inheritBonusStat[1]" type="number"
|
||||
min="0" max="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-2 center align-self-center">지</div>
|
||||
<div class="col col-10"><b-form-input v-model.number="resetStatArgs.inheritBonusStat[2]" type="number"
|
||||
min="0" max="5" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="a-right">
|
||||
<small class="form-text text-muted">시즌 당 1회에 한 해 능력치를 초기화합니다. <br />
|
||||
</small>
|
||||
<span style="color: white">필요 포인트: {{ requiredResetStatPoint }}</span>
|
||||
</div>
|
||||
|
||||
<div class="row px-4">
|
||||
<BButton class="col-6 offset-6" variant="primary" @click="resetStat"> 능력치 초기화</BButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -224,6 +274,7 @@ declare const staticValues: {
|
||||
nextSpecial: number;
|
||||
minSpecificUnique: number;
|
||||
checkOwner: number;
|
||||
bornStatPoint: number;
|
||||
};
|
||||
resetTurnTimeLevel: number;
|
||||
resetSpecialWarLevel: number;
|
||||
@@ -246,16 +297,23 @@ declare const staticValues: {
|
||||
}
|
||||
>;
|
||||
availableTargetGeneral: Record<number, string>;
|
||||
currentStat: {
|
||||
leadership: number;
|
||||
strength: number;
|
||||
intel: number;
|
||||
statMax: number;
|
||||
statMin: number;
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref } from "vue";
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import "@scss/game_bg.scss";
|
||||
import TopBackBar from "@/components/TopBackBar.vue";
|
||||
import _ from "lodash-es";
|
||||
import NumberInputWithInfo from "@/components/NumberInputWithInfo.vue";
|
||||
import { SammoAPI } from "./SammoAPI";
|
||||
import type { inheritBuffType, InheritPointLogItem } from "./defs/API/InheritAction";
|
||||
import { InheritResetStat, type inheritBuffType, type InheritPointLogItem } from "./defs/API/InheritAction";
|
||||
import * as JosaUtil from "@/util/JosaUtil";
|
||||
import { BButton } from "bootstrap-vue-next";
|
||||
import { unwrap } from "./util/unwrap";
|
||||
@@ -389,12 +447,20 @@ const {
|
||||
availableSpecialWar,
|
||||
availableUnique,
|
||||
availableTargetGeneral,
|
||||
currentStat
|
||||
} = staticValues;
|
||||
|
||||
const nextSpecialWar = ref(Object.keys(availableSpecialWar)[0]);
|
||||
const specificUnique = ref<string | null>(null);
|
||||
const specificUniqueAmount = ref(inheritActionCost.minSpecificUnique);
|
||||
|
||||
const resetStatArgs = reactive<Required<Pick<InheritResetStat, 'inheritBonusStat'>> & InheritResetStat>({
|
||||
leadership: currentStat.leadership,
|
||||
strength: currentStat.strength,
|
||||
intel: currentStat.intel,
|
||||
inheritBonusStat: [0, 0, 0]
|
||||
});
|
||||
|
||||
const lastLogID = ref(Math.min(...staticValues.lastInheritPointLogs.map((v) => v.id)));
|
||||
const inheritPointLogs = ref(
|
||||
(() => {
|
||||
@@ -608,6 +674,41 @@ async function checkOwner(): Promise<void> {
|
||||
|
||||
}
|
||||
|
||||
const requiredResetStatPoint = ref(0);
|
||||
|
||||
watch(resetStatArgs, (value) => {
|
||||
const bonusStat = value.inheritBonusStat.reduce((acc, v) => acc + v, 0);
|
||||
requiredResetStatPoint.value = bonusStat > 0 ? inheritActionCost.bornStatPoint : 0;
|
||||
})
|
||||
|
||||
|
||||
async function resetStat(): Promise<void> {
|
||||
const statArg: InheritResetStat = {
|
||||
leadership: resetStatArgs.leadership,
|
||||
strength: resetStatArgs.strength,
|
||||
intel: resetStatArgs.intel,
|
||||
};
|
||||
|
||||
if (resetStatArgs.inheritBonusStat.some(v => v > 0)) {
|
||||
statArg.inheritBonusStat = resetStatArgs.inheritBonusStat;
|
||||
}
|
||||
|
||||
if (!confirm(`능력치를 초기화 하시겠습니까? 시즌마다 한번만 가능합니다. 필요 포인트: ${requiredResetStatPoint.value}`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await SammoAPI.InheritAction.ResetStat(statArg);
|
||||
alert('초기화 되었습니다.');
|
||||
location.reload();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert(`실패했습니다: ${e}`);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function getMoreLog(): Promise<void> {
|
||||
try {
|
||||
const result = await SammoAPI.InheritAction.GetMoreLog({
|
||||
|
||||
+2
-1
@@ -17,7 +17,7 @@ import { APIPathGen, NumVar, StrVar } from "./util/APIPathGen.js";
|
||||
import type { BettingDetailResponse, BettingListResponse } from "./defs/API/Betting";
|
||||
import type { ReserveBulkCommandResponse, ReserveCommandResponse, ReservedCommandResponse } from "./defs/API/Command";
|
||||
import type { ChiefResponse } from "./defs/API/NationCommand";
|
||||
import type { inheritBuffType, InheritLogResponse } from "./defs/API/InheritAction";
|
||||
import type { inheritBuffType, InheritLogResponse, InheritResetStat } from "./defs/API/InheritAction";
|
||||
import type { SetBlockWarResponse, GeneralListResponse as NationGeneralListResponse, NationInfoResponse } from "./defs/API/Nation";
|
||||
import type { UploadImageResponse } from "./defs/API/Misc";
|
||||
import type { GeneralLogType, GetGeneralLogResponse, JoinArgs } from "./defs/API/General";
|
||||
@@ -183,6 +183,7 @@ const apiRealPath = {
|
||||
CheckOwner: PUT as APICallT<{
|
||||
destGeneralID: number;
|
||||
}>,
|
||||
ResetStat: PUT as APICallT<InheritResetStat>,
|
||||
},
|
||||
Message: {
|
||||
DeleteMessage: PATCH as APICallT<{
|
||||
|
||||
@@ -22,3 +22,10 @@ export type InheritPointLogItem = {
|
||||
export type InheritLogResponse = ValidResponse & {
|
||||
log: InheritPointLogItem[];
|
||||
};
|
||||
|
||||
export type InheritResetStat = {
|
||||
leadership: number;
|
||||
strength: number;
|
||||
intel: number;
|
||||
inheritBonusStat?: [number, number, number];
|
||||
};
|
||||
@@ -99,11 +99,19 @@ $lastInheritPointLogs = $db->query('SELECT id, server_id, year, month, date, tex
|
||||
'nextSpecial' => GameConst::$inheritSpecificSpecialPoint,
|
||||
'minSpecificUnique' => GameConst::$inheritItemUniqueMinPoint,
|
||||
'checkOwner' => GameConst::$inheritCheckOwnerPoint,
|
||||
'bornStatPoint' => GameConst::$inheritBornStatPoint,
|
||||
],
|
||||
'availableSpecialWar' => $avilableSpecialWar,
|
||||
'availableUnique' => $availableUnique,
|
||||
'lastInheritPointLogs' => $lastInheritPointLogs,
|
||||
'availableTargetGeneral' => $availableTargetGeneral,
|
||||
'currentStat' => [
|
||||
'leadership' => Util::clamp($me->getVar('leadership'), GameConst::$defaultStatMin, GameConst::$defaultStatMax),
|
||||
'strength' => Util::clamp($me->getVar('strength'), GameConst::$defaultStatMin, GameConst::$defaultStatMax),
|
||||
'intel' => Util::clamp($me->getVar('intel'), GameConst::$defaultStatMin, GameConst::$defaultStatMax),
|
||||
'statMin' => GameConst::$defaultStatMin,
|
||||
'statMax' => GameConst::$defaultStatMax,
|
||||
]
|
||||
]
|
||||
]) ?>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user