Merge pull request #1344 from IceCola97/PR-Branch

step转async(yijiang/李婉/联对,shenhua/周妃、毌丘俭、陆抗、诸葛瞻、郝昭),以及两处bug修复
This commit is contained in:
Spmario233 2024-05-12 07:18:32 +08:00 committed by GitHub
commit e92ed2a89b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 378 additions and 407 deletions

View File

@ -6104,7 +6104,7 @@ const skills = {
player.removeInvisibleSkill(skills); player.removeInvisibleSkill(skills);
}, },
onremove: function (player, skill) { onremove: function (player, skill) {
lib.skill.sbyingmen.removeVisitors(player.getSkills("sbyingmen"), player); lib.skill.sbyingmen.removeVisitors(player.getStorage("sbyingmen"), player);
player.removeSkillBlocker("sbyingmen"); player.removeSkillBlocker("sbyingmen");
}, },
skillBlocker: function (skill, player) { skillBlocker: function (skill, player) {

View File

@ -77,7 +77,7 @@ const skills = {
lose: false, lose: false,
delay: false, delay: false,
async precontent(event, trigger, player) { async precontent(event, trigger, player) {
var result = event.result; const result = event.result;
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) {
@ -104,8 +104,8 @@ const skills = {
if (player.hasSkill("dcwanglie2", null, null, false)) return true; if (player.hasSkill("dcwanglie2", null, null, false)) return true;
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;
@ -167,13 +167,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;
@ -214,32 +214,30 @@ const skills = {
if (event.name == "cardsGotoSpecial") return !event.notrigger; if (event.name == "cardsGotoSpecial") return !event.notrigger;
return true; return true;
}, },
direct: true,
usable: 1, usable: 1,
async cost(event, trigger, player) {
event.result = await player
.chooseTarget(get.prompt("olliangyin"), "选择一名其他角色,你与其各摸一张牌", lib.filter.notMe)
.set("ai", function (target) {
const player = _status.event.player,
num = player.getExpansions("olkongsheng").length - 1;
const att = get.attitude(player, target);
if (att <= 0) return 0;
if (target.countCards("h") == num && target.isDamaged() && get.recoverEffect(target, player, player) > 0) return 3 * att;
return att;
})
.forResult();
},
async content(event, trigger, player) { async content(event, trigger, player) {
const { const target = event.targets[0];
result: { bool, targets }, player.logSkill("olliangyin", target);
} = await player.chooseTarget(get.prompt("olliangyin"), "选择一名其他角色,你与其各摸一张牌", lib.filter.notMe).set("ai", function (target) { await game.asyncDraw([player, target].sortBySeat());
var player = _status.event.player,
num = player.getExpansions("olkongsheng").length - 1;
var att = get.attitude(player, target);
if (att <= 0) return 0;
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;
await game.asyncDelayx(); await game.asyncDelayx();
let num = player.getExpansions("olkongsheng").length; let num = player.getExpansions("olkongsheng").length;
let check = 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)) {
const choiceList = ["令自己回复1点体力", "令" + get.translation(target) + "回复1点体力"]; const choiceList = ["令自己回复1点体力", "令" + get.translation(target) + "回复1点体力"];
const choices = []; const choices = [];
@ -255,9 +253,9 @@ const skills = {
.set("choiceList", choiceList) .set("choiceList", choiceList)
.set("prompt", "良姻:是否令一名角色回复体力?") .set("prompt", "良姻:是否令一名角色回复体力?")
.set("ai", function () { .set("ai", function () {
var player = _status.event.player, const player = _status.event.player,
target = _status.event.getParent().target; target = _status.event.getParent().target;
var list = _status.event.controls.slice(0), let list = _status.event.controls.slice(0),
eff1 = 0, eff1 = 0,
eff2 = 0; eff2 = 0;
if (list.includes("选项一")) eff1 = get.recoverEffect(player, player, player); if (list.includes("选项一")) eff1 = get.recoverEffect(player, player, player);
@ -277,74 +275,71 @@ const skills = {
trigger: { trigger: {
global: ["loseAfter", "equipAfter", "addJudgeAfter", "gainAfter", "loseAsyncAfter", "addToExpansionAfter"], global: ["loseAfter", "equipAfter", "addJudgeAfter", "gainAfter", "loseAsyncAfter", "addToExpansionAfter"],
}, },
direct: true,
filter(event, player) { filter(event, player) {
return game.hasPlayer(function (current) { return game.hasPlayer(function (current) {
var evt = event.getl(current); const evt = event.getl(current);
return evt && (evt.xs.length > 0 || evt.ss.length > 0); return evt && (evt.xs.length > 0 || evt.ss.length > 0);
}); });
}, },
usable: 1, 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; if (!player.countCards("he") || !game.hasPlayer(current => current != player && current.countCards("he") > 0)) return;
const { event.result = await player
result: { bool, targets, cards }, .chooseCardTarget({
} = await player.chooseCardTarget({ prompt: get.prompt("olliangyin"),
prompt: get.prompt("olliangyin"), prompt2: "弃置一张牌,并令一名其他角色也弃置一张牌",
prompt2: "弃置一张牌,并令一名其他角色也弃置一张牌", position: "he",
position: "he", filterCard: lib.filter.cardDiscardable,
filterCard: lib.filter.cardDiscardable, filterTarget(card, player, target) {
filterTarget(card, player, target) { return target != player && target.countCards("he") > 0;
return target != player && target.countCards("he") > 0; },
}, ai1(card) {
ai1(card) { let player = _status.event.player;
let player = _status.event.player; if (_status.event.me) {
if (_status.event.me) { if (get.position(card) === _status.event.me) return 12 - player.hp - get.value(card);
if (get.position(card) === _status.event.me) return 12 - player.hp - get.value(card); return 0;
return 0; }
} return 5 - get.value(card);
return 5 - get.value(card); },
}, ai2(target) {
ai2(target) { let player = _status.event.player,
let player = _status.event.player, att = get.attitude(player, target);
att = get.attitude(player, target); if (att > 0 && (_status.event.me || target.isHealthy())) return -att;
if (att > 0 && (_status.event.me || target.isHealthy())) return -att; if (
if ( att > 0 &&
att > 0 && (target.countCards("he") > target.hp ||
(target.countCards("he") > target.hp || target.hasCard(function (card) {
target.hasCard(function (card) { return get.value(card, target) <= 0;
return get.value(card, target) <= 0; }, "e"))
}, "e")) )
) return att;
return att; return -att;
return -att; },
}, me: (() => {
me: (() => { if (player.isHealthy() || get.recoverEffect(player, player, _status.event.player) <= 0) return false;
if (player.isHealthy() || get.recoverEffect(player, player, _status.event.player) <= 0) return false; let ph = player.countCards("h"),
let ph = player.countCards("h"), num = player.getExpansions("olkongsheng").length;
num = player.getExpansions("olkongsheng").length; if (ph === num) {
if (ph === num) { if (player.hasSkillTag("noh")) return "h";
if (player.hasSkillTag("noh")) return "h"; return "e";
return "e"; }
} if (ph - 1 === num) return "h";
if (ph - 1 === num) return "h"; return false;
return false; })(),
})(), })
}); .forResult();
if (bool) { },
const target = targets[0]; async content(event, trigger, player) {
event.target = target; const target = event.targets[0];
player.logSkill("olliangyin_gain", target); player.logSkill("olliangyin_gain", target);
await player.discard(cards); await player.discard(event.cards);
await target.chooseToDiscard("he", true); await target.chooseToDiscard("he", true);
} else return;
await game.asyncDelayx(); await game.asyncDelayx();
let num = player.getExpansions("olkongsheng").length; const num = player.getExpansions("olkongsheng").length;
let check = player => { const 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)) {
const choiceList = ["令自己回复1点体力", "令" + get.translation(target) + "回复1点体力"]; const choiceList = ["令自己回复1点体力", "令" + get.translation(target) + "回复1点体力"];
const choices = []; const choices = [];
@ -360,9 +355,9 @@ const skills = {
.set("choiceList", choiceList) .set("choiceList", choiceList)
.set("prompt", "良姻:是否令一名角色回复体力?") .set("prompt", "良姻:是否令一名角色回复体力?")
.set("ai", function () { .set("ai", function () {
var player = _status.event.player, const player = _status.event.player,
target = _status.event.getParent().target; target = _status.event.getParent().target;
var list = _status.event.controls.slice(0), let list = _status.event.controls.slice(0),
eff1 = 0, eff1 = 0,
eff2 = 0; eff2 = 0;
if (list.includes("选项一")) eff1 = get.recoverEffect(player, player, player); if (list.includes("选项一")) eff1 = get.recoverEffect(player, player, player);
@ -381,45 +376,44 @@ const skills = {
olkongsheng: { olkongsheng: {
audio: "kongsheng", audio: "kongsheng",
trigger: { player: "phaseZhunbeiBegin" }, trigger: { 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"; event.result = await player
player.chooseCard("he", [1, player.countCards("he")], get.prompt("olkongsheng"), "将任意张牌作为“箜”置于武将牌上").set("ai", function (card) { .chooseCard("he", [1, player.countCards("he")], get.prompt("olkongsheng"), "将任意张牌作为“箜”置于武将牌上")
var player = _status.event.player, .set("ai", function (card) {
num = player.getExpansions("olkongsheng") + ui.selected.cards.length; const player = _status.event.player,
if ( num = player.getExpansions("olkongsheng") + ui.selected.cards.length;
ui.selected.cards.length > 0 && if (
game.hasPlayer(function (current) { ui.selected.cards.length > 0 &&
if (current.isHealthy() || get.recoverEffect(current, player, player) <= 0) return false; game.hasPlayer(function (current) {
var num2 = if (current.isHealthy() || get.recoverEffect(current, player, player) <= 0) return false;
current.countCards("h", function (card) { const num2 =
if (current != player) return true; current.countCards("h", function (card) {
return !ui.selected.cards.includes(card); if (current != player) return true;
}) + 1; return !ui.selected.cards.includes(card);
return num == num2; }) + 1;
}) return num == num2;
) })
return 0; )
if (get.type(card, null, false) == "equip") { return 0;
for (var i of ui.selected.cards) { if (get.type(card, null, false) == "equip") {
if (get.type(i, null, false) == "equip") return 0; for (const i of ui.selected.cards) {
if (get.type(i, null, false) == "equip") return 0;
}
return 5 - get.value(card);
} }
return 5 - get.value(card); if (!player.hasValueTarget(card)) return 1;
} return 0;
if (!player.hasValueTarget(card)) return 1; })
return 0; .forResult();
}); },
"step 1"; async content(event, trigger, player) {
if (result.bool) { player.addToExpansion(event.cards, player, "give").gaintag.add("olkongsheng");
player.logSkill("olkongsheng");
player.addToExpansion(result.cards, player, "give").gaintag.add("olkongsheng");
}
}, },
onremove(player, skill) { onremove(player, skill) {
var cards = player.getExpansions(skill); const cards = player.getExpansions(skill);
if (cards.length) player.loseToDiscardpile(cards); if (cards.length) player.loseToDiscardpile(cards);
}, },
intro: { intro: {
@ -439,42 +433,36 @@ const skills = {
}).length > 0 }).length > 0
); );
}, },
content() { async content(event, trigger, player) {
"step 0"; let cards = player.getExpansions("olkongsheng").filter(function (card) {
var cards = player.getExpansions("olkongsheng").filter(function (card) {
return get.type(card, false) != "equip"; return get.type(card, false) != "equip";
}); });
if (cards.length) player.gain(cards, "gain2"); if (cards.length) await player.gain(cards, "gain2");
"step 1"; cards = player.getExpansions("olkongsheng");
var cards = player.getExpansions("olkongsheng"); if (cards.length <= 0) return;
if (cards.length > 0) { const { result } = await player.chooseTarget(true, "令一名角色使用以下装备牌", get.translation(cards)).set("ai", function (target) {
player.chooseTarget(true, "令一名角色使用以下装备牌", get.translation(cards)).set("ai", function (target) { const player = _status.event.player;
var player = _status.event.player; return get.effect(target, { name: "losehp" }, player, 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 == 1) { const target = result.targets[0];
event._result = { bool: true, links: cards }; player.line(target, "green");
} else if (cards.length) while (true) {
target.chooseButton(true, ["选择要使用的装备牌", cards]).set("ai", function (button) { const cards = player.getExpansions("olkongsheng").filter(function (i) {
return get.order(button.link); return target.hasUseTarget(i);
}); });
else event.goto(5); if (cards.length) {
"step 4"; const card = cards[0];
if (result.bool) { if (cards.length > 1) {
target.chooseUseTarget(result.links[0], true); const { result } = await target.chooseButton(true, ["选择要使用的装备牌", cards]).set("ai", function (button) {
event.goto(3); return get.order(button.link);
});
if (!result.bool) break;
card = result.links[0];
}
await target.chooseUseTarget(card, true);
} else break;
} }
"step 5"; await target.loseHp();
target.loseHp();
}, },
}, },
}, },
@ -482,7 +470,6 @@ const skills = {
//新毌丘俭 //新毌丘俭
zhengrong: { zhengrong: {
trigger: { player: "useCardToPlayered" }, trigger: { player: "useCardToPlayered" },
direct: true,
audio: "drlt_zhenrong", audio: "drlt_zhenrong",
filter(event, player) { filter(event, player) {
if (!event.isFirstTarget) return false; if (!event.isFirstTarget) return false;
@ -493,31 +480,29 @@ const skills = {
}); });
return false; return false;
}, },
content() { async cost(event, trigger, player) {
"step 0"; event.result = await player
player
.chooseTarget(get.prompt("zhengrong"), "将一名手牌数不小于你的目标角色的一张牌置于你的武将牌上,成为「荣」", function (card, player, target) { .chooseTarget(get.prompt("zhengrong"), "将一名手牌数不小于你的目标角色的一张牌置于你的武将牌上,成为「荣」", function (card, player, target) {
return _status.event.targets.includes(target) && target.countCards("h") >= player.countCards("h") && target.countCards("he") > 0; return _status.event.targets.includes(target) && target.countCards("h") >= player.countCards("h") && target.countCards("he") > 0;
}) })
.set("ai", function (target) { .set("ai", function (target) {
return (1 - get.attitude(_status.event.player, target)) / target.countCards("he"); return (1 - get.attitude(_status.event.player, target)) / target.countCards("he");
}) })
.set("targets", trigger.targets); .set("targets", trigger.targets)
"step 1"; .forResult();
},
async content(event, trigger, player) {
const target = event.targets[0];
const next = player.choosePlayerCard(target, "he", true);
next.ai = get.buttonValue;
const { result } = await next;
if (result.bool) { if (result.bool) {
var target = result.targets[0]; const card = result.links[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];
player.addToExpansion(card, "give", "log", target).gaintag.add("zhengrong"); player.addToExpansion(card, "give", "log", target).gaintag.add("zhengrong");
} }
}, },
onremove(player, skill) { onremove(player, skill) {
var cards = player.getExpansions(skill); const cards = player.getExpansions(skill);
if (cards.length) player.loseToDiscardpile(cards); if (cards.length) player.loseToDiscardpile(cards);
}, },
marktext: "荣", marktext: "荣",
@ -538,44 +523,43 @@ const skills = {
filter(event, player) { filter(event, player) {
return player.getExpansions("zhengrong").length >= 3; return player.getExpansions("zhengrong").length >= 3;
}, },
content() { async content(event, trigger, player) {
"step 0";
player.awakenSkill("hongju"); player.awakenSkill("hongju");
var cards = player.getExpansions("zhengrong"); const cards = player.getExpansions("zhengrong");
if (!cards.length || !player.countCards("h")) { if (cards.length && player.countCards("h")) {
event.goto(2); const next = player.chooseToMove("征荣:是否交换“荣”和手牌?");
return; 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("征荣:是否交换“荣”和手牌?"); await player.addSkills("qingce");
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");
game.log(player, "获得了技能", "#g【清侧】"); game.log(player, "获得了技能", "#g【清侧】");
player.loseMaxHp(); await player.loseMaxHp();
}, },
ai: { ai: {
combo: "zhengrong", combo: "zhengrong",
@ -605,7 +589,7 @@ const skills = {
ai: { ai: {
result: { result: {
target(player, target) { target(player, target) {
var att = get.attitude(player, target); const att = get.attitude(player, target);
if ( if (
att > 0 && att > 0 &&
(target.countCards("j") > 0 || (target.countCards("j") > 0 ||
@ -625,13 +609,11 @@ const skills = {
return "选择弃置一张手牌,获得" + get.translation(links[0]) + "并弃置一名角色装备区或判定区内的一张牌"; return "选择弃置一张手牌,获得" + get.translation(links[0]) + "并弃置一名角色装备区或判定区内的一张牌";
}, },
}, },
contentx() { async contentx(event, trigger, player) {
"step 0"; const card = lib.skill.qingce_backup.card;
var card = lib.skill.qingce_backup.card; await player.gain(card, "gain2", "log");
player.gain(card, "gain2", "log"); if (event.target.countDiscardableCards(player, "ej") > 0) {
"step 1"; await player.discardPlayerCard("ej", true, event.target);
if (target.countDiscardableCards(player, "ej") > 0) {
player.discardPlayerCard("ej", true, target);
} }
}, },
ai: { ai: {
@ -641,7 +623,7 @@ const skills = {
player(player) { player(player) {
if ( if (
game.hasPlayer(function (current) { game.hasPlayer(function (current) {
var att = get.attitude(player, current); const att = get.attitude(player, current);
if ((att > 0 && current.countCards("j") > 0) || (att < 0 && current.countCards("e") > 0)) return true; if ((att > 0 && current.countCards("j") > 0) || (att < 0 && current.countCards("e") > 0)) return true;
return false; return false;
}) })
@ -666,19 +648,17 @@ const skills = {
filter(event, player) { filter(event, player) {
return event.player != player && event.player.countCards("h") > player.countCards("h"); return event.player != player && event.player.countCards("h") > player.countCards("h");
}, },
direct: true, async cost(event, trigger, player) {
content() { const { result } = await player.choosePlayerCard("hej", get.prompt("drlt_zhenrong"), trigger.player).set("ai", function (button) {
"step 0";
player.choosePlayerCard("hej", get.prompt("drlt_zhenrong"), trigger.player).set("ai", function (button) {
return -get.attitude(player, trigger.player) + 1; return -get.attitude(player, trigger.player) + 1;
}); });
"step 1";
if (result && result.links && result.links.length) { if (result && result.links && result.links.length) {
player.line(player, trigger.player); event.result = result;
player.logSkill("drlt_zhenrong");
player.addToExpansion(result.links, trigger.player, "give", "log").gaintag.add("drlt_zhenrong");
} }
}, },
async content(event, trigger, player) {
player.addToExpansion(event.cards, trigger.player, "give", "log").gaintag.add("drlt_zhenrong");
},
}, },
drlt_hongju: { drlt_hongju: {
skillAnimation: true, skillAnimation: true,
@ -694,43 +674,42 @@ const skills = {
filter(event, player) { filter(event, player) {
return player.getExpansions("drlt_zhenrong").length >= 3 && game.dead.length > 0; return player.getExpansions("drlt_zhenrong").length >= 3 && game.dead.length > 0;
}, },
content() { async content(event, trigger, player) {
"step 0";
player.awakenSkill("drlt_hongju"); player.awakenSkill("drlt_hongju");
var cards = player.getExpansions("drlt_zhenrong"); const cards = player.getExpansions("drlt_zhenrong");
if (!cards.length || !player.countCards("h")) { if (cards.length && player.countCards("h")) {
event.goto(2); const next = player.chooseToMove("征荣:是否交换“荣”和手牌?");
return; 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("征荣:是否交换“荣”和手牌?"); await player.addSkills("drlt_qingce");
next.set("list", [ await player.loseMaxHp();
[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();
}, },
ai: { ai: {
combo: "drlt_zhenrong", combo: "drlt_zhenrong",
@ -745,16 +724,14 @@ const skills = {
filterTarget(card, player, target) { filterTarget(card, player, target) {
return target.countDiscardableCards(player, "ej") > 0; return target.countDiscardableCards(player, "ej") > 0;
}, },
content() { async content(event, trigger, player) {
"step 0"; const next = player.chooseCardButton(player.getExpansions("drlt_zhenrong"), 1, "请选择需要弃置的“荣”", true);
player.chooseCardButton(player.getExpansions("drlt_zhenrong"), 1, "请选择需要弃置的“荣”", true).ai = function (button) { next.ai = button => 6 - get.value(button.link);
return 6 - get.value(button.link); const { result } = await next;
};
"step 1";
if (result.bool) { if (result.bool) {
var cards = result.links; const cards = result.links;
player.loseToDiscardpile(cards); player.loseToDiscardpile(cards);
player.discardPlayerCard(target, "ej", 1, true); player.discardPlayerCard(event.target, "ej", 1, true);
} }
}, },
ai: { ai: {
@ -773,35 +750,32 @@ const skills = {
trigger: { trigger: {
player: "phaseJieshuBegin", player: "phaseJieshuBegin",
}, },
direct: true, async cost(event, trigger, player) {
content() { event.result = await player
"step 0";
player
.chooseTarget(get.prompt2("drlt_zhenggu"), function (card, player, target) { .chooseTarget(get.prompt2("drlt_zhenggu"), function (card, player, target) {
//if(target.storage.drlt_zhenggu_mark&&target.storage.drlt_zhenggu_mark.includes(player)) return false; //if(target.storage.drlt_zhenggu_mark&&target.storage.drlt_zhenggu_mark.includes(player)) return false;
return target != player; return target != player;
}) })
.set("ai", function (target) { .set("ai", function (target) {
var player = _status.event.player; const player = _status.event.player;
//if(target.storage.drlt_zhenggu_mark&&target.storage.drlt_zhenggu_mark.includes(player)) return 0; //if(target.storage.drlt_zhenggu_mark&&target.storage.drlt_zhenggu_mark.includes(player)) return 0;
var num = Math.min(5, player.countCards("h")) - target.countCards("h"); const num = Math.min(5, player.countCards("h")) - target.countCards("h");
var att = get.attitude(player, target); const att = get.attitude(player, target);
return num * att; return num * att;
}); })
"step 1"; .forResult();
if (result.bool) { },
var target = result.targets[0]; async content(event, trigger, player) {
player.logSkill("drlt_zhenggu", target); const target = event.targets[0];
player.addSkill("drlt_zhenggu2"); player.addSkill("drlt_zhenggu2");
target.addSkill("drlt_zhenggu_mark"); target.addSkill("drlt_zhenggu_mark");
target.storage.drlt_zhenggu_mark.push(player); target.storage.drlt_zhenggu_mark.push(player);
target.markSkill("drlt_zhenggu_mark"); target.markSkill("drlt_zhenggu_mark");
lib.skill.drlt_zhenggu.sync(player, target); lib.skill.drlt_zhenggu.sync(player, target);
}
}, },
sync(player, target) { sync(player, target) {
var num = player.countCards("h"); const num = player.countCards("h");
var num2 = target.countCards("h"); const num2 = target.countCards("h");
if (num < num2) { if (num < num2) {
target.chooseToDiscard(num2 - num, true, "h"); target.chooseToDiscard(num2 - num, true, "h");
} else target.drawTo(Math.min(5, num)); } else target.drawTo(Math.min(5, num));
@ -818,7 +792,7 @@ const skills = {
filter(event, player) { filter(event, player) {
return event.player.storage.drlt_zhenggu_mark && event.player.storage.drlt_zhenggu_mark.includes(player); return event.player.storage.drlt_zhenggu_mark && event.player.storage.drlt_zhenggu_mark.includes(player);
}, },
content() { async content(event, trigger, player) {
while (trigger.player.storage.drlt_zhenggu_mark.includes(player)) { while (trigger.player.storage.drlt_zhenggu_mark.includes(player)) {
trigger.player.storage.drlt_zhenggu_mark.remove(player); trigger.player.storage.drlt_zhenggu_mark.remove(player);
} }
@ -842,7 +816,7 @@ const skills = {
player: "phaseJieshuBegin", player: "phaseJieshuBegin",
}, },
check(event, player) { check(event, player) {
var num = 0; let num = 0;
if ( if (
player.hasHistory("lose", function (evt) { player.hasHistory("lose", function (evt) {
return evt.type == "discard"; return evt.type == "discard";
@ -855,7 +829,7 @@ const skills = {
return true; return true;
}, },
prompt(event, player) { prompt(event, player) {
var num = 3; let num = 3;
if ( if (
player.hasHistory("lose", function (evt) { player.hasHistory("lose", function (evt) {
return evt.type == "discard"; return evt.type == "discard";
@ -866,87 +840,79 @@ const skills = {
if (!player.getStat("damage")) num--; if (!player.getStat("damage")) num--;
return get.prompt("xinfu_zuilun") + "(可获得" + get.cnNumber(num) + "张牌)"; return get.prompt("xinfu_zuilun") + "(可获得" + get.cnNumber(num) + "张牌)";
}, },
content() { async content(event, trigger, player) {
"step 0"; "step 0";
event.num = 0; let num = 0;
event.cards = get.cards(3); const cards = get.cards(3);
game.cardsGotoOrdering(cards); await game.cardsGotoOrdering(cards);
if ( if (
player.hasHistory("lose", function (evt) { player.hasHistory("lose", function (evt) {
return evt.type == "discard"; return evt.type == "discard";
}) })
) )
event.num++; num++;
if (!player.isMinHandcard()) event.num++; if (!player.isMinHandcard()) num++;
if (!player.getStat("damage")) event.num++; if (!player.getStat("damage")) num++;
"step 1"; if (num == 0) {
if (event.num == 0) { await player.gain(cards, "draw");
player.gain(event.cards, "draw"); return;
event.finish(); }
} else { let prompt = "罪论:将" + get.cnNumber(num) + "张牌置于牌堆顶";
var prompt = "罪论:将" + get.cnNumber(num) + "张牌置于牌堆顶"; if (num < 3) prompt += "并获得其余的牌";
if (num < 3) prompt += "并获得其余的牌"; const chooseToMove = player.chooseToMove(prompt, true);
var next = player.chooseToMove(prompt, true); if (num < 3) {
if (num < 3) { chooseToMove.set("list", [["牌堆顶", cards], ["获得"]]);
next.set("list", [["牌堆顶", cards], ["获得"]]); chooseToMove.set("filterMove", function (from, to, moved) {
next.set("filterMove", function (from, to, moved) { if (to == 1 && moved[0].length <= _status.event.num) return false;
if (to == 1 && moved[0].length <= _status.event.num) return false; return true;
return true;
});
next.set("filterOk", function (moved) {
return moved[0].length == _status.event.num;
});
} else {
next.set("list", [["牌堆顶", cards]]);
}
next.set("num", num);
next.set("processAI", function (list) {
var check = function (card) {
var player = _status.event.player;
var next = player.next;
var att = get.attitude(player, next);
var judge = next.getCards("j")[tops.length];
if (judge) {
return get.judge(judge)(card) * att;
}
return next.getUseValue(card) * att;
};
var cards = list[0][1].slice(0),
tops = [];
while (tops.length < _status.event.num) {
list.sort(function (a, b) {
return check(b) - check(a);
});
tops.push(cards.shift());
}
return [tops, cards];
}); });
} chooseToMove.set("filterOk", function (moved) {
"step 2"; return moved[0].length == _status.event.num;
if (result.bool) { });
var list = result.moved[0]; } else chooseToMove.set("list", [["牌堆顶", cards]]);
var num = list.length - 1; chooseToMove.set("num", num);
for (var i = 0; i < list.length; i++) { chooseToMove.set("processAI", function (list) {
event.cards.remove(list[num - i]); const check = function (card) {
ui.cardPile.insertBefore(list[num - i], ui.cardPile.firstChild); const player = _status.event.player;
} const next = player.next;
} const att = get.attitude(player, next);
"step 3"; const judge = next.getCards("j")[tops.length];
game.updateRoundNumber(); if (judge) {
if (event.cards.length) { return get.judge(judge)(card) * att;
player.gain(event.cards, "draw"); }
event.finish(); return next.getUseValue(card) * att;
} else {
player.chooseTarget("请选择一名角色与其一同失去1点体力", true, function (card, player, target) {
return target != player;
}).ai = function (target) {
return -get.attitude(_status.event.player, target);
}; };
const cards = list[0][1].slice(0),
tops = [];
while (tops.length < _status.event.num) {
list.sort(function (a, b) {
return check(b) - check(a);
});
tops.push(cards.shift());
}
return [tops, cards];
});
let result = await chooseToMove.forResult();
if (result.bool) {
const list = result.moved[0];
cards.removeArray(list);
await game.cardsGotoPile(list.reverse(), "insert");
} }
"step 4"; game.updateRoundNumber();
if (cards.length) {
await player.gain(cards, "draw");
return;
}
const chooseTarget = player.chooseTarget("请选择一名角色与其一同失去1点体力", true, function (card, player, target) {
return target != player;
});
chooseTarget.ai = function (target) {
return -get.attitude(_status.event.player, target);
};
result = await chooseTarget.forResult();
player.line(result.targets[0], "fire"); player.line(result.targets[0], "fire");
player.loseHp(); await player.loseHp();
result.targets[0].loseHp(); await result.targets[0].loseHp();
}, },
}, },
xinfu_fuyin: { xinfu_fuyin: {
@ -966,7 +932,7 @@ const skills = {
); );
}); });
}, },
content() { async content(event, trigger, player) {
trigger.getParent().excluded.add(player); trigger.getParent().excluded.add(player);
}, },
ai: { ai: {
@ -1022,7 +988,7 @@ const skills = {
filter(event, player) { filter(event, player) {
return !player.isLinked(); return !player.isLinked();
}, },
content() { async content(event, trigger, player) {
trigger.cancel(); trigger.cancel();
}, },
}, },
@ -1045,9 +1011,8 @@ const skills = {
filter(event, player) { filter(event, player) {
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");
}, },
content() { async content(event, trigger, player) {
"step 0"; const { control } = await player.chooseToDisable(true).set("ai", function (event, player, list) {
player.chooseToDisable(true).set("ai", function (event, player, list) {
if (list.includes("equip2")) return "equip2"; if (list.includes("equip2")) return "equip2";
if ( if (
list.includes("equip1") && list.includes("equip1") &&
@ -1065,9 +1030,8 @@ const skills = {
}) > 1 }) > 1
) )
return "equip5"; return "equip5";
}); }).forResult();
"step 1"; switch (control) {
switch (result.control) {
case "equip1": case "equip1":
player.addTempSkill("drlt_jueyan1"); player.addTempSkill("drlt_jueyan1");
break; break;
@ -1154,12 +1118,10 @@ const skills = {
filter(event, player) { filter(event, player) {
return !player.hasEnabledSlot() || player.hp == 1; return !player.hasEnabledSlot() || player.hp == 1;
}, },
content() { async content(event, trigger, player) {
"step 0";
player.awakenSkill("drlt_poshi"); player.awakenSkill("drlt_poshi");
player.loseMaxHp(); await player.loseMaxHp();
"step 1"; const num = player.maxHp - player.countCards("h");
var num = player.maxHp - player.countCards("h");
if (num > 0) player.draw(num); if (num > 0) player.draw(num);
player.changeSkills(["drlt_huairou"], ["drlt_jueyan"]); player.changeSkills(["drlt_huairou"], ["drlt_jueyan"]);
}, },
@ -1174,8 +1136,8 @@ const skills = {
if (!_status.event.player.canEquip(card)) return 5; if (!_status.event.player.canEquip(card)) return 5;
return 3 - get.value(card); return 3 - get.value(card);
}, },
content() { async content(event, trigger, player) {
player.recast(cards); player.recast(event.cards);
}, },
discard: false, discard: false,
lose: false, lose: false,
@ -2419,7 +2381,7 @@ const skills = {
if (cards.length) player.loseToDiscardpile(cards); if (cards.length) player.loseToDiscardpile(cards);
}, },
group: ["nzry_mingren_1", "nzry_mingren_2"], group: ["nzry_mingren_1", "nzry_mingren_2"],
ai:{ ai: {
combo: "nzry_zhenliang", combo: "nzry_zhenliang",
}, },
subSkill: { subSkill: {

View File

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

View File

@ -1649,9 +1649,13 @@ const skills = {
.getCards("he", function (card) { .getCards("he", function (card) {
return lib.filter.canBeDiscarded(card, player, target); return lib.filter.canBeDiscarded(card, player, target);
}) })
.map(c => {
link: c;
})
.sort(function (a, b) { .sort(function (a, b) {
return get.buttonValue(b) - get.buttonValue(a); return get.buttonValue(b) - get.buttonValue(a);
}); })
.map(b => b.link);
if ( if (
target.countCards("h") - player.countCards("h") >= target.countCards("h") - player.countCards("h") >=
Math.max( Math.max(