重新格式化,修复部分bug
This commit is contained in:
parent
2c598863b7
commit
f03cd6124e
|
@ -4370,61 +4370,52 @@ game.import("character", function () {
|
||||||
game.addGlobalSkill("dcmoyu_ai");
|
game.addGlobalSkill("dcmoyu_ai");
|
||||||
},
|
},
|
||||||
onremove() {
|
onremove() {
|
||||||
if (!game.hasPlayer((i) => i.hasSkill("dcmoyu"), true))
|
if (!game.hasPlayer(i => i.hasSkill("dcmoyu"), true)) game.removeGlobalSkill("dcmoyu_ai");
|
||||||
game.removeGlobalSkill("dcmoyu_ai");
|
|
||||||
},
|
},
|
||||||
enable: "phaseUse",
|
enable: "phaseUse",
|
||||||
filter(event, player) {
|
filter(event, player) {
|
||||||
return game.hasPlayer((current) => lib.skill.dcmoyu.filterTarget(null, player, current));
|
return game.hasPlayer((current) => lib.skill.dcmoyu.filterTarget(null, player, current));
|
||||||
},
|
},
|
||||||
filterTarget(card, player, target) {
|
filterTarget(card, player, target) {
|
||||||
return (
|
return player != target && !player.getStorage("dcmoyu_clear").includes(target) && target.countGainableCards(player, "hej");
|
||||||
player != target &&
|
|
||||||
!player.getStorage("dcmoyu_clear").includes(target) &&
|
|
||||||
target.countGainableCards(player, "hej")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
async content(event,trigger,player) {
|
async content(event, trigger, player) {
|
||||||
|
const target = event.target;
|
||||||
player.addTempSkill("dcmoyu_clear");
|
player.addTempSkill("dcmoyu_clear");
|
||||||
player.markAuto("dcmoyu_clear", [target]);
|
player.markAuto("dcmoyu_clear", [target]);
|
||||||
await player.gainPlayerCard(target, "hej", true, 1 + player.hasSkill("dcmoyu_add"));
|
await player.gainPlayerCard(target, "hej", true, 1 + player.hasSkill("dcmoyu_add"));
|
||||||
player.removeSkill("dcmoyu_add");
|
player.removeSkill("dcmoyu_add");
|
||||||
const num = player.getStorage("dcmoyu_clear").length;
|
const num = player.getStorage("dcmoyu_clear").length;
|
||||||
const result = await target
|
const result = await target
|
||||||
.chooseToUse(function (card, player, event) {
|
.chooseToUse(
|
||||||
|
function (card, player, event) {
|
||||||
if (get.name(card) != "sha") return false;
|
if (get.name(card) != "sha") return false;
|
||||||
return lib.filter.filterCard.apply(this, arguments);
|
return lib.filter.filterCard.apply(this, arguments);
|
||||||
}, "是否对" +
|
},
|
||||||
get.translation(player) +
|
"是否对" + get.translation(player) + "使用一张无距离限制的【杀】?"
|
||||||
"使用一张无距离限制的【杀】?")
|
)
|
||||||
.set("targetRequired", true)
|
.set("targetRequired", true)
|
||||||
.set("complexSelect", true)
|
.set("complexSelect", true)
|
||||||
.set("filterTarget", function (card, player, target) {
|
.set("filterTarget", function (card, player, target) {
|
||||||
if (
|
if (target != _status.event.sourcex && !ui.selected.targets.includes(_status.event.sourcex)) return false;
|
||||||
target != _status.event.sourcex &&
|
|
||||||
!ui.selected.targets.includes(_status.event.sourcex)
|
|
||||||
)
|
|
||||||
return false;
|
|
||||||
return lib.filter.targetEnabled.apply(this, arguments);
|
return lib.filter.targetEnabled.apply(this, arguments);
|
||||||
})
|
})
|
||||||
.set("sourcex", player)
|
.set("sourcex", player)
|
||||||
.set("num", num)
|
.set("num", num)
|
||||||
.set("oncard", (card) => {
|
.set("oncard", card => {
|
||||||
_status.event.baseDamage = _status.event.getParent().num;
|
_status.event.baseDamage = _status.event.getParent().num;
|
||||||
})
|
})
|
||||||
.forResult();
|
.forResult();
|
||||||
if (result.bool) {
|
if (result.bool) {
|
||||||
if (
|
if (
|
||||||
player.hasHistory("damage", (evt) => {
|
player.hasHistory("damage", evt => {
|
||||||
return evt.card && evt.card.name == "sha" && evt.getParent(4) == event;
|
return evt.card && evt.card.name == "sha" && evt.getParent(4) == event;
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
player.tempBanSkill("dcmoyu");
|
player.tempBanSkill("dcmoyu");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
player.addTempSkill("dcmoyu_add", "phaseChange");
|
player.addTempSkill("dcmoyu_add", "phaseChange");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
subSkill: {
|
subSkill: {
|
||||||
|
@ -4440,6 +4431,7 @@ game.import("character", function () {
|
||||||
},
|
},
|
||||||
add: {
|
add: {
|
||||||
charlotte: true,
|
charlotte: true,
|
||||||
|
mark: true,
|
||||||
marktext: "欲",
|
marktext: "欲",
|
||||||
intro: { content: "欲望加速,下次抢两张!" },
|
intro: { content: "欲望加速,下次抢两张!" },
|
||||||
},
|
},
|
||||||
|
|
|
@ -2363,7 +2363,7 @@ game.import("character", function () {
|
||||||
content: function () {
|
content: function () {
|
||||||
"step 0";
|
"step 0";
|
||||||
var skill = trigger.sourceSkill || trigger.skill;
|
var skill = trigger.sourceSkill || trigger.skill;
|
||||||
player.removeSkill(skill);
|
player.removeSkills(skill);
|
||||||
player.unmarkAuto("dclongsong_remove", [skill]);
|
player.unmarkAuto("dclongsong_remove", [skill]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -2373,9 +2373,9 @@ game.import("character", function () {
|
||||||
audio: "dclongsong",
|
audio: "dclongsong",
|
||||||
trigger: { player: "phaseUseBegin" },
|
trigger: { player: "phaseUseBegin" },
|
||||||
filter(event, player) {
|
filter(event, player) {
|
||||||
return game.hasPlayer((target) => {
|
return game.hasPlayer(target => {
|
||||||
if (target == player) return false;
|
if (target == player) return false;
|
||||||
return target.hasCard((card) => {
|
return target.hasCard(card => {
|
||||||
if (get.position(card) == "h") return true;
|
if (get.position(card) == "h") return true;
|
||||||
return get.color(card) == "red" && lib.filter.canBeGained(card, player, target);
|
return get.color(card) == "red" && lib.filter.canBeGained(card, player, target);
|
||||||
}, "he");
|
}, "he");
|
||||||
|
@ -2387,26 +2387,22 @@ game.import("character", function () {
|
||||||
prompt: get.prompt2("longsong"),
|
prompt: get.prompt2("longsong"),
|
||||||
filterTarget(card, player, target) {
|
filterTarget(card, player, target) {
|
||||||
if (target === player) return false;
|
if (target === player) return false;
|
||||||
const skills = lib.skill.dclongsong
|
const skills = lib.skill.dclongsong.getSkills(target).map(skill => get.translation(skill));
|
||||||
.getSkills(target)
|
|
||||||
.map((skill) => get.translation(skill));
|
|
||||||
if (skills.length) {
|
if (skills.length) {
|
||||||
target.prompt(skills.join("<br>"));
|
target.prompt(skills.join("<br>"));
|
||||||
}
|
}
|
||||||
return target.hasCard((card) => {
|
return ui.selected.cards.length || target.hasCard(card => {
|
||||||
if (get.position(card) == "h") return true;
|
if (get.position(card) == "h") return true;
|
||||||
return (
|
return get.color(card) == "red" && lib.filter.canBeGained(card, player, target);
|
||||||
get.color(card) == "red" &&
|
|
||||||
lib.filter.canBeGained(card, player, target)
|
|
||||||
);
|
|
||||||
}, "he");
|
}, "he");
|
||||||
},
|
},
|
||||||
filterCard: { color: "red" },
|
filterCard: { color: "red" },
|
||||||
selectCard: [0, 1],
|
selectCard: [0, 1],
|
||||||
|
multitarget: true,
|
||||||
ai1(card) {
|
ai1(card) {
|
||||||
const ai2 = get.event("ai2");
|
const ai2 = get.event("ai2");
|
||||||
if (
|
if (
|
||||||
game.hasPlayer((current) => {
|
game.hasPlayer(current => {
|
||||||
return ai2(current) > 0;
|
return ai2(current) > 0;
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
|
@ -2417,43 +2413,26 @@ game.import("character", function () {
|
||||||
ai2(target) {
|
ai2(target) {
|
||||||
const player = get.event("player"),
|
const player = get.event("player"),
|
||||||
att = get.attitude(player, target);
|
att = get.attitude(player, target);
|
||||||
if (
|
if (att > 0 && !target.getGainableCards(player, "he").some(card => get.color(card) == "red")) return 0;
|
||||||
att > 0 &&
|
return lib.skill.dclongsong.getSkills(target).length + (att > 0 ? 0 : Math.max(0, get.effect(target, { name: "shunshou_copy2" }, player, player)));
|
||||||
!target
|
|
||||||
.getGainableCards(player, "he")
|
|
||||||
.some((card) => get.color(card) == "red")
|
|
||||||
)
|
|
||||||
return 0;
|
|
||||||
return (
|
|
||||||
lib.skill.dclongsong.getSkills(target).length +
|
|
||||||
(att > 0
|
|
||||||
? 0
|
|
||||||
: Math.max(
|
|
||||||
0,
|
|
||||||
get.effect(target, { name: "shunshou_copy2" }, player, player)
|
|
||||||
))
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.forResult();
|
.forResult();
|
||||||
},
|
},
|
||||||
async content(event, trigger, player) {
|
async content(event, trigger, player) {
|
||||||
const target = event.targets[0],
|
const target = event.targets[0],
|
||||||
card = event.cards[0],
|
cards = event.cards,
|
||||||
gainableCards = target
|
gainableCards = target.getGainableCards(player, "he").filter(card => get.color(card) == "red");
|
||||||
.getGainableCards(player, "he")
|
if (cards) {
|
||||||
.filter((card) => get.color(card) == "red");
|
await player.give(cards, target);
|
||||||
if (card) {
|
|
||||||
await player.give(card, target);
|
|
||||||
} else {
|
} else {
|
||||||
if (gainableCards.length) {
|
if (gainableCards.length) {
|
||||||
let dialog = ["龙诵:获得" + get.translation(target) + "的一张红色牌"];
|
let dialog = ["龙诵:获得" + get.translation(target) + "的一张红色牌"];
|
||||||
let cards1 = cards.filter((i) => get.position(i) == "h"),
|
let cards1 = gainableCards.filter(i => get.position(i) == "h"),
|
||||||
cards2 = cards.filter((i) => get.position(i) == "e");
|
cards2 = gainableCards.filter(i => get.position(i) == "e");
|
||||||
if (cards1.length) {
|
if (cards1.length) {
|
||||||
dialog.push('<div class="text center">手牌区</div>');
|
dialog.push('<div class="text center">手牌区</div>');
|
||||||
if (player.hasSkillTag("viewHandcard", null, target, true))
|
if (player.hasSkillTag("viewHandcard", null, target, true)) dialog.push(cards1);
|
||||||
dialog.push(cards1);
|
|
||||||
else dialog.push([cards1.randomSort(), "blank"]);
|
else dialog.push([cards1.randomSort(), "blank"]);
|
||||||
}
|
}
|
||||||
if (cards2.length) {
|
if (cards2.length) {
|
||||||
|
@ -2462,14 +2441,10 @@ game.import("character", function () {
|
||||||
}
|
}
|
||||||
const {
|
const {
|
||||||
result: { bool, links },
|
result: { bool, links },
|
||||||
} = await player.chooseButton(dialog, true).set("ai", (button) => {
|
} = await player.chooseButton(dialog, true).set("ai", button => {
|
||||||
const player = get.event("player"),
|
const player = get.event("player"),
|
||||||
target = get.event().getParent().targets[0];
|
target = get.event().getParent().targets[0];
|
||||||
return (
|
return get.value(button.link, player) * get.value(button.link, target) * (1 + Math.random());
|
||||||
get.value(button.link, player) *
|
|
||||||
get.value(button.link, target) *
|
|
||||||
(1 + Math.random())
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
if (!bool) return;
|
if (!bool) return;
|
||||||
await player.gain(links, target, "giveAuto", "bySelf");
|
await player.gain(links, target, "giveAuto", "bySelf");
|
||||||
|
@ -2477,10 +2452,10 @@ game.import("character", function () {
|
||||||
player.popup("杯具");
|
player.popup("杯具");
|
||||||
player.chat("无牌可得?!");
|
player.chat("无牌可得?!");
|
||||||
game.log("但是", target, "没有红色牌可被" + get.translation(player) + "获得!");
|
game.log("但是", target, "没有红色牌可被" + get.translation(player) + "获得!");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let skills = lib.skill.dclongsong.getSkills(target), fromTarget = true;
|
let skills = lib.skill.dclongsong.getSkills(target),
|
||||||
|
fromTarget = true;
|
||||||
if (!skills.length) {
|
if (!skills.length) {
|
||||||
if (!_status.characterlist) {
|
if (!_status.characterlist) {
|
||||||
lib.skill.pingjian.initList();
|
lib.skill.pingjian.initList();
|
||||||
|
@ -2491,7 +2466,7 @@ game.import("character", function () {
|
||||||
const curSkills = lib.character[name][3];
|
const curSkills = lib.character[name][3];
|
||||||
const filteredSkills = lib.skill.dclongsong.getSkills(null, curSkills);
|
const filteredSkills = lib.skill.dclongsong.getSkills(null, curSkills);
|
||||||
if (filteredSkills.length > 0) {
|
if (filteredSkills.length > 0) {
|
||||||
skills = filteredSkills.randomGets();
|
skills = filteredSkills.randomGets(1);
|
||||||
fromTarget = false;
|
fromTarget = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2499,7 +2474,7 @@ game.import("character", function () {
|
||||||
}
|
}
|
||||||
if (!skills.length) return;
|
if (!skills.length) return;
|
||||||
if (!event.isMine() && !event.isOnline()) await game.asyncDelayx();
|
if (!event.isMine() && !event.isOnline()) await game.asyncDelayx();
|
||||||
skills.forEach((skill) => {
|
skills.forEach(skill => {
|
||||||
player.popup(skill, "thunder");
|
player.popup(skill, "thunder");
|
||||||
});
|
});
|
||||||
if (fromTarget) {
|
if (fromTarget) {
|
||||||
|
|
Loading…
Reference in New Issue