Merge pull request #1231 from PZ157/PR-Branch

回滚拆顺ai.result,bugfix,标签补充
This commit is contained in:
Spmario233 2024-04-19 18:57:22 +08:00 committed by GitHub
commit 6ff751ed6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 109 additions and 232 deletions

View File

@ -2146,138 +2146,48 @@ game.import("card", function () {
}, },
result: { result: {
player: function (player, target) { player: function (player, target) {
let att = get.attitude(player, target), const hs = target.getGainableCards(player, 'h');
hs = target.hasCard( const es = target.getGainableCards(player, 'e');
(card) => lib.filter.canBeGained(card, player, target), const js = target.getGainableCards(player, 'j');
"h" const att = get.attitude(player, target);
), if (att < 0) {
lose = hs, if (!hs.length && !es.some(card => {
gain = att > 0 ? 0.52 : 1.28; return get.value(card, target) > 0 && card != target.getEquip('jinhe');
if (Math.abs(att) < 5.03) { }) && !js.some(card => {
let temp = 0.015 * att * att; var cardj = card.viewAs ? { name: card.viewAs } : card;
if (att < 0) gain = 0.9 + temp; return get.effect(target, cardj, target, player) < 0;
else gain = 0.9 - temp; })) return 0;
} }
target.countCards("e", function (card) { else if (att > 1) {
if ( return (es.some(card => {
card.name != "jinhe" && return get.value(card, target) <= 0;
lib.filter.canBeGained(card, player, target) && }) || js.some(card => {
att * get.value(card, target) < 0 var cardj = card.viewAs ? { name: card.viewAs } : card;
) { return get.effect(target, cardj, target, player) < 0;
lose = true; })) ? 1.5 : 0;
let val = get.value(card, player);
if (val > 0) gain = Math.max(gain, val / 7);
} }
}); return 1;
target.countCards("j", function (card) {
let cardj = card.viewAs ? new lib.element.VCard({ name: card.viewAs }) : card;
if (
lib.filter.canBeGained(card, player, target) &&
att * get.effect(target, cardj, target, target) < 0
) {
lose = true;
if (cardj.name == "lebu") {
let needs = target.needsToDiscard(2);
if (att > 0) gain = Math.max(gain, 1.6 + needs / 10);
} else if (
cardj.name == "shandian" ||
cardj.name == "fulei" ||
cardj.name == "plague"
)
gain = Math.max(gain, 1.5 / Math.max(1, target.hp));
else if (att > 0) gain = Math.max(gain, 1.7);
}
});
if (!lose) return 0;
return gain;
}, },
target: function (player, target) { target: function (player, target) {
let att = get.attitude(player, target), const hs = target.getGainableCards(player, 'h');
hs = target.countCards("h", (card) => const es = target.getGainableCards(player, 'e');
lib.filter.canBeGained(card, player, target) const js = target.getGainableCards(player, 'j');
),
es = target.countCards("e", (card) => if (get.attitude(player, target) <= 0) {
lib.filter.canBeGained(card, player, target) if (hs.length > 0) return -1.5;
), return (es.some(card => {
js = target.countCards("j", (card) => return get.value(card, target) > 0 && card != target.getEquip('jinhe');
lib.filter.canBeGained(card, player, target) }) || js.some(card => {
), var cardj = card.viewAs ? { name: card.viewAs } : card;
noh = !hs || target.hasSkillTag("noh"), return get.effect(target, cardj, target, player) < 0;
noe = !es || target.hasSkillTag("noe"), })) ? -1.5 : 1.5;
check = [-1, att > 0 ? -1.3 : 1.3, att > 0 ? -2.5 : 2.5],
idx = -1;
if (hs) {
idx = 0;
if (noh) check[0] = 0.7;
} }
if (es) { return (es.some(card => {
if (idx < 0) idx = 1; return get.value(card, target) <= 0;
if ( }) || js.some(card => {
target.getEquip("baiyin") && var cardj = card.viewAs ? { name: card.viewAs } : card;
target.isDamaged() && return get.effect(target, cardj, target, player) < 0;
lib.filter.canBeGained(target.getEquip("baiyin"), player, target) })) ? 1.5 : -1.5;
) {
let rec = get.recoverEffect(target, player, target);
if (es == 1 || att * rec > 0) {
let val = 3 - 0.6 * Math.min(5, target.hp);
if (rec > 0) check[1] = val;
else if (rec < 0) check[1] = -val;
}
}
target.countCards("e", function (card) {
let val = get.value(card, target);
if (
card.name == "jinhe" ||
att * val >= 0 ||
!lib.filter.canBeGained(card, player, target)
)
return false;
if (att > 0) {
check[1] = Math.max(1.3, check[1]);
return true;
}
let sub = get.subtype(card);
if (sub == "equip2" || sub == "equip5") val += 4;
else if (sub == "equip1") val *= 0.4 * Math.min(3.6, target.hp);
else val *= 0.6;
if (target.hp < 3 && sub != "equip2" && sub != "equip5") val *= 0.4;
check[1] = Math.min(-0.16 * val, check[1]);
});
if (noe) check[1] += 0.9;
}
if (js) {
let func = function (num) {
if (att > 0) check[2] = Math.max(check[2], num);
else check[2] = Math.min(check[2], 0.6 - num);
};
if (idx < 0) idx = 2;
target.countCards("j", function (card) {
let cardj = card.viewAs
? new lib.element.VCard({ name: card.viewAs })
: card;
if (
!lib.filter.canBeGained(card, player, target) ||
att * get.effect(target, cardj, target, target) >= 0
)
return false;
if (cardj.name == "lebu") func(2.1 + 0.4 * target.needsToDiscard(2));
else if (cardj.name == "bingliang") func(2.4);
else if (
cardj.name == "shandian" ||
cardj.name == "fulei" ||
cardj.name == "plague"
)
func(Math.abs(check[2]) / (1 + target.hp));
else func(2.1);
});
}
if (idx < 0) return 0;
for (let i = idx + 1; i < 3; i++) {
if ((i == 1 && !es) || (i == 2 && !js)) continue;
if ((att > 0 && check[i] > check[idx]) || (att <= 0 && check[i] < check[idx]))
idx = i;
}
return check[idx];
}, },
}, },
tag: { tag: {
@ -2546,92 +2456,38 @@ game.import("card", function () {
}, },
result: { result: {
target: function (player, target) { target: function (player, target) {
let att = get.attitude(player, target), const att = get.attitude(player, target);
hs = target.countCards("h", (card) => const hs = target.getDiscardableCards(player, 'h');
lib.filter.canBeDiscarded(card, player, target) const es = target.getDiscardableCards(player, 'e');
), const js = target.getDiscardableCards(player, 'j');
es = target.countCards("e", (card) => if (!hs.length && !es.length && !js.length) return 0;
lib.filter.canBeDiscarded(card, player, target)
),
js = target.countCards("j", (card) =>
lib.filter.canBeDiscarded(card, player, target)
),
noh = !hs || target.hasSkillTag("noh"),
noe = !es || target.hasSkillTag("noe"),
check = [-1, att > 0 ? -1.3 : 1.3, att > 0 ? -2.5 : 2.5],
idx = -1;
if (hs) {
idx = 0;
if (noh) check[0] = 0.7;
}
if (es) {
if (idx < 0) idx = 1;
if (
target.getEquip("baiyin") &&
target.isDamaged() &&
lib.filter.canBeDiscarded(target.getEquip("baiyin"), player, target)
) {
let rec = get.recoverEffect(target, player, target);
if (es == 1 || att * rec > 0) {
let val = 3 - 0.6 * Math.min(5, target.hp);
if (rec > 0) check[1] = val;
else if (rec < 0) check[1] = -val;
}
}
target.countCards("e", function (card) {
let val = get.value(card, target);
if (
card.name == "jinhe" ||
att * val >= 0 ||
!lib.filter.canBeDiscarded(card, player, target)
)
return false;
if (att > 0) { if (att > 0) {
check[1] = Math.max(1.3, check[1]); if (js.some(card => {
return true; const cardj = card.viewAs ? { name: card.viewAs } : card;
return get.effect(target, cardj, target, player) < 0;
})) return 3;
if (target.isDamaged() && es.some(card => card.name == 'baiyin') &&
get.recoverEffect(target, player, player) > 0) {
if (target.hp == 1 && !target.hujia) return 1.6;
} }
let sub = get.subtype(card); if (es.some(card => {
if (sub == "equip2" || sub == "equip5") val += 4; return get.value(card, target) < 0;
else if (sub == "equip1") val *= 0.4 * Math.min(3.6, target.hp); })) return 1;
else val *= 0.6; return -1.5;
if (target.hp < 3 && sub != "equip2" && sub != "equip5") val *= 0.4;
check[1] = Math.min(-0.16 * val, check[1]);
});
if (noe) check[1] += 0.9;
} }
if (js) { else {
let func = function (num) { const noh = (hs.length == 0 || target.hasSkillTag('noh'));
if (att > 0) check[2] = Math.max(check[2], num); const noe = (es.length == 0 || target.hasSkillTag('noe'));
else check[2] = Math.min(check[2], 0.6 - num); const noe2 = (noe || !es.some(card => {
}; return get.value(card, target) > 0;
if (idx < 0) idx = 2; }));
target.countCards("j", function (card) { const noj = (js.length == 0 || !js.some(card => {
let cardj = card.viewAs const cardj = card.viewAs ? { name: card.viewAs } : card;
? new lib.element.VCard({ name: card.viewAs }) return get.effect(target, cardj, target, player) < 0;
: card; }))
if ( if (noh && noe2 && noj) return 1.5;
!lib.filter.canBeDiscarded(card, player, target) || return -1.5;
att * get.effect(target, cardj, target, target) >= 0
)
return false;
if (cardj.name == "lebu") func(2.1 + 0.4 * target.needsToDiscard(2));
else if (cardj.name == "bingliang") func(2.4);
else if (
cardj.name == "shandian" ||
cardj.name == "fulei" ||
cardj.name == "plague"
)
func(Math.abs(check[2]) / (1 + target.hp));
else func(2.1);
});
} }
if (idx < 0) return 0;
for (let i = idx + 1; i < 3; i++) {
if ((i == 1 && !es) || (i == 2 && !js)) continue;
if ((att > 0 && check[i] > check[idx]) || (att <= 0 && check[i] < check[idx]))
idx = i;
}
return check[idx];
}, },
}, },
tag: { tag: {
@ -2989,7 +2845,7 @@ game.import("card", function () {
cf = Math.pow(get.threaten(target, player), 2); cf = Math.pow(get.threaten(target, player), 2);
if (!num) return -0.01 * cf; if (!num) return -0.01 * cf;
if (target.hp > 2) num--; if (target.hp > 2) num--;
let dist = Math.sqrt(get.distance(player, target, "absolute")); let dist = Math.sqrt(1 + get.distance(player, target, "absolute"));
if (dist < 1) dist = 1; if (dist < 1) dist = 1;
if (target.isTurnedOver()) dist++; if (target.isTurnedOver()) dist++;
return (Math.min(-0.1, -num) * cf) / dist; return (Math.min(-0.1, -num) * cf) / dist;

View File

@ -9416,6 +9416,9 @@ game.import("character", function () {
} }
} }
}, },
ai: {
combo: "nzry_junlve"
},
}, },
nzry_dinghuo: { nzry_dinghuo: {
audio: 2, audio: 2,

View File

@ -7987,7 +7987,7 @@ game.import("character", function () {
}, },
async content(event, trigger, player) { async content(event, trigger, player) {
if (event.cards && event.cards.length) { if (event.cards && event.cards.length) {
await player.dicard(event.cards); await player.discard(event.cards);
lib.skill.dcxieshou.change(player, 1); lib.skill.dcxieshou.change(player, 1);
} else { } else {
player.drawTo(player.maxHp); player.drawTo(player.maxHp);

View File

@ -672,6 +672,9 @@ game.import("character", function () {
player player
); );
}, },
ai: {
combo: "mbzuoyou"
},
}, },
//成济 //成济
mbkuangli: { mbkuangli: {
@ -1732,6 +1735,9 @@ game.import("character", function () {
}, },
}, },
}, },
ai: {
combo: "mbxuetu"
},
}, },
//霍骏 //霍骏
sidai: { sidai: {

View File

@ -3554,6 +3554,9 @@ game.import("character", function () {
"step 1"; "step 1";
player.addSkills("xinmouli"); player.addSkills("xinmouli");
}, },
ai: {
combo: "xingqi"
},
group: ["mibei_fail", "mibei_silent"], group: ["mibei_fail", "mibei_silent"],
derivation: "xinmouli", derivation: "xinmouli",
subSkill: { subSkill: {

View File

@ -18,6 +18,7 @@ game.import("character", function () {
"tengfanglan", "tengfanglan",
"ruiji", "ruiji",
"caoxiancaohua", "caoxiancaohua",
"caoyu",
], ],
sp_sibi: [ sp_sibi: [
"ol_lukai", "ol_lukai",
@ -168,7 +169,6 @@ game.import("character", function () {
"ol_tw_zhangji", "ol_tw_zhangji",
"ol_liwan", "ol_liwan",
"ol_liuyan", "ol_liuyan",
"caoyu",
"liupan", "liupan",
"ol_liupi", "ol_liupi",
], ],
@ -1148,7 +1148,7 @@ game.import("character", function () {
enable: "phaseUse", enable: "phaseUse",
usable: 1, usable: 1,
async content(event, trigger, player) { async content(event, trigger, player) {
let cards = get.cards(3); let num = player.maxHp, cards = get.cards(num);
await game.cardsGotoOrdering(cards); await game.cardsGotoOrdering(cards);
await player.showCards(cards, get.translation(player) + "发动了【易城】"); await player.showCards(cards, get.translation(player) + "发动了【易城】");
if (player.countCards("h")) { if (player.countCards("h")) {
@ -1181,7 +1181,7 @@ game.import("character", function () {
.set("filterOk", (moved) => moved[1].some((i) => !get.owner(i))) .set("filterOk", (moved) => moved[1].some((i) => !get.owner(i)))
.set("processAI", (list) => { .set("processAI", (list) => {
const player = get.event("player"), const player = get.event("player"),
limit = Math.min(3, player.countCards("h")); limit = Math.min(get.event("num"), player.countCards("h"));
let cards = list[0][1].slice(), let cards = list[0][1].slice(),
hs = player.getCards("h"); hs = player.getCards("h");
if ( if (
@ -1216,7 +1216,8 @@ game.import("character", function () {
} }
return list; return list;
} }
}); })
.set("num", num);
if (bool) { if (bool) {
const puts = player.getCards("h", (i) => moved[0].includes(i)); const puts = player.getCards("h", (i) => moved[0].includes(i));
const gains = cards.filter((i) => moved[1].includes(i)); const gains = cards.filter((i) => moved[1].includes(i));
@ -2666,18 +2667,18 @@ game.import("character", function () {
if (!ui.selected.targets.length) return 0; if (!ui.selected.targets.length) return 0;
const target = ui.selected.targets[0]; const target = ui.selected.targets[0];
if ( if (
player.getHistory("useSkill", (evt) => { player.hasAllHistory("useSkill", (evt) => {
return ( return (
evt.skill == "olgongjie" && evt.skill == "olgongjie" &&
(evt.targets || [evt.target]).includes(target) (evt.targets || [evt.target]).includes(target)
); );
}).length && }) &&
player.getHistory("useSkill", (evt) => { player.hasAllHistory("useSkill", (evt) => {
return ( return (
evt.skill == "olxiangxv" && evt.skill == "olxiangxv" &&
(evt.targets || [evt.target]).includes(target) (evt.targets || [evt.target]).includes(target)
); );
}).length })
) { ) {
if (get.attitude(player, target) > 0) return 1; if (get.attitude(player, target) > 0) return 1;
if (player.canSaveCard(card, player)) return 0; if (player.canSaveCard(card, player)) return 0;
@ -2694,18 +2695,18 @@ game.import("character", function () {
ai2(target) { ai2(target) {
const player = get.event("player"); const player = get.event("player");
const goon = const goon =
player.getHistory("useSkill", (evt) => { player.hasAllHistory("useSkill", (evt) => {
return ( return (
evt.skill == "olgongjie" && evt.skill == "olgongjie" &&
(evt.targets || [evt.target]).includes(target) (evt.targets || [evt.target]).includes(target)
); );
}).length && }) &&
player.getHistory("useSkill", (evt) => { player.hasAllHistory("useSkill", (evt) => {
return ( return (
evt.skill == "olxiangxv" && evt.skill == "olxiangxv" &&
(evt.targets || [evt.target]).includes(target) (evt.targets || [evt.target]).includes(target)
); );
}).length, }),
att = get.attitude(player, target); att = get.attitude(player, target);
if (goon) return 5 * att; if (goon) return 5 * att;
if (!!player.countCards("he", (cardx) => player.canSaveCard(cardx, player))) if (!!player.countCards("he", (cardx) => player.canSaveCard(cardx, player)))
@ -2724,12 +2725,12 @@ game.import("character", function () {
player.awakenSkill("olxiangzuo"); player.awakenSkill("olxiangzuo");
await player.give(cards, target); await player.give(cards, target);
if ( if (
player.getHistory("useSkill", (evt) => { player.hasAllHistory("useSkill", (evt) => {
return evt.skill == "olgongjie" && evt.targets.includes(target); return evt.skill == "olgongjie" && evt.targets.includes(target);
}).length && }) &&
player.getHistory("useSkill", (evt) => { player.hasAllHistory("useSkill", (evt) => {
return evt.skill == "olxiangxv" && evt.targets.includes(target); return evt.skill == "olxiangxv" && evt.targets.includes(target);
}).length })
) )
await player.recover(cards.length); await player.recover(cards.length);
}, },
@ -14492,6 +14493,10 @@ game.import("character", function () {
"的选项" "的选项"
); );
}, },
ai: {
combo: "luochong",
neg: true
},
}, },
//SP孟获 //SP孟获
spmanwang: { spmanwang: {
@ -31488,6 +31493,7 @@ game.import("character", function () {
}, },
usable: 1, usable: 1,
direct: true, direct: true,
derivation: ["lingren_jianxiong", "lingren_xingshang"],
content: function () { content: function () {
"step 0"; "step 0";
player player
@ -32848,7 +32854,7 @@ game.import("character", function () {
}, },
spmanwang: function (player) { spmanwang: function (player) {
var num = 4 - player.countMark("spmanwang"); var num = 4 - player.countMark("spmanwang");
var str = "出牌阶段,你可以弃置任意张牌。然后你依次执行以下选项中的前X项:"; var str = "出牌阶段,你可以弃置任意张牌。然后你依次执行以下选项中的前等量项:";
var list = ["⒈获得〖叛侵〗。", "⒉摸一张牌。", "⒊回复1点体力。", "⒋摸两张牌并失去〖叛侵〗。"]; var list = ["⒈获得〖叛侵〗。", "⒉摸一张牌。", "⒊回复1点体力。", "⒋摸两张牌并失去〖叛侵〗。"];
for (var i = 0; i < 4; i++) { for (var i = 0; i < 4; i++) {
if (i == num) { if (i == num) {
@ -34530,7 +34536,7 @@ game.import("character", function () {
"当你的手牌数变为全场最少时你可以获得以下效果本回合结束时将手牌数调整至与当前回合角色手牌数相同至多摸至五张然后若你以此法弃置了至少两张手牌则你回复1点体力。", "当你的手牌数变为全场最少时你可以获得以下效果本回合结束时将手牌数调整至与当前回合角色手牌数相同至多摸至五张然后若你以此法弃置了至少两张手牌则你回复1点体力。",
olxiangzuo: "襄胙", olxiangzuo: "襄胙",
olxiangzuo_info: olxiangzuo_info:
"限定技,当你进入濒死状态时,你可以交给一名其他角色任意张牌,然后若你本回合已对其发动过〖恭节〗和〖相胥〗,你回复等量的体力。", "限定技,当你进入濒死状态时,你可以交给一名其他角色任意张牌,然后若你已对其发动过〖恭节〗和〖相胥〗,你回复等量的体力。",
liyi: "李异", liyi: "李异",
olchanshuang: "缠双", olchanshuang: "缠双",
olchanshuang_info: olchanshuang_info:
@ -34569,7 +34575,7 @@ game.import("character", function () {
ol_liupi: "刘辟", ol_liupi: "刘辟",
olyicheng: "易城", olyicheng: "易城",
olyicheng_info: olyicheng_info:
"出牌阶段限一次,你可以亮出牌堆顶的三张牌,然后你可以以任意手牌交换这些牌,若这三张牌的点数和因此增加,则你可以选择用所有手牌交换这三张牌。最后你将这三张牌置于牌堆顶。", "出牌阶段限一次,你可以亮出牌堆顶的X张牌X为你的体力上限然后你可以以任意手牌交换其中等量张牌若亮出的牌的点数和因此增加则你可以选择用所有手牌交换亮出的牌。最后你将亮出的牌置于牌堆顶。",
sp_sunce: "SP孙策", sp_sunce: "SP孙策",
sp_sunce_prefix: "SP", sp_sunce_prefix: "SP",
olliantao: "连讨", olliantao: "连讨",

View File

@ -9794,6 +9794,9 @@ game.import("character", function () {
player.markSkill("mubing_rewrite"); player.markSkill("mubing_rewrite");
player.chooseDrawRecover(2, true); player.chooseDrawRecover(2, true);
}, },
ai: {
combo: "mubing"
},
derivation: "mubing_rewrite", derivation: "mubing_rewrite",
}, },
refenyin_wufan: { audio: 2 }, refenyin_wufan: { audio: 2 },