revert拆顺ai.result
This commit is contained in:
parent
00b6347be5
commit
d101393319
278
card/standard.js
278
card/standard.js
|
@ -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)
|
if (att > 0) {
|
||||||
),
|
if (js.some(card => {
|
||||||
js = target.countCards("j", (card) =>
|
const cardj = card.viewAs ? { name: card.viewAs } : card;
|
||||||
lib.filter.canBeDiscarded(card, player, target)
|
return get.effect(target, cardj, target, player) < 0;
|
||||||
),
|
})) return 3;
|
||||||
noh = !hs || target.hasSkillTag("noh"),
|
if (target.isDamaged() && es.some(card => card.name == 'baiyin') &&
|
||||||
noe = !es || target.hasSkillTag("noe"),
|
get.recoverEffect(target, player, player) > 0) {
|
||||||
check = [-1, att > 0 ? -1.3 : 1.3, att > 0 ? -2.5 : 2.5],
|
if (target.hp == 1 && !target.hujia) return 1.6;
|
||||||
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) {
|
if (es.some(card => {
|
||||||
let val = get.value(card, target);
|
return get.value(card, target) < 0;
|
||||||
if (
|
})) return 1;
|
||||||
card.name == "jinhe" ||
|
return -1.5;
|
||||||
att * val >= 0 ||
|
|
||||||
!lib.filter.canBeDiscarded(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) {
|
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: {
|
||||||
|
|
Loading…
Reference in New Issue