feat: 도시 점령, 국가 멸망 시 트리거 추가
This commit is contained in:
@@ -7,13 +7,17 @@ use \sammo\{
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
LastTurn,
|
||||
Command
|
||||
Command,
|
||||
Json,
|
||||
KVStorage
|
||||
};
|
||||
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
use sammo\Event\EventHandler;
|
||||
|
||||
use function sammo\refreshNationStaticInfo;
|
||||
use function sammo\deleteNation;
|
||||
use function sammo\tryRollbackInheritUniqueItem;
|
||||
@@ -98,6 +102,26 @@ class che_해산 extends Command\GeneralCommand{
|
||||
tryRollbackInheritUniqueItem($general);
|
||||
$general->applyDB($db);
|
||||
|
||||
// 이벤트 핸들러 동작
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$e_env = null;
|
||||
foreach (DB::db()->query('SELECT * FROM event WHERE target = "DESTROY_NATION" ORDER BY `priority` DESC, `id` ASC') as $rawEvent) {
|
||||
if ($e_env === null) {
|
||||
$e_env = $gameStor->getAll(false);
|
||||
}
|
||||
$eventID = $rawEvent['id'];
|
||||
$cond = Json::decode($rawEvent['condition']);
|
||||
$action = Json::decode($rawEvent['action']);
|
||||
$event = new EventHandler($cond, $action);
|
||||
$e_env['currentEventID'] = $eventID;
|
||||
|
||||
$event->tryRunEvent($e_env);
|
||||
}
|
||||
|
||||
if ($e_env !== null) {
|
||||
$gameStor->resetCache();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -398,7 +398,7 @@ class TurnExecutionHelper
|
||||
|
||||
// 1달마다 처리하는 것들, 벌점 감소 및 건국,전턴,합병 -1, 군량 소모
|
||||
if (!preUpdateMonthly()) {
|
||||
$gameStor->resetCache(true);
|
||||
$gameStor->resetCache();
|
||||
unlock();
|
||||
throw new \RuntimeException('preUpdateMonthly() 처리 에러');
|
||||
}
|
||||
@@ -435,7 +435,7 @@ class TurnExecutionHelper
|
||||
|
||||
// 이벤트 핸들러 동작
|
||||
$e_env = null;
|
||||
foreach (DB::db()->query('SELECT * from event') as $rawEvent) {
|
||||
foreach (DB::db()->query('SELECT * FROM event WHERE target = "MONTH" ORDER BY `priority` DESC, `id` ASC') as $rawEvent) {
|
||||
if ($e_env === null) {
|
||||
$e_env = $gameStor->getAll(false);
|
||||
}
|
||||
@@ -449,7 +449,7 @@ class TurnExecutionHelper
|
||||
}
|
||||
|
||||
if ($e_env !== null) {
|
||||
$gameStor->resetCache(true);
|
||||
$gameStor->resetCache();
|
||||
}
|
||||
|
||||
postUpdateMonthly();
|
||||
@@ -480,7 +480,7 @@ class TurnExecutionHelper
|
||||
//거래 처리
|
||||
processAuction();
|
||||
// 잡금 해제
|
||||
$gameStor->resetCache(true);
|
||||
$gameStor->resetCache();
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user