国战Bug修复

This commit is contained in:
Spmario233 2024-05-07 00:15:47 +08:00
parent dd16017804
commit 6ab1807d13
3 changed files with 46 additions and 37 deletions

View File

@ -14821,12 +14821,14 @@ const skills = {
trigger.target.chooseToDiscard("he", true, 2); trigger.target.chooseToDiscard("he", true, 2);
"step 1"; "step 1";
if (result.bool && result.cards && result.cards.length) { if (result.bool && result.cards && result.cards.length) {
if (result.cards.length == 1) { const cards = result.cards.filterInD("d");
if (cards.length == 1) {
event._result = { bool: true, links: result.cards.slice(0) }; event._result = { bool: true, links: result.cards.slice(0) };
} else } else if (cards.length > 1) {
player.chooseButton(["选择获得其中的一张牌", result.cards.slice(0)], true).ai = function (button) { player.chooseButton(["选择获得其中的一张牌", result.cards.slice(0)], true).set("ai", function (button) {
return get.value(button.link); return get.value(button.link);
}; });
} else event.finish();
} else event.finish(); } else event.finish();
"step 2"; "step 2";
if (result.links) player.gain(result.links, "gain2"); if (result.links) player.gain(result.links, "gain2");

View File

@ -171,6 +171,9 @@ const skills = {
result: { bool, moved }, result: { bool, moved },
} = await player } = await player
.chooseToMove("易城:请选择你要交换的牌") .chooseToMove("易城:请选择你要交换的牌")
.set("filterMove", (from, to) => {
return typeof to !== "number";
})
.set("list", [ .set("list", [
[ [
"牌堆顶", "牌堆顶",

View File

@ -1158,50 +1158,56 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
const targets = list const targets = list
.slice() .slice()
.filter((i) => (event.num1 - event.num2) * get.sgn(0.5 - list.indexOf(i)) <= 0); .filter((i) => (event.num1 - event.num2) * get.sgn(0.5 - list.indexOf(i)) <= 0);
return targets.some((i) => i.countGainableCards(list[1 - list.indexOf(i)], "e")); return targets.some((i) => {
const target = list[1 - list.indexOf(i)];
return target.hasCard((card) => {
return lib.filter.canBeGained(card, i, target);
}, "e");
});
}, },
async cost(event, trigger, player) { async cost(event, trigger, player) {
let users = []; let users = [];
const list = [event.player, event.target]; const list = [trigger.player, trigger.target];
let targets = list let targets = list
.slice() .slice()
.filter((i) => (event.num1 - event.num2) * get.sgn(0.5 - list.indexOf(i)) <= 0); .filter((i) => (trigger.num1 - trigger.num2) * get.sgn(0.5 - list.indexOf(i)) <= 0);
targets = targets targets = targets.filter((i) => {
.filter((i) => i.countGainableCards(list[1 - list.indexOf(i)], "e")) const target = list[1 - list.indexOf(i)];
.sortBySeat(player); return target.hasCard((card) => {
return lib.filter.canBeGained(card, i, target);
}, "e");
}).sortBySeat(player);
for (const i of targets) { for (const i of targets) {
const aim = list[1 - list.indexOf(i)]; const aim = list[1 - list.indexOf(i)];
const { const {
result: { bool }, result: { bool },
} = await i } = await i.chooseBool(
.chooseBool(
get.prompt("fakehanzhan"), get.prompt("fakehanzhan"),
"获得" + get.translation(aim) + "装备区的一张牌" "获得" + get.translation(aim) + "装备区的一张牌"
) ).set("choice", aim.hasCard((card) => {
.set( return get.value(card, aim) * get.attitude(i, aim) < 0;
"choice", }, "e"));
target.hasCard((card) => {
return get.value(card, aim) * get.attitude(i, aim) < 0;
}, "e")
);
if (bool) users.push(i); if (bool) users.push(i);
} }
event.result = { bool: Boolean(users.length), targets: users }; event.result = { bool: Boolean(users.length), targets: users };
}, },
logLine: false,
async content(event, trigger, player) { async content(event, trigger, player) {
const list = [trigger.player, trigger.target]; const list = [trigger.player, trigger.target];
let targets = list let targets = list
.slice() .slice()
.filter((i) => (trigger.num1 - trigger.num2) * get.sgn(0.5 - list.indexOf(i)) <= 0); .filter((i) => (trigger.num1 - trigger.num2) * get.sgn(0.5 - list.indexOf(i)) <= 0);
targets = targets targets = targets
.filter( .filter((i) => {
(i) => const target = list[1 - list.indexOf(i)];
i.countGainableCards(list[1 - list.indexOf(i)], "e") && return target.hasCard((card) => {
event.targets.includes(i) return lib.filter.canBeGained(card, i, target);
) }, "e");
})
.sortBySeat(player); .sortBySeat(player);
for (const i of targets) { for (const i of targets) {
const aim = list[1 - list.indexOf(i)]; const aim = list[1 - list.indexOf(i)];
i.line(aim, "green");
await i.gainPlayerCard(aim, "e", true); await i.gainPlayerCard(aim, "e", true);
} }
}, },
@ -2630,14 +2636,14 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
const storage = player.getStorage("fakechengshang_effect"); const storage = player.getStorage("fakechengshang_effect");
const list = lib.card.list const list = lib.card.list
.filter((list) => { .filter((list) => {
const type = get.type(card[2]); const type = get.type(list[2]);
if (type != "basic" && type != "trick") return false; if (type != "basic" && type != "trick") return false;
return storage.some( return storage.some(
(card) => (card) =>
card[0] == list[0] && card[1] == list[1] && card[2] != list[2] card[0] == list[0] && card[1] == list[1] && card[2] != list[2]
); );
}) })
.map((card) => [get.translation(type), "", card[2], card[3]]); .map((card) => [get.translation(get.type2(card[2])), "", card[2], card[3]]);
return ui.create.dialog("承赏", [list, "vcard"]); return ui.create.dialog("承赏", [list, "vcard"]);
}, },
filter(button, player) { filter(button, player) {
@ -3766,21 +3772,19 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
audio: "mobiledanshou", audio: "mobiledanshou",
trigger: { global: "phaseZhunbeiBegin" }, trigger: { global: "phaseZhunbeiBegin" },
filter(event, player) { filter(event, player) {
return ["h", "e", "j"].some((pos) => return ["h", "e", "j"].some((pos) =>{
player.getCards(pos).every((card) => lib.filter.cardDiscardable(card, player)) const cards = player.getCards(pos);
); return cards.length > 0 && cards.every((card) => lib.filter.cardDiscardable(card, player));
});
}, },
async cost(event, trigger, player) { async cost(event, trigger, player) {
let list = [], let list = [],
map = { h: "手牌区", e: "装备区", j: "判定区" }; map = { h: "手牌区", e: "装备区", j: "判定区" };
list.addArray( list.addArray(
["h", "e", "j"] ["h", "e", "j"].filter((pos) => {
.filter((pos) => { const cards = player.getCards(pos);
return player return cards.length > 0 && cards.every((card) => lib.filter.cardDiscardable(card, player));
.getCards(pos) }).map((i) => map[i])
.every((card) => lib.filter.cardDiscardable(card, player));
})
.map((i) => map[i])
); );
list.push("cancel2"); list.push("cancel2");
const { const {
@ -3829,7 +3833,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
result: { control }, result: { control },
} = await player } = await player
.chooseControl("摸牌", "增加摸牌数") .chooseControl("摸牌", "增加摸牌数")
.set("prompt", "胆守:请选择一项") .set("prompt", `胆守:请选择一项(当前为${get.translation(trigger.name)}`)
.set("ai", () => { .set("ai", () => {
const player = get.event().player, const player = get.event().player,
trigger = get.event().getTrigger(); trigger = get.event().getTrigger();