getVar('npc') -> getNPCType()
This commit is contained in:
@@ -90,7 +90,7 @@ class AutorunGeneralPolicy{
|
||||
public $can선양 = false;
|
||||
|
||||
function doNPCState(General $general){
|
||||
$npc = $general->getVar('npc');
|
||||
$npc = $general->getNPCType();
|
||||
$nationID = $general->getNationID();
|
||||
|
||||
if($npc==5){
|
||||
@@ -117,7 +117,7 @@ class AutorunGeneralPolicy{
|
||||
//TODO: 국가 정책을 받아와야함
|
||||
$this->priority = static::$default_priority;
|
||||
|
||||
if($general->getVar('npc') >= 2){
|
||||
if($general->getNPCType() >= 2){
|
||||
$this->doNPCState($general);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ class AutorunNationPolicy {
|
||||
$this->reqHumanWarRecommandRice = Util::round(max(20000, $this->reqHumanWarRecommandRice * 3), -2);
|
||||
}
|
||||
|
||||
if($general->getVar('npc') >= 2){
|
||||
if($general->getNPCType() >= 2){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class che_군량매매 extends Command\GeneralCommand{
|
||||
$this->setNation();
|
||||
|
||||
$this->minConditionConstraints=[
|
||||
ConstraintHelper::ReqCityTrader($general->getVar('npc')),
|
||||
ConstraintHelper::ReqCityTrader($general->getNPCType()),
|
||||
ConstraintHelper::OccupiedCity(true),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
];
|
||||
@@ -76,7 +76,7 @@ class che_군량매매 extends Command\GeneralCommand{
|
||||
$general = $this->generalObj;
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
ConstraintHelper::ReqCityTrader($general->getVar('npc')),
|
||||
ConstraintHelper::ReqCityTrader($general->getNPCType()),
|
||||
ConstraintHelper::OccupiedCity(true),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
];
|
||||
@@ -115,7 +115,7 @@ class che_군량매매 extends Command\GeneralCommand{
|
||||
$buyRice = $this->arg['buyRice'];
|
||||
|
||||
if($tradeRate === null){
|
||||
if($general->getVar('npc') >= 2){
|
||||
if($general->getNPCType() >= 2){
|
||||
$tradeRate = 1.0;
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -135,7 +135,7 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
$destNationName = $this->destNation['name'];
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if($general->getVar('npc') == 1 || $relYear >= 3){
|
||||
if($general->getNPCType() == 1 || $relYear >= 3){
|
||||
$joinedNations = $general->getAuxVar('joinedNations')??[];
|
||||
$joinedNations[] = $destNationID;
|
||||
$general->setAuxVar('joinedNations', $joinedNations);
|
||||
@@ -178,7 +178,7 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
$general->addDedication(100);
|
||||
}
|
||||
|
||||
if($general->getVar('npc') < 2){
|
||||
if($general->getNPCType() < 2){
|
||||
$general->setVar('killturn', $env['killturn']);
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ class che_랜덤임관 extends Command\GeneralCommand{
|
||||
|
||||
$destNation = null;
|
||||
|
||||
if ($general->getVar('npc') >= 2 && !$env['fiction'] && 1000 <= $env['scenario'] && $env['scenario'] < 2000) {
|
||||
if ($general->getNPCType() >= 2 && !$env['fiction'] && 1000 <= $env['scenario'] && $env['scenario'] < 2000) {
|
||||
if($notIn){
|
||||
$nations = $db->query(
|
||||
'SELECT nation.`name` as `name`,nation.nation as nation,scout,gennum,`affinity` FROM nation join general on general.nation = nation.nation and general.officer_level = 12 WHERE scout=0 and gennum<%i and nation.nation not in %li',
|
||||
@@ -276,7 +276,7 @@ class che_랜덤임관 extends Command\GeneralCommand{
|
||||
], 'nation=%i', $destNationID);
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if($general->getVar('npc') == 1 || $relYear >= 3){
|
||||
if($general->getNPCType() == 1 || $relYear >= 3){
|
||||
$joinedNations = $general->getAuxVar('joinedNations')??[];
|
||||
$joinedNations[] = $destNationID;
|
||||
$general->setAuxVar('joinedNations', $joinedNations);
|
||||
|
||||
@@ -168,7 +168,7 @@ class che_임관 extends Command\GeneralCommand{
|
||||
\sammo\refreshNationStaticInfo();
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if($general->getVar('npc') == 1 || $relYear >= 3){
|
||||
if($general->getNPCType() == 1 || $relYear >= 3){
|
||||
$joinedNations = $general->getAuxVar('joinedNations')??[];
|
||||
$joinedNations[] = $destNationID;
|
||||
$general->setAuxVar('joinedNations', $joinedNations);
|
||||
|
||||
@@ -64,7 +64,7 @@ class che_장비매매 extends Command\GeneralCommand{
|
||||
$this->setNation();
|
||||
|
||||
$this->minConditionConstraints=[
|
||||
ConstraintHelper::ReqCityTrader($general->getVar('npc')),
|
||||
ConstraintHelper::ReqCityTrader($general->getNPCType()),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class che_장비매매 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
ConstraintHelper::ReqCityTrader($general->getVar('npc')),
|
||||
ConstraintHelper::ReqCityTrader($general->getNPCType()),
|
||||
ConstraintHelper::ReqCityCapacity('secu', '치안 수치', $itemClass->getReqSecu()),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
|
||||
@@ -173,7 +173,7 @@ class che_장수대상임관 extends Command\GeneralCommand{
|
||||
\sammo\refreshNationStaticInfo();
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if($general->getVar('npc') == 1 || $relYear >= 3){
|
||||
if($general->getNPCType() == 1 || $relYear >= 3){
|
||||
$joinedNations = $general->getAuxVar('joinedNations')??[];
|
||||
$joinedNations[] = $destNationID;
|
||||
$general->setAuxVar('joinedNations', $joinedNations);
|
||||
|
||||
@@ -97,7 +97,7 @@ class che_하야 extends Command\GeneralCommand{
|
||||
$db->update('nation', [
|
||||
'gold'=>$db->sqleval('gold + %i', $lostGold),
|
||||
'rice'=>$db->sqleval('rice + %i', $lostRice),
|
||||
'gennum'=>$db->sqleval('gennum - %i', $general->getVar('npc')!=5?1:0)
|
||||
'gennum'=>$db->sqleval('gennum - %i', $general->getNPCType()!=5?1:0)
|
||||
], 'nation=%i', $nationID);
|
||||
\sammo\refreshNationStaticInfo();
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ class che_몰수 extends Command\NationCommand
|
||||
);
|
||||
$amountText = number_format($amount, 0);
|
||||
|
||||
if ($destGeneral->getVar('npc') >= 2 && Util::randBool(0.01)) {
|
||||
if ($destGeneral->getNPCType() >= 2 && Util::randBool(0.01)) {
|
||||
$npcTexts = [
|
||||
'몰수를 하다니... 이것이 윗사람이 할 짓이란 말입니까...',
|
||||
'사유재산까지 몰수해가면서 이 나라가 잘 될거라 믿습니까? 정말 이해할 수가 없군요...',
|
||||
|
||||
@@ -158,6 +158,10 @@ class General implements iAction{
|
||||
return $this->itemObjs[$itemKey];
|
||||
}
|
||||
|
||||
function getNPCType():int{
|
||||
return $this->raw['npc'];
|
||||
}
|
||||
|
||||
/** @return BaseItem[] */
|
||||
function getItems():array{
|
||||
return $this->itemObjs;
|
||||
|
||||
+13
-13
@@ -634,7 +634,7 @@ class GeneralAI
|
||||
//고립 도시 장수 발령
|
||||
$args = [];
|
||||
foreach ($this->lostGenerals as $lostGeneral) {
|
||||
if ($lostGeneral->getVar('npc') >= 2) {
|
||||
if ($lostGeneral->getNPCType() >= 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -885,7 +885,7 @@ class GeneralAI
|
||||
//고립 도시 장수 발령
|
||||
$args = [];
|
||||
foreach ($this->lostGenerals as $lostGeneral) {
|
||||
if ($lostGeneral->getVar('npc') < 2 || $lostGeneral->getVar('npc') == 5) {
|
||||
if ($lostGeneral->getNPCType() < 2 || $lostGeneral->getNPCType() == 5) {
|
||||
continue;
|
||||
}
|
||||
$selCity = Util::choiceRandom($this->supplyCities);
|
||||
@@ -2662,7 +2662,7 @@ class GeneralAI
|
||||
{
|
||||
$general = $this->general;
|
||||
|
||||
if($general->getVar('npc') == 5){
|
||||
if($general->getNPCType() == 5){
|
||||
$newKillTurn = ($general->getVar('killturn') + Util::randRangeInt(2, 4)) % 5;
|
||||
$newKillTurn += 70;
|
||||
$general->setVar('killturn', $newKillTurn);
|
||||
@@ -2812,7 +2812,7 @@ class GeneralAI
|
||||
$db = DB::db();
|
||||
|
||||
// 오랑캐는 바로 임관
|
||||
if ($general->getVar('npc') == 9) {
|
||||
if ($general->getNPCType() == 9) {
|
||||
$rulerNation = $db->queryFirstField(
|
||||
'SELECT nation FROM general WHERE `officer_level`=12 AND npc=9 and nation not in %li ORDER BY RAND() limit 1',
|
||||
$general->getAuxVar('joinedNations') ?? [0]
|
||||
@@ -3010,7 +3010,7 @@ class GeneralAI
|
||||
foreach($nationGenerals as $nationGeneral){
|
||||
$generalID = $nationGeneral->getID();
|
||||
$cityID = $nationGeneral->getCityID();
|
||||
$npcType = $nationGeneral->getVar('npc');
|
||||
$npcType = $nationGeneral->getNPCType();
|
||||
$officerLevel = $nationGeneral->getVar('officer_level');
|
||||
$officerCity = $nationGeneral->getVar('officer_city');
|
||||
|
||||
@@ -3081,7 +3081,7 @@ class GeneralAI
|
||||
//TODO: NationTurn과 InstantNationTurn 구분 필요
|
||||
$lastTurn = $reservedCommand->getLastTurn();
|
||||
$general = $this->general;
|
||||
$npcType = $general->getVar('npc');
|
||||
$npcType = $general->getNPCType();
|
||||
|
||||
$this->categorizeNationGeneral();
|
||||
$this->categorizeNationCities();
|
||||
@@ -3160,7 +3160,7 @@ class GeneralAI
|
||||
|
||||
public function chooseGeneralTurn(GeneralCommand $reservedCommand): GeneralCommand{
|
||||
$general = $this->general;
|
||||
$npcType = $general->getVar('npc');
|
||||
$npcType = $general->getNPCType();
|
||||
$nationID = $general->getNationID();
|
||||
|
||||
//특별 메세지 있는 경우 출력 하루 4번
|
||||
@@ -3427,7 +3427,7 @@ class GeneralAI
|
||||
continue;
|
||||
}
|
||||
$chief = $this->chiefGenerals[$chiefLevel];
|
||||
if($chief->getVar('npc') < 2 && $chief->getVar('killturn') >= $minUserKillturn){
|
||||
if($chief->getNPCType() < 2 && $chief->getVar('killturn') >= $minUserKillturn){
|
||||
$userChiefCnt+=1;
|
||||
$chief->setVar('permission', 'ambassador');
|
||||
}
|
||||
@@ -3490,7 +3490,7 @@ class GeneralAI
|
||||
|
||||
if(key_exists($chiefLevel, $this->chiefGenerals)){
|
||||
$oldChief = $this->chiefGenerals[$chiefLevel];
|
||||
if($oldChief->getVar('npc') < 2 && $oldChief->getVar('killturn') >= $minChiefLevel){
|
||||
if($oldChief->getNPCType() < 2 && $oldChief->getVar('killturn') >= $minChiefLevel){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -3512,10 +3512,10 @@ class GeneralAI
|
||||
if($general->getVar('officer_level') !== 1){
|
||||
continue;
|
||||
}
|
||||
if($general->getVar('npc') < 2 && $general->getVar('killturn') < $minUserKillturn){
|
||||
if($general->getNPCType() < 2 && $general->getVar('killturn') < $minUserKillturn){
|
||||
continue;
|
||||
}
|
||||
if($general->getVar('npc') >= 2 && $general->getVar('killturn') < $minNPCKillturn){
|
||||
if($general->getNPCType() >= 2 && $general->getVar('killturn') < $minNPCKillturn){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3528,7 +3528,7 @@ class GeneralAI
|
||||
continue;
|
||||
}
|
||||
|
||||
if($general->getVar('npc') < 2 && $userChiefCnt >= 3){
|
||||
if($general->getNPCType() < 2 && $userChiefCnt >= 3){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3540,7 +3540,7 @@ class GeneralAI
|
||||
continue;
|
||||
}
|
||||
|
||||
if($newChief->getVar('npc') < 2){
|
||||
if($newChief->getNPCType() < 2){
|
||||
$userChiefCnt += 1;
|
||||
$newChief->setVar('permission', 'ambassador');
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class DyingMessage{
|
||||
}
|
||||
$this->general = $general;
|
||||
$this->name = $general->getName();
|
||||
$this->npc = $general->getVar('npc');
|
||||
$this->npc = $general->getNPCType();
|
||||
if($general->getVar('owner') > 0 && $general->getVar('startage') - $general->getVar('age') > 1){
|
||||
$this->realName = $general->getVar('owner_name');
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ class TurnExecutionHelper
|
||||
|
||||
$killTurn = $gameStor->killturn;
|
||||
|
||||
if($general->getVar('npc') >= 2){
|
||||
if($general->getNPCType() >= 2){
|
||||
$general->increaseVarWithLimit('killturn', -1);
|
||||
}
|
||||
else if($general->getVar('killturn') > $killTurn){
|
||||
@@ -175,7 +175,7 @@ class TurnExecutionHelper
|
||||
// 삭턴장수 삭제처리
|
||||
if($general->getVar('killturn') <= 0){
|
||||
// npc유저 삭턴시 npc로 전환
|
||||
if($general->getVar('npc') == 1 && $general->getVar('deadyear') > $gameStor->year){
|
||||
if($general->getNPCType() == 1 && $general->getVar('deadyear') > $gameStor->year){
|
||||
|
||||
$ownerName = $general->getVar('owner_name');
|
||||
$josaYi = JosaUtil::pick($ownerName, '이');
|
||||
@@ -197,7 +197,7 @@ class TurnExecutionHelper
|
||||
}
|
||||
|
||||
//은퇴
|
||||
if($general->getVar('age') >= GameConst::$retirementYear && $general->getVar('npc') == 0) {
|
||||
if($general->getVar('age') >= GameConst::$retirementYear && $general->getNPCType() == 0) {
|
||||
if($gameStor->isunited == 0) {
|
||||
$general->applyDB($db);
|
||||
CheckHall($generalID);
|
||||
@@ -258,7 +258,7 @@ class TurnExecutionHelper
|
||||
|
||||
$turnObj->preprocessCommand();
|
||||
|
||||
if($general->getVar('npc') >= 2 || ($autorun_user['limit_minutes']??false)){
|
||||
if($general->getNPCType() >= 2 || ($autorun_user['limit_minutes']??false)){
|
||||
$ai = new GeneralAI($turnObj->getGeneral());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user