버그 수정

This commit is contained in:
2020-04-21 02:06:03 +09:00
parent 6b9157f1d4
commit 3c7bee32f8
13 changed files with 103 additions and 40 deletions
+4 -4
View File
@@ -17,7 +17,7 @@ TurnExecutionHelper::executeAllCommand();
$query = "select no,nation,officer_level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$nationID = $nationID;
$nationID = $me['nation'];
$meLevel = $me['officer_level'];
if($meLevel == 0) {
@@ -140,8 +140,8 @@ $eaglestr = join(', ', array_map(function($arr){
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td align=center style='color:<?=newColor($nation['color'])?>; bgcolor=<?=$nation['color']?>' colspan=6>
<font size=5>【 {$nation['name']} 】</font>
<td align=center style='color:<?=newColor($nation['color'])?>; background-color:<?=$nation['color']?>' colspan=6>
<font size=5>【 <?=$nation['name']?> 】</font>
</td>
</tr>
<?php
@@ -530,7 +530,7 @@ $dummyOfficer = [
$textColor = newColor($nation['color']);
$nationColor = $nation['color'];
foreach($db->query('SELECT city,name,level,region,officer4set,officer3set,officer2set from city where nation=$i order by region,level desc,binary(name)', $nationID) as $city) {
foreach($db->query('SELECT city,name,level,region,officer4set,officer3set,officer2set from city where nation=%i order by region,level desc,binary(name)', $nationID) as $city) {
$cityID = $city['city'];
$cityOfficerList = $officerList[$cityID]??[];
?>
+4 -2
View File
@@ -55,12 +55,12 @@ class AutorunNationPolicy {
'NPC후방발령',
'NPC포상',
'NPC몰수',
'NPC전방발령',
'유저장내정발령',
'NPC내정발령',
'NPC몰수',
];
//순서는 중요하지 않음
@@ -128,7 +128,9 @@ class AutorunNationPolicy {
public $reqNPCWarGold = 5000;
public $reqNPCWarRice = 5000;
public $reqNPCDevelGold = 1000;
public $reqNPCDevelRice = 0;
public $reqNPCDevelRice = 500;
public $minimumResourceActionAmount = 1000;
public $minNPCWarLeadership = 40;
public $minWarCrew = 1500;
+9 -2
View File
@@ -258,6 +258,11 @@ abstract class BaseCommand{
}
public function testReservable():?string{
if(!$this->isArgValid()){
$this->reasonNotReservable = '인자가 올바르지 않습니다.';
$this->reservable = false;
return $this->reasonNotReservable;
}
if($this->reservableConstraints === null){
return null;
}
@@ -288,8 +293,10 @@ abstract class BaseCommand{
public function testRunnable():?string{
if(!$this->isArgValid()){
throw new \InvalidArgumentException('인자가 제대로 설정되지 않습니다'.\sammo\Json::encode($this->arg));
}
$this->reasonNotReservable = '인자가 올바르지 않습니다.';
$this->reservable = false;
return $this->reasonNotReservable;
}
if($this->runnableConstraints === null){
throw new \InvalidArgumentException('runnableConstraits가 제대로 설정되지 않았습니다');
}
@@ -35,14 +35,14 @@ class che_군량매매 extends Command\GeneralCommand{
}
$buyRice = boolval($buyRice);
$amount = $this->arg['amount']??null;
if(is_float($amount)){
$amount = Util::toInt($amount);
}
else if(!is_int($amount)){
if(!is_numeric($amount)){
return false;
}
$amount = Util::round($amount, -2);
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
if($amount <= 0){
return false;
}
$this->arg = [
'buyRice'=>$buyRice,
'amount'=>$amount
+5 -4
View File
@@ -43,13 +43,14 @@ class che_증여 extends Command\GeneralCommand{
$isGold = $this->arg['isGold'];
$amount = $this->arg['amount'];
$destGeneralID = $this->arg['destGeneralID'];
if(is_float($amount)){
$amount = Util::toInt($amount);
}
else if(!is_int($amount)){
if(!is_numeric($amount)){
return false;
}
$amount = Util::round($amount, -2);
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
if($amount <= 0){
return false;
}
if(!is_bool($isGold)){
return false;
}
+2 -4
View File
@@ -38,12 +38,10 @@ class che_헌납 extends Command\GeneralCommand{
}
$isGold = $this->arg['isGold'];
$amount = $this->arg['amount'];
if(is_float($amount)){
$amount = Util::toInt($amount);
}
else if(!is_int($amount)){
if(!is_numeric($amount)){
return false;
}
$amount = Util::round($amount, -2);
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
if(!is_bool($isGold)){
return false;
+6 -6
View File
@@ -44,13 +44,14 @@ class che_몰수 extends Command\NationCommand{
$isGold = $this->arg['isGold'];
$amount = $this->arg['amount'];
$destGeneralID = $this->arg['destGeneralID'];
if(is_float($amount)){
$amount = Util::toInt($amount);
}
else if(!is_int($amount)){
if(!is_numeric($amount)){
return false;
}
$amount = Util::round($amount, -2);
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
if($amount <= 0){
return false;
}
if(!is_bool($isGold)){
return false;
}
@@ -140,8 +141,7 @@ class che_몰수 extends Command\NationCommand{
$amount = Util::valueFit(
$amount,
0,
($destGeneral->getVar($resKey) -
($isGold?GameConst::$generalMinimumGold:GameConst::$generalMinimumRice))
$destGeneral->getVar($resKey)
);
$amountText = number_format($amount, 0);
+1 -1
View File
@@ -17,7 +17,7 @@ use function \sammo\{
getDomesticExpLevelBonus,
CriticalRatioDomestic,
CriticalScoreEx,
function cutTurn
cutTurn
};
use \sammo\Constraint\Constraint;
+5 -4
View File
@@ -41,13 +41,14 @@ class che_포상 extends Command\NationCommand{
$isGold = $this->arg['isGold'];
$amount = $this->arg['amount'];
$destGeneralID = $this->arg['destGeneralID'];
if(is_float($amount)){
$amount = Util::toInt($amount);
}
else if(!is_int($amount)){
if(!is_numeric($amount)){
return false;
}
$amount = Util::round($amount, -2);
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
if($amount <= 0){
return false;
}
if(!is_bool($isGold)){
return false;
}
+59 -5
View File
@@ -139,9 +139,9 @@ class GeneralAI
protected function calcGenType(General $general)
{
$leadership = $general->getLeadership();
$strength = Util::valueFit($general->getStrength(), 1);
$intel = Util::valueFit($general->getIntel(), 1);
$leadership = $general->getLeadership(false);
$strength = Util::valueFit($general->getStrength(false), 1);
$intel = Util::valueFit($general->getIntel(false), 1);
//무장
if ($strength >= $intel) {
@@ -241,6 +241,9 @@ class GeneralAI
protected function do부대전방발령(LastTurn $lastTurn): ?NationCommand
{
if(!$this->nation['capital']){
return null;
}
if(!$this->frontCities){
return null;
}
@@ -343,6 +346,9 @@ class GeneralAI
protected function do부대후방발령(LastTurn $lastTurn): ?NationCommand
{
if(!$this->nation['capital']){
return null;
}
if(!$this->frontCities){
return null;
}
@@ -430,6 +436,9 @@ class GeneralAI
protected function do부대유저장후방발령(LastTurn $lastTurn): ?NationCommand
{
if(!$this->nation['capital']){
return null;
}
if($this->dipState !== self::d전쟁){
return null;
}
@@ -536,6 +545,9 @@ class GeneralAI
}
protected function do유저장후방발령(LastTurn $lastTurn): ?NationCommand
{
if(!$this->nation['capital']){
return null;
}
if($this->dipState !== self::d전쟁){
return null;
}
@@ -605,6 +617,9 @@ class GeneralAI
protected function do유저장구출발령(LastTurn $lastTurn): ?NationCommand
{
if(!$this->nation['capital']){
return null;
}
if (in_array($this->dipState, [self::d평화, self::d선포])) {
return null;
}
@@ -652,6 +667,9 @@ class GeneralAI
protected function do유저장전방발령(LastTurn $lastTurn): ?NationCommand
{
if(!$this->nation['capital']){
return null;
}
if(!$this->frontCities){
return null;
}
@@ -706,7 +724,10 @@ class GeneralAI
protected function do유저장내정발령(LastTurn $lastTurn): ?NationCommand
{
if(count($this->supplyCitiesID) === 1){
if(!$this->nation['capital']){
return null;
}
if(count($this->supplyCities) === 1){
return null;
}
@@ -775,6 +796,9 @@ class GeneralAI
protected function doNPC후방발령(LastTurn $lastTurn): ?NationCommand
{
if(!$this->nation['capital']){
return null;
}
if(!$this->frontCities){
return null;
}
@@ -848,6 +872,9 @@ class GeneralAI
protected function doNPC구출발령(LastTurn $lastTurn): ?NationCommand
{
if(!$this->nation['capital']){
return null;
}
//고립 도시 장수 발령
$args = [];
foreach ($this->lostGenerals as $lostGeneral) {
@@ -873,6 +900,9 @@ class GeneralAI
protected function doNPC전방발령(LastTurn $lastTurn): ?NationCommand
{
if(!$this->nation['capital']){
return null;
}
if(!$this->frontCities){
return null;
}
@@ -927,7 +957,10 @@ class GeneralAI
protected function doNPC내정발령(LastTurn $lastTurn): ?NationCommand
{
if(count($this->supplyCitiesID) === 1){
if(!$this->nation['capital']){
return null;
}
if(count($this->supplyCities) === 1){
return null;
}
@@ -1035,6 +1068,9 @@ class GeneralAI
}
//국고와 '충분한 금액'의 기하평균
$payAmount = sqrt(($enoughMoney - $targetUserGeneral->getVar($resName)) * $resVal);
if($payAmount < $this->nationPolicy->minimumResourceActionAmount){
continue;
}
if ($resVal < $payAmount / 2) {
continue;
@@ -1127,6 +1163,9 @@ class GeneralAI
}
//국고와 '충분한 금액'의 기하평균
$payAmount = sqrt(($enoughMoney - $targetUserGeneral->getVar($resName)) * $resVal);
if($payAmount < $this->nationPolicy->minimumResourceActionAmount){
continue;
}
if ($resVal < $payAmount / 2) {
continue;
@@ -1203,6 +1242,10 @@ class GeneralAI
//국고와 '충분한 금액'의 기하평균
$payAmount = sqrt(($enoughMoney - $targetNPCGeneral->getVar($resName)) * $resVal);
if($payAmount < $this->nationPolicy->minimumResourceActionAmount){
continue;
}
if ($resVal < $payAmount / 2) {
continue;
}
@@ -1308,6 +1351,10 @@ class GeneralAI
$payAmount = $enoughMoney - $targetNPCGeneral->getVar($resName);
$payAmount = Util::valueFit($payAmount, 100, GameConst::$maxResourceActionAmount);
if($payAmount < $this->nationPolicy->minimumResourceActionAmount){
continue;
}
$candidateArgs[] = [[
'destGeneralID' => $targetNPCGeneral->getID(),
'isGold' => $resName == 'gold',
@@ -1374,6 +1421,9 @@ class GeneralAI
$takeAmount = $targetNPCGeneral->getVar($resName) - $reqNPCMinDevelRes;
$takeAmount = Util::valueFit($takeAmount, 100, GameConst::$maxResourceActionAmount);
if($takeAmount < $this->nationPolicy->minimumResourceActionAmount){
break;
}
$candidateArgs[] = [[
'destGeneralID' => $targetNPCGeneral->getID(),
@@ -1430,6 +1480,10 @@ class GeneralAI
break;
}
if($takeAmount < $this->nationPolicy->minimumResourceActionAmount){
break;
}
$takeAmount = Util::valueFit($takeAmount, 100, GameConst::$maxResourceActionAmount);
$candidateArgs[] = [[
'destGeneralID' => $targetNPCGeneral->getID(),
+1 -1
View File
@@ -127,6 +127,6 @@ class DyingMessage{
}
return JosaUtil::batch($text, $name);
return JosaUtil::batch($text);
}
}
+1 -1
View File
@@ -3,7 +3,7 @@ namespace sammo;
class GameUnitConst extends GameUnitConstBase
{
const DEFAULT_CREWTYPE = 217001;
const DEFAULT_CREWTYPE = 217100;
protected static $typeData = [
self::T_FOOTMAN => '보병',
+1 -1
View File
@@ -3,7 +3,7 @@ namespace sammo;
class GameUnitConst extends GameUnitConstBase
{
const DEFAULT_CREWTYPE = 40;
const DEFAULT_CREWTYPE = 1500;
protected static $_buildData = [
[