forked from devsam/core
버그 수정...
This commit is contained in:
+14
-14
@@ -230,24 +230,24 @@ for($i=0; $i < $nationCount; $i++) {
|
||||
<td align=center> {$nation['power']} </td>
|
||||
<td align=center> {$gen['cnt']} </td>
|
||||
<td align=center> {$city['cnt']} </td>
|
||||
<td align=center> {$nation['tech']} </td>
|
||||
<td align=right> ".sprintf('%.1f',$nation['tech'])." </td>
|
||||
<td align=center> {$nation['strategic_cmd_limit']} </td>
|
||||
<td align=center> {$nation['gold']} </td>
|
||||
<td align=center> {$nation['rice']} </td>
|
||||
<td align=center> {$gen['avgg']} </td>
|
||||
<td align=center> {$gen['avgr']} </td>
|
||||
<td align=center> {$gen['avgl']} </td>
|
||||
<td align=center> {$gen['avgs']} </td>
|
||||
<td align=center> {$gen['avgi']} </td>
|
||||
<td align=center> {$gen['avge']} </td>
|
||||
<td align=center> {$nation['dex0']} </td>
|
||||
<td align=center> {$nation['dex10']} </td>
|
||||
<td align=center> {$nation['dex20']} </td>
|
||||
<td align=center> {$nation['dex30']} </td>
|
||||
<td align=center> {$nation['dex40']} </td>
|
||||
<td align=center> {$gen['crew']}/{$gen['leadership']}00 </td>
|
||||
<td align=right> {$gen['avgg']} </td>
|
||||
<td align=right> {$gen['avgr']} </td>
|
||||
<td align=right> {$gen['avgl']} </td>
|
||||
<td align=right> {$gen['avgs']} </td>
|
||||
<td align=right> {$gen['avgi']} </td>
|
||||
<td align=right> {$gen['avge']} </td>
|
||||
<td align=right> {$nation['dex0']} </td>
|
||||
<td align=right> {$nation['dex10']} </td>
|
||||
<td align=right> {$nation['dex20']} </td>
|
||||
<td align=right> {$nation['dex30']} </td>
|
||||
<td align=right> {$nation['dex40']} </td>
|
||||
<td align=right> {$gen['crew']}/{$gen['leadership']}00 </td>
|
||||
<td align=center> {$city['pop']}/{$city['pop2']} </td>
|
||||
<td align=center> ".round($city['pop']/$city['pop2']*100,1)."% </td>
|
||||
<td align=center> ".sprintf('%.1f',$city['pop']/$city['pop2']*100)."% </td>
|
||||
<td align=center> {$city['agri']}% </td>
|
||||
<td align=center> {$city['comm']}% </td>
|
||||
<td align=center> {$city['secu']}% </td>
|
||||
|
||||
@@ -217,7 +217,7 @@ if($btn == "추방") {
|
||||
if($admin['year'] < $admin['startyear']+3) {
|
||||
//초반엔 군주 부상 증가(엔장 임관지양)
|
||||
$db->update('general', [
|
||||
'injury'=>$db->sqleval('injury + 1'),
|
||||
'injury'=>$db->sqleval('least(injury + 1, %i)', 80),
|
||||
], 'no=%i', $ruler['no']);
|
||||
|
||||
$db->update('nation', [
|
||||
|
||||
+3
-2
@@ -43,12 +43,13 @@ function getNationStaticInfo($nationID, $forceRefresh=false)
|
||||
'color'=>'#000000',
|
||||
'type'=>GameConst::$neutralNationType,
|
||||
'level'=>0,
|
||||
'capital'=>0
|
||||
'capital'=>0,
|
||||
'gennum'=>1
|
||||
];
|
||||
}
|
||||
|
||||
if($nationList === null){
|
||||
$nationAll = DB::db()->query("select nation, name, color, type, level, capital from nation");
|
||||
$nationAll = DB::db()->query("select nation, name, color, type, level, capital, gennum from nation");
|
||||
$nationList = Util::convertArrayToDict($nationAll, "nation");
|
||||
$nationList[-1] = $nationAll;
|
||||
}
|
||||
|
||||
@@ -159,9 +159,9 @@ function checkCommandArg(?array $arg):?string{
|
||||
return null;
|
||||
}
|
||||
$defaultCheck = [
|
||||
'string'=>[
|
||||
/*'string'=>[
|
||||
'nationName', 'optionText', 'itemType', 'nationType'
|
||||
],
|
||||
],*/
|
||||
'integer'=>[
|
||||
'crewType', 'destGeneralID', 'destCityID', 'destNationID',
|
||||
'amount', 'colorType', 'itemCode'
|
||||
|
||||
+1
-13
@@ -348,19 +348,7 @@ function preUpdateMonthly() {
|
||||
|
||||
//첩보-1
|
||||
foreach($db->queryAllLists("SELECT nation, spy FROM nation WHERE spy!='' AND spy!='{}'") as [$nationNo, $rawSpy]){
|
||||
if (strpos($rawSpy, '|') !== false || is_numeric($rawSpy)) {
|
||||
//TODO: 0.8 버전 이후에는 삭제할 것. 이후 버전은 json으로 변경됨.
|
||||
$spyInfo = [];
|
||||
foreach(explode('|', $rawSpy) as $value){
|
||||
$value = intval($value);
|
||||
$cityNo = intdiv($value, 10);
|
||||
$remainMonth = $value % 10;
|
||||
$spyInfo[$cityNo] = $remainMonth;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$spyInfo = Json::decode($rawSpy);
|
||||
}
|
||||
$spyInfo = Json::decode($rawSpy);
|
||||
|
||||
foreach($spyInfo as $cityNo => $remainMonth){
|
||||
if($remainMonth <= 1){
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
use Constraint\Constraint;
|
||||
|
||||
/**
|
||||
* 내정 커맨드 사용시 성공 확률 계산
|
||||
*
|
||||
|
||||
@@ -854,8 +854,8 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
|
||||
foreach([$gen1, $gen2] as $gen){
|
||||
$horse = buildItemClass($gen['h']);
|
||||
$weapon = buildItemCalss($gen['w']);
|
||||
$book = buildItemCalss($gen['b']);
|
||||
$weapon = buildItemClass($gen['w']);
|
||||
$book = buildItemClass($gen['b']);
|
||||
|
||||
//아이템 로그
|
||||
if(!$horse->isBuyable() && ($tnmt_type == 0 || $tnmt_type == 1)) {
|
||||
|
||||
+16
-14
@@ -34,7 +34,7 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
|
||||
$city = new WarUnitCity($rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate);
|
||||
|
||||
$defenderList = [];
|
||||
foreach ($db->query('SELECT no,name,nation,turntime,personal,special2,crew,crewtype,atmos,train,intel,intel2,book,strength,strength2,weapon,injury,leadership,leadership2,horse,item,explevel,experience,dedication,level,gold,rice,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,defence_train FROM general WHERE nation=%i AND city=%i AND nation!=0 and crew > 0 and rice>(crew/100) and train>=defence_train and atmos>=defence_train', $city->getVar('nation'), $city->getVar('city')) as $rawGeneral){
|
||||
foreach ($db->query('SELECT no,name,nation,turntime,personal,special,special2,crew,crewtype,atmos,train,intel,intel2,book,strength,strength2,weapon,injury,leadership,leadership2,horse,item,explevel,experience,dedication,level,gold,rice,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,defence_train FROM general WHERE nation=%i AND city=%i AND nation!=0 and crew > 0 and rice>(crew/100) and train>=defence_train and atmos>=defence_train', $city->getVar('nation'), $city->getVar('city')) as $rawGeneral){
|
||||
$defenderList[] = new General($rawGeneral, $rawDefenderCity, $year, $month);
|
||||
}
|
||||
|
||||
@@ -142,8 +142,14 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
|
||||
$defenderIncTech /= 4;
|
||||
}
|
||||
|
||||
$updateAttackerNation['tech'] += $attackerIncTech / max(GameConst::$initialNationGenLimit, $rawAttackerNation['gennum']);
|
||||
$updateDefenderNation['tech'] += $defenderIncTech / max(GameConst::$initialNationGenLimit, $rawDefenderNation['gennum']);
|
||||
$updateAttackerNation['tech'] = $db->sqleval(
|
||||
'tech + %d',
|
||||
$attackerIncTech / max(GameConst::$initialNationGenLimit, $rawAttackerNation['gennum'])
|
||||
);
|
||||
$updateDefenderNation['tech'] = $db->sqleval(
|
||||
'tech + %d',
|
||||
$defenderIncTech / max(GameConst::$initialNationGenLimit, $rawDefenderNation['gennum'])
|
||||
);
|
||||
|
||||
$db->update('nation', $updateAttackerNation, 'nation=%i', $attackerNationID);
|
||||
$db->update('nation', $updateDefenderNation, 'nation=%i', $defenderNationID);
|
||||
@@ -702,17 +708,13 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
|
||||
$db->update('city', $query, 'city=%i', (int)$city['city']);
|
||||
//전방설정
|
||||
if($renewFront){
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
if($nation['level'] <= 0){
|
||||
continue;
|
||||
}
|
||||
SetNationFront($nation['nation']);
|
||||
}
|
||||
}
|
||||
else{
|
||||
SetNationFront($destnation['nation']);
|
||||
SetNationFront($conquerNation);
|
||||
|
||||
$nearNationsID = $db->queryFirstColumn(
|
||||
'SELECT distinct(nation) FROM city WHERE nation != 0 AND city IN %li',
|
||||
array_merge(array_keys(CityConst::byID($city['city'])->path), [$city['city']])
|
||||
);
|
||||
foreach($nearNationsID as $nationNationID){
|
||||
SetNationFront($nationNationID);
|
||||
}
|
||||
|
||||
pushGenLog($general, $log);
|
||||
|
||||
@@ -252,7 +252,7 @@ abstract class BaseCommand{
|
||||
'destNation'=>$this->destNation,
|
||||
];
|
||||
|
||||
$this->reasonNotReservable = Constraint::testAll($this->reservableConstraints??[], $constraintInput);
|
||||
$this->reasonNotReservable = Constraint::testAll($this->reservableConstraints??[], $constraintInput, $this->env);
|
||||
$this->reservable = $this->reasonNotReservable === null;
|
||||
return $this->reasonNotReservable;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ abstract class BaseCommand{
|
||||
'destNation'=>$this->destNation,
|
||||
];
|
||||
|
||||
$this->reasonNotRunnable = Constraint::testAll($this->runnableConstraints??[], $constraintInput);
|
||||
$this->reasonNotRunnable = Constraint::testAll($this->runnableConstraints??[], $constraintInput, $this->env);
|
||||
$this->runnable = $this->reasonNotRunnable === null;
|
||||
return $this->reasonNotRunnable;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ class che_귀환 extends Command\GeneralCommand{
|
||||
|
||||
$generalLevel = $general->getVar('level');
|
||||
$target = null;
|
||||
if(2 <= $generalLevel && 4 <= $generalLevel){
|
||||
if(2 <= $generalLevel && $generalLevel <= 4){
|
||||
$target = $db->queryFirstList(
|
||||
'SELECT city, name FROM city WHERE %b=%i AND nation = %i',
|
||||
'officer'.$general->getVar('level'), $generalID, $general->getNationID()
|
||||
|
||||
@@ -34,7 +34,7 @@ class che_인재탐색 extends Command\GeneralCommand{
|
||||
|
||||
$general = $this->generalObj;
|
||||
|
||||
$this->setNation(['gennum']);
|
||||
$this->setNation(['gennum', 'scout']);
|
||||
$env = $this->env;
|
||||
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
@@ -160,6 +160,7 @@ class che_임관 extends Command\GeneralCommand{
|
||||
$db->update('nation', [
|
||||
'gennum'=>$db->sqleval('gennum + 1')
|
||||
], 'nation=%i', $destNationID);
|
||||
\sammo\refreshNationStaticInfo();
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if($general->getVar('npc') == 1 || $relYear >= 3){
|
||||
|
||||
@@ -128,7 +128,7 @@ class che_출병 extends Command\GeneralCommand{
|
||||
$general->applyDB($db);
|
||||
|
||||
//TODO: 장기적으로 통합해야함
|
||||
$attackerNation = $db->queryFirstRow('SELECT nation, name, color, type, level, capital, tech from nation WHERE nation = %i', $attackerNationID);
|
||||
$attackerNation = $db->queryFirstRow('SELECT nation, name, color, type, level, capital, tech, gennum from nation WHERE nation = %i', $attackerNationID);
|
||||
processWar($general, $attackerNation, $this->destCity);
|
||||
|
||||
tryUniqueItemLottery($general);
|
||||
|
||||
@@ -112,6 +112,7 @@ class che_하야 extends Command\GeneralCommand{
|
||||
'rice'=>$db->sqleval('rice + %i', $lostRice),
|
||||
'gennum'=>$db->sqleval('gennum - 1')
|
||||
], 'nation=%i', $nationID);
|
||||
\sammo\refreshNationStaticInfo();
|
||||
|
||||
$general->setVar('nation', 0);
|
||||
$general->setVar('level', 0);
|
||||
|
||||
@@ -8,13 +8,16 @@ use \sammo\{
|
||||
GameConst,
|
||||
LastTurn,
|
||||
GameUnitConst,
|
||||
Command
|
||||
Command,
|
||||
MessageTarget,
|
||||
Message
|
||||
};
|
||||
|
||||
use function \sammo\{
|
||||
getDomesticExpLevelBonus,
|
||||
CriticalRatioDomestic,
|
||||
CriticalScoreEx
|
||||
CriticalScoreEx,
|
||||
GetImageURL
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
@@ -70,7 +73,7 @@ class che_몰수 extends Command\NationCommand{
|
||||
$this->setCity();
|
||||
$this->setNation(['gold', 'rice']);
|
||||
|
||||
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['gold', 'nation'], 1);
|
||||
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['gold', 'rice', 'npc', 'nation'], 1);
|
||||
$this->setDestGeneral($destGeneral);
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
@@ -118,7 +121,7 @@ class che_몰수 extends Command\NationCommand{
|
||||
$resName = $isGold?'금':'쌀';
|
||||
$destGeneral = $this->destGeneralObj;
|
||||
|
||||
$amount = Util::valueFit($amount, 0, ($general->getVar[$resKey]- $isGold?GameConst::$generalMinimumGold:GameConst::$generalMinimumRice));
|
||||
$amount = Util::valueFit($amount, 0, ($general->getVar($resKey)- $isGold?GameConst::$generalMinimumGold:GameConst::$generalMinimumRice));
|
||||
$amountText = number_format($amount, 0);
|
||||
|
||||
if($destGeneral->getVar('npc') >= 2 && Util::randBool(0.01)){
|
||||
|
||||
@@ -26,6 +26,8 @@ abstract class Constraint{
|
||||
protected $nation = null;
|
||||
protected $arg = null;
|
||||
|
||||
protected $env = null;
|
||||
|
||||
protected $cmd_arg = null;
|
||||
|
||||
protected $destGeneral = null;
|
||||
@@ -62,6 +64,11 @@ abstract class Constraint{
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
}
|
||||
public function setEnv($env){
|
||||
$this->env = $env;
|
||||
$this->tested = false;
|
||||
$this->reason = null;
|
||||
}
|
||||
public function setCmdArg($cmd_arg){
|
||||
$this->cmd_arg = $cmd_arg;
|
||||
$this->tested = false;
|
||||
@@ -182,7 +189,7 @@ abstract class Constraint{
|
||||
return $this->reason;
|
||||
}
|
||||
|
||||
public static function testAll(array $constraintPacks, array $input):?string{
|
||||
public static function testAll(array $constraintPacks, array $input, array $env):?string{
|
||||
foreach($constraintPacks as $constraintArgs){
|
||||
if (!$constraintArgs){
|
||||
continue;
|
||||
@@ -194,7 +201,7 @@ abstract class Constraint{
|
||||
$constraint = call_user_func($method,$input);
|
||||
|
||||
assert($constraint instanceof Constraint);
|
||||
|
||||
$constraint->setEnv($env);
|
||||
if(count($constraintArgs) == 2){
|
||||
$arg = $constraintArgs[1];
|
||||
$constraint->setArg($arg);
|
||||
|
||||
@@ -23,11 +23,11 @@ class ReqEnvValue extends Constraint{
|
||||
}
|
||||
|
||||
if(count($this->arg) == 4){
|
||||
[$this->key, $this->reqVal, $comp, $this->msg] = $this->arg;
|
||||
[$this->key, $comp, $this->reqVal, $this->msg] = $this->arg;
|
||||
|
||||
if(!in_array($comp, ['>', '>=', '==', '<=', '<', '!=', '===', '!=='])){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("invalid comparator");
|
||||
throw new \InvalidArgumentException("invalid comparator($comp)");
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -9,7 +9,8 @@ class DummyGeneral extends General{
|
||||
'city'=>0,
|
||||
'nation'=>0,
|
||||
'level'=>0,
|
||||
'crewtype'=>-1
|
||||
'crewtype'=>-1,
|
||||
'turntime'=>'2012-03-04 05:06:07.000000'
|
||||
];
|
||||
|
||||
$this->raw = $raw;
|
||||
|
||||
+37
-23
@@ -127,13 +127,20 @@ class GeneralAI{
|
||||
$this->attackable = ($frontStatus !== null)?$frontStatus:false;
|
||||
|
||||
$warTarget = $db->queryAllLists(
|
||||
'SELECT you, state FROM diplomacy WHERE me = %i AND (state = 1 OR (state = 0 AND term < 5))',
|
||||
'SELECT you, state FROM diplomacy WHERE me = %i AND (state = 0 OR (state = 1 AND term < 5))',
|
||||
$nationID
|
||||
);
|
||||
|
||||
$onWar = false;
|
||||
$warTargetNation = [];
|
||||
foreach($warTarget as [$warNationID, $warState]){
|
||||
$warTargetNation[$warNationID] = $warState==0?2:1;
|
||||
if($warState == 0){
|
||||
$onWar = true;
|
||||
$warTargetNation[$warNationID] = 2;
|
||||
}
|
||||
else{
|
||||
$warTargetNation[$warNationID] = 1;
|
||||
}
|
||||
}
|
||||
$warTargetNation[0] = 0;
|
||||
$this->warTargetNation = $warTargetNation;
|
||||
@@ -153,20 +160,14 @@ class GeneralAI{
|
||||
$this->dipState = self::d직전;
|
||||
}
|
||||
|
||||
if(
|
||||
in_array($this->dipState, [self::d평화, self::d선포]) ||
|
||||
$env['year'] >= $env['startyear'] + 3 ||
|
||||
($env['year'] && $env['startyear'] + 2 && $env['month'] > 5)
|
||||
){
|
||||
$this->dipState = self::d징병;
|
||||
}
|
||||
|
||||
if($this->attackable){
|
||||
//전쟁으로 인한 attackable인가?
|
||||
$onWar = $db->queryFirstField('SELECT you FROM diplomacy WHERE me = %i AND state=0 LIMIT 1', $nationID) !== null;
|
||||
if($onWar){
|
||||
$this->dipState = self::d전쟁;
|
||||
}
|
||||
else{
|
||||
$this->dipState = self::d징병;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,8 +195,8 @@ class GeneralAI{
|
||||
];
|
||||
|
||||
// 우선 선정
|
||||
if($develRate['trust'] < 0.95 && Util::randBool($leadership / 40)){
|
||||
return ['che_선정', null];
|
||||
if($develRate['trust'] < 1 && Util::randBool($leadership / 60)){
|
||||
return ['che_주민선정', null];
|
||||
}
|
||||
|
||||
$commandList = [];
|
||||
@@ -248,7 +249,14 @@ class GeneralAI{
|
||||
if(!TechLimit($env['startyear'], $env['year'], $nation['tech'])){
|
||||
$commandObj = buildGeneralCommandClass('che_기술연구', $general, $env);
|
||||
if($commandObj->isRunnable()){
|
||||
$commandList['che_기술연구'] = $intel / 4;
|
||||
if(!TechLimit($env['startyear'], $env['year'], $nation['tech']+1000)){
|
||||
//한등급 이상 뒤쳐져 있다면, 조금 더 열심히 하자.
|
||||
$commandList['che_기술연구'] = $intel;
|
||||
}
|
||||
else{
|
||||
$commandList['che_기술연구'] = $intel / 4;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,7 +264,7 @@ class GeneralAI{
|
||||
if($develRate['trust'] < 1){
|
||||
$commandObj = buildGeneralCommandClass('che_주민선정', $general, $env);
|
||||
if($commandObj->isRunnable()){
|
||||
$commandList['che_주민선정'] = $leadership / 2;
|
||||
$commandList['che_주민선정'] = power($leadership * 2, 1 / ($develRate['trust'] + 0.001));
|
||||
}
|
||||
}
|
||||
if($develRate['pop'] < 0.99){
|
||||
@@ -283,7 +291,7 @@ class GeneralAI{
|
||||
$commandList['che_물자조달'] = (
|
||||
(GameConst::$minNationalGold + GameConst::$minNationalRice + 24*5*$env['develcost']) /
|
||||
Util::valueFit($nation['gold'] + $nation['rice'], (GameConst::$defaultGold + GameConst::$defaultRice)/2)
|
||||
) * 10;
|
||||
);
|
||||
|
||||
return [Util::choiceRandomUsingWeight($commandList), null];
|
||||
}
|
||||
@@ -507,6 +515,8 @@ class GeneralAI{
|
||||
}
|
||||
|
||||
if($generalObj->getVar('level') == 12 && $this->dipState == self::d평화 && !$this->attackable){
|
||||
|
||||
|
||||
$targetNationID = $this->findWarTarget();
|
||||
if($targetNationID !== null){
|
||||
return ['che_선전포고', ['destNationID'=>$targetNationID]];
|
||||
@@ -1357,7 +1367,7 @@ class GeneralAI{
|
||||
$db = DB::db();
|
||||
|
||||
$general = $this->getGeneralObj();
|
||||
if(!$this->attackable && in_array($this->dipState, [self::d평화, self::d선포])){
|
||||
if(!$this->attackable && $this->dipState == self::d평화){
|
||||
if($this->dipState == self::d평화 && $general->getVar('crew')>=1000 && Util::randBool(0.25)){
|
||||
return ['che_소집해제', null];
|
||||
}
|
||||
@@ -1516,7 +1526,7 @@ class GeneralAI{
|
||||
$db = DB::db();
|
||||
|
||||
if($city['front'] <= 1){
|
||||
throw new \RuntimeException('출병 불가');
|
||||
throw new \RuntimeException('출병 불가'.$cityID);
|
||||
}
|
||||
|
||||
$attackableNations = [];
|
||||
@@ -1534,6 +1544,10 @@ class GeneralAI{
|
||||
$nearCities
|
||||
);
|
||||
|
||||
if(count($attackableCities) == 0){
|
||||
throw new \RuntimeException('출병 불가'.$cityID.var_export($attackableNations, true).var_export($nearCities, true));
|
||||
}
|
||||
|
||||
return ['che_출병', ['destCityID'=>Util::choiceRandom($attackableCities)]];
|
||||
}
|
||||
|
||||
@@ -1656,7 +1670,7 @@ class GeneralAI{
|
||||
$nationID = $this->nation['nation'];
|
||||
|
||||
$this->devRate = $db->queryFirstRow(
|
||||
'SELECT sum(pop)/sum(pop2)*100 as pop_p,(sum(agri)+sum(comm)+sum(secu)+sum(def)+sum(wall))/(sum(agri2)+sum(comm2)+sum(secu2)+sum(def2)+sum(wall2))*100 as all_p from city where nation=%i',
|
||||
'SELECT sum(pop)/sum(pop2) as pop_p,(sum(agri)+sum(comm)+sum(secu)+sum(def)+sum(wall))/(sum(agri2)+sum(comm2)+sum(secu2)+sum(def2)+sum(wall2)) as all_p from city where nation=%i',
|
||||
$nationID
|
||||
);
|
||||
return $this->devRate;
|
||||
@@ -1676,7 +1690,7 @@ class GeneralAI{
|
||||
}
|
||||
|
||||
$devRate = $this->getNationDevelopedRate();
|
||||
if(($devRate['pop_p'] + $devRate['all_p']) / 2 < 80){
|
||||
if(($devRate['pop_p'] + $devRate['all_p']) / 2 < 0.8){
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1829,9 +1843,9 @@ class GeneralAI{
|
||||
|
||||
$avg = ($devRate['pop_p'] + $devRate['all_p']) / 2;
|
||||
|
||||
if($avg > 95) $rate = 25;
|
||||
elseif($avg > 70) $rate = 20;
|
||||
elseif($avg > 50) $rate = 15;
|
||||
if($avg > 0.95) $rate = 25;
|
||||
elseif($avg > 0.70) $rate = 20;
|
||||
elseif($avg > 0.50) $rate = 15;
|
||||
else $rate = 10;
|
||||
|
||||
$db->update('nation', [
|
||||
|
||||
@@ -97,7 +97,7 @@ class DyingMessage{
|
||||
$this->general = $general;
|
||||
$this->name = $general->getName();
|
||||
$this->npc = $general->getVar('npc');
|
||||
if($general['owner'] > 0 && $general->getVar('startage') - $general->getVar('age') > 1){
|
||||
if($general->getVar('owner') > 0 && $general->getVar('startage') - $general->getVar('age') > 1){
|
||||
$this->realName = $general->getVar('name2');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
|
||||
$general->getVar('level')
|
||||
)??[];
|
||||
$hasNationTurn = true;
|
||||
$nationCommand = $rawNationTurn['action'];
|
||||
$nationCommand = $rawNationTurn['action']??null;
|
||||
$nationArg = Json::decode($rawNationTurn['arg']??null);
|
||||
}
|
||||
|
||||
@@ -410,13 +410,6 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
|
||||
$gameStor->turntime = $currentTurn;
|
||||
}
|
||||
|
||||
|
||||
// 부상 과도 제한
|
||||
//TODO: 없애고, 부상 자체가 80 이상 넘지 않도록 처리
|
||||
$db->update('general', [
|
||||
'injury'=>80
|
||||
], 'injury>%i', 80);
|
||||
|
||||
//토너먼트 처리
|
||||
processTournament();
|
||||
//거래 처리
|
||||
|
||||
@@ -52,7 +52,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
$general->updateVar('recwar', $general->getTurnTime());
|
||||
}
|
||||
else if($oppose !== null){
|
||||
$general->updateVar('recwar', $oppose->getTurnTime());
|
||||
$general->updateVar('recwar', $oppose->getGeneral()->getTurnTime());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class che_위압시도 extends BaseWarUnitTrigger{
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->activateSkill('위압');
|
||||
$self->activateSkill('위압');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use sammo\WarUnitCity;
|
||||
use sammo\WarUnit;
|
||||
use sammo\GameUnitDetail;
|
||||
use sammo\ObjectTrigger;
|
||||
use sammo\Util;
|
||||
|
||||
class che_저격시도 extends BaseWarUnitTrigger{
|
||||
protected $priority = ObjectTrigger::PRIORITY_PRE + 100;
|
||||
@@ -37,7 +38,7 @@ class che_저격시도 extends BaseWarUnitTrigger{
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->activateSkill('저격');
|
||||
$self->activateSkill('저격');
|
||||
$selfEnv['woundMin'] = $this->woundMin;
|
||||
$selfEnv['woundMax'] = $this->woundMax;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class che_전투치료시도 extends BaseWarUnitTrigger{
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->activateSkill('치료');
|
||||
$self->activateSkill('치료');
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
@@ -25,7 +25,7 @@ class che_회피시도 extends BaseWarUnitTrigger{
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->activateSkill('특수', '회피시도', '회피');
|
||||
$self->activateSkill('특수', '회피시도', '회피');
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
@@ -610,6 +610,9 @@ class JosaUtil{
|
||||
$search = [];
|
||||
$replace = [];
|
||||
|
||||
$prefix = ':';
|
||||
$postfix = ':';
|
||||
|
||||
foreach(static::DEFAULT_POSTPOSITION as $wJong => $woJong){
|
||||
$value = JosaUtil::pick($key, $wJong);
|
||||
$search[] = "{$prefix}{$wJong}{$postfix}";
|
||||
|
||||
+1
-1
@@ -571,7 +571,7 @@ class Util extends \utilphp\util
|
||||
*
|
||||
* @param array $items 선택하고자 하는 배열
|
||||
*
|
||||
* @return object 선택된 value값.
|
||||
* @return int|float|string|object 선택된 value값.
|
||||
*/
|
||||
public static function choiceRandom(array $items)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user