Squashed commit of the following:
commit3ef363a01eAuthor: hide_d <hided62@gmail.com> Date: Mon Sep 6 02:30:00 2021 +0900 fix: 은퇴 시 숙련 포인트를 지나치게 많이 받는 문제 수정 commit9e68bc90c2Author: hide_d <hided62@gmail.com> Date: Mon Sep 6 02:17:56 2021 +0900 재야에서 도시보기 warning commitd2590607c2Author: hide_d <hided62@gmail.com> Date: Sun Sep 5 23:05:06 2021 +0900 fix: div 0 commit2bce6e4f02Author: hide_d <hided62@gmail.com> Date: Sun Sep 5 23:02:52 2021 +0900 warning 메시지 수정 commite64812da72Author: hide_d <hided62@gmail.com> Date: Sat Sep 4 03:42:09 2021 +0900 fix: m장, 의병장 숙련이 설정되지 않는 버그 수정 commit7cd40fca03Author: hide_d <hided62@gmail.com> Date: Sat Aug 21 16:04:03 2021 +0900 fix: 모병/징병에서 조건 검사부 통솔 계산값 commitd1568a3b2cAuthor: hide_d <hided62@gmail.com> Date: Sat Aug 21 02:50:54 2021 +0900 허보에 수몰이 같이 들어간 버그 수정 commite7dcc84afcAuthor: hide_d <hided62@gmail.com> Date: Thu Aug 19 14:51:50 2021 +0900 REAMDME.md 버전 수정 commit8eaa940d4eAuthor: hide_d <hided62@gmail.com> Date: Wed Aug 18 20:40:37 2021 +0900 Revert "fix: 7.2에서 오동작 버그 수정" This reverts commit9997675b1d. commit9997675b1dAuthor: hide_d <hided62@gmail.com> Date: Wed Aug 18 20:32:47 2021 +0900 fix: 7.2에서 오동작 버그 수정 commit9ef566f11fAuthor: hide_d <hided62@gmail.com> Date: Wed Aug 18 20:26:31 2021 +0900 fix: 아이템중 WarActivateSkill 관련 중첩 해제 버그 수정
This commit is contained in:
@@ -20,9 +20,9 @@
|
||||
* `git`
|
||||
* `curl`
|
||||
|
||||
Linux는 Ubuntu 18.04, 20.04, Windows는 Windows 10에서 XAMPP, WSL2를 사용한 환경에서 테스트되었습니다.
|
||||
Linux는 Ubuntu 18.04, 20.04, Windows는 WSL2를 사용한 환경에서 테스트되었습니다.
|
||||
|
||||
Docker를 이용한 설치는 테스트버전만 제공됩니다.
|
||||
Docker를 이용한 설치도 제공하고 있습니다.
|
||||
|
||||
## Docker를 이용한 설치
|
||||
|
||||
|
||||
@@ -16,7 +16,11 @@ $db = DB::db();
|
||||
increaseRefresh("현재도시", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level,city from general where owner=%i', $userID);
|
||||
$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation']);
|
||||
$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation'])??[
|
||||
'nation'=>0,
|
||||
'level'=>0,
|
||||
'spy'=>''
|
||||
];
|
||||
|
||||
$templates = new \League\Plates\Engine('templates');
|
||||
|
||||
@@ -375,7 +379,7 @@ $genTotal = 0;
|
||||
|
||||
|
||||
foreach($generalsFormat as $general){
|
||||
if($general['nation'] == 0){
|
||||
if(!$general['nation'] || !$myNation['nation']){
|
||||
continue;
|
||||
}
|
||||
if($general['nation'] != $myNation['nation']){
|
||||
|
||||
+15
-8
@@ -654,7 +654,7 @@ function updateNationState()
|
||||
}
|
||||
|
||||
$score *= $trialCnt;
|
||||
|
||||
|
||||
$uniqueLotteryWeightList[$nationGen->getID()] = [$nationGen, $score];
|
||||
}
|
||||
|
||||
@@ -745,7 +745,7 @@ function checkStatistic()
|
||||
];
|
||||
|
||||
$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
|
||||
FROM general'
|
||||
);
|
||||
@@ -1022,8 +1022,8 @@ function checkEmperior()
|
||||
$nation['generals'] = $nationGenerals;
|
||||
|
||||
$tigers = $db->query(
|
||||
'SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
'SELECT value, name
|
||||
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',
|
||||
$nationID
|
||||
); // 오호장군
|
||||
@@ -1034,8 +1034,8 @@ function checkEmperior()
|
||||
}, $tigers));
|
||||
|
||||
$eagles = $db->query(
|
||||
'SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
'SELECT value, name
|
||||
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',
|
||||
$nationID
|
||||
); // 건안칠자
|
||||
@@ -1150,10 +1150,17 @@ function checkEmperior()
|
||||
LogHistory();
|
||||
}
|
||||
|
||||
function resetInheritanceUser(int $userID){
|
||||
function resetInheritanceUser(int $userID, bool $isRebirth=false){
|
||||
$rebirthDegraded = [
|
||||
'dex'=>0.5,
|
||||
];
|
||||
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$userID}");
|
||||
$totalPoint = 0;
|
||||
foreach($inheritStor->getAll() as [$value,]){
|
||||
foreach($inheritStor->getAll() as $key=>[$value,]){
|
||||
if(key_exists($key, $rebirthDegraded)){
|
||||
$value *= $rebirthDegraded[$key];
|
||||
}
|
||||
$totalPoint += $value;
|
||||
}
|
||||
$totalPoint = Util::toInt($totalPoint);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\ActionItem;
|
||||
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\GeneralTrigger;
|
||||
@@ -10,7 +12,8 @@ use sammo\BaseWarUnitTrigger;
|
||||
use sammo\WarUnitTrigger\che_부상무효;
|
||||
use sammo\WarUnitTrigger\WarActivateSkills;
|
||||
|
||||
class che_부적_태현청생부 extends \sammo\BaseItem{
|
||||
class che_부적_태현청생부 extends \sammo\BaseItem
|
||||
{
|
||||
|
||||
protected $id = 9;
|
||||
protected $rawName = '태현청생부';
|
||||
@@ -19,16 +22,18 @@ class che_부적_태현청생부 extends \sammo\BaseItem{
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||
{
|
||||
return new WarUnitTriggerCaller(
|
||||
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_NONE),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '저격불가')
|
||||
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 303),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 303, false, '저격불가')
|
||||
);
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||
{
|
||||
return new WarUnitTriggerCaller(
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '저격불가')
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 303, false, '저격불가')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class event_전투특기_반계 extends \sammo\BaseItem{
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller(
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE*401, false, '계략약화'),
|
||||
new che_반계시도($unit),
|
||||
new che_반계발동($unit)
|
||||
);
|
||||
|
||||
@@ -23,14 +23,14 @@ class che_event_견고 extends \sammo\BaseSpecial{
|
||||
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller(
|
||||
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_NONE),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '저격불가')
|
||||
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_ITEM),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE*402, false, '저격불가')
|
||||
);
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller(
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '필살불가', '계략약화', '저격불가')
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE*402, false, '필살불가', '계략약화', '저격불가')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\ActionSpecialDomestic;
|
||||
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\SpecialityHelper;
|
||||
@@ -10,7 +12,8 @@ use \sammo\WarUnitTrigger\WarActivateSkills;
|
||||
use \sammo\WarUnitTrigger\che_반계시도;
|
||||
use \sammo\WarUnitTrigger\che_반계발동;
|
||||
|
||||
class che_event_반계 extends \sammo\BaseSpecial{
|
||||
class che_event_반계 extends \sammo\BaseSpecial
|
||||
{
|
||||
|
||||
protected $id = 45;
|
||||
protected $name = '반계';
|
||||
@@ -22,18 +25,20 @@ class che_event_반계 extends \sammo\BaseSpecial{
|
||||
SpecialityHelper::STAT_INTEL,
|
||||
];
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'warMagicSuccessDamage' && $aux === '반목'){
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux = null)
|
||||
{
|
||||
if ($statName === 'warMagicSuccessDamage' && $aux === '반목') {
|
||||
return $value + 0.9;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||
{
|
||||
return new WarUnitTriggerCaller(
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 403, false, '계략약화'),
|
||||
new che_반계시도($unit),
|
||||
new che_반계발동($unit)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\ActionSpecialWar;
|
||||
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\SpecialityHelper;
|
||||
@@ -9,7 +11,8 @@ use sammo\BaseWarUnitTrigger;
|
||||
use sammo\WarUnitTrigger\che_부상무효;
|
||||
use sammo\WarUnitTrigger\WarActivateSkills;
|
||||
|
||||
class che_견고 extends \sammo\BaseSpecial{
|
||||
class che_견고 extends \sammo\BaseSpecial
|
||||
{
|
||||
|
||||
protected $id = 62;
|
||||
protected $name = '견고';
|
||||
@@ -21,20 +24,23 @@ class che_견고 extends \sammo\BaseSpecial{
|
||||
SpecialityHelper::STAT_STRENGTH
|
||||
];
|
||||
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||
{
|
||||
return new WarUnitTriggerCaller(
|
||||
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_NONE),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '저격불가')
|
||||
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 404),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 404, false, '저격불가')
|
||||
);
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit): ?WarUnitTriggerCaller
|
||||
{
|
||||
return new WarUnitTriggerCaller(
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '필살불가', '계략약화', '저격불가')
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 404, false, '필살불가', '계략약화', '저격불가')
|
||||
);
|
||||
}
|
||||
|
||||
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||
public function getWarPowerMultiplier(WarUnit $unit): array
|
||||
{
|
||||
return [1, 0.9];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class che_반계 extends \sammo\BaseSpecial{
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller(
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM + BaseWarUnitTrigger::TYPE_DEDUP_TYPE_BASE * 406, false, '계략약화'),
|
||||
new che_반계시도($unit),
|
||||
new che_반계발동($unit)
|
||||
);
|
||||
|
||||
@@ -184,12 +184,6 @@ class che_허보 extends Command\NationCommand
|
||||
);
|
||||
$destNationLogger->flush();
|
||||
|
||||
|
||||
$db->update('city', [
|
||||
'def' => $db->sqleval('def * 0.2'),
|
||||
'wall' => $db->sqleval('wall * 0.2'),
|
||||
], 'city=%i', $destCityID);
|
||||
|
||||
$josaYiNation = JosaUtil::pick($nationName, '이');
|
||||
|
||||
$logger->pushGeneralHistoryLog("<G><b>{$destCityName}</b></>에 <M>허보</>를 발동");
|
||||
|
||||
@@ -38,7 +38,8 @@ class ReqGeneralCrewMargin extends Constraint{
|
||||
$reqCrewType = GameUnitConst::byID($this->arg);
|
||||
|
||||
//XXX: 왜 General -> obj -> General 변환을 하고 있나?
|
||||
$generalObj = new General($this->general, null, null, null, null, null, false);
|
||||
//FIXME: RankVar, city에 따라 통솔이 바뀐다면 이 부분에 문제가 발생.
|
||||
$generalObj = new General($this->general, null, null, null, null, null, true);
|
||||
|
||||
if($reqCrewType->id != $generalObj->getCrewTypeObj()->id){
|
||||
return true;
|
||||
|
||||
+87
-87
@@ -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]);
|
||||
}
|
||||
|
||||
+76
-76
@@ -97,7 +97,7 @@ class GeneralAI
|
||||
else{
|
||||
$this->city = $general->getRawCity();
|
||||
}
|
||||
|
||||
|
||||
$this->nation = $db->queryFirstRow(
|
||||
'SELECT nation,name,color,capital,capset,gennum,gold,rice,bill,rate,rate_tmp,scout,war,strategic_cmd_limit,surlimit,tech,power,level,chief_set,type,aux FROM nation WHERE nation = %i',
|
||||
$general->getNationID()
|
||||
@@ -144,7 +144,7 @@ class GeneralAI
|
||||
$this->fullStrength = $general->getStrength(false);
|
||||
$this->fullIntel = $general->getIntel(false);
|
||||
|
||||
|
||||
|
||||
$this->genType = $this->calcGenType($general);
|
||||
|
||||
$this->calcDiplomacyState();
|
||||
@@ -184,7 +184,7 @@ class GeneralAI
|
||||
$genType |= self::t통솔장;
|
||||
}
|
||||
return $genType;
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function calcDiplomacyState()
|
||||
@@ -228,9 +228,9 @@ class GeneralAI
|
||||
if(!$onWar && !$onWarReady && !$onWarYet){
|
||||
$warTargetNation[0] = 1;
|
||||
}
|
||||
|
||||
|
||||
$this->warTargetNation = $warTargetNation;
|
||||
|
||||
|
||||
|
||||
$minWarTerm = $db->queryFirstField('SELECT min(term) FROM diplomacy WHERE me = %i AND state=1', $nationID);
|
||||
if ($minWarTerm === null) {
|
||||
@@ -271,7 +271,7 @@ class GeneralAI
|
||||
}
|
||||
$this->calcWarRoute();
|
||||
$troopCandidate = [];
|
||||
|
||||
|
||||
$chiefTurn = cutTurn($this->general->getTurnTime(), $this->env['turnterm']);
|
||||
$yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']);
|
||||
|
||||
@@ -319,8 +319,8 @@ class GeneralAI
|
||||
$troopCandidate[] = [$leaderID, Util::choiceRandom($this->frontCities)['city']];
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//출발지가 아국땅이 아닌경우 수도->출발지
|
||||
if(!key_exists($fromCityID, $this->supplyCities)){
|
||||
$toCityID = $fromCityID;
|
||||
@@ -377,7 +377,7 @@ class GeneralAI
|
||||
|
||||
$chiefTurn = cutTurn($this->general->getTurnTime(), $this->env['turnterm']);
|
||||
$yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']);
|
||||
|
||||
|
||||
$troopCandidate = [];
|
||||
foreach($this->troopLeaders as $troopLeader){
|
||||
$leaderID = $troopLeader->getID();
|
||||
@@ -416,7 +416,7 @@ class GeneralAI
|
||||
if(!$troopCandidate){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if(count($this->supplyCities) == 1){
|
||||
return null;
|
||||
}
|
||||
@@ -485,7 +485,7 @@ class GeneralAI
|
||||
if(!$troopCandidate){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$cityCandidates = [];
|
||||
|
||||
foreach($this->frontCities as $city){
|
||||
@@ -679,7 +679,7 @@ class GeneralAI
|
||||
if($pop_ratio < $this->nationPolicy->safeRecruitCityPopulationRatio){
|
||||
$pop_ratio /= 4;
|
||||
}
|
||||
|
||||
|
||||
$recruitableCityList[$cityID] = $pop_ratio;
|
||||
}
|
||||
|
||||
@@ -746,9 +746,9 @@ class GeneralAI
|
||||
$troopID = $lostGeneral->getVar('troop');
|
||||
if($troopID && key_exists($troopID, $this->troopLeaders)){
|
||||
$troopLeader = $this->troopLeaders[$troopID];
|
||||
|
||||
|
||||
if(
|
||||
key_exists($troopLeader->getCityID(), $this->supplyCities) &&
|
||||
key_exists($troopLeader->getCityID(), $this->supplyCities) &&
|
||||
$this->troopLeaders[$troopID]->getTurnTime() < $lostGeneral->getTurnTime()
|
||||
){
|
||||
//이미 탈출 가능한 부대를 탔다
|
||||
@@ -770,10 +770,10 @@ class GeneralAI
|
||||
if(!$args){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$arg = Util::choiceRandom($args);
|
||||
$cmd = buildNationCommandClass('che_발령', $this->general, $this->env, $lastTurn, $arg);
|
||||
|
||||
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
LogText('구출실패', [$arg, $cmd->getFailString()]);
|
||||
return null;
|
||||
@@ -840,7 +840,7 @@ class GeneralAI
|
||||
|
||||
return $cmd;
|
||||
}
|
||||
|
||||
|
||||
protected function do유저장내정발령(LastTurn $lastTurn): ?NationCommand
|
||||
{
|
||||
if(!$this->nation['capital']){
|
||||
@@ -870,7 +870,7 @@ class GeneralAI
|
||||
if(!key_exists($cityID, $this->supplyCities)){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$city = $this->supplyCities[$cityID];
|
||||
|
||||
if($city['dev'] < 0.95){
|
||||
@@ -980,7 +980,7 @@ class GeneralAI
|
||||
if($pop_ratio < $this->nationPolicy->safeRecruitCityPopulationRatio){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$recruitableCityList[$cityID] = $pop_ratio;
|
||||
}
|
||||
|
||||
@@ -1227,7 +1227,7 @@ class GeneralAI
|
||||
$reqMoney = max($reqMoney, $reqHumanMinRes);
|
||||
}
|
||||
$enoughMoney = $reqMoney * 1.1;
|
||||
|
||||
|
||||
if ($targetUserGeneral->getVar($resName) >= $reqMoney) {
|
||||
continue;
|
||||
}
|
||||
@@ -1257,9 +1257,9 @@ class GeneralAI
|
||||
if(!$candidateArgs){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$cmd = buildNationCommandClass(
|
||||
'che_포상', $this->general, $this->env, $lastTurn,
|
||||
'che_포상', $this->general, $this->env, $lastTurn,
|
||||
Util::choiceRandomUsingWeightPair($candidateArgs)
|
||||
);
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
@@ -1295,7 +1295,7 @@ class GeneralAI
|
||||
|
||||
|
||||
$userGenerals = $this->userGenerals;
|
||||
|
||||
|
||||
|
||||
foreach($remainResource as $resName=>[$reqNationRes, $resVal,$reqHumanMinWarRes,$reqHumanMinDevelRes]){
|
||||
if($resVal < $reqNationRes){
|
||||
@@ -1333,7 +1333,7 @@ class GeneralAI
|
||||
$reqMoney = max($reqMoney, $reqHumanMinRes);
|
||||
}
|
||||
$enoughMoney = $reqMoney * 1.2;
|
||||
|
||||
|
||||
if ($targetUserGeneral->getVar($resName) >= $reqMoney) {
|
||||
continue;
|
||||
}
|
||||
@@ -1360,13 +1360,13 @@ class GeneralAI
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!$candidateArgs){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$cmd = buildNationCommandClass(
|
||||
'che_포상', $this->general, $this->env, $lastTurn,
|
||||
'che_포상', $this->general, $this->env, $lastTurn,
|
||||
Util::choiceRandomUsingWeightPair($candidateArgs)
|
||||
);
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
@@ -1422,7 +1422,7 @@ class GeneralAI
|
||||
$reqMoney = max($reqMoney, $reqNPCMinWarRes);
|
||||
}
|
||||
$enoughMoney = $reqMoney * 1.2;
|
||||
|
||||
|
||||
if ($targetNPCGeneral->getVar($resName) >= $reqMoney) {
|
||||
continue;
|
||||
}
|
||||
@@ -1453,9 +1453,9 @@ class GeneralAI
|
||||
if(!$candidateArgs){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$cmd = buildNationCommandClass(
|
||||
'che_포상', $this->general, $this->env, $lastTurn,
|
||||
'che_포상', $this->general, $this->env, $lastTurn,
|
||||
Util::choiceRandomUsingWeightPair($candidateArgs)
|
||||
);
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
@@ -1514,7 +1514,7 @@ class GeneralAI
|
||||
$reqMoney = max($reqMoney, $reqNPCMinWarRes);
|
||||
}
|
||||
$enoughMoney = $reqMoney * 1.5;
|
||||
|
||||
|
||||
if ($targetNPCGeneral->getVar($resName) >= $reqMoney) {
|
||||
continue;
|
||||
}
|
||||
@@ -1570,9 +1570,9 @@ class GeneralAI
|
||||
if(!$candidateArgs){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$cmd = buildNationCommandClass(
|
||||
'che_포상', $this->general, $this->env, $lastTurn,
|
||||
'che_포상', $this->general, $this->env, $lastTurn,
|
||||
Util::choiceRandomUsingWeightPair($candidateArgs)
|
||||
);
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
@@ -1654,14 +1654,14 @@ class GeneralAI
|
||||
return -($lhs->getVar($resName) <=> $rhs->getVar($resName));
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
foreach($npcWarGenerals as $idx=>$targetNPCGeneral){
|
||||
if($willTakeSmallAmount){
|
||||
if($targetNPCGeneral->getVar($resName) <= $reqNPCMinWarRes * 2){
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if($targetNPCGeneral->getVar($resName) <= $reqNPCMinWarRes){
|
||||
break;
|
||||
@@ -1700,9 +1700,9 @@ class GeneralAI
|
||||
if(!$candidateArgs){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$cmd = buildNationCommandClass(
|
||||
'che_몰수', $this->general, $this->env, $lastTurn,
|
||||
'che_몰수', $this->general, $this->env, $lastTurn,
|
||||
Util::choiceRandomUsingWeightPair($candidateArgs)
|
||||
);
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
@@ -1777,7 +1777,7 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[$targetYear, $targetMonth] = Util::parseYearMonth($yearMonth + $diplomatMonth);
|
||||
|
||||
$cmd = buildNationCommandClass('che_불가침제의', $this->general, $this->env, $lastTurn, [
|
||||
@@ -1788,10 +1788,10 @@ class GeneralAI
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$respAssistTry["n{$destNationID}"] = [$destNationID, $yearMonth];
|
||||
$nationStor->setValue('resp_assist_try', $respAssistTry);
|
||||
|
||||
|
||||
return $cmd;
|
||||
}
|
||||
|
||||
@@ -1900,7 +1900,7 @@ class GeneralAI
|
||||
else{
|
||||
$warNations[$destNationID] = 1 / sqrt($destNationPower + 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (!$nations) {
|
||||
if(!$warNations){
|
||||
@@ -1964,7 +1964,7 @@ class GeneralAI
|
||||
|
||||
|
||||
//checkSupply()와 비슷하면서 다름
|
||||
|
||||
|
||||
$nationCityIDList = [];
|
||||
$this->categorizeNationCities();
|
||||
foreach($this->nationCities as $city){
|
||||
@@ -1987,7 +1987,7 @@ class GeneralAI
|
||||
//수도와 연결된 도시 탐색
|
||||
while(!$queue->isEmpty()){
|
||||
$cityID = $queue->dequeue();
|
||||
|
||||
|
||||
foreach(array_keys(CityConst::byID($cityID)->path) as $nextCityID){
|
||||
if(!key_exists($nextCityID, $nationCityIDList)){
|
||||
continue;
|
||||
@@ -2049,7 +2049,7 @@ class GeneralAI
|
||||
}
|
||||
$targetCityID = Util::choiceRandom($candidates);
|
||||
}
|
||||
|
||||
|
||||
$cmd = buildNationCommandClass('che_천도', $this->general, $this->env, $lastTurn, [
|
||||
'destCityID'=>$targetCityID
|
||||
]);
|
||||
@@ -2058,7 +2058,7 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$nationStor->last천도Trial = [$general->getVar('officer_level'), $general->getTurnTime()];
|
||||
return $cmd;
|
||||
}
|
||||
@@ -2332,7 +2332,7 @@ class GeneralAI
|
||||
|
||||
$absGold = $general->getVar('gold');
|
||||
$absRice = $general->getVar('rice');
|
||||
|
||||
|
||||
$relGold = $absGold;
|
||||
$relRice = $absRice * $deathRate;
|
||||
|
||||
@@ -2374,7 +2374,7 @@ class GeneralAI
|
||||
{
|
||||
$tryBuying = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
if($relRice * 2 < $relGold && $relRice < $riceCost * 3)
|
||||
@@ -2409,7 +2409,7 @@ class GeneralAI
|
||||
{
|
||||
$trySelling = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
if($relGold * 2 < $relRice && $relGold < $goldCost * 3)
|
||||
@@ -2433,7 +2433,7 @@ class GeneralAI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -2448,7 +2448,7 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$general = $this->getGeneralObj();
|
||||
$city = $this->city;
|
||||
@@ -2470,7 +2470,7 @@ class GeneralAI
|
||||
(Util::randF($remainPop/$maxPop))){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$nationID = $general->getNationID();
|
||||
@@ -2499,7 +2499,7 @@ class GeneralAI
|
||||
GameUnitConst::T_WIZARD => sqrt($general->getVar('dex4') + 500),
|
||||
GameUnitConst::T_SIEGE => sqrt($general->getVar('dex5') + 500),
|
||||
];
|
||||
|
||||
|
||||
$availableArmType = [];
|
||||
if($this->fullStrength > $this->fullIntel * 0.9){
|
||||
$availableArmType[GameUnitConst::T_FOOTMAN] = $dex[GameUnitConst::T_FOOTMAN] * $this->fullStrength;
|
||||
@@ -2548,7 +2548,7 @@ class GeneralAI
|
||||
//굳이 뽑은 이유가 있겠지
|
||||
$type = $currCrewType->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//XXX: 훈련, 사기진작 금액을 하드코딩으로 계산중
|
||||
@@ -2566,7 +2566,7 @@ class GeneralAI
|
||||
|
||||
$riceCost = $crewType->riceWithTech(
|
||||
$this->nation['tech'],
|
||||
$this->fullLeadership*100 *
|
||||
$this->fullLeadership*100 *
|
||||
$general->getRankVar('killcrew')/max($general->getRankVar('deathcrew'),1)*1.2
|
||||
);
|
||||
|
||||
@@ -2584,7 +2584,7 @@ class GeneralAI
|
||||
]);
|
||||
}
|
||||
else if($gold < $cost && $gold * 2 >= $cost){
|
||||
$crew *= 0.5;
|
||||
$crew *= 0.5;
|
||||
$riceCost *= 0.5;
|
||||
$crew = Util::round($crew-49, -2);
|
||||
$cmd = buildGeneralCommandClass('che_징병', $general, $env, [
|
||||
@@ -2597,7 +2597,7 @@ class GeneralAI
|
||||
//이 쌀도 없어?
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
return null;
|
||||
}
|
||||
@@ -2749,7 +2749,7 @@ class GeneralAI
|
||||
|
||||
foreach($resourceMap as [$resKey, $reqNation, $reqNPCWar, $reqNPCDevel]){
|
||||
$genRes = $general->getVar($resKey);
|
||||
|
||||
|
||||
if($this->genType & self::t통솔장){
|
||||
$reqRes = $reqNPCWar;
|
||||
}
|
||||
@@ -2794,7 +2794,7 @@ class GeneralAI
|
||||
if($genRes < $reqRes * 1.5){
|
||||
continue;
|
||||
}
|
||||
if(!Util::randBool(($genRes / $reqRes)-0.5)){
|
||||
if($reqRes > 0 && !Util::randBool(($genRes / $reqRes)-0.5)){
|
||||
continue;
|
||||
}
|
||||
$amount = $genRes - $reqRes;
|
||||
@@ -2917,7 +2917,7 @@ class GeneralAI
|
||||
'optionText' => '순간이동',
|
||||
'destCityID' => Util::choiceRandomUsingWeight($recruitableCityList),
|
||||
]);
|
||||
|
||||
|
||||
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
LogText("{$this->general->getName()}, {$this->general->getID()} 후방워프 불가: 조건 불충족", $cmd->getArg());
|
||||
@@ -2969,7 +2969,7 @@ class GeneralAI
|
||||
'optionText' => '순간이동',
|
||||
'destCityID' => Util::choiceRandomUsingWeight($candidateCities),
|
||||
]);
|
||||
|
||||
|
||||
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
return null;
|
||||
@@ -2986,7 +2986,7 @@ class GeneralAI
|
||||
if(($this->genType & self::t통솔장)&&in_array($this->dipState, [self::d징병, self::d직전, self::d전쟁])){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$city = $this->city;
|
||||
if(Util::randBool(0.6)){
|
||||
return null;
|
||||
@@ -3028,9 +3028,9 @@ class GeneralAI
|
||||
$realDevelRate += $develVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$realDevelRate /= $availableTypeCnt;
|
||||
|
||||
|
||||
if($realDevelRate >= 0.95){
|
||||
continue;
|
||||
}
|
||||
@@ -3158,7 +3158,7 @@ class GeneralAI
|
||||
|
||||
$prop = Util::randF() * (GameConst::$defaultStatNPCMax + GameConst::$chiefStatMin) / 2;
|
||||
$ratio = ($this->fullLeadership + $this->fullStrength + $this->fullIntel) / 3;
|
||||
|
||||
|
||||
|
||||
if($prop >= $ratio){
|
||||
return null;
|
||||
@@ -3251,7 +3251,7 @@ class GeneralAI
|
||||
if ($nationCnt == 0 || $notFullNationCnt == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (Util::randBool(pow(1 / ($nationCnt + 1) / pow($notFullNationCnt, 3), 1 / 4))) {
|
||||
return null;
|
||||
}
|
||||
@@ -3355,7 +3355,7 @@ class GeneralAI
|
||||
$nationID = $nation['nation'];
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
|
||||
$nationCities = [];
|
||||
$frontCities = [];
|
||||
$supplyCities = [];
|
||||
@@ -3399,7 +3399,7 @@ class GeneralAI
|
||||
$userGenerals = [];
|
||||
$userCivilGenerals = [];
|
||||
$userWarGenerals = [];
|
||||
|
||||
|
||||
$lostGenerals = [];
|
||||
$npcCivilGenerals = [];
|
||||
$npcWarGenerals = [];
|
||||
@@ -3541,7 +3541,7 @@ class GeneralAI
|
||||
}
|
||||
|
||||
foreach($this->nationPolicy->priority as $actionName){
|
||||
|
||||
|
||||
if(!property_exists($this->nationPolicy, 'can'.$actionName)){
|
||||
trigger_error ("can{$actionName}이 없음", E_USER_NOTICE );
|
||||
continue;
|
||||
@@ -3625,7 +3625,7 @@ class GeneralAI
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($npcType == 5){
|
||||
if($general->getNationID()==0){
|
||||
$general->setVar('killturn', 1);
|
||||
@@ -3765,10 +3765,10 @@ class GeneralAI
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$picked = false;
|
||||
foreach(Util::range(5) as $idx){
|
||||
|
||||
|
||||
/** @var General */
|
||||
if($this->npcWarGenerals){
|
||||
$randGeneral = Util::choiceRandom($this->npcWarGenerals);
|
||||
@@ -3785,7 +3785,7 @@ class GeneralAI
|
||||
else{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if($randGeneral->getVar('officer_level') != 1){
|
||||
continue;
|
||||
}
|
||||
@@ -3864,7 +3864,7 @@ class GeneralAI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$minBelong = min($this->general->getVar('belong') - 1, 3);
|
||||
$updatedChiefSet = 0;
|
||||
@@ -3910,7 +3910,7 @@ class GeneralAI
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
foreach(Util::range(11, $minChiefLevel-1, -1) as $chiefLevel) {
|
||||
if(isOfficerSet($nation['chief_set'], $chiefLevel)){
|
||||
continue;
|
||||
@@ -3918,7 +3918,7 @@ class GeneralAI
|
||||
if($this->general->getVar('officer_level') === $chiefLevel){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(key_exists($chiefLevel, $this->chiefGenerals)){
|
||||
$oldChief = $this->chiefGenerals[$chiefLevel];
|
||||
if($oldChief->getNPCType() < 2 && $oldChief->getVar('killturn') >= $minChiefLevel){
|
||||
@@ -3964,7 +3964,7 @@ class GeneralAI
|
||||
}
|
||||
|
||||
$newChief = $general;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!$newChief){
|
||||
|
||||
@@ -16,22 +16,22 @@ class GeneralBuilder{
|
||||
|
||||
protected $owner = 0;
|
||||
protected $ownerName = null;
|
||||
protected $affinity=null;
|
||||
protected $affinity=null;
|
||||
protected $nameCustomPrefix=null;
|
||||
protected $name;
|
||||
protected $name;
|
||||
protected $imgsvr = 0;
|
||||
protected $picturePath;
|
||||
protected $nationID;
|
||||
protected $cityID;
|
||||
protected $leadership=null;
|
||||
protected $strength=null;
|
||||
protected $intel=null;
|
||||
protected $picturePath;
|
||||
protected $nationID;
|
||||
protected $cityID;
|
||||
protected $leadership=null;
|
||||
protected $strength=null;
|
||||
protected $intel=null;
|
||||
protected $officerLevel;
|
||||
protected $birth=null;
|
||||
protected $death=null;
|
||||
protected $birth=null;
|
||||
protected $death=null;
|
||||
protected $ego=null;
|
||||
protected $specialDomestic=null;
|
||||
protected $specialWar=null;
|
||||
protected $specialDomestic=null;
|
||||
protected $specialWar=null;
|
||||
protected $npc = 2;
|
||||
protected $text;
|
||||
static $prefixList = [
|
||||
@@ -42,7 +42,7 @@ class GeneralBuilder{
|
||||
4 => 'ⓖ', //의병장(전략)
|
||||
5 => '㉥', //부대장
|
||||
6 => 'ⓤ', //unselectable npc, 빙의 불가 npc
|
||||
|
||||
|
||||
9 => 'ⓞ', //오랑캐?
|
||||
];
|
||||
|
||||
@@ -66,12 +66,12 @@ class GeneralBuilder{
|
||||
protected $aux = [];
|
||||
|
||||
public function __construct(
|
||||
string $name,
|
||||
string $name,
|
||||
bool $isDynamicImageSvr,
|
||||
$picturePath,
|
||||
$picturePath,
|
||||
int $nationID
|
||||
){
|
||||
|
||||
|
||||
$this->name = $name;
|
||||
$this->imgsvr = $isDynamicImageSvr;
|
||||
$this->picturePath = $picturePath;
|
||||
@@ -144,7 +144,7 @@ class GeneralBuilder{
|
||||
$this->specialDomestic = $specialDomestic;
|
||||
$this->specialWar = $specialWar;
|
||||
return $this;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function setOfficerLevel(int $level):self{
|
||||
@@ -380,7 +380,7 @@ class GeneralBuilder{
|
||||
if($this->specialWar === null){
|
||||
$this->specialWar = GameConst::$defaultSpecialWar;
|
||||
}
|
||||
|
||||
|
||||
if($this->killturn === null && $this->owner){
|
||||
$this->killturn = 5;
|
||||
}
|
||||
@@ -408,7 +408,7 @@ class GeneralBuilder{
|
||||
$this->death = $this->birth+Util::randRangeInt(60, 80);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($this->specAge===null){
|
||||
$age = $env['year']-$this->birth;
|
||||
$relYear = Util::valueFit($env['year'] - $env['startyear'], 0);
|
||||
@@ -459,7 +459,7 @@ class GeneralBuilder{
|
||||
}
|
||||
}
|
||||
|
||||
if($this->dex1 === null){
|
||||
if(!$this->dex1 && in_array('dex_t', $avgGen)){
|
||||
$dexTotal = $avgGen['dex_t'];
|
||||
if ($pickType == '무') {
|
||||
$dexVal = Util::choiceRandom([
|
||||
@@ -532,7 +532,7 @@ class GeneralBuilder{
|
||||
public function build($env){
|
||||
//scenario에 life==1인 경우 수명 제한이 없어지는 모양.
|
||||
|
||||
|
||||
|
||||
|
||||
if(!key_exists('stored_icons', $env)){
|
||||
try{
|
||||
@@ -542,7 +542,7 @@ class GeneralBuilder{
|
||||
catch(\Exception $e){
|
||||
$storedIcons = [];
|
||||
}
|
||||
|
||||
|
||||
$env['stored_icons'] = $storedIcons;
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ class GeneralBuilder{
|
||||
else{
|
||||
$name = $this->nameCustomPrefix.$this->name;
|
||||
}
|
||||
|
||||
|
||||
$this->realName = $name;
|
||||
|
||||
if($this->death <= $year){
|
||||
@@ -635,7 +635,6 @@ class GeneralBuilder{
|
||||
'@phan-var array<string,string|int> $cityObj';
|
||||
$this->cityID = $cityObj['id'];
|
||||
}
|
||||
|
||||
|
||||
$experience = $this->experience?:$age * 100;
|
||||
$dedication = $this->dedication?:$age * 100;
|
||||
|
||||
Reference in New Issue
Block a user