Squashed commit of the following:

commit 3ef363a01e
Author: hide_d <hided62@gmail.com>
Date:   Mon Sep 6 02:30:00 2021 +0900

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

commit 9e68bc90c2
Author: hide_d <hided62@gmail.com>
Date:   Mon Sep 6 02:17:56 2021 +0900

    재야에서 도시보기 warning

commit d2590607c2
Author: hide_d <hided62@gmail.com>
Date:   Sun Sep 5 23:05:06 2021 +0900

    fix: div 0

commit 2bce6e4f02
Author: hide_d <hided62@gmail.com>
Date:   Sun Sep 5 23:02:52 2021 +0900

    warning 메시지 수정

commit e64812da72
Author: hide_d <hided62@gmail.com>
Date:   Sat Sep 4 03:42:09 2021 +0900

    fix: m장, 의병장 숙련이 설정되지 않는 버그 수정

commit 7cd40fca03
Author: hide_d <hided62@gmail.com>
Date:   Sat Aug 21 16:04:03 2021 +0900

    fix: 모병/징병에서 조건 검사부 통솔 계산값

commit d1568a3b2c
Author: hide_d <hided62@gmail.com>
Date:   Sat Aug 21 02:50:54 2021 +0900

    허보에 수몰이 같이 들어간 버그 수정

commit e7dcc84afc
Author: hide_d <hided62@gmail.com>
Date:   Thu Aug 19 14:51:50 2021 +0900

    REAMDME.md 버전 수정

commit 8eaa940d4e
Author: hide_d <hided62@gmail.com>
Date:   Wed Aug 18 20:40:37 2021 +0900

    Revert "fix: 7.2에서 오동작 버그 수정"

    This reverts commit 9997675b1d.

commit 9997675b1d
Author: hide_d <hided62@gmail.com>
Date:   Wed Aug 18 20:32:47 2021 +0900

    fix: 7.2에서 오동작 버그 수정

commit 9ef566f11f
Author: hide_d <hided62@gmail.com>
Date:   Wed Aug 18 20:26:31 2021 +0900

    fix: 아이템중 WarActivateSkill 관련 중첩 해제 버그 수정
