balance: 초반 NPC 생성 시 모든 국가를 채울 수 있을 정도로는 제공
This commit is contained in:
@@ -9,9 +9,11 @@ use function sammo\pickGeneralFromPool;
|
|||||||
//기존 event_3.php
|
//기존 event_3.php
|
||||||
class CreateManyNPC extends \sammo\Event\Action{
|
class CreateManyNPC extends \sammo\Event\Action{
|
||||||
protected $npcCount;
|
protected $npcCount;
|
||||||
|
protected $fillCnt;
|
||||||
protected $avgGen;
|
protected $avgGen;
|
||||||
public function __construct($npcCount = 10){
|
public function __construct($npcCount = 10, $fillCnt = 0){
|
||||||
$this->npcCount = $npcCount;
|
$this->npcCount = $npcCount;
|
||||||
|
$this->fillCnt = $fillCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generateNPC($env, int $cnt){
|
protected function generateNPC($env, int $cnt){
|
||||||
@@ -47,7 +49,17 @@ class CreateManyNPC extends \sammo\Event\Action{
|
|||||||
if($this->npcCount <= 0){
|
if($this->npcCount <= 0){
|
||||||
return [__CLASS__, []];
|
return [__CLASS__, []];
|
||||||
}
|
}
|
||||||
$result = $this->generateNPC($env, $this->npcCount);
|
|
||||||
|
|
||||||
|
$moreGenCnt = 0;
|
||||||
|
if($this->fillCnt){
|
||||||
|
$db = DB::db();
|
||||||
|
$nations = $db->queryFirstColumn('SELECT nation FROM general WHERE npc < 2 AND officer_level = 12');
|
||||||
|
$regGens = $db->queryFirstField('SELECT count(*) FROM general WHERE nation IN %li AND npc < 4', $nations);
|
||||||
|
$moreGenCnt = count($nations) * $this->fillCnt - $regGens;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->generateNPC($env, $this->npcCount + $moreGenCnt);
|
||||||
|
|
||||||
$logger = new \sammo\ActionLogger(0, 0, $env['year'], $env['month']);
|
$logger = new \sammo\ActionLogger(0, 0, $env['year'], $env['month']);
|
||||||
$genCnt = count($result);
|
$genCnt = count($result);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"events":[
|
"events":[
|
||||||
[
|
[
|
||||||
["or", ["Date", "==", null, 12], ["Date", "==", null, 6]],
|
["or", ["Date", "==", null, 12], ["Date", "==", null, 6]],
|
||||||
["CreateManyNPC", 30],
|
["CreateManyNPC", 10, 10],
|
||||||
["DeleteEvent"]
|
["DeleteEvent"]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"events":[
|
"events":[
|
||||||
[
|
[
|
||||||
["or", ["Date", "==", null, 12], ["Date", "==", null, 6]],
|
["or", ["Date", "==", null, 12], ["Date", "==", null, 6]],
|
||||||
["CreateManyNPC", 30],
|
["CreateManyNPC", 10, 10],
|
||||||
["DeleteEvent"]
|
["DeleteEvent"]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"events":[
|
"events":[
|
||||||
[
|
[
|
||||||
["or", ["Date", "==", null, 12], ["Date", "==", null, 6]],
|
["or", ["Date", "==", null, 12], ["Date", "==", null, 6]],
|
||||||
["CreateManyNPC", 30],
|
["CreateManyNPC", 10, 10],
|
||||||
["DeleteEvent"]
|
["DeleteEvent"]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
"events":[
|
"events":[
|
||||||
[
|
[
|
||||||
["or", ["Date", "==", null, 12], ["Date", "==", null, 6]],
|
["or", ["Date", "==", null, 12], ["Date", "==", null, 6]],
|
||||||
["CreateManyNPC", 30],
|
["CreateManyNPC", 10, 10],
|
||||||
["DeleteEvent"]
|
["DeleteEvent"]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
"events":[
|
"events":[
|
||||||
[
|
[
|
||||||
["Date", "==", null, 12],
|
["Date", "==", null, 12],
|
||||||
["CreateManyNPC", 30],
|
["CreateManyNPC", 10, 10],
|
||||||
["DeleteEvent"]
|
["DeleteEvent"]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"events": [
|
"events": [
|
||||||
[
|
[
|
||||||
["Date", "==", null, 12],
|
["Date", "==", null, 12],
|
||||||
["CreateManyNPC", 100],
|
["CreateManyNPC", 100, 0],
|
||||||
["DeleteEvent"]
|
["DeleteEvent"]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user