Merge pull request #1352 from IceCola97/PR-Branch

step转async:新袁术、张绣、旧陈到、严颜、王平、陆绩;修复自由选将搜索输入框的Bug
This commit is contained in:
Spmario233 2024-05-15 08:33:24 +08:00 committed by GitHub
commit 885511f8c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 235 additions and 244 deletions

View File

@ -81,7 +81,7 @@ const skills = {
if (result.targets.length > 0) result.card = get.autoViewAs({ name: "tiesuo" }, result.cards); if (result.targets.length > 0) result.card = get.autoViewAs({ name: "tiesuo" }, result.cards);
}, },
async content(event, trigger, player) { async content(event, trigger, player) {
player.recast(event.cards); await player.recast(event.cards);
}, },
}, },
//新杀小加强 陈到 //新杀小加强 陈到
@ -230,7 +230,6 @@ const skills = {
}, },
async content(event, trigger, player) { async content(event, trigger, player) {
const target = event.targets[0]; const target = event.targets[0];
player.logSkill("olliangyin", target);
await game.asyncDraw([player, target].sortBySeat()); await game.asyncDraw([player, target].sortBySeat());
await game.asyncDelayx(); await game.asyncDelayx();
let num = player.getExpansions("olkongsheng").length; let num = player.getExpansions("olkongsheng").length;
@ -331,7 +330,6 @@ const skills = {
}, },
async content(event, trigger, player) { async content(event, trigger, player) {
const target = event.targets[0]; const target = event.targets[0];
player.logSkill("olliangyin_gain", target);
await player.discard(event.cards); await player.discard(event.cards);
await target.chooseToDiscard("he", true); await target.chooseToDiscard("he", true);
await game.asyncDelayx(); await game.asyncDelayx();
@ -410,7 +408,9 @@ const skills = {
.forResult(); .forResult();
}, },
async content(event, trigger, player) { async content(event, trigger, player) {
player.addToExpansion(event.cards, player, "give").gaintag.add("olkongsheng"); const next = player.addToExpansion(event.cards, player, "give");
next.gaintag.add("olkongsheng");
await next;
}, },
onremove(player, skill) { onremove(player, skill) {
const cards = player.getExpansions(skill); const cards = player.getExpansions(skill);
@ -498,7 +498,9 @@ const skills = {
const { result } = await next; const { result } = await next;
if (result.bool) { if (result.bool) {
const card = result.links[0]; const card = result.links[0];
player.addToExpansion(card, "give", "log", target).gaintag.add("zhengrong"); const next = player.addToExpansion(card, "give", "log", target);
next.gaintag.add("zhengrong");
await next;
} }
}, },
onremove(player, skill) { onremove(player, skill) {
@ -657,7 +659,9 @@ const skills = {
} }
}, },
async content(event, trigger, player) { async content(event, trigger, player) {
player.addToExpansion(event.cards, trigger.player, "give", "log").gaintag.add("drlt_zhenrong"); const next = player.addToExpansion(event.cards, trigger.player, "give", "log");
next.gaintag.add("drlt_zhenrong");
await next;
}, },
}, },
drlt_hongju: { drlt_hongju: {
@ -730,8 +734,8 @@ const skills = {
const { result } = await next; const { result } = await next;
if (result.bool) { if (result.bool) {
const cards = result.links; const cards = result.links;
player.loseToDiscardpile(cards); await player.loseToDiscardpile(cards);
player.discardPlayerCard(event.target, "ej", 1, true); await player.discardPlayerCard(event.target, "ej", 1, true);
} }
}, },
ai: { ai: {
@ -1012,25 +1016,28 @@ const skills = {
return player.hasEnabledSlot(1) || player.hasEnabledSlot(2) || player.hasEnabledSlot(5) || player.hasEnabledSlot("horse"); return player.hasEnabledSlot(1) || player.hasEnabledSlot(2) || player.hasEnabledSlot(5) || player.hasEnabledSlot("horse");
}, },
async content(event, trigger, player) { async content(event, trigger, player) {
const { control } = await player.chooseToDisable(true).set("ai", function (event, player, list) { const { control } = await player
if (list.includes("equip2")) return "equip2"; .chooseToDisable(true)
if ( .set("ai", function (event, player, list) {
list.includes("equip1") && if (list.includes("equip2")) return "equip2";
player.countCards("h", function (card) { if (
return get.name(card, player) == "sha" && player.hasUseTarget(card); list.includes("equip1") &&
}) - player.countCards("h", function (card) {
player.getCardUsable("sha") > return get.name(card, player) == "sha" && player.hasUseTarget(card);
1 }) -
) player.getCardUsable("sha") >
return "equip1"; 1
if ( )
list.includes("equip5") && return "equip1";
player.countCards("h", function (card) { if (
return get.type2(card, player) == "trick" && player.hasUseTarget(card); list.includes("equip5") &&
}) > 1 player.countCards("h", function (card) {
) return get.type2(card, player) == "trick" && player.hasUseTarget(card);
return "equip5"; }) > 1
}).forResult(); )
return "equip5";
})
.forResult();
switch (control) { switch (control) {
case "equip1": case "equip1":
player.addTempSkill("drlt_jueyan1"); player.addTempSkill("drlt_jueyan1");
@ -1122,8 +1129,8 @@ const skills = {
player.awakenSkill("drlt_poshi"); player.awakenSkill("drlt_poshi");
await player.loseMaxHp(); await player.loseMaxHp();
const num = player.maxHp - player.countCards("h"); const num = player.maxHp - player.countCards("h");
if (num > 0) player.draw(num); if (num > 0) await player.draw(num);
player.changeSkills(["drlt_huairou"], ["drlt_jueyan"]); await player.changeSkills(["drlt_huairou"], ["drlt_jueyan"]);
}, },
}, },
drlt_huairou: { drlt_huairou: {
@ -1137,7 +1144,7 @@ const skills = {
return 3 - get.value(card); return 3 - get.value(card);
}, },
async content(event, trigger, player) { async content(event, trigger, player) {
player.recast(event.cards); await player.recast(event.cards);
}, },
discard: false, discard: false,
lose: false, lose: false,
@ -1164,7 +1171,7 @@ const skills = {
filter(event, player) { filter(event, player) {
return !event.numFixed; return !event.numFixed;
}, },
content() { async content(event, trigger, player) {
trigger.num = game.countGroup(); trigger.num = game.countGroup();
}, },
}, },
@ -1175,20 +1182,20 @@ const skills = {
}, },
forced: true, forced: true,
filter(event, player) { filter(event, player) {
var num = 0; let num = 0;
player.getHistory("sourceDamage", function (evt) { player.getHistory("sourceDamage", function (evt) {
if (evt.getParent("phaseUse") == event) num += evt.num; if (evt.getParent("phaseUse") == event) num += evt.num;
}); });
return !num || num > 1; return !num || num > 1;
}, },
content() { async content(event, trigger, player) {
var numx = 0; let numx = 0;
player.getHistory("sourceDamage", function (evt) { player.getHistory("sourceDamage", function (evt) {
if (evt.getParent("phaseUse") == trigger) numx += evt.num; if (evt.getParent("phaseUse") == trigger) numx += evt.num;
}); });
if (!numx) { if (!numx) {
var num = player.hp - player.countCards("h"); const num = player.hp - player.countCards("h");
if (num > 0) player.draw(num); if (num > 0) await player.draw(num);
} else { } else {
player.addTempSkill("drlt_yongsi1", { player: "phaseDiscardAfter" }); player.addTempSkill("drlt_yongsi1", { player: "phaseDiscardAfter" });
} }
@ -1211,7 +1218,6 @@ const skills = {
trigger: { trigger: {
player: "phaseDiscardBegin", player: "phaseDiscardBegin",
}, },
direct: true,
filter(event, player) { filter(event, player) {
if (!player.hasZhuSkill("drlt_weidi")) return false; if (!player.hasZhuSkill("drlt_weidi")) return false;
return ( return (
@ -1221,16 +1227,16 @@ const skills = {
}) > 0 }) > 0
); );
}, },
content() { async cost(event, trigger, player) {
"step 0"; const num = Math.min(
var num = Math.min(
player.needsToDiscard(), player.needsToDiscard(),
game.countPlayer(function (target) { game.countPlayer(function (target) {
return target != player && target.group == "qun"; return target != player && target.group == "qun";
}) })
); );
if (num) { if (!num) return;
player.chooseCardTarget({ event.result = await player
.chooseCardTarget({
prompt: get.prompt("drlt_weidi"), prompt: get.prompt("drlt_weidi"),
prompt2: "你可以将" + (num > 1 ? "至多" : "") + get.cnNumber(num) + "张手牌交给等量的其他群势力角色。先按顺序选中所有要给出的手牌,然后再按顺序选择等量的目标角色", prompt2: "你可以将" + (num > 1 ? "至多" : "") + get.cnNumber(num) + "张手牌交给等量的其他群势力角色。先按顺序选中所有要给出的手牌,然后再按顺序选择等量的目标角色",
selectCard: [1, num], selectCard: [1, num],
@ -1245,8 +1251,8 @@ const skills = {
return ui.selected.cards.length == ui.selected.targets.length; return ui.selected.cards.length == ui.selected.targets.length;
}, },
ai1(card) { ai1(card) {
var player = _status.event.player; const player = _status.event.player;
var value = get.value(card, player, "raw"); const value = get.value(card, player, "raw");
if ( if (
game.hasPlayer(function (target) { game.hasPlayer(function (target) {
return target != player && target.group == "qun" && !ui.selected.targets.includes(target) && get.sgn(value) == get.sgn(get.attitude(player, target)); return target != player && target.group == "qun" && !ui.selected.targets.includes(target) && get.sgn(value) == get.sgn(get.attitude(player, target));
@ -1256,30 +1262,31 @@ const skills = {
return -1; return -1;
}, },
ai2(target) { ai2(target) {
var player = _status.event.player; const player = _status.event.player;
var card = ui.selected.cards[ui.selected.targets.length]; const card = ui.selected.cards[ui.selected.targets.length];
if (card && get.value(card, player, "raw") < 0) return -get.attitude(player, target); if (card && get.value(card, player, "raw") < 0) return -get.attitude(player, target);
return get.attitude(player, target); return get.attitude(player, target);
}, },
}); })
} else event.finish(); .forResult();
"step 1"; if (event.result.bool) event.result.bool = event.result.cards.length > 0;
if (result.bool && result.cards.length > 0) { },
var list = []; async content(event, trigger, player) {
for (var i = 0; i < result.targets.length; i++) { const list = [];
var target = result.targets[i]; for (let i = 0; i < event.targets.length; i++) {
var card = result.cards[i]; const target = event.targets[i];
list.push([target, card]); const card = event.cards[i];
} list.push([target, card]);
player.logSkill("drlt_weidi", result.targets); }
game.loseAsync({ await game
.loseAsync({
gain_list: list, gain_list: list,
player: player, player: player,
cards: result.cards, cards: event.cards,
giver: player, giver: player,
animate: "giveAuto", animate: "giveAuto",
}).setContent("gaincardMultiple"); })
} else event.finish(); .setContent("gaincardMultiple");
}, },
}, },
drlt_xiongluan: { drlt_xiongluan: {
@ -1296,20 +1303,20 @@ const skills = {
filterTarget(card, player, target) { filterTarget(card, player, target) {
return target != player; return target != player;
}, },
content() { async content(event, trigger, player) {
player.awakenSkill("drlt_xiongluan"); player.awakenSkill("drlt_xiongluan");
var disables = []; const disables = [];
for (var i = 1; i <= 5; i++) { for (let i = 1; i <= 5; i++) {
for (var j = 0; j < player.countEnabledSlot(i); j++) { for (let j = 0; j < player.countEnabledSlot(i); j++) {
disables.push(i); disables.push(i);
} }
} }
if (disables.length > 0) player.disableEquip(disables); if (disables.length > 0) await player.disableEquip(disables);
player.disableJudge(); await player.disableJudge();
player.addTempSkill("drlt_xiongluan1"); player.addTempSkill("drlt_xiongluan1");
player.storage.drlt_xiongluan1 = target; player.storage.drlt_xiongluan1 = event.target;
target.addSkill("drlt_xiongluan2"); event.target.addSkill("drlt_xiongluan2");
target.markSkillCharacter("drlt_xiongluan1", player, "雄乱", "无法使用或打出任何手牌"); event.target.markSkillCharacter("drlt_xiongluan1", player, "雄乱", "无法使用或打出任何手牌");
}, },
ai: { ai: {
order: 13, order: 13,
@ -1378,44 +1385,42 @@ const skills = {
trigger: { trigger: {
target: "useCardToTargeted", target: "useCardToTargeted",
}, },
direct: true,
filter(event, player) { filter(event, player) {
return get.type(event.card) == "trick" && event.targets.length > 1 && player.countCards("he") > 0; return get.type(event.card) == "trick" && event.targets.length > 1 && player.countCards("he") > 0;
}, },
content() { async cost(event, trigger, player) {
"step 0"; "step 0";
player.chooseCardTarget({ event.result = await player
filterCard: true, .chooseCardTarget({
selectCard: 1, filterCard: true,
position: "he", selectCard: 1,
filterTarget(card, player, target) { position: "he",
return player != target && _status.event.targets.includes(target); filterTarget(card, player, target) {
}, return player != target && _status.event.targets.includes(target);
ai1(card) { },
if (card.name == "du") return 20; ai1(card) {
if (_status.event.player.storage.drlt_xiongluan && get.type(card) == "equip") return 15; if (card.name == "du") return 20;
return 6 - get.value(card); if (_status.event.player.storage.drlt_xiongluan && get.type(card) == "equip") return 15;
}, return 6 - get.value(card);
ai2(target) { },
var att = get.attitude(_status.event.player, target); ai2(target) {
if (ui.selected.cards.length && ui.selected.cards[0].name == "du") { const att = get.attitude(_status.event.player, target);
if (target.hasSkillTag("nodu")) return 0.1; if (ui.selected.cards.length && ui.selected.cards[0].name == "du") {
return 1 - att; if (target.hasSkillTag("nodu")) return 0.1;
} return 1 - att;
return att - 3; }
}, return att - 3;
prompt: get.prompt2("drlt_congjian"), },
targets: trigger.targets, prompt: get.prompt2("drlt_congjian"),
}); targets: trigger.targets,
"step 1"; })
if (result.bool) { .forResult();
var target = result.targets[0]; },
player.logSkill("drlt_congjian", target); async content(event, trigger, player) {
player.give(result.cards, target, "give"); const target = event.targets[0];
var num = 1; await player.give(event.cards, target, "give");
if (get.type(result.cards[0]) == "equip") num = 2; const num = get.type(event.cards[0]) == "equip" ? 2 : 1;
player.draw(num); await player.draw(num);
}
}, },
}, },
drlt_wanglie: { drlt_wanglie: {
@ -1425,7 +1430,7 @@ const skills = {
if (game.online) { if (game.online) {
if (!player.countUsed()) return true; if (!player.countUsed()) return true;
} else { } else {
var evt = _status.event.getParent("phaseUse"); const evt = _status.event.getParent("phaseUse");
if ( if (
evt && evt &&
evt.name == "phaseUse" && evt.name == "phaseUse" &&
@ -1448,8 +1453,8 @@ const skills = {
check(event, player) { check(event, player) {
if (["wuzhong", "kaihua", "dongzhuxianji"].includes(event.card.name)) return false; if (["wuzhong", "kaihua", "dongzhuxianji"].includes(event.card.name)) return false;
player._wanglie_temp = true; player._wanglie_temp = true;
var eff = 0; let eff = 0;
for (var i of event.targets) { for (const i of event.targets) {
eff += get.effect(i, event.card, player, player); eff += get.effect(i, event.card, player, player);
} }
delete player._wanglie_temp; delete player._wanglie_temp;
@ -1473,7 +1478,7 @@ const skills = {
prompt2(event) { prompt2(event) {
return "令" + get.translation(event.card) + "不能被响应,然后本阶段不能再使用牌"; return "令" + get.translation(event.card) + "不能被响应,然后本阶段不能再使用牌";
}, },
content() { async content(event, trigger, player) {
trigger.nowuxie = true; trigger.nowuxie = true;
trigger.directHit.addArray(game.players); trigger.directHit.addArray(game.players);
player.addTempSkill("drlt_wanglie2", "phaseUseAfter"); player.addTempSkill("drlt_wanglie2", "phaseUseAfter");
@ -1485,13 +1490,13 @@ const skills = {
if (tag == "pretao") return true; if (tag == "pretao") return true;
if (player._wanglie_temp) return false; if (player._wanglie_temp) return false;
player._wanglie_temp = true; player._wanglie_temp = true;
var bool = (function () { const bool = (function () {
if (["wuzhong", "kaihua", "dongzhuxianji"].includes(arg.card.name)) return false; if (["wuzhong", "kaihua", "dongzhuxianji"].includes(arg.card.name)) return false;
if (get.attitude(player, arg.target) > 0 || !player.isPhaseUsing()) return false; if (get.attitude(player, arg.target) > 0 || !player.isPhaseUsing()) return false;
var cards = player.getCards("h", function (card) { let cards = player.getCards("h", function (card) {
return card != arg.card && (!arg.card.cards || !arg.card.cards.includes(card)); return card != arg.card && (!arg.card.cards || !arg.card.cards.includes(card));
}); });
var sha = player.getCardUsable("sha"); let sha = player.getCardUsable("sha");
if (arg.card.name == "sha") sha--; if (arg.card.name == "sha") sha--;
cards = cards.filter(function (card) { cards = cards.filter(function (card) {
if (card.name == "sha" && sha <= 0) return false; if (card.name == "sha" && sha <= 0) return false;
@ -1533,19 +1538,17 @@ const skills = {
if (event.name == "cardsGotoSpecial") return !event.notrigger; if (event.name == "cardsGotoSpecial") return !event.notrigger;
return true; return true;
}, },
direct: true, async cost(event, trigger, player) {
content() { const next = player.chooseTarget("是否发动【良姻】令手牌数大于你的一名角色摸一张牌?", function (card, player, target) {
"step 0";
player.chooseTarget("是否发动【良姻】令手牌数大于你的一名角色摸一张牌?", function (card, player, target) {
return target != player && target.countCards("h") > player.countCards("h"); return target != player && target.countCards("h") > player.countCards("h");
}).ai = function (target) { });
next.ai = function (target) {
return get.attitude(player, target); return get.attitude(player, target);
}; };
"step 1"; event.result = await next.forResult();
if (result.bool) { },
player.logSkill("liangyin", result.targets); async content(event, trigger, player) {
result.targets[0].draw(); await event.targets[0].draw();
}
}, },
sub: true, sub: true,
}, },
@ -1557,24 +1560,22 @@ const skills = {
return ( return (
event.fromStorage == true || event.fromStorage == true ||
game.hasPlayer2(function (current) { game.hasPlayer2(function (current) {
var evt = event.getl(current); const evt = event.getl(current);
return evt && evt.xs && evt.xs.length > 0; return evt && evt.xs && evt.xs.length > 0;
}) })
); );
}, },
direct: true, async cost(event, trigger, player) {
content() { const next = player.chooseTarget("是否发动【良姻】令手牌数小于你的一名角色弃置一张牌?", function (card, player, target) {
"step 0";
player.chooseTarget("是否发动【良姻】令手牌数小于你的一名角色弃置一张牌?", function (card, player, target) {
return target != player && target.countCards("h") < player.countCards("h") && target.countCards("he") > 0; return target != player && target.countCards("h") < player.countCards("h") && target.countCards("he") > 0;
}).ai = function (target) { });
next.ai = function (target) {
return -get.attitude(player, target); return -get.attitude(player, target);
}; };
"step 1"; event.result = await next.forResult();
if (result.bool) { },
player.logSkill("liangyin", result.targets); async content(event, trigger, player) {
result.targets[0].chooseToDiscard("he", 1, true); await event.targets[0].chooseToDiscard("he", 1, true);
}
}, },
sub: true, sub: true,
}, },
@ -1585,23 +1586,25 @@ const skills = {
trigger: { trigger: {
player: "phaseZhunbeiBegin", player: "phaseZhunbeiBegin",
}, },
direct: true,
filter(event, player) { filter(event, player) {
return player.countCards("he") > 0; return player.countCards("he") > 0;
}, },
content() { async cost(event, trigger, player) {
"step 0"; "step 0";
player.chooseCard(get.prompt("kongsheng"), "将任意张牌置于武将牌上", "he", [1, player.countCards("he")]).set("ai", function (card) { event.result = await player
if (get.position(card) == "e") return 1 - get.value(card); .chooseCard(get.prompt("kongsheng"), "将任意张牌置于武将牌上", "he", [1, player.countCards("he")])
if (card.name == "shan" || card.name == "du" || !player.hasValueTarget(card)) return 1; .set("ai", function (card) {
return 4 - get.value(card); if (get.position(card) == "e") return 1 - get.value(card);
}); if (card.name == "shan" || card.name == "du" || !player.hasValueTarget(card)) return 1;
"step 1"; return 4 - get.value(card);
if (result.bool) { })
player.logSkill("kongsheng"); .forResult();
player.addSkill("kongsheng2"); },
player.addToExpansion(result.cards, "log", "give", player).gaintag.add("kongsheng2"); async content(event, trigger, player) {
} player.addSkill("kongsheng2");
const next = player.addToExpansion(event.cards, "log", "give", player);
next.gaintag.add("kongsheng2");
await next;
}, },
}, },
kongsheng_ai: { ai: { reverseOrder: true } }, kongsheng_ai: { ai: { reverseOrder: true } },
@ -1620,28 +1623,26 @@ const skills = {
}, },
forced: true, forced: true,
charlotte: true, charlotte: true,
content() { async content(event, trigger, player) {
"step 0";
player.addTempSkill("kongsheng_ai", "kongsheng2After"); player.addTempSkill("kongsheng_ai", "kongsheng2After");
"step 1"; while (true) {
var cards = player.getExpansions("kongsheng2").filter(function (i) { const cards = player.getExpansions("kongsheng2").filter(function (i) {
return get.type(i, false) == "equip" && player.hasUseTarget(i); return get.type(i, false) == "equip" && player.hasUseTarget(i);
});
if (cards.length == 1) {
event._result = { bool: true, links: cards };
} else if (cards.length)
player.chooseButton(true, ["选择要使用的装备牌", cards]).set("ai", function (button) {
return get.order(button.link);
}); });
else event.goto(3); if (cards.length > 0) {
"step 2"; let card = cards[0];
if (result.bool) { if (cards.length > 1) {
player.chooseUseTarget(result.links[0], true); const { result } = await player.chooseButton(true, ["选择要使用的装备牌", cards]).set("ai", function (button) {
event.goto(1); return get.order(button.link);
});
if (!result.bool) continue;
card = result.links[0];
}
await player.chooseUseTarget(card, true);
} else break;
} }
"step 3"; const cards2 = player.getExpansions("kongsheng2");
var cards = player.getExpansions("kongsheng2"); if (cards2.length) await player.gain(cards2, "gain2");
if (cards.length) player.gain(cards, "gain2");
}, },
}, },
nzry_juzhan: { nzry_juzhan: {
@ -1668,14 +1669,12 @@ const skills = {
return event.card.name == "sha" && !player.storage.nzry_juzhan; return event.card.name == "sha" && !player.storage.nzry_juzhan;
}, },
logTarget: "player", logTarget: "player",
content() { async content(event, trigger, player) {
"step 0"; await game.asyncDraw([player, trigger.player]);
game.asyncDraw([player, trigger.player]);
trigger.player.addTempSkill("nzry_juzhany"); trigger.player.addTempSkill("nzry_juzhany");
player.changeZhuanhuanji("nzry_juzhan"); player.changeZhuanhuanji("nzry_juzhan");
player.addTempSkill("nzry_juzhanx"); player.addTempSkill("nzry_juzhanx");
"step 1"; await game.asyncDelayx();
game.delayx();
}, },
}, },
2: { 2: {
@ -1691,8 +1690,8 @@ const skills = {
return event.player.countCards("he") > 0 && event.targets && event.targets.length == 1; return event.player.countCards("he") > 0 && event.targets && event.targets.length == 1;
}, },
logTarget: "target", logTarget: "target",
content() { async content(event, trigger, player) {
player.gainPlayerCard(trigger.targets[0], "he", true); await player.gainPlayerCard(trigger.targets[0], "he", true);
player.changeZhuanhuanji("nzry_juzhan"); player.changeZhuanhuanji("nzry_juzhan");
trigger.target.addTempSkill("nzry_juzhanx"); trigger.target.addTempSkill("nzry_juzhanx");
player.addTempSkill("nzry_juzhany"); player.addTempSkill("nzry_juzhany");
@ -1715,7 +1714,7 @@ const skills = {
intro: { intro: {
content(storage) { content(storage) {
if (!storage || !storage.length) return "尚未发动"; if (!storage || !storage.length) return "尚未发动";
var str = get.translation(storage); const str = get.translation(storage);
return "已对" + str + "发动过〖飞军〗"; return "已对" + str + "发动过〖飞军〗";
}, },
}, },
@ -1738,9 +1737,8 @@ const skills = {
check(card) { check(card) {
return 5 - get.value(card); return 5 - get.value(card);
}, },
content() { async content(event, trigger, player) {
"step 0"; const list = [];
var list = [];
if ( if (
game.hasPlayer(function (current) { game.hasPlayer(function (current) {
return current.countCards("h") > player.countCards("h"); return current.countCards("h") > player.countCards("h");
@ -1753,17 +1751,18 @@ const skills = {
}) > 0 }) > 0
) )
list.push("令一名装备区内牌数大于你的角色弃置一张装备牌"); list.push("令一名装备区内牌数大于你的角色弃置一张装备牌");
if (list.length == 0) event.finish(); if (list.length == 0) return;
else if (list.length < 2) { let index;
if (list.length < 2) {
if ( if (
game.hasPlayer(function (current) { game.hasPlayer(function (current) {
return current.countCards("h") > player.countCards("h"); return current.countCards("h") > player.countCards("h");
}) })
) )
event._result = { index: 0 }; index = 0;
else event._result = { index: 1 }; else index = 1;
} else { } else {
player ({ index } = await player
.chooseControl() .chooseControl()
.set("ai", function () { .set("ai", function () {
if ( if (
@ -1774,49 +1773,45 @@ const skills = {
return 0; return 0;
return 1; return 1;
}) })
.set("choiceList", list); .set("choiceList", list)
.forResult());
} }
"step 1"; let result;
event.index = result.index; if (index == 0) {
if (result.index == 0) { result = await player
player
.chooseTarget(function (card, player, target) { .chooseTarget(function (card, player, target) {
return target != player && target.countCards("h") > player.countCards("h"); return target != player && target.countCards("h") > player.countCards("h");
}, "选择一名手牌数大于你的角色") }, "选择一名手牌数大于你的角色")
.set("ai", function (target) { .set("ai", function (target) {
return -get.attitude(player, target); return -get.attitude(player, target);
}); })
.forResult();
} else { } else {
player.chooseTarget(function (card, player, target) { const next = player.chooseTarget(function (card, player, target) {
return target.countCards("e") > player.countCards("e") && target != player; return target.countCards("e") > player.countCards("e") && target != player;
}, "选择一名装备区里牌数大于你的角色").ai = function (target) { }, "选择一名装备区里牌数大于你的角色");
next.ai = function (target) {
return -get.attitude(player, target); return -get.attitude(player, target);
}; };
result = await next.forResult();
} }
"step 2"; if (!result.bool) return;
if (result.bool) { const target = result.targets[0];
event.target = result.targets[0]; const list2 = player.getStorage("nzry_feijun");
var list = player.getStorage("nzry_feijun"); if (!list2.includes(target)) {
if (!list.includes(event.target)) { event._nzry_binglve = true;
event._nzry_binglve = true; player.markAuto("nzry_feijun", [target]);
player.markAuto("nzry_feijun", [event.target]); }
} player.line(target, "green");
player.line(event.target, "green"); if (index == 0) {
if (event.index == 0) { const result = await target
event.target.chooseCard("he", true, "选择一张牌交给" + get.translation(player)).set("ai", function (card) { .chooseCard("he", true, "选择一张牌交给" + get.translation(player))
.set("ai", function (card) {
return 6 - get.value(card); return 6 - get.value(card);
}); })
} else { .forResult();
event.target.chooseToDiscard("he", true, { type: "equip" }, "请弃置一张装备牌"); if (result.bool) target.give(result.cards, player);
event.finish(); } else await target.chooseToDiscard("he", true, { type: "equip" }, "请弃置一张装备牌");
}
} else {
event.finish();
}
"step 3";
if (result.bool) {
target.give(result.cards, player);
}
}, },
ai: { ai: {
order: 11, order: 11,
@ -1846,8 +1841,8 @@ const skills = {
filter(event, player) { filter(event, player) {
return event._nzry_binglve == true; return event._nzry_binglve == true;
}, },
content() { async content(event, trigger, player) {
player.draw(2); await player.draw(2);
}, },
ai: { combo: "nzry_feijun" }, ai: { combo: "nzry_feijun" },
}, },
@ -1885,7 +1880,7 @@ const skills = {
filter(event, player) { filter(event, player) {
return event.name != "phase" || game.phaseNumber == 0; return event.name != "phase" || game.phaseNumber == 0;
}, },
content() { async content(event, trigger, player) {
player.addMark("nzry_huaiju", 3); player.addMark("nzry_huaiju", 3);
player.addSkill("nzry_huaiju_ai"); player.addSkill("nzry_huaiju_ai");
}, },
@ -1901,7 +1896,7 @@ const skills = {
filter(event, player) { filter(event, player) {
return event.player.hasMark("nzry_huaiju") && (event.name == "damage" || !event.numFixed); return event.player.hasMark("nzry_huaiju") && (event.name == "damage" || !event.numFixed);
}, },
content() { async content(event, trigger, player) {
player.line(trigger.player, "green"); player.line(trigger.player, "green");
if (trigger.name == "damage") { if (trigger.name == "damage") {
trigger.cancel(); trigger.cancel();
@ -1914,38 +1909,32 @@ const skills = {
trigger: { trigger: {
player: "phaseUseBegin", player: "phaseUseBegin",
}, },
direct: true, async cost(event, trigger, player) {
content() { const next = player.chooseTarget(get.prompt("nzry_yili"), "移去一个【橘】或失去1点体力然后令一名其他角色获得一个【橘】", function (card, player, target) {
"step 0";
player.chooseTarget(get.prompt("nzry_yili"), "移去一个【橘】或失去1点体力然后令一名其他角色获得一个【橘】", function (card, player, target) {
return target != player; return target != player;
}).ai = function (target) { });
var player = _status.event.player; next.ai = function (target) {
const player = _status.event.player;
if (player.storage.nzry_huaiju > 2 || player.hp > 2) return get.attitude(player, target); if (player.storage.nzry_huaiju > 2 || player.hp > 2) return get.attitude(player, target);
return -1; return -1;
}; };
"step 1"; event.result = await next.forResult();
if (result.bool) { },
event.target = result.targets[0]; async content(event, trigger, player) {
if (player.hasMark("nzry_huaiju")) { const target = event.targets[0];
player let index = 0;
.chooseControl() if (player.hasMark("nzry_huaiju")) {
.set("choiceList", ["失去1点体力", "移去一个“橘”"]) ({ index } = await player
.set("ai", function () { .chooseControl()
if (player.hp > 2) return 0; .set("choiceList", ["失去1点体力", "移去一个“橘”"])
return 1; .set("ai", function () {
}); if (player.hp > 2) return 0;
} else event._result = { index: 0 }; return 1;
} else { })
event.finish(); .forResult());
}
"step 2";
player.logSkill("nzry_yili", target);
if (result.index == 1) {
player.removeMark("nzry_huaiju", 1);
} else {
player.loseHp();
} }
if (index == 1) player.removeMark("nzry_huaiju", 1);
else await player.loseHp();
target.addMark("nzry_huaiju", 1); target.addMark("nzry_huaiju", 1);
target.addSkill("nzry_huaiju_ai"); target.addSkill("nzry_huaiju_ai");
}, },
@ -1964,7 +1953,7 @@ const skills = {
check(event, player) { check(event, player) {
return player.countCards("h") >= 2 || player.skipList.includes("phaseUse"); return player.countCards("h") >= 2 || player.skipList.includes("phaseUse");
}, },
content() { async content(event, trigger, player) {
trigger.cancel(); trigger.cancel();
player.addMark("nzry_huaiju", 1); player.addMark("nzry_huaiju", 1);
}, },

View File

@ -2015,6 +2015,7 @@ export class Create {
input.style.borderRadius = "6px"; input.style.borderRadius = "6px";
input.style.fontWeight = "bold"; input.style.fontWeight = "bold";
input.style.fontSize = "21px"; input.style.fontSize = "21px";
input.placeholder = "支持正则搜索";
let find = ui.create.button(["find", "搜索"], "tdnodes"); let find = ui.create.button(["find", "搜索"], "tdnodes");
find.style.display = "inline"; find.style.display = "inline";
let clickfind = function (e) { let clickfind = function (e) {
@ -2034,8 +2035,9 @@ export class Create {
} }
} }
}; };
input.addEventListener("keyup", (e) => { input.addEventListener("keydown", (e) => {
if (e.key == "Enter") clickfind(e); if (e.key == "Enter") clickfind(e);
e.stopPropagation();
}); });
find.listen(clickfind); find.listen(clickfind);
Searcher.appendChild(input); Searcher.appendChild(input);