fix: maybe not a bug.

This commit is contained in:
Rintim 2023-12-23 16:03:59 +08:00
parent 550e026688
commit 3b4cb81799
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
4 changed files with 17 additions and 17 deletions

View File

@ -5836,21 +5836,18 @@ export class Game extends Uninstantable {
let { step, source, player, target, targets, card, cards, skill, forced, num, _trigger: trigger, _result: result, _storeEvent } = event;
// 数组形式
if ("contents" in event && Array.isArray(event.contents)) {
event.contents[step](event, trigger, player, _storeEvent)
.then((evt) => Promise.resolve(evt))
.then((evt) => {
event._storeEvent = evt;
if (step < event.contents.length - 1 && !event.finished) return resolve();
if (game.executingAsyncEventMap.has(event.toEvent())) {
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
event.finish();
resolve();
}));
} else {
event.finish();
event.contents[step](event, trigger, player, _storeEvent).then((evt) => {
if (evt) event._storeEvent = evt;
if (game.executingAsyncEventMap.has(event.toEvent())) {
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
if (event.step >= event.contents.length - 1) event.finish();
resolve();
}
})
}));
} else {
if (event.step >= event.contents.length - 1) event.finish();
resolve();
}
})
}
else if (event.content instanceof GeneratorFunction) {
if (!event.debugging) {

View File

@ -2409,7 +2409,7 @@ export default {
/**
* @deprecated
*/
phase_old2: function () {
phase: function () {
'step 0';
//初始化阶段列表
if (!event.phaseList) {
@ -8249,6 +8249,9 @@ export default {
}, player, player.isLinked());
game.addVideo('link', player, player.isLinked());
},
/**
* @deprecated
*/
chooseToGuanxing: function () {
"step 0";
var cards = get.cards(num);

View File

@ -244,5 +244,5 @@ export default {
delete _status.currentPhase;
}, player);
}
],
]
};

View File

@ -20496,7 +20496,7 @@ export class Library extends Uninstantable {
let eventPromise = _status.event.next.find(e => e.toEvent() == event);
// 如果父级事件也是一个异步的话,那应该立即执行这个事件的
// 如果在AsyncFunction执行过程中在别的位置新建了一个异步事件那也直接等会set配置完执行
if (eventPromise && _status.event.content instanceof AsyncFunction) {
if (eventPromise && (_status.event.content instanceof AsyncFunction || Array.isArray(_status.event.contents))) {
// 异步执行game.loop
// 不直接game.loop(event)是因为需要让别人可以手动set()和setContent()
// 再执行game.loop是因为原有的game.loop被await卡住了