유산 포인트 시스템, 추가 기수 대비 (#187)
- 유산 포인트 - 기수 뒤로도 누적되는 포인트 - 생존, 최대 임관년 수, 최대 연속 내정 성공, 병종 상성 우위 횟수, 전투 횟수, 계략 성공 횟수, 천통 기여(규모 상승, 천통 수뇌, 천통 군주), 숙련도, 토너먼트, 베팅 당첨 - 유산 관리 페이지 제공 - 태수국 - 181년 1월에 자동 생성되는 u장수국 - 시간이 지나면 사실상 자동 소멸 - 유저국과는 4칸 거리, 서로는 2칸 거리 - 이 시스템으로 인해 m장 거병 차단 - NPC 원조시 불가침 - 1년 세수만큼 받은 경우 24개월 불가침 제안 - 최소 6개월 - 불가침을 받지 않고 추가 원조한 경우 계속해서 기간 상승 - 단, 불가침 수락 전에 선포를 할 수 있음 Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/187 Co-authored-by: hide_d <hided62@gmail.com> Co-committed-by: hide_d <hided62@gmail.com>
This commit was merged in pull request #187.
This commit is contained in:
+86
-2
@@ -1712,6 +1712,88 @@ class GeneralAI
|
||||
return $cmd;
|
||||
}
|
||||
|
||||
// 군주 행동
|
||||
protected function do불가침제의(LastTurn $lastTurn): ?NationCommand
|
||||
{
|
||||
$general = $this->general;
|
||||
|
||||
if($general->getVar('officer_level') < 12){
|
||||
return null;
|
||||
}
|
||||
|
||||
$nation = $this->nation;
|
||||
$nationID = $nation['nation'];
|
||||
|
||||
$nationStor = KVStorage::getStorage(DB::db(), $nationID, 'nation_env');
|
||||
$recvAssist = $nationStor->getValue('recv_assist')??[];
|
||||
$respAssist = $nationStor->getValue('resp_assist')??[];
|
||||
$respAssistTry = $nationStor->getValue('resp_assist_try')??[];
|
||||
|
||||
$yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']);
|
||||
|
||||
$candidateList = [];
|
||||
foreach($recvAssist as [$candNationID, $amount]){
|
||||
$amount -= $respAssist["n{$candNationID}"][1]??0;
|
||||
if($amount <= 0){
|
||||
continue;
|
||||
}
|
||||
if(key_exists($candNationID, $this->warTargetNation)){
|
||||
continue;
|
||||
}
|
||||
if(($respAssistTry["n{$candNationID}"][1]??0) >= $yearMonth - 8){
|
||||
continue;
|
||||
}
|
||||
$candidateList[$candNationID] = $amount;
|
||||
}
|
||||
|
||||
if(!$candidateList){
|
||||
return null;
|
||||
}
|
||||
|
||||
$cityList = $this->supplyCities;
|
||||
|
||||
if (!$cityList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$goldIncome = getGoldIncome($nation['nation'], $nation['level'], 15, $nation['capital'], $nation['type'], $cityList);
|
||||
$riceIncome = getRiceIncome($nation['nation'], $nation['level'], 15, $nation['capital'], $nation['type'], $cityList);
|
||||
$wallIncome = getWallIncome($nation['nation'], $nation['level'], 15, $nation['capital'], $nation['type'], $cityList);
|
||||
$income = $goldIncome + $riceIncome + $wallIncome;
|
||||
|
||||
arsort($candidateList);
|
||||
$destNationID = null;
|
||||
$diplomatMonth = 0;
|
||||
foreach($candidateList as $candNationID => $amount){
|
||||
if($amount * 4 < $income){
|
||||
break;
|
||||
}
|
||||
$destNationID = $candNationID;
|
||||
$diplomatMonth = 24 * $amount / $income;
|
||||
break;
|
||||
}
|
||||
|
||||
if($destNationID === null){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
[$targetYear, $targetMonth] = Util::parseYearMonth($yearMonth + $diplomatMonth);
|
||||
|
||||
$cmd = buildNationCommandClass('che_불가침제의', $this->general, $this->env, $lastTurn, [
|
||||
'destNationID' => $destNationID,
|
||||
'year' => $targetYear,
|
||||
'month' => $targetMonth,
|
||||
]);
|
||||
if(!$cmd->hasFullConditionMet()){
|
||||
return null;
|
||||
}
|
||||
|
||||
$respAssistTry["n{$destNationID}"] = [$destNationID, $yearMonth];
|
||||
$nationStor->setValue('resp_assist_try', $respAssistTry);
|
||||
|
||||
return $cmd;
|
||||
}
|
||||
|
||||
// 군주 행동
|
||||
protected function do선전포고(LastTurn $lastTurn): ?NationCommand
|
||||
@@ -3067,6 +3149,9 @@ class GeneralAI
|
||||
if($general->getVar('makelimit')){
|
||||
return null;
|
||||
}
|
||||
if($general->getNPCType() > 2){
|
||||
return null;
|
||||
}
|
||||
if(!$this->generalPolicy->can건국){
|
||||
return null;
|
||||
}
|
||||
@@ -3167,8 +3252,7 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Util::randBool(pow(1 / $nationCnt / pow($notFullNationCnt, 3), 1 / 4))) {
|
||||
//국가가 1개일 경우에는 '임관하지 않음'
|
||||
if (Util::randBool(pow(1 / ($nationCnt + 1) / pow($notFullNationCnt, 3), 1 / 4))) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user