import { lib, game, ui, get, ai, _status } from "../noname.js";
game.import("card", function () {
return {
name: "guozhan",
connect: true,
card: {
zhaoshu: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "equip",
subtype: "equip5",
skills: ["zhaoshu_skill"],
content: function () {
cards = cards.filterInD();
if (cards.length && target.isAlive()) {
target.addToExpansion(cards, "gain2").gaintag.add("zhaoshu_skill");
target.addSkill("zhaoshu_skill");
game.addGlobalSkill("zhaoshu_global");
}
},
onEquip: function () {
if (player.isAlive()) {
player.addToExpansion(card, "giveAuto").gaintag.add("zhaoshu_skill");
player.markAuto("zhaoshu_skill", [card]);
player.addSkill("zhaoshu_skill");
game.addGlobalSkill("zhaoshu_global");
}
},
ai: {
order: 12,
value: 3,
useful: 1,
result: {
keepAI: true,
target: 1,
},
},
},
gz_haolingtianxia: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "trick",
enable: true,
filterTarget(card, player, target) {
return target != player && !target.isMinHp();
},
async content(event, trigger, player) {
const target = event.target;
if (!target.isIn()) return;
const str = get.translation(target);
const card = new lib.element.VCard({ name: "sha" });
const targets = game
.filterPlayer((current) => {
return current != target;
})
.sortBySeat();
for (const current of targets) {
if (!target.isIn()) return;
if (!current || !current.isIn() || current.hasSkill("diaohulishan")) continue;
let choiceList = [
"弃置一张牌,视为对" + str + "使用一张【杀】",
"弃置" + str + "一张牌",
],
choices = ["出杀", "弃牌", "cancel2"];
if (current.identity == "wei") {
choiceList[0] = choiceList[0].slice(6);
choiceList[1] = "获得" + choiceList[1].slice(2);
choices[1] = "得牌";
}
if (
!current.canUse(card, target, false) ||
(current.identity != "wei" && !current.countDiscardableCards(current, "he"))
) {
choiceList[0] = '' + choiceList[0] + "";
choices.remove("出杀");
}
if (!target.countCards("he")) {
choiceList[1] = '' + choiceList[1] + "";
choices.remove(current.identity == "wei" ? "得牌" : "弃牌");
}
if (choices.length > 1) {
const {
result: { control },
} = await current
.chooseControl(choices)
.set("prompt", "号令天下:请选择其中一项")
.set("target", target)
.set("ai", () => {
const player = get.event("player"),
target = get.event("target"),
choices = get.event("controls");
const guohe = new lib.element.VCard({ name: "guohe_copy2" }),
shunshou = new lib.element.VCard({ name: "shunshou_copy2" }),
sha = new lib.element.VCard({ name: "sha" });
const num = Math.max(
0,
choices.includes("弃牌") ? get.effect(target, guohe, player) : 0,
choices.includes("得牌") ? get.effect(target, shunshou, player) : 0
);
if (
choices.includes("出杀") &&
get.effect(player, guohe, player) + get.effect(target, sha, player) >
num
)
return "出杀";
if (choices.includes("得牌") && num > 0) return "得牌";
if (choices.includes("弃牌") && num > 0) return "弃牌";
return "cancel2";
});
if (control != "cancel2") {
if (control == "出杀") {
if (current.identity != "wei") await current.chooseToDiscard("he", true);
await current.useCard(card, target, false);
} else
await current[
current.identity == "wei" ? "gainPlayerCard" : "discardPlayerCard"
](target, true, "he").set("boolline", true);
}
}
}
},
ai: {
order: 6,
value: 9,
useful: 6,
tag: {
damage: 1,
discard: 1,
loseCard: 1,
},
result: {
target(player, target) {
return -1.5 * (game.countPlayer() - 1);
},
},
},
},
gz_kefuzhongyuan: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "trick",
enable: true,
filterTarget: true,
selectTarget: [1, Infinity],
content: function () {
"step 0";
var p1 = "请选择【杀】的目标",
p2 = "或点击「取消」摸一张牌";
if (target.identity == "shu") {
p1 += "(伤害+1)";
p2 = "或点击「取消」摸两张牌";
}
var next = target.chooseUseTarget("sha", p1, p2, false);
if (target.identity == "shu")
next.set("oncard", function () {
_status.event.baseDamage++;
});
"step 1";
if (!result.bool) {
target.draw(target.identity == "shu" ? 2 : 1);
}
},
ai: {
wuxie: function (target, card, player, viewer) {
if (get.mode() == "guozhan") {
if (!_status._aozhan) {
if (!player.isMajor()) {
if (!viewer.isMajor()) return 0;
}
}
}
},
order: 4,
value: 9,
useful: 6,
tag: {
gain: 1,
},
result: { target: 1.5 },
},
},
gz_guguoanbang: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "trick",
enable: true,
selectTarget: -1,
toself: true,
filterTarget: function (card, player, target) {
return target == player;
},
modTarget: true,
content: function () {
"step 0";
target.draw(8);
"step 1";
target.chooseToDiscard("请弃置至少六张手牌", [6, target.countCards("h")], true, "h");
if (target.identity != "wu") event.finish();
"step 2";
if (!result.cards || !result.cards.length) event.finish();
event.give_cards = result.cards;
event.given_list = [];
"step 3";
event.give_cards = event.give_cards.filterInD("d");
if (
!event.give_cards.length ||
!game.hasPlayer(function (current) {
return (
current != target &&
current.identity == "wu" &&
!event.given_list.includes(current)
);
})
)
event.finish();
else {
target.chooseButton(["是否将弃置的牌交给其他吴势力角色?", event.give_cards], [1, 2]);
}
"step 4";
if (result.bool) {
event.cards2 = result.links;
target
.chooseTarget(
true,
"选择获得" + get.translation(event.cards2) + "的角色",
function (card, player, target) {
return (
target != player &&
target.identity == "wu" &&
!_status.event.targets.includes(target)
);
}
)
.set("targets", event.given_list);
} else event.finish();
"step 5";
if (result.bool && result.targets && result.targets.length) {
var current = result.targets[0];
target.line(current, "green");
current.gain(event.cards2, "gain2").giver = player;
event.given_list.push(current);
event.goto(3);
}
},
ai: {
wuxie: function (target, card, player, viewer) {
if (get.mode() == "guozhan") {
if (!_status._aozhan) {
if (!player.isMajor()) {
if (!viewer.isMajor()) return 0;
}
}
}
},
order: 6,
value: 9,
useful: 6,
tag: {
draw: 8,
loseCard: 6,
discard: 6,
},
result: {
target: function (player, target) {
if (target.identity != "wu") return 3;
return Math.max(
3,
Math.min(
8,
2 *
game.countPlayer(function (current) {
return current.identity == "wu";
})
)
);
},
},
},
},
gz_wenheluanwu: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "trick",
enable: true,
filterTarget: true,
selectTarget: -1,
ignoreTarget: function (card, player, target) {
return target.countCards("h") == 0;
},
content: function () {
"step 0";
if (!target.countCards("h") || !player.isIn()) event.finish();
else target.showHandcards();
"step 1";
var str = get.translation(target);
player
.chooseControl()
.set("prompt", "文和乱武:请选择一项")
.set("choiceList", [
"令" + str + "弃置两张类型不同的手牌",
"弃置" + str + "的一张手牌",
])
.set("ai", () => {
let target = _status.event.getParent().target,
hs = target.getCards("h"),
type = [],
att = get.attitude(_status.event.player, target);
if (hs.length < 2) return att > 0 ? 1 : 0;
hs.forEach((i) => {
type.add(get.type2(i, target));
});
if (target.identity !== "qun") {
if (Boolean(att > 0) === Boolean(type.length > 1)) return 1;
return 0;
}
if (type.length < 2 || target.hp < 3) return att > 0 ? 1 : 0;
if (hs.length === 2) return att > 0 ? 0 : 1;
return att > 0 ? 1 : 0;
});
"step 2";
if (result.index == 0) {
var list = [],
hs = target.getCards("h");
for (var i of hs) {
if (lib.filter.cardDiscardable(i, target, "gz_wenheluanwu"))
list.add(get.type2(i, target));
if (list.length > 1) break;
}
if (list.length > 1)
target
.chooseToDiscard(
"h",
true,
"请弃置两张类型不同的手牌",
2,
function (card, player) {
if (!ui.selected.cards.length) return true;
return (
get.type2(card, target) != get.type2(ui.selected.cards[0], target)
);
}
)
.set("complexCard", true);
else if (list.length == 1) target.chooseToDiscard("h", true);
else event.finish();
} else {
player.discardPlayerCard(target, "h", true, "visible");
}
"step 3";
if (
target.identity != "qun" ||
!result.bool ||
!result.cards ||
!result.cards.length ||
target.countCards("h") > 0 ||
target.hp < 1
)
event.finish();
else target.draw(Math.min(5, target.hp));
},
ai: {
order: 6,
value: 10,
useful: 6,
tag: {
discard: 1.5,
loseCard: 1.5,
},
result: { target: -1.5 },
},
},
liulongcanjia: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "equip",
subtype: "equip6",
subtypes: ["equip3", "equip4"],
nomod: true,
nopower: true,
//unique:true,
distance: {
globalFrom: -1,
globalTo: +1,
},
skills: ["liulongcanjia"],
ai: {
equipValue: function (card, player) {
if (player.countCards("e", { subtype: ["equip3", "equip4"] }) > 1) return 1;
if (player.hasSkill("gzzongyu")) return 9;
if (
game.hasPlayer(function (current) {
return current.hasSkill("gzzongyu") && get.attitude(player, current) <= 0;
})
)
return 1;
return 7.2;
},
basic: {
equipValue: 7.2,
},
},
},
minguangkai: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "equip",
subtype: "equip2",
skills: ["minguangkai_cancel", "minguangkai_link"],
ai: {
basic: {
equipValue: 6,
},
},
},
dinglanyemingzhu: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "equip",
subtype: "equip5",
nomod: true,
nopower: true,
unique: true,
global: "g_dinglanyemingzhu_ai",
skills: ["dinglanyemingzhu_skill"],
ai: {
equipValue: function (card, player) {
if (player.hasSkill("jubao")) return 8;
if (player.hasSkill("gzzhiheng")) return 6;
if (
game.hasPlayer(function (current) {
return current.hasSkill("jubao") && get.attitude(player, current) <= 0;
})
) {
return 0;
}
return 7;
},
basic: {
equipValue: 6.5,
},
},
},
feilongduofeng: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "equip",
subtype: "equip1",
nomod: true,
nopower: true,
unique: true,
global: "g_feilongduofeng_ai",
distance: { attackFrom: -1 },
skills: ["feilongduofeng", "feilongduofeng3"],
ai: {
equipValue: function (card, player) {
if (player.hasSkill("zhangwu")) return 9;
if (
game.hasPlayer(function (current) {
return current.hasSkill("zhangwu") && get.attitude(player, current) <= 0;
})
) {
return 1;
}
return 8;
},
basic: {
equipValue: 7,
},
},
},
taipingyaoshu: {
audio: true,
fullskin: true,
type: "equip",
subtype: "equip2",
cardcolor: "heart",
nomod: true,
nopower: true,
unique: true,
global: ["g_taipingyaoshu_ai"],
skills: ["taipingyaoshu"],
ai: {
equipValue: function (card, player) {
if (player.hasSkill("wendao")) return 9;
if (
game.hasPlayer(function (current) {
return current.hasSkill("wendao") && get.attitude(player, current) <= 0;
})
) {
return 1;
}
return 6;
},
basic: {
equipValue: 6,
},
},
filterLose: function (card, player) {
if (player.hasSkillTag("unequip2")) return false;
return true;
},
loseDelay: false,
onLose: function () {
var next = game.createEvent("taipingyaoshu");
event.next.remove(next);
var evt = event.getParent();
if (evt.getlx === false) evt = evt.getParent();
evt.after.push(next);
next.player = player;
next.setContent(lib.card.taipingyaoshu.onLosex);
},
onLosex: function () {
"step 0";
player.logSkill("taipingyaoshu");
player.draw(2);
"step 1";
if (player.hp > 1) player.loseHp();
},
},
yuxi: {
audio: true,
mode: ["guozhan"],
fullskin: true,
type: "equip",
subtype: "equip5",
skills: ["yuxi_skill"],
ai: {
equipValue: 9,
},
},
xietianzi: {
audio: true,
fullskin: true,
type: "trick",
enable: function (card, player, event) {
if (get.mode() == "guozhan" && !player.isMajor()) return false;
if (player.hasSkill("xietianzi")) return false;
if (_status.currentPhase != player) return false;
var evt = event || _status.event;
if (evt.name != "chooseToUse") evt = evt.getParent("chooseToUse");
return evt.type == "phase";
},
filterTarget: function (card, player, target) {
return player == target;
},
selectTarget: -1,
content: function () {
var evt = _status.event.getParent("phaseUse");
if (evt && evt.name == "phaseUse") {
evt.skipped = true;
}
target.addTempSkill("xietianzi");
},
ai: {
order: 0.5,
value: 4,
useful: 2,
result: {
target: function (player, target) {
if (target.countCards("h") >= 2) return 1;
return 0;
},
},
},
},
shuiyanqijunx: {
audio: "shuiyanqijun",
fullskin: true,
type: "trick",
filterTarget: function (card, player, target) {
return (
target != player &&
(get.mode() != "guozhan" ||
_status.mode == "yingbian" ||
_status.mode == "free" ||
target.countCards("e") > 0)
);
},
enable: true,
defaultYingbianEffect: "add",
content: function () {
"step 0";
if (event.card.yingbian_all) {
target.discard(
target.getCards("e", function (card) {
return lib.filter.cardDiscardable(card, target, "shuiyanqijunx");
})
);
target.damage("thunder");
event.finish();
} else if (
!target.countCards("e", function (card) {
return lib.filter.cardDiscardable(card, target, "shuiyanqijunx");
})
) {
var next = target.damage();
if (!get.is.single()) game.setNature(next, "thunder", true);
event.finish();
return;
} else
target
.chooseControl("discard_card", "take_damage", function (event, player) {
let eff = get.damageEffect(player, event.player, player, "thunder");
if (eff > 0) return "take_damage";
if (player.hasSkillTag("noe")) return "discard_card";
if (!eff) return "take_damage";
if (
player.isDamaged() &&
player.hasCard(
(card) =>
get.name(card) == "baiyin" &&
get.recoverEffect(player, player, _status.event.player) > 0,
"e"
)
)
return "discard_card";
if (
player.hasCard((card) => get.value(card, player) <= 0, "e") &&
!player.hasCard(
(card) => get.value(card, player) > Math.max(7, 12 - player.hp),
"e"
)
)
return "discard_card";
if (
(player.hp > 2 && player.countCards("e") > 2) ||
(player.hp > 1 && player.countCards("e") > 3)
)
return "take_damage";
return "discard_card";
})
.set("prompt", "水淹七军")
.set(
"prompt2",
"请选择一项:⒈弃置装备区里的所有牌;⒉受到" +
get.translation(player) +
"造成的1点雷电伤害。"
);
"step 1";
if (result.control == "discard_card") {
target.discard(
target.getCards("e", function (card) {
return lib.filter.cardDiscardable(card, target, "shuiyanqijunx");
})
);
} else {
var next = target.damage();
if (!get.is.single()) game.setNature(next, "thunder", true);
}
event.finish();
},
ai: {
canLink: function (player, target, card) {
if (
!target.isLinked() ||
player.hasSkill("jueqing") ||
target.hasSkill("gangzhi") ||
player.hasSkill("gangzhi")
)
return false;
let es = target.getCards("e"),
val = 0;
if (!es.length) return true;
for (let i of es) {
if (i.name == "baiyin" && target.isDamaged() && get.recoverEffect(target))
val += get.value({ name: "tao" }, target);
else val -= get.value(i, target);
}
if (0.15 * val > 2 * get.sgn(get.damageEffect(target, player, target, "thunder")))
return false;
return true;
},
order: 6,
value: 4,
useful: 2,
tag: {
damage: 1,
thunderDamage: 1,
natureDamage: 1,
loseCard: 1,
},
yingbian: function (card, player, targets, viewer) {
if (get.attitude(viewer, player) <= 0) return 0;
var base = 0;
if (get.cardtag(card, "yingbian_all")) {
if (
targets.filter(function (current) {
return (
get.damageEffect(current, player, player, "thunder") > 0 &&
current.countCards("e", function (card) {
return get.value(card, current) <= 0;
}) < 2 &&
current.countCards("e", function (card) {
return get.value(card, current) > 0;
}) > 0
);
}).length
)
base += 6;
}
if (get.cardtag(card, "yingbian_add")) {
if (
game.hasPlayer(function (current) {
return (
!targets.includes(current) &&
lib.filter.targetEnabled2(card, player, current) &&
get.effect(current, card, player, player) > 0
);
})
)
base += 6;
}
return 0;
},
result: {
target: function (player, target, card, isLink) {
let es = target.getCards("e"),
eff = 2 * get.sgn(get.damageEffect(target, player, target, "thunder"));
if (isLink || !es.length) return eff;
let val = 0;
for (let i of es) {
if (i.name == "baiyin" && target.isDamaged() && get.recoverEffect(target))
val += 6;
else val -= get.value(i, target);
}
return Math.max(eff, 0.15 * val);
},
},
},
},
lulitongxin: {
fullskin: true,
audio: true,
type: "trick",
enable: function (card, player) {
if (get.mode() == "versus") return true;
return game.hasPlayer(function (current) {
return current.isMajor();
});
},
mode: ["guozhan", "versus"],
filterTarget: true,
recastable: true,
changeTarget: function (player, targets) {
var target = targets[0];
game.filterPlayer(function (current) {
if (get.mode() == "versus") return current.isFriendOf(target);
return (
current.isMajor() == target.isMajor() &&
current != target &&
!current.hasSkill("diaohulishan")
);
}, targets);
},
content: function () {
if (get.mode() == "versus") {
if (target.isEnemyOf(player)) target.link(true);
else if (target.isLinked()) target.draw();
} else if (target.isLinked()) {
target.draw();
} else {
target.link();
}
},
ai: {
order: 7.5,
value: 4,
useful: 2,
result: {
target: function (player, target) {
if (get.mode() == "versus") {
if (target.isFriendOf(player)) return target.isLinked() ? 1 : 0;
return target.isLinked() ? 0 : -1;
}
return target.isLinked() ? 1 : -1;
},
},
},
},
lianjunshengyan: {
fullskin: true,
audio: true,
type: "trick",
enable: function (card, player) {
if (get.mode() == "guozhan") return !player.isUnseen();
return true;
},
mode: ["guozhan", "boss"],
filterTarget: function (card, player, target) {
if (get.mode() == "guozhan")
return target != player && target.identity != "unknown" && !target.isFriendOf(player);
return true;
},
selectTarget: function () {
return get.mode() == "guozhan" ? 1 : -1;
},
changeTarget: function (player, targets) {
if (get.mode() == "guozhan") {
var target = targets[0];
targets.push(player);
if (target.identity != "ye") {
game.filterPlayer(function (current) {
return (
target != current &&
target.isFriendOf(current) &&
!current.hasSkill("diaohulishan")
);
}, targets);
}
}
} /*
contentBefore:function(){
if(get.mode()=='guozhan'){
var evt=event.getParent();
if(evt&&evt.targets&&evt.targets.includes(player)){
evt.fixedSeat=true;
evt.targets.sortBySeat();
evt.targets.remove(player);
evt.targets.push(player);
}
}
},*/,
content: function () {
"step 0";
if (get.mode() != "guozhan") {
if (player == target) target.draw(game.filterPlayer().length);
else target.chooseDrawRecover(true);
event.finish();
} else {
if (target == player) {
var num = targets.length - 1;
event.num = num;
var damaged = target.maxHp - target.hp;
if (damaged == 0) {
target.draw(num);
event.finish();
} else {
var list = [];
for (var i = Math.min(num, damaged); i >= 0; i--) {
list.push("摸" + (num - i) + "回" + i);
}
target.chooseControl(list).set("prompt", "请分配自己的摸牌数和回复量").ai =
function () {
return 0;
};
}
} else {
target.draw();
}
}
"step 1";
if (target != player) target.link(false);
else if (typeof result.control == "string") {
var index = result.control.indexOf("回");
var draw = parseInt(result.control.slice(1, index));
var recover = parseInt(result.control.slice(index + 1));
if (draw) target.draw(draw);
if (recover) target.recover(recover);
}
},
ai: {
wuxie: function (target, card, player, viewer) {
if (get.mode() == "guozhan") {
if (!_status._aozhan) {
if (!player.isMajor()) {
if (!viewer.isMajor()) return 0;
}
}
}
},
order: 6,
value: 4,
useful: 2,
result: {
target: function (player, target) {
if (player == target) return 2;
return 1;
},
},
},
},
chiling: {
fullskin: true,
audio: true,
type: "trick",
enable: function () {
return game.hasPlayer(function (current) {
return current.isUnseen();
});
},
mode: ["guozhan"],
//global:['g_chiling1','g_chiling2','g_chiling3'],
filterTarget: function (card, player, target) {
return target.isUnseen();
},
selectTarget: -1,
chooseai: function (event, player) {
if (player.hasSkillTag("mingzhi_yes")) return "选项一";
if (_status.event.controls.includes("选项三")) {
if (player.hasSkillTag("mingzhi_no")) return "选项三";
return Math.random() < 0.5 ? "选项一" : "选项三";
} else {
if (_status.event.getParent().nomingzhi) {
if (_status.event.controls.includes("选项二")) return "选项二";
return "选项一";
}
if (player.hasSkillTag("maixie_hp") || player.hp <= 2) return "选项一";
return Math.random() < 0.5 ? "选项一" : "选项二";
}
},
content: function () {
"step 0";
var choiceList = ["明置一张武将牌,然后摸一张牌", "失去1点体力"];
event.nomingzhi = target.hasSkillTag("nomingzhi", false, null, true);
if (event.nomingzhi) {
choiceList.shift();
}
if (target.countCards("he", { type: "equip" })) {
choiceList.push("弃置一张装备牌");
}
target
.chooseControl(lib.card.chiling.chooseai)
.set("prompt", "敕令")
.set("choiceList", choiceList);
"step 1";
var index = result.index;
if (event.nomingzhi) {
index++;
}
if (index == 0) {
target
.chooseControl("主将", "副将", function () {
return Math.floor(Math.random() * 2);
})
.set("prompt", "选择要明置的武将牌");
} else if (index == 1) {
target.loseHp();
event.finish();
} else {
target.chooseToDiscard("he", { type: "equip" }, true);
event.finish();
}
"step 2";
if (result.index == 0) {
target.showCharacter(0);
} else {
target.showCharacter(1);
}
target.draw();
},
destroy: function (card, targetPosition, player, event) {
if (
(event.name != "lose" && event.name != "cardsDiscard") ||
targetPosition != "discardPile"
)
return false;
var evt = event.getParent().relatedEvent;
if (evt && evt.name == "useCard") return false;
return true;
},
onDestroy: function () {
var currentPhase = _status.currentPhase;
if (currentPhase) {
_status.chiling = true;
currentPhase.addTempSkill("g_chiling3");
}
if (!lib.inpile.includes("zhaoshu")) {
lib.inpile.push("zhaoshu");
var card = game.createCard2("zhaoshu", "club", 3);
game.log(card, "被置于了牌堆底");
ui.cardPile.appendChild(card);
game.updateRoundNumber();
}
},
ai: {
order: 6,
result: {
target: -1,
},
tag: {
multitarget: 1,
multineg: 1,
},
},
},
diaohulishan: {
fullskin: true,
audio: true,
type: "trick",
enable: true,
global: "g_diaohulishan",
filterTarget: function (card, player, target) {
return target != player;
},
selectTarget: [1, 2],
content: function () {
target.addTempSkill("diaohulishan");
},
ai: {
order: function (item, player) {
if (!player) player = get.player();
if (
player.hasCard(function (card) {
return [
"gz_haolingtianxia",
"gz_guguoanbang",
"gz_kefuzhongyuan",
"wuzhong",
"yuanjiao",
"lianjunshengyan",
"lulitongxin",
"yiyi",
].includes(get.name(card));
}, "hs")
)
return 3.5;
if (
player.hasCard(function (card) {
return get.name(card) == "taoyuan";
}, "hs")
)
return get.order({ name: "taoyuan" }, player) - 1;
return 9.5;
},
value: 4,
useful: [2, 1],
wuxie: function () {
return 0;
},
result: {
player: function (player, target) {
var att = get.attitude(player, target);
if (target.hp == 1 && att < 0) return 0;
if (
game.hasPlayer(function (current) {
return get.attitude(player, current) < att;
})
) {
var num = 1;
if (target == player.next || target == player.previous) {
num += 0.5;
}
return num;
}
return 0;
},
},
},
},
huxinjing: {
fullskin: true,
type: "equip",
subtype: "equip2",
cardcolor: "club",
skills: ["huxinjing"],
filterTarget: function (card, player, target) {
if (get.mode() == "guozhan" && player != target) return false;
return target.canEquip(card, true);
},
selectTarget: function () {
return get.mode() == "guozhan" ? -1 : 1;
},
toself: false,
ai: {
basic: {
equipValue: 6,
},
},
},
huoshaolianying: {
fullskin: true,
audio: true,
type: "trick",
filterTarget: function (card, player, target) {
if (get.mode() == "guozhan") {
var next = player.getNext();
if (!next) return false;
return target == next || target.inline(next);
}
if (player == target) return false;
if (
game.hasPlayer(function (current) {
return current.isLinked() && current != player;
})
) {
if (!target.isLinked()) return false;
var distance = get.distance(player, target, "absolute");
return !game.hasPlayer(function (current) {
if (target != current && current != player && current.isLinked()) {
var dist = get.distance(player, current, "absolute");
if (dist < distance) {
return true;
}
if (
dist == distance &&
parseInt(current.dataset.position) < parseInt(target.dataset.position)
) {
return true;
}
}
});
} else {
var dist = get.distance(player, target);
return !game.hasPlayer(function (current) {
return current != player && get.distance(player, current) < dist;
});
}
},
enable: true,
selectTarget: -1,
modTarget: true,
content: function () {
target.damage("fire");
},
ai: {
order: 5,
value: 6,
tag: {
damage: 1,
natureDamage: 1,
fireDamage: 1,
},
result: {
target: function (player, target) {
if (target.hasSkillTag("nofire") || target.hasSkillTag("nodamage")) return 0;
if (target.hasSkill("xuying") && target.countCards("h") == 0) return 0;
if (!target.isLinked()) {
return get.damageEffect(target, player, target, "fire");
}
return game.countPlayer(function (current) {
if (current.isLinked()) {
return get.sgn(get.damageEffect(current, player, target, "fire"));
}
});
},
},
},
},
yuanjiao: {
audio: true,
fullskin: true,
type: "trick",
enable: function (card, player) {
if (get.mode() == "guozhan" && player.isUnseen()) return false;
return true;
},
filterTarget: function (card, player, target) {
if (get.mode() != "guozhan") return target.group != player.group;
if (target.identity == "unknown" || player.identity == "unknown") return false;
return player.isEnemyOf(target);
},
content: function () {
target.draw(1, "nodelay");
player.draw(3);
},
ai: {
wuxie: function (target, card, player, viewer) {
if (get.mode() == "guozhan") {
if (!_status._aozhan) {
if (!player.isMajor()) {
if (!viewer.isMajor()) return 0;
}
}
}
},
basic: {
useful: 4,
value: 8,
order: 9,
},
result: {
target: 1,
player: 3,
},
},
},
zhibi: {
audio: true,
fullskin: true,
type: "trick",
enable: true,
recastable: true,
filterTarget: function (card, player, target) {
if (player == target) return false;
return target.countCards("h") || target.isUnseen(2);
},
content: function () {
"step 0";
if (!player.storage.zhibi) {
player.storage.zhibi = [];
}
player.storage.zhibi.add(target);
var controls = [];
if (target.countCards("h")) controls.push("手牌");
if (target.isUnseen(0)) controls.push("主将");
if (target.isUnseen(1)) controls.push("副将");
if (controls.length > 1) {
player.chooseControl(controls).set("ai", function () {
return 1;
});
}
if (controls.length == 0) event.finish();
"step 1";
var content;
var str = get.translation(target) + "的";
if (result.control) {
if (result.control == "手牌") {
content = [str + "手牌", target.getCards("h")];
game.log(player, "观看了", target, "的手牌");
} else if (result.control == "主将") {
content = [str + "主将", [[target.name1], "character"]];
game.log(player, "观看了", target, "的主将");
} else {
content = [str + "副将", [[target.name2], "character"]];
game.log(player, "观看了", target, "的副将");
}
} else if (target.countCards("h")) {
content = [str + "手牌", target.getCards("h")];
game.log(player, "观看了", target, "的手牌");
} else if (target.isUnseen(0)) {
content = [str + "主将", [[target.name1], "character"]];
game.log(player, "观看了", target, "的主将");
} else {
content = [str + "副将", [[target.name2], "character"]];
game.log(player, "观看了", target, "的副将");
}
player.chooseControl("ok").set("dialog", content);
},
mode: ["guozhan"],
ai: {
order: 9.5,
wuxie: function () {
return 0;
},
result: {
player: function (player, target) {
if (player.countCards("h") <= player.hp) return 0;
if (player.storage.zhibi && player.storage.zhibi.includes(target)) return 0;
return target.isUnseen() ? 1 : 0;
},
},
},
},
yiyi: {
audio: true,
fullskin: true,
type: "trick",
enable: true,
filterTarget: function (card, player, target) {
if (get.mode() == "guozhan") {
return target.isFriendOf(player);
} else if (get.is.versus()) {
return player.side == target.side;
} else {
return true;
}
},
selectTarget: function () {
if (get.mode() == "guozhan") return -1;
return [1, 3];
},
content: function () {
target.draw(2);
target.chooseToDiscard(2, "he", true).ai = get.disvalue;
},
ai: {
wuxie: function () {
return 0;
},
basic: {
order: 9,
useful: 1.5,
value: 3,
},
result: {
target(player, target) {
let i,
add = 0,
y = 1,
tars = 0;
if (!ui.selected.cards) y = 0;
if (ui.selected.targets) tars = 0.01 * ui.selected.targets.length;
else tars = 0;
if (target == player)
i = player.countCards("h", function (card) {
if (y > 0 && ui.selected.cards.includes(card)) return false;
if (!y && get.name(card) === "yiyi") {
y = -1;
return false;
}
return true;
});
else i = target.countCards("he");
if (target.hasSkillTag("noh")) add++;
return add + Math.sqrt(i / 3.6 + tars) / 2;
},
},
tag: {
draw: 2,
loseCard: 2,
discard: 2,
multitarget: true,
norepeat: 1,
},
},
},
wuliu: {
fullskin: true,
type: "equip",
subtype: "equip1",
global: "g_wuliu_skill",
distance: { attackFrom: -1 },
ai: {
equipValue: function (card, player) {
if (player.identity == "unknown" || player.identity == "ye") return 2;
return (
2 +
game.countPlayer(function (current) {
return current.isFriendOf(player);
}) /
2
);
},
basic: {
equipValue: 3,
},
},
skills: ["wuliu_skill"],
mode: ["guozhan"],
},
sanjian: {
fullskin: true,
type: "equip",
subtype: "equip1",
distance: { attackFrom: -2 },
ai: {
basic: {
equipValue: 4,
},
},
skills: ["sanjian_skill"],
},
jingfanma: {
fullskin: true,
type: "equip",
subtype: "equip4",
distance: { globalFrom: -1 },
},
},
skill: {
zhaoshu_skill: {
equipSkill: true,
charlotte: true,
enable: "phaseUse",
usable: 1,
filter: function (event, player) {
var cards = player.getExpansions("zhaoshu_cards");
if (cards.length < 4) return false;
var list = [];
for (var i of cards) {
list.add(get.suit(i, false));
if (list.length >= 4) return true;
}
return false;
},
delay: false,
content: function () {
"step 0";
var cards = player.getExpansions("zhaoshu_cards");
player.loseToDiscardpile(cards);
game.delayx();
"step 1";
var list = [
["spade", 12, "gz_haolingtianxia"],
["diamond", 1, "gz_kefuzhongyuan"],
["heart", 1, "gz_guguoanbang"],
["club", 12, "gz_wenheluanwu"],
];
for (var i = 0; i < list.length; i++) {
if (lib.inpile.includes(list[i][2])) list.splice(i--, 1);
}
if (list.length) {
var card = list.randomGet();
lib.inpile.add(card[2]);
player.gain(game.createCard2(card[2], card[0], card[1]), "gain2");
}
},
ai: {
order: 10,
result: { player: 1 },
},
mark: true,
marktext: "诏",
intro: {
name: "诏书",
mark: function (dialog, content, player) {
var content = player.getExpansions("zhaoshu_skill");
dialog.add(content);
dialog.addText(
"