This commit is contained in:
2021-09-09 00:53:35 +09:00
parent 6bf09ff6da
commit c59019f5f7
14 changed files with 254 additions and 233 deletions
+87 -87
View File
@@ -46,7 +46,7 @@ class General implements iAction{
'tsw'=>1, 'tsd'=>1, 'tsl'=>1, 'tsg'=>1, 'tsp'=>1,
'tiw'=>1, 'tid'=>1, 'til'=>1, 'tig'=>1, 'tip'=>1,
'betwin'=>1, 'betgold'=>1, 'betwingold'=>1,
'killcrew_person'=>1, 'deathcrew_person'=>1,
'killcrew_person'=>1, 'deathcrew_person'=>1,
'occupied'=>1,
];
@@ -102,7 +102,7 @@ class General implements iAction{
if($nation === null){
$nation = getNationStaticInfo($raw['nation']);
}
$this->raw = $raw;
$this->rawCity = $city;
@@ -131,7 +131,7 @@ class General implements iAction{
$this->specialWarObj = buildGeneralSpecialWarClass($raw['special2']);
$this->personalityObj = buildPersonalityClass($raw['personal']);
$this->itemObjs['horse'] = buildItemClass($raw['horse']);
$this->itemObjs['weapon'] = buildItemClass($raw['weapon']);
$this->itemObjs['book'] = buildItemClass($raw['book']);
@@ -140,9 +140,9 @@ class General implements iAction{
function initLogger(int $year, int $month){
$this->logger = new ActionLogger(
$this->getVar('no'),
$this->getVar('nation'),
$year,
$this->getVar('no'),
$this->getVar('nation'),
$year,
$month,
false
);
@@ -330,10 +330,10 @@ class General implements iAction{
}
/**
* @param General[] $generalList
* @param General[] $generalList
* @param int $turnIdxFrom [$turnIdxFrom, $turnIdxTo)
* @param int $turnIdxTo [$turnIdxFrom, $turnIdxTo)
* @param array $env
* @param array $env
* @return GeneralCommand[]
*/
public function getReservedTurnList(int $turnIdxFrom, int $turnIdxTo, array $env){
@@ -346,9 +346,9 @@ class General implements iAction{
}
$db = DB::db();
$generalID = $this->getID();
$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);
@@ -359,23 +359,23 @@ class General implements iAction{
}
return $result;
}
foreach($rawCmds as $turnIdx=>$rawCmd){
$result[$turnIdx] = buildGeneralCommandClass($rawCmd['action'], $this, $env, Json::decode($rawCmd['arg']??null));
}
return $result;
}
/**
* 장수의 스탯을 계산해옴
*
*
* @param string $statName 스탯값, leadership, strength, intel 가능
* @param bool $withInjury 부상값 사용 여부
* @param bool $withIActionObj 아이템, 특성, 성격 등 보정치 적용 여부
* @param bool $withStatAdjust 능력치간 보정 사용 여부
* @param bool $useFloor 내림 사용 여부, false시 float 값을 반환할 수도 있음
*
*
* @return int|float 계산된 능력치
*/
@@ -416,7 +416,7 @@ class General implements iAction{
$statValue = $actionObj->onCalcStat($this, $statName, $statValue);
}
}
foreach($this->itemObjs as $actionObj){
if($actionObj !== null){
$statValue = $actionObj->onCalcStat($this, $statName, $statValue);
@@ -429,7 +429,7 @@ class General implements iAction{
if($useFloor){
return Util::toInt($statValue);
}
return $statValue;
}
@@ -486,7 +486,7 @@ class General implements iAction{
if($affectTrigger){
$experience = $this->onCalcStat($this, 'experience', $experience);
}
$this->increaseVar('experience', $experience);
$nextExpLevel = getExpLevel($this->getVar('experience'));
$comp = $nextExpLevel <=> $this->getVar('explevel');
@@ -503,14 +503,14 @@ class General implements iAction{
else{
$this->getLogger()->pushGeneralActionLog("<C>Lv {$nextExpLevel}</>{$josaRo} <R>레벨다운</>!", ActionLogger::PLAIN);
}
}
function addDedication(float $dedication, bool $affectTrigger=true){
if($affectTrigger){
$dedication = $this->onCalcStat($this, 'dedication', $dedication);
}
$this->increaseVar('dedication', $dedication);
$nextDedLevel = getDedLevel($this->getVar('dedication'));
$comp = $nextDedLevel <=> $this->getVar('dedlevel');
@@ -530,7 +530,7 @@ class General implements iAction{
else{
$this->getLogger()->pushGeneralActionLog("<Y>{$dedLevelText}</>{$josaRoDed} <R>강등</>되어 봉록이 <C>{$billText}</>{$josaRoBill} <R>하락</>했습니다!", ActionLogger::PLAIN);
}
}
function updateVar(string $key, $value){
@@ -583,7 +583,7 @@ class General implements iAction{
$dyingMessageObj = new TextDecoration\DyingMessage($this);
$logger->pushGlobalActionLog($dyingMessageObj->getText());
}
$logger->flush();
$logger->flush();
}
$db->update('select_pool', [
@@ -611,7 +611,7 @@ class General implements iAction{
$ownerID = $this->getVar('owner');
if($ownerID){
$this->mergeTotalInheritancePoint();
resetInheritanceUser($ownerID);
resetInheritanceUser($ownerID, true);
}
$this->multiplyVarWithLimit('leadership', 0.85, 10);
@@ -701,7 +701,7 @@ class General implements iAction{
$this->setVar('last_turn', $this->getResultTurn()->toJson());
}
$updateVals = $this->getUpdatedValues();
$generalID = $this->getID();
$result = false;
@@ -726,7 +726,7 @@ class General implements iAction{
}
$result = true;
}
if($this->rankVarSet){
foreach($this->rankVarSet as $rankKey => $rankVal){
$db->update('rank_data', [
@@ -736,7 +736,7 @@ class General implements iAction{
}
$result = true;
}
$this->rankVarIncrease = [];
$this->rankVarSet = [];
@@ -779,14 +779,14 @@ class General implements iAction{
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
$caller = new GeneralTriggerCaller();
foreach(array_merge([
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){
if(!$iObj){
continue;
}
@@ -798,11 +798,11 @@ class General implements iAction{
}
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
foreach(array_merge([
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){
if(!$iObj){
@@ -817,11 +817,11 @@ class General implements iAction{
public function onCalcStat(General $general, string $statName, $value, $aux=null){
//xxx: $general?
foreach(array_merge([
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){
if(!$iObj){
@@ -835,11 +835,11 @@ class General implements iAction{
public function onCalcStrategic(string $turnType, string $varType, $value){
foreach(array_merge([
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){
if(!$iObj){
@@ -853,11 +853,11 @@ class General implements iAction{
public function onCalcNationalIncome(string $type, $amount){
foreach(array_merge([
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){
if(!$iObj){
@@ -874,11 +874,11 @@ class General implements iAction{
$att = 1;
$def = 1;
foreach(array_merge([
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){
if(!$iObj){
@@ -894,11 +894,11 @@ class General implements iAction{
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
$caller = new WarUnitTriggerCaller();
foreach(array_merge([
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){
if(!$iObj){
@@ -921,11 +921,11 @@ class General implements iAction{
new WarUnitTrigger\che_계략실패($unit)
);
foreach(array_merge([
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->nationType,
$this->officerLevelObj,
$this->specialDomesticObj,
$this->specialWarObj,
$this->personalityObj,
$this->getCrewTypeObj(),
], $this->itemObjs) as $iObj){
if(!$iObj){
@@ -946,8 +946,8 @@ class General implements iAction{
'horse', 'weapon', 'book', 'item', 'last_turn'
];
$fullColumn = [
'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',
'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',
'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime',
'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong',
'personal', 'special', 'special2', 'defence_train', 'tnmt', 'npc', 'npc_org', 'deadyear', 'npcmsg',
@@ -979,17 +979,17 @@ class General implements iAction{
}
/**
* @param ?int[] $generalIDList
* @param null|string[] $column
* @param int $constructMode
* @param ?int[] $generalIDList
* @param null|string[] $column
* @param int $constructMode
* @return \sammo\General[]
* @throws MustNotBeReachedException
* @throws MustNotBeReachedException
*/
static public function createGeneralObjListFromDB(?array $generalIDList, ?array $column=null, int $constructMode=2):array{
if($generalIDList === []){
return [];
}
$db = DB::db();
if($constructMode > 0){
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -999,7 +999,7 @@ class General implements iAction{
$year = null;
$month = null;
}
[$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode);
if($generalIDList === null){
@@ -1015,7 +1015,7 @@ class General implements iAction{
'no'
);
}
$rawRanks = [];
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);
}
return $result;
}
@@ -1057,7 +1057,7 @@ class General implements iAction{
$year = null;
$month = null;
}
[$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode);
$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;
}
}
$general = new static($rawGeneral, $rawRankValues, null, null, $year, $month, $constructMode > 1);
return $general;
}
/**
* @param General[] $generalList
* @param int $turnIdx
* @param array $env
* @param General[] $generalList
* @param int $turnIdx
* @param array $env
* @return GeneralCommand[]
*/
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 $turnIdxTo [$turnIdxFrom, $turnIdxTo)
* @param array $env
* @param array $env
* @return GeneralCommand[][]
*/
static public function getReservedTurnListByGeneralList(array $generalList, int $turnIdxFrom, int $turnIdxTo, array $env){
@@ -1135,7 +1135,7 @@ class General implements iAction{
}, $generalList);
$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);
$orderedRawCmds = [];
foreach($rawCmds as $rawCmd){
@@ -1224,7 +1224,7 @@ class General implements iAction{
$extractFn = function() use ($multiplier){
$betWin = $this->getRankVar('betwin');
$betWinRate = $this->getRankVar('betwingold')/max(1, $this->getRankVar('betgold'));
return [$betWin * $multiplier * pow($betWinRate, 2), null];
};
break;
@@ -1272,7 +1272,7 @@ class General implements iAction{
if($gameStor->isunited != 0){
return;
}
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}");
$inheritStor->setValue($key, [$value, $aux]);
}