Merge pull request #1434 from IceCola97/PR-Branch

step转async(shenhua/skill.js全部);萌喵的bug修复;choose/discard/gainPlayerCard…
This commit is contained in:
Spmario233 2024-06-03 23:09:18 +08:00 committed by GitHub
commit d27e3696b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 915 additions and 1040 deletions

File diff suppressed because it is too large Load Diff

View File

@ -182,6 +182,10 @@ const skills = {
}, },
}, },
}, },
ai: {
order: 1,
result: { player: 1 },
},
}, },
//蔡瑁 //蔡瑁
olzuolian: { olzuolian: {

View File

@ -22,7 +22,8 @@ const skills = {
.set("prompt", "辞虑:选择执行并移去一项") .set("prompt", "辞虑:选择执行并移去一项")
.set("ai", () => { .set("ai", () => {
const player = get.event("player"), const player = get.event("player"),
trigger = get.event().getTrigger(); trigger = get.event().getTrigger(),
card = trigger.card;
let controls = get.event("controls").slice(); let controls = get.event("controls").slice();
if (controls.includes("防伤")) { if (controls.includes("防伤")) {
if (get.tag(card, "damage")) return "防伤"; if (get.tag(card, "damage")) return "防伤";

View File

@ -5888,6 +5888,7 @@ export const Content = {
} else if (!event.dialog.noforcebutton) { } else if (!event.dialog.noforcebutton) {
event.dialog.classList.add("forcebutton-auto"); event.dialog.classList.add("forcebutton-auto");
} }
directh = false;
} else { } else {
event.dialog.add([hs, "blank"]); event.dialog.add([hs, "blank"]);
} }
@ -6082,6 +6083,7 @@ export const Content = {
} else if (!event.dialog.noforcebutton) { } else if (!event.dialog.noforcebutton) {
event.dialog.classList.add("forcebutton-auto"); event.dialog.classList.add("forcebutton-auto");
} }
directh = false;
} else { } else {
event.dialog.add([hs, "blank"]); event.dialog.add([hs, "blank"]);
} }
@ -6299,6 +6301,7 @@ export const Content = {
} else if (!event.dialog.noforcebutton) { } else if (!event.dialog.noforcebutton) {
event.dialog.classList.add("forcebutton-auto"); event.dialog.classList.add("forcebutton-auto");
} }
directh = false;
} else { } else {
event.dialog.add([hs, "blank"]); event.dialog.add([hs, "blank"]);
} }

View File

@ -7074,7 +7074,7 @@ export class Player extends HTMLDivElement {
node = ui.create.div(".card.mark.drawinghidden"); node = ui.create.div(".card.mark.drawinghidden");
ui.create.div(".background.skillmark", node).innerHTML = get.translation(name)[0]; ui.create.div(".background.skillmark", node).innerHTML = get.translation(name)[0];
} else { } else {
if (!lib.character[name]) return; if (!get.character(name)) return;
node = ui.create.div(".card.mark.drawinghidden").setBackground(name, "character"); node = ui.create.div(".card.mark.drawinghidden").setBackground(name, "character");
} }
this.node.marks.insertBefore(node, this.node.marks.childNodes[1]); this.node.marks.insertBefore(node, this.node.marks.childNodes[1]);

View File

@ -11999,6 +11999,7 @@ export class Library {
}, },
}, },
}; };
/** @type {Object<string, import("./element/character.js").Character>} */
character = new Proxy( character = new Proxy(
{}, {},
{ {
@ -12040,8 +12041,8 @@ export class Library {
lib.node.observing.push(this); lib.node.observing.push(this);
this.send("reinit", lib.configOL, get.arenaState(), game.getState ? game.getState() : {}, game.ip, game.players[0].playerid, null, _status.cardtag); this.send("reinit", lib.configOL, get.arenaState(), game.getState ? game.getState() : {}, game.ip, game.players[0].playerid, null, _status.cardtag);
// 没有系统提示的接口喵? // 没有系统提示的接口喵?
game.log("玩家 ", `#y${config.nickname}`, " 进入房间观战"); game.log("玩家 ", `#y${get.plainText(config.nickname)}`, " 进入房间观战");
game.me.chat(`玩家 <span style="font-weight: bold; color: rgb(126, 180, 255)">${config.nickname}</span> 进入房间观战`); game.me.chat(`玩家 <span style="font-weight: bold; color: rgb(126, 180, 255)">${get.plainText(config.nickname)}</span> 进入房间观战`);
if (!ui.removeObserve) { if (!ui.removeObserve) {
ui.removeObserve = ui.create.system( ui.removeObserve = ui.create.system(
"移除旁观", "移除旁观",

View File

@ -3653,24 +3653,25 @@ class Sandbox {
return Marshal[SandboxExposer2] return Marshal[SandboxExposer2]
(SandboxSignal_Marshal, result, prevDomain); (SandboxSignal_Marshal, result, prevDomain);
// } catch (e) { // } catch (e) {
// // 立即报告错误 // // 立即报告错误
// const window = Domain.topDomain[SandboxExposer](SandboxSignal_GetWindow); // const window = Domain.topDomain[SandboxExposer](SandboxSignal_GetWindow);
// // @ts-ignore // // @ts-ignore
// const line = String(e.stack).split("\n")[1]; // const stack = String(e.stack);
// const match = /<anonymous>:(\d+):\d+\)/.exec(line); // const line = stack.split("\n")[1];
// if (match) { // const match = /<anonymous>:(\d+):\d+\)/.exec(line);
// const index = parseInt(match[1]) - 5; // if (match) {
// const lines = code.split("\n"); // const index = parseInt(match[1]) - 5;
// let codeView = ""; // const lines = code.split("\n");
// for (let i = index - 4; i < index + 5; i++) { // let codeView = "";
// if (i < 0 || i >= lines.length) // for (let i = index - 4; i < index + 5; i++) {
// continue; // if (i < 0 || i >= lines.length)
// codeView += `${i + 1}|${i == index ? "⚠️" : " "}${lines[i]}\n`; // continue;
// } // codeView += `${i + 1}|${i == index ? "⚠️" : " "}${lines[i]}\n`;
// // @ts-ignore
// window.alert(`沙盒内出现错误:\n----------\n${codeView}\n----------\n${String(e.stack)}`);
// } // }
// throw e; // // @ts-ignore
// window.alert(`Sandbox内执行的代码出现错误\n${stack}\n----------\n${codeView}\n----------`);
// }
// throw e; // 不再向上抛出异常
} finally { } finally {
Sandbox.#executingScope.pop(); Sandbox.#executingScope.pop();
} }