fix: 진행 중 $rng 호출 관련 버그 수정
This commit is contained in:
+3
-1
@@ -1247,7 +1247,7 @@ function updateOnline()
|
|||||||
$gameStor->online_nation = join(', ', $onlineNation);
|
$gameStor->online_nation = join(', ', $onlineNation);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addAge()
|
function addAge(RandUtil $rng)
|
||||||
{
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
@@ -1268,6 +1268,7 @@ function addAge()
|
|||||||
foreach ($db->query('SELECT no,name,nation,leadership,strength,intel,aux from general where specage<=age and special=%s', GameConst::$defaultSpecialDomestic) as $general) {
|
foreach ($db->query('SELECT no,name,nation,leadership,strength,intel,aux from general where specage<=age and special=%s', GameConst::$defaultSpecialDomestic) as $general) {
|
||||||
$generalID = $general['no'];
|
$generalID = $general['no'];
|
||||||
$special = SpecialityHelper::pickSpecialDomestic(
|
$special = SpecialityHelper::pickSpecialDomestic(
|
||||||
|
$rng,
|
||||||
$general,
|
$general,
|
||||||
(Json::decode($general['aux'])['prev_types_special']) ?? []
|
(Json::decode($general['aux'])['prev_types_special']) ?? []
|
||||||
);
|
);
|
||||||
@@ -1295,6 +1296,7 @@ function addAge()
|
|||||||
$updateVars['aux'] = Json::encode($generalAux);
|
$updateVars['aux'] = Json::encode($generalAux);
|
||||||
} else {
|
} else {
|
||||||
$special2 = SpecialityHelper::pickSpecialWar(
|
$special2 = SpecialityHelper::pickSpecialWar(
|
||||||
|
$rng,
|
||||||
$general,
|
$general,
|
||||||
($generalAux['prev_types_special2']) ?? []
|
($generalAux['prev_types_special2']) ?? []
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ class TurnExecutionHelper
|
|||||||
updateQuaterly();
|
updateQuaterly();
|
||||||
disaster($monthlyRng);
|
disaster($monthlyRng);
|
||||||
tradeRate($monthlyRng);
|
tradeRate($monthlyRng);
|
||||||
addAge();
|
addAge($monthlyRng);
|
||||||
// 새해 알림
|
// 새해 알림
|
||||||
$logger->pushGlobalActionLog("<C>{$gameStor->year}</>년이 되었습니다.");
|
$logger->pushGlobalActionLog("<C>{$gameStor->year}</>년이 되었습니다.");
|
||||||
$logger->flush(); //TODO: globalAction류는 전역에서 관리하는것이 좋을 듯.
|
$logger->flush(); //TODO: globalAction류는 전역에서 관리하는것이 좋을 듯.
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ namespace sammo;
|
|||||||
|
|
||||||
class WarUnit
|
class WarUnit
|
||||||
{
|
{
|
||||||
public readonly RandUtil $rng;
|
|
||||||
|
|
||||||
protected $general;
|
protected $general;
|
||||||
protected $rawNation;
|
protected $rawNation;
|
||||||
|
|
||||||
@@ -34,7 +32,7 @@ class WarUnit
|
|||||||
protected $logActivatedSkill = [];
|
protected $logActivatedSkill = [];
|
||||||
protected $isFinished = false;
|
protected $isFinished = false;
|
||||||
|
|
||||||
private function __construct(RandUtil $rng, General $general)
|
private function __construct(public readonly RandUtil $rng, General $general)
|
||||||
{
|
{
|
||||||
$this->rng = $rng;
|
$this->rng = $rng;
|
||||||
$this->general = $general;
|
$this->general = $general;
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ class WarUnitCity extends WarUnit{
|
|||||||
|
|
||||||
protected $cityRate;
|
protected $cityRate;
|
||||||
|
|
||||||
function __construct(RandUtil $rng, $raw, $rawNation, int $year, int $month, $cityRate){
|
function __construct(public readonly RandUtil $rng, $raw, $rawNation, int $year, int $month, $cityRate){
|
||||||
$this->rng = $rng;
|
|
||||||
$general = new DummyGeneral(false);
|
$general = new DummyGeneral(false);
|
||||||
$general->setVar('city', $raw['city']);
|
$general->setVar('city', $raw['city']);
|
||||||
$general->setVar('nation', $raw['nation']);
|
$general->setVar('nation', $raw['nation']);
|
||||||
|
|||||||
@@ -10,9 +10,8 @@ class WarUnitGeneral extends WarUnit
|
|||||||
protected $killedPerson = 0;
|
protected $killedPerson = 0;
|
||||||
protected $deadPerson = 0;
|
protected $deadPerson = 0;
|
||||||
|
|
||||||
function __construct(RandUtil $rng, General $general, array $rawNation, bool $isAttacker)
|
function __construct(public readonly RandUtil $rng, General $general, array $rawNation, bool $isAttacker)
|
||||||
{
|
{
|
||||||
$this->rng = $rng;
|
|
||||||
$this->general = $general;
|
$this->general = $general;
|
||||||
$this->raw = $general->getRaw();
|
$this->raw = $general->getRaw();
|
||||||
$this->rawNation = $rawNation; //read-only
|
$this->rawNation = $rawNation; //read-only
|
||||||
|
|||||||
Reference in New Issue
Block a user