fix: RegNPC 버그 수정

This commit is contained in:
2021-03-19 17:44:34 +09:00
parent 0165cfb3ac
commit 0a42d7381c
6 changed files with 12 additions and 13 deletions
+2 -3
View File
@@ -35,12 +35,11 @@ class RegNPC extends \sammo\Event\Action{
->setSpecialSingle($char) ->setSpecialSingle($char)
->setNPCText($text?:'') ->setNPCText($text?:'')
->setAffinity($affinity) ->setAffinity($affinity)
->setLifeSpan($birth, $death) ->setLifeSpan($birth, $death);
->fillRemainSpecAsZero();
} }
public function run($env=null){ public function run($env=null){
$result = $this->npc->build($env); $result = $this->npc->fillRemainSpecAsZero($env)->build($env);
return [__CLASS__, $result]; return [__CLASS__, $result];
} }
+3 -3
View File
@@ -3,6 +3,7 @@ namespace sammo\Event\Action;
class RegNeutralNPC extends \sammo\Event\Action{ class RegNeutralNPC extends \sammo\Event\Action{
/** @var \sammo\Scenario\GeneralBuilder */
private $npc; private $npc;
public function __construct( public function __construct(
@@ -33,12 +34,11 @@ class RegNeutralNPC extends \sammo\Event\Action{
->setNPCText($text?:'') ->setNPCText($text?:'')
->setAffinity($affinity) ->setAffinity($affinity)
->setLifeSpan($birth, $death) ->setLifeSpan($birth, $death)
->setNPCType(6) ->setNPCType(6);
->fillRemainSpecAsZero();
} }
public function run($env=null){ public function run($env=null){
$result = $this->npc->build($env); $result = $this->npc->fillRemainSpecAsZero($env)->build($env);
return [__CLASS__, $result]; return [__CLASS__, $result];
} }
+1 -1
View File
@@ -26,7 +26,7 @@ class RandomNameGeneral extends AbsGeneralPool{
return $db->affectedRows()!=0; return $db->affectedRows()!=0;
} }
public function giveGeneralSpec(array $pickTypeList, array $avgGen, array $env=[]){ public function giveGeneralSpec(array $pickTypeList, array $avgGen, array $env){
//do Nothing //do Nothing
$dexTotal = $avgGen['dex_t']; $dexTotal = $avgGen['dex_t'];
+1 -1
View File
@@ -482,7 +482,7 @@ class Scenario{
copy("$unitPath/$unitSet.php", $path.'/GameUnitConst.php'); copy("$unitPath/$unitSet.php", $path.'/GameUnitConst.php');
} }
public function build($env=[]){ public function build($env){
$db = DB::db(); $db = DB::db();
getGeneralPoolClass(GameConst::$targetGeneralPool)::initPool($db); getGeneralPoolClass(GameConst::$targetGeneralPool)::initPool($db);
+3 -3
View File
@@ -337,7 +337,7 @@ class GeneralBuilder{
return $this; return $this;
} }
public function fillRemainSpecAsZero(array $env=[]):self{ public function fillRemainSpecAsZero(array $env):self{
if($this->leadership===null){ if($this->leadership===null){
throw new \RuntimeException('stat이 설정되어 있지 않음'); throw new \RuntimeException('stat이 설정되어 있지 않음');
} }
@@ -390,7 +390,7 @@ class GeneralBuilder{
return $this; return $this;
} }
public function fillRemainSpecAsRandom(array $pickTypeList, array $avgGen, array $env=[]):self{ public function fillRemainSpecAsRandom(array $pickTypeList, array $avgGen, array $env):self{
$isFictionMode = (Util::array_get($env['fiction'], 0)!=0); $isFictionMode = (Util::array_get($env['fiction'], 0)!=0);
@@ -532,7 +532,7 @@ class GeneralBuilder{
return $this->death; return $this->death;
} }
public function build($env=[]){ public function build($env){
//scenario에 life==1인 경우 수명 제한이 없어지는 모양. //scenario에 life==1인 경우 수명 제한이 없어지는 모양.
+2 -2
View File
@@ -64,7 +64,7 @@ class Nation{
return $this->name; return $this->name;
} }
public function build($env=[]){ public function build($env){
//NOTE: NPC의 숫자는 아직 확정된 것이 아니다. //NOTE: NPC의 숫자는 아직 확정된 것이 아니다.
$cities = array_map(function($cityName){ $cities = array_map(function($cityName){
return \sammo\CityHelper::getCityByName($cityName)['id']; return \sammo\CityHelper::getCityByName($cityName)['id'];
@@ -147,7 +147,7 @@ class Nation{
$this->generals[] = $general; $this->generals[] = $general;
} }
public function postBuild($env=[]){ public function postBuild($env){
$npc_cnt = count($this->generals); $npc_cnt = count($this->generals);
$db = DB::db(); $db = DB::db();