noname/mode/brawl.js

5431 lines
168 KiB
JavaScript
Raw Normal View History

2024-04-15 18:46:41 +00:00
"use strict";
game.import("mode", function (lib, game, ui, get, ai, _status) {
2017-04-15 00:25:50 +00:00
return {
2024-04-15 18:46:41 +00:00
name: "brawl",
game: {
syncMenu: true,
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
start: function () {
2018-04-17 07:32:43 +00:00
ui.auto.hide();
2024-04-15 18:46:41 +00:00
if (!lib.storage.scene) {
lib.storage.scene = {};
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (!lib.storage.stage) {
lib.storage.stage = {};
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (!_status.extensionmade) {
_status.extensionmade = [];
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (_status.extensionscene) {
game.save("scene", lib.storage.scene);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (_status.extensionstage) {
game.save("stage", lib.storage.stage);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
var dialog = ui.create.dialog("hidden");
dialog.classList.add("fixed");
dialog.classList.add("scroll1");
dialog.classList.add("scroll2");
dialog.classList.add("fullwidth");
dialog.classList.add("fullheight");
dialog.classList.add("noupdate");
dialog.classList.add("character");
dialog.contentContainer.style.overflow = "visible";
dialog.style.overflow = "hidden";
dialog.content.style.height = "100%";
dialog.contentContainer.style.transition = "all 0s";
if (!lib.storage.directStage) dialog.open();
var packnode = ui.create.div(".packnode", dialog);
2018-04-17 07:32:43 +00:00
lib.setScroll(packnode);
2024-04-15 18:46:41 +00:00
var clickCapt = function () {
var active = this.parentNode.querySelector(".active");
if (this.link == "stage") {
if (get.is.empty(lib.storage.scene)) {
alert("请创建至少1个场景");
2018-04-17 07:32:43 +00:00
return;
}
}
2024-04-15 18:46:41 +00:00
if (active) {
if (active == this) return;
for (var i = 0; i < active.nodes.length; i++) {
2018-04-17 07:32:43 +00:00
active.nodes[i].remove();
2024-04-15 18:46:41 +00:00
if (active.nodes[i].showcaseinterval) {
2018-04-17 07:32:43 +00:00
clearInterval(active.nodes[i].showcaseinterval);
delete active.nodes[i].showcaseinterval;
}
}
2024-04-15 18:46:41 +00:00
active.classList.remove("active");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
this.classList.add("active");
for (var i = 0; i < this.nodes.length; i++) {
2018-04-17 07:32:43 +00:00
dialog.content.appendChild(this.nodes[i]);
}
2024-04-15 18:46:41 +00:00
var showcase = this.nodes[this.nodes.length - 1];
showcase.style.height = dialog.content.offsetHeight - showcase.offsetTop + "px";
if (typeof showcase.action == "function") {
if (showcase.action(showcase._showcased ? false : true) !== false) {
showcase._showcased = true;
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
if (this._nostart) start.style.display = "none";
else start.style.display = "";
game.save("currentBrawl", this.link);
};
var createNode = function (name) {
var info = lib.brawl[name];
var node = ui.create.div(".dialogbutton.menubutton.large", info.name, packnode, clickCapt);
node.style.transition = "all 0s";
var caption = info.name;
var modeinfo = "";
if (info.mode) {
modeinfo = get.translation(info.mode) + "模式";
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (info.submode) {
if (modeinfo) {
modeinfo += " - ";
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
modeinfo += info.submode;
2018-04-17 07:32:43 +00:00
}
var intro;
2024-04-15 18:46:41 +00:00
if (Array.isArray(info.intro)) {
intro = '<ul style="text-align:left;margin-top:0;width:450px">';
if (modeinfo) {
intro += "<li>" + modeinfo;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < info.intro.length; i++) {
intro += "<li>" + info.intro[i];
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
} else {
intro = "";
if (modeinfo) {
intro += "" + modeinfo + "";
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
intro += info.intro;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
var showcase = ui.create.div();
showcase.style.margin = "0px";
showcase.style.padding = "0px";
showcase.style.width = "100%";
showcase.style.display = "block";
showcase.action = info.showcase;
showcase.link = name;
if (info.fullshow) {
node.nodes = [showcase];
showcase.style.height = "100%";
} else {
node.nodes = [
ui.create.div(".caption", caption),
ui.create.div(".text center", intro),
showcase,
2018-04-17 07:32:43 +00:00
];
}
2024-04-15 18:46:41 +00:00
node.link = name;
node._nostart = info.nostart;
if (lib.storage.currentBrawl == name) {
2018-04-17 07:32:43 +00:00
clickCapt.call(node);
}
return node;
2024-04-15 18:46:41 +00:00
};
var clickStart = function () {
var active = packnode.querySelector(".active");
if (active) {
for (var i = 0; i < active.nodes.length; i++) {
if (active.nodes[i].showcaseinterval) {
2018-04-17 07:32:43 +00:00
clearInterval(active.nodes[i].showcaseinterval);
delete active.nodes[i].showcaseinterval;
}
}
var info;
2024-04-15 18:46:41 +00:00
if (active.link.indexOf("stage_") == 0) {
2018-04-17 07:32:43 +00:00
var level;
2024-04-15 18:46:41 +00:00
if (Array.isArray(arguments[0])) {
level = { index: arguments[0][1] };
} else {
level = dialog.content.querySelector(".menubutton.large.active");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (level) {
var stagesave = lib.storage.stage;
var stage = stagesave[active.link.slice(6)];
game.save("lastStage", level.index);
lib.onover.push(function (bool) {
_status.createControl = ui.controls[0];
if (bool && level.index + 1 < stage.scenes.length) {
ui.create.control("下一关", function () {
game.save("directStage", [stage.name, level.index + 1], "brawl");
localStorage.setItem(lib.configprefix + "directstart", true);
2018-04-17 07:32:43 +00:00
game.reload();
});
2024-04-15 18:46:41 +00:00
if (level.index + 1 > stage.level) {
stage.level = level.index + 1;
game.save("stage", stagesave, "brawl");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (stage.mode != "sequal") {
game.save("lastStage", level.index + 1, "brawl");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
} else {
ui.create.control("重新开始", function () {
if (
stage.mode == "sequal" &&
bool &&
level.index == stage.scenes.length - 1
) {
game.save("directStage", [stage.name, 0], "brawl");
} else {
game.save("directStage", [stage.name, level.index], "brawl");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
localStorage.setItem(lib.configprefix + "directstart", true);
2018-04-17 07:32:43 +00:00
game.reload();
});
2024-04-15 18:46:41 +00:00
if (stage.mode == "sequal" && level.index == stage.scenes.length - 1) {
stage.level = 0;
game.save("stage", stagesave, "brawl");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (stage.mode != "sequal") {
game.save("lastStage", level.index, "brawl");
2018-04-17 07:32:43 +00:00
}
}
delete _status.createControl;
});
2024-04-15 18:46:41 +00:00
var scene = stage.scenes[level.index];
info = {
name: scene.name,
intro: scene.intro,
2018-04-17 07:32:43 +00:00
};
2024-04-15 18:46:41 +00:00
for (var i in lib.brawl.scene.template) {
info[i] = get.copy(lib.brawl.scene.template[i]);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (!scene.gameDraw) {
info.content.noGameDraw = true;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
info.content.scene = scene;
} else {
2018-04-17 07:32:43 +00:00
return;
}
2024-04-15 18:46:41 +00:00
} else {
info = lib.brawl[active.link];
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
lib.translate.restart = "返回";
2018-04-17 07:32:43 +00:00
dialog.delete();
2024-04-15 18:46:41 +00:00
ui.brawlinfo = ui.create.system("乱斗", null, true);
lib.setPopped(
ui.brawlinfo,
function () {
var uiintro = ui.create.dialog("hidden");
uiintro.add(info.name);
var intro;
if (Array.isArray(info.intro)) {
intro = '<ul style="text-align:left;margin-top:0;width:450px">';
for (var i = 0; i < info.intro.length; i++) {
intro += "<li>" + info.intro[i];
}
intro += "</ul>";
} else {
intro = info.intro;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
uiintro.add('<div class="text center">' + intro + "</div>");
var ul = uiintro.querySelector("ul");
if (ul) {
ul.style.width = "180px";
}
uiintro.add(ui.create.div(".placeholder"));
return uiintro;
},
250
);
2018-04-17 07:32:43 +00:00
ui.auto.show();
2024-04-15 18:46:41 +00:00
_status.brawl = info.content;
2018-04-17 07:32:43 +00:00
game.switchMode(info.mode);
2024-04-15 18:46:41 +00:00
if (info.init) {
2018-04-17 07:32:43 +00:00
info.init();
}
}
};
2024-04-15 18:46:41 +00:00
var start = ui.create.div(".menubutton.round.highlight", "斗", dialog.content, clickStart);
start.style.position = "absolute";
start.style.left = "auto";
start.style.right = "10px";
start.style.top = "auto";
start.style.bottom = "10px";
start.style.width = "80px";
start.style.height = "80px";
start.style.lineHeight = "80px";
start.style.margin = "0";
start.style.padding = "5px";
start.style.fontSize = "72px";
start.style.zIndex = 3;
start.style.transition = "all 0s";
game.addScene = function (name, clear) {
var scene = lib.storage.scene[name];
var brawl = {
name: name,
intro: scene.intro,
2018-04-17 07:32:43 +00:00
};
2024-04-15 18:46:41 +00:00
for (var i in lib.brawl.scene.template) {
brawl[i] = get.copy(lib.brawl.scene.template[i]);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (!scene.gameDraw) {
brawl.content.noGameDraw = true;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
brawl.content.scene = scene;
lib.brawl["scene_" + name] = brawl;
var node = createNode("scene_" + name);
if (clear) {
2018-04-17 07:32:43 +00:00
game.addSceneClear();
clickCapt.call(node);
2024-04-15 18:46:41 +00:00
_status.sceneChanged = true;
2018-04-17 07:32:43 +00:00
}
};
2024-04-15 18:46:41 +00:00
game.addStage = function (name, clear) {
var stage = lib.storage.stage[name];
var brawl = {
name: name,
intro: stage.intro,
content: {},
2018-04-17 07:32:43 +00:00
};
2024-04-15 18:46:41 +00:00
for (var i in lib.brawl.stage.template) {
brawl[i] = get.copy(lib.brawl.stage.template[i]);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
brawl.content.stage = stage;
lib.brawl["stage_" + name] = brawl;
var node = createNode("stage_" + name);
if (clear) {
2018-04-17 07:32:43 +00:00
game.addStageClear();
clickCapt.call(node);
}
2024-04-15 18:46:41 +00:00
};
game.removeScene = function (name) {
2018-04-17 07:32:43 +00:00
delete lib.storage.scene[name];
2024-04-15 18:46:41 +00:00
game.save("scene", lib.storage.scene);
_status.sceneChanged = true;
for (var i = 0; i < packnode.childElementCount; i++) {
if (packnode.childNodes[i].link == "scene_" + name) {
if (packnode.childNodes[i].classList.contains("active")) {
for (var j = 0; j < packnode.childElementCount; j++) {
if (packnode.childNodes[j].link == "scene") {
2018-04-17 07:32:43 +00:00
clickCapt.call(packnode.childNodes[j]);
}
}
}
packnode.childNodes[i].remove();
break;
}
}
2024-04-15 18:46:41 +00:00
};
game.removeStage = function (name) {
2018-04-17 07:32:43 +00:00
delete lib.storage.stage[name];
2024-04-15 18:46:41 +00:00
game.save("stage", lib.storage.stage);
for (var i = 0; i < packnode.childElementCount; i++) {
if (packnode.childNodes[i].link == "stage_" + name) {
if (packnode.childNodes[i].classList.contains("active")) {
for (var j = 0; j < packnode.childElementCount; j++) {
if (get.is.empty(lib.storage.scene)) {
if (packnode.childNodes[j].link == "scene") {
2018-04-17 07:32:43 +00:00
clickCapt.call(packnode.childNodes[j]);
}
2024-04-15 18:46:41 +00:00
} else {
if (packnode.childNodes[j].link == "stage") {
2018-04-17 07:32:43 +00:00
clickCapt.call(packnode.childNodes[j]);
}
}
}
}
packnode.childNodes[i].remove();
break;
}
}
2024-04-15 18:46:41 +00:00
};
2018-04-17 07:32:43 +00:00
var sceneNode;
2024-04-15 18:46:41 +00:00
for (var i in lib.brawl) {
if (get.config(i) === false) continue;
if (i == "scene") {
sceneNode = createNode(i);
} else {
2018-04-17 07:32:43 +00:00
createNode(i);
}
}
2024-04-15 18:46:41 +00:00
if (sceneNode) {
game.switchScene = function () {
2018-04-17 07:32:43 +00:00
clickCapt.call(sceneNode);
2024-04-15 18:46:41 +00:00
};
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i in lib.storage.scene) {
2018-04-17 07:32:43 +00:00
game.addScene(i);
}
2024-04-15 18:46:41 +00:00
for (var i in lib.storage.stage) {
2018-04-17 07:32:43 +00:00
game.addStage(i);
}
2024-04-15 18:46:41 +00:00
if (!lib.storage.currentBrawl) {
2018-04-17 07:32:43 +00:00
clickCapt.call(packnode.firstChild);
}
2024-04-15 18:46:41 +00:00
game.save("lastStage");
if (lib.storage.directStage) {
var directStage = lib.storage.directStage;
game.save("directStage");
2018-04-17 07:32:43 +00:00
clickStart(directStage);
}
lib.init.onfree();
},
2024-04-15 18:46:41 +00:00
brawl: {
huanhuazhizhan: {
name: "幻化之战",
mode: "identity",
intro: [
"杀死所有其他角色,成为最后的存活者",
"所有角色改为四血白板,依靠灵力值获得技能。灵力值可以通过各种方式获得",
2020-01-11 12:17:57 +00:00
],
2024-04-15 18:46:41 +00:00
showcase: function (init) {
if (init) {
this.nodes = [];
} else {
while (this.nodes.length) {
2020-01-11 12:17:57 +00:00
this.nodes.shift().remove();
}
}
2024-04-15 18:46:41 +00:00
var lx = this.offsetWidth / 2 - 120;
var ly = Math.min(lx, this.offsetHeight / 2 - 60);
var setPos = function (node) {
var i = node.index;
var deg = (Math.PI / 4) * i;
var dx = Math.round(lx * Math.cos(deg));
var dy = Math.round(ly * Math.sin(deg));
node.style.transform = "translate(" + dx + "px," + dy + "px)";
};
var characterz = [
"guyong",
"litong",
"mazhong",
"fuwan",
"chengpu",
"liaohua",
"xinxianying",
"liuyu",
];
for (var i = 0; i < 8; i++) {
var node = ui.create.player(null, true);
2020-01-11 12:17:57 +00:00
this.nodes.push(node);
node.init(characterz[i]);
2024-04-15 18:46:41 +00:00
node.classList.add("minskin");
2020-01-11 12:17:57 +00:00
node.node.marks.remove();
node.node.hp.remove();
node.node.count.remove();
2024-04-15 18:46:41 +00:00
node.style.left = "calc(50% - 60px)";
node.style.top = "calc(50% - 60px)";
node.index = i;
node.style.borderRadius = "100%";
node.node.avatar.style.borderRadius = "100%";
2020-01-11 12:17:57 +00:00
node.node.name.remove();
setPos(node);
this.appendChild(node);
}
2024-04-15 18:46:41 +00:00
var nodes = this.nodes;
this.showcaseinterval = setInterval(function () {
for (var i = 0; i < nodes.length; i++) {
2020-01-11 12:17:57 +00:00
nodes[i].index++;
2024-04-15 18:46:41 +00:00
if (nodes[i].index > 7) {
nodes[i].index = 0;
2020-01-11 12:17:57 +00:00
}
setPos(nodes[i]);
}
2024-04-15 18:46:41 +00:00
}, 1000);
2020-01-11 12:17:57 +00:00
},
2024-04-15 18:46:41 +00:00
init: function () {},
content: {
submode: "normal",
chooseCharacterBefore: function () {
game.identityVideoName = "幻化之战";
var skills = [];
var banned = [
"xinfu_guhuo",
"reguhuo",
"jixi",
"duanchang",
"huashen",
"xinsheng",
"rehuashen",
"rexinsheng",
"jinqu",
"nzry_binglve",
"nzry_huaiju",
"nzry_yili",
"nzry_zhenglun",
"nzry_mingren",
"nzry_zhenliang",
"drlt_qingce",
"new_wuhun",
"qixing",
"kuangfeng",
"dawu",
"baonu",
"wumou",
"ol_wuqian",
"ol_shenfen",
"renjie",
"jilue",
"nzry_junlve",
"nzry_dinghuo",
"drlt_duorui",
"chuanxin",
"cunsi",
"jueqing",
"huilei",
"paiyi",
"fuhun",
"zhuiyi",
"olddanshou",
"yanzhu",
"juexiang",
"jiexun",
"bizhuan",
"tongbo",
"xinfu_zhanji",
"xinfu_jijun",
"xinfu_fangtong",
"xinfu_qianchong",
"pdgyinshi",
"shuliang",
"zongkui",
"guju",
"bmcanshi",
"dingpan",
"xinfu_lingren",
"new_luoyan",
"junwei",
"gxlianhua",
"qizhou",
"fenyue",
"dianhu",
"linglong",
"fenxin",
"mouduan",
"cuorui",
"xinmanjuan",
"xinfu_jianjie",
"jianjie_faq",
"new_meibu",
"xinfu_xingzhao",
"jici",
"xianfu",
"fenyong",
"xuehen",
"yingbin",
"midao",
"yishe",
"yinbing",
"juedi",
"bushi",
"xinfu_dianhua",
"xinfu_falu",
"xinfu_zhenyi",
"lskuizhu",
"pingjian",
"xjshijian",
"fentian",
"zhiri",
"xindan",
"xinzhengnan",
"xinfu_xiaode",
"komari_xueshang",
"qiaosi_map",
];
var characters = [];
for (var name in lib.character) {
if (!lib.character[name]) continue;
if (lib.filter.characterDisabled(name)) continue;
if (name.indexOf("old_") == 0) continue;
var skillsx = lib.character[name][3].slice(0);
lib.character[name][2] = 4;
lib.character[name][3] = [];
if (lib.character[name][4]) lib.character[name][4].remove("hiddenSkill");
characters.push(name);
var list = skillsx.slice(0);
for (var j = 0; j < skillsx.length; j++) {
var info = get.info(skillsx[j]);
if (!info) {
skillsx.splice(j, 1);
list.splice(j--, 1);
continue;
}
if (typeof info.derivation == "string") list.push(info.derivation);
else if (Array.isArray(info.derivation)) list.addArray(info.derivation);
}
for (var j = 0; j < list.length; j++) {
if (skills.includes(list[j]) || banned.includes(list[j])) continue;
var info = get.info(list[j]);
if (
!info ||
info.zhuSkill ||
info.juexingji ||
info.charlotte ||
info.limited ||
info.hiddenSkill ||
info.dutySkill ||
info.groupSkill ||
(info.ai && info.ai.combo)
)
continue;
skills.push(list[j]);
2020-01-11 12:17:57 +00:00
}
}
2024-04-15 18:46:41 +00:00
_status.characterlist = characters;
var pack = {
skills: skills,
pack: {
card: {
hhzz_toulianghuanzhu: {
enable: true,
cardimage: "toulianghuanzhu",
recastable: true,
type: "trick",
filterTarget: function (card, player, target) {
return target.skillH.length > 0;
},
content: function () {
target.removeSkillH(target.skillH.randomGet());
var skills = lib.huanhuazhizhan.skills;
skills.randomSort();
for (var i = 0; i < skills.length; i++) {
if (!target.skillH.includes(skills[i])) {
target.addSkillH(skills[i]);
break;
}
2020-01-13 15:22:52 +00:00
}
2024-04-15 18:46:41 +00:00
},
ai: {
order: 10,
result: {
target: function () {
return 0.5 - Math.random();
},
2020-01-13 15:22:52 +00:00
},
},
},
2024-04-15 18:46:41 +00:00
hhzz_fudichouxin: {
enable: true,
cardimage: "fudichouxin",
type: "trick",
filterTarget: function (card, player, target) {
return target.skillH.length > 0;
},
content: function () {
target.removeSkillH(target.skillH.randomGet());
},
ai: {
order: 10,
result: { target: -1 },
},
2020-01-13 15:22:52 +00:00
},
},
2024-04-15 18:46:41 +00:00
character: {
hhzz_shiona: ["female", "key", 1, ["hhzz_huilei"]],
hhzz_kanade: ["female", "key", 2, ["hhzz_youlian"]],
hhzz_takaramono1: ["male", "qun", 5, ["hhzz_jubao", "hhzz_huizhen"]],
hhzz_takaramono2: ["male", "qun", 3, ["hhzz_jubao", "hhzz_zhencang"]],
2020-01-13 15:22:52 +00:00
},
2024-04-15 18:46:41 +00:00
skill: {
_lingli_damage: {
trigger: { source: "damage" },
forced: true,
popup: false,
filter: function (event, player) {
return event.player == player._toKill;
},
content: function () {
game.log(player, "对击杀目标造成了伤害");
player.changeLingli(trigger.num);
},
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_lingli: {
mark: true,
marktext: "灵",
popup: "聚灵",
intro: {
name: "灵力",
content: "当前灵力点数:# / 5",
},
trigger: {
player: "phaseBeginStart",
},
prompt: "是否消耗2点灵力获得一个技能",
filter: function (event, player) {
return player.storage._lingli > 1;
},
check: function (event, player) {
return player.skillH.length < 3;
},
content: function () {
"step 0";
player.changeLingli(-2);
"step 1";
event.skills = lib.huanhuazhizhan.skills;
var skills = event.skills;
skills.randomSort();
var list = [];
for (var i = 0; i < skills[i].length; i++) {
if (!player.skillH.includes(skills[i])) list.push(skills[i]);
if (list.length == 3) break;
}
if (!list.length) {
event.finish();
return;
}
if (player.storage._lingli > 0) list.push("刷新");
event.list = list;
var dialog = game.getSkillDialog(event.list, "选择获得一个技能");
player.chooseControl(event.list).set("ai", function () {
return 0;
}).dialog = dialog;
"step 2";
if (result.control == "刷新") {
player.changeLingli(-1);
event.goto(1);
return;
}
event.skill = result.control;
if (player.skillH.length == 3) {
event.lose = true;
player.chooseControl(player.skillH).prompt =
"选择失去1个已有技能";
}
"step 3";
if (event.lose) player.removeSkillH(result.control);
player.addSkillH(event.skill);
},
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_lingli_round: {
trigger: { global: "roundStart" },
forced: true,
popup: false,
filter: function (event, player) {
return _status._aozhan != true && game.roundNumber > 1;
},
content: function () {
player.changeLingli(1);
},
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_lingli_draw: {
enable: "phaseUse",
filter: function (event, player) {
return player.storage._lingli > 0;
},
content: function () {
2023-11-06 18:07:27 +00:00
player.changeLingli(-1);
2024-04-15 18:46:41 +00:00
player.draw();
},
delay: 0,
ai: {
order: 10,
result: {
player: function (player) {
return player.storage._lingli -
2 * (3 - player.skillH.length) >
0
? 1
: 0;
},
2020-01-22 06:04:55 +00:00
},
2020-01-11 12:17:57 +00:00
},
},
2024-04-15 18:46:41 +00:00
_lingli_save: {
trigger: { target: "useCardToTargeted" },
forced: true,
popup: false,
filter: function (event, player) {
return event.card.name == "tao" && player == event.player._toSave;
},
content: function () {
game.log(trigger.player, "帮助了保护目标");
trigger.player.changeLingli(1);
},
2020-01-11 12:17:57 +00:00
},
2024-04-15 18:46:41 +00:00
_hhzz_qiankunbagua: {
trigger: { player: "phaseAfter" },
forced: true,
forceDie: true,
popup: false,
filter: function (event, player) {
return (
(_status._aozhan &&
!player.getStat("damage") &&
player.isAlive()) ||
event._lastDead != undefined
);
},
content: function () {
"step 0";
if (_status._aozhan && !player.getStat("damage")) {
player.loseHp();
player.changeLingli(1);
game.log(player, "本回合内未造成伤害,触发死战模式惩罚");
2020-01-11 12:17:57 +00:00
}
2024-04-15 18:46:41 +00:00
if (trigger._lastDead == undefined) event.goto(2);
"step 1";
var type = get.rand(1, 8);
event.type = type;
trigger._lastDead.playerfocus(1200);
player.$fullscreenpop(
"乾坤八卦·" +
["离", "坎", "乾", "震", "兑", "艮", "巽", "坤"][
type - 1
],
get.groupnature(trigger._lastDead.group, "raw")
);
game.delay(1.5);
"step 2";
var type = event.type;
switch (type) {
case 1: {
game.countPlayer(function (current) {
current.loseHp();
2020-01-11 12:17:57 +00:00
});
2024-04-15 18:46:41 +00:00
break;
}
case 2: {
game.countPlayer(function (current) {
current.draw(2, "nodelay");
});
break;
}
case 3: {
trigger._lastDead.revive(3);
trigger._lastDead.draw(3);
break;
}
case 4: {
game.countPlayer(function (current) {
var he = current.getCards("he");
if (he.length)
current.discard(he.randomGet()).delay = false;
});
break;
}
case 5: {
game.countPlayer(function (current) {
current.changeLingli(1);
});
break;
}
case 6: {
var cards = [];
game.countPlayer(function (current) {
var card = get.cardPile(function (card) {
return (
!cards.includes(card) &&
get.type(card) == "equip"
);
});
if (card) {
cards.push(card);
current.$gain(card, "gain2");
current.gain(card);
}
});
break;
}
case 7: {
game.countPlayer(function (current) {
if (current.skillH.length < 3) {
var skills = lib.huanhuazhizhan.skills;
skills.randomSort();
for (var i = 0; i < skills.length; i++) {
if (!current.skillH.includes(skills[i])) {
current.addSkillH(skills[i]);
break;
}
2020-01-11 12:17:57 +00:00
}
}
2024-04-15 18:46:41 +00:00
});
break;
}
case 8: {
trigger._lastDead.revive(null, false);
trigger._lastDead.uninit();
trigger._lastDead.init(
[
"hhzz_shiona",
"hhzz_kanade",
"hhzz_takaramono1",
"hhzz_takaramono2",
].randomGet()
);
trigger._lastDead.skillH =
lib.character[trigger._lastDead.name][3].slice(0);
trigger._lastDead.addSkill("hhzz_noCard");
break;
}
2020-01-11 12:17:57 +00:00
}
2024-04-15 18:46:41 +00:00
"step 3";
if (game.playerx().length <= 4 && !_status._aozhan) {
game.countPlayer2(function (current) {
delete current._toKill;
delete current._toSave;
});
ui.huanhuazhizhan.innerHTML = "死战模式";
_status._aozhan = true;
game.playBackgroundMusic();
trigger._lastDead.$fullscreenpop(
"死战模式",
get.groupnature(trigger._lastDead.group, "raw") || "fire"
);
} else game.randomMission();
},
2020-01-11 12:17:57 +00:00
},
2024-04-15 18:46:41 +00:00
hhzz_noCard: {
mod: {
cardEnabled: function () {
return false;
},
cardSavable: function () {
return false;
},
cardRespondable: function () {
return false;
},
},
2020-01-13 15:22:52 +00:00
},
2024-04-15 18:46:41 +00:00
hhzz_huilei: {
trigger: { player: "die" },
forced: true,
forceDie: true,
skillAnimation: true,
logTarget: "source",
filter: function (event, player) {
return event.source != undefined;
},
content: function () {
var source = trigger.source;
var cards = source.getCards("he");
if (cards.length) source.discard(cards);
},
ai: {
effect: {
target: function (card, player, target) {
if (get.tag(card, "damage")) return [-5, 0];
},
},
},
2020-01-15 15:30:03 +00:00
},
2024-04-15 18:46:41 +00:00
hhzz_youlian: {
trigger: { player: "die" },
forced: true,
forceDie: true,
skillAnimation: true,
logTarget: "source",
filter: function (event, player) {
return event.source != undefined;
},
content: function () {
var source = trigger.source;
var cards = source.getCards("he");
if (cards.length) source.discard(cards);
var skills = source.skillH;
if (skills.length) source.removeSkillH(skills.randomGet());
},
ai: {
effect: {
target: function (card, player, target) {
if (get.tag(card, "damage")) return [-5, 0];
},
},
},
2020-01-15 15:30:03 +00:00
},
2024-04-15 18:46:41 +00:00
hhzz_zhencang: {
trigger: { player: "die" },
forced: true,
filter: function (event, player) {
return event.source != undefined;
},
forceDie: true,
logTarget: "source",
content: function () {
var source = trigger.source;
source.draw();
if (source.skillH.length == 3)
source.removeSkillH(source.skillH.randomGet());
var skills = lib.huanhuazhizhan.skills;
skills.randomSort();
for (var i = 0; i < skills.length; i++) {
if (!source.skillH.includes(skills[i])) {
source.addSkillH(skills[i]);
break;
}
2020-01-13 15:22:52 +00:00
}
2024-04-15 18:46:41 +00:00
},
2020-01-13 15:22:52 +00:00
},
2024-04-15 18:46:41 +00:00
hhzz_huizhen: {
trigger: { player: "die" },
forced: true,
forceDie: true,
logTarget: "source",
filter: function (event, player) {
return event.source != undefined;
},
content: function () {
var source = trigger.source;
source.draw(3);
if (source.skillH.length == 3)
source.removeSkillH(source.skillH.randomGet());
var skills = lib.huanhuazhizhan.skills;
skills.randomSort();
for (var i = 0; i < skills.length; i++) {
if (!source.skillH.includes(skills[i])) {
source.addSkillH(skills[i]);
break;
}
2020-01-13 15:22:52 +00:00
}
2024-04-15 18:46:41 +00:00
},
2020-01-15 15:30:03 +00:00
},
2024-04-15 18:46:41 +00:00
hhzz_jubao: {
trigger: { player: "damage" },
forced: true,
logTarget: "source",
filter: function (event, player) {
return event.source != undefined && player.countCards("he") > 0;
},
content: function () {
var cards = player.getCards("he");
cards.randomSort();
cards = cards.slice(0, trigger.num);
trigger.source.gain("give", cards, player);
},
ai: {
effect: {
target: function (card, player, target) {
if (get.tag(card, "damage")) return [15, 0];
},
},
},
2020-01-13 15:22:52 +00:00
},
},
2024-04-15 18:46:41 +00:00
translate: {
_lingli: "聚灵",
_lingli_bg: "灵",
_lingli_draw: "聚灵",
hhzz_huilei: "挥泪",
hhzz_youlian: "犹怜",
hhzz_zhencang: "珍藏",
hhzz_huizhen: "汇珍",
hhzz_jubao: "聚宝",
hhzz_huilei_info: "锁定技,杀死你的角色弃置所有的牌。",
hhzz_youlian_info: "锁定技,杀死你的角色弃置所有牌并随机失去一个技能。",
hhzz_zhencang_info:
"锁定技,杀死你的角色摸一张牌并随机获得一个技能(已满则先随机移除一个)。",
hhzz_huizhen_info:
"锁定技,杀死你的角色摸三张牌并随机获得一个技能(已满则先随机移除一个)。",
hhzz_jubao_info:
"锁定技当你受到伤害的点数确定时伤害来源随机获得你区域内的X张牌X为伤害点数。",
hhzz_shiona: "汐奈",
hhzz_kanade: "立华奏",
hhzz_takaramono1: "坚实宝箱",
hhzz_takaramono2: "普通宝箱",
hhzz_toulianghuanzhu: "偷梁换柱",
hhzz_fudichouxin: "釜底抽薪",
hhzz_toulianghuanzhu_info:
"出牌阶段,对一名角色使用,随机更换其一个技能。可重铸。",
hhzz_fudichouxin_info: "出牌阶段,对一名角色使用,随机弃置其一个技能。",
nei: " ",
nei2: " ",
刷新_info: "消耗1点灵力值刷新上述技能。",
},
},
get: {
rawAttitude: function (from, to) {
if (from == to || to == from._toSave) return 10;
if (to == from._toKill) return -30;
return -10;
},
},
eltc: {
gameDraw: function () {
var end = player;
var numx;
var num = function (player) {
return player._hSeat > 5 ? 5 : 4;
};
do {
if (typeof num == "function") {
numx = num(player);
2020-01-15 15:30:03 +00:00
}
2024-04-15 18:46:41 +00:00
if (player._hSeat > 6) player.changeLingli(1);
player.directgain(get.cards(numx));
player = player.next;
} while (player != end);
2020-01-13 15:22:52 +00:00
},
2024-04-15 18:46:41 +00:00
},
eltp: {
addSkillH: function (skill) {
this.skillH.add(skill);
this.addSkillLog.apply(this, arguments);
},
removeSkillH: function (skill) {
this.skillH.remove(skill);
game.log(this, "失去了技能", "#g【" + get.translation(skill) + "】");
this.removeSkill(skill);
},
dieAfter: function () {
var evt = _status.event.getParent("phase");
if (evt) evt._lastDead = this;
if (game.playerx().length == 1) game.over(game.me.isAlive());
},
$dieAfter: function () {},
hasUnknown: function () {
return false;
},
isUnknown: function () {
return false;
},
getEnemies: function () {
var list = game.playerx();
list.remove(this);
return list;
},
dieAfter2: function (source) {
if (source && this.name.indexOf("hhzz_") != 0) {
if (source._toKill == this) game.log(source, "击杀目标成功");
source.draw(this == source._toKill ? 2 : 1);
source.changeLingli(this == source._toKill ? 3 : 2);
}
if (!_status._aozhan) {
var that = this;
game.countPlayer(function (current) {
if (current._toSave == that) {
game.log(current, "保护失败");
var cards = current.getCards("he");
if (cards.length) current.discard(cards.randomGets(4));
2020-01-13 15:22:52 +00:00
}
2024-04-15 18:46:41 +00:00
});
2020-01-13 15:22:52 +00:00
}
},
2024-04-15 18:46:41 +00:00
logAi: function () {},
changeLingli: function (num) {
if (typeof num != "number") num = 1;
if (typeof this.storage._lingli != "number") this.storage._lingli = 0;
if (num > 0) {
num = Math.min(num, 5 - this.storage._lingli);
if (num < 1) return;
game.log(this, "获得了", "#y" + get.cnNumber(num) + "点", "灵力");
} else {
if (-num > this.storage._lingli) num = -this.storage._lingli;
if (num == 0) return;
game.log(this, "失去了", "#y" + get.cnNumber(-num) + "点", "灵力");
2020-01-11 12:17:57 +00:00
}
2024-04-15 18:46:41 +00:00
this.storage._lingli += num;
this.markSkill("_lingli");
},
2020-01-15 15:30:03 +00:00
},
2024-04-15 18:46:41 +00:00
game: {
playerx: function () {
return game.filterPlayer(function (current) {
if (current.name.indexOf("hhzz_") == 0) return;
return true;
2020-01-15 15:30:03 +00:00
});
2024-04-15 18:46:41 +00:00
},
randomMission: function () {
if (_status._aozhan) return;
if (!ui.huanhuazhizhan) {
ui.huanhuazhizhan = ui.create.div(".touchinfo.left", ui.window);
if (ui.time3) ui.time3.style.display = "none";
2020-01-11 12:17:57 +00:00
}
2024-04-15 18:46:41 +00:00
var players = game.playerx();
for (var i = 0; i < players.length; i++) {
var player = players[i];
var list = players.slice(0).randomSort();
list.remove(player);
player._toKill = list[0];
player._toSave = list[1];
2020-01-11 12:17:57 +00:00
}
2024-04-15 18:46:41 +00:00
ui.huanhuazhizhan.innerHTML =
"击杀" +
get.translation(game.me._toKill) +
",保护" +
get.translation(game.me._toSave);
},
getSkillDialog: function (skills, prompt) {
var dialog = ui.create.dialog("hidden", "forcebutton");
if (prompt) dialog.addText(prompt);
for (var i = 0; i < skills.length; i++) {
dialog.add(
'<div class="popup pointerdiv" style="width:80%;display:inline-block"><div class="skill">【' +
get.translation(skills[i]) +
"】</div><div>" +
lib.translate[skills[i] + "_info"] +
"</div></div>"
);
2020-01-13 15:22:52 +00:00
}
2024-04-15 18:46:41 +00:00
dialog.addText(" <br> ");
return dialog;
},
chooseCharacter: function () {
var next = game.createEvent("chooseCharacter");
next.showConfig = true;
next.setContent(function () {
"step 0";
game.zhu = game.players.randomGet();
var i = 1;
var current = game.zhu;
while (true) {
current.skillH = [];
current._hSeat = i;
current.identity = "nei";
current.setNickname(get.cnNumber(i, true) + "号位");
for (var ii in lib.huanhuazhizhan.eltp)
current[ii] = lib.huanhuazhizhan.eltp[ii];
current = current.next;
i++;
if (current == game.zhu) break;
}
ui.arena.classList.add("choose-character");
game.me.chooseButton(
[
"请选择角色形象",
[_status.characterlist.randomRemove(5), "character"],
],
true
).onfree = true;
"step 1";
game.me.init(result.links[0]);
var list = ["xiandeng", "shulv", "xisheng"];
game.me.chooseControl(list).dialog = game.getSkillDialog(
list,
"选择要获得的初始技能"
);
"step 2";
var list = [
"_lingli",
"_lingli_round",
"_lingli_draw",
"_lingli_save",
"_hhzz_qiankunbagua",
"_lingli_damage",
];
for (var i = 0; i < list.length; i++) {
game.addGlobalSkill(list[i]);
}
game.me.addSkillH(result.control);
game.countPlayer(function (current) {
if (!current.name) {
current.init(_status.characterlist.randomRemove(1)[0]);
current.addSkillH(
["xiandeng", "shulv", "xisheng"].randomGet()
);
}
current.storage._lingli = 0;
current.markSkill("_lingli");
});
game.showIdentity(true);
"step 3";
game.randomMission();
var list = [
game.createCard("hhzz_fudichouxin"),
game.createCard("hhzz_toulianghuanzhu"),
game.createCard("hhzz_toulianghuanzhu"),
game.createCard("hhzz_toulianghuanzhu"),
];
for (var i = 0; i < list.length; i++) {
ui.cardPile.insertBefore(
list[i],
ui.cardPile.childNodes[
get.rand(ui.cardPile.childElementCount)
]
);
}
game.updateRoundNumber();
"step 4";
setTimeout(function () {
ui.arena.classList.remove("choose-character");
}, 500);
_status.videoInited = true;
game.addVideo("arrangeLib", null, {
skill: {
_lingli_damage: {},
_lingli: {
mark: true,
marktext: "灵",
popup: "聚灵",
intro: {
name: "灵力",
content: "当前灵力点数:# / 5",
},
},
_lingli_round: {},
_lingli_draw: {},
_lingli_save: {},
hhzz_noCard: {},
hhzz_huilei: {
skillAnimation: true,
},
hhzz_youlian: {
skillAnimation: true,
},
hhzz_zhencang: {},
hhzz_huizhen: {},
hhzz_jubao: {},
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
card: {
hhzz_toulianghuanzhu: {
cardimage: "toulianghuanzhu",
},
hhzz_fudichouxin: {
cardimage: "fudichouxin",
},
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
character: {
hhzz_shiona: ["female", "key", 1, ["hhzz_huilei"]],
hhzz_kanade: ["female", "key", 2, ["hhzz_youlian"]],
hhzz_takaramono1: [
"male",
"qun",
5,
["hhzz_jubao", "hhzz_huizhen"],
],
hhzz_takaramono2: [
"male",
"qun",
3,
["hhzz_jubao", "hhzz_zhencang"],
],
2020-03-19 13:24:54 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
_lingli: "聚灵",
_lingli_bg: "灵",
_lingli_draw: "聚灵",
hhzz_huilei: "挥泪",
hhzz_youlian: "犹怜",
hhzz_zhencang: "珍藏",
hhzz_huizhen: "汇珍",
hhzz_jubao: "聚宝",
hhzz_huilei_info: "锁定技,杀死你的角色弃置所有的牌。",
hhzz_youlian_info:
"锁定技,杀死你的角色弃置所有牌并随机失去一个技能。",
hhzz_zhencang_info:
"锁定技,杀死你的角色摸一张牌并随机获得一个技能(已满则先随机移除一个)。",
hhzz_huizhen_info:
"锁定技,杀死你的角色摸三张牌并随机获得一个技能(已满则先随机移除一个)。",
hhzz_jubao_info:
"锁定技当你受到伤害的点数确定时伤害来源随机获得你区域内的X张牌X为伤害点数。",
nei: " ",
nei2: " ",
hhzz_shiona: "汐奈",
hhzz_kanade: "立华奏",
hhzz_takaramono1: "坚实宝箱",
hhzz_takaramono2: "普通宝箱",
hhzz_toulianghuanzhu: "偷梁换柱",
hhzz_fudichouxin: "釜底抽薪",
hhzz_toulianghuanzhu_info:
"出牌阶段,对一名角色使用,随机更换其一个技能。可重铸。",
hhzz_fudichouxin_info:
"出牌阶段,对一名角色使用,随机弃置其一个技能。",
2020-03-19 13:24:54 +00:00
},
2024-04-15 18:46:41 +00:00
});
2020-03-19 13:24:54 +00:00
});
2024-04-15 18:46:41 +00:00
},
2020-01-11 12:17:57 +00:00
},
2024-04-15 18:46:41 +00:00
};
var func = function (pack) {
for (var i in pack.pack) {
for (var j in pack.pack[i]) lib[i][j] = pack.pack[i][j];
}
for (var i in pack.eltc) lib.element.content[i] = pack.eltc[i];
for (var i in pack.eltp) lib.element.player[i] = pack.eltp[i];
for (var i in pack.game) game[i] = pack.game[i];
for (var i in pack.get) get[i] = pack.get[i];
lib.huanhuazhizhan = pack;
};
func(pack);
2020-01-11 12:17:57 +00:00
},
},
},
2024-04-15 18:46:41 +00:00
duzhansanguo: {
name: "毒战三国",
mode: "identity",
intro: "牌堆中额外添加10%的毒",
showcase: function (init) {
var node = this;
var func = function () {
var card = game.createCard("du", "noclick");
2018-04-17 07:32:43 +00:00
node.nodes.push(card);
2024-04-15 18:46:41 +00:00
card.style.position = "absolute";
var rand1 = Math.round(Math.random() * 100);
var rand2 = Math.round(Math.random() * 100);
var rand3 = Math.round(Math.random() * 40) - 20;
card.style.left = "calc(" + rand1 + "% - " + rand1 + "px)";
card.style.top = "calc(" + rand2 + "% - " + rand2 + "px)";
card.style.transform = "scale(0.8) rotate(" + rand3 + "deg)";
card.style.opacity = 0;
2018-04-17 07:32:43 +00:00
node.appendChild(card);
ui.refresh(card);
2024-04-15 18:46:41 +00:00
card.style.opacity = 1;
card.style.transform = "scale(1) rotate(" + rand3 + "deg)";
if (node.nodes.length > 7) {
setTimeout(function () {
while (node.nodes.length > 5) {
2018-04-17 07:32:43 +00:00
node.nodes.shift().delete();
}
2024-04-15 18:46:41 +00:00
}, 500);
2018-04-17 07:32:43 +00:00
}
};
2024-04-15 18:46:41 +00:00
if (init) {
node.nodes = [];
for (var i = 0; i < 5; i++) {
2018-04-17 07:32:43 +00:00
func();
}
}
2024-04-15 18:46:41 +00:00
node.showcaseinterval = setInterval(func, 1000);
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
content: {
cardPile: function (list) {
game.identityVideoName = "毒战三国杀";
lib.config.bannedcards.remove("du");
if (game.bannedcards) game.bannedcards.remove("du");
var num = Math.ceil(list.length / 10);
while (num--) {
list.push([
["heart", "diamond", "club", "spade"].randomGet(),
Math.ceil(Math.random() * 13),
"du",
]);
2018-04-17 07:32:43 +00:00
}
return list;
2024-04-15 18:46:41 +00:00
},
2018-04-17 07:32:43 +00:00
},
},
2024-04-15 18:46:41 +00:00
daozhiyueying: {
name: "导师月英",
mode: "identity",
intro: "牌堆中所有普通锦囊牌数量翻倍;移除拥有集智技能的角色",
showcase: function (init) {
var node = this;
var player1, player2;
if (init) {
player1 = ui.create.player(null, true).init("huangyueying");
player2 = ui.create.player(null, true);
if (lib.character.jsp_huangyueying) {
player2.init("jsp_huangyueying");
} else if (lib.character.re_huangyueying) {
player2.init("re_huangyueying");
} else {
player2.init("huangyueying");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
player1.style.left = "20px";
player1.style.top = "20px";
player1.style.transform = "scale(0.9)";
player1.node.count.innerHTML = "2";
player1.node.count.dataset.condition = "mid";
player2.style.left = "auto";
player2.style.right = "20px";
player2.style.top = "20px";
player2.style.transform = "scale(0.9)";
player2.node.count.innerHTML = "2";
player2.node.count.dataset.condition = "mid";
2018-04-17 07:32:43 +00:00
this.appendChild(player1);
this.appendChild(player2);
2024-04-15 18:46:41 +00:00
this.player1 = player1;
this.player2 = player2;
} else {
player1 = this.player1;
player2 = this.player2;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
var createCard = function (wuxie) {
2018-04-17 07:32:43 +00:00
var card;
2024-04-15 18:46:41 +00:00
if (wuxie) {
card = game.createCard("wuxie", "noclick");
card.style.transform = "scale(0.9)";
} else {
card = ui.create.card(null, "noclick", true);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
card.style.opacity = 0;
card.style.position = "absolute";
card.style.zIndex = 2;
card.style.margin = 0;
2018-04-17 07:32:43 +00:00
return card;
2024-04-15 18:46:41 +00:00
};
2024-04-15 18:46:41 +00:00
var func = function () {
game.linexy(
[
player1.getLeft() + player1.offsetWidth / 2,
player1.getTop() + player1.offsetHeight / 2,
player2.getLeft() + player2.offsetWidth / 2,
player2.getTop() + player2.offsetHeight / 2,
],
node
);
var card = createCard(true);
card.style.left = "43px";
card.style.top = "58px";
2018-04-17 07:32:43 +00:00
node.appendChild(card);
ui.refresh(card);
2024-04-15 18:46:41 +00:00
card.style.opacity = 1;
card.style.transform = "scale(0.9) translate(137px,152px)";
setTimeout(function () {
2018-04-17 07:32:43 +00:00
card.delete();
2024-04-15 18:46:41 +00:00
}, 1000);
player1.node.count.innerHTML = "1";
2024-04-15 18:46:41 +00:00
setTimeout(function () {
if (!node.showcaseinterval) return;
player1.node.count.innerHTML = "2";
var card = createCard();
card.style.left = "43px";
card.style.top = "58px";
card.style.transform = "scale(0.9) translate(137px,152px)";
2018-04-17 07:32:43 +00:00
node.appendChild(card);
ui.refresh(card);
2024-04-15 18:46:41 +00:00
card.style.opacity = 1;
card.style.transform = "scale(0.9)";
setTimeout(function () {
2018-04-17 07:32:43 +00:00
card.delete();
2024-04-15 18:46:41 +00:00
}, 1000);
}, 300);
2024-04-15 18:46:41 +00:00
setTimeout(function () {
if (!node.showcaseinterval) return;
player2.node.count.innerHTML = "1";
game.linexy(
[
player2.getLeft() + player2.offsetWidth / 2,
player2.getTop() + player2.offsetHeight / 2,
player1.getLeft() + player1.offsetWidth / 2,
player1.getTop() + player1.offsetHeight / 2,
],
node
);
var card = createCard(true);
card.style.left = "auto";
card.style.right = "43px";
card.style.top = "58px";
2018-04-17 07:32:43 +00:00
node.appendChild(card);
ui.refresh(card);
2024-04-15 18:46:41 +00:00
card.style.opacity = 1;
card.style.transform = "scale(0.9) translate(-137px,152px)";
setTimeout(function () {
2018-04-17 07:32:43 +00:00
card.delete();
2024-04-15 18:46:41 +00:00
}, 700);
2024-04-15 18:46:41 +00:00
setTimeout(function () {
if (!node.showcaseinterval) return;
player2.node.count.innerHTML = "2";
var card = createCard();
card.style.left = "auto";
card.style.right = "43px";
card.style.top = "58px";
card.style.transform = "scale(0.9) translate(-137px,152px)";
2018-04-17 07:32:43 +00:00
node.appendChild(card);
ui.refresh(card);
2024-04-15 18:46:41 +00:00
card.style.opacity = 1;
card.style.transform = "scale(0.9)";
setTimeout(function () {
2018-04-17 07:32:43 +00:00
card.delete();
2024-04-15 18:46:41 +00:00
}, 700);
}, 300);
}, 1000);
2018-04-17 07:32:43 +00:00
};
2024-04-15 18:46:41 +00:00
node.showcaseinterval = setInterval(func, 2200);
2018-04-17 07:32:43 +00:00
func();
},
2024-04-15 18:46:41 +00:00
init: function () {
for (var i in lib.character) {
var skills = lib.character[i][3];
if (
skills.includes("jizhi") ||
skills.includes("rejizhi") ||
skills.includes("lingzhou") ||
skills.includes("sbaiyin")
) {
2018-04-17 07:32:43 +00:00
delete lib.character[i];
}
}
},
2024-04-15 18:46:41 +00:00
content: {
cardPile: function (list) {
game.identityVideoName = "导师月英";
var list2 = [];
for (var i = 0; i < list.length; i++) {
2018-04-17 07:32:43 +00:00
list2.push(list[i]);
2024-04-15 18:46:41 +00:00
if (get.type(list[i][2]) == "trick") {
2018-04-17 07:32:43 +00:00
list2.push(list[i]);
}
}
return list2;
2024-04-15 18:46:41 +00:00
},
},
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
weiwoduzun: {
name: "唯我独尊",
mode: "identity",
intro: [
"牌堆中杀的数量增加30%",
"游戏开始时,主公获得一枚战神标记",
"拥有战神标记的角色杀造成的伤害+1",
"受到杀造成的伤害后战神印记将移到伤害来源的武将牌上",
2018-04-17 07:32:43 +00:00
],
2024-04-15 18:46:41 +00:00
showcase: function (init) {
var node = this;
2018-04-17 07:32:43 +00:00
var player;
2024-04-15 18:46:41 +00:00
if (init) {
player = ui.create.player(null, true);
player.node.avatar.style.backgroundSize = "cover";
player.node.avatar.setBackgroundImage("image/mode/boss/character/boss_lvbu2.jpg");
2018-04-17 07:32:43 +00:00
player.node.avatar.show();
2024-04-15 18:46:41 +00:00
player.style.left = "calc(50% - 75px)";
player.style.top = "20px";
2018-04-17 07:32:43 +00:00
player.node.count.remove();
player.node.hp.remove();
2024-04-15 18:46:41 +00:00
player.style.transition = "all 0.5s";
2018-04-17 07:32:43 +00:00
node.appendChild(player);
2024-04-15 18:46:41 +00:00
node.playernode = player;
} else {
player = node.playernode;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
var num = 0;
var num2 = 0;
this.showcaseinterval = setInterval(function () {
var dx, dy;
if (num2 % 5 == 0) {
// player.addTempClass('target');
// player.addTempClass('zoomin');
2024-04-15 18:46:41 +00:00
player.classList.add("zoomin3");
2018-04-17 07:32:43 +00:00
player.hide();
2024-04-15 18:46:41 +00:00
player.style.transitionDuration = "0.7s";
setTimeout(function () {
player.style.transitionProperty = "none";
player.classList.remove("zoomin3");
player.classList.add("zoomout2");
setTimeout(function () {
player.style.transitionProperty = "";
player.classList.remove("zoomout2");
2018-04-17 07:32:43 +00:00
player.show();
2024-04-15 18:46:41 +00:00
}, 500);
}, 700);
for (var i = 0; i < 5; i++) {
switch (i) {
case 0:
dx = -180;
dy = 0;
break;
case 1:
dx = -140;
dy = 100;
break;
case 2:
dx = 0;
dy = 155;
break;
case 3:
dx = 140;
dy = 100;
break;
case 4:
dx = 180;
dy = 0;
break;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
var card = game.createCard("sha", "noclick");
card.style.left = "calc(50% - 52px)";
card.style.top = "68px";
card.style.position = "absolute";
card.style.margin = 0;
card.style.zIndex = 2;
card.style.opacity = 0;
2018-04-17 07:32:43 +00:00
node.appendChild(card);
ui.refresh(card);
2024-04-15 18:46:41 +00:00
card.style.opacity = 1;
card.style.transform = "translate(" + dx + "px," + dy + "px)";
setTimeout(
(function (card) {
return function () {
card.delete();
};
})(card),
700
);
2018-04-17 07:32:43 +00:00
}
}
num2++;
2024-04-15 18:46:41 +00:00
if (num >= 5) {
num = 0;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
}, 700);
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
init: function () {
game.identityVideoName = "唯我独尊";
lib.skill.weiwoduzun = {
mark: true,
intro: {
content: "杀造成的伤害+1",
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
group: ["weiwoduzun_damage", "weiwoduzun_lose"],
subSkill: {
damage: {
trigger: { source: "damageBegin" },
forced: true,
filter: function (event) {
return event.card && event.card.name == "sha" && event.notLink();
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
content: function () {
2018-04-17 07:32:43 +00:00
trigger.num++;
2024-04-15 18:46:41 +00:00
},
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
lose: {
trigger: { player: "damageEnd" },
forced: true,
filter: function (event) {
return event.source && event.source.isAlive();
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
content: function () {
player.removeSkill("weiwoduzun");
trigger.source.addSkill("weiwoduzun");
},
},
},
2018-04-17 07:32:43 +00:00
};
2024-04-15 18:46:41 +00:00
lib.translate.weiwoduzun = "战神";
lib.translate.weiwoduzun_bg = "尊";
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
content: {
cardPile: function (list) {
var num = 0;
for (var i = 0; i < list.length; i++) {
if (list[i][2] == "sha") num++;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
num = Math.round(num * 0.3);
if (num <= 0) return list;
while (num--) {
var nature = "";
var rand = Math.random();
if (rand < 0.15) {
nature = "fire";
} else if (rand < 0.3) {
nature = "thunder";
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
var suit = ["heart", "spade", "club", "diamond"].randomGet();
var number = Math.ceil(Math.random() * 13);
if (nature) {
list.push([suit, number, "sha", nature]);
} else {
list.push([suit, number, "sha"]);
2018-04-17 07:32:43 +00:00
}
}
return list;
},
2024-04-15 18:46:41 +00:00
gameStart: function () {
if (_status.mode == "zhong") {
game.zhong.addSkill("weiwoduzun");
} else {
game.zhu.addSkill("weiwoduzun");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
},
},
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
tongxingzhizheng: {
name: "同姓之争",
mode: "versus",
submode: "2v2",
intro: "姓氏相同的武将组合一队",
showcase: function (init) {
var node = this;
var getList = function () {
var list = [
["guanyu", "guanping", "guansuo", "guanyinping"],
["caocao", "caopi", "caozhi", "caorui"],
["liubei", "liushan", "liuchen"],
["re_xiahouyuan", "xiahouba", "xiahoushi"],
["sunjian", "sunquan", "sunce"],
["sp_zhangjiao", "re_zhangliang", "zhangbao"],
["zhugeliang", "zhugeguo", "zhugejin", "zhugeke"],
["mateng", "machao", "old_madai", "mayunlu"],
];
2018-04-17 07:32:43 +00:00
list.randomSort();
2024-04-15 18:46:41 +00:00
var list2 = [];
for (var i = 0; i < list.length; i++) {
list2 = list2.concat(list[i]);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
node.list = list2;
2018-04-17 07:32:43 +00:00
};
2024-04-15 18:46:41 +00:00
var func = function () {
if (!node.list.length) {
2018-04-17 07:32:43 +00:00
getList();
}
2024-04-15 18:46:41 +00:00
var card = ui.create.player(null, true);
2018-04-17 07:32:43 +00:00
card.init(node.list.shift());
card.node.marks.remove();
card.node.count.remove();
card.node.hp.remove();
node.nodes.push(card);
2024-04-15 18:46:41 +00:00
card.style.position = "absolute";
var rand1 = Math.round(Math.random() * 100);
var rand2 = Math.round(Math.random() * 100);
var rand3 = Math.round(Math.random() * 40) - 20;
card.style.left = "calc(" + rand1 + "% - " + rand1 * 1.5 + "px)";
card.style.top = "calc(" + rand2 + "% - " + rand2 * 1.8 + "px)";
card.style.transform = "scale(1.2) rotate(" + rand3 + "deg)";
card.style.opacity = 0;
2018-04-17 07:32:43 +00:00
ui.refresh(card);
node.appendChild(card);
ui.refresh(card);
2024-04-15 18:46:41 +00:00
card.style.transform = "scale(0.9) rotate(" + rand3 + "deg)";
card.style.opacity = 1;
if (node.nodes.length > 4) {
setTimeout(function () {
while (node.nodes.length > 3) {
2018-04-17 07:32:43 +00:00
node.nodes.shift().delete();
}
2024-04-15 18:46:41 +00:00
}, 500);
2018-04-17 07:32:43 +00:00
}
};
2024-04-15 18:46:41 +00:00
node.list = [];
if (init) {
node.nodes = [];
for (var i = 0; i < 3; i++) {
2018-04-17 07:32:43 +00:00
func();
}
}
2024-04-15 18:46:41 +00:00
node.showcaseinterval = setInterval(func, 1000);
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
init: function () {
var map = {};
var map3 = [];
var list1 = ["司", "夏", "诸", "皇"];
var list2 = ["马", "侯", "葛", "甫"];
for (var i in lib.character) {
if (lib.filter.characterDisabled(i)) continue;
if (lib.character[i][1] == "key") continue;
var surname = get.rawName2(i);
for (var j = 0; j < surname.length; j++) {
if (!/[a-z]/i.test(surname[j])) {
var index = list1.indexOf(surname[j]);
if (index != -1 && surname[j + 1] == list2[index]) {
surname = surname[j] + surname[j + 1];
} else {
surname = surname[j];
2018-04-17 07:32:43 +00:00
}
break;
}
}
2024-04-15 18:46:41 +00:00
if (!map[surname]) {
map[surname] = [];
2018-04-17 07:32:43 +00:00
}
map[surname].push(i);
}
2024-04-15 18:46:41 +00:00
for (var i in map) {
if (map[i].length < 6) {
2018-04-17 07:32:43 +00:00
delete map[i];
2024-04-15 18:46:41 +00:00
} else {
2018-04-17 07:32:43 +00:00
map3.push(i);
}
}
2024-04-15 18:46:41 +00:00
_status.brawl.map = map;
_status.brawl.map3 = map3;
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
content: {
submode: "two",
chooseCharacterFixed: true,
chooseCharacter: function (list, player) {
game.versusVideoName = "同姓之争";
_status.noReplaceCharacter = true;
if (player.side == game.me.side) {
if (_status.brawl.mylist) {
2018-04-17 07:32:43 +00:00
return _status.brawl.mylist.randomGets(2);
}
2024-04-15 18:46:41 +00:00
} else {
if (_status.brawl.enemylist) {
2018-04-17 07:32:43 +00:00
return _status.brawl.enemylist.randomGets(2);
}
}
2024-04-15 18:46:41 +00:00
var surname = _status.brawl.map3.randomRemove();
var list = _status.brawl.map[surname];
if (player == game.me) {
_status.brawl.mylist = list;
} else {
_status.brawl.enemylist = list;
2018-04-17 07:32:43 +00:00
}
2023-10-02 16:32:08 +00:00
return list.randomRemove(3);
2024-04-15 18:46:41 +00:00
},
},
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
tongqueduopao: {
name: "铜雀夺袍",
mode: "identity",
intro: [
"主公必选曹操",
"其余玩家从曹休、文聘、曹洪、张郃、夏侯渊、徐晃、许褚这些武将中随机选中一个",
"游戏开始时将麒麟弓和爪黄飞电各置于每名角色的装备区内,大宛马洗入牌堆,移除其他的武器牌和坐骑牌",
2018-04-17 07:32:43 +00:00
],
2024-04-15 18:46:41 +00:00
init: function () {
game.saveConfig("player_number", "8", "identity");
game.saveConfig("double_character", false, "identity");
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
showcase: function (init) {
var node = this;
var list = [
"re_caoxiu",
"re_wenpin",
"tw_re_caohong",
"re_zhanghe",
"ol_xiahouyuan",
"ol_xuhuang",
"re_xuzhu",
];
2018-04-17 07:32:43 +00:00
list.randomSort();
2024-04-15 18:46:41 +00:00
list.push("re_caocao");
var func = function () {
var card = ui.create.player(null, true);
2018-04-17 07:32:43 +00:00
card.init(list.shift());
card.node.marks.remove();
card.node.count.remove();
card.node.hp.remove();
node.nodes.push(card);
2024-04-15 18:46:41 +00:00
card.style.position = "absolute";
card.style.zIndex = 2;
card.style.transition = "all 2s";
var rand1 = Math.round(Math.random() * 100);
var rand2 = Math.round(Math.random() * 100);
var rand3 = Math.round(Math.random() * 40) - 20;
card.style.left = "calc(" + rand1 + "% - " + rand1 * 1.5 + "px)";
card.style.top = "calc(" + rand2 + "% - " + rand2 * 1.8 + "px)";
card.style.transform = "scale(0.8) rotate(" + rand3 + "deg)";
2018-04-17 07:32:43 +00:00
node.appendChild(card);
ui.refresh(card);
};
2024-04-15 18:46:41 +00:00
var list2 = ["qilin", "dawan", "zhuahuang"];
var func2 = function () {
var card = game.createCard(list2.shift(), "noclick");
2018-04-17 07:32:43 +00:00
node.nodes.push(card);
2024-04-15 18:46:41 +00:00
card.style.position = "absolute";
card.style.zIndex = 2;
card.style.transition = "all 2s";
var rand1 = Math.round(Math.random() * 100);
var rand2 = Math.round(Math.random() * 100);
var rand3 = Math.round(Math.random() * 40) - 20;
card.style.left = "calc(" + rand1 + "% - " + rand1 + "px)";
card.style.top = "calc(" + rand2 + "% - " + rand2 + "px)";
card.style.transform = "rotate(" + rand3 + "deg)";
2018-04-17 07:32:43 +00:00
node.appendChild(card);
ui.refresh(card);
};
2024-04-15 18:46:41 +00:00
if (init) {
node.nodes = [];
} else {
while (node.nodes.length) {
2018-04-17 07:32:43 +00:00
node.nodes.shift().remove();
}
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < 5; i++) {
2018-04-17 07:32:43 +00:00
func();
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < 3; i++) {
2018-04-17 07:32:43 +00:00
func2();
func();
}
2024-04-15 18:46:41 +00:00
var func3 = function () {
for (var i = 0; i < node.nodes.length; i++) {
var card = node.nodes[i];
if (card.classList.contains("player")) {
var rand1 = Math.round(Math.random() * 100);
var rand2 = Math.round(Math.random() * 100);
var rand3 = Math.round(Math.random() * 40) - 20;
card.style.left = "calc(" + rand1 + "% - " + rand1 * 1.5 + "px)";
card.style.top = "calc(" + rand2 + "% - " + rand2 * 1.8 + "px)";
card.style.transform = "scale(0.8) rotate(" + rand3 + "deg)";
} else {
var rand1 = Math.round(Math.random() * 100);
var rand2 = Math.round(Math.random() * 100);
var rand3 = Math.round(Math.random() * 40) - 20;
card.style.left = "calc(" + rand1 + "% - " + rand1 + "px)";
card.style.top = "calc(" + rand2 + "% - " + rand2 + "px)";
card.style.transform = "rotate(" + rand3 + "deg)";
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
};
2018-04-17 07:32:43 +00:00
// func3();
// node.showcaseinterval=setInterval(func3,5000);
},
2024-04-15 18:46:41 +00:00
content: {
cardPile: function (list) {
for (var i = 0; i < list.length; i++) {
var subtype = get.subtype(list[i][2]);
if (subtype == "equip1" || subtype == "equip3" || subtype == "equip4") {
list.splice(i--, 1);
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < 8; i++) {
list.push([
["heart", "diamond", "club", "spade"].randomGet(),
Math.ceil(Math.random() * 13),
"dawan",
]);
2018-04-17 07:32:43 +00:00
}
return list;
},
2024-04-15 18:46:41 +00:00
gameStart: function () {
game.identityVideoName = "铜雀夺袍";
for (var i = 0; i < game.players.length; i++) {
game.players[i].$equip(game.createCard("qilin"));
game.players[i].$equip(game.createCard("zhuahuang"));
2018-04-17 07:32:43 +00:00
}
},
2024-04-15 18:46:41 +00:00
submode: "normal",
list: [
"re_caoxiu",
"re_wenpin",
"tw_re_caohong",
"re_zhanghe",
"ol_xiahouyuan",
"ol_xuhuang",
"re_xuzhu",
],
chooseCharacterFixed: true,
chooseCharacterAi: function (player) {
if (player == game.zhu) {
player.init("re_caocao");
} else {
2018-04-17 07:32:43 +00:00
_status.brawl.list.remove(game.me.name);
player.init(_status.brawl.list.randomRemove());
}
},
2024-04-15 18:46:41 +00:00
chooseCharacter: function () {
_status.noReplaceCharacter = true;
if (game.me == game.zhu) {
return ["re_caocao"];
} else {
2018-04-17 07:32:43 +00:00
_status.brawl.list.randomSort();
return _status.brawl.list;
// return _status.brawl.list.randomGets(1);
}
2024-04-15 18:46:41 +00:00
},
},
2018-04-17 07:32:43 +00:00
},
// shenrudihou:{
2020-02-14 05:33:43 +00:00
// name:'深入敌后',
// mode:'versus',
// submode:'1v1',
// intro:'选将阶段选择武将和对战阶段选择上场的武将都由对手替你选择,而且你不知道对手为你选择了什么武将'
2018-04-17 07:32:43 +00:00
// },
2024-04-15 18:46:41 +00:00
tongjiangmoshi: {
name: "同将模式",
mode: "identity",
intro: "玩家选择一个武将,所有角色均使用此武将",
showcase: function (init) {
if (init) {
this.nodes = [];
} else {
while (this.nodes.length) {
2018-04-17 07:32:43 +00:00
this.nodes.shift().remove();
}
}
2024-04-15 18:46:41 +00:00
var lx = this.offsetWidth / 2 - 120;
var ly = Math.min(lx, this.offsetHeight / 2 - 60);
var setPos = function (node) {
var i = node.index;
var deg = (Math.PI / 4) * i;
var dx = Math.round(lx * Math.cos(deg));
var dy = Math.round(ly * Math.sin(deg));
node.style.transform = "translate(" + dx + "px," + dy + "px)";
};
for (var i = 0; i < 8; i++) {
var node = ui.create.player(null, true);
2018-04-17 07:32:43 +00:00
this.nodes.push(node);
2024-04-15 18:46:41 +00:00
node.init("zuoci");
node.classList.add("minskin");
2018-04-17 07:32:43 +00:00
node.node.marks.remove();
node.node.hp.remove();
node.node.count.remove();
2024-04-15 18:46:41 +00:00
node.style.left = "calc(50% - 60px)";
node.style.top = "calc(50% - 60px)";
node.index = i;
node.style.borderRadius = "100%";
node.node.avatar.style.borderRadius = "100%";
2017-11-07 10:41:45 +00:00
node.node.name.remove();
2018-04-17 07:32:43 +00:00
setPos(node);
this.appendChild(node);
}
2024-04-15 18:46:41 +00:00
var nodes = this.nodes;
this.showcaseinterval = setInterval(function () {
for (var i = 0; i < nodes.length; i++) {
2018-04-17 07:32:43 +00:00
nodes[i].index++;
2024-04-15 18:46:41 +00:00
if (nodes[i].index > 7) {
nodes[i].index = 0;
2018-04-17 07:32:43 +00:00
}
setPos(nodes[i]);
}
2024-04-15 18:46:41 +00:00
}, 1000);
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
content: {
gameStart: function () {
game.identityVideoName = "同将模式";
var target = _status.mode == "zhong" ? game.zhong : game.zhu;
if (get.config("double_character")) {
target.init(game.me.name1, game.me.name2);
} else {
2021-01-27 12:48:29 +00:00
target.init(game.me.name1);
2018-04-17 07:32:43 +00:00
}
target.hp++;
target.maxHp++;
target.update();
2024-04-15 18:46:41 +00:00
if (get.config("choose_group")) {
var list = lib.group.slice(0);
list.remove("shen");
game.players.forEach((i) => {
if (i.group == "shen" && i != game.me) {
var group = list.randomGet();
i.group = group;
i.node.name.dataset.nature = get.groupnature(group);
i.update();
}
});
}
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
chooseCharacterAi: function (player, list, list2, back) {
if (player == game.zhu) {
2018-04-17 07:32:43 +00:00
return;
2024-04-15 18:46:41 +00:00
} else {
if (get.config("double_character")) {
player.init(game.me.name1, game.me.name2);
} else {
2021-01-27 12:48:29 +00:00
player.init(game.me.name1);
2018-04-17 07:32:43 +00:00
}
}
},
2024-04-15 18:46:41 +00:00
chooseCharacter: function (list, list2, num) {
if (game.me != game.zhu) {
return list.slice(0, list2);
} else {
if (_status.event.zhongmode) {
return list.slice(0, 6);
} else {
return list.concat(list2.slice(0, num));
2018-04-17 07:32:43 +00:00
}
}
2021-01-27 12:48:29 +00:00
},
2024-04-15 18:46:41 +00:00
chooseCharacterBefore: function () {
if (_status.mode == "purple") _status.mode = "normal";
2021-01-27 12:48:29 +00:00
},
2024-04-15 18:46:41 +00:00
},
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
jiazuzhizheng: {
name: "家族之争",
mode: "versus",
submode: "2v2",
intro: "势力相同的武将组合一队,获得专属势力技能",
showcase: function (init) {
var node = this;
var getList = function () {
var list = [
["liubei", "guanyu", "zhangfei"],
["caocao", "guojia", "xunyu"],
["sunquan", "zhangzhang", "zhouyu"],
["re_yuanshao", "guotufengji", "yj_jushou"],
["jin_simayi", "jin_simazhao", "jin_wangyuanji"],
2020-02-16 04:25:41 +00:00
];
2024-04-15 18:46:41 +00:00
if (_status.keyVerified) list.push(["key_yuri", "key_yuzuru", "sp_key_kanade"]);
2020-02-16 04:25:41 +00:00
list.randomSort();
2024-04-15 18:46:41 +00:00
var list2 = [];
for (var i = 0; i < list.length; i++) {
list2 = list2.concat(list[i]);
2020-02-16 04:25:41 +00:00
}
2024-04-15 18:46:41 +00:00
node.list = list2;
2020-02-16 04:25:41 +00:00
};
2024-04-15 18:46:41 +00:00
var func = function () {
if (!node.list.length) {
2020-02-16 04:25:41 +00:00
getList();
}
2024-04-15 18:46:41 +00:00
var card = ui.create.player(null, true);
2020-02-16 04:25:41 +00:00
card.init(node.list.shift());
card.node.marks.remove();
card.node.count.remove();
card.node.hp.remove();
node.nodes.push(card);
2024-04-15 18:46:41 +00:00
card.style.position = "absolute";
var rand1 = Math.round(Math.random() * 100);
var rand2 = Math.round(Math.random() * 100);
var rand3 = Math.round(Math.random() * 40) - 20;
card.style.left = "calc(" + rand1 + "% - " + rand1 * 1.5 + "px)";
card.style.top = "calc(" + rand2 + "% - " + rand2 * 1.8 + "px)";
card.style.transform = "scale(1.2) rotate(" + rand3 + "deg)";
card.style.opacity = 0;
2020-02-16 04:25:41 +00:00
ui.refresh(card);
node.appendChild(card);
ui.refresh(card);
2024-04-15 18:46:41 +00:00
card.style.transform = "scale(0.9) rotate(" + rand3 + "deg)";
card.style.opacity = 1;
if (node.nodes.length > 4) {
setTimeout(function () {
while (node.nodes.length > 3) {
2020-02-16 04:25:41 +00:00
node.nodes.shift().delete();
}
2024-04-15 18:46:41 +00:00
}, 500);
2020-02-16 04:25:41 +00:00
}
};
2024-04-15 18:46:41 +00:00
node.list = [];
if (init) {
node.nodes = [];
for (var i = 0; i < 3; i++) {
2020-02-16 04:25:41 +00:00
func();
}
}
2024-04-15 18:46:41 +00:00
node.showcaseinterval = setInterval(func, 1000);
2020-02-16 04:25:41 +00:00
},
2024-04-15 18:46:41 +00:00
init: function () {},
content: {
submode: "two",
chooseCharacterFixed: true,
chooseCharacterBefore: function () {
_status.noReplaceCharacter = true;
game.versusVideoName = "家族之争";
var map = {
wei: [],
shu: [],
wu: [],
qun: [],
jin: [],
key: [],
2023-11-06 18:07:27 +00:00
};
2024-04-15 18:46:41 +00:00
var map3 = [];
var banned = ["zuoci", "re_zuoci", "tw_xiahouba"];
for (var i in lib.character) {
if (
lib.filter.characterDisabled2(i) ||
lib.filter.characterDisabled(i) ||
banned.includes(i)
)
continue;
var group = lib.character[i][1];
if (group && map[group]) map[group].push(i);
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i in map) {
if (map[i].length < 8 || (i == "key" && !_status.keyVerified)) {
2023-11-06 18:07:27 +00:00
delete map[i];
2024-04-15 18:46:41 +00:00
} else {
2023-11-06 18:07:27 +00:00
map3.push(i);
}
}
2024-04-15 18:46:41 +00:00
_status.brawl.map = map;
_status.brawl.map3 = map3;
var skill = {
_jiazu_wei: {
trigger: { player: "phaseBegin" },
direct: true,
popup: "魏业",
prompt2:
"回合开始时,你可以弃置一张牌并指定一名敌方角色,该角色须弃置一张牌,否则你摸一张牌。",
filter: function (event, player) {
return player.group == "wei" && player.countCards("he") > 0;
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
content: function () {
"step 0";
2023-11-06 18:07:27 +00:00
player.chooseCardTarget({
2024-04-15 18:46:41 +00:00
prompt: get.prompt2(event.name),
filterCard: lib.filter.cardDiscardable,
filterTarget: function (card, player, target) {
return player.side != target.side;
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
position: "he",
ai1: function (card) {
return 6 - get.value(card);
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
ai2: function (target) {
return 1 / (1 + target.countCards("he"));
2023-11-06 18:07:27 +00:00
},
});
2024-04-15 18:46:41 +00:00
"step 1";
if (result.bool) {
player.logSkill(event.name, result.targets);
2023-11-06 18:07:27 +00:00
player.discard(result.cards);
2024-04-15 18:46:41 +00:00
result.targets[0].chooseToDiscard(
"弃置一张牌,或令" + get.translation(player) + "摸一张牌",
"he"
).ai = lib.skill.zhiheng.check;
} else event.finish();
"step 2";
if (!result.bool) player.draw();
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
_jiazu_shu: {
popup: "蜀义",
prompt2:
"你使用【杀】上限+1出牌阶段结束时若你于此阶段使用【杀】次数不少于2摸一张牌。",
mod: {
cardUsable: function (card, player, num) {
if (card.name == "sha" && player.group == "shu") return num + 1;
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
trigger: { player: "phaseUseEnd" },
forced: true,
filter: function (event, player) {
return (
player.group == "shu" &&
player.getHistory("useCard", function (evt) {
return (
evt.card &&
evt.card.name == "sha" &&
evt.getParent("phaseUse") == event
);
}).length > 1
);
},
content: function () {
player.draw();
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
_jiazu_wu: {
trigger: { player: "phaseEnd" },
forced: true,
popup: "吴耀",
prompt2: "回合结束时,若你的手牌数不等于你的体力值,则你摸一张牌。",
filter: function (event, player) {
return player.group == "wu" && player.countCards("h") != player.hp;
},
content: function () {
player.draw();
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
_jiazu_qun: {
popup: "群心",
prompt2:
"锁定技弃牌阶段开始时若你的手牌数比体力值多2或更多你本回合手牌上限+1若你已损失体力值大于1你手牌上限+1",
trigger: { player: "phaseDiscardBegin" },
forced: true,
filter: function (event, player) {
return (
player.group == "qun" &&
(player.isDamaged() || player.countCards("h") - player.hp > 1)
);
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
content: function () {
var num = 0;
if (player.isDamaged()) num++;
if (player.countCards("h") - player.hp > 1) num++;
player.addMark("qunxin_temp", num, false);
player.addTempSkill("qunxin_temp", "phaseDiscardEnd");
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
_jiazu_jin: {
trigger: { player: "phaseDrawEnd" },
popup: "晋势",
prompt2:
"摸牌阶段结束时,你可以展示你于此阶段内因摸牌而得到的牌。若这些牌的花色均不同,则你摸一张牌。",
filter: function (event, player) {
var hs = player.getCards("h");
return (
player.group == "jin" &&
hs.length > 0 &&
player.getHistory("gain", function (evt) {
if (
evt.getParent().name != "draw" ||
evt.getParent("phaseDraw") != event
)
return false;
for (var i of evt.cards) {
if (hs.includes(i)) return true;
}
return false;
}).length > 0
);
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
check: function (event, player) {
var hs = player.getCards("h"),
cards = [],
suits = [];
player.getHistory("gain", function (evt) {
if (
evt.getParent().name != "draw" ||
evt.getParent("phaseDraw") != event
)
return false;
for (var i of evt.cards) {
if (hs.includes(i)) {
2023-11-06 18:07:27 +00:00
cards.add(i);
2024-04-15 18:46:41 +00:00
suits.add(get.suit(i, player));
2023-11-06 18:07:27 +00:00
}
}
});
2024-04-15 18:46:41 +00:00
return cards.length == suits.length;
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
content: function () {
var hs = player.getCards("h"),
cards = [],
suits = [];
player.getHistory("gain", function (evt) {
if (
evt.getParent().name != "draw" ||
evt.getParent("phaseDraw") != trigger
)
return false;
for (var i of evt.cards) {
if (hs.includes(i)) {
2023-11-06 18:07:27 +00:00
cards.add(i);
2024-04-15 18:46:41 +00:00
suits.add(get.suit(i, player));
2023-11-06 18:07:27 +00:00
}
}
});
2024-04-15 18:46:41 +00:00
player.showCards(cards, get.translation(player) + "发动了【晋势】");
if (cards.length == suits.length) player.draw();
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
_jiazu_key: {
enable: "phaseUse",
usable: 1,
popup: "键魂",
filter: function (event, player) {
return player.group == "key";
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
prompt2:
"出牌阶段限一次你可以摸一张牌并获得1点护甲。若如此做你于当前回合结束时失去1点体力。",
content: function () {
"step 0";
2023-11-06 18:07:27 +00:00
player.draw();
2024-04-15 18:46:41 +00:00
"step 1";
2023-11-06 18:07:27 +00:00
player.changeHujia(1);
2024-04-15 18:46:41 +00:00
"step 2";
var evt = event.getParent("phase");
if (evt && evt.after) {
var next = player.loseHp();
2023-11-06 18:07:27 +00:00
event.next.remove(next);
evt.after.push(next);
}
},
2024-04-15 18:46:41 +00:00
ai: {
order: 10,
result: {
player: function (player) {
return player.hp - 1;
2023-11-06 18:07:27 +00:00
},
},
},
},
2024-04-15 18:46:41 +00:00
qunxin_temp: {
noGlobal: true,
onremove: true,
mod: {
maxHandcard: function (player, num) {
return num + player.countMark("qunxin_temp");
2023-11-06 18:07:27 +00:00
},
},
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken_wei: {
popup: "许昌",
intro: {
content: "锁定技,当你受到伤害后,你摸一张牌。",
},
trigger: { player: "damageEnd" },
forced: true,
filter: function (event, player) {
return player._jiazuAwaken && player.group == "wei";
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
content: function () {
player.draw();
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken_shu: {
popup: "成都",
intro: {
content: "锁定技,当你使用【杀】造成伤害后,你摸一张牌。",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
trigger: { source: "damageEnd" },
forced: true,
filter: function (event, player) {
return (
player._jiazuAwaken &&
player.group == "shu" &&
event.card &&
event.card.name == "sha"
);
},
content: function () {
player.draw();
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken_wu: {
popup: "武昌",
intro: {
content: "锁定技,当你使用装备牌时,你摸一张牌。",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
trigger: { player: "useCard" },
forced: true,
filter: function (event, player) {
return (
player._jiazuAwaken &&
player.group == "wu" &&
get.type(event.card) == "equip"
);
},
content: function () {
player.draw();
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken_qun: {
popup: "邺城",
intro: {
content: "锁定技,当你使用锦囊牌指定其他角色为目标后,你摸一张牌。",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
trigger: { player: "useCardToPlayered" },
forced: true,
filter: function (event, player) {
if (
!player._jiazuAwaken ||
player.group != "qun" ||
!event.isFirstTarget ||
get.type(event.card, "trick") != "trick"
)
return false;
for (var i = 0; i < event.targets.length; i++) {
if (event.targets[i] != player) return true;
2023-11-06 18:07:27 +00:00
}
return false;
},
2024-04-15 18:46:41 +00:00
content: function () {
player.draw();
},
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken_key: {
popup: "光坂",
intro: {
content: "锁定技,当你回复/失去体力后,你摸一张牌。",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
trigger: { player: ["loseHpEnd", "recoverEnd"] },
forced: true,
filter: function (event, player) {
return player._jiazuAwaken && player.group == "key";
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
content: function () {
2023-11-06 18:07:27 +00:00
player.draw();
},
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken_jin: {
popup: "洛阳",
intro: {
content: "锁定技结束阶段若你手牌中的花色数小于3则你摸一张牌。",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
trigger: { player: "phaseJieshuBegin" },
forced: true,
filter: function (event, player) {
if (!player._jiazuAwaken || player.group != "jin") return false;
var hs = player.getCards("h"),
suits = [];
if (hs.length < 3) return true;
for (var i of hs) {
suits.add(get.suit(i, player));
if (suits.length > 2) return false;
2023-11-06 18:07:27 +00:00
}
return true;
},
2024-04-15 18:46:41 +00:00
content: function () {
2023-11-06 18:07:27 +00:00
player.draw();
},
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken: {
trigger: { global: "die" },
forced: true,
filter: function (event, player) {
return !player._jiazuAwaken && event.player.side == player.side;
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
content: function () {
player._jiazuAwaken = true;
var name = "_jiazu_awaken_" + player.group;
if (lib.skill[name]) player.markSkill(name);
2023-11-06 18:07:27 +00:00
},
},
};
2024-04-15 18:46:41 +00:00
var translate = {};
for (var i in skill) {
lib.skill[i] = skill[i];
if (skill[i].popup) {
lib.translate[i] = skill[i].popup;
translate[i] = skill[i].popup;
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
if (skill[i].prompt2) {
lib.translate[i + "_info"] = skill[i].prompt2;
translate[i + "_info"] = skill[i].prompt2;
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
if (!skill[i].noGlobal) game.addGlobalSkill(i);
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
game.addVideo("arrangeLib", null, {
skill: {
_jiazu_wei: {
popup: "魏业",
prompt2:
"回合开始时,你可以弃置一张牌并指定一名敌方角色,该角色须弃置一张牌,否则你摸一张牌。",
},
_jiazu_shu: {
popup: "蜀义",
prompt2:
"你使用【杀】上限+1出牌阶段结束时若你于此阶段使用【杀】次数不少于2摸一张牌。",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_jiazu_wu: {
popup: "吴耀",
prompt2: "回合结束时,若你的手牌数不等于你的体力值,则你摸一张牌。",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_jiazu_qun: {
popup: "群心",
prompt2:
"锁定技弃牌阶段开始时若你的手牌数比体力值多2或更多你本回合手牌上限+1若你已损失体力值大于1你手牌上限+1",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_jiazu_jin: {
popup: "晋势",
prompt2:
"摸牌阶段结束时,你可以展示你于此阶段内因摸牌而得到的牌。若这些牌的花色均不同,则你摸一张牌。",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_jiazu_key: {
popup: "键魂",
prompt2:
"出牌阶段限一次你可以摸一张牌并获得1点护甲。若如此做你于当前回合结束时失去1点体力。",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken_wei: {
popup: "许昌",
intro: {
content: "锁定技,当你受到伤害后,你摸一张牌。",
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken_shu: {
popup: "成都",
intro: {
content: "锁定技,当你使用【杀】造成伤害后,你摸一张牌。",
},
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
_jiazu_awaken_wu: {
popup: "武昌",
intro: {
content: "锁定技,当你使用装备牌时,你摸一张牌。",
},
},
_jiazu_awaken_qun: {
popup: "邺城",
intro: {
content: "锁定技,当你使用锦囊牌指定其他角色为目标后,你摸一张牌。",
},
},
_jiazu_awaken_jin: {
popup: "洛阳",
intro: {
content: "锁定技结束阶段若你手牌中的花色数小于3则你摸一张牌。",
},
},
_jiazu_awaken_key: {
popup: "光坂",
intro: {
content: "锁定技,当你回复/失去体力后,你摸一张牌。",
},
},
_jiazu_awaken: {},
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: translate,
2023-11-06 18:07:27 +00:00
});
2020-02-16 04:25:41 +00:00
},
2024-04-15 18:46:41 +00:00
chooseCharacter: function (list, player) {
if (player.side == game.me.side) {
if (_status.brawl.mylist) {
return _status.brawl.mylist.randomGets(player == game.me ? 5 : 3);
2020-02-16 04:25:41 +00:00
}
2024-04-15 18:46:41 +00:00
} else {
if (_status.brawl.enemylist) {
return _status.brawl.enemylist.randomGets(player == game.me ? 5 : 3);
2020-02-16 04:25:41 +00:00
}
}
2024-04-15 18:46:41 +00:00
var surname = _status.brawl.map3.randomRemove();
var list = _status.brawl.map[surname];
if (player == game.me) {
_status.brawl.mylist = list;
} else {
_status.brawl.enemylist = list;
2020-02-16 04:25:41 +00:00
}
2024-04-15 18:46:41 +00:00
return list.randomRemove(player == game.me ? 5 : 3);
},
},
2020-02-16 04:25:41 +00:00
},
2024-04-15 18:46:41 +00:00
baiyidujiang: {
name: "白衣渡江",
mode: "versus",
submode: "2v2",
showcase: function (init) {
var node = this;
var player1, player2;
if (init) {
player1 = ui.create.player(null, true);
player1.classList.add("fullskin");
2022-04-30 12:32:57 +00:00
player1.node.avatar.show();
2024-04-15 18:46:41 +00:00
player1.node.avatar.setBackground("lvmeng", "character");
player2 = ui.create.player(null, true);
player2.classList.add("fullskin");
2022-04-30 12:32:57 +00:00
player2.node.avatar.show();
2024-04-15 18:46:41 +00:00
player2.node.avatar.setBackground("guanyu", "character");
2020-02-14 05:33:43 +00:00
player1.node.marks.remove();
player1.node.hp.remove();
player2.node.marks.remove();
player2.node.hp.remove();
2024-04-15 18:46:41 +00:00
player1.style.left = "20px";
player1.style.top = "20px";
player1.style.transform = "scale(0.9)";
2020-03-05 13:10:37 +00:00
player1.node.count.remove();
2024-04-15 18:46:41 +00:00
player2.style.left = "auto";
player2.style.right = "20px";
player2.style.top = "20px";
player2.style.transform = "scale(0.9)";
2020-03-05 13:10:37 +00:00
player2.node.count.remove();
2020-02-14 05:33:43 +00:00
this.appendChild(player1);
this.appendChild(player2);
2024-04-15 18:46:41 +00:00
this.player1 = player1;
this.player2 = player2;
} else {
player1 = this.player1;
player2 = this.player2;
2020-02-14 05:33:43 +00:00
}
2024-04-15 18:46:41 +00:00
var func = function () {
setTimeout(function () {
2022-04-30 12:32:57 +00:00
player1.smoothAvatar();
player2.smoothAvatar();
2024-04-15 18:46:41 +00:00
player1.node.avatar.setBackground("re_lvmeng", "character");
player2.node.avatar.setBackground("re_guanyu", "character");
}, 1500);
setTimeout(function () {
2022-04-30 12:32:57 +00:00
player1.smoothAvatar();
player2.smoothAvatar();
2024-04-15 18:46:41 +00:00
player1.node.avatar.setBackground("sp_lvmeng", "character");
player2.node.avatar.setBackground("jsp_guanyu", "character");
}, 3000);
setTimeout(function () {
2022-04-30 12:32:57 +00:00
player1.smoothAvatar();
player2.smoothAvatar();
2024-04-15 18:46:41 +00:00
player1.node.avatar.setBackground("shen_lvmeng", "character");
player2.node.avatar.setBackground("shen_guanyu", "character");
}, 4500);
setTimeout(function () {
2022-04-30 12:32:57 +00:00
player1.smoothAvatar();
player2.smoothAvatar();
2024-04-15 18:46:41 +00:00
player1.node.avatar.setBackground("lvmeng", "character");
player2.node.avatar.setBackground("guanyu", "character");
}, 6000);
2020-02-14 05:33:43 +00:00
};
2024-04-15 18:46:41 +00:00
node.showcaseinterval = setInterval(func, 6000);
2020-02-14 05:33:43 +00:00
func();
},
2024-04-15 18:46:41 +00:00
intro: [
"玩家在选将时可从8张武将牌里选择两张武将牌一张面向大家可见加入游戏另一张是隐藏面孔暗置",
"选择的两张武将牌需满足以下至少两个条件1.性别相同2.体力上限相同3.技能数量相同",
"每名玩家在其回合开始或回合结束时,可以选择将自己的武将牌弃置,然后使用暗置的武将牌进行剩余的游戏",
2020-02-14 05:33:43 +00:00
],
2024-04-15 18:46:41 +00:00
content: {
submode: "two",
chooseCharacterBefore: function () {
game.versusVideoName = "白衣渡江";
(lib.skill._changeCharacter = {
trigger: { player: ["phaseBefore", "phaseAfter"] },
forced: true,
silent: true,
popup: false,
filter: function (event, player) {
return player._backupCharacter != undefined;
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
content: function () {
"step 0";
player
.chooseControl("确定", "取消")
.set("dialog", [
"是否替换自己的武将牌?",
[[player._backupCharacter], "character"],
])
.set("ai", function () {
return Math.random() < 0.15 ? "确定" : "取消";
});
"step 1";
if (result.control == "确定") {
game.log(player, "将", player.name, "替换为了", player._backupCharacter);
player.reinit(player.name, player._backupCharacter);
player.changeGroup(lib.character[player._backupCharacter][1], false);
2023-11-06 18:07:27 +00:00
delete player._backupCharacter;
}
},
2024-04-15 18:46:41 +00:00
}),
game.addGlobalSkill("_changeCharacter");
game.chooseCharacterTwo = function () {
var next = game.createEvent("chooseCharacter");
next.setContent(function () {
"step 0";
ui.arena.classList.add("choose-character");
for (var i in lib.skill) {
if (lib.skill[i].changeSeat) {
lib.skill[i] = {};
if (lib.translate[i + "_info"]) {
lib.translate[i + "_info"] = "此模式下不可用";
2023-11-06 18:07:27 +00:00
}
}
}
2024-04-15 18:46:41 +00:00
var bool = Math.random() < 0.5;
var bool2 = Math.random() < 0.5;
var ref = game.players[0];
2024-04-15 18:46:41 +00:00
ref.side = bool;
ref.next.side = bool2;
ref.next.next.side = !bool;
ref.previous.side = !bool2;
2024-04-15 18:46:41 +00:00
var firstChoose = game.players.randomGet();
if (firstChoose.next.side == firstChoose.side) {
firstChoose = firstChoose.next;
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
_status.firstAct = firstChoose;
for (var i = 0; i < 4; i++) {
firstChoose.node.name.innerHTML = get.verticalStr(
get.cnNumber(i + 1, true) + "号位"
);
firstChoose = firstChoose.next;
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < game.players.length; i++) {
if (game.players[i].side == game.me.side) {
game.players[i].node.identity.firstChild.innerHTML = "友";
} else {
game.players[i].node.identity.firstChild.innerHTML = "敌";
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
game.players[i].node.identity.dataset.color =
game.players[i].side + "zhu";
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
var list = [];
for (i in lib.character) {
if (!lib.filter.characterDisabled(i)) {
2023-11-06 18:07:27 +00:00
list.push(i);
}
}
2024-04-15 18:46:41 +00:00
var choose = [];
_status.characterlist = list;
event.filterChoice = function (name1, name2) {
var info1 = lib.character[name1];
var info2 = lib.character[name2];
if (!info1 || !info2) return;
var num = 0;
if (info1[0] == info2[0]) num++;
if (get.infoMaxHp(info1[2]) == get.infoMaxHp(info2[2])) num++;
if (info1[3].length == info2[3].length) num++;
return num > 1;
2023-11-06 18:07:27 +00:00
};
2024-04-15 18:46:41 +00:00
var list2 = list.randomGets(8);
var next = game.me.chooseButton(2, true, [
"请选择您的武将牌",
[list2, "character"],
]);
next.set("onfree", true);
next.set("filterButton", function (button) {
if (!ui.selected.buttons.length) {
for (var i = 0; i < list2.length; i++) {
if (
list2[i] != button.link &&
event.filterChoice(button.link, list2[i])
)
return true;
2023-11-06 18:07:27 +00:00
}
return false;
}
2024-04-15 18:46:41 +00:00
return event.filterChoice(button.link, ui.selected.buttons[0].link);
2023-11-06 18:07:27 +00:00
});
2024-04-15 18:46:41 +00:00
"step 1";
2023-11-06 18:07:27 +00:00
game.me.init(result.links[0]);
2024-04-15 18:46:41 +00:00
game.me._backupCharacter = result.links[1];
2023-11-06 18:07:27 +00:00
_status.characterlist.removeArray(result.links);
2024-04-15 18:46:41 +00:00
var list = _status.characterlist;
for (var i = 0; i < game.players.length; i++) {
if (game.players[i] != game.me) {
2023-11-06 18:07:27 +00:00
list.randomSort();
2024-04-15 18:46:41 +00:00
var bool = false;
for (var k = 0; k < list.length; k++) {
for (var j = i + 1; j < list.length; j++) {
if (event.filterChoice(list[k], list[j])) {
bool = true;
2023-11-06 18:07:27 +00:00
game.players[i].init(list[k]);
2024-04-15 18:46:41 +00:00
game.players[i]._backupCharacter = list[j];
2023-11-06 18:07:27 +00:00
break;
}
}
2024-04-15 18:46:41 +00:00
if (bool) break;
2023-11-06 18:07:27 +00:00
}
}
}
2024-04-15 18:46:41 +00:00
setTimeout(function () {
ui.arena.classList.remove("choose-character");
}, 500);
if (get.config("two_phaseswap")) {
game.addGlobalSkill("autoswap");
if (lib.config.show_handcardbutton) {
ui.versushs = ui.create.system("手牌", null, true);
lib.setPopped(ui.versushs, game.versusHoverHandcards, 220);
2023-11-06 18:07:27 +00:00
}
}
});
};
2024-04-15 18:46:41 +00:00
},
},
2020-02-14 05:33:43 +00:00
},
2024-04-15 18:46:41 +00:00
qianlidanji: {
name: "千里单骑",
mode: "identity",
showcase: function (init) {
var node = this;
2020-08-11 13:05:00 +00:00
var player1;
2024-04-15 18:46:41 +00:00
if (init) {
player1 = ui.create.player(null, true).init("jsp_guanyu");
2020-08-11 13:05:00 +00:00
player1.node.marks.remove();
player1.node.hp.remove();
2024-04-15 18:46:41 +00:00
player1.style.left = "20px";
player1.style.top = "20px";
player1.style.transform = "scale(0.9)";
2020-08-11 13:05:00 +00:00
player1.node.count.remove();
this.appendChild(player1);
2024-04-15 18:46:41 +00:00
this.player1 = player1;
} else {
player1 = this.player1;
2020-08-11 13:05:00 +00:00
}
2024-04-15 18:46:41 +00:00
var func = function () {
var player2 = ui.create.player(null, true).init("caiyang");
2020-08-11 13:05:00 +00:00
player2.node.marks.remove();
player2.node.hp.remove();
2024-04-15 18:46:41 +00:00
player2.style.left = "auto";
player2.style.right = "20px";
player2.style.top = "20px";
2020-08-11 13:05:00 +00:00
player2.node.count.remove();
2024-04-15 18:46:41 +00:00
player2.style.transform = "scale(0.7)";
player2.style.opacity = 0;
2020-08-11 13:05:00 +00:00
node.appendChild(player2);
ui.refresh(player2);
2024-04-15 18:46:41 +00:00
player2.style.opacity = 1;
player2.style.transform = "scale(0.9)";
setTimeout(function () {
if (!player2) return;
game.linexy(
[
player1.getLeft() + player1.offsetWidth / 2,
player1.getTop() + player1.offsetHeight / 2,
player2.getLeft() + player2.offsetWidth / 2,
player2.getTop() + player2.offsetHeight / 2,
],
node
);
setTimeout(function () {
var popup = ui.create.div(".damage");
popup.innerHTML = "-1";
popup.dataset.nature = "soil";
2023-11-06 18:07:27 +00:00
player2.appendChild(popup);
ui.refresh(popup);
2024-04-15 18:46:41 +00:00
popup.classList.add("damageadded");
popup.listenTransition(function () {
setTimeout(function () {
2023-11-06 18:07:27 +00:00
popup.delete();
2024-04-15 18:46:41 +00:00
}, 300);
2023-11-06 18:07:27 +00:00
});
2024-04-15 18:46:41 +00:00
}, 250);
}, 600);
setTimeout(function () {
if (!player2) return;
player2.style.transition = "all 0.5s";
player2.style.transform = "scale(1.2)";
2020-08-11 13:05:00 +00:00
player2.delete();
2024-04-15 18:46:41 +00:00
}, 1200);
2020-08-11 13:05:00 +00:00
};
2024-04-15 18:46:41 +00:00
node.showcaseinterval = setInterval(func, 2600);
2020-08-11 13:05:00 +00:00
func();
},
2024-04-15 18:46:41 +00:00
intro: [
"无尽而漫长的单挑试炼",
lib.config.qianlidanji_level
? "你的最高纪录是连续通过" +
lib.config.qianlidanji_level +
"关,是否能够突破这一记录呢?"
: "你能否过五关斩六将,击败古城战神蔡阳呢?",
2020-08-11 13:05:00 +00:00
],
2024-04-15 18:46:41 +00:00
init: function () {
if (!_status.qianlidanji)
_status.qianlidanji = {
completeNumber: 0,
used: ["pujing", "huban", "caiyang"],
addFellow: function (name) {
game.fan.dataset.position = 2;
ui.arena.setNumber(3);
game.fellow = game.addFellow(1, name);
game.fellow.gain(get.cards(4));
game.fellow.identity = "zhong";
game.fellow.setIdentity();
game.fellow.identityShown = true;
game.fellow.node.identity.classList.remove("guessing");
_status.event.getParent("phaseLoop").player = game.fellow;
},
completeReward: [
[
"回复1点体力并摸一张牌",
function () {
game.zhu.recover();
game.zhu.draw();
},
],
[
"摸三张牌",
function () {
game.zhu.draw(3);
},
],
[
"将一张防具牌置入装备区并摸一张牌",
function () {
var card = get.cardPile(function (card) {
return (
get.subtype(card) == "equip2" && !get.cardtag(card, "gifts")
);
});
if (card) game.zhu.equip(card);
game.zhu.draw();
},
],
[
"将一张武器牌置入装备区并摸一张牌",
function () {
var card = get.cardPile(function (card) {
return (
get.subtype(card) == "equip1" && !get.cardtag(card, "gifts")
);
});
if (card) game.zhu.equip(card);
game.zhu.draw();
},
],
[
"回复2点体力并弃置一张牌",
function () {
game.zhu.recover(2);
game.zhu.chooseToDiscard("he", true);
},
],
[
"摸五张牌,然后弃置三张牌",
function () {
game.zhu.draw(5);
game.zhu.chooseToDiscard(3, "he", true);
},
],
[
"摸五张牌,然后对手摸两张牌",
function () {
game.zhu.draw(5);
game.fan.draw(2);
},
],
[
"将一张武器牌和一张防具牌置入装备区",
function () {
var card = get.cardPile(function (card) {
return (
get.subtype(card) == "equip1" && !get.cardtag(card, "gifts")
);
});
if (card) game.zhu.equip(card);
var card2 = get.cardPile(function (card) {
return (
get.subtype(card) == "equip2" && !get.cardtag(card, "gifts")
);
});
if (card2) game.zhu.equip(card2);
},
],
[
"将一张武器牌和一张防御坐骑牌置入装备区",
function () {
var card = get.cardPile(function (card) {
return (
get.subtype(card) == "equip1" && !get.cardtag(card, "gifts")
);
});
if (card) game.zhu.equip(card);
var card2 = get.cardPile(function (card) {
return (
get.subtype(card) == "equip3" && !get.cardtag(card, "gifts")
);
});
if (card2) game.zhu.equip(card2);
},
],
[
"弃置所有手牌并于下一关获得【涅槃】(标)",
function () {
var hs = game.zhu.getCards("h");
if (hs.length) game.zhu.discard(hs);
game.zhu.addSkill("oldniepan");
game.zhu.restoreSkill("oldniepan");
game.zhu._oldniepan = true;
},
],
[
"获得两张锦囊牌",
function () {
var list = [];
while (list.length < 2) {
var card = get.cardPile(function (card) {
return (
!list.includes(card) && get.type(card, "trick") == "trick"
);
});
if (!card) break;
list.push(card);
}
if (list.length) game.zhu.gain(list, "gain2", "log");
},
],
[
"将体力回复至体力上限,然后弃置一张牌",
function () {
var num = game.zhu.maxHp - game.zhu.hp;
if (num) game.zhu.recover(num);
game.zhu.chooseToDiscard("he", true);
},
],
[
"弃置两张牌,在下一关的第一个回合后进行一个额外的回合",
function () {
game.zhu.chooseToDiscard(2, true, "he");
game.zhu.addSkill("qianlidanji_phase");
},
],
[
"摸一张牌,然后将对手翻面",
function () {
game.zhu.draw();
game.fan.turnOver(true);
},
],
[
"摸一张牌然后令对手受到1点伤害",
function () {
game.zhu.draw();
game.fan.damage(game.zhu);
},
],
[
"获得五张基本牌",
function () {
var list = [];
while (list.length < 5) {
var card = get.cardPile(function (card) {
return !list.includes(card) && get.type(card) == "basic";
});
if (!card) break;
list.push(card);
}
if (list.length) game.zhu.gain(list, "gain2", "log");
},
],
[
"失去1点体力然后摸五张牌",
function () {
game.zhu.loseHp();
game.zhu.draw(5);
},
],
[
"失去体力至1点然后摸七张牌",
function () {
var num = game.zhu.hp - 1;
if (num) game.zhu.loseHp(num);
game.zhu.draw(7);
},
],
[
"弃置一张牌然后令对手受到2点伤害",
function () {
game.zhu.chooseToDiscard("he", true);
game.fan.damage(game.zhu, 2);
},
],
[
"在下一关中召唤普净一同战斗",
function () {
_status.qianlidanji.addFellow("pujing");
},
],
[
"在下一关中召唤胡班一同战斗",
function () {
_status.qianlidanji.addFellow("huban");
},
],
[
"将一张宝物牌置入装备区并摸一张牌",
function () {
var card = get.cardPile(function (card) {
return (
get.subtype(card) == "equip5" && !get.cardtag(card, "gifts")
);
});
if (card) game.zhu.equip(card);
game.zhu.draw();
},
],
[
"摸五张牌,然后将自己翻面",
function () {
game.zhu.draw(5);
game.zhu.turnOver(true);
},
],
[
"获得一张【酒】和一张【杀】",
function () {
var list = [];
var card = get.cardPile(function (card) {
return card.name == "sha";
});
if (card) list.push(card);
var card = get.cardPile(function (card) {
return card.name == "jiu";
});
if (card) list.push(card);
if (list.length) game.zhu.gain(list, "gain2", "log");
},
],
],
replace_character: function () {
"step 0";
if (game.zhu._oldniepan) {
game.zhu.removeSkill("oldniepan");
delete game.zhu._oldniepan;
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
_status.qianlidanji.completeNumber++;
if (
!lib.config.qianlidanji_level ||
lib.config.qianlidanji_level < _status.qianlidanji.completeNumber
) {
lib.config.qianlidanji_level = _status.qianlidanji.completeNumber;
game.saveConfig("qianlidanji_level", lib.config.qianlidanji_level);
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
if (game.fellow && game.fellow.isAlive()) {
if (ui.land && ui.land.player == game.fellow) {
game.addVideo("destroyLand");
ui.land.destroy();
}
game.zhu.next = game.fan;
game.fan.next = game.zhu;
game.zhu.nextSeat = game.fan;
game.fan.nextSeat = game.zhu;
game.players.remove(game.fellow);
_status.dying.remove(game.fellow);
game.fellow.out();
for (var mark in game.fellow.marks) {
game.fellow.unmarkSkill(mark);
}
while (game.fellow.node.marks.childNodes.length > 1) {
game.fellow.node.marks.lastChild.remove();
}
for (var i in game.fellow.tempSkills) {
game.fellow.removeSkill(i);
}
var skills = game.fellow.getSkills();
for (var i = 0; i < skills.length; i++) {
if (lib.skill[skills[i]].temp) {
game.fellow.removeSkill(skills[i]);
}
}
var cards = game.fellow.getCards("hej");
while (cards.length) {
ui.discardPile.appendChild(cards.shift());
}
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
"step 1";
if (game.fellow) {
game.dead.remove(game.fellow);
game.fellow.remove();
game.fan.dataset.position = 1;
ui.arena.setNumber(2);
game.zhu.next = game.fan;
game.fan.next = game.zhu;
game.zhu.nextSeat = game.fan;
game.fan.nextSeat = game.zhu;
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
if (_status.qianlidanji.completeNumber != 5) {
var list = _status.qianlidanji.completeReward.randomGets(3);
var list2 = [];
for (var i = 0; i < list.length; i++) {
list2.push(list[i][1]);
list[i] = list[i][0];
}
if (_status.qianlidanji.completeNumber >= 6) {
list.push("我不想再打了,直接在这里结束吧!");
list2.push(function () {
game.over(true);
});
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
event.list = list2;
game.zhu
.chooseControl()
.set("choiceList", list)
.set(
"prompt",
"请选择一项奖励(当前已通过" +
_status.qianlidanji.completeNumber +
"关)"
);
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
"step 2";
if (_status.qianlidanji.completeNumber != 5) {
if (result.index == 3) {
game.over(true);
return;
}
event.reward = event.list[result.index];
2020-08-11 13:05:00 +00:00
}
2024-04-15 18:46:41 +00:00
_status.characterlist.removeArray(_status.qianlidanji.used);
if (_status.qianlidanji.completeNumber == 5)
event._result = { links: ["caiyang"] };
else
game.zhu.chooseButton(
[
"选择下一关出战的对手",
[_status.characterlist.randomGets(3), "character"],
],
true
);
"step 3";
_status.event.getParent("phaseLoop").player = game.zhu;
var source = game.fan;
var name = result.links[0];
source.revive(null, false);
_status.characterlist.remove(name);
_status.qianlidanji.used.push(name);
source.uninit();
source.init(name);
game.addVideo("reinit", source, [name]);
source.lose(source.getCards("hej"))._triggered = null;
var gain = 4;
var add = 0;
switch (_status.qianlidanji.completeNumber) {
case 5:
break;
case 1:
gain = 5;
break;
case 2:
gain = 5;
add = 1;
break;
case 3:
gain = 6;
add = 1;
break;
default:
gain = 6;
add = 2;
break;
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
source.hp += add;
source.maxHp += add;
source.update();
source.gain(get.cards(gain))._triggered = null;
game.triggerEnter(source);
if (event.reward) event.reward();
"step 4";
var cards = Array.from(ui.ordering.childNodes);
while (cards.length) {
cards.shift().discard();
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
var evt = _status.event.getParent("phase");
if (evt) {
game.resetSkills();
_status.event = evt;
_status.event.finish();
_status.event.untrigger(true);
2020-08-11 13:05:00 +00:00
}
2024-04-15 18:46:41 +00:00
},
};
_status.qianlidanji.player_number = get.config("player_number");
game.saveConfig("player_number", "2", "identity");
2020-08-11 13:05:00 +00:00
},
2024-04-15 18:46:41 +00:00
content: {
submode: "normal",
chooseCharacterBefore: function () {
game.identityVideoName = "千里单骑";
game.saveConfig("player_number", _status.qianlidanji.player_number, "identity");
game.chooseCharacter = function () {
var next = game.createEvent("chooseCharacter");
next.showConfig = true;
next.setContent(function () {
"step 0";
ui.arena.classList.add("choose-character");
game.me.identity = "zhu";
game.zhu = game.me;
game.fan = game.me.next;
game.fan.identity = "fan";
2023-11-06 18:07:27 +00:00
game.zhu.setIdentity();
2024-04-15 18:46:41 +00:00
game.zhu.identityShown = true;
game.zhu.node.identity.classList.remove("guessing");
2023-11-06 18:07:27 +00:00
game.fan.setIdentity();
2024-04-15 18:46:41 +00:00
game.fan.identityShown = true;
game.fan.node.identity.classList.remove("guessing");
2024-04-15 18:46:41 +00:00
event.list = [];
for (var i in lib.character) {
if (lib.filter.characterDisabled(i)) continue;
2023-11-06 18:07:27 +00:00
event.list.push(i);
}
event.list.randomSort();
2024-04-15 18:46:41 +00:00
_status.characterlist = event.list.slice(0);
var list = event.list.slice(0, 5);
2023-11-06 18:07:27 +00:00
delete event.swapnochoose;
var dialog;
2024-04-15 18:46:41 +00:00
if (event.swapnodialog) {
dialog = ui.dialog;
event.swapnodialog(dialog, list);
2023-11-06 18:07:27 +00:00
delete event.swapnodialog;
2024-04-15 18:46:41 +00:00
} else {
var str = "选择角色";
dialog = ui.create.dialog(str, "hidden", [list, "character"]);
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
dialog.setCaption("选择角色");
game.me.chooseButton(dialog, true).set("onfree", true);
2024-04-15 18:46:41 +00:00
ui.create.cheat = function () {
_status.createControl = ui.cheat2;
ui.cheat = ui.create.control("更换", function () {
if (ui.cheat2 && ui.cheat2.dialog == _status.event.dialog) {
2023-11-06 18:07:27 +00:00
return;
}
2024-04-15 18:46:41 +00:00
if (game.changeCoin) {
2023-11-06 18:07:27 +00:00
game.changeCoin(-3);
}
2023-11-06 18:07:27 +00:00
event.list.randomSort();
2024-04-15 18:46:41 +00:00
list = event.list.slice(0, 5);
2024-04-15 18:46:41 +00:00
var buttons = ui.create.div(".buttons");
var node = _status.event.dialog.buttons[0].parentNode;
_status.event.dialog.buttons = ui.create.buttons(
list,
"character",
buttons
);
_status.event.dialog.content.insertBefore(buttons, node);
buttons.addTempClass("start");
2023-11-06 18:07:27 +00:00
node.remove();
game.uncheck();
game.check();
});
delete _status.createControl;
};
2024-04-15 18:46:41 +00:00
if (lib.onfree) {
lib.onfree.push(function () {
event.dialogxx = ui.create.characterDialog("heightset");
if (ui.cheat2) {
ui.cheat2.addTempClass("controlpressdownx", 500);
ui.cheat2.classList.remove("disabled");
2023-11-06 18:07:27 +00:00
}
});
2024-04-15 18:46:41 +00:00
} else {
event.dialogxx = ui.create.characterDialog("heightset");
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
ui.create.cheat2 = function () {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(10);
2023-11-06 18:07:27 +00:00
}
this.dialog.close();
2024-04-15 18:46:41 +00:00
_status.event.dialog = this.backup;
2023-11-06 18:07:27 +00:00
this.backup.open();
delete this.backup;
game.uncheck();
game.check();
2024-04-15 18:46:41 +00:00
if (ui.cheat) {
ui.cheat.addTempClass("controlpressdownx", 500);
ui.cheat.classList.remove("disabled");
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
} else {
if (game.changeCoin) {
2023-11-06 18:07:27 +00:00
game.changeCoin(-10);
}
2024-04-15 18:46:41 +00:00
this.backup = _status.event.dialog;
2023-11-06 18:07:27 +00:00
_status.event.dialog.close();
2024-04-15 18:46:41 +00:00
_status.event.dialog = _status.event.parent.dialogxx;
this.dialog = _status.event.dialog;
2023-11-06 18:07:27 +00:00
this.dialog.open();
game.uncheck();
game.check();
2024-04-15 18:46:41 +00:00
if (ui.cheat) {
ui.cheat.classList.add("disabled");
2023-11-06 18:07:27 +00:00
}
}
});
2024-04-15 18:46:41 +00:00
if (lib.onfree) {
ui.cheat2.classList.add("disabled");
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
};
if (!_status.brawl || !_status.brawl.chooseCharacterFixed) {
if (!ui.cheat && get.config("change_choice")) ui.create.cheat();
if (!ui.cheat2 && get.config("free_choose")) ui.create.cheat2();
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
"step 1";
if (ui.cheat) {
2023-11-06 18:07:27 +00:00
ui.cheat.close();
delete ui.cheat;
}
2024-04-15 18:46:41 +00:00
if (ui.cheat2) {
2023-11-06 18:07:27 +00:00
ui.cheat2.close();
delete ui.cheat2;
}
game.addRecentCharacter(result.buttons[0].link);
game.zhu.init(result.buttons[0].link);
_status.characterlist.remove(result.buttons[0].link);
_status.qianlidanji.used.add(result.buttons[0].link);
2024-04-15 18:46:41 +00:00
game.zhu
.chooseControl("地狱", "困难", "普通", "简单", "无双")
.set("prompt", "请选择游戏难度");
"step 2";
var hp = Math.floor(result.index / 2);
event.draw = Math.floor((result.index + 1) / 2);
if (hp) {
game.zhu.hp += hp;
game.zhu.maxHp += hp;
2023-11-06 18:07:27 +00:00
game.zhu.update();
}
2024-04-15 18:46:41 +00:00
game.zhu.chooseButton(
[
"请选择对手的登场武将",
[_status.characterlist.randomGets(3), "character"],
],
true
);
"step 3";
2023-11-06 18:07:27 +00:00
game.fan.init(result.links[0]);
_status.characterlist.remove(result.links[0]);
_status.qianlidanji.used.add(result.links[0]);
2024-04-15 18:46:41 +00:00
if (event.draw) {
2023-11-06 18:07:27 +00:00
game.zhu.directgain(get.cards(event.draw));
}
2024-04-15 18:46:41 +00:00
setTimeout(function () {
ui.arena.classList.remove("choose-character");
}, 500);
2024-04-15 18:46:41 +00:00
var pack = {
character: {
pujing: ["male", "qun", 1, [], []],
huban: ["male", "qun", 2, [], []],
caiyang: ["male", "qun", 1, ["zhuixi"], []],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
pujing: "普净",
huban: "胡班",
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
skill: {
qianlidanji_phase: {
trigger: { global: "phaseBefore" },
forced: true,
silent: true,
firstDo: true,
content: function () {
player.removeSkill("qianlidanji_phase");
2023-11-06 18:07:27 +00:00
player.insertPhase();
},
},
},
};
2024-04-15 18:46:41 +00:00
for (var i in pack) {
for (var j in pack[i]) {
lib[i][j] = pack[i][j];
2023-11-06 18:07:27 +00:00
}
}
delete pack.skill;
2024-04-15 18:46:41 +00:00
game.addVideo("arrangeLib", null, pack);
game.addOverDialog = function (dialog) {
dialog.addText("共计通过" + _status.qianlidanji.completeNumber + "关");
};
lib.element.player.dieAfter = function () {
if (this == game.fellow) return;
_status.characterlist.removeArray(_status.qianlidanji.used);
if (game.zhu == this || !_status.characterlist.length) {
var bool = false;
if (_status.qianlidanji.completeNumber > 5) bool = true;
game.over(bool);
} else {
var next = game.createEvent("qianlidanji_replace", false);
next.setContent(_status.qianlidanji.replace_character);
}
};
lib.element.player.dieAfter2 = function () {
_status.characterlist.removeArray(_status.qianlidanji.used);
};
game.zhu.dieAfter = lib.element.player.dieAfter;
game.fan.dieAfter = lib.element.player.dieAfter;
game.zhu.dieAfter2 = lib.element.player.dieAfter2;
game.fan.dieAfter2 = lib.element.player.dieAfter2;
2023-11-06 18:07:27 +00:00
});
};
2024-04-15 18:46:41 +00:00
},
},
2020-08-11 13:05:00 +00:00
},
2024-04-15 18:46:41 +00:00
liangjunduilei: {
name: "两军对垒",
mode: "versus",
submode: "2v2",
showcase: function (init) {
var node = this;
var player1, player2;
var list = [
["re_sp_zhugeliang", "yujin_yujin", "re_zhangliao", "re_lusu"],
["re_huangzhong", "re_xiahouyuan", "zhanghe", "xin_fazheng"],
["re_caocao", "xin_yuanshao", "guotufengji", "re_guojia"],
["chunyuqiong", "sp_xuyou", "re_xuhuang", "gaolan"],
["re_sp_zhugeliang", "re_zhangzhang", "guyong", "re_lusu"],
["yj_jushou", "re_caocao", "jsp_guanyu", "re_yanwen"],
["re_lingtong", "re_lidian", "re_zhangliao", "re_ganning"],
["re_guanyu", "caoren", "re_lvmeng", "guanping"],
2020-07-31 02:16:01 +00:00
].randomGet();
2024-04-15 18:46:41 +00:00
if (_status.keyVerified) {
list = [["caozhen", "key_hisako", "key_iwasawa", "sp_key_kanade"]].randomGet();
2020-07-31 02:16:01 +00:00
}
2024-04-15 18:46:41 +00:00
if (init) {
player1 = ui.create.player(null, true);
player2 = ui.create.player(null, true);
2020-07-31 02:16:01 +00:00
player1.node.marks.remove();
player1.node.hp.remove();
player2.node.marks.remove();
player2.node.hp.remove();
2024-04-15 18:46:41 +00:00
player1.style.left = "20px";
player1.style.top = "20px";
player1.style.transform = "scale(0.9)";
2020-07-31 02:16:01 +00:00
player1.node.count.remove();
2024-04-15 18:46:41 +00:00
player2.style.left = "auto";
player2.style.right = "20px";
player2.style.top = "20px";
player2.style.transform = "scale(0.9)";
2020-07-31 02:16:01 +00:00
player2.node.count.remove();
this.appendChild(player1);
this.appendChild(player2);
2024-04-15 18:46:41 +00:00
this.player1 = player1;
this.player2 = player2;
} else {
player1 = this.player1;
player2 = this.player2;
2020-07-31 02:16:01 +00:00
}
2024-04-15 18:46:41 +00:00
var player3, player4;
if (init) {
player3 = ui.create.player(null, true);
player4 = ui.create.player(null, true);
2020-07-31 02:16:01 +00:00
player3.node.marks.remove();
player3.node.hp.remove();
player4.node.marks.remove();
player4.node.hp.remove();
2024-04-15 18:46:41 +00:00
player3.style.left = "60px";
player3.style.top = "120px";
player3.style.transform = "scale(0.9)";
2020-07-31 02:16:01 +00:00
player3.node.count.remove();
2024-04-15 18:46:41 +00:00
player4.style.left = "auto";
player4.style.right = "60px";
player4.style.top = "120px";
player4.style.transform = "scale(0.9)";
2020-07-31 02:16:01 +00:00
player4.node.count.remove();
this.appendChild(player3);
this.appendChild(player4);
2024-04-15 18:46:41 +00:00
this.player3 = player3;
this.player4 = player4;
} else {
player3 = this.player3;
player4 = this.player4;
2020-07-31 02:16:01 +00:00
}
2021-11-26 14:55:37 +00:00
player1.init(list[0]);
player2.init(list[1]);
player3.init(list[3]);
player4.init(list[2]);
2020-07-31 02:16:01 +00:00
},
2024-04-15 18:46:41 +00:00
intro: ["双方使用特定的武将,搭配特定的技能,还原特定的经典场景"],
content: {
submode: "two",
chooseCharacterBefore: function () {
var list = [
2023-11-06 18:07:27 +00:00
{
2024-04-15 18:46:41 +00:00
name: "草船借箭",
place: [true, false, false, true],
character: ["re_sp_zhugeliang", "yujin_yujin", "re_zhangliao", "re_lusu"],
lib: {
character: {
re_sp_zhugeliang: [
"male",
"shu",
3,
["tiaoxin", "bazhen", "feiying"],
[],
],
yujin_yujin: ["male", "wei", 4, ["jiangchi", "danshou"], []],
re_zhangliao: ["male", "wei", 4, ["benxi", "tuifeng", "qingxi"], []],
re_lusu: ["male", "wu", 3, ["kaikang", "shenxian"], []],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
re_sp_zhugeliang: "诸葛卧龙",
yujin_yujin: "于文则",
re_zhangliao: "张文远",
re_lusu: "鲁子敬",
2023-11-06 18:07:27 +00:00
},
},
},
{
2024-04-15 18:46:41 +00:00
name: "定军山之战",
place: [true, false, false, true],
character: ["re_huangzhong", "re_xiahouyuan", "zhanghe", "xin_fazheng"],
lib: {
character: {
re_huangzhong: [
"male",
"shu",
4,
["yingjian", "weikui", "gzyinghun"],
[],
],
re_xiahouyuan: [
"male",
"wei",
4,
["benxi", "yaowu", "dujin", "juesi"],
[],
],
zhanghe: ["male", "wei", 4, ["kaikang", "xingshang", "zhiheng"], []],
xin_fazheng: [
"male",
"shu",
4,
["xinfu_zhanji", "nzry_chenglve", "yiji"],
[],
],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
re_huangzhong: "定军黄忠",
re_xiahouyuan: "定军妙才",
zhanghe: "定军张郃",
xin_fazheng: "定军法正",
2023-11-06 18:07:27 +00:00
},
},
},
{
2024-04-15 18:46:41 +00:00
name: "官渡追击战",
place: [false, true, true, false],
character: ["re_caocao", "xin_yuanshao", "guotufengji", "re_guojia"],
lib: {
character: {
re_caocao: ["male", "wei", 4, ["fankui", "zhuiji", "duanbing"], []],
xin_yuanshao: [
"male",
"qun",
"3/6",
["reluanji", "kuanggu", "benghuai", "weizhong"],
[],
],
guotufengji: [
"male",
"qun",
2,
["sijian", "jigong", "shifei", "jianying"],
[],
],
re_guojia: ["male", "wei", 3, ["yiji", "sanyao", "gongxin"], []],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
re_caocao: "官渡曹操",
xin_yuanshao: "官渡袁绍",
guotufengji: "袁军智囊",
re_guojia: "官渡郭嘉",
2023-11-06 18:07:27 +00:00
},
},
},
{
2024-04-15 18:46:41 +00:00
name: "奇袭乌巢",
place: [true, false, false, true],
character: ["chunyuqiong", "sp_xuyou", "re_xuhuang", "gaolan"],
lib: {
character: {
chunyuqiong: [
"male",
"qun",
8,
["ranshang", "duliang", "jiuchi"],
[],
],
sp_xuyou: [
"male",
"qun",
3,
["qice", "lianying", "nzry_jianxiang"],
[],
],
re_xuhuang: [
"male",
"wei",
4,
["shenduan", "xiaoguo", "nzry_juzhan"],
[],
],
gaolan: [
"male",
"qun",
4,
["yuanhu", "shensu", "benyu", "suishi"],
[],
],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
chunyuqiong: "乌巢淳于琼",
sp_xuyou: "乌巢许攸",
re_xuhuang: "乌巢徐晃",
gaolan: "乌巢高览",
2023-11-06 18:07:27 +00:00
},
},
},
{
2024-04-15 18:46:41 +00:00
name: "舌战群儒",
place: [false, true, false, true],
character: ["re_zhangzhang", "re_sp_zhugeliang", "guyong", "re_lusu"],
lib: {
character: {
re_sp_zhugeliang: [
"male",
"shu",
3,
["tianbian", "jyzongshi", "xinfu_guolun"],
[],
],
re_zhangzhang: [
"male",
"wu",
3,
["zhuandui", "tiaoxin", "guzheng"],
[],
],
guyong: ["male", "wu", 3, ["qiaoshui", "qicai", "bingyi"], []],
re_lusu: ["male", "wu", 3, ["qingzhongx", "shuimeng"], []],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
re_sp_zhugeliang: "诸葛卧龙",
re_zhangzhang: "张子布",
guyong: "顾元叹",
re_lusu: "鲁子敬",
2023-11-06 18:07:27 +00:00
},
},
},
{
2024-04-15 18:46:41 +00:00
name: "武圣战双雄",
place: [true, false, false, true],
character: ["yj_jushou", "re_caocao", "jsp_guanyu", "re_yanwen"],
lib: {
character: {
yj_jushou: ["male", "qun", 3, ["mingce", "jianyan", "shibei"], []],
re_caocao: ["male", "wei", 4, ["miji", "beige", "feiying"], []],
jsp_guanyu: [
"male",
"wei",
4,
["nuzhan", "jianchu", "new_rewusheng"],
[],
],
re_yanwen: [
"male",
"qun",
4,
["shuangxiong", "zhanyi", "zhichi"],
[],
],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
yj_jushou: "白马沮授",
re_caocao: "白马曹操",
jsp_guanyu: "武圣关羽",
re_yanwen: "颜文双雄",
2023-11-06 18:07:27 +00:00
},
},
},
{
2024-04-15 18:46:41 +00:00
name: "合肥之战",
place: [true, false, false, true],
character: ["re_lingtong", "re_lidian", "re_zhangliao", "re_ganning"],
lib: {
character: {
re_lingtong: ["male", "wu", 4, ["xuanfeng", "zishou", "tiaoxin"], []],
re_lidian: ["male", "wei", 3, ["weijing", "wangxi", "zhuandui"], []],
re_zhangliao: [
"male",
"wei",
3,
["retuxi", "mashu", "reyingzi", "xinpojun"],
[],
],
re_ganning: ["male", "wu", 5, ["lizhan", "jiang", "zhenwei"], []],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
re_lingtong: "合肥凌统",
re_lidian: "合肥李典",
re_zhangliao: "合肥张辽",
re_ganning: "合肥甘宁",
2023-11-06 18:07:27 +00:00
},
},
},
{
2024-04-15 18:46:41 +00:00
name: "荆州之战",
place: [true, false, false, true],
character: ["re_guanyu", "caoren", "re_lvmeng", "guanping"],
lib: {
character: {
re_guanyu: ["male", "shu", 5, ["wusheng", "zishou", "zhongyong"], []],
caoren: [
"male",
"wei",
1,
["xinjiewei", "qiuyuan", "gzbuqu", "xinjushou"],
[],
],
re_lvmeng: [
"male",
"wu",
4,
["gongxin", "duodao", "dujin", "huituo"],
[],
],
guanping: ["male", "shu", 5, ["longyin", "suishi"], []],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
re_guanyu: "荆州关羽",
caoren: "樊城曹仁",
re_lvmeng: "江东吕蒙",
guanping: "荆州关平",
2023-11-06 18:07:27 +00:00
},
},
},
{
2024-04-15 18:46:41 +00:00
name: "雒城之战",
place: [true, false, false, true],
character: ["liubei", "re_wuyi", "zhangren", "pangtong"],
lib: {
character: {
liubei: ["male", "shu", 4, ["rezhijian", "jijiu", "reyingzi"], []],
re_wuyi: ["male", "qun", 4, ["weijing", "rerende"], []],
zhangren: ["male", "qun", 4, ["shefu", "gnsheque"], []],
pangtong: ["male", "shu", 3, ["dujin"], []],
2023-11-06 18:07:27 +00:00
},
2024-04-15 18:46:41 +00:00
translate: {
liubei: "雒城刘备",
re_wuyi: "雒城吴懿",
zhangren: "雒城张任",
pangtong: "雒城庞统",
rezhijian: "厚恩",
zhijian: "厚恩",
jijiu: "驰援",
reyingzi: "征令",
rerende: "遣军",
2023-11-06 18:07:27 +00:00
},
},
},
];
2024-04-15 18:46:41 +00:00
if (_status.keyVerified)
list = [
2023-11-06 18:07:27 +00:00
{
2024-04-15 18:46:41 +00:00
name: "My Song",
place: [false, true, true, false],
character: ["caozhen", "key_hisako", "key_iwasawa", "sp_key_kanade"],
lib: {
character: {
caozhen: ["male", "wei", 4, ["xinsidi", "tuxi"]],
key_hisako: [
"female",
"key",
"2/3",
[
"hisako_yinbao",
"shenzhi",
"shiorimiyuki_banyin",
"hisako_zhuanyun",
],
[],
],
key_iwasawa: [
"female",
"key",
"-999/3",
["iwasawa_yinhang", "iwasawa_mysong", "hisako_zhuanyun"],
],
sp_key_kanade: ["female", "key", 3, ["xinwuyan", "xinbenxi"]],
},
translate: {
caozhen: "突袭教师",
key_hisako: "绝望恶魔",
key_iwasawa: "引吭孤鸦",
sp_key_kanade: "学生会长",
},
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
{
name: "Day Game",
place: [false, true, true, false],
character: ["key_yuzuru", "sp_key_kanade", "key_ayato", "key_hinata"],
lib: {
character: {
key_yuzuru: ["male", "key", 4, ["hinata_qiulve", "kurou"]],
sp_key_kanade: [
"female",
"key",
3,
["hinata_qiulve", "benxi"],
[],
],
key_ayato: ["male", "key", 3, ["hinata_qiulve", "retieji"]],
key_hinata: [
"female",
"key",
4,
["hinata_qiulve", "hinata_ehou"],
],
},
translate: {
key_yuzuru: "新秀球王",
sp_key_kanade: "学生会长",
key_ayato: "副会长",
key_hinata: "球队领袖",
},
2023-11-06 18:07:27 +00:00
},
},
2024-04-15 18:46:41 +00:00
];
game.liangjunduilei = list;
game.chooseCharacterTwo = function () {
var next = game.createEvent("chooseCharacter");
next.setContent(function () {
"step 0";
for (var i in lib.skill) {
if (lib.skill[i].audio && !lib.skill[i].equipSkill)
lib.skill[i].audio = false;
if (lib.skill[i].changeSeat) {
lib.skill[i] = {};
if (lib.translate[i + "_info"]) {
lib.translate[i + "_info"] = "此模式下不可用";
2023-11-06 18:07:27 +00:00
}
}
}
2024-04-15 18:46:41 +00:00
ui.arena.classList.add("choose-character");
var list = game.liangjunduilei;
var id = lib.status.videoId++;
var choiceList = ui.create.dialog("请选择要游玩的剧情", "forcebutton");
choiceList.videoId = id;
choiceList.add([
list.map((item, i) => {
return [
i,
`<div class="popup text center" style="width:calc(100% - 10px);display:inline-block">${item.name}</div>`,
];
}),
"textbutton",
]);
game.me.chooseButton(true).set("dialog", id).set("onfree", true);
"step 1";
var pack = game.liangjunduilei[result.links[0]];
game.versusVideoName = pack.name;
if (get.is.phoneLayout()) {
ui.duileiInfo = ui.create.div(".touchinfo.left", ui.window);
} else {
ui.duileiInfo = ui.create.div(ui.gameinfo);
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
ui.duileiInfo.innerHTML = "当前剧情:" + pack.name;
for (var i in pack.lib) {
for (var j in pack.lib[i]) {
lib[i][j] = pack.lib[i][j];
2023-11-06 18:07:27 +00:00
}
}
2024-04-15 18:46:41 +00:00
var player = game.players.randomGet();
_status.firstAct = player;
for (var i = 0; i < 4; i++) {
2023-11-06 18:07:27 +00:00
player.init(pack.character[i]);
2024-04-15 18:46:41 +00:00
player.side = pack.place[i];
player = player.next;
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < game.players.length; i++) {
if (game.players[i].side == game.me.side) {
game.players[i].node.identity.firstChild.innerHTML = "友";
} else {
game.players[i].node.identity.firstChild.innerHTML = "敌";
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
game.players[i].node.identity.dataset.color =
game.players[i].side + "zhu";
2023-11-06 18:07:27 +00:00
}
2024-04-15 18:46:41 +00:00
game.addVideo("arrangeLib", null, pack.lib);
setTimeout(function () {
ui.arena.classList.remove("choose-character");
}, 500);
if (get.config("two_phaseswap")) {
game.addGlobalSkill("autoswap");
if (lib.config.show_handcardbutton) {
ui.versushs = ui.create.system("手牌", null, true);
lib.setPopped(ui.versushs, game.versusHoverHandcards, 220);
2023-11-06 18:07:27 +00:00
}
}
});
};
2024-04-15 18:46:41 +00:00
},
},
2020-07-31 02:16:01 +00:00
},
2024-04-15 18:46:41 +00:00
scene: {
name: "创建场景",
content: {
submode: "normal",
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
nostart: true,
fullshow: true,
template: {
mode: "identity",
init: function () {
game.saveConfig("double_character", false, "identity");
_status.brawl.playerNumber = _status.brawl.scene.players.length;
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
showcase: function (init) {
if (init) {
var name = lib.brawl[this.link].name;
var scene = lib.storage.scene[name];
ui.create.node("button", "编辑场景", this, function () {
_status.sceneToLoad = scene;
2018-04-17 07:32:43 +00:00
game.switchScene();
});
2024-04-15 18:46:41 +00:00
if (_status.extensionmade.includes(name)) {
ui.create.node(
"button",
"管理扩展",
this,
function () {
ui.click.configMenu();
ui.click.extensionTab(name);
},
{ marginLeft: "6px" }
);
} else {
ui.create.node(
"button",
"删除场景",
this,
function () {
if (confirm("确定删除" + name + "")) {
game.removeScene(name);
}
},
{ marginLeft: "6px" }
);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
ui.create.node(
"button",
"导出扩展",
this,
function () {
var str =
'{name:"' +
name +
'",content:function(){\nif(lib.config.mode=="brawl"){\n' +
"if(!lib.storage.scene) lib.storage.scene={};\n" +
'if(!lib.storage.scene["' +
name +
'"]){\nlib.storage.scene["' +
name +
'"]=' +
get.stringify(scene) +
";\n_status.extensionscene=true;}\n" +
"if(!_status.extensionmade) _status.extensionmade=[];\n" +
'_status.extensionmade.push("' +
name +
'");\n}}\n}';
var extension = {
"extension.js":
'game.import("extension",function(lib,game,ui,get,ai,_status){return ' +
str +
"})",
};
game.importExtension(extension, null, name);
},
{ marginLeft: "6px" }
);
2018-04-17 07:32:43 +00:00
}
},
2024-04-15 18:46:41 +00:00
content: {
submode: "normal",
noAddSetting: true,
identityShown: true,
orderedPile: true,
cardPile: function (list) {
2018-04-17 07:32:43 +00:00
list.randomSort();
2024-04-15 18:46:41 +00:00
var scene = _status.brawl.scene;
var inpile = [];
for (var i = 0; i < list.length; i++) {
if (lib.card[list[i][2]]) {
if (lib.config.bannedcards.includes(list[i][2])) continue;
if (game.bannedcards && game.bannedcards.includes(list[i][2])) continue;
2018-04-17 07:32:43 +00:00
inpile.add(list[i][2]);
}
}
2024-04-15 18:46:41 +00:00
var parseInfo = function (info) {
var info2 = [];
if (info[1] == "random") {
info2.push(["club", "spade", "heart", "diamond"].randomGet());
} else {
2018-04-17 07:32:43 +00:00
info2.push(info[1]);
}
2024-04-15 18:46:41 +00:00
if (info[2] == "random") {
info2.push(Math.ceil(Math.random() * 13));
} else {
2018-04-17 07:32:43 +00:00
info2.push(info[2]);
}
2024-04-15 18:46:41 +00:00
if (info[0] == "random") {
2018-04-17 07:32:43 +00:00
info2.push(inpile.randomGet());
2024-04-15 18:46:41 +00:00
} else {
2018-04-17 07:32:43 +00:00
info2.push(info[0]);
}
return info2;
2024-04-15 18:46:41 +00:00
};
if (scene.replacepile) {
list.length = 0;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = scene.cardPileTop.length - 1; i >= 0; i--) {
2018-04-17 07:32:43 +00:00
list.unshift(parseInfo(scene.cardPileTop[i]));
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < scene.cardPileBottom.length; i++) {
2018-04-17 07:32:43 +00:00
list.push(parseInfo(scene.cardPileBottom[i]));
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < scene.discardPile.length; i++) {
2018-04-17 07:32:43 +00:00
ui.create.card(ui.discardPile).init(parseInfo(scene.discardPile[i]));
}
return list;
},
2024-04-15 18:46:41 +00:00
gameStart: function () {
for (var i = 0; i < game.players.length; i++) {
2018-04-17 07:32:43 +00:00
game.players[i].node.marks.show();
game.players[i].node.name.show();
game.players[i].node.name2.show();
2024-04-15 18:46:41 +00:00
var info = game.players[i].brawlinfo;
if (info.maxHp) {
game.players[i].maxHp = info.maxHp;
if (game.players[i].hp > game.players[i].maxHp) {
game.players[i].hp = game.players[i].maxHp;
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
if (info.hp) {
game.players[i].hp = info.hp;
if (game.players[i].hp > game.players[i].maxHp) {
game.players[i].maxHp = game.players[i].hp;
2018-04-17 07:32:43 +00:00
}
}
game.players[i].update();
}
2024-04-15 18:46:41 +00:00
var scene = _status.brawl.scene;
var over = function (str) {
switch (str) {
case "win":
game.over(true);
break;
case "lose":
game.over(false);
break;
case "tie":
game.over("平局");
break;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
};
if (scene.turns) {
var turns = scene.turns[0];
lib.onphase.push(function () {
2018-04-17 07:32:43 +00:00
turns--;
2024-04-15 18:46:41 +00:00
if (turns < 0) {
2018-04-17 07:32:43 +00:00
over(scene.turns[1]);
}
});
}
2024-04-15 18:46:41 +00:00
if (scene.washes) {
var washes = scene.washes[0];
lib.onwash.push(function () {
2018-04-17 07:32:43 +00:00
washes--;
2024-04-15 18:46:41 +00:00
if (washes <= 0) {
2018-04-17 07:32:43 +00:00
over(scene.washes[1]);
}
});
}
},
2024-04-15 18:46:41 +00:00
chooseCharacterBefore: function () {
var scene = _status.brawl.scene;
var playercontrol = [];
var maxpos = 0;
for (var i = 0; i < scene.players.length; i++) {
if (scene.players[i].playercontrol) {
2018-04-17 07:32:43 +00:00
playercontrol.push(scene.players[i]);
}
2024-04-15 18:46:41 +00:00
maxpos = Math.max(maxpos, scene.players[i].position);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (maxpos < scene.players.length) {
maxpos = scene.players.length;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
var posmap = [];
for (var i = 1; i <= maxpos; i++) {
2018-04-17 07:32:43 +00:00
posmap.push(i);
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < scene.players.length; i++) {
if (scene.players[i].position) {
2018-04-17 07:32:43 +00:00
posmap.remove(scene.players[i].position);
}
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < scene.players.length; i++) {
if (!scene.players[i].position) {
scene.players[i].position = posmap.randomRemove();
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
if (playercontrol.length) {
game.me.brawlinfo = playercontrol.randomGet();
} else {
game.me.brawlinfo = scene.players.randomGet();
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
var getpos = function (info) {
var dp = info.position - game.me.brawlinfo.position;
if (dp < 0) {
dp += maxpos;
2018-04-17 07:32:43 +00:00
}
return dp;
};
2024-04-15 18:46:41 +00:00
scene.players.sort(function (a, b) {
return getpos(a) - getpos(b);
2018-04-17 07:32:43 +00:00
});
2024-04-15 18:46:41 +00:00
var target = game.me;
var createCard = function (info) {
var info2 = [];
if (info[1] == "random") {
info2.push(["club", "spade", "heart", "diamond"].randomGet());
} else {
2018-04-17 07:32:43 +00:00
info2.push(info[1]);
}
2024-04-15 18:46:41 +00:00
if (info[2] == "random") {
info2.push(Math.ceil(Math.random() * 13));
} else {
2018-04-17 07:32:43 +00:00
info2.push(info[2]);
}
2024-04-15 18:46:41 +00:00
if (info[0] == "random") {
2018-04-17 07:32:43 +00:00
info2.push(lib.inpile.randomGet());
2024-04-15 18:46:41 +00:00
} else {
2018-04-17 07:32:43 +00:00
info2.push(info[0]);
}
return ui.create.card().init(info2);
2024-04-15 18:46:41 +00:00
};
_status.firstAct = game.me;
for (var i = 0; i < scene.players.length; i++) {
var info = scene.players[i];
target.brawlinfo = info;
target.identity = info.identity;
if (target.identity == "zhu") target.isZhu = true;
2018-04-17 07:32:43 +00:00
target.setIdentity(info.identity);
target.node.marks.hide();
2024-04-15 18:46:41 +00:00
if (info.name2 != "none" && info.name2 != "random") {
if (info.name == "random") {
target.init(info.name2, info.name2);
2018-04-17 07:32:43 +00:00
target.node.name.hide();
target.node.avatar.hide();
2024-04-15 18:46:41 +00:00
} else {
target.init(info.name, info.name2);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
} else {
if (info.name != "random") {
if (info.name2 == "random") {
target.init(info.name, info.name);
2018-04-17 07:32:43 +00:00
target.node.name2.hide();
target.node.avatar2.hide();
2024-04-15 18:46:41 +00:00
} else {
2018-04-17 07:32:43 +00:00
target.init(info.name);
}
}
}
2024-04-15 18:46:41 +00:00
if (info.linked)
target.classList.add("linked" + (get.is.linked2(target) ? "2" : ""));
if (info.turnedover) target.classList.add("turnedover");
if (info.position < _status.firstAct.brawlinfo.position)
_status.firstAct = target;
var hs = [];
for (var j = 0; j < info.handcards.length; j++) {
2018-04-17 07:32:43 +00:00
hs.push(createCard(info.handcards[j]));
}
2024-04-15 18:46:41 +00:00
if (hs.length) {
2018-04-17 07:32:43 +00:00
target.directgain(hs);
}
2024-04-15 18:46:41 +00:00
for (var j = 0; j < info.equips.length; j++) {
2018-04-17 07:32:43 +00:00
target.$equip(createCard(info.equips[j]));
}
2024-04-15 18:46:41 +00:00
for (var j = 0; j < info.judges.length; j++) {
2018-04-17 07:32:43 +00:00
target.node.judges.appendChild(createCard(info.judges[j]));
}
2024-04-15 18:46:41 +00:00
target = target.next;
2018-04-17 07:32:43 +00:00
}
},
2024-04-15 18:46:41 +00:00
chooseCharacterAi: function (player, list, list2) {
var info = player.brawlinfo;
if (info.name2 != "none") {
if (info.name == "random" && info.name2 == "random") {
list = list.slice(0);
player.init(list.randomRemove(), list.randomRemove());
} else if (info.name == "random") {
player.init(list.randomGet(), info.name2);
} else if (info.name2 == "random") {
player.init(info.name, list.randomGet());
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
} else {
if (info.name == "random") {
2018-04-17 07:32:43 +00:00
player.init(list.randomGet());
}
}
},
2024-04-15 18:46:41 +00:00
chooseCharacter: function (list) {
var info = game.me.brawlinfo;
var event = _status.event;
if (info.name2 == "none") {
if (info.name != "random") {
event.chosen = [info.name];
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
} else {
if (info.name2 == "random" && info.name == "random") {
_status.brawl.doubleCharacter = true;
} else if (info.name == "random") {
game.me.init(info.name2, info.name2);
2018-04-17 07:32:43 +00:00
game.me.node.avatar.hide();
game.me.node.name.hide();
2024-04-15 18:46:41 +00:00
_status.brawl.chooseCharacterStr = "选择主将";
event.modchosen = [info.name, info.name2];
} else if (info.name2 == "random") {
game.me.init(info.name, info.name);
2018-04-17 07:32:43 +00:00
game.me.node.avatar2.hide();
game.me.node.name2.hide();
2024-04-15 18:46:41 +00:00
_status.brawl.chooseCharacterStr = "选择副将";
event.modchosen = [info.name, info.name2];
} else {
event.chosen = [info.name, info.name2];
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
if (game.me.identity == "zhu") return false;
return "nozhu";
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
},
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
showcase: function (init) {
if (init) {
lib.translate.zhu = lib.translate.zhu || "主";
lib.translate.zhong = lib.translate.zhong || "忠";
lib.translate.nei = lib.translate.nei || "内";
lib.translate.fan = lib.translate.fan || "反";
2024-04-15 18:46:41 +00:00
this.style.transition = "all 0s";
this.style.height = this.offsetHeight - 10 + "px";
this.style.overflow = "scroll";
2018-04-17 07:32:43 +00:00
lib.setScroll(this);
2024-04-15 18:46:41 +00:00
var style = { marginLeft: "3px", marginRight: "3px" };
var style2 = {
position: "relative",
display: "block",
left: 0,
top: 0,
marginBottom: "6px",
padding: 0,
width: "100%",
};
var style3 = { marginLeft: "4px", marginRight: "4px", position: "relative" };
2024-04-15 18:46:41 +00:00
var scenename = ui.create.node(
"input",
ui.create.div(style2, "", "场景名称:", this),
{ width: "120px" }
);
scenename.type = "text";
scenename.style.marginTop = "20px";
var sceneintro = ui.create.node(
"input",
ui.create.div(style2, "", "场景描述:", this),
{ width: "120px" }
);
sceneintro.type = "text";
sceneintro.style.marginBottom = "10px";
2024-04-15 18:46:41 +00:00
var line1 = ui.create.div(style2, this);
var addCharacter = ui.create.node(
"button",
"添加角色",
line1,
function () {
// line1.style.display='none';
resetStatus();
editPile.disabled = true;
// editCode.disabled=true;
saveButton.disabled = true;
// exportButton.disabled=true;
line7.style.display = "none";
line2.style.display = "block";
line2_t.style.display = "block";
line3.style.display = "block";
line4.style.display = "block";
line5.style.display = "block";
line6_h.style.display = "block";
line6_e.style.display = "block";
line6_j.style.display = "block";
capt1.style.display = "block";
capt2.style.display = "block";
if (line6_h.childElementCount) capt_h.style.display = "block";
if (line6_e.childElementCount) capt_e.style.display = "block";
if (line6_j.childElementCount) capt_j.style.display = "block";
},
style
);
var editPile = ui.create.node(
"button",
"场景选项",
line1,
function () {
resetCharacter();
// editCode.disabled=true;
saveButton.disabled = true;
// exportButton.disabled=true;
line7.style.display = "none";
line8.style.display = "block";
capt8.style.display = "block";
line9.style.display = "block";
line10.style.display = "block";
line11.style.display = "block";
capt9.style.display = "block";
line3.style.display = "block";
2024-04-15 18:46:41 +00:00
line6_t.style.display = "block";
line6_b.style.display = "block";
line6_d.style.display = "block";
if (line6_t.childElementCount) capt_t.style.display = "block";
if (line6_b.childElementCount) capt_b.style.display = "block";
if (line6_d.childElementCount) capt_d.style.display = "block";
},
style
);
2018-04-17 07:32:43 +00:00
// var editCode=ui.create.node('button','编辑代码',line1,function(){
2020-02-14 05:33:43 +00:00
// console.log(1);
2018-04-17 07:32:43 +00:00
// },style);
2024-04-15 18:46:41 +00:00
var saveButton = ui.create.node(
"button",
"保存场景",
line1,
function () {
if (!scenename.value) {
alert("请填写场景名称");
return;
}
var scene = {
name: scenename.value,
intro: sceneintro.value,
players: [],
cardPileTop: [],
cardPileBottom: [],
discardPile: [],
};
for (var i = 0; i < line7.childElementCount; i++) {
scene.players.push(line7.childNodes[i].info);
}
if (scene.players.length < 2) {
alert("请添加至少两名角色");
return;
}
if (lib.storage.scene[scenename.value]) {
if (_status.currentScene != scenename.value) {
if (!confirm("场景名与现有场景重复,是否覆盖?")) {
return;
}
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
game.removeScene(scenename.value);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < line6_t.childElementCount; i++) {
scene.cardPileTop.push(line6_t.childNodes[i].info);
}
for (var i = 0; i < line6_b.childElementCount; i++) {
scene.cardPileBottom.push(line6_b.childNodes[i].info);
}
for (var i = 0; i < line6_d.childElementCount; i++) {
scene.discardPile.push(line6_d.childNodes[i].info);
}
if (replacepile.checked) {
scene.replacepile = true;
}
if (gameDraw.checked) {
scene.gameDraw = true;
}
if (turnsresult.value != "none") {
scene.turns = [parseInt(turns.value), turnsresult.value];
}
if (washesresult.value != "none") {
scene.washes = [parseInt(washes.value), washesresult.value];
}
lib.storage.scene[scene.name] = scene;
game.save("scene", lib.storage.scene);
game.addScene(scene.name, true);
},
style
);
2024-04-15 18:46:41 +00:00
var capt1 = ui.create.div(style2, "", "角色信息", this);
var line2 = ui.create.div(style2, this);
line2.style.display = "none";
var identity = ui.create.selectlist(
[
["zhu", "主公"],
["zhong", "忠臣"],
["nei", "内奸"],
["fan", "反贼"],
],
"zhu",
line2
);
identity.value = "fan";
identity.style.marginLeft = "3px";
identity.style.marginRight = "3px";
var position = ui.create.selectlist(
[
["0", "随机位置"],
["1", "一号位"],
["2", "二号位"],
["3", "三号位"],
["4", "四号位"],
["5", "五号位"],
["6", "六号位"],
["7", "七号位"],
["8", "八号位"],
],
"1",
line2
);
position.style.marginLeft = "3px";
position.style.marginRight = "3px";
var line2_t = ui.create.div(style2, this);
line2_t.style.display = "none";
2018-04-17 07:32:43 +00:00
// line2_t.style.marginBottom='10px';
2024-04-15 18:46:41 +00:00
ui.create.node("span", "体力:", line2_t);
var hp = ui.create.node("input", line2_t, { width: "40px" });
hp.type = "text";
ui.create.node("span", "体力上限:", line2_t, { marginLeft: "10px" });
var maxHp = ui.create.node("input", line2_t, { width: "40px" });
maxHp.type = "text";
ui.create.node("span", "横置 ", line2_t, { marginLeft: "20px" });
var linked = ui.create.node("input", line2_t);
linked.type = "checkbox";
ui.create.node("span", "翻面 ", line2_t, { marginLeft: "10px" });
var turnedover = ui.create.node("input", line2_t);
turnedover.type = "checkbox";
ui.create.node("span", "玩家 ", line2_t, { marginLeft: "10px" });
var playercontrol = ui.create.node("input", line2_t);
playercontrol.type = "checkbox";
2024-04-15 18:46:41 +00:00
var list = [];
for (var i in lib.character) {
list.push([i, lib.translate[i]]);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
list.sort(function (a, b) {
a = a[0];
b = b[0];
var aa = a,
bb = b;
if (aa.indexOf("_") != -1) {
aa = aa.slice(aa.indexOf("_") + 1);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (bb.indexOf("_") != -1) {
bb = bb.slice(bb.indexOf("_") + 1);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (aa != bb) {
return aa > bb ? 1 : -1;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
return a > b ? 1 : -1;
2018-04-17 07:32:43 +00:00
});
2024-04-15 18:46:41 +00:00
list.unshift(["random", "自选主将"]);
var name1 = ui.create.selectlist(list, list[0], line2);
name1.style.marginLeft = "3px";
name1.style.marginRight = "3px";
name1.style.maxWidth = "80px";
list[0][1] = "自选副将";
list.unshift(["none", "无副将"]);
var name2 = ui.create.selectlist(list, list[0], line2);
name2.style.marginLeft = "3px";
name2.style.marginRight = "3px";
name2.style.maxWidth = "80px";
2024-04-15 18:46:41 +00:00
var capt9 = ui.create.div(style2, "", "编辑牌堆", this);
capt9.style.display = "none";
2024-04-15 18:46:41 +00:00
var capt2 = ui.create.div(style2, "", "添加卡牌", this);
var line3 = ui.create.div(style2, this);
line3.style.display = "none";
capt1.style.display = "none";
capt2.style.display = "none";
2024-04-15 18:46:41 +00:00
var line5 = ui.create.div(style2, this);
line5.style.display = "none";
var pileaddlist = [];
for (var i = 0; i < lib.config.cards.length; i++) {
if (!lib.cardPack[lib.config.cards[i]]) continue;
for (var j = 0; j < lib.cardPack[lib.config.cards[i]].length; j++) {
var cname = lib.cardPack[lib.config.cards[i]][j];
pileaddlist.push([cname, get.translation(cname)]);
if (cname == "sha") {
pileaddlist.push(["huosha", "火杀"]);
pileaddlist.push(["leisha", "雷杀"]);
pileaddlist.push(["icesha", "冰杀"]);
pileaddlist.push(["kamisha", "神杀"]);
pileaddlist.push(["cisha", "刺杀"]);
2018-04-17 07:32:43 +00:00
}
}
}
2024-04-15 18:46:41 +00:00
for (var i in lib.cardPack) {
if (lib.config.all.cards.includes(i)) continue;
for (var j = 0; j < lib.cardPack[i].length; j++) {
var cname = lib.cardPack[i][j];
pileaddlist.push([cname, get.translation(cname)]);
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
pileaddlist.unshift(["random", ["随机卡牌"]]);
var cardpileaddname = ui.create.selectlist(pileaddlist, null, line3);
cardpileaddname.style.marginLeft = "3px";
cardpileaddname.style.marginRight = "3px";
cardpileaddname.style.width = "85px";
var cardpileaddsuit = ui.create.selectlist(
[
["random", "随机花色"],
["heart", "红桃"],
["diamond", "方片"],
["club", "梅花"],
["spade", "黑桃"],
],
null,
line3
);
cardpileaddsuit.style.marginLeft = "3px";
cardpileaddsuit.style.marginRight = "3px";
cardpileaddsuit.style.width = "85px";
var cardpileaddnumber = ui.create.selectlist(
[["random", "随机点数"], 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
null,
line3
);
cardpileaddnumber.style.marginLeft = "3px";
cardpileaddnumber.style.marginRight = "3px";
cardpileaddnumber.style.width = "85px";
2024-04-15 18:46:41 +00:00
var fakecard = function (info, position, capt) {
var name = info[0],
suit = info[1],
number = info[2];
var card = ui.create.card(null, "noclick", true);
card.style.zoom = 0.6;
number = parseInt(cardpileaddnumber.value);
var name2 = name;
var suit2 = suit;
var number2 = number;
if (name2 == "random") name2 = "sha";
if (suit2 == "random") suit2 = "?";
if (!number2) {
number = "random";
number2 = "?";
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
card.init([suit2, number2, name2]);
card.info = info;
if (name == "random") {
card.node.name.innerHTML = get.verticalStr("随机卡牌");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (position && capt) {
card.listen(function () {
2018-04-17 07:32:43 +00:00
this.remove();
2024-04-15 18:46:41 +00:00
if (!position.childElementCount) capt.style.display = "none";
2018-04-17 07:32:43 +00:00
});
position.appendChild(card);
}
return card;
};
2024-04-15 18:46:41 +00:00
var cc_h = ui.create.node("button", "加入手牌区", line5, function () {
fakecard(
[cardpileaddname.value, cardpileaddsuit.value, cardpileaddnumber.value],
line6_h,
capt_h
);
capt_h.style.display = "block";
2018-04-17 07:32:43 +00:00
});
2024-04-15 18:46:41 +00:00
var cc_e = ui.create.node("button", "加入装备区", line5, function () {
if (get.type(cardpileaddname.value) != "equip") return;
var subtype = get.subtype(cardpileaddname.value);
for (var i = 0; i < line6_e.childElementCount; i++) {
if (get.subtype(line6_e.childNodes[i].name) == subtype) {
line6_e.childNodes[i].remove();
break;
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
fakecard(
[cardpileaddname.value, cardpileaddsuit.value, cardpileaddnumber.value],
line6_e,
capt_e
);
capt_e.style.display = "block";
2018-04-17 07:32:43 +00:00
});
2024-04-15 18:46:41 +00:00
var cc_j = ui.create.node("button", "加入判定区", line5, function () {
if (get.type(cardpileaddname.value) != "delay") return;
for (var i = 0; i < line6_j.childElementCount; i++) {
if (line6_j.childNodes[i].name == cardpileaddname.value) {
line6_j.childNodes[i].remove();
break;
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
fakecard(
[cardpileaddname.value, cardpileaddsuit.value, cardpileaddnumber.value],
line6_j,
capt_j
);
capt_j.style.display = "block";
2018-04-17 07:32:43 +00:00
});
2024-04-15 18:46:41 +00:00
cc_h.style.marginLeft = "3px";
cc_h.style.marginRight = "3px";
cc_h.style.width = "85px";
cc_e.style.marginLeft = "3px";
cc_e.style.marginRight = "3px";
cc_e.style.width = "85px";
cc_j.style.marginLeft = "3px";
cc_j.style.marginRight = "3px";
cc_j.style.width = "85px";
2024-04-15 18:46:41 +00:00
var capt_h = ui.create.div(style2, "", "手牌区", this);
var line6_h = ui.create.div(style2, this);
var capt_e = ui.create.div(style2, "", "装备区", this);
var line6_e = ui.create.div(style2, this);
var capt_j = ui.create.div(style2, "", "判定区", this);
var line6_j = ui.create.div(style2, this);
line6_j.style.marginBottom = "10px";
capt_h.style.display = "none";
capt_e.style.display = "none";
capt_j.style.display = "none";
2024-04-15 18:46:41 +00:00
var line10 = ui.create.div(style2, this);
line10.style.display = "none";
var ac_h = ui.create.node("button", "加入牌堆顶", line10, function () {
fakecard(
[cardpileaddname.value, cardpileaddsuit.value, cardpileaddnumber.value],
line6_t,
capt_t
);
capt_t.style.display = "block";
2018-04-17 07:32:43 +00:00
});
2024-04-15 18:46:41 +00:00
var ac_e = ui.create.node("button", "加入牌堆底", line10, function () {
fakecard(
[cardpileaddname.value, cardpileaddsuit.value, cardpileaddnumber.value],
line6_b,
capt_b
);
capt_b.style.display = "block";
2018-04-17 07:32:43 +00:00
});
2024-04-15 18:46:41 +00:00
var ac_j = ui.create.node("button", "加入弃牌堆", line10, function () {
fakecard(
[cardpileaddname.value, cardpileaddsuit.value, cardpileaddnumber.value],
line6_d,
capt_d
);
capt_d.style.display = "block";
2018-04-17 07:32:43 +00:00
});
2024-04-15 18:46:41 +00:00
ac_h.style.marginLeft = "3px";
ac_h.style.marginRight = "3px";
ac_h.style.width = "85px";
ac_e.style.marginLeft = "3px";
ac_e.style.marginRight = "3px";
ac_e.style.width = "85px";
ac_j.style.marginLeft = "3px";
ac_j.style.marginRight = "3px";
ac_j.style.width = "85px";
2024-04-15 18:46:41 +00:00
var line11 = ui.create.div(style2, this, "", "<span>替换牌堆</span>");
line11.style.display = "none";
var replacepile = ui.create.node("input", line11);
replacepile.type = "checkbox";
2024-04-15 18:46:41 +00:00
ui.create.node("span", line11, "开局摸牌", { marginLeft: "10px" });
var gameDraw = ui.create.node("input", line11);
gameDraw.type = "checkbox";
gameDraw.checked = true;
2024-04-15 18:46:41 +00:00
var capt_t = ui.create.div(style2, "", "牌堆顶", this);
var line6_t = ui.create.div(style2, this);
var capt_b = ui.create.div(style2, "", "牌堆底", this);
var line6_b = ui.create.div(style2, this);
var capt_d = ui.create.div(style2, "", "弃牌堆", this);
var line6_d = ui.create.div(style2, this);
line6_d.style.marginBottom = "10px";
capt_t.style.display = "none";
capt_b.style.display = "none";
capt_d.style.display = "none";
2024-04-15 18:46:41 +00:00
var line4 = ui.create.div(style2, this);
line4.style.display = "none";
line4.style.marginTop = "20px";
var resetCharacter = function () {
2018-04-17 07:32:43 +00:00
// line1.style.display='block';
2024-04-15 18:46:41 +00:00
editPile.disabled = false;
2018-04-17 07:32:43 +00:00
// editCode.disabled=false;
2024-04-15 18:46:41 +00:00
saveButton.disabled = false;
2018-04-17 07:32:43 +00:00
// exportButton.disabled=false;
2024-04-15 18:46:41 +00:00
line7.style.display = "block";
line2.style.display = "none";
line2_t.style.display = "none";
line3.style.display = "none";
line4.style.display = "none";
line5.style.display = "none";
line6_h.style.display = "none";
line6_e.style.display = "none";
line6_j.style.display = "none";
capt1.style.display = "none";
capt2.style.display = "none";
capt_h.style.display = "none";
capt_e.style.display = "none";
capt_j.style.display = "none";
2024-04-15 18:46:41 +00:00
name1.value = "random";
name2.value = "none";
identity.value = "fan";
position.value = "0";
hp.value = "";
maxHp.value = "";
line6_h.innerHTML = "";
line6_e.innerHTML = "";
line6_j.innerHTML = "";
cardpileaddname.value = "random";
cardpileaddsuit.value = "random";
cardpileaddnumber.value = "random";
linked.checked = false;
turnedover.checked = false;
playercontrol.checked = false;
2018-04-17 07:32:43 +00:00
};
2024-04-15 18:46:41 +00:00
var createCharacter = function (info) {
var player = ui.create.player(null, true);
player._customintro = function (uiintro) {
if (info.handcards.length) {
uiintro.addText("手牌", true);
var hs = ui.create.div(".buttons");
for (var i = 0; i < info.handcards.length; i++) {
2018-04-17 07:32:43 +00:00
hs.appendChild(fakecard(info.handcards[i]));
}
uiintro.add(hs);
2024-04-15 18:46:41 +00:00
} else {
2018-04-17 07:32:43 +00:00
return false;
}
2024-04-15 18:46:41 +00:00
};
player.info = info;
var name = info.name,
name3 = info.name2;
if (name == "random") {
name = "re_caocao";
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (name3 != "none") {
if (name3 == "random") {
name3 = "liubei";
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
player.init(name, name3);
if (info.name2 == "random") {
player.node.name2.innerHTML = get.verticalStr("自选副将");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
} else {
2018-04-17 07:32:43 +00:00
player.init(name);
}
2024-04-15 18:46:41 +00:00
if (info.name == "random") {
player.node.name.innerHTML = get.verticalStr("自选主将");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (info.maxHp) {
player.maxHp = info.maxHp;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (info.hp) {
player.hp = Math.min(info.hp, player.maxHp);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < info.handcards.length; i++) {
2018-04-17 07:32:43 +00:00
player.node.handcards1.appendChild(ui.create.card());
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < info.equips.length; i++) {
2018-04-17 07:32:43 +00:00
player.$equip(fakecard(info.equips[i]));
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < info.judges.length; i++) {
2018-04-17 07:32:43 +00:00
player.node.judges.appendChild(fakecard(info.judges[i]));
}
player.setIdentity(info.identity);
2024-04-15 18:46:41 +00:00
var pos = info.position;
if (pos == 0) {
pos = "随机位置";
} else {
pos = get.cnNumber(pos, true) + "号位";
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (info.linked && info.turnedover) {
pos += "<br>横置 - 翻面";
} else {
if (info.linked) pos += " - 横置";
if (info.turnedover) pos += " - 翻面";
2018-04-17 07:32:43 +00:00
}
player.setNickname(pos);
player.update();
2024-04-15 18:46:41 +00:00
player.style.transform = "scale(0.7)";
player.style.position = "relative";
player.style.left = 0;
player.style.top = 0;
player.style.margin = "-18px";
2018-04-17 07:32:43 +00:00
player.node.marks.remove();
2018-04-17 07:32:43 +00:00
line7.appendChild(player);
2024-04-15 18:46:41 +00:00
player.listen(function () {
if (confirm("是否删除此角色?")) {
2018-04-17 07:32:43 +00:00
this.remove();
}
});
2018-04-17 07:32:43 +00:00
return player;
};
2024-04-15 18:46:41 +00:00
ui.create.div(".menubutton.large", "确定", line4, style3, function () {
var info = {
name: name1.value,
name2: name2.value,
identity: identity.value,
position: parseInt(position.value),
hp: parseInt(hp.value),
maxHp: parseInt(maxHp.value),
linked: linked.checked,
turnedover: turnedover.checked,
playercontrol: playercontrol.checked,
handcards: [],
equips: [],
judges: [],
2018-04-17 07:32:43 +00:00
};
2024-04-15 18:46:41 +00:00
for (var i = 0; i < line7.childElementCount; i++) {
if (info.identity == "zhu" && line7.childNodes[i].info.identity == "zhu") {
alert("不能有两个主公");
2018-04-17 07:32:43 +00:00
return;
}
2024-04-15 18:46:41 +00:00
if (
info.position != 0 &&
info.position == line7.childNodes[i].info.position
) {
alert("座位与现在角色相同");
2018-04-17 07:32:43 +00:00
return;
}
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < line6_h.childElementCount; i++) {
2018-04-17 07:32:43 +00:00
info.handcards.push(line6_h.childNodes[i].info);
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < line6_e.childElementCount; i++) {
2018-04-17 07:32:43 +00:00
info.equips.push(line6_e.childNodes[i].info);
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < line6_j.childElementCount; i++) {
2018-04-17 07:32:43 +00:00
info.judges.push(line6_j.childNodes[i].info);
}
createCharacter(info);
resetCharacter();
});
2024-04-15 18:46:41 +00:00
ui.create.div(".menubutton.large", "取消", line4, style3, resetCharacter);
var line7 = ui.create.div(style2, this);
line7.style.marginTop = "12px";
2024-04-15 18:46:41 +00:00
var capt8 = ui.create.div(style2, "", "胜负条件", this);
capt8.style.display = "none";
var line8 = ui.create.div(style2, this);
line8.style.display = "none";
line8.style.marginTop = "10px";
line8.style.marginBottom = "10px";
var turnslist = [
["1", "一"],
["2", "两"],
["3", "三"],
["4", "四"],
["5", "五"],
["6", "六"],
["7", "七"],
["8", "八"],
["9", "九"],
["10", "十"],
];
var results = [
["none", "无"],
["win", "胜利"],
["lose", "失败"],
["tie", "平局"],
];
var turns = ui.create.selectlist(turnslist, "1", line8);
ui.create.node("span", "个回合后", line8, style);
var turnsresult = ui.create.selectlist(results, "none", line8);
2024-04-15 18:46:41 +00:00
var washes = ui.create.selectlist(turnslist, "1", line8);
washes.style.marginLeft = "20px";
ui.create.node("span", "次洗牌后", line8, style);
var washesresult = ui.create.selectlist(results, "none", line8);
2024-04-15 18:46:41 +00:00
var line9 = ui.create.div(style2, this);
line9.style.display = "none";
line9.style.marginTop = "20px";
var resetStatus = function (all) {
2018-04-17 07:32:43 +00:00
// editCode.disabled=false;
2024-04-15 18:46:41 +00:00
saveButton.disabled = false;
2018-04-17 07:32:43 +00:00
// exportButton.disabled=false;
2024-04-15 18:46:41 +00:00
cardpileaddname.value = "random";
cardpileaddsuit.value = "random";
cardpileaddnumber.value = "random";
2024-04-15 18:46:41 +00:00
line8.style.display = "none";
capt8.style.display = "none";
capt9.style.display = "none";
line9.style.display = "none";
line10.style.display = "none";
line11.style.display = "none";
line3.style.display = "none";
line7.style.display = "block";
2024-04-15 18:46:41 +00:00
line6_t.style.display = "none";
line6_b.style.display = "none";
line6_d.style.display = "none";
capt_t.style.display = "none";
capt_b.style.display = "none";
capt_d.style.display = "none";
2024-04-15 18:46:41 +00:00
if (all === true) {
replacepile.checked = false;
gameDraw.checked = true;
turns.value = "1";
turnsresult.value = "none";
washes.value = "1";
washesresult.value = "none";
line6_t.innerHTML = "";
line6_b.innerHTML = "";
line6_d.innerHTML = "";
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
};
2024-04-15 18:46:41 +00:00
ui.create.div(".menubutton.large", "确定", line9, style3, resetStatus);
2024-04-15 18:46:41 +00:00
game.addSceneClear = function () {
2018-04-17 07:32:43 +00:00
resetCharacter();
resetStatus(true);
2024-04-15 18:46:41 +00:00
scenename.value = "";
sceneintro.value = "";
line7.innerHTML = "";
2018-04-17 07:32:43 +00:00
delete _status.currentScene;
};
2024-04-15 18:46:41 +00:00
game.loadScene = function (scene) {
2018-04-17 07:32:43 +00:00
resetCharacter();
resetStatus(true);
2024-04-15 18:46:41 +00:00
scenename.value = scene.name;
sceneintro.value = scene.intro;
_status.currentScene = scene.name;
line7.innerHTML = "";
if (scene.replacepile) replacepile.checked = true;
if (scene.gameDraw) gameDraw.checked = true;
else gameDraw.checked = false;
if (scene.turns) {
turns.value = scene.turns[0].toString();
turnsresult.value = scene.turns[1];
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (scene.washes) {
washes.value = scene.washes[0].toString();
washesresult.value = scene.washes[1];
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < scene.cardPileTop.length; i++) {
fakecard(scene.cardPileTop[i], line6_t, capt_t);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < scene.cardPileBottom.length; i++) {
fakecard(scene.cardPileBottom[i], line6_b, capt_b);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < scene.discardPile.length; i++) {
fakecard(scene.discardPile[i], line6_d, capt_d);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
for (var i = 0; i < scene.players.length; i++) {
2018-04-17 07:32:43 +00:00
createCharacter(scene.players[i]);
}
};
}
2024-04-15 18:46:41 +00:00
if (_status.sceneToLoad) {
var scene = _status.sceneToLoad;
2018-04-17 07:32:43 +00:00
delete _status.sceneToLoad;
game.loadScene(scene);
}
2024-04-15 18:46:41 +00:00
},
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
stage: {
name: "创建关卡",
content: {
submode: "normal",
2018-04-17 07:32:43 +00:00
},
2024-04-15 18:46:41 +00:00
nostart: true,
fullshow: true,
template: {
showcase: function (init) {
if (init) {
var name = lib.brawl[this.link].name;
var stage = lib.storage.stage[name];
var style2 = {
position: "relative",
display: "block",
left: 0,
top: 0,
marginBottom: "10px",
padding: 0,
width: "100%",
};
var style3 = { marginLeft: "4px", marginRight: "4px", position: "relative" };
var line1 = ui.create.div(style2, this);
var line2 = ui.create.div(style2, this);
line2.style.lineHeight = "50px";
line2.style.overflow = "scroll";
2018-01-05 04:46:56 +00:00
lib.setScroll(line2);
2024-04-15 18:46:41 +00:00
var container = this.parentNode.parentNode;
setTimeout(function () {
var rect1 = container.getBoundingClientRect();
var rect2 = line2.getBoundingClientRect();
line2.style.height = rect1.height - (rect2.top - rect1.top) + "px";
}, 1000);
if (_status.extensionmade.includes(name)) {
ui.create.node(
"button",
"管理扩展",
line1,
function () {
ui.click.configMenu();
ui.click.extensionTab(name);
},
{ marginLeft: "6px" }
);
} else {
ui.create.node(
"button",
"删除关卡",
line1,
function () {
if (confirm("确定删除" + name + "")) {
game.removeStage(name);
}
},
{ marginLeft: "6px" }
);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
ui.create.node(
"button",
"导出扩展",
line1,
function () {
var level = stage.level;
stage.level = 0;
var str =
'{name:"' +
name +
'",content:function(){\nif(lib.config.mode=="brawl"){\n' +
"if(!lib.storage.stage) lib.storage.stage={};\n" +
'if(!lib.storage.stage["' +
name +
'"]){\nlib.storage.stage["' +
name +
'"]=' +
get.stringify(stage) +
";\n_status.extensionstage=true;}\n" +
"if(!_status.extensionmade) _status.extensionmade=[];\n" +
'_status.extensionmade.push("' +
name +
'");\n}}\n}';
stage.level = level;
var extension = {
"extension.js":
'game.import("extension",function(lib,game,ui,get,ai,_status){return ' +
str +
"})",
};
game.importExtension(extension, null, name);
},
{ marginLeft: "6px" }
);
var noactive = true;
var clickNode = function () {
if (this.classList.contains("unselectable")) return;
if (!this.classList.contains("active")) {
var active = this.parentNode.querySelector(".menubutton.large.active");
if (active) {
active.classList.remove("active");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
this.classList.add("active");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
};
for (var i = 0; i < stage.scenes.length; i++) {
var node = ui.create.div(
".menubutton.large",
line2,
stage.scenes[i].name,
style3,
clickNode
);
node.index = i;
if (stage.mode == "sequal") {
if (i == stage.level) {
node.classList.add("active");
noactive = false;
} else {
node.classList.add("unselectable");
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
} else if (stage.mode == "normal") {
if (i > stage.level) {
node.classList.add("unselectable");
2018-04-17 07:32:43 +00:00
}
}
2024-04-15 18:46:41 +00:00
if (lib.storage.lastStage == i && !node.classList.contains("unselectable")) {
node.classList.add("active");
noactive = false;
} else if (
lib.storage.lastStage == undefined &&
noactive &&
!node.classList.contains("unselectable")
) {
node.classList.add("active");
noactive = false;
2018-04-17 07:32:43 +00:00
}
}
}
},
},
2024-04-15 18:46:41 +00:00
showcase: function (init) {
if (_status.sceneChanged) {
init = true;
this.innerHTML = "";
2018-04-17 07:32:43 +00:00
delete _status.sceneChanged;
}
2024-04-15 18:46:41 +00:00
if (init) {
this.style.transition = "all 0s";
this.style.height = this.offsetHeight - 10 + "px";
2018-04-17 07:32:43 +00:00
// this.style.overflow='scroll';
// lib.setScroll(this);
2024-04-15 18:46:41 +00:00
var style2 = {
position: "relative",
display: "block",
left: 0,
top: 0,
marginBottom: "6px",
padding: 0,
width: "100%",
};
var style3 = { marginLeft: "4px", marginRight: "4px", position: "relative" };
2024-04-15 18:46:41 +00:00
var scenename = ui.create.node(
"input",
ui.create.div(style2, "", "关卡名称:", this),
{ width: "120px" }
);
scenename.type = "text";
scenename.style.marginTop = "20px";
var sceneintro = ui.create.node(
"input",
ui.create.div(style2, "", "关卡描述:", this),
{ width: "120px" }
);
sceneintro.type = "text";
sceneintro.style.marginBottom = "10px";
2024-04-15 18:46:41 +00:00
var line1 = ui.create.div(style2, this);
var line2 = ui.create.div(style2, this);
line1.style.marginBottom = "10px";
line2.style.lineHeight = "50px";
line2.style.overflow = "scroll";
2018-01-05 04:46:56 +00:00
lib.setScroll(line2);
2024-04-15 18:46:41 +00:00
var container = this.parentNode.parentNode;
setTimeout(function () {
var rect1 = container.getBoundingClientRect();
var rect2 = line2.getBoundingClientRect();
line2.style.height = rect1.height - (rect2.top - rect1.top) + "px";
}, 1000);
var scenes = [];
for (var i in lib.storage.scene) {
scenes.push([i, i]);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
if (!scenes.length) {
alert("请创建至少1个场景");
2018-04-17 07:32:43 +00:00
return;
}
2024-04-15 18:46:41 +00:00
var scenelist = ui.create.selectlist(scenes, null, line1);
var e1 = function () {
if (this.nextSibling) {
this.parentNode.insertBefore(this, this.nextSibling.nextSibling);
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
};
var e2 = function () {
var that = this;
this.movetimeout = setTimeout(function () {
2018-04-17 07:32:43 +00:00
e1.call(that);
2024-04-15 18:46:41 +00:00
}, 500);
};
var e3 = function () {
2018-04-17 07:32:43 +00:00
clearTimeout(this.movetimeout);
delete this.movetimeout;
2024-04-15 18:46:41 +00:00
};
var e4 = function (value) {
var node = ui.create.div(".menubutton.large", value, line2, style3, function () {
if (confirm("是否移除" + this.innerHTML + "")) {
2018-04-17 07:32:43 +00:00
this.remove();
}
});
2024-04-15 18:46:41 +00:00
if (lib.config.touchscreen) {
node.ontouchstart = e2;
node.ontouchend = e3;
node.ontouchmove = e3;
} else {
node.oncontextmenu = e1;
node.onmousedown = e2;
node.onmouseup = e3;
node.onmouseleave = e3;
2018-04-17 07:32:43 +00:00
}
2024-04-15 18:46:41 +00:00
};
var addButton = ui.create.node(
"button",
"添加场景",
line1,
function () {
e4(scenelist.value);
},
{ marginLeft: "6px", marginRight: "12px" }
);
var sceneconfig = ui.create.selectlist(
[
["normal", "默认模式"],
["sequal", "连续闯关"],
["free", "自由选关"],
],
null,
line1
);
var saveButton = ui.create.node(
"button",
"保存关卡",
line1,
function () {
if (!scenename.value) {
alert("请填写关卡名称");
2018-04-17 07:32:43 +00:00
return;
}
2024-04-15 18:46:41 +00:00
if (line2.childElementCount < 2) {
alert("请添加至少2个场景");
return;
}
var stage = {
name: scenename.value,
intro: sceneintro.value,
scenes: [],
mode: sceneconfig.value,
level: 0,
};
for (var i = 0; i < line2.childElementCount; i++) {
stage.scenes.push(lib.storage.scene[line2.childNodes[i].innerHTML]);
}
if (lib.storage.stage[scenename.value]) {
if (!confirm("关卡名与现有关卡重复,是否覆盖?")) {
return;
}
game.removeStage(scenename.value);
}
lib.storage.stage[stage.name] = stage;
game.save("stage", lib.storage.stage);
game.addStage(stage.name, true);
},
{ marginLeft: "6px" }
);
game.addStageClear = function () {
scenelist.value = scenes[0][0];
sceneconfig.value = "normal";
scenename.value = "";
sceneintro.value = "";
line2.innerHTML = "";
2018-04-17 07:32:43 +00:00
};
}
2024-04-15 18:46:41 +00:00
},
},
2018-04-17 07:32:43 +00:00
},
2017-04-15 00:25:50 +00:00
};
2017-04-14 23:35:56 +00:00
});