Skip to content

Commit

Permalink
Merge pull request #1237 from libccy/PR-Branch
Browse files Browse the repository at this point in the history
v1.10.11.2
  • Loading branch information
Spmario233 authored Apr 19, 2024
2 parents e491a31 + 79b2fd1 commit fe03644
Show file tree
Hide file tree
Showing 37 changed files with 831 additions and 511 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"ecmaVersion": 13,
"sourceType": "module"
}
}
}
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
- [ ] 如果此次PR需要扩展跟进,我已在`扩展适配`中写入详细文档
- [ ] 如果这个PR解决了一个issue,我在`诱因和背景`中明确链接到该issue
- [ ] 我保证该PR中没有随意修改换行符等内容,没有制造出大量的Diff
- [ ] 我保证该PR遵循项目中`.editorconfig``.eslintrc.json``.prettierrc`所规定的代码样式,并且已经通过`prettier`格式化过代码
- [ ] 我保证该PR遵循项目中`.editorconfig``eslint.config.mjs``prettier.config.mjs`所规定的代码样式,并且已经通过`prettier`格式化过代码
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ noname.ico
package-lock.json
package.json
Thumbs.db
bun.lockb
12 changes: 0 additions & 12 deletions .prettierrc

This file was deleted.

280 changes: 68 additions & 212 deletions card/standard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2146,138 +2146,48 @@ game.import("card", function () {
},
result: {
player: function (player, target) {
let att = get.attitude(player, target),
hs = target.hasCard(
(card) => lib.filter.canBeGained(card, player, target),
"h"
),
lose = hs,
gain = att > 0 ? 0.52 : 1.28;
if (Math.abs(att) < 5.03) {
let temp = 0.015 * att * att;
if (att < 0) gain = 0.9 + temp;
else gain = 0.9 - temp;
const hs = target.getGainableCards(player, 'h');
const es = target.getGainableCards(player, 'e');
const js = target.getGainableCards(player, 'j');
const att = get.attitude(player, target);
if (att < 0) {
if (!hs.length && !es.some(card => {
return get.value(card, target) > 0 && card != target.getEquip('jinhe');
}) && !js.some(card => {
var cardj = card.viewAs ? { name: card.viewAs } : card;
return get.effect(target, cardj, target, player) < 0;
})) return 0;
}
target.countCards("e", function (card) {
if (
card.name != "jinhe" &&
lib.filter.canBeGained(card, player, target) &&
att * get.value(card, target) < 0
) {
lose = true;
let val = get.value(card, player);
if (val > 0) gain = Math.max(gain, val / 7);
}
});
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;
else if (att > 1) {
return (es.some(card => {
return get.value(card, target) <= 0;
}) || js.some(card => {
var cardj = card.viewAs ? { name: card.viewAs } : card;
return get.effect(target, cardj, target, player) < 0;
})) ? 1.5 : 0;
}
return 1;
},
target: function (player, target) {
let att = get.attitude(player, target),
hs = target.countCards("h", (card) =>
lib.filter.canBeGained(card, player, target)
),
es = target.countCards("e", (card) =>
lib.filter.canBeGained(card, player, target)
),
js = target.countCards("j", (card) =>
lib.filter.canBeGained(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.canBeGained(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.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;
const hs = target.getGainableCards(player, 'h');
const es = target.getGainableCards(player, 'e');
const js = target.getGainableCards(player, 'j');

if (get.attitude(player, target) <= 0) {
if (hs.length > 0) return -1.5;
return (es.some(card => {
return get.value(card, target) > 0 && card != target.getEquip('jinhe');
}) || js.some(card => {
var cardj = card.viewAs ? { name: card.viewAs } : card;
return get.effect(target, cardj, target, player) < 0;
})) ? -1.5 : 1.5;
}
return check[idx];
return (es.some(card => {
return get.value(card, target) <= 0;
}) || js.some(card => {
var cardj = card.viewAs ? { name: card.viewAs } : card;
return get.effect(target, cardj, target, player) < 0;
})) ? 1.5 : -1.5;
},
},
tag: {
Expand Down Expand Up @@ -2546,92 +2456,38 @@ game.import("card", function () {
},
result: {
target: function (player, target) {
let att = get.attitude(player, target),
hs = target.countCards("h", (card) =>
lib.filter.canBeDiscarded(card, player, target)
),
es = target.countCards("e", (card) =>
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;
}
const att = get.attitude(player, target);
const hs = target.getDiscardableCards(player, 'h');
const es = target.getDiscardableCards(player, 'e');
const js = target.getDiscardableCards(player, 'j');
if (!hs.length && !es.length && !js.length) return 0;
if (att > 0) {
if (js.some(card => {
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;
}
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) {
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.canBeDiscarded(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 (es.some(card => {
return get.value(card, target) < 0;
})) return 1;
return -1.5;
}
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;
else {
const noh = (hs.length == 0 || target.hasSkillTag('noh'));
const noe = (es.length == 0 || target.hasSkillTag('noe'));
const noe2 = (noe || !es.some(card => {
return get.value(card, target) > 0;
}));
const noj = (js.length == 0 || !js.some(card => {
const cardj = card.viewAs ? { name: card.viewAs } : card;
return get.effect(target, cardj, target, player) < 0;
}))
if (noh && noe2 && noj) return 1.5;
return -1.5;
}
return check[idx];
},
},
tag: {
Expand Down Expand Up @@ -2989,7 +2845,7 @@ game.import("card", function () {
cf = Math.pow(get.threaten(target, player), 2);
if (!num) return -0.01 * cf;
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 (target.isTurnedOver()) dist++;
return (Math.min(-0.1, -num) * cf) / dist;
Expand Down
2 changes: 1 addition & 1 deletion character/clan.js
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ game.import("character", function () {
var num = get.cardNameLength(event.card);
return typeof num == "number" && num > 0 && player.countCards("he") > 0;
},
async content(event, trigger, player) {
async cost(event, trigger, player) {
var num = get.cardNameLength(trigger.card),
str = "";
if (player.getDamagedHp() > 0)
Expand Down
13 changes: 9 additions & 4 deletions character/ddd.js
Original file line number Diff line number Diff line change
Expand Up @@ -3361,6 +3361,9 @@ game.import("character", function () {
content() {
player.draw(3);
},
ai: {
combo: "dddfusi"
},
},
dddchashi: {
trigger: { global: "phaseUseBegin" },
Expand Down Expand Up @@ -5113,6 +5116,9 @@ game.import("character", function () {
},
},
},
ai: {
combo: "dddyouxue"
},
},
dddyouxue_old: {
audio: 2,
Expand Down Expand Up @@ -6624,7 +6630,7 @@ game.import("character", function () {
"锁定技。出牌阶段开始时,你选择一名角色,其弃置两张牌,然后你对一名角色造成1点伤害。" +
(player.storage["dddxiaheng_del"]
? ""
: "“若两名角色:均不为你,你失去一点体力上限;为同一名角色,你失去一点体力;然后若以此法对包括你在内三名不同的角色造成伤害,删除双引号里的描述内容”")
: "“若两名角色:均不为你,你失去一点体力上限;为同一名角色,你失去一点体力;然后若以此法对包括你在内三名不同的角色造成伤害,删除双引号里的描述内容”")
);
},
dddshichao(player) {
Expand All @@ -6638,9 +6644,8 @@ game.import("character", function () {
return (
"转换技,摸牌阶段,你" +
(player.hasMark("dddxuanlun_del") ? "" : "可") +
"展示手牌(无牌则不展示),并改为摸其中" +
(!player.storage["dddlanghuai"] ? "包含" : "缺少") +
"花色数的牌。"
"展示手牌(无牌则不展示),并改为摸其中:" +
(player.storage["dddlanghuai"] ? '阴:包含花色数的牌;<span class="bluetext">阳:缺少花色数的牌。</span>' : '<span class="bluetext">阴:包含花色数的牌;</span>阳:缺少花色数的牌。')
);
},
dddxuanlun(player) {
Expand Down
3 changes: 3 additions & 0 deletions character/diy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5467,6 +5467,9 @@ game.import("character", function () {
content: () => {
trigger.forceYingbian = true;
},
ai: {
combo: "asara_shelu"
},
},
yukito_kongwu: {
enable: "phaseUse",
Expand Down
Loading

0 comments on commit fe03644

Please sign in to comment.