fix: RegNPC 버그 수정

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