diff --git a/hwe/sammo/Event/Action/NoticeToHistoryLog.php b/hwe/sammo/Event/Action/NoticeToHistoryLog.php index dc37b81c..936c226a 100644 --- a/hwe/sammo/Event/Action/NoticeToHistoryLog.php +++ b/hwe/sammo/Event/Action/NoticeToHistoryLog.php @@ -7,7 +7,7 @@ use sammo\ActionLogger; class NoticeToHistoryLog extends \sammo\Event\Action { - public function __construct(private string $msg) + public function __construct(private string $msg, private int $type = ActionLogger::YEAR_MONTH) { } @@ -17,7 +17,7 @@ class NoticeToHistoryLog extends \sammo\Event\Action throw new RuntimeException('year, month가 없음'); } $logger = new ActionLogger(0, 0, $env['year'], $env['month']); - $logger->pushGlobalHistoryLog($this->msg); + $logger->pushGlobalHistoryLog($this->msg, $this->type); $logger->flush(); } } diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php index 9215eb3b..d4870ffd 100644 --- a/hwe/sammo/GameConstBase.php +++ b/hwe/sammo/GameConstBase.php @@ -399,4 +399,37 @@ class GameConstBase public static $npcBanMessageProb = 0.01; public static $npcSeizureMessageProb = 0.01; public static $npcMessageFreqByDay = 4; + + public static $defaultInitialEvents = [ + [ + true, + ["NoticeToHistoryLog", "2년간 거병 및 건국이 가능합니다.", ActionLogger::EVENT_YEAR_MONTH] + ] + ]; + public static $defaultEvents = [ + [ + "month", 2000, + ["DateRelative", "==", 1, 1], + ["NoticeToHistoryLog", "2년 뒤 출병 제한이 풀립니다.", ActionLogger::EVENT_YEAR_MONTH], + ["DeleteEvent"] + ], + [ + "month", 2000, + ["DateRelative", "==", 2, 1], + ["NoticeToHistoryLog", "1년 뒤 출병 제한이 풀립니다.", ActionLogger::EVENT_YEAR_MONTH], + ["DeleteEvent"] + ], + [ + "month", 2000, + ["DateRelative", "==", 2, 7], + ["NoticeToHistoryLog", "6개월 뒤 출병 제한이 풀립니다. 병력을 준비해주세요.", ActionLogger::EVENT_YEAR_MONTH], + ["DeleteEvent"] + ], + [ + "month", 2000, + ["DateRelative", "==", 3, 1], + ["NoticeToHistoryLog", "출병 제한이 풀렸습니다.", ActionLogger::EVENT_YEAR_MONTH], + ["DeleteEvent"] + ], + ]; } diff --git a/hwe/sammo/ResetHelper.php b/hwe/sammo/ResetHelper.php index f612f521..6d19c04b 100644 --- a/hwe/sammo/ResetHelper.php +++ b/hwe/sammo/ResetHelper.php @@ -186,6 +186,10 @@ class ResetHelper{ $seasonIdx = $clearResult['seasonIdx']; $scenarioObj = new Scenario($scenario, true); + + if(class_exists('\\sammo\GameConst', false)){ + trigger_error("이미 GameConst가 호출되어있습니다", E_USER_NOTICE); + } $scenarioObj->buildConf(); $scenarioObj->initFull(); diff --git a/hwe/sammo/Scenario.php b/hwe/sammo/Scenario.php index 48268e16..05615037 100644 --- a/hwe/sammo/Scenario.php +++ b/hwe/sammo/Scenario.php @@ -207,7 +207,7 @@ class Scenario{ $cond = $rawEvent[0]; $action = array_slice($rawEvent, 1); return new \sammo\Event\EventHandler($cond, $action); - }, Util::array_get($data['initialEvents'], [])); + }, array_merge(GameConst::$defaultInitialEvents, Util::array_get($data['initialEvents'], []))); $this->events = array_map(function($rawEvent){ //event는 여기서 풀지 않는다. 평가만 한다. @@ -230,7 +230,7 @@ class Scenario{ 'cond' => $cond, 'action' => $action ]; - }, Util::array_get($data['events'], [])); + }, array_merge(GameConst::$defaultEvents, Util::array_get($data['events'], []))); } public function getGameConf(){ @@ -546,6 +546,8 @@ class Scenario{ $this->buildDiplomacy($env); + pushGlobalHistoryLog($this->history, $env['year'], $env['month']); + foreach($this->initialEvents as $event){ $event->tryRunEvent($env); } @@ -563,10 +565,6 @@ class Scenario{ $db->insert('event', $events); } - - - pushGlobalHistoryLog($this->history, $env['year'], $env['month']); - refreshNationStaticInfo(); foreach(getAllNationStaticInfo() as $nation){ SetNationFront($nation['nation']);