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;
} }
@@ -19,11 +19,15 @@ class event_전투특기_격노 extends \sammo\BaseItem{
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)
); );
} }
} }
+1 -1
View File
@@ -98,7 +98,7 @@ class che_방랑 extends Command\GeneralCommand{
'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);
@@ -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;
+4 -3
View File
@@ -31,9 +31,10 @@ class che_탈취 extends che_화계{
$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']){ if($destCity['supply']){
[$destNationGold, $destNationRice] = $db->queryFirstList('SELECT gold,rice FROM nation WHERE nation=%i', $destNationID); [$destNationGold, $destNationRice] = $db->queryFirstList('SELECT gold,rice FROM nation WHERE nation=%i', $destNationID);
@@ -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, [
@@ -42,6 +42,10 @@ class che_계략시도 extends BaseWarUnitTrigger{
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;
+1 -1
View File
@@ -40,7 +40,7 @@
<?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): ?>