Skip to content

Commit 36a998c

Browse files
authored
Merge pull request #3093 from Xiazhiliao/PR-Branch
bugfix;国战部分函数提示补全
2 parents a86f010 + a3ec166 commit 36a998c

File tree

8 files changed

+265
-103
lines changed

8 files changed

+265
-103
lines changed

character/extra/skill.js

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -216,29 +216,48 @@ const skills = {
216216
_status.zc26_huaxiu ??= {};
217217
_status.zc26_huaxiu[name] ??= [];
218218
_status.zc26_huaxiu[name].add(player);
219+
lib.init.sheet(`
220+
.card[data-card-name = "${name}"]>.image {
221+
background-image: url(${lib.assetURL}image/card/${map[name]}.png) !important;
222+
}
223+
`);
219224
},
220225
name,
221226
player,
222227
map
223228
);
224-
function check(name, target) {
225-
if (target.hasVCard({ name }, "e")) {
226-
return true;
229+
function check(name, target, method) {
230+
if (method == "e") {
231+
return target.hasVCard({ name }, "e");
232+
} else if (method == "j") {
233+
return target.hasVCard(card => {
234+
if (!card.storage?.equipEnable) {
235+
return false;
236+
}
237+
return card.cards.some(cardx => cardx.name == name);
238+
}, "j");
227239
}
228-
return target.hasVCard(card => {
229-
if (!card.storage?.equipEnable) {
230-
return false;
231-
}
232-
return card.cards.some(cardx => cardx.name == name);
233-
}, "j");
240+
return false;
234241
}
235242
const removeSkill = get.skillsFromEquips([{ name }]),
236243
addSkill = get.skillsFromEquips([{ name: map[name] }]);
237244
for (let current of game.players) {
238-
current.removeSkill(removeSkill);
239-
if (check(name, current)) {
245+
let keepSkills = Object.values(current.additionalSkills).flat(),
246+
removeSkill2 = removeSkill.slice().removeArray(keepSkills);
247+
if (removeSkill2.length) {
248+
current.removeSkill(removeSkill2);
249+
}
250+
if (check(name, current, "j")) {
240251
current.addSkill(addSkill);
241252
}
253+
if (check(name, current, "e")) {
254+
current.addEquipTrigger({ name: map[name] });
255+
}
256+
let vcards = current.getVCards("e", { name });
257+
while (vcards.length) {
258+
let vcard = vcards.shift();
259+
current.$addVirtualEquip(vcard, vcard.cards);
260+
}
242261
}
243262
}
244263
},
@@ -267,19 +286,26 @@ const skills = {
267286
for (let name of ["duanjian", "serafuku", "yonglv"]) {
268287
if (_status.zc26_huaxiu?.[name]?.includes(player)) {
269288
_status.zc26_huaxiu[name].remove(player);
289+
lib.init.sheet(`
290+
.card[data-card-name = "${name}"]>.image {
291+
background-image: url(${lib.assetURL}image/card/${name}.png) !important;
292+
}
293+
`);
270294
}
271295
}
272296
}, player);
273-
function check(name, target) {
274-
if (target.hasVCard({ name }, "e")) {
275-
return true;
297+
function check(name, target, method) {
298+
if (method == "e") {
299+
return target.hasVCard({ name }, "e");
300+
} else if (method == "j") {
301+
return target.hasVCard(card => {
302+
if (!card.storage?.equipEnable) {
303+
return false;
304+
}
305+
return card.cards.some(cardx => cardx.name == name);
306+
}, "j");
276307
}
277-
return target.hasVCard(card => {
278-
if (!card.storage?.equipEnable) {
279-
return false;
280-
}
281-
return card.cards.some(cardx => cardx.name == name);
282-
}, "j");
308+
return false;
283309
}
284310
const map = {
285311
duanjian: "zc26_zhuge",
@@ -289,6 +315,9 @@ const skills = {
289315
for (let name of ["duanjian", "serafuku", "yonglv"]) {
290316
if (name in _status.zc26_huaxiu && !_status.zc26_huaxiu[name].length) {
291317
game.log(`#y${get.translation({ name })}`, "的效果还原了");
318+
game.broadcastAll(function (name) {
319+
delete _status.zc26_huaxiu[name];
320+
}, name);
292321
lib.card[name] = _status.zc26_huaxiu_origin[name].info;
293322
lib.translate[name] = _status.zc26_huaxiu_origin[name].translate;
294323
lib.translate[`${name}_info`] = _status.zc26_huaxiu_origin[name].translate2;
@@ -300,8 +329,15 @@ const skills = {
300329
if (removeSkill2.length) {
301330
current.removeSkill(removeSkill2);
302331
}
303-
if (check(name, current)) {
332+
if (check(name, current, "j")) {
304333
current.addSkill(addSkill);
334+
} else if (check(name, current, "e")) {
335+
current.addEquipTrigger({ name });
336+
}
337+
let vcards = current.getVCards("e", { name });
338+
while (vcards.length) {
339+
let vcard = vcards.shift();
340+
current.$addVirtualEquip(vcard, vcard.cards);
305341
}
306342
}
307343
}
@@ -393,7 +429,7 @@ const skills = {
393429
return;
394430
}
395431
const { result } = await current
396-
.chooseCardButton(`请选择重铸${trigger.target}的一张手牌`, cards)
432+
.chooseCardButton(`请选择重铸${get.translation(trigger.target)}的一张手牌`, cards)
397433
.set("ai", ({ link }) => {
398434
const { player, target } = get.event();
399435
if (get.attitude(player, target) > 0) {
@@ -586,7 +622,7 @@ const skills = {
586622
const targets = game.dead.slice();
587623
const map = await game.chooseAnyOL(targets, get.info(event.name).chooseControl, [player, event.indexedData]).forResult();
588624
for (const target of targets) {
589-
let source = game.findPlayer(current => current.hasCards(card => card == event.indexedData, "ej")),
625+
let source = game.findPlayer(current => current.hasCard(card => card == event.indexedData, "ej")),
590626
aim;
591627
const control = map.get(target).control;
592628
if (control == "上家") {

character/huicui/skill.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,9 @@ const skills = {
20092009
if (event.card.name != "sha" && get.type(event.card) != "trick") {
20102010
return false;
20112011
}
2012+
if (!event.isFirstTarget) {
2013+
return false;
2014+
}
20122015
return event.target != player;
20132016
},
20142017
logTarget: "target",
@@ -11278,7 +11281,9 @@ const skills = {
1127811281
)
1127911282
.set("filterButton", button => {
1128011283
const { link } = button;
11281-
if (!ui.selected.buttons.length) return typeof link == "number";
11284+
if (!ui.selected.buttons.length) {
11285+
return typeof link == "number";
11286+
}
1128211287
return get.itemtype(link) == "card";
1128311288
})
1128411289
.set("source", source)
@@ -15905,14 +15910,12 @@ const skills = {
1590515910
let result;
1590615911
if (!target.isIn()) {
1590715912
return event.finish();
15908-
}
15909-
else if (!target.countDiscardableCards(player, "he")) {
15913+
} else if (!target.countDiscardableCards(player, "he")) {
1591015914
result = { index: 1 };
15911-
}
15912-
else {
15915+
} else {
1591315916
result = await player
1591415917
.chooseControl()
15915-
.set("choiceList", ["弃置" + str + "的" + get.cnNumber(num) + "张牌", "对" + str + "造成1点伤害"])
15918+
.set("choiceList", ["弃置" + get.translation(target) + "的" + get.cnNumber(num) + "张牌", "对" + get.translation(target) + "造成1点伤害"])
1591615919
.set("ai", function () {
1591715920
const player = _status.event.player;
1591815921
const eff0 = get.effect(target, { name: "guohe_copy2" }, player, player) * Math.min(1.7, target.countCards("he"));

character/onlyOL/skill.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ const skills = {
898898
},
899899
async content(event, trigger, player) {
900900
const target = event.targets[0];
901-
const { result } = await player.discardPlayerCard(Math.max(true, target, "he", target.countCards("h") - target.hp, 1), "allowChooseAll", target);
901+
const { result } = await player.discardPlayerCard(true, target, "he", Math.max(target.countCards("h") - target.hp, 1), "allowChooseAll");
902902
if (result?.bool && result.cards?.length) {
903903
const num = result.cards.reduce((sum, card) => (sum + get.type(card) != "equip" ? 1 : 0), 0);
904904
if (num == 0) {
@@ -1583,8 +1583,8 @@ const skills = {
15831583
player.addTempSkill("olsbmengshi_effect", { player: "dieAfter" });
15841584
player.markAuto("olsbmengshi_effect", event.targets);
15851585
const list = target2.getHp() > target1.getHp() ? [num, -num] : [-num, num];
1586-
await target1.changeHp(list[0]).set("_triggered", null);
1587-
await target2.changeHp(list[1]).set("_triggered", null);
1586+
await target1[list[0] > 0 ? "recover" : "loseHp"](Math.abs(list[0]));
1587+
await target2[list[1] > 0 ? "recover" : "loseHp"](Math.abs(list[1]));
15881588
},
15891589
subSkill: {
15901590
effect: {

character/sp2/skill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ const skills = {
931931
if (!result?.bool) {
932932
return;
933933
}
934-
player.addTempSkill("stardangchen_buff");
934+
player.addTempSkill("stardangchen_buff", { player: "phaseUseEnd" });
935935
player.addMark("stardangchen_buff", num, false);
936936
}
937937
},

character/sp2/translate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ const translates = {
614614
star_dingfeng: "星丁奉",
615615
star_dingfeng_prefix: "星",
616616
stardangchen: "荡尘",
617-
stardangchen_info: "出牌阶段开始时,你可以令一名角色交给你任意张牌,然后你可以弃置X张牌(X为其交给你的牌数)。若你因此弃牌,则当你于本回合使用基本牌或普通锦囊牌时,可以进行一次判定,若判定的点数为X的倍数,则此牌额外结算一次。",
617+
stardangchen_info: "出牌阶段开始时,你可以令一名角色交给你任意张牌,然后你可以弃置X张牌(X为其交给你的牌数)。若你因此弃牌,则当你于本阶段使用基本牌或普通锦囊牌时,可以进行一次判定,若判定的点数为X的倍数,则此牌额外结算一次。",
618618
starjianyu: "翦羽",
619619
starjianyu_info: "锁定技,其他角色在你回合内失去装备区的牌后,你摸一张牌。",
620620
star_wenchou: "星文丑",

character/tw/skill.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9186,6 +9186,9 @@ const skills = {
91869186
if (!player.hasZhuSkill("twpolu")) {
91879187
return false;
91889188
}
9189+
if (event.player != player && player.isDead()) {
9190+
return false;
9191+
}
91899192
if (name == "dieAfter" && event.source && event.source.group == "wu") {
91909193
return true;
91919194
}

character/xianding/skill.js

Lines changed: 37 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8800,15 +8800,26 @@ const skills = {
88008800
//威孙权
88018801
dcwoheng: {
88028802
audio: 2,
8803+
mark: true,
8804+
intro: {
8805+
markcount() {
8806+
const useCnt = game.getRoundHistory("everything", evt => evt.name == "dcwoheng", 0).length;
8807+
return useCnt + 1;
8808+
},
8809+
content() {
8810+
const useCnt = game.getRoundHistory("everything", evt => evt.name == "dcwoheng", 0).length;
8811+
return `令一名其他角色摸${get.cnNumber(useCnt + 1)}张牌或弃置${get.cnNumber(useCnt + 1)}张牌`;
8812+
},
8813+
},
88038814
trigger: { player: "damageEnd" },
88048815
enable: "phaseUse",
88058816
filterTarget: lib.filter.notMe,
88068817
prompt() {
8807-
const num = get.player().countMark("dcwoheng");
8818+
const num = game.getRoundHistory("everything", evt => evt.name == "dcwoheng", 0).length;
88088819
return `令一名其他角色摸${get.cnNumber(num + 1)}张牌或弃置${get.cnNumber(num + 1)}张牌`;
88098820
},
88108821
async cost(event, trigger, player) {
8811-
const num = player.countMark("dcwoheng");
8822+
const num = game.getRoundHistory("everything", evt => evt.name == "dcwoheng", 0).length;
88128823
event.result = await player
88138824
.chooseTarget(get.prompt(event.skill), `令一名其他角色摸${get.cnNumber(num + 1)}张牌或弃置${get.cnNumber(num + 1)}张牌`, lib.filter.notMe)
88148825
.set("ai", target => {
@@ -8819,14 +8830,9 @@ const skills = {
88198830
},
88208831
async content(event, trigger, player) {
88218832
const target = event.target || event.targets[0];
8822-
game.countPlayer(current => {
8823-
if (current.hasSkill("dcwoheng", null, null, false)) {
8824-
current.addTempSkill("dcwoheng_used", "roundStart");
8825-
current.addMark("dcwoheng", 1, false);
8826-
}
8827-
});
8828-
const goon = event.getParent(2).name !== "dcyuhui_buff";
8829-
const num = goon ? player.countMark("dcwoheng") : 1;
8833+
const goon = event.getParent(2).name !== "dcyuhui_buff",
8834+
useCnt = game.getRoundHistory("everything", evt => evt.name == "dcwoheng", 0).length;
8835+
const num = goon ? useCnt : 1;
88308836
if (!target?.isIn()) {
88318837
return;
88328838
}
@@ -8845,7 +8851,7 @@ const skills = {
88458851
"choice",
88468852
get.effect(target, { name: "draw" }, player, player) *
88478853
(() => {
8848-
if (goon && player.countMark("dcwoheng") <= 3) {
8854+
if (goon && useCnt <= 3) {
88498855
if (target.countCards("h") + num === player.countCards("h")) {
88508856
return 100 * num;
88518857
}
@@ -8855,7 +8861,7 @@ const skills = {
88558861
get.effect(target, { name: "guohe_copy2" }, target, player) *
88568862
(() => {
88578863
const numx = Math.min(num, target.countDiscardableCards(target, "he"));
8858-
if (goon && player.countMark("dcwoheng") <= 3) {
8864+
if (goon && useCnt <= 3) {
88598865
if (target.countCards("h") - numx === player.countCards("h")) {
88608866
return 100 * numx;
88618867
}
@@ -8872,16 +8878,28 @@ const skills = {
88728878
} else {
88738879
await target.chooseToDiscard(num, true, "he");
88748880
}
8875-
if (player.countMark("dcwoheng") > 3 || player.countCards("h") !== target.countCards("h")) {
8881+
if (useCnt > 3 || player.countCards("h") !== target.countCards("h")) {
88768882
await player.draw(2);
88778883
if (player.hasSkill("dcwoheng", null, null, false)) {
88788884
player.tempBanSkill("dcwoheng");
88798885
}
88808886
}
88818887
},
8888+
group: "dcwoheng_refresh",
8889+
subSkill: {
8890+
refresh: {
8891+
charlotte: true,
8892+
trigger: { global: "roundStart" },
8893+
forced: true,
8894+
popup: false,
8895+
async content(event, trigger, player) {
8896+
player.markSkill("dcwoheng");
8897+
},
8898+
},
8899+
},
88828900
ai: {
88838901
order(item, player) {
8884-
const num = player.countMark("dcwoheng") + 1;
8902+
const num = game.getRoundHistory("everything", evt => evt.name == "dcwoheng", 0).length + 1;
88858903
if (
88868904
game.hasPlayer(target => {
88878905
if (get.effect(target, { name: "draw" }, player, player) > 0) {
@@ -8904,12 +8922,13 @@ const skills = {
89048922
},
89058923
result: {
89068924
player(player, target) {
8907-
const goon = !get.event()?.getParent()?.name.includes("dcyuhui_buff");
8908-
const num = goon ? player.countMark("dcwoheng") + 1 : 1;
8925+
const goon = !get.event()?.getParent()?.name.includes("dcyuhui_buff"),
8926+
useCnt = game.getRoundHistory("everything", evt => evt.name == "dcwoheng", 0).length;
8927+
const num = goon ? useCnt + 1 : 1;
89098928
return Math.max(
89108929
get.effect(target, { name: "draw" }, player, player) *
89118930
(() => {
8912-
if (goon && player.countMark("dcwoheng") < 3) {
8931+
if (goon && useCnt < 3) {
89138932
if (target.countCards("h") + num === player.countCards("h")) {
89148933
return 100 * num;
89158934
}
@@ -8919,7 +8938,7 @@ const skills = {
89198938
get.effect(target, { name: "guohe_copy2" }, target, player) *
89208939
(() => {
89218940
const numx = Math.min(num, target.countDiscardableCards(target, "he"));
8922-
if (goon && player.countMark("dcwoheng") < 3) {
8941+
if (goon && useCnt < 3) {
89238942
if (target.countCards("h") - numx === player.countCards("h")) {
89248943
return 100 * numx;
89258944
}
@@ -8930,41 +8949,6 @@ const skills = {
89308949
},
89318950
},
89328951
},
8933-
init(player) {
8934-
const num = (() => {
8935-
let num = 0,
8936-
globalHistory = _status.globalHistory;
8937-
for (let i = globalHistory.length - 1; i >= 0; i--) {
8938-
num += globalHistory[i].everything.filter(evt => evt.name === "dcwoheng").length;
8939-
if (globalHistory[i].isRound) {
8940-
break;
8941-
}
8942-
}
8943-
return num;
8944-
})();
8945-
if (num) {
8946-
player.addTempSkill("dcwoheng_used", "roundStart");
8947-
player.addMark("dcwoheng", num, false);
8948-
}
8949-
},
8950-
onremove: true,
8951-
mark: true,
8952-
intro: {
8953-
markcount(num = 0) {
8954-
return num + 1;
8955-
},
8956-
content(num = 0) {
8957-
return `令一名其他角色摸${get.cnNumber(num + 1)}张牌或弃置${get.cnNumber(num + 1)}张牌`;
8958-
},
8959-
},
8960-
subSkill: {
8961-
used: {
8962-
charlotte: true,
8963-
onremove(player) {
8964-
player.clearMark("dcwoheng", false);
8965-
},
8966-
},
8967-
},
89688952
},
89698953
dcyuhui: {
89708954
audio: 2,

0 commit comments

Comments
 (0)