Compare commits

..
11 Commits
16 changed files with 404 additions and 313 deletions
+64 -11
View File
@@ -148,8 +148,30 @@ echo "
unset($city); unset($city);
// 첩보된 도시까지만 허용 // 첩보된 도시까지만 허용
if($valid == 0 && $userGrade < 5) {
$showDetailedInfo = false;
if($valid){
$showDetailedInfo = true;
}
if(!key_exists($citylist, CityConst::all())){
$citylist = $me['city']; $citylist = $me['city'];
$showDetailedInfo = true;
$valid = 1;
}
if($userGrade >= 5){
$valid = true;
}
if(!$valid) {
$ownCities = Util::convertArrayToSetLike($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i AND nation != 0', $me['nation']));
foreach(array_keys(CityConst::byID($citylist)->path) as $pathID){
if(key_exists($pathID, $ownCities)){
$showDetailedInfo = true;
break;
}
}
} }
@@ -172,11 +194,35 @@ if($city['trade'] === null) {
} }
$dbColumns = General::mergeQueryColumn(['npc', 'defence_train', 'no', 'picture', 'imgsvr', 'name', 'injury', 'leadership', 'strength', 'intel', 'officer_level', 'nation', 'crewtype', 'crew', 'train', 'atmos'], 2)[0]; $dbColumns = General::mergeQueryColumn(['npc', 'defence_train', 'no', 'picture', 'imgsvr', 'name', 'injury', 'leadership', 'strength', 'intel', 'officer_level', 'nation', 'crewtype', 'crew', 'train', 'atmos'], 2)[0];
$generals = $db->query( if($showDetailedInfo){
'SELECT %l from general where city=%i order by name', $generals = $db->query(
Util::formatListOfBackticks($dbColumns), 'SELECT %l from general where city=%i order by name',
$city['city'] Util::formatListOfBackticks($dbColumns),
); $city['city']
);
}
else{
$generals = [];
}
if($valid){
$city['trustText'] = round($city['trust'], 1);
$city['popRateText'] = round($city['pop']/$city['pop_max']*100, 2);
}
else{
$city['agri'] = '?';
$city['comm'] = '?';
$city['pop'] = '?';
$city['secu'] = '?';
$city['trustText'] = '?';
$city['popRateText'] = '?';
if($city['nation'] != 0){
$city['def'] = '?';
$city['wall'] = '?';
}
}
$generalTurnList = []; $generalTurnList = [];
@@ -257,6 +303,10 @@ foreach($generals as $general){
$crew = $general['crew']; $crew = $general['crew'];
$train = -1; $train = -1;
$atmos = -1; $atmos = -1;
if(!$valid){
$crew = -1;
}
} }
$nation = $general['nation']; $nation = $general['nation'];
@@ -331,7 +381,9 @@ foreach($generalsFormat as $general){
} }
if($general['nation'] != $myNation['nation']){ if($general['nation'] != $myNation['nation']){
$enemyCnt += 1; $enemyCnt += 1;
$enemyCrew += $general['crew']; if($general['crew'] >= 0){
$enemyCrew += $general['crew'];
}
if($general['crew'] > 0){ if($general['crew'] > 0){
$enemyArmedCnt += 1; $enemyArmedCnt += 1;
} }
@@ -402,11 +454,11 @@ foreach($generalsFormat as $general){
</tr> </tr>
<tr> <tr>
<td align=center class=bg1>민심</td> <td align=center class=bg1>민심</td>
<td align=center><?=round($city['trust'], 1)?></td> <td align=center><?=$city['trustText']?></td>
<td align=center class=bg1>시세</td> <td align=center class=bg1>시세</td>
<td align=center><?=$city['trade']?>%</td> <td align=center><?=$city['trade']?>%</td>
<td align=center class=bg1>인구</td> <td align=center class=bg1>인구</td>
<td align=center><?=round($city['pop']/$city['pop_max']*100, 2)?>%</td> <td align=center><?=$city['popRateText']?>%</td>
<td align=center class=bg1>태수</td> <td align=center class=bg1>태수</td>
<td align=center><?=$officer[4]['name']?></td> <td align=center><?=$officer[4]['name']?></td>
<td align=center class=bg1>군사</td> <td align=center class=bg1>군사</td>
@@ -430,11 +482,12 @@ foreach($generalsFormat as $general){
</tr> </tr>
<tr> <tr>
<td align=center class=bg1>장수</td> <td align=center class=bg1>장수</td>
<td colspan=11><?=join(', ', $generalsName)?></td> <td colspan=11><?=$showDetailedInfo?join(', ', $generalsName):'<span style="color:gray">알 수 없음</span>'?></td>
</tr> </tr>
</table> </table>
<br> <br>
<?php if($showDetailedInfo): ?>
<table align=center class='tb_layout bg0'> <table align=center class='tb_layout bg0'>
<thead> <thead>
<tr> <tr>
@@ -459,7 +512,7 @@ foreach($generalsFormat as $general){
?> ?>
</tbody> </tbody>
</table> </table>
<?php endif; ?>
<table align=center width=1000 class='tb_layout bg0'> <table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr> <tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?> </td></tr> <tr><td><?=banner()?> </td></tr>
+2 -2
View File
@@ -235,10 +235,10 @@ function reloadWorldMap(option, drawTarget) {
} }
function mergeClickable(city) { function mergeClickable(city) {
//clickable = (remainSpy << 3) | (ourCity << 2) | (shownByGeneral << 1) | clickableAll //clickable = (defaultCity << 4 ) | (remainSpy << 3) | (ourCity << 2) | (shownByGeneral << 1) | clickableAll
var id = city.id; var id = city.id;
var nationId = city.nationId; var nationId = city.nationId;
var clickable = 0; var clickable = 16;
if (id in spyList) { if (id in spyList) {
clickable |= spyList[id] << 3; clickable |= spyList[id] << 3;
} }
@@ -18,12 +18,16 @@ class event_전투특기_격노 extends \sammo\BaseItem{
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
protected $reqSecu = 3000; protected $reqSecu = 3000;
public function getWarPowerMultiplier(WarUnit $unit):array{
$activatedCnt = $unit->hasActivatedSkillOnLog('격노');
return [1 + 0.2*$activatedCnt, 1];
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller( return new WarUnitTriggerCaller(
new che_격노시도($unit), new che_격노시도($unit, che_격노시도::TYPE_ITEM),
new che_격노발동($unit) new che_격노발동($unit, che_격노발동::TYPE_ITEM)
); );
} }
} }
+134 -134
View File
@@ -1,135 +1,135 @@
<?php <?php
namespace sammo\Command\General; namespace sammo\Command\General;
use \sammo\{ use \sammo\{
DB, Util, JosaUtil, DB, Util, JosaUtil,
General, General,
ActionLogger, ActionLogger,
GameConst, GameUnitConst, GameConst, GameUnitConst,
LastTurn, LastTurn,
Command Command
}; };
use function \sammo\{ use function \sammo\{
tryUniqueItemLottery tryUniqueItemLottery
}; };
use \sammo\Constraint\Constraint; use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper; use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst; use sammo\CityConst;
use function sammo\DeleteConflict; use function sammo\DeleteConflict;
use function sammo\refreshNationStaticInfo; use function sammo\refreshNationStaticInfo;
class che_방랑 extends Command\GeneralCommand{ class che_방랑 extends Command\GeneralCommand{
static protected $actionName = '방랑'; static protected $actionName = '방랑';
protected function argTest():bool{ protected function argTest():bool{
$this->arg = null; $this->arg = null;
return true; return true;
} }
protected function init(){ protected function init(){
$general = $this->generalObj; $general = $this->generalObj;
$env = $this->env; $env = $this->env;
$this->setCity(); $this->setCity();
$this->setNation(); $this->setNation();
$relYear = $env['year'] - $env['startyear']; $relYear = $env['year'] - $env['startyear'];
$this->fullConditionConstraints=[ $this->fullConditionConstraints=[
ConstraintHelper::BeLord(), ConstraintHelper::BeLord(),
ConstraintHelper::NotWanderingNation(), ConstraintHelper::NotWanderingNation(),
ConstraintHelper::NotOpeningPart($relYear), ConstraintHelper::NotOpeningPart($relYear),
ConstraintHelper::AllowDiplomacyStatus($this->generalObj->getNationID(), [ ConstraintHelper::AllowDiplomacyStatus($this->generalObj->getNationID(), [
2, 7 2, 7
], '방랑할 수 없는 외교상태입니다.'), ], '방랑할 수 없는 외교상태입니다.'),
]; ];
} }
public function getCost():array{ public function getCost():array{
return [0, 0]; return [0, 0];
} }
public function getPreReqTurn():int{ public function getPreReqTurn():int{
return 0; return 0;
} }
public function getPostReqTurn():int{ public function getPostReqTurn():int{
return 0; return 0;
} }
public function run():bool{ public function run():bool{
if(!$this->hasFullConditionMet()){ if(!$this->hasFullConditionMet()){
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
} }
$db = DB::db(); $db = DB::db();
$env = $this->env; $env = $this->env;
$general = $this->generalObj; $general = $this->generalObj;
$date = $general->getTurnTime($general::TURNTIME_HM); $date = $general->getTurnTime($general::TURNTIME_HM);
$generalName = $general->getName(); $generalName = $general->getName();
$josaYi = JosaUtil::pick($generalName, '이'); $josaYi = JosaUtil::pick($generalName, '이');
$josaUn = JosaUtil::pick($generalName, '은'); $josaUn = JosaUtil::pick($generalName, '은');
$nationID = $general->getNationID(); $nationID = $general->getNationID();
$nationName = $this->nation['name']; $nationName = $this->nation['name'];
$josaUl = JosaUtil::pick($nationName, '을'); $josaUl = JosaUtil::pick($nationName, '을');
$logger = $general->getLogger(); $logger = $general->getLogger();
$logger->pushGeneralActionLog("영토를 버리고 방랑의 길을 떠납니다. <1>$date</>"); $logger->pushGeneralActionLog("영토를 버리고 방랑의 길을 떠납니다. <1>$date</>");
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} 방랑의 길을 떠납니다."); $logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} 방랑의 길을 떠납니다.");
$logger->pushGlobalHistoryLog("<R><b>【방랑】</b></><D><b>{$generalName}</b></>{$josaUn} <R>방랑</>의 길을 떠납니다."); $logger->pushGlobalHistoryLog("<R><b>【방랑】</b></><D><b>{$generalName}</b></>{$josaUn} <R>방랑</>의 길을 떠납니다.");
$logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>{$josaUl} 버리고 방랑"); $logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>{$josaUl} 버리고 방랑");
//분쟁기록 모두 지움 //분쟁기록 모두 지움
DeleteConflict($nationID); DeleteConflict($nationID);
// 국명, 색깔 바꿈 국가 레벨 0, 성향리셋, 기술0 // 국명, 색깔 바꿈 국가 레벨 0, 성향리셋, 기술0
$db->update('nation', [ $db->update('nation', [
'name'=>$generalName, 'name'=>$generalName,
'color'=>'#330000', //TODO: 기본 방랑군색 별도 지정 'color'=>'#330000', //TODO: 기본 방랑군색 별도 지정
'level'=>0, 'level'=>0,
'type'=>0, 'type'=>'None',
'tech'=>0, 'tech'=>0,
'capital'=>0 'capital'=>0
], 'nation=%i', $nationID); ], 'nation=%i', $nationID);
$db->update('general', [ $db->update('general', [
'makelimit'=>12 'makelimit'=>12
], 'nation=%i', $nationID); ], 'nation=%i', $nationID);
$general->setVar('makelimit', 12); $general->setVar('makelimit', 12);
$general->setVar('officer_city', 0); $general->setVar('officer_city', 0);
$db->update('general', [ $db->update('general', [
'officer_level'=>1, 'officer_level'=>1,
'officer_city'=>0, 'officer_city'=>0,
], 'nation=%i AND officer_level < 12', $nationID); ], 'nation=%i AND officer_level < 12', $nationID);
$db->update('city', [ $db->update('city', [
'nation'=>0, 'nation'=>0,
'front'=>0, 'front'=>0,
'conflict'=>'{}' 'conflict'=>'{}'
], 'nation=%i', $nationID); ], 'nation=%i', $nationID);
$db->update('diplomacy', [ $db->update('diplomacy', [
'state'=>2, 'state'=>2,
'term'=>0, 'term'=>0,
], 'me=%i OR you=%i', $nationID, $nationID); ], 'me=%i OR you=%i', $nationID, $nationID);
refreshNationStaticInfo(); refreshNationStaticInfo();
$this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->applyDB($db); $general->applyDB($db);
return true; return true;
} }
} }
@@ -134,7 +134,8 @@ class che_인재탐색 extends Command\GeneralCommand
$totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2'); $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'); $totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4');
$foundNpc = Util::randBool($this->calcFoundProp($env['maxgeneral'], $totalGenCnt, $totalNpcCnt)); $foundProp = $this->calcFoundProp($env['maxgeneral'], $totalGenCnt, $totalNpcCnt);
$foundNpc = Util::randBool($foundProp);
$logger = $general->getLogger(); $logger = $general->getLogger();
@@ -164,8 +165,8 @@ class che_인재탐색 extends Command\GeneralCommand
} }
//인간적으로 너무 길어서 끊었다! //인간적으로 너무 길어서 끊었다!
$exp = 200; $exp = 100 * (sqrt(1 / $foundProp) + 1);
$ded = 300; $ded = 150 * (sqrt(1 / $foundProp) + 1);
$pickTypeList = ['무' => 6, '지' => 6, '무지' => 3]; $pickTypeList = ['무' => 6, '지' => 6, '무지' => 3];
@@ -206,7 +207,7 @@ class che_인재탐색 extends Command\GeneralCommand
$leadership = $subStat; $leadership = $subStat;
$strength = $otherStat; $strength = $otherStat;
$intel = $mainStat; $intel = $mainStat;
$dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8]; $dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8];
} else { } else {
$leadership = $otherStat; $leadership = $otherStat;
$strength = $subStat; $strength = $subStat;
+99 -98
View File
@@ -1,99 +1,100 @@
<?php <?php
namespace sammo\Command\General; namespace sammo\Command\General;
use \sammo\{ use \sammo\{
DB, Util, JosaUtil, DB, Util, JosaUtil,
General, General,
ActionLogger, ActionLogger,
GameConst, GameUnitConst, GameConst, GameUnitConst,
Command Command
}; };
class che_탈취 extends che_화계{ class che_탈취 extends che_화계{
static protected $actionName = '탈취'; static protected $actionName = '탈취';
static protected $statType = 'strength'; static protected $statType = 'strength';
static protected $injuryGeneral = false; static protected $injuryGeneral = false;
protected function affectDestCity(int $injuryCount){ protected function affectDestCity(int $injuryCount){
$general = $this->generalObj; $general = $this->generalObj;
$nationID = $general->getNationID(); $nationID = $general->getNationID();
$date = $general->getTurnTime($general::TURNTIME_HM); $date = $general->getTurnTime($general::TURNTIME_HM);
$logger = $general->getLogger(); $logger = $general->getLogger();
$destCity = $this->destCity; $destCity = $this->destCity;
$destCityName = $destCity['name']; $destCityName = $destCity['name'];
$destCityID = $destCity['city']; $destCityID = $destCity['city'];
$destNationID = $destCity['nation']; $destNationID = $destCity['nation'];
$commandName = $this->getName(); $commandName = $this->getName();
$db = DB::db(); $db = DB::db();
// 탈취 최대 400 * 8 // 탈취 최대 800 * 8 * sqrt(1 + (year - startyear) / 5) / 2
$gold = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level']; $yearCoef = sqrt(1 + ($this->env['year'] - $this->env['startyear']) / 5) / 2;
$rice = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level']; $gold = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level'] * $yearCoef;
$rice = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level'] * $yearCoef;
if($destCity['supply']){
[$destNationGold, $destNationRice] = $db->queryFirstList('SELECT gold,rice FROM nation WHERE nation=%i', $destNationID); if($destCity['supply']){
[$destNationGold, $destNationRice] = $db->queryFirstList('SELECT gold,rice FROM nation WHERE nation=%i', $destNationID);
$destNationGold -= $gold;
$destNationRice -= $rice; $destNationGold -= $gold;
$destNationRice -= $rice;
if($destNationGold < GameConst::$minNationalGold) {
$gold += $destNationGold - GameConst::$minNationalGold; if($destNationGold < GameConst::$minNationalGold) {
$destNationGold = GameConst::$minNationalGold; $gold += $destNationGold - GameConst::$minNationalGold;
} $destNationGold = GameConst::$minNationalGold;
if($destNationRice < GameConst::$minNationalRice) { }
$rice += $destNationRice - GameConst::$minNationalRice; if($destNationRice < GameConst::$minNationalRice) {
$destNationRice = GameConst::$minNationalRice; $rice += $destNationRice - GameConst::$minNationalRice;
} $destNationRice = GameConst::$minNationalRice;
}
$db->update('nation', [
'gold'=>$destNationGold, $db->update('nation', [
'rice'=>$destNationRice 'gold'=>$destNationGold,
], 'nation=%i', $destNationID); 'rice'=>$destNationRice
$db->update('city', [ ], 'nation=%i', $destNationID);
'state'=>34 $db->update('city', [
], 'city=%i', $destCityID); 'state'=>34
} ], 'city=%i', $destCityID);
else{ }
$db->update('city', [ else{
'comm'=>Util::valueFit($destCity['comm'] - $gold / 12, 0), $db->update('city', [
'agri'=>Util::valueFit($destCity['agri'] - $rice / 12, 0), 'comm'=>Util::valueFit($destCity['comm'] - $gold / 12, 0),
'state'=>34 'agri'=>Util::valueFit($destCity['agri'] - $rice / 12, 0),
], 'city=%i', $destCityID); 'state'=>34
} ], 'city=%i', $destCityID);
}
// 본국으로 일부 회수, 재야이면 본인이 전량 소유
if($nationID != 0) { // 본국으로 일부 회수, 재야이면 본인이 전량 소유
$db->update('nation', [ if($nationID != 0) {
'gold' => $db->sqleval('gold + %i', Util::round($gold * 0.7)), $db->update('nation', [
'rice' => $db->sqleval('rice + %i', Util::round($rice * 0.7)) 'gold' => $db->sqleval('gold + %i', Util::round($gold * 0.7)),
], 'nation=%i', $nationID); 'rice' => $db->sqleval('rice + %i', Util::round($rice * 0.7))
$general->increaseVar('gold', $gold - Util::round($gold * 0.7)); ], 'nation=%i', $nationID);
$general->increaseVar('rice', $rice - Util::round($rice * 0.7)); $general->increaseVar('gold', $gold - Util::round($gold * 0.7));
} else { $general->increaseVar('rice', $rice - Util::round($rice * 0.7));
$general->increaseVar('gold', $gold); } else {
$general->increaseVar('rice', $rice); $general->increaseVar('gold', $gold);
} $general->increaseVar('rice', $rice);
}
$db->update('city', [
'state'=>32, $db->update('city', [
'agri'=>$destCity['agri'], 'state'=>32,
'comm'=>$destCity['comm'] 'agri'=>$destCity['agri'],
], 'city=%i', $destCityID); 'comm'=>$destCity['comm']
], 'city=%i', $destCityID);
$goldText = number_format($gold);
$riceText = number_format($rice); $goldText = number_format($gold);
$riceText = number_format($rice);
$josaYi = JosaUtil::pick($destCityName, '이');
$logger->pushGlobalActionLog("<G><b>{$destCityName}</b></>에서 금과 쌀을 도둑맞았습니다."); $josaYi = JosaUtil::pick($destCityName, '이');
$josaYi = JosaUtil::pick($commandName, '이'); $logger->pushGlobalActionLog("<G><b>{$destCityName}</b></>에서 금과 쌀을 도둑맞았습니다.");
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>에 {$commandName}{$josaYi} 성공했습니다. <1>$date</>"); $josaYi = JosaUtil::pick($commandName, '이');
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>에 {$commandName}{$josaYi} 성공했습니다. <1>$date</>");
$logger->pushGeneralActionLog("금<C>{$goldText}</> 쌀<C>{$riceText}</>을 획득했습니다.", ActionLogger::PLAIN);
} $logger->pushGeneralActionLog("금<C>{$goldText}</> 쌀<C>{$riceText}</>을 획득했습니다.", ActionLogger::PLAIN);
}
} }
@@ -185,7 +185,7 @@ class che_의병모집 extends Command\NationCommand
$leadership = $subStat; $leadership = $subStat;
$strength = $otherStat; $strength = $otherStat;
$intel = $mainStat; $intel = $mainStat;
$dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8]; $dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8];
} else { } else {
$leadership = $otherStat; $leadership = $otherStat;
$strength = $subStat; $strength = $subStat;
@@ -176,7 +176,7 @@ class che_이호경식 extends Command\NationCommand
$broadcastMessage = "아국에 <M>{$commandName}</>{$josaYiCommand} 발동되었습니다."; $broadcastMessage = "아국에 <M>{$commandName}</>{$josaYiCommand} 발동되었습니다.";
$destNationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID); $destNationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $destNationID, $generalID);
foreach ($destNationGeneralList as $destNationGeneralID) { foreach ($destNationGeneralList as $destNationGeneralID) {
$destNationGeneralLogger = new ActionLogger($destNationGeneralID, $destNationID, $year, $month); $destNationGeneralLogger = new ActionLogger($destNationGeneralID, $destNationID, $year, $month);
$destNationGeneralLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN); $destNationGeneralLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
@@ -197,6 +197,10 @@ class che_이호경식 extends Command\NationCommand
'state' => 1, 'state' => 1,
], '(me = %i AND you = %i) OR (you = %i AND me = %i)', $nationID, $destNationID, $nationID, $destNationID); ], '(me = %i AND you = %i) OR (you = %i AND me = %i)', $nationID, $destNationID, $nationID, $destNationID);
\sammo\SetNationFront($nationID);
\sammo\SetNationFront($destNationID);
$this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->applyDB($db); $general->applyDB($db);
+1 -1
View File
@@ -40,7 +40,7 @@ class BattleGroundCity extends Constraint{
$db = DB::db(); $db = DB::db();
$diplomacy = $db->queryFirstField('SELECT state FROM diplomacy WHERE me = %i AND you = %i', $nationID, $destNationID); $diplomacy = $db->queryFirstField('SELECT state FROM diplomacy WHERE me = %i AND you = %i', $nationID, $destNationID);
if($diplomacy === 0){ if($diplomacy == 0){
return true; return true;
} }
+1 -1
View File
@@ -48,7 +48,7 @@ class GameConstBase
/** @var int 계략시 최소 수치 감소량*/ /** @var int 계략시 최소 수치 감소량*/
public static $sabotageDamageMin = 100; public static $sabotageDamageMin = 100;
/** @var int 계략시 최대 수치 감소량*/ /** @var int 계략시 최대 수치 감소량*/
public static $sabotageDamageMax = 500; public static $sabotageDamageMax = 800;
/** @var string 기본 배경색깔 푸른색*/ /** @var string 기본 배경색깔 푸른색*/
public static $basecolor = "#000044"; public static $basecolor = "#000044";
/** @var string 기본 배경색깔 초록색*/ /** @var string 기본 배경색깔 초록색*/
+26 -2
View File
@@ -1723,7 +1723,15 @@ class GeneralAI
return null; return null;
} }
$db = DB::db();
$lowTargetNations = Util::convertArrayToSetLike($db->queryFirstColumn(
'SELECT DISTINCT(me) FROM diplomacy WHERE me != %i AND state IN %li',
$nationID,
[0, 1]
));
$nations = []; $nations = [];
$warNations = [];
foreach(getAllNationStaticInfo() as $destNation){ foreach(getAllNationStaticInfo() as $destNation){
if($destNation['level'] == 0){ if($destNation['level'] == 0){
continue; continue;
@@ -1733,10 +1741,26 @@ class GeneralAI
if (!isNeighbor($nationID, $destNationID)) { if (!isNeighbor($nationID, $destNationID)) {
continue; continue;
} }
$nations[$destNationID] = 1 / sqrt($destNationPower + 1);
if(!key_exists($destNationID, $lowTargetNations)){
$nations[$destNationID] = 1 / sqrt($destNationPower + 1);
}
else{
$warNations[$destNationID] = 1 / sqrt($destNationPower + 1);
}
} }
if (!$nations) { if (!$nations) {
return null; if(!$warNations){
return null;
}
if(!$lowTargetNations){
return null;
}
if(Util::randBool(1/count($lowTargetNations))){
return null;
}
$nations = $warNations;
} }
$cmd = buildNationCommandClass('che_선전포고', $this->general, $this->env, $lastTurn, [ $cmd = buildNationCommandClass('che_선전포고', $this->general, $this->env, $lastTurn, [
@@ -41,6 +41,10 @@ class che_계략시도 extends BaseWarUnitTrigger{
if($magicTrialProb <= 0){ if($magicTrialProb <= 0){
return true; return true;
} }
if($self->getPhase() == 0){
$magicTrialProb *= 3;
}
if(!Util::randBool($magicTrialProb)){ if(!Util::randBool($magicTrialProb)){
return true; return true;
@@ -31,6 +31,6 @@ class che_저지발동 extends BaseWarUnitTrigger{
$self->setWarPowerMultiply(0); $self->setWarPowerMultiply(0);
$oppose->setWarPowerMultiply(0); $oppose->setWarPowerMultiply(0);
return false; //저지는 모든 특수 이벤트를 중지시킨다. return false; //저지는 모든 이벤트를 중지시킨다.
} }
} }
@@ -26,7 +26,7 @@ class che_필살시도 extends BaseWarUnitTrigger{
return true; return true;
} }
$self->activateSkill('특수', '필살시도', '필살'); $self->activateSkill('필살시도', '필살');
return true; return true;
@@ -26,7 +26,7 @@ class che_회피시도 extends BaseWarUnitTrigger{
return true; return true;
} }
$self->activateSkill('특수', '회피시도', '회피'); $self->activateSkill('회피시도', '회피');
return true; return true;
+52 -52
View File
@@ -1,53 +1,53 @@
<tr <tr
data-is-our-general="<?=$ourGeneral?'true':'false'?>" data-is-our-general="<?=$ourGeneral?'true':'false'?>"
data-is-npc="<?=$isNPC?'true':'false'?>" data-is-npc="<?=$isNPC?'true':'false'?>"
data-general-wounded="<?=$wounded?>" data-general-wounded="<?=$wounded?>"
data-general-name="<?=$this->e($name)?>" data-general-name="<?=$this->e($name)?>"
data-general-leadership="<?=$leadership?>" data-general-leadership="<?=$leadership?>"
data-general-strength="<?=$strength?>" data-general-strength="<?=$strength?>"
data-general-intel="<?=$intel?>" data-general-intel="<?=$intel?>"
data-general-officer-level="<?=$officerLevel?>" data-general-officer-level="<?=$officerLevel?>"
data-general-leadership-bonus="<?=$leadershipBonus?>" data-general-leadership-bonus="<?=$leadershipBonus?>"
<?php if($ourGeneral): ?> <?php if($ourGeneral): ?>
data-general-defence-train="<?=$defenceTrain?>" data-general-defence-train="<?=$defenceTrain?>"
data-general-crew-type="<?=$crewType?>" data-general-crew-type="<?=$crewType?>"
data-general-crew="<?=$crew?>" data-general-crew="<?=$crew?>"
data-general-train="<?=$train?>" data-general-train="<?=$train?>"
data-general-atmos="<?=$atmos?>" data-general-atmos="<?=$atmos?>"
<?php else: ?> <?php else: ?>
data-general-crew="<?=$crew?>" data-general-crew="<?=$crew?>"
<?php endif; ?> <?php endif; ?>
data-general-nation="<?=$nation?>" data-general-nation="<?=$nation?>"
data-general-nation-name="<?=$nationName?>" data-general-nation-name="<?=$nationName?>"
> >
<td height="64"><img class='generalIcon' width='64' height='64' src='<?=$iconPath?>'></td> <td height="64"><img class='generalIcon' width='64' height='64' src='<?=$iconPath?>'></td>
<td><?=$nameText?></td> <td><?=$nameText?></td>
<td><?=$leadershipText?><?=$leadershipBonusText?></td> <td><?=$leadershipText?><?=$leadershipBonusText?></td>
<td><?=$strengthText?></td> <td><?=$strengthText?></td>
<td><?=$intelText?></td> <td><?=$intelText?></td>
<td class="general_officer_level"><?=$officerLevelText?></td> <td class="general_officer_level"><?=$officerLevelText?></td>
<?php if($ourGeneral): ?> <?php if($ourGeneral): ?>
<td><?=$defenceTrainText?></td> <td><?=$defenceTrainText?></td>
<td class="general_crew_type"><?=$crewTypeText?></td> <td class="general_crew_type"><?=$crewTypeText?></td>
<td><?=$crew?></td> <td><?=$crew?></td>
<td><?=$train?></td> <td><?=$train?></td>
<td><?=$atmos?></td> <td><?=$atmos?></td>
<?php if($isNPC): ?> <?php if($isNPC): ?>
<td>NPC 장수</td> <td>NPC 장수</td>
<?php else: ?> <?php else: ?>
<td class="general_turn_text"><?=$turnText?></td> <td class="general_turn_text"><?=$turnText?></td>
<?php endif; ?> <?php endif; ?>
<?php else: ?> <?php else: ?>
<td>?</td> <td>?</td>
<td class="general_crew_type">?</td> <td class="general_crew_type">?</td>
<td><?=$crew?></td> <td><?=$crew>=0?$crew:'?'?></td>
<td>?</td> <td>?</td>
<td>?</td> <td>?</td>
<?php if($nation!==0): ?> <?php if($nation!==0): ?>
<td>【<?=$nationName?>】 장수</td> <td>【<?=$nationName?>】 장수</td>
<?php else: ?> <?php else: ?>
<td>재 야</td> <td>재 야</td>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
</tr> </tr>