phan 처리
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_덕가 extends \sammo\BaseNation{
|
||||
|
||||
@@ -30,10 +31,10 @@ class che_덕가 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'rice'){
|
||||
return $amount * 0.9;
|
||||
return Util::toInt($amount * 0.9);
|
||||
}
|
||||
if($type == 'pop'){
|
||||
return $amount * 1.2;
|
||||
return Util::toInt($amount * 1.2);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_도가 extends \sammo\BaseNation{
|
||||
|
||||
@@ -25,7 +26,7 @@ class che_도가 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'pop'){
|
||||
return $amount * 1.2;
|
||||
return Util::toInt($amount * 1.2);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_도적 extends \sammo\BaseNation{
|
||||
|
||||
@@ -29,7 +30,7 @@ class che_도적 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'gold'){
|
||||
return $amount * 0.9;
|
||||
return Util::toInt($amount * 0.9);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_명가 extends \sammo\BaseNation{
|
||||
|
||||
@@ -26,10 +27,10 @@ class che_명가 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'rice'){
|
||||
return $amount * 0.9;
|
||||
return Util::toInt($amount * 0.9);
|
||||
}
|
||||
if($type == 'pop'){
|
||||
return $amount * 1.2;
|
||||
return Util::toInt($amount * 1.2);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_법가 extends \sammo\BaseNation{
|
||||
|
||||
@@ -26,10 +27,10 @@ class che_법가 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'gold'){
|
||||
return $amount * 1.1;
|
||||
return Util::toInt($amount * 1.1);
|
||||
}
|
||||
if($type == 'pop'){
|
||||
return $amount * 0.8;
|
||||
return Util::toInt($amount * 0.8);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_병가 extends \sammo\BaseNation{
|
||||
|
||||
@@ -30,7 +31,7 @@ class che_병가 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'pop'){
|
||||
return $amount * 0.8;
|
||||
return Util::toInt($amount * 0.8);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_불가 extends \sammo\BaseNation{
|
||||
|
||||
@@ -25,7 +26,7 @@ class che_불가 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'gold'){
|
||||
return $amount * 0.9;
|
||||
return Util::toInt($amount * 0.9);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_오두미도 extends \sammo\BaseNation{
|
||||
|
||||
@@ -30,10 +31,10 @@ class che_오두미도 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'rice'){
|
||||
return $amount * 1.1;
|
||||
return Util::toInt($amount * 1.1);
|
||||
}
|
||||
if($type == 'pop'){
|
||||
return $amount * 1.2;
|
||||
return Util::toInt($amount * 1.2);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_유가 extends \sammo\BaseNation{
|
||||
|
||||
@@ -25,7 +26,7 @@ class che_유가 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'rice'){
|
||||
return $amount * 0.9;
|
||||
return Util::toInt($amount * 0.9);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_음양가 extends \sammo\BaseNation{
|
||||
|
||||
@@ -26,7 +27,7 @@ class che_음양가 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'pop'){
|
||||
return $amount * 1.2;
|
||||
return Util::toInt($amount * 1.2);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -27,7 +27,7 @@ class che_종횡가 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'gold'){
|
||||
return $amount * 0.9;
|
||||
return Util::toInt($amount * 0.9);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo\ActionNationType;
|
||||
use \sammo\iAction;
|
||||
use \sammo\General;
|
||||
use \sammo\Util;
|
||||
|
||||
class che_태평도 extends \sammo\BaseNation{
|
||||
|
||||
@@ -30,7 +31,7 @@ class che_태평도 extends \sammo\BaseNation{
|
||||
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
if($type == 'pop'){
|
||||
return $amount * 1.2;
|
||||
return Util::toInt($amount * 1.2);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
|
||||
@@ -14,10 +14,6 @@ use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
abstract class BaseCommand{
|
||||
/**
|
||||
* @var General|null $generalObj
|
||||
* @var General|null $destGeneralObj
|
||||
*/
|
||||
static protected $actionName = 'CommandName';
|
||||
static public $reqArg = false;
|
||||
|
||||
@@ -253,7 +249,7 @@ abstract class BaseCommand{
|
||||
return static::$actionName;
|
||||
}
|
||||
|
||||
public function getLogger():ActionLogger{
|
||||
public function getLogger():?ActionLogger{
|
||||
return $this->logger;
|
||||
}
|
||||
|
||||
@@ -403,7 +399,6 @@ abstract class BaseCommand{
|
||||
}
|
||||
public function getForm():string{
|
||||
throw new \sammo\MustNotBeReachedException();
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getLastTurn():LastTurn{
|
||||
|
||||
@@ -29,6 +29,8 @@ class che_상업투자 extends Command\GeneralCommand{
|
||||
static protected $actionName = '상업 투자';
|
||||
static protected $debuffFront = 0.5;
|
||||
|
||||
protected $reqGold;
|
||||
|
||||
protected function argTest():bool{
|
||||
$this->arg = null;
|
||||
return true;
|
||||
|
||||
@@ -28,6 +28,8 @@ class che_정착장려 extends Command\GeneralCommand{
|
||||
static protected $actionKey = '인구';
|
||||
static protected $actionName = '정착 장려';
|
||||
|
||||
protected $reqRice;
|
||||
|
||||
protected function argTest():bool{
|
||||
$this->arg = null;
|
||||
return true;
|
||||
|
||||
@@ -28,6 +28,8 @@ class che_주민선정 extends Command\GeneralCommand{
|
||||
static protected $actionKey = '민심';
|
||||
static protected $actionName = '주민 선정';
|
||||
|
||||
protected $reqRice;
|
||||
|
||||
protected function argTest():bool{
|
||||
$this->arg = null;
|
||||
return true;
|
||||
|
||||
@@ -24,9 +24,6 @@ use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_징병 extends Command\GeneralCommand{
|
||||
/**
|
||||
* @var \sammo\GameUnitDetail $reqCrewType
|
||||
*/
|
||||
static protected $actionName = '징병';
|
||||
static protected $costOffset = 1;
|
||||
static public $reqArg = true;
|
||||
|
||||
@@ -98,8 +98,8 @@ class che_물자원조 extends Command\NationCommand{
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::BeChief(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::ReqNationGold(GameConst::$basegold+($goldAmount>0)?1:0),
|
||||
ConstraintHelper::ReqNationRice(GameConst::$baserice+($riceAmount>0)?1:0),
|
||||
ConstraintHelper::ReqNationGold(GameConst::$basegold+(($goldAmount>0)?1:0)),
|
||||
ConstraintHelper::ReqNationRice(GameConst::$baserice+(($riceAmount>0)?1:0)),
|
||||
ConstraintHelper::ReqNationValue('surlimit', '외교제한', '==', 0, '외교제한중입니다.'),
|
||||
ConstraintHelper::ReqDestNationValue('surlimit', '외교제한', '==', 0, '상대국이 외교제한중입니다.'),
|
||||
];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace sammo\Constraint;
|
||||
|
||||
class AllowWar extends Constraint{
|
||||
class AllowStrategicCommand extends Constraint{
|
||||
const REQ_VALUES = Constraint::REQ_NATION;
|
||||
|
||||
public function checkInputValues(bool $throwExeception=true):bool{
|
||||
|
||||
@@ -5,7 +5,7 @@ use \sammo\DB;
|
||||
use \sammo\GameConst;
|
||||
use \sammo\Json;
|
||||
|
||||
class AllowJoinDestNation extends Constraint{
|
||||
class ExistsAllowJoinNation extends Constraint{
|
||||
const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_ARRAY_ARG;
|
||||
|
||||
protected $relYear;
|
||||
|
||||
@@ -111,7 +111,9 @@ class ReqCityValue extends Constraint{
|
||||
return '부족합니다.';
|
||||
},
|
||||
'>'=>function($target, $src){
|
||||
return $target > $src;
|
||||
if($target > $src){
|
||||
return true;
|
||||
}
|
||||
if($src == 0){
|
||||
return '없습니다';
|
||||
}
|
||||
|
||||
@@ -111,7 +111,9 @@ class ReqDestCityValue extends Constraint{
|
||||
return '부족합니다.';
|
||||
},
|
||||
'>'=>function($target, $src){
|
||||
return $target > $src;
|
||||
if($target > $src){
|
||||
return true;
|
||||
}
|
||||
if($src == 0){
|
||||
return '없습니다';
|
||||
}
|
||||
|
||||
@@ -111,7 +111,9 @@ class ReqDestNationValue extends Constraint{
|
||||
return '부족합니다.';
|
||||
},
|
||||
'>'=>function($target, $src){
|
||||
return $target > $src;
|
||||
if($target > $src){
|
||||
return true;
|
||||
}
|
||||
if($src == 0){
|
||||
return '없습니다';
|
||||
}
|
||||
|
||||
@@ -89,7 +89,9 @@ class ReqGeneralValue extends Constraint{
|
||||
return '부족합니다.';
|
||||
},
|
||||
'>'=>function($target, $src){
|
||||
return $target > $src;
|
||||
if($target > $src){
|
||||
return true;
|
||||
}
|
||||
if($src == 0){
|
||||
return '없습니다';
|
||||
}
|
||||
|
||||
@@ -135,7 +135,9 @@ class ReqNationAuxValue extends Constraint{
|
||||
return '부족합니다.';
|
||||
},
|
||||
'>'=>function($target, $src){
|
||||
return $target > $src;
|
||||
if($target > $src){
|
||||
return true;
|
||||
}
|
||||
if($src == 0){
|
||||
return '없습니다';
|
||||
}
|
||||
|
||||
@@ -111,7 +111,9 @@ class ReqNationValue extends Constraint{
|
||||
return '부족합니다.';
|
||||
},
|
||||
'>'=>function($target, $src){
|
||||
return $target > $src;
|
||||
if($target > $src){
|
||||
return true;
|
||||
}
|
||||
if($src == 0){
|
||||
return '없습니다';
|
||||
}
|
||||
|
||||
+14
-13
@@ -8,15 +8,6 @@ use sammo\WarUnitTrigger as WarUnitTrigger;
|
||||
class General implements iAction{
|
||||
use LazyVarUpdater;
|
||||
|
||||
/**
|
||||
* @var iAction $nationType
|
||||
* @var iAction $officerLevelObj
|
||||
* @var iAction $specialDomesticObj
|
||||
* @var iAction $specialWarObj
|
||||
* @var iAction $personalityObj
|
||||
* @var iAction[] $itemObjs
|
||||
*/
|
||||
|
||||
protected $raw = [];
|
||||
protected $rawCity = null;
|
||||
|
||||
@@ -32,11 +23,17 @@ class General implements iAction{
|
||||
protected $logActivatedSkill = [];
|
||||
protected $isFinished = false;
|
||||
|
||||
/** @var iAction */
|
||||
protected $nationType = null;
|
||||
/** @var iAction */
|
||||
protected $officerLevelObj = null;
|
||||
/** @var iAction */
|
||||
protected $specialDomesticObj = null;
|
||||
/** @var iAction */
|
||||
protected $specialWarObj = null;
|
||||
/** @var iAction */
|
||||
protected $personalityObj = null;
|
||||
/** @var iAction[] */
|
||||
protected $itemObjs = [];
|
||||
|
||||
protected $lastTurn = null;
|
||||
@@ -79,8 +76,8 @@ class General implements iAction{
|
||||
/**
|
||||
* @param array $raw DB row값.
|
||||
* @param null|array $city DB city 테이블의 row값
|
||||
* @param int $year 게임 연도
|
||||
* @param int $month 게임 월
|
||||
* @param int|null $year 게임 연도
|
||||
* @param int|null $month 게임 월
|
||||
* @param bool $fullConstruct iAction, 및 ActionLogger 초기화 여부, false인 경우 no, name, city, nation, officer_level 정도로 초기화 가능
|
||||
*/
|
||||
public function __construct(array $raw, ?array $rawRank, ?array $city, ?array $nation, ?int $year, ?int $month, bool $fullConstruct=true){
|
||||
@@ -270,7 +267,11 @@ class General implements iAction{
|
||||
}
|
||||
|
||||
function getCrewTypeObj():GameUnitDetail{
|
||||
return GameUnitConst::byID($this->getVar('crewtype'));
|
||||
$crewType = GameUnitConst::byID($this->getVar('crewtype'));
|
||||
if($crewType === null){
|
||||
throw new \InvalidArgumentException('Invalid CrewType:'.$this->getVar('crewtype'));
|
||||
}
|
||||
return $crewType;
|
||||
}
|
||||
|
||||
function calcRecentWarTurn(int $turnTerm):int{
|
||||
@@ -292,7 +293,7 @@ class General implements iAction{
|
||||
return 0;
|
||||
}
|
||||
|
||||
$result = intdiv($secDiff, 60 * $turnTerm);
|
||||
$result = intdiv(Util::toInt($secDiff), 60 * $turnTerm);
|
||||
$this->calcCache[$cacheKey] = $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
+10
-7
@@ -8,9 +8,7 @@ use sammo\Scenario\NPC;
|
||||
|
||||
class GeneralAI
|
||||
{
|
||||
/**
|
||||
* @var General $general
|
||||
*/
|
||||
/** @var General */
|
||||
protected $general;
|
||||
/** @var array */
|
||||
protected $city;
|
||||
@@ -92,8 +90,12 @@ class GeneralAI
|
||||
if ($general->getRawCity() === null) {
|
||||
$city = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $general->getCityID());
|
||||
$general->setRawCity($city);
|
||||
$this->city = $city;
|
||||
}
|
||||
$this->city = $general->getRawCity();
|
||||
else{
|
||||
$this->city = $general->getRawCity();
|
||||
}
|
||||
|
||||
$this->nation = $db->queryFirstRow(
|
||||
'SELECT nation,name,color,capital,capset,gennum,gold,rice,bill,rate,rate_tmp,scout,war,strategic_cmd_limit,surlimit,tech,power,level,l12set,l11set,l10set,l9set,l8set,l7set,l6set,l5set,type,aux FROM nation WHERE nation = %i',
|
||||
$general->getNationID()
|
||||
@@ -496,7 +498,7 @@ class GeneralAI
|
||||
return null;
|
||||
}
|
||||
|
||||
$turnList = General::getReservedTurnByGeneralList(array_keys($generalCadidates), 0, $this->env);
|
||||
$turnList = General::getReservedTurnByGeneralList($generalCadidates, 0, $this->env);
|
||||
$generalCadidates = array_filter($generalCadidates, function(General $general)use($turnList){
|
||||
$generalID = $general->getID();
|
||||
if($turnList[$generalID] instanceof Command\General\che_징병){
|
||||
@@ -2898,8 +2900,6 @@ class GeneralAI
|
||||
'amount' => GameConst::$maxResourceActionAmount
|
||||
]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function do중립(): GeneralCommand
|
||||
@@ -3205,6 +3205,9 @@ class GeneralAI
|
||||
return $reservedCommand;
|
||||
}
|
||||
$result = $this->do집합();
|
||||
if(!$result){
|
||||
throw new MustNotBeReachedException();
|
||||
}
|
||||
$result->reason='do집합';
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace sammo;
|
||||
trait LazyVarUpdater{
|
||||
protected $raw = [];
|
||||
protected $updatedVar = [];
|
||||
protected $auxVar = null;
|
||||
protected $auxUpdated = false;
|
||||
|
||||
function getRaw(bool $extractAux=false):array{
|
||||
|
||||
@@ -38,7 +38,7 @@ class MessageTarget extends Target {
|
||||
public static function buildFromArray($arr)
|
||||
{
|
||||
if(!$arr){
|
||||
return null;
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
if(!Util::array_get($arr['nation_id'])){
|
||||
$arr['nation'] = '재야';
|
||||
@@ -71,7 +71,7 @@ class MessageTarget extends Target {
|
||||
) = $db->queryFirstList('SELECT `name`, nation, imgsvr, picture FROM general WHERE `no`=%i', $generalID);
|
||||
|
||||
if($generalName === null){
|
||||
return null;
|
||||
throw new \RuntimeException('장수가 없음:'.$generalID);
|
||||
}
|
||||
|
||||
$icon = GetImageURL($imgsvr, $picture);
|
||||
|
||||
@@ -6,6 +6,7 @@ use \sammo\Util;
|
||||
use \sammo\JosaUtil;
|
||||
|
||||
class DyingMessage{
|
||||
private $general;
|
||||
private $name;
|
||||
private $realName;
|
||||
private $npc;
|
||||
|
||||
@@ -4,9 +4,7 @@ namespace sammo;
|
||||
use \Symfony\Component\Lock;
|
||||
class TurnExecutionHelper
|
||||
{
|
||||
/**
|
||||
* @var General $generalObj;
|
||||
*/
|
||||
/** @var General*/
|
||||
protected $generalObj;
|
||||
|
||||
public function __construct(General $general)
|
||||
@@ -267,17 +265,16 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
|
||||
}
|
||||
|
||||
$autorunMode = false;
|
||||
$tryAutorun = false;
|
||||
$ai = null;
|
||||
|
||||
if($general->getVar('npc') >= 2 || ($autorun_user['limit_minutes']??false)){
|
||||
$tryAutorun = true;
|
||||
$ai = new GeneralAI($turnObj->getGeneral());
|
||||
}
|
||||
|
||||
if(!$turnObj->processBlocked()){
|
||||
$turnObj->preprocessCommand();
|
||||
if($hasNationTurn){
|
||||
if($tryAutorun){
|
||||
if($ai){
|
||||
$nationCommandObj = $ai->chooseNationTurn($nationCommandObj);
|
||||
LogText("NationTurn", "General, {$general->getName()}, {$general->getID()}, {$general->getStaticNation()['name']}, {$nationCommandObj->getBrief()}, {$nationCommandObj->reason}, ");
|
||||
}
|
||||
@@ -287,7 +284,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
|
||||
$nationStor->setValue($lastNationTurnKey, $resultNationTurn->toJson());
|
||||
}
|
||||
|
||||
if($tryAutorun){
|
||||
if($ai){
|
||||
$newGeneralCommandObj = $ai->chooseGeneralTurn($generalCommandObj); // npc AI 처리
|
||||
if($generalCommandObj !== $newGeneralCommandObj){
|
||||
$autorunMode = true;
|
||||
@@ -347,7 +344,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
|
||||
$prevTurn = cutTurn($gameStor->turntime, $gameStor->turnterm);
|
||||
$nextTurn = addTurn($prevTurn, $gameStor->turnterm);
|
||||
|
||||
$maxActionTime = ini_get('max_execution_time');
|
||||
$maxActionTime = Util::toInt(ini_get('max_execution_time'));
|
||||
if($maxActionTime == 0){
|
||||
$maxActionTime = 60;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,11 @@ class WarUnit{
|
||||
}
|
||||
|
||||
function getLogger():ActionLogger{
|
||||
return $this->getGeneral()->getLogger();
|
||||
$logger = $this->getGeneral()->getLogger();
|
||||
if($logger === null){
|
||||
throw new \RuntimeException();
|
||||
}
|
||||
return $logger;
|
||||
}
|
||||
|
||||
function getKilled():int{
|
||||
|
||||
@@ -149,7 +149,7 @@ class WarUnitCity extends WarUnit{
|
||||
}
|
||||
|
||||
|
||||
function applyDB($db):bool{
|
||||
function applyDB(\MeekroDB $db):bool{
|
||||
$updateVals = $this->getUpdatedValues();
|
||||
$this->getLogger()->rollback(); //수비 도시의 로그는 기록하지 않음
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
namespace sammo;
|
||||
|
||||
class WarUnitGeneral extends WarUnit{
|
||||
protected $raw;
|
||||
|
||||
function __construct(General $general, array $rawNation, bool $isAttacker){
|
||||
$this->general = $general;
|
||||
$this->raw = $general->getRaw();
|
||||
@@ -301,10 +303,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
$this->checkStatChange();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MeekroDB $db
|
||||
*/
|
||||
function applyDB($db):bool{
|
||||
function applyDB(\MeekroDB $db):bool{
|
||||
$affected = $this->getGeneral()->applyDB($db);
|
||||
$this->getLogger()->flush();
|
||||
return $affected;
|
||||
|
||||
Reference in New Issue
Block a user