game.asyncDraw改为async函数,修改周妃的良姻技能作为测试
This commit is contained in:
parent
80a0b2df63
commit
a2d78f873b
|
@ -458,9 +458,8 @@ game.import("character", function () {
|
||||||
},
|
},
|
||||||
direct: true,
|
direct: true,
|
||||||
usable: 1,
|
usable: 1,
|
||||||
content() {
|
async content(event, trigger, player) {
|
||||||
"step 0";
|
const { result: { bool, targets } } = await player
|
||||||
player
|
|
||||||
.chooseTarget(
|
.chooseTarget(
|
||||||
get.prompt("olliangyin"),
|
get.prompt("olliangyin"),
|
||||||
"选择一名其他角色,你与其各摸一张牌",
|
"选择一名其他角色,你与其各摸一张牌",
|
||||||
|
@ -479,32 +478,32 @@ game.import("character", function () {
|
||||||
return 3 * att;
|
return 3 * att;
|
||||||
return att;
|
return att;
|
||||||
});
|
});
|
||||||
"step 1";
|
if (bool) {
|
||||||
if (result.bool) {
|
const target = targets[0];
|
||||||
var target = result.targets[0];
|
|
||||||
event.target = target;
|
event.target = target;
|
||||||
player.logSkill("olliangyin", target);
|
player.logSkill("olliangyin", target);
|
||||||
game.asyncDraw([player, target].sortBySeat());
|
await game.asyncDraw([player, target].sortBySeat());
|
||||||
} else event.finish();
|
}
|
||||||
"step 2";
|
else return;
|
||||||
game.delayx();
|
await game.asyncDelayx();
|
||||||
var num = player.getExpansions("olkongsheng").length;
|
let num = player.getExpansions("olkongsheng").length;
|
||||||
var check = function (player) {
|
let check = player => {
|
||||||
if (!player.isIn() || player.isHealthy()) return false;
|
if (!player.isIn() || player.isHealthy()) return false;
|
||||||
return player.countCards("h") == num;
|
return player.countCards("h") == num;
|
||||||
};
|
};
|
||||||
|
const { target } = event;
|
||||||
if (check(player) || check(target)) {
|
if (check(player) || check(target)) {
|
||||||
var choiceList = [
|
const choiceList = [
|
||||||
"令自己回复1点体力",
|
"令自己回复1点体力",
|
||||||
"令" + get.translation(target) + "回复1点体力",
|
"令" + get.translation(target) + "回复1点体力",
|
||||||
];
|
];
|
||||||
var choices = [];
|
const choices = [];
|
||||||
if (check(player)) choices.push("选项一");
|
if (check(player)) choices.push("选项一");
|
||||||
else choiceList[0] = '<span style="opacity:0.5">' + choiceList[0] + "</span>";
|
else choiceList[0] = '<span style="opacity:0.5">' + choiceList[0] + "</span>";
|
||||||
if (check(target)) choices.push("选项二");
|
if (check(target)) choices.push("选项二");
|
||||||
else choiceList[1] = '<span style="opacity:0.5">' + choiceList[1] + "</span>";
|
else choiceList[1] = '<span style="opacity:0.5">' + choiceList[1] + "</span>";
|
||||||
choices.push("cancel2");
|
choices.push("cancel2");
|
||||||
player
|
const { result : { control } } = await player
|
||||||
.chooseControl(choices)
|
.chooseControl(choices)
|
||||||
.set("choiceList", choiceList)
|
.set("choiceList", choiceList)
|
||||||
.set("prompt", "良姻:是否令一名角色回复体力?")
|
.set("prompt", "良姻:是否令一名角色回复体力?")
|
||||||
|
@ -520,10 +519,9 @@ game.import("character", function () {
|
||||||
if (eff2 > 0) return "选项二";
|
if (eff2 > 0) return "选项二";
|
||||||
return "cancel2";
|
return "cancel2";
|
||||||
});
|
});
|
||||||
} else event.finish();
|
if (control == "选项一") await player.recover();
|
||||||
"step 3";
|
else if (control == "选项二") await target.recover();
|
||||||
if (result.control == "选项一") player.recover();
|
}
|
||||||
else if (result.control == "选项二") target.recover();
|
|
||||||
},
|
},
|
||||||
group: "olliangyin_gain",
|
group: "olliangyin_gain",
|
||||||
subSkill: {
|
subSkill: {
|
||||||
|
@ -547,17 +545,13 @@ game.import("character", function () {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
usable: 1,
|
usable: 1,
|
||||||
content() {
|
async content(event, trigger, player) {
|
||||||
"step 0";
|
|
||||||
if (
|
if (
|
||||||
!player.countCards("he") ||
|
!player.countCards("he") ||
|
||||||
!game.hasPlayer(function (current) {
|
!game.hasPlayer(current => current != player &&
|
||||||
return current != player && current.countCards("he") > 0;
|
current.countCards("he") > 0)
|
||||||
})
|
) return;
|
||||||
)
|
const { result: { bool, targets, cards } } = await player.chooseCardTarget({
|
||||||
event.finish();
|
|
||||||
else
|
|
||||||
player.chooseCardTarget({
|
|
||||||
prompt: get.prompt("olliangyin"),
|
prompt: get.prompt("olliangyin"),
|
||||||
prompt2: "弃置一张牌,并令一名其他角色也弃置一张牌",
|
prompt2: "弃置一张牌,并令一名其他角色也弃置一张牌",
|
||||||
position: "he",
|
position: "he",
|
||||||
|
@ -588,7 +582,7 @@ game.import("character", function () {
|
||||||
return att;
|
return att;
|
||||||
return -att;
|
return -att;
|
||||||
},
|
},
|
||||||
me: (function () {
|
me: (() => {
|
||||||
if (
|
if (
|
||||||
player.isHealthy() ||
|
player.isHealthy() ||
|
||||||
get.recoverEffect(player, player, _status.event.player) <= 0
|
get.recoverEffect(player, player, _status.event.player) <= 0
|
||||||
|
@ -604,33 +598,33 @@ game.import("character", function () {
|
||||||
return false;
|
return false;
|
||||||
})(),
|
})(),
|
||||||
});
|
});
|
||||||
"step 1";
|
if (bool) {
|
||||||
if (result.bool) {
|
const target = targets[0];
|
||||||
var target = result.targets[0];
|
|
||||||
event.target = target;
|
event.target = target;
|
||||||
player.logSkill("olliangyin_gain", target);
|
player.logSkill("olliangyin_gain", target);
|
||||||
player.discard(result.cards);
|
await player.discard(cards);
|
||||||
target.chooseToDiscard("he", true);
|
await target.chooseToDiscard("he", true);
|
||||||
} else event.finish();
|
}
|
||||||
"step 2";
|
else return;
|
||||||
game.delayx();
|
await game.asyncDelayx();
|
||||||
var num = player.getExpansions("olkongsheng").length;
|
let num = player.getExpansions("olkongsheng").length;
|
||||||
var check = function (player) {
|
let check = player => {
|
||||||
if (!player.isIn() || player.isHealthy()) return false;
|
if (!player.isIn() || player.isHealthy()) return false;
|
||||||
return player.countCards("h") == num;
|
return player.countCards("h") == num;
|
||||||
};
|
};
|
||||||
|
const { target } = event;
|
||||||
if (check(player) || check(target)) {
|
if (check(player) || check(target)) {
|
||||||
var choiceList = [
|
const choiceList = [
|
||||||
"令自己回复1点体力",
|
"令自己回复1点体力",
|
||||||
"令" + get.translation(target) + "回复1点体力",
|
"令" + get.translation(target) + "回复1点体力",
|
||||||
];
|
];
|
||||||
var choices = [];
|
const choices = [];
|
||||||
if (check(player)) choices.push("选项一");
|
if (check(player)) choices.push("选项一");
|
||||||
else choiceList[0] = '<span style="opacity:0.5">' + choiceList[0] + "</span>";
|
else choiceList[0] = '<span style="opacity:0.5">' + choiceList[0] + "</span>";
|
||||||
if (check(target)) choices.push("选项二");
|
if (check(target)) choices.push("选项二");
|
||||||
else choiceList[1] = '<span style="opacity:0.5">' + choiceList[1] + "</span>";
|
else choiceList[1] = '<span style="opacity:0.5">' + choiceList[1] + "</span>";
|
||||||
choices.push("cancel2");
|
choices.push("cancel2");
|
||||||
player
|
const { result: { control } } = await player
|
||||||
.chooseControl(choices)
|
.chooseControl(choices)
|
||||||
.set("choiceList", choiceList)
|
.set("choiceList", choiceList)
|
||||||
.set("prompt", "良姻:是否令一名角色回复体力?")
|
.set("prompt", "良姻:是否令一名角色回复体力?")
|
||||||
|
@ -648,10 +642,9 @@ game.import("character", function () {
|
||||||
if (eff2 > 0) return "选项二";
|
if (eff2 > 0) return "选项二";
|
||||||
return "cancel2";
|
return "cancel2";
|
||||||
});
|
});
|
||||||
} else event.finish();
|
if (control == "选项一") await player.recover();
|
||||||
"step 3";
|
else if (control == "选项二") await target.recover();
|
||||||
if (result.control == "选项一") player.recover();
|
}
|
||||||
else if (result.control == "选项二") target.recover();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -7491,16 +7491,17 @@ export class Game {
|
||||||
* @param { { drawDeck: boolean } } [drawDeck]
|
* @param { { drawDeck: boolean } } [drawDeck]
|
||||||
* @param { boolean } [bottom]
|
* @param { boolean } [bottom]
|
||||||
*/
|
*/
|
||||||
asyncDraw(players, num, drawDeck, bottom) {
|
async asyncDraw(players, num, drawDeck, bottom) {
|
||||||
return players.forEach((value, index) => {
|
for (let index = 0; index < players.length; index++) {
|
||||||
|
const value = players[index];
|
||||||
let num2 = 1;
|
let num2 = 1;
|
||||||
if (typeof num == "number") num2 = num;
|
if (typeof num == "number") num2 = num;
|
||||||
else if (Array.isArray(num)) num2 = num[index];
|
else if (Array.isArray(num)) num2 = num[index];
|
||||||
else if (typeof num == "function") num2 = num(value);
|
else if (typeof num == "function") num2 = num(value);
|
||||||
if (drawDeck && drawDeck.drawDeck) value.draw(num2, false, drawDeck);
|
if (drawDeck && drawDeck.drawDeck) await value.draw(num2, false, drawDeck);
|
||||||
else if (bottom) value.draw(num2, "nodelay", "bottom");
|
else if (bottom) await value.draw(num2, "nodelay", "bottom");
|
||||||
else value.draw(num2, "nodelay");
|
else await value.draw(num2, "nodelay");
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param { Player[] } players
|
* @param { Player[] } players
|
||||||
|
|
Loading…
Reference in New Issue