李婉的联对,周妃、毌丘俭(共八个技能)的step转async

This commit is contained in:
IceCola 2024-05-11 16:59:08 +08:00
parent 4e7cbc2776
commit 6ac598d617
2 changed files with 188 additions and 211 deletions

View File

@ -214,12 +214,9 @@ const skills = {
if (event.name == "cardsGotoSpecial") return !event.notrigger;
return true;
},
direct: true,
usable: 1,
async content(event, trigger, player) {
const {
result: { bool, targets },
} = await player.chooseTarget(get.prompt("olliangyin"), "选择一名其他角色,你与其各摸一张牌", lib.filter.notMe).set("ai", function (target) {
async cost(event, trigger, player) {
event.result = await player.chooseTarget(get.prompt("olliangyin"), "选择一名其他角色,你与其各摸一张牌", lib.filter.notMe).set("ai", function (target) {
var player = _status.event.player,
num = player.getExpansions("olkongsheng").length - 1;
var att = get.attitude(player, target);
@ -227,19 +224,18 @@ const skills = {
if (target.countCards("h") == num && target.isDamaged() && get.recoverEffect(target, player, player) > 0) return 3 * att;
return att;
});
if (bool) {
const target = targets[0];
event.target = target;
player.logSkill("olliangyin", target);
await game.asyncDraw([player, target].sortBySeat());
} else return;
},
async content(event, trigger, player) {
const { targets } = event.result;
const target = targets[0];
player.logSkill("olliangyin", target);
await game.asyncDraw([player, target].sortBySeat());
await game.asyncDelayx();
let num = player.getExpansions("olkongsheng").length;
let check = player => {
if (!player.isIn() || player.isHealthy()) return false;
return player.countCards("h") == num;
};
const { target } = event;
if (check(player) || check(target)) {
const choiceList = ["令自己回复1点体力", "令" + get.translation(target) + "回复1点体力"];
const choices = [];
@ -277,7 +273,6 @@ const skills = {
trigger: {
global: ["loseAfter", "equipAfter", "addJudgeAfter", "gainAfter", "loseAsyncAfter", "addToExpansionAfter"],
},
direct: true,
filter(event, player) {
return game.hasPlayer(function (current) {
var evt = event.getl(current);
@ -285,11 +280,9 @@ const skills = {
});
},
usable: 1,
async content(event, trigger, player) {
async cost(event, trigger, player) {
if (!player.countCards("he") || !game.hasPlayer(current => current != player && current.countCards("he") > 0)) return;
const {
result: { bool, targets, cards },
} = await player.chooseCardTarget({
event.result = await player.chooseCardTarget({
prompt: get.prompt("olliangyin"),
prompt2: "弃置一张牌,并令一名其他角色也弃置一张牌",
position: "he",
@ -331,20 +324,19 @@ const skills = {
return false;
})(),
});
if (bool) {
const target = targets[0];
event.target = target;
player.logSkill("olliangyin_gain", target);
await player.discard(cards);
await target.chooseToDiscard("he", true);
} else return;
},
async content(event, trigger, player) {
const { targets, cards } = event.result;
const target = targets[0];
player.logSkill("olliangyin_gain", target);
await player.discard(cards);
await target.chooseToDiscard("he", true);
await game.asyncDelayx();
let num = player.getExpansions("olkongsheng").length;
let check = player => {
const num = player.getExpansions("olkongsheng").length;
const check = player => {
if (!player.isIn() || player.isHealthy()) return false;
return player.countCards("h") == num;
};
const { target } = event;
if (check(player) || check(target)) {
const choiceList = ["令自己回复1点体力", "令" + get.translation(target) + "回复1点体力"];
const choices = [];
@ -360,9 +352,9 @@ const skills = {
.set("choiceList", choiceList)
.set("prompt", "良姻:是否令一名角色回复体力?")
.set("ai", function () {
var player = _status.event.player,
const player = _status.event.player,
target = _status.event.getParent().target;
var list = _status.event.controls.slice(0),
let list = _status.event.controls.slice(0),
eff1 = 0,
eff2 = 0;
if (list.includes("选项一")) eff1 = get.recoverEffect(player, player, player);
@ -381,20 +373,18 @@ const skills = {
olkongsheng: {
audio: "kongsheng",
trigger: { player: "phaseZhunbeiBegin" },
direct: true,
filter(event, player) {
return player.countCards("he") > 0;
},
content() {
"step 0";
player.chooseCard("he", [1, player.countCards("he")], get.prompt("olkongsheng"), "将任意张牌作为“箜”置于武将牌上").set("ai", function (card) {
var player = _status.event.player,
async cost(event, trigger, player) {
event.result = await player.chooseCard("he", [1, player.countCards("he")], get.prompt("olkongsheng"), "将任意张牌作为“箜”置于武将牌上").set("ai", function (card) {
const player = _status.event.player,
num = player.getExpansions("olkongsheng") + ui.selected.cards.length;
if (
ui.selected.cards.length > 0 &&
game.hasPlayer(function (current) {
if (current.isHealthy() || get.recoverEffect(current, player, player) <= 0) return false;
var num2 =
const num2 =
current.countCards("h", function (card) {
if (current != player) return true;
return !ui.selected.cards.includes(card);
@ -404,7 +394,7 @@ const skills = {
)
return 0;
if (get.type(card, null, false) == "equip") {
for (var i of ui.selected.cards) {
for (const i of ui.selected.cards) {
if (get.type(i, null, false) == "equip") return 0;
}
return 5 - get.value(card);
@ -412,14 +402,13 @@ const skills = {
if (!player.hasValueTarget(card)) return 1;
return 0;
});
"step 1";
if (result.bool) {
player.logSkill("olkongsheng");
player.addToExpansion(result.cards, player, "give").gaintag.add("olkongsheng");
}
},
async content(event, trigger, player) {
player.logSkill("olkongsheng");
player.addToExpansion(event.result.cards, player, "give").gaintag.add("olkongsheng");
},
onremove(player, skill) {
var cards = player.getExpansions(skill);
const cards = player.getExpansions(skill);
if (cards.length) player.loseToDiscardpile(cards);
},
intro: {
@ -439,42 +428,36 @@ const skills = {
}).length > 0
);
},
content() {
"step 0";
var cards = player.getExpansions("olkongsheng").filter(function (card) {
async content(event, trigger, player) {
let cards = player.getExpansions("olkongsheng").filter(function (card) {
return get.type(card, false) != "equip";
});
if (cards.length) player.gain(cards, "gain2");
"step 1";
var cards = player.getExpansions("olkongsheng");
if (cards.length > 0) {
player.chooseTarget(true, "令一名角色使用以下装备牌", get.translation(cards)).set("ai", function (target) {
var player = _status.event.player;
return get.effect(target, { name: "losehp" }, player, player);
});
} else event.finish();
"step 2";
var target = result.targets[0];
event.target = target;
player.line(target, "green");
"step 3";
var cards = player.getExpansions("olkongsheng").filter(function (i) {
return target.hasUseTarget(i);
if (cards.length) await player.gain(cards, "gain2");
cards = player.getExpansions("olkongsheng");
if (cards.length <= 0) return;
const { result } = await player.chooseTarget(true, "令一名角色使用以下装备牌", get.translation(cards)).set("ai", function (target) {
const player = _status.event.player;
return get.effect(target, { name: "losehp" }, player, player);
});
if (cards.length == 1) {
event._result = { bool: true, links: cards };
} else if (cards.length)
target.chooseButton(true, ["选择要使用的装备牌", cards]).set("ai", function (button) {
return get.order(button.link);
const target = result.targets[0];
player.line(target, "green");
while (true) {
const cards = player.getExpansions("olkongsheng").filter(function (i) {
return target.hasUseTarget(i);
});
else event.goto(5);
"step 4";
if (result.bool) {
target.chooseUseTarget(result.links[0], true);
event.goto(3);
if (cards.length) {
const card = cards[0];
if (cards.length > 1) {
const { result } = await target.chooseButton(true, ["选择要使用的装备牌", cards]).set("ai", function (button) {
return get.order(button.link);
});
if (!result.bool) break;
card = result.links[0];
}
await target.chooseUseTarget(card, true);
} else break;
}
"step 5";
target.loseHp();
await target.loseHp();
},
},
},
@ -482,7 +465,6 @@ const skills = {
//新毌丘俭
zhengrong: {
trigger: { player: "useCardToPlayered" },
direct: true,
audio: "drlt_zhenrong",
filter(event, player) {
if (!event.isFirstTarget) return false;
@ -493,9 +475,8 @@ const skills = {
});
return false;
},
content() {
"step 0";
player
async cost(event, trigger, player) {
event.result = await player
.chooseTarget(get.prompt("zhengrong"), "将一名手牌数不小于你的目标角色的一张牌置于你的武将牌上,成为「荣」", function (card, player, target) {
return _status.event.targets.includes(target) && target.countCards("h") >= player.countCards("h") && target.countCards("he") > 0;
})
@ -503,16 +484,15 @@ const skills = {
return (1 - get.attitude(_status.event.player, target)) / target.countCards("he");
})
.set("targets", trigger.targets);
"step 1";
},
async content(event, trigger, player) {
const target = result.targets[0];
player.logSkill("zhengrong", target);
const next = player.choosePlayerCard(target, "he", true);
next.ai = get.buttonValue;
const { result } = await next;
if (result.bool) {
var target = result.targets[0];
event.target = result.targets[0];
player.logSkill("zhengrong", target);
player.choosePlayerCard(target, "he", true).ai = get.buttonValue;
} else event.finish();
"step 2";
if (result.bool) {
var card = result.links[0];
const card = result.links[0];
player.addToExpansion(card, "give", "log", target).gaintag.add("zhengrong");
}
},
@ -538,44 +518,43 @@ const skills = {
filter(event, player) {
return player.getExpansions("zhengrong").length >= 3;
},
content() {
"step 0";
async content(event, trigger, player) {
player.awakenSkill("hongju");
var cards = player.getExpansions("zhengrong");
if (!cards.length || !player.countCards("h")) {
event.goto(2);
return;
const cards = player.getExpansions("zhengrong");
if (cards.length && player.countCards("h")) {
const next = player.chooseToMove("征荣:是否交换“荣”和手牌?");
next.set("list", [
[get.translation(player) + "(你)的“荣”", cards],
["手牌区", player.getCards("h")],
]);
next.set("filterMove", function (from, to) {
return typeof to != "number";
});
next.set("processAI", function (list) {
const player = _status.event.player,
cards = list[0][1].concat(list[1][1]).sort(function (a, b) {
return get.value(a) - get.value(b);
}),
cards2 = cards.splice(0, player.getExpansions("zhengrong").length);
return [cards2, cards];
});
const { result } = await next;
if (result.bool) {
const pushs = result.moved[0],
gains = result.moved[1];
pushs.removeArray(player.getExpansions("zhengrong"));
gains.removeArray(player.getCards("h"));
if (pushs.length && pushs.length == gains.length) {
const next = player.addToExpansion(pushs);
next.gaintag.add("zhengrong");
await next;
await player.gain(gains, "gain2", "log");
}
}
}
var next = player.chooseToMove("征荣:是否交换“荣”和手牌?");
next.set("list", [
[get.translation(player) + "(你)的“荣”", cards],
["手牌区", player.getCards("h")],
]);
next.set("filterMove", function (from, to) {
return typeof to != "number";
});
next.set("processAI", function (list) {
var player = _status.event.player,
cards = list[0][1].concat(list[1][1]).sort(function (a, b) {
return get.value(a) - get.value(b);
}),
cards2 = cards.splice(0, player.getExpansions("zhengrong").length);
return [cards2, cards];
});
"step 1";
if (result.bool) {
var pushs = result.moved[0],
gains = result.moved[1];
pushs.removeArray(player.getExpansions("zhengrong"));
gains.removeArray(player.getCards("h"));
if (!pushs.length || pushs.length != gains.length) return;
player.addToExpansion(pushs).gaintag.add("zhengrong");
player.gain(gains, "gain2", "log");
}
"step 2";
player.addSkills("qingce");
await player.addSkills("qingce");
game.log(player, "获得了技能", "#g【清侧】");
player.loseMaxHp();
await player.loseMaxHp();
},
ai: {
combo: "zhengrong",
@ -625,13 +604,11 @@ const skills = {
return "选择弃置一张手牌,获得" + get.translation(links[0]) + "并弃置一名角色装备区或判定区内的一张牌";
},
},
contentx() {
"step 0";
var card = lib.skill.qingce_backup.card;
player.gain(card, "gain2", "log");
"step 1";
if (target.countDiscardableCards(player, "ej") > 0) {
player.discardPlayerCard("ej", true, target);
async contentx(event, player, trigger) {
const card = lib.skill.qingce_backup.card;
await player.gain(card, "gain2", "log");
if (event.target.countDiscardableCards(player, "ej") > 0) {
await player.discardPlayerCard("ej", true, target);
}
},
ai: {
@ -666,19 +643,17 @@ const skills = {
filter(event, player) {
return event.player != player && event.player.countCards("h") > player.countCards("h");
},
direct: true,
content() {
"step 0";
player.choosePlayerCard("hej", get.prompt("drlt_zhenrong"), trigger.player).set("ai", function (button) {
async cost(event, player, trigger) {
const { result } = await player.choosePlayerCard("hej", get.prompt("drlt_zhenrong"), trigger.player).set("ai", function (button) {
return -get.attitude(player, trigger.player) + 1;
});
"step 1";
if (result && result.links && result.links.length) {
player.line(player, trigger.player);
player.logSkill("drlt_zhenrong");
player.addToExpansion(result.links, trigger.player, "give", "log").gaintag.add("drlt_zhenrong");
event.result = result;
}
},
async content(event, player, trigger) {
player.addToExpansion(event.result.cards, trigger.player, "give", "log").gaintag.add("drlt_zhenrong");
},
},
drlt_hongju: {
skillAnimation: true,
@ -694,43 +669,42 @@ const skills = {
filter(event, player) {
return player.getExpansions("drlt_zhenrong").length >= 3 && game.dead.length > 0;
},
content() {
"step 0";
async content(event, player, trigger) {
player.awakenSkill("drlt_hongju");
var cards = player.getExpansions("drlt_zhenrong");
if (!cards.length || !player.countCards("h")) {
event.goto(2);
return;
const cards = player.getExpansions("drlt_zhenrong");
if (cards.length && player.countCards("h")) {
const next = player.chooseToMove("征荣:是否交换“荣”和手牌?");
next.set("list", [
[get.translation(player) + "(你)的“荣”", cards],
["手牌区", player.getCards("h")],
]);
next.set("filterMove", function (from, to) {
return typeof to != "number";
});
next.set("processAI", function (list) {
const player = _status.event.player,
cards = list[0][1].concat(list[1][1]).sort(function (a, b) {
return get.value(a) - get.value(b);
}),
cards2 = cards.splice(0, player.getExpansions("drlt_zhenrong").length);
return [cards2, cards];
});
const { result } = await next;
if (result.bool) {
const pushs = result.moved[0],
gains = result.moved[1];
pushs.removeArray(player.getExpansions("drlt_zhenrong"));
gains.removeArray(player.getCards("h"));
if (pushs.length && pushs.length == gains.length) {
const next = player.addToExpansion(pushs);
next.gaintag.add("drlt_zhenrong");
await next;
await player.gain(gains, "gain2", "log");
}
}
}
var next = player.chooseToMove("征荣:是否交换“荣”和手牌?");
next.set("list", [
[get.translation(player) + "(你)的“荣”", cards],
["手牌区", player.getCards("h")],
]);
next.set("filterMove", function (from, to) {
return typeof to != "number";
});
next.set("processAI", function (list) {
var player = _status.event.player,
cards = list[0][1].concat(list[1][1]).sort(function (a, b) {
return get.value(a) - get.value(b);
}),
cards2 = cards.splice(0, player.getExpansions("drlt_zhenrong").length);
return [cards2, cards];
});
"step 1";
if (result.bool) {
var pushs = result.moved[0],
gains = result.moved[1];
pushs.removeArray(player.getExpansions("drlt_zhenrong"));
gains.removeArray(player.getCards("h"));
if (!pushs.length || pushs.length != gains.length) return;
player.addToExpansion(pushs).gaintag.add("drlt_zhenrong");
player.gain(gains, "gain2", "log");
}
"step 2";
player.addSkills("drlt_qingce");
player.loseMaxHp();
await player.addSkills("drlt_qingce");
await player.loseMaxHp();
},
ai: {
combo: "drlt_zhenrong",
@ -745,16 +719,14 @@ const skills = {
filterTarget(card, player, target) {
return target.countDiscardableCards(player, "ej") > 0;
},
content() {
"step 0";
player.chooseCardButton(player.getExpansions("drlt_zhenrong"), 1, "请选择需要弃置的“荣”", true).ai = function (button) {
return 6 - get.value(button.link);
};
"step 1";
async content(event, player, trigger) {
const next = player.chooseCardButton(player.getExpansions("drlt_zhenrong"), 1, "请选择需要弃置的“荣”", true);
next.ai = button => 6 - get.value(button.link);
const { result } = await next;
if (result.bool) {
var cards = result.links;
const cards = result.links;
player.loseToDiscardpile(cards);
player.discardPlayerCard(target, "ej", 1, true);
player.discardPlayerCard(event.target, "ej", 1, true);
}
},
ai: {
@ -2419,7 +2391,7 @@ const skills = {
if (cards.length) player.loseToDiscardpile(cards);
},
group: ["nzry_mingren_1", "nzry_mingren_2"],
ai:{
ai: {
combo: "nzry_zhenliang",
},
subSkill: {

View File

@ -1276,25 +1276,20 @@ const skills = {
if (event.player != player && previous == player) return true;
return false;
},
direct: true,
content: function () {
"step 0";
var history = game.getAllGlobalHistory("useCard");
var index = history.indexOf(trigger);
var previous = history[index - 1].player;
var user = trigger.player,
target = previous;
event.user = user;
event.target = target;
if (user) {
user.chooseBool("是否对" + get.translation(target) + "发动【联对】?", "令" + get.translation(target) + "摸两张牌")
.set("ai", () => _status.event.bool)
.set("bool", get.effect(target, { name: "draw" }, user, user) > 0);
}
"step 1";
async cost(event, trigger, player) {
event.result = { bool: !!trigger.player };
},
async content(event, trigger, player) {
const history = game.getAllGlobalHistory("useCard");
const index = history.indexOf(trigger);
const previous = history[index - 1].player;
const { result } = await trigger.player
.chooseBool("是否对" + get.translation(previous) + "发动【联对】?", "令" + get.translation(previous) + "摸两张牌")
.set("ai", () => _status.event.bool)
.set("bool", get.effect(previous, { name: "draw" }, trigger.player, trigger.player) > 0);
if (result.bool) {
event.user.logSkill("liandui", target);
target.draw(2);
trigger.player.logSkill("liandui", previous);
previous.draw(2);
}
},
},
@ -8379,14 +8374,20 @@ const skills = {
content: function () {
"step 0";
player.showHandcards();
const hs = player.getCards("h"), color = get.color(hs[0], player);
if (hs.length === 1 || !hs.some((card,index) => {
return index > 0 && get.color(card) !== color;
})) {
const hs = player.getCards("h"),
color = get.color(hs[0], player);
if (
hs.length === 1 ||
!hs.some((card, index) => {
return index > 0 && get.color(card) !== color;
})
) {
event.finish();
}
"step 1";
const list = [], bannedList = [], indexs = Object.keys(lib.color);
const list = [],
bannedList = [],
indexs = Object.keys(lib.color);
player.getCards("h").forEach(card => {
const color = get.color(card, player);
list.add(color);
@ -8395,15 +8396,19 @@ const skills = {
list.removeArray(bannedList);
list.sort((a, b) => indexs.indexOf(a) - indexs.indexOf(b));
if (!list.length) event.finish();
else if(list.length === 1) event._result = {control: list[0]};
else player.chooseControl(list.map(i => `${i}2`)).set("ai", function () {
var player = _status.event.player;
if (player.countCards("h", { color: "red" }) == 1 && player.countCards("h", { color: "black" }) > 1) return 1;
return 0;
}).set("prompt", "请选择弃置一种颜色的所有手牌");
else if (list.length === 1) event._result = { control: list[0] };
else
player
.chooseControl(list.map(i => `${i}2`))
.set("ai", function () {
var player = _status.event.player;
if (player.countCards("h", { color: "red" }) == 1 && player.countCards("h", { color: "black" }) > 1) return 1;
return 0;
})
.set("prompt", "请选择弃置一种颜色的所有手牌");
"step 2";
event.control = result.control.slice(0, result.control.length - 1);
var cards = player.getCards("h", {color: event.control});
var cards = player.getCards("h", { color: event.control });
player.discard(cards);
event.num = cards.length;
"step 3";
@ -8442,7 +8447,7 @@ const skills = {
return 1;
},
result: {
player:(player) => {
player: player => {
if (get.color(player.getCards("h")) != "none") return 0;
return 1;
},