Util::range 추가

This commit is contained in:
2020-04-09 02:07:50 +09:00
parent 8519481f96
commit a386999567
18 changed files with 77 additions and 43 deletions
+1 -1
View File
@@ -347,7 +347,7 @@ class NPC{
]);
$this->generalID = $db->insertId();
$turnRows = [];
foreach(range(0, GameConst::$maxTurn - 1) as $turnIdx){
foreach(Util::range(GameConst::$maxTurn) as $turnIdx){
$turnRows[] = [
'general_id'=>$this->generalID,
'turn_idx'=>$turnIdx,
+4 -3
View File
@@ -2,6 +2,7 @@
namespace sammo\Scenario;
use \sammo\DB;
use \sammo\GameConst;
use \sammo\Util;
use function \sammo\getNationChiefLevel;
class Nation{
@@ -150,8 +151,8 @@ class Nation{
}
$turnRows = [];
foreach(range(getNationChiefLevel(0) - 1, getNationChiefLevel($this->nationLevel), -1) as $chiefLevel){
foreach(range(0, GameConst::$maxChiefTurn - 1) as $turnIdx){
foreach(Util::range(12, getNationChiefLevel($this->nationLevel)-1, -1) as $chiefLevel){
foreach(Util::range(GameConst::$maxChiefTurn) as $turnIdx){
$turnRows[] = [
'nation_id'=>$this->id,
'level'=>$chiefLevel,
@@ -162,7 +163,7 @@ class Nation{
];
}
}
$db->insert('nation_turn', $turnRows);
$db->insertIgnore('nation_turn', $turnRows);
}
public function getBrief(){