From b6e307660fef17026f59afe89512d6012cffcfd2 Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 12 Jun 2020 20:28:50 +0900 Subject: [PATCH] =?UTF-8?q?warning=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/a_genList.php | 430 +++++++-------- hwe/sammo/Command/General/che_인재탐색.php | 592 ++++++++++----------- hwe/sammo/GeneralAI.php | 4 +- 3 files changed, 509 insertions(+), 517 deletions(-) diff --git a/hwe/a_genList.php b/hwe/a_genList.php index 6ec7c07e..12d24685 100644 --- a/hwe/a_genList.php +++ b/hwe/a_genList.php @@ -1,215 +1,215 @@ -setReadOnly(); -$userID = Session::getUserID(); - -$db = DB::db(); -$gameStor = KVStorage::getStorage($db, 'game_env'); - -increaseRefresh("장수일람", 2); - -$me = $db->queryFirstRow('SELECT con,turntime FROM general WHERE owner = %i', $userID); - -$con = checkLimit($me['con']); -if ($con >= 2) { - printLimitMsg($me['turntime']); - exit(); -} - -if ($type <= 0 || $type > 15) { - $type = 9; -} - -$ownerNameList = []; -if($gameStor->isunited){ - foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){ - $ownerNameList[$ownerID] = $ownerName; - } -} - -?> - - - - - - - -<?=UniqueConst::$serverName?>: 장수일람 - - - - - - - - - - - - - - -
장 수 일 람
정렬순서 : - -
-
-['nation', false], - 2=>['leadership', true], - 3=>['strength', true], - 4=>['intel', true], - 5=>['experience', true], - 6=>['dedication', true], - 7=>['officer_level', true], - 8=>['killturn', false], - 9=>['connect', true], - 10=>['experience', true], - 11=>['personal', true], - 12=>['special', true], - 13=>['special2', true], - 14=>['age', true], - 15=>['npc', true], -][$type]; - -$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general order by %b %l', $orderKey, $orderDesc?'desc':''); - -echo" - - - - - - - - - - - - - - - - - - "; -foreach($generalList as $general){ - $nation = $nationname[$general['nation']]; - - $lbonus = calcLeadershipBonus($general['officer_level'], $nationlevel[$general['nation']]??0); - if ($lbonus > 0) { - $lbonusText = "+{$lbonus}"; - } else { - $lbonusText = ""; - } - - if ($general['injury'] > 0) { - $leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100); - $strength = intdiv($general['strength'] * (100 - $general['injury']), 100); - $intel = intdiv($general['intel'] * (100 - $general['injury']), 100); - $leadership = "{$leadership}{$lbonusText}"; - $strength = "{$strength}"; - $intel = "{$intel}"; - } else { - $leadership = "{$general['leadership']}{$lbonusText}"; - $strength = "{$general['strength']}"; - $intel = "{$general['intel']}"; - } - - - - if ($general['npc'] >= 2) { - $name = "{$general['name']}"; - } elseif ($general['npc'] == 1) { - $name = "{$general['name']}"; - } else { - $name = "{$general['name']}"; - } - - if(key_exists($general['owner'], $ownerNameList)){ - $name = $name.'
('.$ownerNameList[$general['owner']].')'; - } - - $general['connect'] = Util::round($general['connect'], -1); - - $imageTemp = GetImageURL($general['imgsvr']); - echo " - =2?'true':'false')."' - > - - - - - - - - - - - - - - - - "; -} -echo " -
얼 굴이 름연령성격특기레 벨국 가명 성계 급관 직통솔무력지력삭턴벌점
$name{$general['age']}세".displayCharInfo($general['personal'])."".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])."Lv ".getExpLevel($general['experience'])."{$nation}".getHonor($general['experience'])."".getDed($general['dedication']).""; - echo getOfficerLevelText($general['officer_level']); - echo "$leadership$strength$intel{$general['killturn']}{$general['connect']}"; - echo "
【".getConnect($general['connect'])."】
-"; - -?> - - - - -
- - - - +setReadOnly(); +$userID = Session::getUserID(); + +$db = DB::db(); +$gameStor = KVStorage::getStorage($db, 'game_env'); + +increaseRefresh("장수일람", 2); + +$me = $db->queryFirstRow('SELECT con,turntime FROM general WHERE owner = %i', $userID); + +$con = checkLimit($me['con']); +if ($con >= 2) { + printLimitMsg($me['turntime']); + exit(); +} + +if ($type <= 0 || $type > 15) { + $type = 9; +} + +$ownerNameList = []; +if($gameStor->isunited){ + foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){ + $ownerNameList[$ownerID] = $ownerName; + } +} + +?> + + + + + + + +<?=UniqueConst::$serverName?>: 장수일람 + + + + + + + + + + + + + + +
장 수 일 람
정렬순서 : + +
+
+['nation', false], + 2=>['leadership', true], + 3=>['strength', true], + 4=>['intel', true], + 5=>['experience', true], + 6=>['dedication', true], + 7=>['officer_level', true], + 8=>['killturn', false], + 9=>['connect', true], + 10=>['experience', true], + 11=>['personal', true], + 12=>['special', true], + 13=>['special2', true], + 14=>['age', true], + 15=>['npc', true], +][$type]; + +$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general order by %b %l', $orderKey, $orderDesc?'desc':''); + +echo" + + + + + + + + + + + + + + + + + + "; +foreach($generalList as $general){ + $nation = $nationname[$general['nation']]; + + $lbonus = calcLeadershipBonus($general['officer_level'], $nationlevel[$general['nation']]??0); + if ($lbonus > 0) { + $lbonusText = "+{$lbonus}"; + } else { + $lbonusText = ""; + } + + if ($general['injury'] > 0) { + $leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100); + $strength = intdiv($general['strength'] * (100 - $general['injury']), 100); + $intel = intdiv($general['intel'] * (100 - $general['injury']), 100); + $leadership = "{$leadership}{$lbonusText}"; + $strength = "{$strength}"; + $intel = "{$intel}"; + } else { + $leadership = "{$general['leadership']}{$lbonusText}"; + $strength = "{$general['strength']}"; + $intel = "{$general['intel']}"; + } + + + + if ($general['npc'] >= 2) { + $name = "{$general['name']}"; + } elseif ($general['npc'] == 1) { + $name = "{$general['name']}"; + } else { + $name = "{$general['name']}"; + } + + if(key_exists($general['owner'], $ownerNameList)){ + $name = $name.'
('.$ownerNameList[$general['owner']].')'; + } + + $general['connect'] = Util::round($general['connect'], -1); + + $imageTemp = GetImageURL($general['imgsvr']); + echo " + =2?'true':'false')."' + > + + + + + + + + + + + + + + + + "; +} +echo " +
얼 굴이 름연령성격특기레 벨국 가명 성계 급관 직통솔무력지력삭턴벌점
$name{$general['age']}세".displayCharInfo($general['personal'])."".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])."Lv ".getExpLevel($general['experience'])."{$nation}".getHonor($general['experience'])."".getDed($general['dedication']).""; + echo getOfficerLevelText($general['officer_level']); + echo "$leadership$strength$intel{$general['killturn']}{$general['connect']}"; + echo "
【".getConnect($general['connect'])."】
+"; + +?> + + + + +
+ + + + diff --git a/hwe/sammo/Command/General/che_인재탐색.php b/hwe/sammo/Command/General/che_인재탐색.php index 617c405c..a7aa2806 100644 --- a/hwe/sammo/Command/General/che_인재탐색.php +++ b/hwe/sammo/Command/General/che_인재탐색.php @@ -1,300 +1,292 @@ -arg = null; - return true; - } - - protected function init() - { - - $general = $this->generalObj; - - $this->setNation(); - $env = $this->env; - - [$reqGold, $reqRice] = $this->getCost(); - - $this->fullConditionConstraints = [ - ConstraintHelper::ReqGeneralGold($reqGold), - ConstraintHelper::ReqGeneralRice($reqRice), - ]; - } - - public function getCommandDetailTitle(): string - { - $db = DB::db(); - $env = $this->env; - - $maxGenCnt = $env['maxgeneral']; - $totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2'); - $totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4'); - - $name = $this->getName(); - [$reqGold, $reqRice] = $this->getCost(); - - $foundProp = $this->calcFoundProp($maxGenCnt, $totalGenCnt, $totalNpcCnt); - $foundPropText = number_format($foundProp * 100, 1); - - $title = "{$name}(랜덤경험"; - if ($reqGold > 0) { - $title .= ", 자금{$reqGold}"; - } - if ($reqRice > 0) { - $title .= ", 군량{$reqRice}"; - } - - $title .= ", 확률 {$foundPropText}%)"; - return $title; - } - - public function getCost(): array - { - return [$this->env['develcost'], 0]; - } - - public function getPreReqTurn(): int - { - return 0; - } - - public function getPostReqTurn(): int - { - return 0; - } - - public function calcFoundProp(int $maxGenCnt, int $totalGenCnt, int $totalNpcCnt): float - { - - - $currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2); - $remainSlot = $maxGenCnt - $currCnt; - if ($remainSlot < 0) { - $remainSlot = 0; - } - - $foundPropMain = pow($remainSlot / $maxGenCnt, 6); - $foundPropSmall = 1 / ($totalNpcCnt / 3 + 1); - $foundPropBig = 1 / $maxGenCnt; - - if ($totalNpcCnt < 50) { - $foundProp = max($foundPropMain, $foundPropSmall); - } else { - $foundProp = max($foundPropMain, $foundPropBig); - } - return $foundProp; - } - - public function run(): bool - { - if (!$this->hasFullConditionMet()) { - throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); - } - - $db = DB::db(); - $env = $this->env; - $relYear = $env['year'] - $env['startyear']; - - $general = $this->generalObj; - $date = $general->getTurnTime($general::TURNTIME_HM); - - $nationID = $general->getNationID(); - - $nationCnt = count(getAllNationStaticInfo()); - - $totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2'); - $totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4'); - - $genCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc < 2', $nationID); - $npcCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND 3 <= npc AND npc <= 4', $nationID); - - $currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2); - $avgCnt = $currCnt / $nationCnt; - - $foundNpc = Util::randBool($this->calcFoundProp($env['maxgeneral'], $totalGenCnt, $totalNpcCnt)); - - $logger = $general->getLogger(); - - if (!$foundNpc) { - $logger->pushGeneralActionLog("인재를 찾을 수 없었습니다. <1>$date"); - - $incStat = Util::choiceRandomUsingWeight([ - 'leadership_exp' => $general->getLeadership(false, false, false, false), - 'strength_exp' => $general->getStrength(false, false, false, false), - 'intel_exp' => $general->getIntel(false, false, false, false) - ]); - [$reqGold, $reqRice] = $this->getCost(); - - $exp = 100; - $ded = 70; - - $general->increaseVarWithLimit('gold', -$reqGold, 0); - $general->increaseVarWithLimit('rice', -$reqRice, 0); - $general->addExperience($exp); - $general->addDedication($ded); - $general->increaseVar($incStat, 1); - $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); - $general->checkStatChange(); - tryUniqueItemLottery($general); - $general->applyDB($db); - return true; - } - //인간적으로 너무 길어서 끊었다! - - $exp = 200; - $ded = 300; - - $pickTypeList = ['무' => 6, '지' => 6, '무지' => 3]; - - $pickType = Util::choiceRandomUsingWeight($pickTypeList); - - $totalStat = GameConst::$defaultStatNPCTotal; - $minStat = GameConst::$defaultStatNPCMin; - $mainStat = GameConst::$defaultStatNPCMax - Util::randRangeInt(0, GameConst::$defaultStatNPCMin); - $otherStat = $minStat + Util::randRangeInt(0, Util::toInt(GameConst::$defaultStatNPCMin/2)); - $subStat = $totalStat - $mainStat - $otherStat; - if ($subStat < $minStat) { - $subStat = $otherStat; - $otherStat = $minStat; - $mainStat = $totalStat - $subStat - $otherStat; - if ($mainStat) { - throw new \LogicException('기본 스탯 설정값이 잘못되어 있음'); - } - } - - $avgGen = $db->queryFirstRow( - 'SELECT avg(dedication) as ded,avg(experience) as exp, - avg(dex1+dex2+dex3+dex4) as dex_t, avg(age) as age, avg(dex5) as dex5 - from general where npc < 5', - $nationID - ); - $dexTotal = $avgGen['dex_t']; - - if ($pickType == '무') { - $leadership = $subStat; - $strength = $mainStat; - $intel = $otherStat; - $dexVal = Util::choiceRandom([ - [$dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8, $dexTotal / 8], - [$dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8], - [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8], - ]); - } else if ($pickType == '지') { - $leadership = $subStat; - $strength = $otherStat; - $intel = $mainStat; - $dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8]; - } else { - $leadership = $otherStat; - $strength = $subStat; - $intel = $mainStat; - $dexVal = [$dexTotal / 4, $dexTotal / 4, $dexTotal / 4, $dexTotal / 4]; - } - - $leadership = Util::round($leadership); - $strength = Util::round($strength); - $intel = Util::round($intel); - - $scoutType = "발견"; - $scoutLevel = 0; - $scoutNation = 0; - - $age = Util::randRangeInt(20, 25); - $birthYear = $env['year'] - $age; - $deathYear = $env['year'] + Util::randRangeInt(10, 50); - - $cityID = Util::choiceRandom(array_keys(\sammo\CityConst::all())); - $newNPC = new \sammo\Scenario\NPC( - Util::randRangeInt(1, 150), - \sammo\getRandGenName(), - null, - $scoutNation, - $cityID, - $leadership, - $strength, - $intel, - $scoutLevel, - $birthYear, - $deathYear, - null, - null - ); - $newNPC->npc = 3; - $newNPC->setMoney(1000, 1000); - $newNPC->setExpDed($avgGen['exp'], $avgGen['ded']); - $newNPC->setSpecYear( - Util::round((GameConst::$retirementYear - $age) / 12) + $age, - Util::round((GameConst::$retirementYear - $age) / 6) + $age - ); - $newNPC->setDex( - $dexVal[0], - $dexVal[1], - $dexVal[2], - $dexVal[3], - $avgGen['dex5'] - ); - - $newNPC->build($this->env); - $npcName = $newNPC->realName; - $josaRa = JosaUtil::pick($npcName, '라'); - - $generalName = $general->getName(); - $josaYi = JosaUtil::pick($generalName, '이'); - - $logger->pushGeneralActionLog("$npcName{$josaRa}는 인재를 {$scoutType}하였습니다! <1>$date"); - $logger->pushGlobalActionLog("{$generalName}{$josaYi} $npcName{$josaRa}는 인재를 {$scoutType}하였습니다!"); - $logger->pushGeneralHistoryLog("$npcName{$josaRa}는 인재를 {$scoutType}"); - - $incStat = Util::choiceRandomUsingWeight([ - 'leadership_exp' => $general->getLeadership(false, false, false, false), - 'strength_exp' => $general->getStrength(false, false, false, false), - 'intel_exp' => $general->getIntel(false, false, false, false) - ]); - [$reqGold, $reqRice] = $this->getCost(); - - $exp = 200; - $ded = 300; - - $general->increaseVarWithLimit('gold', -$reqGold, 0); - $general->increaseVarWithLimit('rice', -$reqRice, 0); - $general->addExperience($exp); - $general->addDedication($ded); - $general->increaseVar($incStat, 3); - $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); - $general->checkStatChange(); - tryUniqueItemLottery($general); - $general->applyDB($db); - return true; - } -} +arg = null; + return true; + } + + protected function init() + { + + $general = $this->generalObj; + + $this->setNation(); + $env = $this->env; + + [$reqGold, $reqRice] = $this->getCost(); + + $this->fullConditionConstraints = [ + ConstraintHelper::ReqGeneralGold($reqGold), + ConstraintHelper::ReqGeneralRice($reqRice), + ]; + } + + public function getCommandDetailTitle(): string + { + $db = DB::db(); + $env = $this->env; + + $maxGenCnt = $env['maxgeneral']; + $totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2'); + $totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4'); + + $name = $this->getName(); + [$reqGold, $reqRice] = $this->getCost(); + + $foundProp = $this->calcFoundProp($maxGenCnt, $totalGenCnt, $totalNpcCnt); + $foundPropText = number_format($foundProp * 100, 1); + + $title = "{$name}(랜덤경험"; + if ($reqGold > 0) { + $title .= ", 자금{$reqGold}"; + } + if ($reqRice > 0) { + $title .= ", 군량{$reqRice}"; + } + + $title .= ", 확률 {$foundPropText}%)"; + return $title; + } + + public function getCost(): array + { + return [$this->env['develcost'], 0]; + } + + public function getPreReqTurn(): int + { + return 0; + } + + public function getPostReqTurn(): int + { + return 0; + } + + public function calcFoundProp(int $maxGenCnt, int $totalGenCnt, int $totalNpcCnt): float + { + + + $currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2); + $remainSlot = $maxGenCnt - $currCnt; + if ($remainSlot < 0) { + $remainSlot = 0; + } + + $foundPropMain = pow($remainSlot / $maxGenCnt, 6); + $foundPropSmall = 1 / ($totalNpcCnt / 3 + 1); + $foundPropBig = 1 / $maxGenCnt; + + if ($totalNpcCnt < 50) { + $foundProp = max($foundPropMain, $foundPropSmall); + } else { + $foundProp = max($foundPropMain, $foundPropBig); + } + return $foundProp; + } + + public function run(): bool + { + if (!$this->hasFullConditionMet()) { + throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); + } + + $db = DB::db(); + $env = $this->env; + $relYear = $env['year'] - $env['startyear']; + + $general = $this->generalObj; + $date = $general->getTurnTime($general::TURNTIME_HM); + + $nationID = $general->getNationID(); + + $totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2'); + $totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4'); + + $foundNpc = Util::randBool($this->calcFoundProp($env['maxgeneral'], $totalGenCnt, $totalNpcCnt)); + + $logger = $general->getLogger(); + + if (!$foundNpc) { + $logger->pushGeneralActionLog("인재를 찾을 수 없었습니다. <1>$date"); + + $incStat = Util::choiceRandomUsingWeight([ + 'leadership_exp' => $general->getLeadership(false, false, false, false), + 'strength_exp' => $general->getStrength(false, false, false, false), + 'intel_exp' => $general->getIntel(false, false, false, false) + ]); + [$reqGold, $reqRice] = $this->getCost(); + + $exp = 100; + $ded = 70; + + $general->increaseVarWithLimit('gold', -$reqGold, 0); + $general->increaseVarWithLimit('rice', -$reqRice, 0); + $general->addExperience($exp); + $general->addDedication($ded); + $general->increaseVar($incStat, 1); + $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); + return true; + } + //인간적으로 너무 길어서 끊었다! + + $exp = 200; + $ded = 300; + + $pickTypeList = ['무' => 6, '지' => 6, '무지' => 3]; + + $pickType = Util::choiceRandomUsingWeight($pickTypeList); + + $totalStat = GameConst::$defaultStatNPCTotal; + $minStat = GameConst::$defaultStatNPCMin; + $mainStat = GameConst::$defaultStatNPCMax - Util::randRangeInt(0, GameConst::$defaultStatNPCMin); + $otherStat = $minStat + Util::randRangeInt(0, Util::toInt(GameConst::$defaultStatNPCMin/2)); + $subStat = $totalStat - $mainStat - $otherStat; + if ($subStat < $minStat) { + $subStat = $otherStat; + $otherStat = $minStat; + $mainStat = $totalStat - $subStat - $otherStat; + if ($mainStat) { + throw new \LogicException('기본 스탯 설정값이 잘못되어 있음'); + } + } + + $avgGen = $db->queryFirstRow( + 'SELECT avg(dedication) as ded,avg(experience) as exp, + avg(dex1+dex2+dex3+dex4) as dex_t, avg(age) as age, avg(dex5) as dex5 + from general where npc < 5', + $nationID + ); + $dexTotal = $avgGen['dex_t']; + + if ($pickType == '무') { + $leadership = $subStat; + $strength = $mainStat; + $intel = $otherStat; + $dexVal = Util::choiceRandom([ + [$dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8, $dexTotal / 8], + [$dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8], + [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8], + ]); + } else if ($pickType == '지') { + $leadership = $subStat; + $strength = $otherStat; + $intel = $mainStat; + $dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8]; + } else { + $leadership = $otherStat; + $strength = $subStat; + $intel = $mainStat; + $dexVal = [$dexTotal / 4, $dexTotal / 4, $dexTotal / 4, $dexTotal / 4]; + } + + $leadership = Util::round($leadership); + $strength = Util::round($strength); + $intel = Util::round($intel); + + $scoutType = "발견"; + $scoutLevel = 0; + $scoutNation = 0; + + $age = Util::randRangeInt(20, 25); + $birthYear = $env['year'] - $age; + $deathYear = $env['year'] + Util::randRangeInt(10, 50); + + $cityID = Util::choiceRandom(array_keys(\sammo\CityConst::all())); + $newNPC = new \sammo\Scenario\NPC( + Util::randRangeInt(1, 150), + \sammo\getRandGenName(), + null, + $scoutNation, + $cityID, + $leadership, + $strength, + $intel, + $scoutLevel, + $birthYear, + $deathYear, + null, + null + ); + $newNPC->npc = 3; + $newNPC->setMoney(1000, 1000); + $newNPC->setExpDed($avgGen['exp'], $avgGen['ded']); + $newNPC->setSpecYear( + Util::round((GameConst::$retirementYear - $age) / 12) + $age, + Util::round((GameConst::$retirementYear - $age) / 6) + $age + ); + $newNPC->setDex( + $dexVal[0], + $dexVal[1], + $dexVal[2], + $dexVal[3], + $avgGen['dex5'] + ); + + $newNPC->build($this->env); + $npcName = $newNPC->realName; + $josaRa = JosaUtil::pick($npcName, '라'); + + $generalName = $general->getName(); + $josaYi = JosaUtil::pick($generalName, '이'); + + $logger->pushGeneralActionLog("$npcName{$josaRa}는 인재를 {$scoutType}하였습니다! <1>$date"); + $logger->pushGlobalActionLog("{$generalName}{$josaYi} $npcName{$josaRa}는 인재를 {$scoutType}하였습니다!"); + $logger->pushGeneralHistoryLog("$npcName{$josaRa}는 인재를 {$scoutType}"); + + $incStat = Util::choiceRandomUsingWeight([ + 'leadership_exp' => $general->getLeadership(false, false, false, false), + 'strength_exp' => $general->getStrength(false, false, false, false), + 'intel_exp' => $general->getIntel(false, false, false, false) + ]); + [$reqGold, $reqRice] = $this->getCost(); + + $exp = 200; + $ded = 300; + + $general->increaseVarWithLimit('gold', -$reqGold, 0); + $general->increaseVarWithLimit('rice', -$reqRice, 0); + $general->addExperience($exp); + $general->addDedication($ded); + $general->increaseVar($incStat, 3); + $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); + tryUniqueItemLottery($general); + $general->applyDB($db); + return true; + } +} diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index f78fbf5b..b10fb3ab 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -534,7 +534,7 @@ class GeneralAI if(!key_exists($userGeneral->getCityID(), $this->nationCities)){ continue; } - $city = $this->supplyCities[$userGeneral->getCityID()]; + $city = $this->nationCities[$userGeneral->getCityID()]; $troopLeaderID = $userGeneral->getVar('troop'); if(!$troopLeaderID || !key_exists($troopLeaderID, $this->troopLeaders)){ continue; @@ -2778,7 +2778,7 @@ class GeneralAI if($city['city'] === $candidate['city']){ continue; } - $realDevelRate = 0; + $realDevelRate = 0.0001; //하단의 나눗셈 foreach($this->calcCityDevelRate($candidate) as $develKey => [$develVal, $develType]){ if(!($this->genType & $develType)){