game.check增加报错信息

This commit is contained in:
kuangshen04 2024-01-21 23:45:59 +08:00
parent 1d7a459672
commit 4690e51b32
1 changed files with 7 additions and 7 deletions

View File

@ -5737,7 +5737,7 @@ export class Game extends Uninstantable {
* @param { GameEventPromise } [event] * @param { GameEventPromise } [event]
*/ */
static check(event) { static check(event) {
let i, j, range; let i, range;
if (event == undefined) event = _status.event; if (event == undefined) event = _status.event;
event._checked = true; event._checked = true;
let custom = event.custom || {}; let custom = event.custom || {};
@ -5986,10 +5986,9 @@ export class Game extends Uninstantable {
} }
} }
if (!event.skill && get.noSelected() && !_status.noconfirm) { if (!event.skill && get.noSelected() && !_status.noconfirm) {
let skills = [], enable, info; const skills = [];
let skills2;
if (event._skillChoice) { if (event._skillChoice) {
skills2 = event._skillChoice; let skills2 = event._skillChoice;
for (let i = 0; i < skills2.length; i++) { for (let i = 0; i < skills2.length; i++) {
if (event.isMine() || !event._aiexclude.includes(skills2[i])) { if (event.isMine() || !event._aiexclude.includes(skills2[i])) {
skills.push(skills2[i]); skills.push(skills2[i]);
@ -6007,9 +6006,10 @@ export class Game extends Uninstantable {
skills2 = game.filterSkills(skills2.concat(lib.skill.global), player, player.getSkills('e').concat(lib.skill.global)); skills2 = game.filterSkills(skills2.concat(lib.skill.global), player, player.getSkills('e').concat(lib.skill.global));
event._skillChoice = []; event._skillChoice = [];
game.expandSkills(skills2); game.expandSkills(skills2);
for (i = 0; i < skills2.length; i++) { for (let i = 0; i < skills2.length; i++) {
info = get.info(skills2[i]); const info = get.info(skills2[i]);
enable = false; if (!info) throw new ReferenceError(`Cannot find ${skills2[i]} in lib.skill`);
let enable = false;
if (typeof info.enable == 'function') enable = info.enable(event); if (typeof info.enable == 'function') enable = info.enable(event);
else if (Array.isArray(info.enable)) enable = info.enable.includes(event.name); else if (Array.isArray(info.enable)) enable = info.enable.includes(event.name);
else if (info.enable == 'phaseUse') enable = (event.type == 'phase'); else if (info.enable == 'phaseUse') enable = (event.type == 'phase');