fix: 은퇴 시 숙련 포인트를 지나치게 많이 받는 문제 수정

This commit is contained in:
2021-09-06 02:30:00 +09:00
parent 9e68bc90c2
commit 3ef363a01e
2 changed files with 102 additions and 95 deletions
+15 -8
View File
@@ -654,7 +654,7 @@ function updateNationState()
} }
$score *= $trialCnt; $score *= $trialCnt;
$uniqueLotteryWeightList[$nationGen->getID()] = [$nationGen, $score]; $uniqueLotteryWeightList[$nationGen->getID()] = [$nationGen, $score];
} }
@@ -745,7 +745,7 @@ function checkStatistic()
]; ];
$avgGeneral = $db->queryFirstRow( $avgGeneral = $db->queryFirstRow(
'SELECT avg(gold) as avggold, avg(rice) as avgrice, avg(dex1+dex2+dex3+dex4) as avgdex, 'SELECT avg(gold) as avggold, avg(rice) as avgrice, avg(dex1+dex2+dex3+dex4) as avgdex,
max(dex1+dex2+dex3+dex4) as maxdex, avg(experience+dedication) as avgexpded, max(experience+dedication) as maxexpded max(dex1+dex2+dex3+dex4) as maxdex, avg(experience+dedication) as avgexpded, max(experience+dedication) as maxexpded
FROM general' FROM general'
); );
@@ -1022,8 +1022,8 @@ function checkEmperior()
$nation['generals'] = $nationGenerals; $nation['generals'] = $nationGenerals;
$tigers = $db->query( $tigers = $db->query(
'SELECT value, name 'SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
WHERE rank_data.nation_id = %i AND rank_data.type = "killnum" AND value > 0 ORDER BY value DESC LIMIT 5', WHERE rank_data.nation_id = %i AND rank_data.type = "killnum" AND value > 0 ORDER BY value DESC LIMIT 5',
$nationID $nationID
); // 오호장군 ); // 오호장군
@@ -1034,8 +1034,8 @@ function checkEmperior()
}, $tigers)); }, $tigers));
$eagles = $db->query( $eagles = $db->query(
'SELECT value, name 'SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7', WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7',
$nationID $nationID
); // 건안칠자 ); // 건안칠자
@@ -1150,10 +1150,17 @@ function checkEmperior()
LogHistory(); LogHistory();
} }
function resetInheritanceUser(int $userID){ function resetInheritanceUser(int $userID, bool $isRebirth=false){
$rebirthDegraded = [
'dex'=>0.5,
];
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$userID}"); $inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$userID}");
$totalPoint = 0; $totalPoint = 0;
foreach($inheritStor->getAll() as [$value,]){ foreach($inheritStor->getAll() as $key=>[$value,]){
if(key_exists($key, $rebirthDegraded)){
$value *= $rebirthDegraded[$key];
}
$totalPoint += $value; $totalPoint += $value;
} }
$totalPoint = Util::toInt($totalPoint); $totalPoint = Util::toInt($totalPoint);
+87 -87
View File
@@ -46,7 +46,7 @@ class General implements iAction{
'tsw'=>1, 'tsd'=>1, 'tsl'=>1, 'tsg'=>1, 'tsp'=>1, 'tsw'=>1, 'tsd'=>1, 'tsl'=>1, 'tsg'=>1, 'tsp'=>1,
'tiw'=>1, 'tid'=>1, 'til'=>1, 'tig'=>1, 'tip'=>1, 'tiw'=>1, 'tid'=>1, 'til'=>1, 'tig'=>1, 'tip'=>1,
'betwin'=>1, 'betgold'=>1, 'betwingold'=>1, 'betwin'=>1, 'betgold'=>1, 'betwingold'=>1,
'killcrew_person'=>1, 'deathcrew_person'=>1, 'killcrew_person'=>1, 'deathcrew_person'=>1,
'occupied'=>1, 'occupied'=>1,
]; ];
@@ -102,7 +102,7 @@ class General implements iAction{
if($nation === null){ if($nation === null){
$nation = getNationStaticInfo($raw['nation']); $nation = getNationStaticInfo($raw['nation']);
} }
$this->raw = $raw; $this->raw = $raw;
$this->rawCity = $city; $this->rawCity = $city;
@@ -131,7 +131,7 @@ class General implements iAction{
$this->specialWarObj = buildGeneralSpecialWarClass($raw['special2']); $this->specialWarObj = buildGeneralSpecialWarClass($raw['special2']);
$this->personalityObj = buildPersonalityClass($raw['personal']); $this->personalityObj = buildPersonalityClass($raw['personal']);
$this->itemObjs['horse'] = buildItemClass($raw['horse']); $this->itemObjs['horse'] = buildItemClass($raw['horse']);
$this->itemObjs['weapon'] = buildItemClass($raw['weapon']); $this->itemObjs['weapon'] = buildItemClass($raw['weapon']);
$this->itemObjs['book'] = buildItemClass($raw['book']); $this->itemObjs['book'] = buildItemClass($raw['book']);
@@ -140,9 +140,9 @@ class General implements iAction{
function initLogger(int $year, int $month){ function initLogger(int $year, int $month){
$this->logger = new ActionLogger( $this->logger = new ActionLogger(
$this->getVar('no'), $this->getVar('no'),
$this->getVar('nation'), $this->getVar('nation'),
$year, $year,
$month, $month,
false false
); );
@@ -330,10 +330,10 @@ class General implements iAction{
} }
/** /**
* @param General[] $generalList * @param General[] $generalList
* @param int $turnIdxFrom [$turnIdxFrom, $turnIdxTo) * @param int $turnIdxFrom [$turnIdxFrom, $turnIdxTo)
* @param int $turnIdxTo [$turnIdxFrom, $turnIdxTo) * @param int $turnIdxTo [$turnIdxFrom, $turnIdxTo)
* @param array $env * @param array $env
* @return GeneralCommand[] * @return GeneralCommand[]
*/ */
public function getReservedTurnList(int $turnIdxFrom, int $turnIdxTo, array $env){ public function getReservedTurnList(int $turnIdxFrom, int $turnIdxTo, array $env){
@@ -346,9 +346,9 @@ class General implements iAction{
} }
$db = DB::db(); $db = DB::db();
$generalID = $this->getID(); $generalID = $this->getID();
$result = []; $result = [];
$rawCmds = $db->queryFirstRow('SELECT * FROM general_turn WHERE general_id = %i AND %i <= turn_idx AND turn_idx < %i ORDER BY turn_idx ASC', $generalID, $turnIdxFrom, $turnIdxTo); $rawCmds = $db->queryFirstRow('SELECT * FROM general_turn WHERE general_id = %i AND %i <= turn_idx AND turn_idx < %i ORDER BY turn_idx ASC', $generalID, $turnIdxFrom, $turnIdxTo);
@@ -359,23 +359,23 @@ class General implements iAction{
} }
return $result; return $result;
} }
foreach($rawCmds as $turnIdx=>$rawCmd){ foreach($rawCmds as $turnIdx=>$rawCmd){
$result[$turnIdx] = buildGeneralCommandClass($rawCmd['action'], $this, $env, Json::decode($rawCmd['arg']??null)); $result[$turnIdx] = buildGeneralCommandClass($rawCmd['action'], $this, $env, Json::decode($rawCmd['arg']??null));
} }
return $result; return $result;
} }
/** /**
* 장수의 스탯을 계산해옴 * 장수의 스탯을 계산해옴
* *
* @param string $statName 스탯값, leadership, strength, intel 가능 * @param string $statName 스탯값, leadership, strength, intel 가능
* @param bool $withInjury 부상값 사용 여부 * @param bool $withInjury 부상값 사용 여부
* @param bool $withIActionObj 아이템, 특성, 성격 등 보정치 적용 여부 * @param bool $withIActionObj 아이템, 특성, 성격 등 보정치 적용 여부
* @param bool $withStatAdjust 능력치간 보정 사용 여부 * @param bool $withStatAdjust 능력치간 보정 사용 여부
* @param bool $useFloor 내림 사용 여부, false시 float 값을 반환할 수도 있음 * @param bool $useFloor 내림 사용 여부, false시 float 값을 반환할 수도 있음
* *
* @return int|float 계산된 능력치 * @return int|float 계산된 능력치
*/ */
@@ -416,7 +416,7 @@ class General implements iAction{
$statValue = $actionObj->onCalcStat($this, $statName, $statValue); $statValue = $actionObj->onCalcStat($this, $statName, $statValue);
} }
} }
foreach($this->itemObjs as $actionObj){ foreach($this->itemObjs as $actionObj){
if($actionObj !== null){ if($actionObj !== null){
$statValue = $actionObj->onCalcStat($this, $statName, $statValue); $statValue = $actionObj->onCalcStat($this, $statName, $statValue);
@@ -429,7 +429,7 @@ class General implements iAction{
if($useFloor){ if($useFloor){
return Util::toInt($statValue); return Util::toInt($statValue);
} }
return $statValue; return $statValue;
} }
@@ -486,7 +486,7 @@ class General implements iAction{
if($affectTrigger){ if($affectTrigger){
$experience = $this->onCalcStat($this, 'experience', $experience); $experience = $this->onCalcStat($this, 'experience', $experience);
} }
$this->increaseVar('experience', $experience); $this->increaseVar('experience', $experience);
$nextExpLevel = getExpLevel($this->getVar('experience')); $nextExpLevel = getExpLevel($this->getVar('experience'));
$comp = $nextExpLevel <=> $this->getVar('explevel'); $comp = $nextExpLevel <=> $this->getVar('explevel');
@@ -503,14 +503,14 @@ class General implements iAction{
else{ else{
$this->getLogger()->pushGeneralActionLog("<C>Lv {$nextExpLevel}</>{$josaRo} <R>레벨다운</>!", ActionLogger::PLAIN); $this->getLogger()->pushGeneralActionLog("<C>Lv {$nextExpLevel}</>{$josaRo} <R>레벨다운</>!", ActionLogger::PLAIN);
} }
} }
function addDedication(float $dedication, bool $affectTrigger=true){ function addDedication(float $dedication, bool $affectTrigger=true){
if($affectTrigger){ if($affectTrigger){
$dedication = $this->onCalcStat($this, 'dedication', $dedication); $dedication = $this->onCalcStat($this, 'dedication', $dedication);
} }
$this->increaseVar('dedication', $dedication); $this->increaseVar('dedication', $dedication);
$nextDedLevel = getDedLevel($this->getVar('dedication')); $nextDedLevel = getDedLevel($this->getVar('dedication'));
$comp = $nextDedLevel <=> $this->getVar('dedlevel'); $comp = $nextDedLevel <=> $this->getVar('dedlevel');
@@ -530,7 +530,7 @@ class General implements iAction{
else{ else{
$this->getLogger()->pushGeneralActionLog("<Y>{$dedLevelText}</>{$josaRoDed} <R>강등</>되어 봉록이 <C>{$billText}</>{$josaRoBill} <R>하락</>했습니다!", ActionLogger::PLAIN); $this->getLogger()->pushGeneralActionLog("<Y>{$dedLevelText}</>{$josaRoDed} <R>강등</>되어 봉록이 <C>{$billText}</>{$josaRoBill} <R>하락</>했습니다!", ActionLogger::PLAIN);
} }
} }
function updateVar(string $key, $value){ function updateVar(string $key, $value){
@@ -583,7 +583,7 @@ class General implements iAction{
$dyingMessageObj = new TextDecoration\DyingMessage($this); $dyingMessageObj = new TextDecoration\DyingMessage($this);
$logger->pushGlobalActionLog($dyingMessageObj->getText()); $logger->pushGlobalActionLog($dyingMessageObj->getText());
} }
$logger->flush(); $logger->flush();
} }
$db->update('select_pool', [ $db->update('select_pool', [
@@ -611,7 +611,7 @@ class General implements iAction{
$ownerID = $this->getVar('owner'); $ownerID = $this->getVar('owner');
if($ownerID){ if($ownerID){
$this->mergeTotalInheritancePoint(); $this->mergeTotalInheritancePoint();
resetInheritanceUser($ownerID); resetInheritanceUser($ownerID, true);
} }
$this->multiplyVarWithLimit('leadership', 0.85, 10); $this->multiplyVarWithLimit('leadership', 0.85, 10);
@@ -701,7 +701,7 @@ class General implements iAction{
$this->setVar('last_turn', $this->getResultTurn()->toJson()); $this->setVar('last_turn', $this->getResultTurn()->toJson());
} }
$updateVals = $this->getUpdatedValues(); $updateVals = $this->getUpdatedValues();
$generalID = $this->getID(); $generalID = $this->getID();
$result = false; $result = false;
@@ -726,7 +726,7 @@ class General implements iAction{
} }
$result = true; $result = true;
} }
if($this->rankVarSet){ if($this->rankVarSet){
foreach($this->rankVarSet as $rankKey => $rankVal){ foreach($this->rankVarSet as $rankKey => $rankVal){
$db->update('rank_data', [ $db->update('rank_data', [
@@ -736,7 +736,7 @@ class General implements iAction{
} }
$result = true; $result = true;
} }
$this->rankVarIncrease = []; $this->rankVarIncrease = [];
$this->rankVarSet = []; $this->rankVarSet = [];
@@ -779,14 +779,14 @@ class General implements iAction{
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{ public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
$caller = new GeneralTriggerCaller(); $caller = new GeneralTriggerCaller();
foreach(array_merge([ foreach(array_merge([
$this->nationType, $this->nationType,
$this->officerLevelObj, $this->officerLevelObj,
$this->specialDomesticObj, $this->specialDomesticObj,
$this->specialWarObj, $this->specialWarObj,
$this->personalityObj, $this->personalityObj,
$this->getCrewTypeObj(), $this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){ ], $this->itemObjs) as $iObj){
if(!$iObj){ if(!$iObj){
continue; continue;
} }
@@ -798,11 +798,11 @@ class General implements iAction{
} }
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
foreach(array_merge([ foreach(array_merge([
$this->nationType, $this->nationType,
$this->officerLevelObj, $this->officerLevelObj,
$this->specialDomesticObj, $this->specialDomesticObj,
$this->specialWarObj, $this->specialWarObj,
$this->personalityObj, $this->personalityObj,
$this->getCrewTypeObj(), $this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){ ], $this->itemObjs) as $iObj){
if(!$iObj){ if(!$iObj){
@@ -817,11 +817,11 @@ class General implements iAction{
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
//xxx: $general? //xxx: $general?
foreach(array_merge([ foreach(array_merge([
$this->nationType, $this->nationType,
$this->officerLevelObj, $this->officerLevelObj,
$this->specialDomesticObj, $this->specialDomesticObj,
$this->specialWarObj, $this->specialWarObj,
$this->personalityObj, $this->personalityObj,
$this->getCrewTypeObj(), $this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){ ], $this->itemObjs) as $iObj){
if(!$iObj){ if(!$iObj){
@@ -835,11 +835,11 @@ class General implements iAction{
public function onCalcStrategic(string $turnType, string $varType, $value){ public function onCalcStrategic(string $turnType, string $varType, $value){
foreach(array_merge([ foreach(array_merge([
$this->nationType, $this->nationType,
$this->officerLevelObj, $this->officerLevelObj,
$this->specialDomesticObj, $this->specialDomesticObj,
$this->specialWarObj, $this->specialWarObj,
$this->personalityObj, $this->personalityObj,
$this->getCrewTypeObj(), $this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){ ], $this->itemObjs) as $iObj){
if(!$iObj){ if(!$iObj){
@@ -853,11 +853,11 @@ class General implements iAction{
public function onCalcNationalIncome(string $type, $amount){ public function onCalcNationalIncome(string $type, $amount){
foreach(array_merge([ foreach(array_merge([
$this->nationType, $this->nationType,
$this->officerLevelObj, $this->officerLevelObj,
$this->specialDomesticObj, $this->specialDomesticObj,
$this->specialWarObj, $this->specialWarObj,
$this->personalityObj, $this->personalityObj,
$this->getCrewTypeObj(), $this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){ ], $this->itemObjs) as $iObj){
if(!$iObj){ if(!$iObj){
@@ -874,11 +874,11 @@ class General implements iAction{
$att = 1; $att = 1;
$def = 1; $def = 1;
foreach(array_merge([ foreach(array_merge([
$this->nationType, $this->nationType,
$this->officerLevelObj, $this->officerLevelObj,
$this->specialDomesticObj, $this->specialDomesticObj,
$this->specialWarObj, $this->specialWarObj,
$this->personalityObj, $this->personalityObj,
$this->getCrewTypeObj(), $this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){ ], $this->itemObjs) as $iObj){
if(!$iObj){ if(!$iObj){
@@ -894,11 +894,11 @@ class General implements iAction{
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
$caller = new WarUnitTriggerCaller(); $caller = new WarUnitTriggerCaller();
foreach(array_merge([ foreach(array_merge([
$this->nationType, $this->nationType,
$this->officerLevelObj, $this->officerLevelObj,
$this->specialDomesticObj, $this->specialDomesticObj,
$this->specialWarObj, $this->specialWarObj,
$this->personalityObj, $this->personalityObj,
$this->getCrewTypeObj(), $this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){ ], $this->itemObjs) as $iObj){
if(!$iObj){ if(!$iObj){
@@ -921,11 +921,11 @@ class General implements iAction{
new WarUnitTrigger\che_계략실패($unit) new WarUnitTrigger\che_계략실패($unit)
); );
foreach(array_merge([ foreach(array_merge([
$this->nationType, $this->nationType,
$this->officerLevelObj, $this->officerLevelObj,
$this->specialDomesticObj, $this->specialDomesticObj,
$this->specialWarObj, $this->specialWarObj,
$this->personalityObj, $this->personalityObj,
$this->getCrewTypeObj(), $this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){ ], $this->itemObjs) as $iObj){
if(!$iObj){ if(!$iObj){
@@ -946,8 +946,8 @@ class General implements iAction{
'horse', 'weapon', 'book', 'item', 'last_turn' 'horse', 'weapon', 'book', 'item', 'last_turn'
]; ];
$fullColumn = [ $fullColumn = [
'no', 'name', 'owner', 'owner_name', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity', 'no', 'name', 'owner', 'owner_name', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity',
'leadership', 'leadership_exp', 'strength', 'strength_exp', 'intel', 'intel_exp', 'weapon', 'book', 'horse', 'item', 'leadership', 'leadership_exp', 'strength', 'strength_exp', 'intel', 'intel_exp', 'weapon', 'book', 'horse', 'item',
'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime',
'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong', 'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong',
'personal', 'special', 'special2', 'defence_train', 'tnmt', 'npc', 'npc_org', 'deadyear', 'npcmsg', 'personal', 'special', 'special2', 'defence_train', 'tnmt', 'npc', 'npc_org', 'deadyear', 'npcmsg',
@@ -979,17 +979,17 @@ class General implements iAction{
} }
/** /**
* @param ?int[] $generalIDList * @param ?int[] $generalIDList
* @param null|string[] $column * @param null|string[] $column
* @param int $constructMode * @param int $constructMode
* @return \sammo\General[] * @return \sammo\General[]
* @throws MustNotBeReachedException * @throws MustNotBeReachedException
*/ */
static public function createGeneralObjListFromDB(?array $generalIDList, ?array $column=null, int $constructMode=2):array{ static public function createGeneralObjListFromDB(?array $generalIDList, ?array $column=null, int $constructMode=2):array{
if($generalIDList === []){ if($generalIDList === []){
return []; return [];
} }
$db = DB::db(); $db = DB::db();
if($constructMode > 0){ if($constructMode > 0){
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
@@ -999,7 +999,7 @@ class General implements iAction{
$year = null; $year = null;
$month = null; $month = null;
} }
[$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode); [$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode);
if($generalIDList === null){ if($generalIDList === null){
@@ -1015,7 +1015,7 @@ class General implements iAction{
'no' 'no'
); );
} }
$rawRanks = []; $rawRanks = [];
if($rankColumn){ if($rankColumn){
@@ -1043,7 +1043,7 @@ class General implements iAction{
} }
$result[$generalID] = new static($rawGenerals[$generalID], $rawRanks[$generalID]??null, null, null, $year, $month, $constructMode > 1); $result[$generalID] = new static($rawGenerals[$generalID], $rawRanks[$generalID]??null, null, null, $year, $month, $constructMode > 1);
} }
return $result; return $result;
} }
@@ -1057,7 +1057,7 @@ class General implements iAction{
$year = null; $year = null;
$month = null; $month = null;
} }
[$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode); [$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode);
$rawGeneral = $db->queryFirstRow('SELECT %l FROM general WHERE no = %i', Util::formatListOfBackticks($column), $generalID); $rawGeneral = $db->queryFirstRow('SELECT %l FROM general WHERE no = %i', Util::formatListOfBackticks($column), $generalID);
@@ -1072,17 +1072,17 @@ class General implements iAction{
$rawRankValues[$rankType] = $rankValue; $rawRankValues[$rankType] = $rankValue;
} }
} }
$general = new static($rawGeneral, $rawRankValues, null, null, $year, $month, $constructMode > 1); $general = new static($rawGeneral, $rawRankValues, null, null, $year, $month, $constructMode > 1);
return $general; return $general;
} }
/** /**
* @param General[] $generalList * @param General[] $generalList
* @param int $turnIdx * @param int $turnIdx
* @param array $env * @param array $env
* @return GeneralCommand[] * @return GeneralCommand[]
*/ */
static public function getReservedTurnByGeneralList(array $generalList, int $turnIdx, array $env){ static public function getReservedTurnByGeneralList(array $generalList, int $turnIdx, array $env){
@@ -1110,10 +1110,10 @@ class General implements iAction{
} }
/** /**
* @param General[] $generalList * @param General[] $generalList
* @param int $turnIdxFrom [$turnIdxFrom, $turnIdxTo) * @param int $turnIdxFrom [$turnIdxFrom, $turnIdxTo)
* @param int $turnIdxTo [$turnIdxFrom, $turnIdxTo) * @param int $turnIdxTo [$turnIdxFrom, $turnIdxTo)
* @param array $env * @param array $env
* @return GeneralCommand[][] * @return GeneralCommand[][]
*/ */
static public function getReservedTurnListByGeneralList(array $generalList, int $turnIdxFrom, int $turnIdxTo, array $env){ static public function getReservedTurnListByGeneralList(array $generalList, int $turnIdxFrom, int $turnIdxTo, array $env){
@@ -1135,7 +1135,7 @@ class General implements iAction{
}, $generalList); }, $generalList);
$db = DB::db(); $db = DB::db();
$rawCmds = $db->queryFirstRow('SELECT * FROM general_turn WHERE general_id IN %i AND %i <= turn_idx AND turn_idx < %i ORDER BY general_id ASC, turn_idx ASC', $generalIDList, $turnIdxFrom, $turnIdxTo); $rawCmds = $db->queryFirstRow('SELECT * FROM general_turn WHERE general_id IN %i AND %i <= turn_idx AND turn_idx < %i ORDER BY general_id ASC, turn_idx ASC', $generalIDList, $turnIdxFrom, $turnIdxTo);
$orderedRawCmds = []; $orderedRawCmds = [];
foreach($rawCmds as $rawCmd){ foreach($rawCmds as $rawCmd){
@@ -1224,7 +1224,7 @@ class General implements iAction{
$extractFn = function() use ($multiplier){ $extractFn = function() use ($multiplier){
$betWin = $this->getRankVar('betwin'); $betWin = $this->getRankVar('betwin');
$betWinRate = $this->getRankVar('betwingold')/max(1, $this->getRankVar('betgold')); $betWinRate = $this->getRankVar('betwingold')/max(1, $this->getRankVar('betgold'));
return [$betWin * $multiplier * pow($betWinRate, 2), null]; return [$betWin * $multiplier * pow($betWinRate, 2), null];
}; };
break; break;
@@ -1272,7 +1272,7 @@ class General implements iAction{
if($gameStor->isunited != 0){ if($gameStor->isunited != 0){
return; return;
} }
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}"); $inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}");
$inheritStor->setValue($key, [$value, $aux]); $inheritStor->setValue($key, [$value, $aux]);
} }