2024-04-15 18:46:41 +00:00
|
|
|
|
"use strict";
|
|
|
|
|
game.import("mode", function (lib, game, ui, get, ai, _status) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return {
|
2024-04-15 18:46:41 +00:00
|
|
|
|
name: "chess",
|
|
|
|
|
canvasUpdates2: [],
|
|
|
|
|
hiddenCharacters: [],
|
|
|
|
|
start: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
_status.gameDrawed = true;
|
|
|
|
|
_status.mode = get.config("chess_mode");
|
|
|
|
|
if (
|
|
|
|
|
lib.config.player_border == "normal" &&
|
|
|
|
|
(lib.config.layout == "long" || lib.config.layout == "long2")
|
|
|
|
|
) {
|
|
|
|
|
ui.arena.classList.add("lslim_player");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
// if(_status.mode=='leader'){
|
|
|
|
|
// _status.mode='combat';
|
|
|
|
|
// }
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (lib.config.test_game) {
|
|
|
|
|
_status.mode = "combat";
|
|
|
|
|
game.saveConfig("additional_player", false, true);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.mode == "combat") {
|
|
|
|
|
_status.first_less = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
for (var i in lib.skill) {
|
|
|
|
|
if (lib.skill[i].changeSeat) {
|
|
|
|
|
lib.skill[i] = {};
|
|
|
|
|
if (lib.translate[i + "_info"]) {
|
|
|
|
|
lib.translate[i + "_info"] = "此模式下不可用";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
lib.init.css(lib.assetURL + "layout/mode", "chess");
|
|
|
|
|
ui.chesssheet = document.createElement("style");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
document.head.appendChild(ui.chesssheet);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var playback = localStorage.getItem(lib.configprefix + "playback");
|
|
|
|
|
lib.treasurelist = [];
|
|
|
|
|
if (get.config("chess_character") || playback || _status.mode == "leader") {
|
|
|
|
|
for (var i in lib.characterPack.mode_chess) {
|
|
|
|
|
if (i.indexOf("treasure_") == 0) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
lib.treasurelist.push(i);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!playback && i.indexOf("leader_") == 0 && _status.mode != "leader") continue;
|
|
|
|
|
lib.character[i] = lib.characterPack.mode_chess[i];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (get.config("chess_card")) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
lib.card.list.addArray(lib.chess_cardlist);
|
|
|
|
|
}
|
|
|
|
|
ui.create.cardsAsync();
|
|
|
|
|
game.finishCards();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.addGlobalSkill("autoswap");
|
|
|
|
|
ui.chessContainer = ui.create.div("#chess-container", ui.arena);
|
|
|
|
|
ui.chessContainer.move = ui.click.moveContainer;
|
|
|
|
|
ui.chessContainer.chessLeft = 0;
|
|
|
|
|
ui.chessContainer.chessTop = 0;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// lib.setScroll(ui.chessContainer);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chess = ui.create.div("#chess", ui.chessContainer);
|
|
|
|
|
ui.canvas2 = document.createElement("canvas");
|
|
|
|
|
ui.canvas2.id = "canvas2";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.chess.appendChild(ui.canvas2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.ctx2 = ui.canvas2.getContext("2d");
|
|
|
|
|
game.me = ui.create.player();
|
|
|
|
|
if (playback) {
|
|
|
|
|
for (var i in lib.characterPack) {
|
|
|
|
|
for (var j in lib.characterPack[i]) {
|
|
|
|
|
lib.character[j] = lib.character[j] || lib.characterPack[i][j];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.system.style.display = "none";
|
|
|
|
|
_status.playback = playback;
|
|
|
|
|
localStorage.removeItem(lib.configprefix + "playback");
|
|
|
|
|
var store = lib.db.transaction(["video"], "readwrite").objectStore("video");
|
|
|
|
|
store.get(parseInt(playback)).onsuccess = function (e) {
|
|
|
|
|
if (e.target.result) {
|
|
|
|
|
event.video = e.target.result.video;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
alert("播放失败:找不到录像");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.reload();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
switch (_status.mode) {
|
|
|
|
|
case "leader": {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.leaderView();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "three": {
|
|
|
|
|
if (lib.config.continue_name_chess) {
|
|
|
|
|
event._result = {
|
|
|
|
|
friend: lib.config.continue_name_chess.friend,
|
|
|
|
|
enemy: lib.config.continue_name_chess.enemy,
|
|
|
|
|
};
|
|
|
|
|
_status.color = lib.config.continue_name_chess.color;
|
|
|
|
|
game.saveConfig("continue_name_chess");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.delay(0.5);
|
|
|
|
|
lib.init.onfree();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
game.chooseCharacterDouble(
|
|
|
|
|
function (i) {
|
2024-04-23 13:26:29 +00:00
|
|
|
|
if (lib.character[i].isChessBoss) {
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return !lib.filter.characterDisabled(i);
|
|
|
|
|
},
|
|
|
|
|
function (i) {
|
|
|
|
|
switch (i) {
|
|
|
|
|
case 0:
|
|
|
|
|
return "主帅";
|
|
|
|
|
case 1:
|
|
|
|
|
return "副帅";
|
|
|
|
|
default:
|
|
|
|
|
return "前锋";
|
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "combat": {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.chooseCharacter();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
default: {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.chooseCharacter();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 2";
|
|
|
|
|
ui.arena.classList.add("chess");
|
|
|
|
|
if (_status.mode == "three") {
|
|
|
|
|
_status.mylist = result.friend;
|
|
|
|
|
_status.enemylist = result.enemy;
|
|
|
|
|
_status.friendBackup = _status.mylist.slice(0);
|
|
|
|
|
_status.enemyBackup = _status.enemylist.slice(0);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var mylistmap, enemylistmap;
|
|
|
|
|
if (event.video) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var videocontent;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var ii = 0; ii < event.video.length; ii++) {
|
|
|
|
|
if (event.video[ii].type == "init") {
|
|
|
|
|
videocontent = event.video[ii].content;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.mylist = [];
|
|
|
|
|
_status.enemylist = [];
|
|
|
|
|
mylistmap = [];
|
|
|
|
|
enemylistmap = [];
|
|
|
|
|
for (var i = 0; i < videocontent.length; i++) {
|
|
|
|
|
if (videocontent[i].lord) {
|
|
|
|
|
_status.lord = videocontent[i].name;
|
|
|
|
|
}
|
|
|
|
|
if (videocontent[i].identity == "friend") {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.mylist.push(videocontent[i].name);
|
|
|
|
|
mylistmap.push(videocontent[i].position);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.enemylist.push(videocontent[i].name);
|
|
|
|
|
enemylistmap.push(videocontent[i].position);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.playerMap = lib.posmap;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var num = Math.round((_status.mylist.length + _status.enemylist.length) / 2);
|
|
|
|
|
var friend, enemy;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var side;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.mode == "three") {
|
|
|
|
|
side = !_status.color;
|
|
|
|
|
} else if (_status.mode == "leader") {
|
|
|
|
|
side = true;
|
|
|
|
|
} else {
|
|
|
|
|
side = Math.random() < 0.5;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
switch (num) {
|
|
|
|
|
case 1:
|
|
|
|
|
ui.chessheight = 4;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
ui.chessheight = 5;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
ui.chessheight = 5;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
ui.chessheight = 6;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
ui.chessheight = 6;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
ui.chessheight = 7;
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
ui.chessheight = 7;
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
ui.chessheight = 8;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ui.chessheight = 8;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chesswidth = Math.round(ui.chessheight * 1.5);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num == 1) ui.chesswidth++;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.initChess();
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var grids = [];
|
|
|
|
|
var gridnum = ui.chessheight * ui.chesswidth;
|
|
|
|
|
for (var i = 0; i < gridnum; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
grids.push(i);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.obs = [];
|
|
|
|
|
if (!event.video) {
|
|
|
|
|
var nco = parseFloat(get.config("chess_obstacle"));
|
|
|
|
|
if (nco > 0) {
|
|
|
|
|
var ng = Math.floor(gridnum * nco);
|
|
|
|
|
for (var i = 0; i < ng; i++) {
|
|
|
|
|
var cg = grids.randomRemove();
|
|
|
|
|
game.addObstacle(cg.toString(), false);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.obs.push(cg.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.enemyCount = _status.enemylist.length;
|
|
|
|
|
_status.friendCount = _status.mylist.length;
|
|
|
|
|
while (_status.mylist.length) {
|
|
|
|
|
friend = ui.create.player().addTempClass("start");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
friend.getId();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!event.friendZhu) {
|
|
|
|
|
event.friendZhu = friend;
|
|
|
|
|
} else if (!event.friendViceZhu) {
|
|
|
|
|
event.friendViceZhu = friend;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
friend.init(_status.mylist.shift());
|
2024-04-15 18:46:41 +00:00
|
|
|
|
friend.side = side;
|
|
|
|
|
friend.setIdentity("friend");
|
|
|
|
|
friend.identity = "friend";
|
|
|
|
|
friend.node.identity.dataset.color = get.translation(side + "Color");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.players.push(friend);
|
|
|
|
|
ui.chess.appendChild(friend);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.video) {
|
|
|
|
|
ui.placeChess(friend, mylistmap.shift());
|
|
|
|
|
} else {
|
|
|
|
|
ui.placeChess(friend, grids.randomRemove());
|
|
|
|
|
if (_status.enterArena && game.data.arena.acted.includes(friend.name)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
friend.hp--;
|
|
|
|
|
friend.update();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.enterArena) {
|
|
|
|
|
friend.addSkill("arenaAdd");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
lib.posmap[friend.dataset.position] = friend;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
while (_status.enemylist.length) {
|
|
|
|
|
enemy = ui.create.player().addTempClass("start");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
enemy.getId();
|
|
|
|
|
enemy.init(_status.enemylist.shift());
|
2024-04-15 18:46:41 +00:00
|
|
|
|
enemy.side = !side;
|
|
|
|
|
enemy.setIdentity("enemy");
|
|
|
|
|
enemy.identity = "enemy";
|
|
|
|
|
enemy.node.identity.dataset.color = get.translation(!side + "Color");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.players.push(enemy);
|
|
|
|
|
ui.chess.appendChild(enemy);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.video) {
|
|
|
|
|
ui.placeChess(enemy, enemylistmap.shift());
|
|
|
|
|
} else {
|
|
|
|
|
ui.placeChess(enemy, grids.randomRemove());
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
lib.posmap[enemy.dataset.position] = enemy;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (lib.config.show_handcardbutton) {
|
|
|
|
|
lib.setPopped(
|
|
|
|
|
ui.create.system("手牌", null, true),
|
|
|
|
|
function () {
|
|
|
|
|
var uiintro = ui.create.dialog("hidden");
|
|
|
|
|
var added = false;
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].side == game.me.side && game.players[i] != game.me) {
|
|
|
|
|
added = true;
|
|
|
|
|
uiintro.add(get.translation(game.players[i]));
|
|
|
|
|
var cards = game.players[i].getCards("h");
|
|
|
|
|
if (cards.length) {
|
|
|
|
|
uiintro.addSmall(cards, true);
|
|
|
|
|
} else {
|
|
|
|
|
uiintro.add("(无)");
|
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!added) {
|
|
|
|
|
uiintro.add("无队友");
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return uiintro;
|
|
|
|
|
},
|
|
|
|
|
220
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (
|
|
|
|
|
!event.video &&
|
|
|
|
|
_status.mode == "combat" &&
|
|
|
|
|
!_status.vsboss &&
|
|
|
|
|
(_status.replacelist.length || get.config("additional_player"))
|
|
|
|
|
) {
|
|
|
|
|
_status.enemyDied = 0;
|
|
|
|
|
_status.friendDied = 0;
|
|
|
|
|
ui.enemyDied = ui.create.system("杀敌: " + get.cnNumber(0), null, true);
|
|
|
|
|
ui.friendDied = ui.create.system("阵亡: " + get.cnNumber(0), null, true);
|
|
|
|
|
if (!get.config("additional_player")) {
|
|
|
|
|
lib.setPopped(ui.friendDied, function () {
|
|
|
|
|
if (_status.replacelist.length) {
|
|
|
|
|
var uiintro = ui.create.dialog("hidden");
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
uiintro.add("未上场");
|
|
|
|
|
uiintro.add([_status.replacelist, "character"]);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return uiintro;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!event.video && _status.mode == "combat" && !get.config("single_control") && !_status.boss) {
|
|
|
|
|
ui.single_swap = ui.create.system(
|
|
|
|
|
"换人",
|
|
|
|
|
function () {
|
|
|
|
|
var bool = false;
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].side == game.me.side && game.players[i] != game.me) {
|
|
|
|
|
bool = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (bool) {
|
|
|
|
|
if (ui.auto.classList.contains("hidden")) {
|
|
|
|
|
game.me.popup("请稍后换人");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.event.isMine()) {
|
|
|
|
|
ui.click.auto();
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
ui.click.auto();
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
var player = game.me;
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
player = player.next;
|
|
|
|
|
if (player.side == game.me.side) {
|
|
|
|
|
game.modeSwapPlayer(player);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
|
|
|
|
true
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (
|
|
|
|
|
!event.video &&
|
|
|
|
|
_status.mode == "combat" &&
|
|
|
|
|
!_status.vsboss &&
|
|
|
|
|
get.config("additional_player")
|
|
|
|
|
) {
|
|
|
|
|
var finishGameBr = document.createElement("br");
|
|
|
|
|
finishGameBr.classList.add("finish_game");
|
|
|
|
|
ui.finishGame = ui.create.system("结束游戏", function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.finishGame.remove();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.friendDied < _status.enemyDied) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.forceOver(true);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (_status.friendDied > _status.enemyDied) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.forceOver(false);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.forceOver();
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.finishGame.classList.add("finish_game");
|
|
|
|
|
ui.finishGame.parentNode.insertBefore(finishGameBr, ui.finishGame);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.create.me();
|
|
|
|
|
ui.create.fakeme();
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (
|
|
|
|
|
!event.video &&
|
|
|
|
|
((_status.mode == "combat" &&
|
|
|
|
|
get.config("zhu") &&
|
|
|
|
|
!_status.vsboss &&
|
|
|
|
|
game.players.length > 2) ||
|
|
|
|
|
_status.mode == "three")
|
|
|
|
|
) {
|
|
|
|
|
game.friendZhu = event.friendZhu;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.friendZhu.hp++;
|
|
|
|
|
game.friendZhu.maxHp++;
|
|
|
|
|
game.friendZhu.update();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.friendZhu.node.identity.firstChild.innerHTML = "将";
|
2024-01-12 03:38:36 +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.enemyZhu = game.players[i];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.players[i].hp++;
|
|
|
|
|
game.players[i].maxHp++;
|
|
|
|
|
game.players[i].update();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.players[i].node.identity.firstChild.innerHTML = "帅";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if ((get.config("main_zhu") || _status.mode == "three") && event.friendViceZhu) {
|
|
|
|
|
game.friendViceZhu = event.friendViceZhu;
|
|
|
|
|
game.friendViceZhu.node.identity.firstChild.innerHTML = "仕";
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].side != game.me.side && game.players[i] != game.enemyZhu) {
|
|
|
|
|
game.enemyViceZhu = game.players[i];
|
|
|
|
|
game.players[i].node.identity.firstChild.innerHTML = "士";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chessinfo = ui.create.div(".fakeme.player.playerbg", ui.me, function (e) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
e.stopPropagation();
|
|
|
|
|
});
|
|
|
|
|
ui.create.div(ui.chessinfo);
|
|
|
|
|
lib.setScroll(ui.chessinfo.firstChild);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.arrangePlayers();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 3";
|
|
|
|
|
ui.control.style.display = "";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var p;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (_status.lord) {
|
|
|
|
|
if (game.players[i].name == _status.lord) {
|
|
|
|
|
p = game.players[i];
|
|
|
|
|
p.addSkill("tongshuai");
|
|
|
|
|
p.addSkill("leader_zhaoxiang");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (game.players[i].side) {
|
|
|
|
|
p = game.players[i];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.video) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.playVideoContent(event.video);
|
|
|
|
|
game.setChessInfo(p);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var players = get.players(lib.sort.position);
|
|
|
|
|
var info = [];
|
|
|
|
|
for (var i = 0; i < players.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
info.push({
|
2024-04-15 18:46:41 +00:00
|
|
|
|
name: players[i].name,
|
|
|
|
|
identity: players[i].identity,
|
|
|
|
|
position: players[i].dataset.position,
|
|
|
|
|
lord: players[i].name == _status.lord,
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.videoInited = true;
|
|
|
|
|
game.addVideo("init", null, info);
|
|
|
|
|
if (game.friendZhu) {
|
|
|
|
|
game.addVideo("identityText", game.friendZhu, "将");
|
|
|
|
|
game.addVideo("identityText", game.enemyZhu, "帅");
|
|
|
|
|
if (game.friendViceZhu) {
|
|
|
|
|
game.addVideo("identityText", game.friendViceZhu, "仕");
|
|
|
|
|
game.addVideo("identityText", game.enemyViceZhu, "士");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.obs) {
|
|
|
|
|
game.addVideo("initobs", null, event.obs);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.trigger("gameStart");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.gameDraw(p);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.me.classList.add("current_action");
|
|
|
|
|
if (_status.mode == "three") {
|
|
|
|
|
game.phaseLoopThree(_status.color ? game.enemyZhu : game.friendZhu);
|
|
|
|
|
} else if (_status.mode == "leader") {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.phaseLoopOrdered(p);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (get.config("seat_order") == "指定") {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.phaseLoopOrdered(p);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.phaseLoop(p);
|
|
|
|
|
}
|
|
|
|
|
game.setChessInfo(p);
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
element: {
|
|
|
|
|
card: {
|
|
|
|
|
moveTo: function (player) {
|
|
|
|
|
var rect1 = this.getBoundingClientRect();
|
|
|
|
|
var rect2 = player.getBoundingClientRect();
|
|
|
|
|
var dx = rect2.left + rect2.width / 2 - (rect1.left + rect1.width / 2);
|
|
|
|
|
var dy = rect2.top + rect2.height / 2 - (rect1.top + rect1.height / 2);
|
|
|
|
|
this.style.transform += " translate(" + dx + "px," + dy + "px)";
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player: {
|
|
|
|
|
getLeft: function () {
|
|
|
|
|
var left = this.offsetLeft;
|
|
|
|
|
if (this._chesstransform) {
|
|
|
|
|
left += this._chesstransform[0];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return left;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
getTop: function () {
|
|
|
|
|
var top = this.offsetLeft;
|
|
|
|
|
if (this._chesstransform) {
|
|
|
|
|
top += this._chesstransform[1];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return top;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
createRangeShadow: function (num, move) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var shadows = this.parentNode.getElementsByClassName("playergrid");
|
|
|
|
|
while (shadows.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
shadows[0].remove();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var grids = [];
|
|
|
|
|
for (var i = 1 - num; i < num; i++) {
|
|
|
|
|
for (var j = 1 - num + Math.abs(i); j < num - Math.abs(i); j++) {
|
|
|
|
|
if (this.movable(i, j)) {
|
|
|
|
|
var grid = ui.create.playergrid(this, i, j);
|
|
|
|
|
if (grid) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
grids.push(grid);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (typeof move == "function") {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
grid.listen(move);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (move) {
|
|
|
|
|
grid.classList.add("pointerdiv");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
grid.listen(ui.click.playergrid);
|
|
|
|
|
ui.movegrids.push(grid);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
grid.classList.add("temp");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return grids;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chooseToMoveChess: function (num, prompt) {
|
|
|
|
|
var next = game.createEvent("chooseToMoveChess");
|
|
|
|
|
next.num = num || 1;
|
|
|
|
|
next.player = this;
|
|
|
|
|
next.setContent("chooseToMoveChess");
|
|
|
|
|
next.prompt = prompt;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return next;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
move: function (x, y) {
|
|
|
|
|
var xy = this.getXY();
|
|
|
|
|
return this.moveTo(x + xy[0], y + xy[1]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
moveTo: function (x, y) {
|
|
|
|
|
game.addVideo("moveTo", this, [x, y]);
|
|
|
|
|
if (x >= ui.chesswidth) {
|
|
|
|
|
x = ui.chesswidth - 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (y >= ui.chessheight) {
|
|
|
|
|
y = ui.chessheight - 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var pos = y * ui.chesswidth + x;
|
|
|
|
|
if (!lib.posmap[pos]) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete lib.posmap[this.dataset.position];
|
|
|
|
|
// this.changeSeat(pos,false);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.placeChess(this, pos);
|
|
|
|
|
lib.posmap[pos] = this;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.chessFocus();
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (get.mode() == "tafang" && !_status.video) {
|
|
|
|
|
if (_status.tafangend.includes(this.dataset.position)) {
|
|
|
|
|
if (_status.enemies.includes(this)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.over(false);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.delete();
|
|
|
|
|
delete lib.posmap[this];
|
|
|
|
|
game.players.remove(this);
|
|
|
|
|
_status.friends.remove(this);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
this.classList.add("dead");
|
|
|
|
|
if (_status.roundStart == this) {
|
|
|
|
|
_status.roundStart = player.next || player.getNext() || game.players[0];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (this == game.me) {
|
|
|
|
|
if (ui.confirm) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.confirm.close();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.friends.length == 0) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.fakeme.hide();
|
|
|
|
|
this.node.handcards1.delete();
|
|
|
|
|
this.node.handcards2.delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.me = ui.create.player();
|
|
|
|
|
game.me.side = false;
|
|
|
|
|
game.addVideo("removeTafangPlayer");
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.modeSwapPlayer(_status.friends[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < ui.phasequeue.length; i++) {
|
|
|
|
|
if (ui.phasequeue[i].link == this) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.phasequeue[i].remove();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.phasequeue.splice(i, 1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.addVideo("deleteChessPlayer", this);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return this;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
canMoveTowards: function (target) {
|
|
|
|
|
var fxy = this.getXY();
|
|
|
|
|
var txy = target.getXY();
|
|
|
|
|
var dx = txy[0] - fxy[0];
|
|
|
|
|
var dy = txy[1] - fxy[1];
|
|
|
|
|
if (dx < 0 && this.movable(-1, 0)) return true;
|
|
|
|
|
if (dx > 0 && this.movable(1, 0)) return true;
|
|
|
|
|
if (dy < 0 && this.movable(0, -1)) return true;
|
|
|
|
|
if (dy > 0 && this.movable(0, 1)) return true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
moveTowards: function (target, forbid) {
|
|
|
|
|
var fxy = this.getXY();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var txy;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (Array.isArray(target)) {
|
|
|
|
|
txy = target;
|
|
|
|
|
} else if (typeof target == "string") {
|
|
|
|
|
var pos = parseInt(target);
|
|
|
|
|
txy = [pos % ui.chesswidth, Math.floor(pos / ui.chesswidth)];
|
|
|
|
|
} else {
|
|
|
|
|
txy = target.getXY();
|
|
|
|
|
}
|
|
|
|
|
var dx = txy[0] - fxy[0];
|
|
|
|
|
var dy = txy[1] - fxy[1];
|
|
|
|
|
forbid = forbid || [];
|
|
|
|
|
if (Math.abs(dx) > Math.abs(dy)) {
|
|
|
|
|
if (dx < 0) {
|
|
|
|
|
if (!forbid.includes("moveLeft") && this.movable(-1, 0)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.moveLeft();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return "moveLeft";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (dx > 0) {
|
|
|
|
|
if (!forbid.includes("moveRight") && this.movable(1, 0)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.moveRight();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return "moveRight";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (dy < 0) {
|
|
|
|
|
if (!forbid.includes("moveUp") && this.movable(0, -1)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.moveUp();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return "moveUp";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (dy > 0) {
|
|
|
|
|
if (!forbid.includes("moveDown") && this.movable(0, 1)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.moveDown();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return "moveDown";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (dy < 0) {
|
|
|
|
|
if (!forbid.includes("moveUp") && this.movable(0, -1)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.moveUp();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return "moveUp";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (dy > 0) {
|
|
|
|
|
if (!forbid.includes("moveDown") && this.movable(0, 1)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.moveDown();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return "moveDown";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (dx < 0) {
|
|
|
|
|
if (!forbid.includes("moveLeft") && this.movable(-1, 0)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.moveLeft();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return "moveLeft";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (dx > 0) {
|
|
|
|
|
if (!forbid.includes("moveRight") && this.movable(1, 0)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.moveRight();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return "moveRight";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chessFocus: function () {
|
|
|
|
|
game.addVideo("chessFocus", this);
|
|
|
|
|
if (ui.chess._chessdrag) return;
|
|
|
|
|
if (_status.chessscrolling) return;
|
|
|
|
|
var player = this;
|
|
|
|
|
var dx = 0,
|
|
|
|
|
dy = 0;
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player.getLeft() - ui.chessContainer.chessLeft < 14) {
|
|
|
|
|
dx = player.getLeft() - ui.chessContainer.chessLeft - 14;
|
|
|
|
|
} else if (
|
|
|
|
|
player.getLeft() - ui.chessContainer.chessLeft >
|
|
|
|
|
ui.chessContainer.offsetWidth - 134
|
|
|
|
|
) {
|
|
|
|
|
dx =
|
|
|
|
|
player.getLeft() -
|
|
|
|
|
ui.chessContainer.chessLeft -
|
|
|
|
|
ui.chessContainer.offsetWidth +
|
|
|
|
|
134;
|
|
|
|
|
}
|
|
|
|
|
if (player.getTop() - ui.chessContainer.chessTop < 14) {
|
|
|
|
|
dy = player.getTop() - ui.chessContainer.chessTop - 14;
|
|
|
|
|
} else if (
|
|
|
|
|
player.getTop() + ui.chess.offsetTop - ui.chessContainer.chessTop >
|
|
|
|
|
ui.chessContainer.offsetHeight - 134
|
|
|
|
|
) {
|
|
|
|
|
dy =
|
|
|
|
|
player.getTop() +
|
|
|
|
|
ui.chess.offsetTop -
|
|
|
|
|
ui.chessContainer.chessTop -
|
|
|
|
|
ui.chessContainer.offsetHeight +
|
|
|
|
|
134;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
// if(_status.currentChessFocus){
|
|
|
|
|
// cancelAnimationFrame(_status.currentChessFocus);
|
|
|
|
|
// }
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var count = lib.config.low_performance ? 6 : 12;
|
|
|
|
|
var ddx = Math.floor(dx / count);
|
|
|
|
|
var ddy = Math.floor(dy / count);
|
|
|
|
|
if (dx || dy) {
|
|
|
|
|
ui.chessContainer.move(dx, dy, true);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// var chessFocus=function(){
|
|
|
|
|
// if(count--){
|
|
|
|
|
// ui.chessContainer.chessLeft+=ddx;
|
|
|
|
|
// ui.chessContainer.chessTop+=ddy;
|
|
|
|
|
// _status.currentChessFocus=requestAnimationFrame(chessFocus);
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// ui.chessContainer.chessLeft+=dx%count;
|
|
|
|
|
// ui.chessContainer.chessTop+=dy%count;
|
|
|
|
|
// cancelAnimationFrame(_status.currentChessFocus);
|
|
|
|
|
// delete _status.currentChessFocus;
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// _status.currentChessFocus=requestAnimationFrame(chessFocus);
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
getXY: function () {
|
|
|
|
|
var pos = parseInt(this.dataset.position);
|
|
|
|
|
var x = pos % ui.chesswidth;
|
|
|
|
|
var y = Math.floor(pos / ui.chesswidth);
|
|
|
|
|
return [x, y];
|
|
|
|
|
},
|
|
|
|
|
getDataPos: function (x, y) {
|
|
|
|
|
var xy = this.getXY();
|
|
|
|
|
if (typeof x != "number") x = 0;
|
|
|
|
|
if (typeof y != "number") y = 0;
|
|
|
|
|
x += xy[0];
|
|
|
|
|
y += xy[1];
|
|
|
|
|
return x + y * ui.chesswidth;
|
|
|
|
|
},
|
|
|
|
|
getNeighbour: function (x, y) {
|
|
|
|
|
var xy = this.getXY();
|
|
|
|
|
if (xy[0] + x < 0) return null;
|
|
|
|
|
if (xy[1] + y < 0) return null;
|
|
|
|
|
if (xy[0] + x >= ui.chesswidth) return null;
|
|
|
|
|
if (xy[1] + y >= ui.chessheight) return null;
|
|
|
|
|
return lib.posmap[this.getDataPos(x, y)] || null;
|
|
|
|
|
},
|
|
|
|
|
getNeighbours: function () {
|
|
|
|
|
var players = [];
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.isChessNeighbour(game.players[i], this)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
players.push(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return players;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
movable: function (x, y) {
|
|
|
|
|
var xy = this.getXY();
|
|
|
|
|
if (xy[0] + x < 0) return false;
|
|
|
|
|
if (xy[1] + y < 0) return false;
|
|
|
|
|
if (xy[0] + x >= ui.chesswidth) return false;
|
|
|
|
|
if (xy[1] + y >= ui.chessheight) return false;
|
|
|
|
|
return !this.getNeighbour(x, y);
|
|
|
|
|
},
|
|
|
|
|
moveRight: function () {
|
|
|
|
|
if (this.movable(1, 0)) {
|
|
|
|
|
this.move(1, 0);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
moveLeft: function () {
|
|
|
|
|
if (this.movable(-1, 0)) {
|
|
|
|
|
this.move(-1, 0);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
moveUp: function () {
|
|
|
|
|
if (this.movable(0, -1)) {
|
|
|
|
|
this.move(0, -1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
moveDown: function () {
|
|
|
|
|
if (this.movable(0, 1)) {
|
|
|
|
|
this.move(0, 1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dieAfter2: function () {
|
|
|
|
|
var player = this;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete lib.posmap[player.dataset.position];
|
2024-04-15 18:46:41 +00:00
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 500);
|
|
|
|
|
for (var i = 0; i < ui.phasequeue.length; i++) {
|
|
|
|
|
if (ui.phasequeue[i].link == player) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.phasequeue[i].remove();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.phasequeue.splice(i, 1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dieAfter: function (source) {
|
|
|
|
|
var player = this;
|
|
|
|
|
if (_status.friends) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.friends.remove(this);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.enemies) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.enemies.remove(this);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (ui.friendDied && player.side == game.me.side) {
|
|
|
|
|
ui.friendDied.innerHTML = "阵亡: " + get.cnNumber(++_status.friendDied, true);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (ui.enemyDied && player.side != game.me.side) {
|
|
|
|
|
ui.enemyDied.innerHTML = "杀敌: " + get.cnNumber(++_status.enemyDied, true);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player == game.friendZhu) {
|
|
|
|
|
if (game.friendViceZhu && game.friendViceZhu.isAlive()) {
|
|
|
|
|
game.friendZhu = game.friendViceZhu;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete game.friendViceZhu;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.friendZhu.node.identity.lastChild.innerHTML = "将";
|
|
|
|
|
game.addVideo("identityText", game.friendZhu, "将");
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.over(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (player == game.enemyZhu) {
|
|
|
|
|
if (game.enemyViceZhu && game.enemyViceZhu.isAlive()) {
|
|
|
|
|
game.enemyZhu = game.enemyViceZhu;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete game.enemyViceZhu;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.enemyZhu.node.identity.lastChild.innerHTML = "帅";
|
|
|
|
|
game.addVideo("identityText", game.enemyZhu, "帅");
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.over(true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player == game.me && get.config("single_control")) {
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].side == player.side) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.modeSwapPlayer(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var notend = false;
|
|
|
|
|
for (var i = 1; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].side != game.players[0].side) {
|
|
|
|
|
if (source && game.players.includes(source)) {
|
|
|
|
|
if (_status.mode == "combat") {
|
|
|
|
|
if (source.side != player.side) {
|
|
|
|
|
source.draw(get.config("reward"));
|
|
|
|
|
} else {
|
|
|
|
|
switch (get.config("punish")) {
|
|
|
|
|
case "弃牌":
|
|
|
|
|
var he = source.getCards("he");
|
|
|
|
|
if (he.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.discard(he);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "摸牌":
|
|
|
|
|
source.draw(get.config("reward"));
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (_status.mode == "three") {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.draw(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (source.side != player.side) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.draw();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.mode != "combat" || _status.vsboss) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
notend = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.mode == "combat" && !_status.vsboss) {
|
|
|
|
|
if (
|
|
|
|
|
game.players.length == 1 &&
|
|
|
|
|
get.config("additional_player") &&
|
|
|
|
|
_status.additionallist.length &&
|
|
|
|
|
source == game.players[0]
|
|
|
|
|
) {
|
|
|
|
|
source.draw(get.config("reward"));
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player.side == game.me.side) {
|
|
|
|
|
if (get.config("additional_player") && _status.additionallist.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.replaceChessPlayer();
|
|
|
|
|
return;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (_status.replacelist.length) {
|
|
|
|
|
if (game.players.length == 1 && source == game.players[0]) {
|
|
|
|
|
source.draw(get.config("reward"));
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.replaceChessPlayer(_status.replacelist.randomRemove());
|
|
|
|
|
return;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (get.config("noreplace_end")) {
|
|
|
|
|
game.over(player.side != game.me.side);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (notend) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (get.config("additional_player") && _status.additionallist.length) {
|
|
|
|
|
game.replaceChessPlayer(null, true);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (_status.enemyreplacelist.length) {
|
|
|
|
|
if (game.players.length == 1 && source == game.players[0]) {
|
|
|
|
|
source.draw(get.config("reward"));
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.replaceChessPlayer(_status.enemyreplacelist.randomRemove(), true);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (get.config("noreplace_end")) {
|
|
|
|
|
game.over(player.side != game.me.side);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (notend) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.over(game.me.side == game.players[0].side);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
$draw_old: function (num) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var cards;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (get.itemtype(num) == "cards") {
|
|
|
|
|
cards = num;
|
|
|
|
|
} else if (get.itemtype(num) == "card") {
|
|
|
|
|
cards = [num];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (cards) {
|
|
|
|
|
game.addVideo("chessgainmod", this, get.cardsInfo(num));
|
|
|
|
|
} else if (!num || typeof num == "number") {
|
|
|
|
|
game.addVideo("chessgainmod", this, num);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return this.$gainmod(num);
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
$gainmod: function (num) {
|
|
|
|
|
var cards, node;
|
|
|
|
|
if (get.itemtype(num) == "cards") {
|
|
|
|
|
cards = num;
|
|
|
|
|
num = cards.length;
|
|
|
|
|
} else if (get.itemtype(num) == "card") {
|
|
|
|
|
cards = [num];
|
|
|
|
|
num = 1;
|
|
|
|
|
}
|
|
|
|
|
if (cards) {
|
|
|
|
|
cards = cards.slice(0);
|
|
|
|
|
node = cards.shift().copy("thrown", "hidden");
|
|
|
|
|
} else {
|
|
|
|
|
node = ui.create.div(".card.thrown.hidden");
|
|
|
|
|
}
|
|
|
|
|
node.fixed = true;
|
|
|
|
|
this.$randomMove(node, 130, 0);
|
|
|
|
|
var ot = node.style.transform;
|
|
|
|
|
if (node.style.transform && node.style.transform != "none") {
|
|
|
|
|
node.style.transform += " scale(0.6)";
|
|
|
|
|
} else {
|
|
|
|
|
node.style.transform = "scale(0.6)";
|
|
|
|
|
}
|
|
|
|
|
node.dataset.position = this.dataset.position;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.parentNode.appendChild(node);
|
|
|
|
|
ui.refresh(node);
|
|
|
|
|
node.show();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.style.transform = ot;
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
node.style.transform = "";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 500);
|
|
|
|
|
var that = this;
|
|
|
|
|
if (num && num > 1) {
|
|
|
|
|
if (cards) {
|
|
|
|
|
that.$gain(cards, null, false);
|
|
|
|
|
} else {
|
|
|
|
|
that.$gain(num - 1, null, false);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
$throw: function (card, time, init) {
|
|
|
|
|
if (init !== false) {
|
|
|
|
|
if (get.itemtype(card) != "cards") {
|
|
|
|
|
if (get.itemtype(card) == "card") {
|
|
|
|
|
card = [card];
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.addVideo("throw", this, [get.cardsInfo(card), time]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
this.chessFocus();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (get.itemtype(card) == "cards") {
|
|
|
|
|
for (var i = 0; i < card.length; i++) {
|
|
|
|
|
this.$throw(card[i], time, false);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (card == undefined || card.length == 0) return;
|
|
|
|
|
var node = card.copy("thrown", "hidden");
|
|
|
|
|
node.dataset.position = this.dataset.position;
|
|
|
|
|
if (this.parentNode) this.parentNode.appendChild(node);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.refresh(node);
|
|
|
|
|
node.show();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
this.$randomMove(node, 130, 0);
|
|
|
|
|
if (time != undefined) {
|
|
|
|
|
node.fixed = true;
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
node.delete();
|
|
|
|
|
}, time);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
$givemod: function (card, player) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.chessFocus();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var from = this;
|
|
|
|
|
if (get.itemtype(card) == "cards") {
|
|
|
|
|
for (var i = 0; i < card.length; i++) {
|
|
|
|
|
from.$givemod(card[i], player);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (typeof card == "number" && card >= 0) {
|
|
|
|
|
for (var i = 0; i < card; i++) {
|
|
|
|
|
from.$givemod("", player);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var node;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (get.itemtype(card) == "card") {
|
|
|
|
|
node = card.copy("card", "thrown", false);
|
|
|
|
|
} else {
|
|
|
|
|
node = ui.create.div(".card.thrown");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.dataset.position = this.dataset.position;
|
|
|
|
|
node.fixed = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.hide();
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.parentNode.appendChild(node);
|
|
|
|
|
ui.refresh(node);
|
|
|
|
|
node.show();
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
this.$randomMove(node, 130, 0);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
setTimeout(function () {
|
|
|
|
|
lib.element.card.moveTo.call(node, player);
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 200);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// node.removeAttribute('style');
|
|
|
|
|
// node.dataset.position=player.dataset.position;
|
|
|
|
|
// node.delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 700);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
$throwxy: function (card, left, top, transform) {
|
|
|
|
|
var node = card.copy("thrown", "thrownhighlight");
|
|
|
|
|
var rect = this.getBoundingClientRect();
|
|
|
|
|
node.style.left = rect.left + 8 + "px";
|
|
|
|
|
node.style.top = rect.top + 8 + "px";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.hide();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.style.transitionProperty = "left,top,opacity";
|
|
|
|
|
if (transform) {
|
|
|
|
|
node.style.transform = "rotate(" + (Math.random() * 16 - 8) + "deg)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
ui.arena.appendChild(node);
|
|
|
|
|
ui.refresh(node);
|
|
|
|
|
node.show();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.style.left = left;
|
|
|
|
|
node.style.top = top;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return node;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
$phaseJudge: function (card) {
|
|
|
|
|
game.addVideo("phaseJudge", this, get.cardInfo(card));
|
|
|
|
|
var clone = card.copy("thrown", this.parentNode).addTempClass("judgestart");
|
|
|
|
|
var player = this;
|
|
|
|
|
clone.style.opacity = 0.6;
|
|
|
|
|
clone.style.left =
|
|
|
|
|
Math.random() * 100 -
|
|
|
|
|
50 +
|
|
|
|
|
ui.chessContainer.chessLeft +
|
|
|
|
|
ui.chessContainer.offsetWidth / 2 -
|
|
|
|
|
52 +
|
|
|
|
|
"px";
|
|
|
|
|
clone.style.top =
|
|
|
|
|
Math.random() * 80 -
|
|
|
|
|
40 +
|
|
|
|
|
ui.chessContainer.chessTop +
|
|
|
|
|
ui.chessContainer.offsetHeight / 2 -
|
|
|
|
|
52 -
|
|
|
|
|
ui.chessContainer.offsetTop +
|
|
|
|
|
"px";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.delay();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.linexy(
|
|
|
|
|
[
|
|
|
|
|
clone.offsetLeft + clone.offsetWidth / 2,
|
|
|
|
|
clone.offsetTop + clone.offsetHeight / 2,
|
|
|
|
|
player.getLeft() + player.offsetWidth / 2,
|
|
|
|
|
player.getTop() + player.offsetHeight / 2,
|
|
|
|
|
],
|
|
|
|
|
{ opacity: 0.5, dashed: true },
|
|
|
|
|
true
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
$randomMove: function (node, length, rand) {
|
|
|
|
|
if (!this.node.chessthrown) {
|
|
|
|
|
this.node.chessthrown = [];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var thrown = this.node.chessthrown;
|
|
|
|
|
for (var i = 0; i < thrown.length; i++) {
|
|
|
|
|
if (
|
|
|
|
|
thrown[i].parentNode != this.parentNode ||
|
|
|
|
|
thrown[i].classList.contains("removing")
|
|
|
|
|
) {
|
|
|
|
|
thrown.splice(i--, 1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
thrown.push(node);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var rect = this.getBoundingClientRect();
|
|
|
|
|
var amax, amin;
|
|
|
|
|
if (rect.left <= 80) {
|
|
|
|
|
if (rect.top <= 80) {
|
|
|
|
|
amin = -90;
|
|
|
|
|
amax = 0;
|
|
|
|
|
} else if (rect.top + rect.height + 80 >= ui.chessContainer.offsetHeight) {
|
|
|
|
|
amin = 0;
|
|
|
|
|
amax = 90;
|
|
|
|
|
} else {
|
|
|
|
|
amin = -90;
|
|
|
|
|
amax = 90;
|
|
|
|
|
}
|
|
|
|
|
} else if (rect.left + rect.width + 80 >= ui.chessContainer.offsetWidth) {
|
|
|
|
|
if (rect.top <= 80) {
|
|
|
|
|
amin = 180;
|
|
|
|
|
amax = 270;
|
|
|
|
|
} else if (rect.top + rect.height + 80 >= ui.chessContainer.offsetHeight) {
|
|
|
|
|
amin = 90;
|
|
|
|
|
amax = 180;
|
|
|
|
|
} else {
|
|
|
|
|
amin = 90;
|
|
|
|
|
amax = 270;
|
|
|
|
|
}
|
|
|
|
|
} else if (rect.top <= 80) {
|
|
|
|
|
amin = 180;
|
|
|
|
|
amax = 360;
|
|
|
|
|
} else if (rect.top + rect.height + 80 >= ui.chessContainer.offsetHeight) {
|
|
|
|
|
amin = 0;
|
|
|
|
|
amax = 180;
|
|
|
|
|
} else {
|
|
|
|
|
var dx = ui.chessContainer.offsetWidth / 2 - (rect.left + rect.width / 2);
|
|
|
|
|
var dy = -ui.chessContainer.offsetHeight / 2 + (rect.top + rect.height / 2);
|
|
|
|
|
var ang = (Math.abs(Math.atan(dy / dx)) * 180) / Math.PI;
|
|
|
|
|
if (dx < 0) {
|
|
|
|
|
if (dy > 0) {
|
|
|
|
|
ang = 180 - ang;
|
|
|
|
|
} else {
|
|
|
|
|
ang += 180;
|
|
|
|
|
}
|
|
|
|
|
} else if (dy < 0) {
|
|
|
|
|
ang = 360 - ang;
|
|
|
|
|
}
|
|
|
|
|
amin = ang - 180;
|
|
|
|
|
amax = ang + 180;
|
|
|
|
|
}
|
|
|
|
|
var da = (amax - amin) / (thrown.length * 2);
|
|
|
|
|
if (da > 30 && thrown.length > 1) {
|
|
|
|
|
amin += (da - 30) * thrown.length;
|
|
|
|
|
da = 30;
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < thrown.length; i++) {
|
|
|
|
|
var lengthi = length + Math.random() * rand;
|
|
|
|
|
var ang = amin + da * (2 * i + 1);
|
|
|
|
|
ang *= Math.PI / 180;
|
|
|
|
|
var tx = lengthi * Math.cos(ang);
|
|
|
|
|
var ty = -lengthi * Math.sin(ang);
|
|
|
|
|
if (Math.abs(tx) < 0.1) {
|
|
|
|
|
tx = 0;
|
|
|
|
|
}
|
|
|
|
|
if (Math.abs(ty) < 0.1) {
|
|
|
|
|
ty = 0;
|
|
|
|
|
}
|
|
|
|
|
thrown[i].style.transform = "translate(" + tx + "px," + ty + "px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: {
|
|
|
|
|
replaceChessPlayer: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
if (get.config("additional_player")) {
|
|
|
|
|
if (
|
|
|
|
|
!event.enemy &&
|
|
|
|
|
!_status.auto &&
|
|
|
|
|
(game.me.isDead() || get.config("single_control"))
|
|
|
|
|
) {
|
|
|
|
|
event.dialog = ui.create.dialog("选择替补角色", [
|
|
|
|
|
_status.additionallist.randomGets(parseInt(get.config("choice_number"))),
|
|
|
|
|
"character",
|
|
|
|
|
]);
|
|
|
|
|
event.filterButton = function () {
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
event.player = game.me;
|
|
|
|
|
event.forced = true;
|
|
|
|
|
event.forceDie = true;
|
|
|
|
|
event.custom.replace.confirm = function () {
|
|
|
|
|
event.playername = ui.selected.buttons[0].link;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.dialog.close();
|
|
|
|
|
_status.additionallist.remove(event.playername);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (ui.confirm) ui.confirm.close();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.check();
|
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
event.playername = _status.additionallist.randomRemove();
|
|
|
|
|
}
|
|
|
|
|
} else if (
|
|
|
|
|
!event.enemy &&
|
|
|
|
|
get.config("seat_order") == "指定" &&
|
|
|
|
|
!_status.auto &&
|
|
|
|
|
_status.replacelist.length
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.replacelist.add(event.playername);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.dialog = ui.create.dialog("选择替补角色", [_status.replacelist, "character"]);
|
|
|
|
|
event.filterButton = function () {
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
event.player = game.me;
|
|
|
|
|
event.forced = true;
|
|
|
|
|
event.forceDie = true;
|
|
|
|
|
event.custom.replace.confirm = function () {
|
|
|
|
|
event.playername = ui.selected.buttons[0].link;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.dialog.close();
|
|
|
|
|
_status.replacelist.remove(event.playername);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (ui.confirm) ui.confirm.close();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.check();
|
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.delay();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.me.isDead()) {
|
|
|
|
|
event.swapNow = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.uncheck();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var player = game.addChessPlayer(event.playername, event.enemy);
|
|
|
|
|
game.log(player, "加入游戏");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.chessFocus();
|
|
|
|
|
player.playerfocus(1000);
|
|
|
|
|
game.delay(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.swapNow && player.side == game.me.side) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.modeSwapPlayer(player);
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chooseToMoveChess: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
if (
|
|
|
|
|
!player.movable(0, 1) &&
|
|
|
|
|
!player.movable(0, -1) &&
|
|
|
|
|
!player.movable(1, 0) &&
|
|
|
|
|
!player.movable(-1, 0)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.switchToAuto = function () {
|
|
|
|
|
if (ui.movegrids) {
|
|
|
|
|
while (ui.movegrids.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.movegrids.shift().delete();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var list = [];
|
|
|
|
|
var randomMove = ["moveUp", "moveDown", "moveLeft", "moveRight"];
|
|
|
|
|
var getMove = function (move) {
|
|
|
|
|
switch (move) {
|
|
|
|
|
case "moveUp":
|
|
|
|
|
return "moveDown";
|
|
|
|
|
case "moveDown":
|
|
|
|
|
return "moveUp";
|
|
|
|
|
case "moveLeft":
|
|
|
|
|
return "moveRight";
|
|
|
|
|
case "moveRight":
|
|
|
|
|
return "moveLeft";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
|
|
|
|
var dontMove = null;
|
|
|
|
|
for (var iwhile = 0; iwhile < num; iwhile++) {
|
|
|
|
|
if (get.mode() == "tafang" && _status.enemies.includes(player)) {
|
|
|
|
|
var targets2 = [];
|
|
|
|
|
for (var i = 0; i < ui.chesswidth; i++) {
|
|
|
|
|
var tafangdes = ui.chesswidth * (ui.chessheight - 1) + i;
|
|
|
|
|
if (!lib.posmap[tafangdes]) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
targets2.push(tafangdes);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
targets2.sort(function (a, b) {
|
|
|
|
|
return (
|
|
|
|
|
Math.abs((a % ui.chesswidth) - player.getXY()[0]) -
|
|
|
|
|
Math.abs((b % ui.chesswidth) - player.getXY()[0])
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var tafangmoved = false;
|
|
|
|
|
for (var i = 0; i < targets2.length; i++) {
|
|
|
|
|
if (player.moveTowards(targets2[i].toString())) {
|
|
|
|
|
tafangmoved = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (tafangmoved) {
|
|
|
|
|
event.moved = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
var targets = game.filterPlayer(function (current) {
|
|
|
|
|
return current.side != player.side && current.isIn();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
targets.sort(function (a, b) {
|
|
|
|
|
return get.distance(player, a) - get.distance(player, b);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
while (targets.length) {
|
|
|
|
|
var target = targets.shift();
|
|
|
|
|
var moveTowards = player.moveTowards(target, [dontMove]);
|
|
|
|
|
if (moveTowards) {
|
|
|
|
|
dontMove = getMove(moveTowards);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
randomMove.remove(dontMove);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.moved = true;
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (targets.length == 0) {
|
|
|
|
|
if (randomMove.length) {
|
|
|
|
|
var list = randomMove.slice(0);
|
|
|
|
|
while (list.length) {
|
|
|
|
|
var thismove = list.randomRemove();
|
|
|
|
|
if (player[thismove]()) {
|
|
|
|
|
event.moved = true;
|
|
|
|
|
dontMove = getMove(thismove);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
randomMove.remove(dontMove);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (list.length == 0) return;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (lib.skill._chessmove.ai.result.player(player) <= 0) break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.isMine()) {
|
|
|
|
|
if (event.prompt) {
|
|
|
|
|
event.dialog = ui.create.dialog(event.prompt);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var resume = function () {
|
|
|
|
|
if (ui.movegrids) {
|
|
|
|
|
while (ui.movegrids.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.movegrids.shift().delete();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.result = { bool: false };
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.phasing) {
|
|
|
|
|
event.custom.replace.confirm = resume;
|
|
|
|
|
} else {
|
|
|
|
|
event.control = ui.create.control("取消", resume);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.imchoosing = true;
|
|
|
|
|
ui.movegrids = [];
|
|
|
|
|
player.createRangeShadow(num, true);
|
|
|
|
|
for (var i = 0; i < ui.movegrids.length; i++) {
|
|
|
|
|
var grid = ui.movegrids[i];
|
|
|
|
|
if (game.isChessNeighbour(grid, player)) continue;
|
|
|
|
|
for (var j = 0; j < ui.movegrids.length; j++) {
|
|
|
|
|
if (game.isChessNeighbour(grid, ui.movegrids[j])) break;
|
|
|
|
|
}
|
|
|
|
|
if (j == ui.movegrids.length) grid.remove();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.switchToAuto();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
_status.imchoosing = false;
|
|
|
|
|
if (event.moved) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.delay();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.result = {
|
|
|
|
|
bool: true,
|
|
|
|
|
move: player.dataset.position,
|
|
|
|
|
};
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!event.result) {
|
|
|
|
|
event.result = {
|
|
|
|
|
bool: false,
|
|
|
|
|
};
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.control) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.control.close();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.dialog) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.dialog.close();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game: {
|
|
|
|
|
minskin: true,
|
|
|
|
|
singleHandcard: true,
|
|
|
|
|
chess: true,
|
|
|
|
|
treasures: [],
|
|
|
|
|
obstacles: [],
|
|
|
|
|
initChess: function () {
|
|
|
|
|
ui.chess.style.height = 148 * ui.chessheight + "px";
|
|
|
|
|
ui.chess.style.width = 148 * ui.chesswidth + "px";
|
|
|
|
|
ui.chessContainer.xmax = Math.max(0, 148 * ui.chesswidth - ui.chessContainer.offsetWidth);
|
|
|
|
|
ui.chessContainer.ymax =
|
|
|
|
|
Math.max(0, 148 * ui.chessheight - ui.chessContainer.offsetHeight) + 72;
|
|
|
|
|
if (lib.config.show_history == "right") {
|
|
|
|
|
ui.chessContainer.xmax += 50;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
lib.onresize.push(function () {
|
|
|
|
|
ui.chessContainer.xmax = Math.max(0, 148 * ui.chesswidth - ui.chessContainer.offsetWidth);
|
|
|
|
|
ui.chessContainer.ymax =
|
|
|
|
|
Math.max(0, 148 * ui.chessheight - ui.chessContainer.offsetHeight) + 72;
|
|
|
|
|
if (lib.config.show_history == "right") {
|
|
|
|
|
ui.chessContainer.xmax += 50;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!lib.config.touchscreen) {
|
|
|
|
|
ui.chess.addEventListener("mousedown", function (e) {
|
|
|
|
|
if (Array.isArray(e.path)) {
|
|
|
|
|
for (var i = 0; i < e.path.length; i++) {
|
|
|
|
|
var itemtype = get.itemtype(e.path[i]);
|
|
|
|
|
if (itemtype == "button" || itemtype == "card" || itemtype == "player") {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
this._chessdrag = [e, this.parentNode.chessLeft, this.parentNode.chessTop];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chess.addEventListener("mouseleave", function () {
|
|
|
|
|
this._chessdrag = null;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chess.addEventListener("mouseup", function () {
|
|
|
|
|
if (this._chessdrag) {
|
|
|
|
|
this._chessdrag = null;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chess.addEventListener("mousemove", function (e) {
|
|
|
|
|
if (_status.mousedragging) return;
|
|
|
|
|
if (this._chessdrag) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.chessContainer.move(
|
2024-04-15 18:46:41 +00:00
|
|
|
|
this._chessdrag[1] - e.x + this._chessdrag[0].x - ui.chessContainer.chessLeft,
|
|
|
|
|
this._chessdrag[2] - e.y + this._chessdrag[0].y - ui.chessContainer.chessTop
|
2020-11-05 08:26:02 +00:00
|
|
|
|
);
|
|
|
|
|
// this.parentNode.scrollLeft=this._chessdrag[1]-e.x+this._chessdrag[0].x;
|
|
|
|
|
// this.parentNode.scrollTop=this._chessdrag[2]-e.y+this._chessdrag[0].y;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.clicked = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chess.addEventListener("wheel", function (e) {
|
|
|
|
|
ui.chessContainer.move(e.deltaX, e.deltaY);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
e.preventDefault();
|
|
|
|
|
});
|
|
|
|
|
// ui.chessContainer.addEventListener('mousewheel',function(){
|
|
|
|
|
// if(_status.currentChessFocus){
|
|
|
|
|
// cancelAnimationFrame(_status.currentChessFocus);
|
|
|
|
|
// delete _status.currentChessFocus;
|
|
|
|
|
// }
|
|
|
|
|
// },{passive:true});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
ui.chess.addEventListener("touchstart", function (e) {
|
|
|
|
|
if (e.touches.length == 1) {
|
|
|
|
|
this._chessdrag = [e, this.parentNode.chessLeft, this.parentNode.chessTop];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chess.addEventListener("touchend", function () {
|
|
|
|
|
this._chessdrag = null;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chess.addEventListener("touchmove", function (e) {
|
|
|
|
|
if (_status.mousedragging) return;
|
|
|
|
|
if (this._chessdrag && e.touches.length == 1) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.chessContainer.move(
|
2024-04-15 18:46:41 +00:00
|
|
|
|
this._chessdrag[1] -
|
|
|
|
|
e.touches[0].clientX +
|
|
|
|
|
this._chessdrag[0].touches[0].clientX -
|
|
|
|
|
ui.chessContainer.chessLeft,
|
|
|
|
|
this._chessdrag[2] -
|
|
|
|
|
e.touches[0].clientY +
|
|
|
|
|
this._chessdrag[0].touches[0].clientY -
|
|
|
|
|
ui.chessContainer.chessTop
|
2020-11-05 08:26:02 +00:00
|
|
|
|
);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.clicked = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chessscroll1 = ui.create.div(".chessscroll.left", ui.chessContainer);
|
|
|
|
|
ui.chessscroll2 = ui.create.div(".chessscroll.right", ui.chessContainer);
|
|
|
|
|
var chessscroll = function () {
|
|
|
|
|
if (lib.config.touchscreen) return;
|
|
|
|
|
var direction = this.direction;
|
|
|
|
|
var speed = parseInt(get.config("chessscroll_speed"));
|
|
|
|
|
if (!speed) return;
|
|
|
|
|
var interval = setInterval(function () {
|
|
|
|
|
ui.chessContainer.move(speed * direction);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// ui.chessContainer.chessLeft+=speed*direction;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 16);
|
|
|
|
|
_status.chessscrolling = interval;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var leavescroll = function () {
|
|
|
|
|
if (_status.chessscrolling) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
clearInterval(_status.chessscrolling);
|
|
|
|
|
delete _status.chessscrolling;
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chessscroll1.direction = -1;
|
|
|
|
|
ui.chessscroll1.addEventListener("mouseenter", chessscroll);
|
|
|
|
|
ui.chessscroll1.addEventListener("mouseleave", leavescroll);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chessscroll2.direction = 1;
|
|
|
|
|
ui.chessscroll2.addEventListener("mouseenter", chessscroll);
|
|
|
|
|
ui.chessscroll2.addEventListener("mouseleave", leavescroll);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < ui.chesswidth; i++) {
|
|
|
|
|
for (var j = 0; j < ui.chessheight; j++) {
|
|
|
|
|
var pos = '[data-position="' + (i + j * ui.chesswidth) + '"]';
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// ui.chesssheet.sheet.insertRule('#arena.chess #chess>.player'+pos+
|
|
|
|
|
// '{left:'+(14+i*148)+'px;top:'+(14+j*148)+'px}',0);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chesssheet.sheet.insertRule(
|
|
|
|
|
"#arena.chess #chess>.card" +
|
|
|
|
|
pos +
|
|
|
|
|
"{left:" +
|
|
|
|
|
(22 + i * 148) +
|
|
|
|
|
"px;top:" +
|
|
|
|
|
(22 + j * 148) +
|
|
|
|
|
"px}",
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
ui.chesssheet.sheet.insertRule(
|
|
|
|
|
"#arena.chess #chess>.popup" +
|
|
|
|
|
pos +
|
|
|
|
|
"{left:" +
|
|
|
|
|
(19 + i * 148) +
|
|
|
|
|
"px;top:" +
|
|
|
|
|
(142 + j * 148) +
|
|
|
|
|
"px}",
|
|
|
|
|
0
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
getVideoName: function () {
|
|
|
|
|
var str =
|
|
|
|
|
"战棋" +
|
|
|
|
|
get.translation(_status.mode) +
|
|
|
|
|
" - " +
|
|
|
|
|
_status.friendCount +
|
|
|
|
|
"v" +
|
|
|
|
|
_status.enemyCount;
|
|
|
|
|
var name = [get.translation(game.me.name), str];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return name;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
addChessPlayer: function (name, enemy, num, pos) {
|
|
|
|
|
if (typeof num != "number") {
|
|
|
|
|
num = 4;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var player = ui.create.player();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.getId();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (enemy == "treasure") {
|
|
|
|
|
player.addTempClass("judgestart");
|
|
|
|
|
player.side = null;
|
|
|
|
|
player.identity = "neutral";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.setIdentity();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player.node.identity.dataset.color = "zhong";
|
|
|
|
|
player.classList.add("treasure");
|
|
|
|
|
player.node.hp.classList.add("treasure");
|
|
|
|
|
player.life = 6 + Math.floor(Math.random() * 6);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.treasures.add(player);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
player.addTempClass("start");
|
|
|
|
|
if (enemy) {
|
|
|
|
|
if (get.mode() == "tafang") {
|
|
|
|
|
player.side = true;
|
|
|
|
|
} else {
|
|
|
|
|
player.side = !game.me.side;
|
|
|
|
|
}
|
|
|
|
|
player.setIdentity("enemy");
|
|
|
|
|
player.identity = "enemy";
|
|
|
|
|
} else {
|
|
|
|
|
if (get.mode() == "tafang") {
|
|
|
|
|
player.side = false;
|
|
|
|
|
} else {
|
|
|
|
|
player.side = game.me.side;
|
|
|
|
|
}
|
|
|
|
|
player.setIdentity("friend");
|
|
|
|
|
player.identity = "friend";
|
|
|
|
|
}
|
|
|
|
|
player.node.identity.dataset.color = get.translation(player.side + "Color");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.players.push(player);
|
|
|
|
|
// if(lib.config.animation){
|
|
|
|
|
// setTimeout(function(){
|
|
|
|
|
// player.$rare2();
|
|
|
|
|
// },300);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
ui.chess.appendChild(player);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.video || (pos && !lib.posmap[pos])) {
|
|
|
|
|
ui.placeChess(player, pos);
|
|
|
|
|
} else {
|
|
|
|
|
var grids = [];
|
|
|
|
|
var gridnum = ui.chessheight * ui.chesswidth;
|
|
|
|
|
for (var i = 0; i < gridnum; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
grids.push(i);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
grids.remove(parseInt(game.players[i].dataset.position));
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < game.obstacles.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
grids.remove(parseInt(game.obstacles[i].dataset.position));
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
grids.remove(parseInt(game.treasures[i].dataset.position));
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.placeChess(player, grids.randomGet());
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
lib.posmap[player.dataset.position] = player;
|
|
|
|
|
game.addVideo("addChessPlayer", null, [name, enemy, num, player.dataset.position]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.init(name);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num && !_status.video) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.directgain(get.cards(num));
|
|
|
|
|
}
|
|
|
|
|
game.arrangePlayers();
|
|
|
|
|
player.chessFocus();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.me && game.me.name) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.setChessInfo();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (game.players.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.setChessInfo(game.players[0]);
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.triggerEnter(player);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return player;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
replaceChessPlayer: function (name, enemy) {
|
|
|
|
|
var next = game.createEvent("replaceChessPlayer");
|
|
|
|
|
next.playername = name;
|
|
|
|
|
next.enemy = enemy;
|
|
|
|
|
next.setContent("replaceChessPlayer");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
removeTreasure: function (player) {
|
|
|
|
|
game.addVideo("removeTreasure", null, player.dataset.position);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.delete();
|
|
|
|
|
delete lib.posmap[player.dataset.position];
|
|
|
|
|
game.treasures.remove(player);
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
addObstacle: function (x, y) {
|
|
|
|
|
if (y !== false) {
|
|
|
|
|
game.addVideo("addObstacle", null, [x, y]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
var pos;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (typeof x == "string") {
|
|
|
|
|
pos = x;
|
|
|
|
|
} else {
|
|
|
|
|
if (x >= ui.chesswidth) {
|
|
|
|
|
x = ui.chesswidth - 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (y >= ui.chessheight) {
|
|
|
|
|
y = ui.chessheight - 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
pos = y * ui.chesswidth + x;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!lib.posmap[pos]) {
|
|
|
|
|
var grid = ui.create.div(".player.minskin.obstacle", ui.chess).addTempClass("start");
|
|
|
|
|
ui.placeChess(grid, pos);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
grid.listen(ui.click.obstacle);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
lib.posmap[pos] = grid;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.obstacles.push(grid);
|
|
|
|
|
return grid;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
addTempObstacle: function (x, y, num) {
|
|
|
|
|
var node = game.addObstacle(x, y);
|
|
|
|
|
if (node) {
|
|
|
|
|
game.colorObstacle(node, "blue");
|
|
|
|
|
node.tempObstacle = num;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
removeObstacle: function (pos) {
|
|
|
|
|
if (get.is.div(pos)) {
|
|
|
|
|
pos = pos.dataset.position;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var node = lib.posmap[pos];
|
|
|
|
|
if (node && game.obstacles.includes(node)) {
|
|
|
|
|
game.addVideo("removeObstacle", null, pos);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.obstacles.remove(node);
|
|
|
|
|
delete lib.posmap[pos];
|
|
|
|
|
node.delete();
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
moveObstacle: function (pos, x, y) {
|
|
|
|
|
if (get.is.div(pos)) {
|
|
|
|
|
pos = pos.dataset.position;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var node = lib.posmap[pos];
|
|
|
|
|
if (node && game.obstacles.includes(node)) {
|
|
|
|
|
pos = parseInt(pos);
|
|
|
|
|
var x2 = (pos % ui.chesswidth) + x;
|
|
|
|
|
var y2 = Math.floor(pos / ui.chesswidth) + y;
|
|
|
|
|
if (x2 >= ui.chesswidth) {
|
|
|
|
|
x2 = ui.chesswidth - 1;
|
|
|
|
|
}
|
|
|
|
|
if (y2 >= ui.chessheight) {
|
|
|
|
|
y2 = ui.chessheight - 1;
|
|
|
|
|
}
|
|
|
|
|
if (x2 < 0) {
|
|
|
|
|
x2 = 0;
|
|
|
|
|
}
|
|
|
|
|
if (y2 < 0) {
|
|
|
|
|
y2 = 0;
|
|
|
|
|
}
|
|
|
|
|
var pos2 = y2 * ui.chesswidth + x2;
|
|
|
|
|
if (!lib.posmap[pos2]) {
|
|
|
|
|
game.addVideo("moveObstacle", null, [pos, x, y]);
|
|
|
|
|
ui.placeChess(node, pos2);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete lib.posmap[pos];
|
2024-04-15 18:46:41 +00:00
|
|
|
|
lib.posmap[pos2] = node;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
colorObstacle: function (pos, color) {
|
|
|
|
|
if (get.is.div(pos)) {
|
|
|
|
|
pos = pos.dataset.position;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var node = lib.posmap[pos];
|
|
|
|
|
if (node && game.obstacles.includes(node)) {
|
|
|
|
|
game.addVideo("colorObstacle", null, [pos, color]);
|
|
|
|
|
node.dataset.obscolor = color;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
addOverDialog: function (dialog, result) {
|
|
|
|
|
if (ui.finishGame) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.finishGame.remove();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dialog.classList.add("center");
|
|
|
|
|
if (_status.mode != "leader") return;
|
|
|
|
|
if (result == "战斗胜利") {
|
|
|
|
|
_status.victory = true;
|
|
|
|
|
if (!_status.enterArena) {
|
|
|
|
|
var div = ui.create.div();
|
|
|
|
|
div.innerHTML = "获得" + game.reward + "金";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
dialog.add(div);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.challenge && _status.challengeMoney <= game.data.dust) {
|
|
|
|
|
var div2 = ui.create.div();
|
|
|
|
|
div2.style.display = "block";
|
|
|
|
|
div2.innerHTML =
|
|
|
|
|
"招降所需招募令:" + _status.challengeMoney + "/" + game.data.dust;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
dialog.add(div2);
|
|
|
|
|
}
|
|
|
|
|
game.changeMoney(game.reward);
|
|
|
|
|
game.saveData();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (_status.zhaoxiang) {
|
|
|
|
|
var div = ui.create.div();
|
|
|
|
|
div.innerHTML = "招降" + get.translation(_status.zhaoxiang) + "成功";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
dialog.add(div);
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
controlOver: function () {
|
|
|
|
|
if (_status.mode == "three") {
|
|
|
|
|
ui.create.control("再战", function () {
|
|
|
|
|
game.saveConfig("continue_name_chess", {
|
|
|
|
|
friend: _status.friendBackup,
|
|
|
|
|
enemy: _status.enemyBackup,
|
|
|
|
|
color: _status.color,
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.saveConfig("mode", lib.config.mode);
|
|
|
|
|
localStorage.setItem(lib.configprefix + "directstart", true);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.reload();
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.create.control("返回", game.reload);
|
|
|
|
|
if (_status.mode != "leader") return;
|
|
|
|
|
if (_status.enterArena) {
|
|
|
|
|
game.data.arena.acted.length = 0;
|
|
|
|
|
if (_status.victory) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.data.arena.win++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (_status.arenaAdd && _status.arenaAdd.includes(game.players[i].name)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.arena.dead.includes(game.players[i].name)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.data.arena.dead.remove(game.players[i].name);
|
|
|
|
|
game.data.arena.acted.push(game.players[i].name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.saveData();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (_status.challenge && (_status.zhaoxiang || _status.victory)) {
|
|
|
|
|
game.data.challenge = game.getLeaderList();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.saveData();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.challenge && !_status.zhaoxiang && _status.victory) {
|
|
|
|
|
var money = _status.challengeMoney;
|
|
|
|
|
if (game.data.dust >= money) {
|
|
|
|
|
ui.create.control("招降" + get.translation(_status.challenge), function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.data.character.add(_status.challenge);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.data.challenge = game.getLeaderList();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.changeDust(-money);
|
|
|
|
|
game.reload();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
phaseLoopThree: function (player) {
|
|
|
|
|
var next = game.createEvent("phaseLoop");
|
|
|
|
|
next.player = player;
|
|
|
|
|
(next.swap = function (player) {
|
|
|
|
|
if (player.side == game.me.side) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return game.enemyZhu;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return game.me;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}),
|
|
|
|
|
next.setContent(function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
player.classList.add("acted");
|
|
|
|
|
player.phase();
|
|
|
|
|
"step 1";
|
|
|
|
|
if (player != game.friendZhu && player != game.enemyZhu) {
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (
|
|
|
|
|
game.players[i].side == player.side &&
|
|
|
|
|
game.players[i] != game.friendZhu &&
|
|
|
|
|
game.players[i] != game.enemyZhu &&
|
|
|
|
|
game.players[i] != player &&
|
|
|
|
|
!game.players[i].classList.contains("acted")
|
|
|
|
|
) {
|
|
|
|
|
game.players[i].classList.add("acted");
|
|
|
|
|
game.players[i].phase();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 2";
|
|
|
|
|
var target = event.swap(player);
|
|
|
|
|
var swap = [],
|
|
|
|
|
swap2 = [];
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].isOut()) continue;
|
|
|
|
|
if (!game.players[i].classList.contains("acted")) {
|
|
|
|
|
if (game.players[i].side == target.side) {
|
|
|
|
|
swap.push(game.players[i]);
|
|
|
|
|
} else {
|
|
|
|
|
swap2.push(game.players[i]);
|
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (swap.length == 0) {
|
|
|
|
|
if (swap2.length) {
|
|
|
|
|
target = event.swap(target);
|
|
|
|
|
swap = swap2;
|
|
|
|
|
} else {
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].isOut()) continue;
|
|
|
|
|
game.players[i].classList.remove("acted");
|
|
|
|
|
}
|
|
|
|
|
delete _status.roundStart;
|
|
|
|
|
event.redo();
|
|
|
|
|
game.delay();
|
|
|
|
|
return;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (swap.length == 1) {
|
|
|
|
|
event.directresult = swap[0];
|
|
|
|
|
} else {
|
|
|
|
|
var rand = Math.random();
|
|
|
|
|
var next = target.chooseTarget(
|
|
|
|
|
"选择行动的角色",
|
|
|
|
|
true,
|
|
|
|
|
function (card, player, target2) {
|
|
|
|
|
return (
|
|
|
|
|
target2.side == target.side && !target2.classList.contains("acted")
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
next._triggered = null;
|
|
|
|
|
next.includeOut = true;
|
|
|
|
|
next.ai = function (target2) {
|
|
|
|
|
var num = 0;
|
|
|
|
|
if (target2.countCards("j")) {
|
|
|
|
|
num -= 5;
|
|
|
|
|
}
|
|
|
|
|
if (target2 != game.friendZhu && target2 != game.enemyZhu) {
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (
|
|
|
|
|
game.players[i] != game.friendZhu &&
|
|
|
|
|
game.players[i] != game.enemyZhu &&
|
|
|
|
|
game.players[i] != target2 &&
|
|
|
|
|
game.players[i].side == target2.side &&
|
|
|
|
|
game.players[i].countCards("j")
|
|
|
|
|
) {
|
|
|
|
|
num -= 2;
|
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (rand < 1 / 3) {
|
|
|
|
|
num += 1 / (target2.hp + 1);
|
|
|
|
|
} else if (rand < 2 / 3) {
|
|
|
|
|
num += target2.countCards("h") / 5;
|
|
|
|
|
}
|
|
|
|
|
return num;
|
|
|
|
|
};
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 3";
|
|
|
|
|
if (event.directresult) {
|
|
|
|
|
event.player = event.directresult;
|
|
|
|
|
delete event.directresult;
|
|
|
|
|
} else if (result.bool) {
|
|
|
|
|
event.player = result.targets[0];
|
|
|
|
|
}
|
|
|
|
|
event.goto(0);
|
|
|
|
|
});
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
phaseLoopOrdered: function (player) {
|
|
|
|
|
var next = game.createEvent("phaseLoop");
|
|
|
|
|
next.player = player;
|
|
|
|
|
next.setContent(function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
if (
|
|
|
|
|
!game.hasPlayer(function (current) {
|
|
|
|
|
return current.side == player.side && !current.classList.contains("acted");
|
|
|
|
|
})
|
|
|
|
|
) {
|
|
|
|
|
var num1 = 0;
|
|
|
|
|
var next = null;
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].side == player.side) {
|
|
|
|
|
game.players[i].classList.remove("acted");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num1++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (!next) {
|
|
|
|
|
next = game.players[i];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.roundStart && _status.roundStart.side == player.side) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete _status.roundStart;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var num2 = game.players.length - num1;
|
|
|
|
|
if (num2 > num1) {
|
|
|
|
|
if (next.side == game.me.side) {
|
|
|
|
|
next = game.me;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
var str;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num2 - num1 > 1) {
|
|
|
|
|
str = "选择至多" + get.cnNumber(num2 - num1) + "个已方角色各摸一张牌";
|
|
|
|
|
} else {
|
|
|
|
|
str = "选择一个已方角色摸一张牌";
|
|
|
|
|
}
|
|
|
|
|
var nevt = player.chooseTarget(
|
|
|
|
|
str,
|
|
|
|
|
function (card, player, target) {
|
|
|
|
|
return target.side == player.side;
|
|
|
|
|
},
|
|
|
|
|
[1, num2 - num1]
|
|
|
|
|
);
|
|
|
|
|
nevt.ai = function (target) {
|
|
|
|
|
return Math.max(1, 10 - target.countCards("h"));
|
2020-11-05 08:26:02 +00:00
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
nevt.includeOut = true;
|
|
|
|
|
nevt.chessForceAll = true;
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.delay();
|
|
|
|
|
event.goto(2);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.goto(2);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
if (result.bool) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.asyncDraw(result.targets);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 2";
|
|
|
|
|
if (player.side == game.me.side) {
|
|
|
|
|
player = game.me;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player.isDead()) {
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].side == player.side) {
|
|
|
|
|
player = game.players[i];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var players = game.filterPlayer(function (current) {
|
|
|
|
|
return player.side == current.side && !current.classList.contains("acted");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (players.length > 1) {
|
|
|
|
|
var nevt = player.chooseTarget(
|
|
|
|
|
"选择下一个行动的角色",
|
|
|
|
|
function (card, player, target) {
|
|
|
|
|
return target.side == player.side && !target.classList.contains("acted");
|
|
|
|
|
},
|
|
|
|
|
true
|
|
|
|
|
);
|
|
|
|
|
nevt.chessForceAll = true;
|
|
|
|
|
nevt.includeOut = true;
|
|
|
|
|
nevt.ai = function (target) {
|
|
|
|
|
var nj = target.countCards("j");
|
|
|
|
|
if (nj) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return -nj;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return Math.max(0, 10 - target.hp);
|
|
|
|
|
};
|
|
|
|
|
} else if (players.length) {
|
|
|
|
|
event.decided = players[0];
|
|
|
|
|
} else {
|
|
|
|
|
event.player = game.findPlayer(function (current) {
|
|
|
|
|
return current.side != player.side;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
|
|
|
|
event.goto(0);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 3";
|
|
|
|
|
if (event.decided) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.decided.phase();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.justacted = event.decided;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete event.decided;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
var current = result.targets[0];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
current.phase();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.justacted = current;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 4";
|
|
|
|
|
event.justacted.classList.add("acted");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.goto(0);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i].side != event.justacted.side) {
|
|
|
|
|
event.player = game.players[i];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (Math.random() < parseFloat(get.config("chess_treasure"))) {
|
|
|
|
|
var list = [];
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.push(game.treasures[i].name);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (list.length < lib.treasurelist.length) {
|
|
|
|
|
var name = Array.prototype.randomGet.apply(lib.treasurelist, list);
|
|
|
|
|
var treasure = game.addChessPlayer(name, "treasure", 0);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
treasure.playerfocus(1500);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (lib.config.animation && !lib.config.low_performance) {
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
treasure.$rare2();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 500);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.delay(3);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.treasures[i].life--;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.treasures[i].life <= 0) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.removeTreasure(game.treasures[i--]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
isChessNeighbour: function (a, b) {
|
|
|
|
|
if (a && a.dataset) {
|
|
|
|
|
a = a.dataset.position;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (b && b.dataset) {
|
|
|
|
|
b = b.dataset.position;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var ax = a % ui.chesswidth;
|
|
|
|
|
var ay = Math.floor(a / ui.chesswidth);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var bx = b % ui.chesswidth;
|
|
|
|
|
var by = Math.floor(b / ui.chesswidth);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (ax == bx && Math.abs(ay - by) == 1) return true;
|
|
|
|
|
if (ay == by && Math.abs(ax - bx) == 1) return true;
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
draw2: function (func) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
lib.canvasUpdates2.push(func);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!lib.status.canvas2) {
|
|
|
|
|
lib.status.canvas2 = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.update(game.updateCanvas2);
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
updateCanvas2: function (time) {
|
|
|
|
|
if (lib.canvasUpdates2.length === 0) {
|
|
|
|
|
lib.status.canvas2 = false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.canvas2.width = ui.chess.offsetWidth;
|
|
|
|
|
ui.canvas2.height = ui.chess.offsetHeight;
|
|
|
|
|
ui.canvas2.style.left = 0;
|
|
|
|
|
ui.canvas2.style.top = 0;
|
|
|
|
|
var ctx = ui.ctx2;
|
|
|
|
|
ctx.shadowBlur = 5;
|
|
|
|
|
ctx.shadowColor = "rgba(0,0,0,0.3)";
|
|
|
|
|
ctx.fillStyle = "white";
|
|
|
|
|
ctx.strokeStyle = "white";
|
|
|
|
|
ctx.lineWidth = 3;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ctx.save();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < lib.canvasUpdates2.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ctx.restore();
|
|
|
|
|
ctx.save();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var update = lib.canvasUpdates2[i];
|
|
|
|
|
if (!update.starttime) {
|
|
|
|
|
update.starttime = time;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (update(time - update.starttime, ctx) === false) {
|
|
|
|
|
lib.canvasUpdates2.splice(i--, 1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
setChessInfo: function (p) {
|
|
|
|
|
if (!p) {
|
|
|
|
|
if (ui.phasequeue && ui.phasequeue.length) {
|
|
|
|
|
p = ui.phasequeue[0].link;
|
|
|
|
|
} else {
|
|
|
|
|
p = game.me;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chessinfo.firstChild.innerHTML = "";
|
|
|
|
|
ui.phasequeue = [];
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
var node = ui.create.div(".avatar", ui.chessinfo.firstChild);
|
|
|
|
|
node.style.backgroundImage = p.node.avatar.style.backgroundImage;
|
|
|
|
|
node.link = p;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.listen(ui.click.chessInfo);
|
|
|
|
|
lib.setIntro(node);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.linkplayer = true;
|
|
|
|
|
p.instance = node;
|
|
|
|
|
if (_status.currentPhase == p) {
|
|
|
|
|
node.classList.add("glow2");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
ui.phasequeue.push(node);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
p = p.next;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
initLeaderSave: function (save) {
|
|
|
|
|
game.save(save, {
|
|
|
|
|
money: 300,
|
|
|
|
|
dust: 0,
|
|
|
|
|
legend: 0,
|
|
|
|
|
character: [],
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leaderView: function () {
|
|
|
|
|
var next = game.createEvent("leaderView", false);
|
|
|
|
|
next.setContent(function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var save = get.config("chess_leader_save");
|
|
|
|
|
if (!save) {
|
|
|
|
|
save = "save1";
|
|
|
|
|
}
|
|
|
|
|
if (!lib.storage[save]) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.initLeaderSave(save);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.data = lib.storage[save];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.wuxie.hide();
|
|
|
|
|
ui.auto.hide();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.money = ui.create.div(ui.window);
|
|
|
|
|
lib.setIntro(ui.money, function (uiintro) {
|
|
|
|
|
uiintro.add('<span style="font-family:xinwei">' + game.data.money + "金币");
|
|
|
|
|
uiintro.addText(
|
|
|
|
|
"通过战斗或竞技场可获得金币。花费100金币可招募3名随机武将;花费150金币可参加一次竞技场"
|
|
|
|
|
);
|
|
|
|
|
uiintro.add('<span style="font-family:xinwei">' + game.data.dust + "招募令");
|
|
|
|
|
uiintro.addText(
|
|
|
|
|
"通过遣返武将或竞技场可获得招募令。挑战武将成功后可通过招募令招募该武将,普通/稀有/史诗/传说武将分别花费40/100/400/1600招募令"
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.money.innerHTML =
|
|
|
|
|
"<span>⚑</span><span>" +
|
|
|
|
|
game.data.dust +
|
|
|
|
|
"</span>" +
|
|
|
|
|
"<span>㉤</span><span>" +
|
|
|
|
|
game.data.money +
|
|
|
|
|
"</span>";
|
|
|
|
|
ui.money.style.top = "auto";
|
|
|
|
|
ui.money.style.left = "auto";
|
|
|
|
|
ui.money.style.right = "20px";
|
|
|
|
|
ui.money.style.bottom = "15px";
|
|
|
|
|
ui.money.childNodes[0].style.color = "rgb(111, 198, 255)";
|
|
|
|
|
ui.money.childNodes[1].style.fontFamily = "huangcao";
|
|
|
|
|
ui.money.childNodes[1].style.marginRight = "10px";
|
|
|
|
|
ui.money.childNodes[2].style.color = "#FFE600";
|
|
|
|
|
ui.money.childNodes[3].style.fontFamily = "huangcao";
|
|
|
|
|
ui.money.style.letterSpacing = "4px";
|
|
|
|
|
if (get.config("chess_leader_allcharacter")) {
|
|
|
|
|
for (var i in lib.rank) {
|
|
|
|
|
if (Array.isArray(lib.rank[i])) {
|
|
|
|
|
for (var j = 0; j < lib.rank[i].length; j++) {
|
|
|
|
|
if (!lib.character[lib.rank[i][j]]) {
|
|
|
|
|
lib.rank[i].splice(j--, 1);
|
2020-11-17 08:21:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i in lib.rank.rarity) {
|
|
|
|
|
if (Array.isArray(lib.rank.rarity[i])) {
|
|
|
|
|
for (var j = 0; j < lib.rank.rarity[i].length; j++) {
|
|
|
|
|
if (!lib.character[lib.rank.rarity[i][j]]) {
|
|
|
|
|
lib.rank.rarity[i].splice(j--, 1);
|
2020-11-17 08:21:06 +00:00
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
var list = get.gainableCharacters().filter(function (i) {
|
|
|
|
|
return i.indexOf("leader_") != 0;
|
2020-11-17 08:21:06 +00:00
|
|
|
|
});
|
|
|
|
|
list.randomSort();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i in lib.rank.rarity) {
|
|
|
|
|
if (Array.isArray(lib.rank.rarity[i])) {
|
|
|
|
|
for (var j = 0; j < lib.rank.rarity[i].length; j++) {
|
|
|
|
|
if (
|
|
|
|
|
!list.includes(lib.rank.rarity[i][j]) ||
|
|
|
|
|
!lib.character[lib.rank.rarity[i][j]]
|
|
|
|
|
) {
|
|
|
|
|
lib.rank.rarity[i].splice(j--, 1);
|
2020-11-17 08:21:06 +00:00
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i in lib.rank) {
|
|
|
|
|
if (Array.isArray(lib.rank[i])) {
|
|
|
|
|
for (var j = 0; j < lib.rank[i].length; j++) {
|
|
|
|
|
if (!list.includes(lib.rank[i][j])) {
|
|
|
|
|
lib.rank[i].splice(j--, 1);
|
2020-11-28 02:28:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-17 08:21:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-28 02:28:27 +00:00
|
|
|
|
//var length=Math.ceil(list.length/9);
|
|
|
|
|
//for(var i in lib.rank){
|
|
|
|
|
// if(Array.isArray(lib.rank[i])){
|
|
|
|
|
// lib.rank[i]=list.splice(0,length);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
lib.rank.all = lib.rank.s
|
|
|
|
|
.concat(lib.rank.ap)
|
|
|
|
|
.concat(lib.rank.a)
|
|
|
|
|
.concat(lib.rank.am)
|
|
|
|
|
.concat(lib.rank.bp)
|
|
|
|
|
.concat(lib.rank.b)
|
|
|
|
|
.concat(lib.rank.bm)
|
|
|
|
|
.concat(lib.rank.c)
|
|
|
|
|
.concat(lib.rank.d);
|
|
|
|
|
lib.rank.rarity.common = [];
|
|
|
|
|
for (var i = 0; i < lib.rank.all.length; i++) {
|
|
|
|
|
if (
|
|
|
|
|
!lib.rank.rarity.legend.includes(lib.rank.all[i]) &&
|
|
|
|
|
!lib.rank.rarity.epic.includes(lib.rank.all[i]) &&
|
|
|
|
|
!lib.rank.rarity.rare.includes(lib.rank.all[i])
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
lib.rank.rarity.common.push(lib.rank.all[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.control.style.transition = "all 0s";
|
|
|
|
|
if (get.is.phoneLayout()) {
|
|
|
|
|
ui.control.style.top = "calc(100% - 80px)";
|
|
|
|
|
} else {
|
|
|
|
|
ui.control.style.top = "calc(100% - 70px)";
|
|
|
|
|
}
|
|
|
|
|
var cardNode = function (i, name, load) {
|
|
|
|
|
var node = ui.create.player(ui.window);
|
|
|
|
|
node.style.transition = "all 0.7s";
|
|
|
|
|
node.style.opacity = 0;
|
|
|
|
|
node.style.zIndex = 4;
|
|
|
|
|
node.classList.add("pointerdiv");
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var kaibao = false;
|
|
|
|
|
if (!name || typeof i == "string") {
|
|
|
|
|
if (!name) {
|
|
|
|
|
name = game.getLeaderCharacter();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.cardnodes.push(node);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
node.classList.add("minskin");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
kaibao = true;
|
|
|
|
|
node.style.left = "calc(50% - 75px)";
|
|
|
|
|
node.style.top = "calc(50% - 90px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.refresh(node);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (!load) {
|
|
|
|
|
node.style.transform = "perspective(1200px) rotateY(180deg) translate(0,-200px)";
|
|
|
|
|
}
|
|
|
|
|
node.name = name;
|
|
|
|
|
if (!load) {
|
|
|
|
|
switch (i) {
|
|
|
|
|
case 0: {
|
|
|
|
|
node.style.left = "calc(50% - 75px)";
|
|
|
|
|
node.style.top = "calc(25% - 90px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case 1: {
|
|
|
|
|
node.style.left = "calc(30% - 90px)";
|
|
|
|
|
node.style.top = "calc(75% - 90px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case 2: {
|
|
|
|
|
node.style.left = "calc(70% - 60px)";
|
|
|
|
|
node.style.top = "calc(75% - 90px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "51": {
|
|
|
|
|
node.style.left = "calc(50% - 60px)";
|
|
|
|
|
node.style.top = "calc(25% - 75px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "52": {
|
|
|
|
|
node.style.left = "calc(35% - 55px)";
|
|
|
|
|
node.style.top = "calc(75% - 25px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "53": {
|
|
|
|
|
node.style.left = "calc(65% - 65px)";
|
|
|
|
|
node.style.top = "calc(75% - 25px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "54": {
|
|
|
|
|
node.style.left = "calc(25% - 75px)";
|
|
|
|
|
node.style.top = "calc(50% - 70px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "55": {
|
|
|
|
|
node.style.left = "calc(75% - 45px)";
|
|
|
|
|
node.style.top = "calc(50% - 70px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!kaibao) {
|
|
|
|
|
node.style.top = "calc(50% - 180px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.refresh(node);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.style.opacity = 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
node.node.count.remove();
|
|
|
|
|
node.node.marks.remove();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var rarity = game.getRarity(name);
|
|
|
|
|
if (rarity != "common") {
|
|
|
|
|
node.rarity = rarity;
|
|
|
|
|
node.node.intro.style.left = "14px";
|
|
|
|
|
if (node.classList.contains("minskin")) {
|
|
|
|
|
node.node.intro.style.top = "84px";
|
|
|
|
|
} else {
|
|
|
|
|
node.node.intro.style.top = "145px";
|
|
|
|
|
}
|
|
|
|
|
node.node.intro.style.fontSize = "20px";
|
|
|
|
|
node.node.intro.style.fontFamily = "yuanli";
|
|
|
|
|
switch (rarity) {
|
|
|
|
|
case "rare":
|
|
|
|
|
node.node.intro.dataset.nature = "thunderm";
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
node.node.intro.dataset.nature = "metalm";
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
node.node.intro.dataset.nature = "orangem";
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}
|
|
|
|
|
if (kaibao) {
|
|
|
|
|
node.node.avatar.style.display = "none";
|
|
|
|
|
node.style.transform = "perspective(1200px) rotateY(180deg) translateX(0)";
|
|
|
|
|
if (typeof i == "string") {
|
|
|
|
|
node.listen(event.turnCard2);
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.listen(turnCard);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!game.data.character.includes(name)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.data.character.push(name);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.challenge.includes(name)) {
|
|
|
|
|
game.data.challenge = game.getLeaderList();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.saveData();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var button = ui.create.button(name, "character");
|
|
|
|
|
button.classList.add("glow2");
|
|
|
|
|
dialog1.content.lastChild.insertBefore(
|
|
|
|
|
button,
|
|
|
|
|
dialog1.content.lastChild.firstChild
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
dialog1.buttons.push(button);
|
|
|
|
|
fixButton(button);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
button.area = "character";
|
|
|
|
|
} else {
|
|
|
|
|
switch (rarity) {
|
|
|
|
|
case "common":
|
|
|
|
|
game.data.dust += 10;
|
|
|
|
|
break;
|
|
|
|
|
case "rare":
|
|
|
|
|
game.data.dust += 30;
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
game.data.dust += 150;
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
game.data.dust += 600;
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
node.style.transform = "";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return node;
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.cardNode = cardNode;
|
|
|
|
|
if (game.data.arena) {
|
|
|
|
|
ui.money.style.display = "none";
|
|
|
|
|
_status.enterArena = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var groupSort = function (name) {
|
|
|
|
|
if (lib.character[name][1] == "wei") return 0;
|
|
|
|
|
if (lib.character[name][1] == "shu") return 1;
|
|
|
|
|
if (lib.character[name][1] == "wu") return 2;
|
|
|
|
|
if (lib.character[name][1] == "qun") return 3;
|
|
|
|
|
if (lib.character[name][1] == "key") return 4;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.data.character = game.data.character.filter(function (i) {
|
2024-04-29 01:23:44 +00:00
|
|
|
|
return get.is.object(lib.character[i]);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
});
|
|
|
|
|
game.data.character.sort(function (a, b) {
|
|
|
|
|
var del = groupSort(a) - groupSort(b);
|
|
|
|
|
if (del != 0) return del;
|
|
|
|
|
var aa = a,
|
|
|
|
|
bb = b;
|
|
|
|
|
if (a.indexOf("_") != -1) {
|
|
|
|
|
a = a.slice(a.indexOf("_") + 1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (b.indexOf("_") != -1) {
|
|
|
|
|
b = b.slice(b.indexOf("_") + 1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (a != b) {
|
|
|
|
|
return a > b ? 1 : -1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return aa > bb ? 1 : -1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.character.length == 0 || !game.data.challenge) {
|
|
|
|
|
game.data.character = lib.rank.rarity.common.randomGets(3);
|
|
|
|
|
game.data.challenge = game.getLeaderList();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.saveData();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var fixButton = function (button) {
|
|
|
|
|
var rarity = game.getRarity(button.link);
|
|
|
|
|
if (rarity != "common") {
|
|
|
|
|
var intro = button.node.intro;
|
|
|
|
|
intro.classList.add("showintro");
|
|
|
|
|
intro.style.fontFamily = "yuanli";
|
|
|
|
|
intro.style.fontSize = "20px";
|
|
|
|
|
intro.style.top = "82px";
|
|
|
|
|
intro.style.left = "2px";
|
|
|
|
|
switch (rarity) {
|
|
|
|
|
case "rare":
|
|
|
|
|
intro.dataset.nature = "thunderm";
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
intro.dataset.nature = "metalm";
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
intro.dataset.nature = "orangem";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
intro.innerHTML = get.translation(rarity);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
game.leaderLord = ["leader_caocao", "leader_liubei", "leader_sunquan", "leader_yuri"];
|
|
|
|
|
var dialog1 = ui.create.dialog("选择君主", "hidden");
|
|
|
|
|
event.dialog1 = dialog1;
|
|
|
|
|
dialog1.classList.add("fullheight");
|
|
|
|
|
dialog1.classList.add("halfleft");
|
|
|
|
|
dialog1.classList.add("fixed");
|
|
|
|
|
dialog1.classList.add("pointerbutton");
|
|
|
|
|
dialog1.add([game.leaderLord, "character"]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var i;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (i = 0; i < dialog1.buttons.length; i++) {
|
|
|
|
|
dialog1.buttons[i].area = "lord";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var j = i;
|
|
|
|
|
dialog1.add("选择武将");
|
|
|
|
|
var getCapt = function (str) {
|
|
|
|
|
if (str.indexOf("_") == -1) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return str[0];
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return str[str.indexOf("_") + 1];
|
|
|
|
|
};
|
|
|
|
|
var clickCapt = function (e) {
|
|
|
|
|
if (_status.dragged) return;
|
|
|
|
|
if (this.classList.contains("thundertext")) {
|
|
|
|
|
dialog1.currentcapt = null;
|
|
|
|
|
dialog1.currentcaptnode = null;
|
|
|
|
|
this.classList.remove("thundertext");
|
|
|
|
|
for (var i = 0; i < dialog1.buttons.length; i++) {
|
|
|
|
|
dialog1.buttons[i].style.display = "";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (dialog1.currentcaptnode) {
|
|
|
|
|
dialog1.currentcaptnode.classList.remove("thundertext");
|
|
|
|
|
}
|
|
|
|
|
dialog1.currentcapt = this.link;
|
|
|
|
|
dialog1.currentcaptnode = this;
|
|
|
|
|
this.classList.add("thundertext");
|
|
|
|
|
for (var i = 0; i < dialog1.buttons.length; i++) {
|
|
|
|
|
if (dialog1.buttons[i].area != "character") continue;
|
|
|
|
|
if (getCapt(dialog1.buttons[i].link) != dialog1.currentcapt) {
|
|
|
|
|
dialog1.buttons[i].style.display = "none";
|
|
|
|
|
} else {
|
|
|
|
|
dialog1.buttons[i].style.display = "";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var captnode = ui.create.div(".caption");
|
|
|
|
|
var initcapt = function () {
|
|
|
|
|
var namecapt = [];
|
|
|
|
|
for (var i = 0; i < game.data.character.length; i++) {
|
|
|
|
|
var ii = game.data.character[i];
|
|
|
|
|
if (namecapt.indexOf(getCapt(ii)) == -1) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
namecapt.push(getCapt(ii));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
namecapt.sort(function (a, b) {
|
|
|
|
|
return a > b ? 1 : -1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
captnode.innerHTML = "";
|
|
|
|
|
for (i = 0; i < namecapt.length; i++) {
|
|
|
|
|
var span = document.createElement("span");
|
|
|
|
|
span.innerHTML = " " + namecapt[i].toUpperCase() + " ";
|
|
|
|
|
span.link = namecapt[i];
|
|
|
|
|
span.addEventListener(lib.config.touchscreen ? "touchend" : "click", clickCapt);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
captnode.appendChild(span);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.character.length <= 15) {
|
|
|
|
|
captnode.style.display = "none";
|
|
|
|
|
} else {
|
|
|
|
|
captnode.style.display = "";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
initcapt();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dialog1.captnode = captnode;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
dialog1.add(captnode);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dialog1.add([game.data.character, "character"]);
|
|
|
|
|
for (i = j; i < dialog1.buttons.length; i++) {
|
|
|
|
|
dialog1.buttons[i].area = "character";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
fixButton(dialog1.buttons[i]);
|
|
|
|
|
}
|
|
|
|
|
dialog1.open();
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var dialog2 = ui.create.dialog("战斗难度", "hidden");
|
|
|
|
|
event.dialog2 = dialog2;
|
|
|
|
|
dialog2.classList.add("fullheight");
|
|
|
|
|
dialog2.classList.add("halfright");
|
|
|
|
|
dialog2.classList.add("fixed");
|
|
|
|
|
dialog2.classList.add("pointerbutton");
|
|
|
|
|
dialog2.add([
|
|
|
|
|
[
|
|
|
|
|
["", "", "leader_easy"],
|
|
|
|
|
["", "", "leader_medium"],
|
|
|
|
|
["", "", "leader_hard"],
|
|
|
|
|
],
|
|
|
|
|
"vcard",
|
|
|
|
|
]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// for(i=0;i<dialog2.buttons.length;i++){
|
|
|
|
|
// dialog2.buttons[i].node.name.style.fontFamily='xinwei';
|
|
|
|
|
// dialog2.buttons[i].node.name.style.fontSize='30px';
|
|
|
|
|
// dialog2.buttons[i].node.name.style.left='4px';
|
|
|
|
|
// dialog2.buttons[i].node.name.dataset.color='unknownm';
|
|
|
|
|
// dialog2.buttons[i]._nopup=true;
|
|
|
|
|
// dialog2.buttons[i].area='difficulty';
|
|
|
|
|
// }
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dialog2.add("敌方人数");
|
|
|
|
|
dialog2.add([
|
|
|
|
|
[
|
|
|
|
|
["", "", "leader_2"],
|
|
|
|
|
["", "", "leader_3"],
|
|
|
|
|
["", "", "leader_5"],
|
|
|
|
|
["", "", "leader_8"],
|
|
|
|
|
],
|
|
|
|
|
"vcard",
|
|
|
|
|
]);
|
|
|
|
|
for (i = 0; i < dialog2.buttons.length; i++) {
|
|
|
|
|
dialog2.buttons[i].className = "menubutton large pointerdiv";
|
|
|
|
|
dialog2.buttons[i].innerHTML = dialog2.buttons[i].node.background.innerHTML;
|
|
|
|
|
dialog2.buttons[i].style.position = "relative";
|
|
|
|
|
dialog2.buttons[i].style.fontSize = "";
|
|
|
|
|
dialog2.buttons[i].style.color = "";
|
|
|
|
|
dialog2.buttons[i].style.textShadow = "";
|
|
|
|
|
dialog2.buttons[i]._nopup = true;
|
|
|
|
|
dialog2.buttons[i].style.marginLeft = "4px";
|
|
|
|
|
dialog2.buttons[i].style.marginRight = "4px";
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (i < 3) {
|
|
|
|
|
dialog2.buttons[i].area = "difficulty";
|
|
|
|
|
} else {
|
|
|
|
|
dialog2.buttons[i].area = "number";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
// if(i<3){
|
|
|
|
|
// dialog2.buttons[i].style.width='160px';
|
|
|
|
|
// dialog2.buttons[i].node.background.classList.remove('tight');
|
|
|
|
|
// dialog2.buttons[i].node.background.style.whiteSpace='nowrap';
|
|
|
|
|
// }
|
|
|
|
|
// dialog2.buttons[i].style.background='rgba(0,0,0,0.2)';
|
|
|
|
|
// dialog2.buttons[i].style.boxShadow='rgba(0, 0, 0, 0.3) 0 0 0 1px';
|
|
|
|
|
// dialog2.buttons[i].node.background.style.fontFamily='lishu';
|
|
|
|
|
// dialog2.buttons[i]._nopup=true;
|
|
|
|
|
// dialog2.buttons[i].area='number';
|
|
|
|
|
// dialog2.buttons[i].classList.add('menubg');
|
|
|
|
|
// dialog2.buttons[i].classList.add('large');
|
|
|
|
|
// dialog2.buttons[i].classList.remove('card');
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dialog2.add("挑战武将");
|
|
|
|
|
dialog2.add([game.data.challenge, "character"]);
|
|
|
|
|
for (; i < dialog2.buttons.length; i++) {
|
|
|
|
|
dialog2.buttons[i].area = "challenge";
|
|
|
|
|
fixButton(dialog2.buttons[i]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
dialog2.open();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dialog1.classList.remove("hidden");
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var selected = {
|
|
|
|
|
lord: [],
|
|
|
|
|
character: [],
|
|
|
|
|
difficulty: [],
|
|
|
|
|
number: [],
|
|
|
|
|
challenge: [],
|
|
|
|
|
};
|
|
|
|
|
var clearSelected = function () {
|
|
|
|
|
for (var i = 0; i < dialog1.buttons.length; i++) {
|
|
|
|
|
dialog1.buttons[i].classList.remove("unselectable");
|
|
|
|
|
dialog1.buttons[i].classList.remove("selected");
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < dialog2.buttons.length; i++) {
|
|
|
|
|
dialog2.buttons[i].classList.remove("unselectable");
|
|
|
|
|
dialog2.buttons[i].classList.remove("selected");
|
|
|
|
|
}
|
|
|
|
|
for (var j in selected) {
|
|
|
|
|
selected[j].length = 0;
|
|
|
|
|
}
|
|
|
|
|
event.removeCharacter.classList.add("disabled");
|
|
|
|
|
};
|
|
|
|
|
event.enterArena = ui.create.control("竞技场", "nozoom", function () {
|
|
|
|
|
if (game.data.money < 150 && !game.data._arena) return;
|
|
|
|
|
if (_status.qianfan || _status.kaibao) return;
|
|
|
|
|
if (!game.data._arena) game.changeMoney(-150);
|
|
|
|
|
_status.enterArena = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var turnCard = function () {
|
|
|
|
|
if (this.turned) return;
|
|
|
|
|
_status.chessclicked = true;
|
|
|
|
|
this.turned = true;
|
|
|
|
|
var node = this;
|
|
|
|
|
node.style.transition = "all ease-in 0.3s";
|
|
|
|
|
node.style.transform = "perspective(1200px) rotateY(270deg) translateX(150px)";
|
|
|
|
|
var onEnd = function () {
|
|
|
|
|
game.minskin = false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.init(node.name);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.minskin = true;
|
|
|
|
|
node.node.avatar.style.display = "";
|
|
|
|
|
if (node.rarity) {
|
|
|
|
|
node.node.intro.innerHTML = get.translation(node.rarity);
|
|
|
|
|
node.node.intro.classList.add("showintro");
|
|
|
|
|
}
|
|
|
|
|
node.classList.add("playerflip");
|
|
|
|
|
node.style.transform = "none";
|
|
|
|
|
node.style.transition = "";
|
|
|
|
|
if (lib.config.animation && !lib.config.low_performance) {
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
switch (game.getRarity(node.name)) {
|
|
|
|
|
case "rare":
|
|
|
|
|
node.$rare();
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
node.$epic();
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
node.$legend();
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 150);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
node.listenTransition(onEnd);
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var zhaomu2 = function () {
|
|
|
|
|
if (_status.qianfan || _status.kaibao) return;
|
|
|
|
|
if (game.data.money < 100) return;
|
|
|
|
|
_status.chessclicked = true;
|
|
|
|
|
ui.arena.classList.add("leaderhide");
|
|
|
|
|
ui.arena.classList.add("leadercontrol");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.money.hide();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.kaibao = true;
|
|
|
|
|
event.cardnodes = [];
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.cardnodes.push(cardNode(0));
|
2024-04-15 18:46:41 +00:00
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.cardnodes.push(cardNode(1));
|
2024-04-15 18:46:41 +00:00
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.cardnodes.push(cardNode(2));
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.money.childNodes[1].innerHTML = game.data.dust;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.changeMoney(-100);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.character.length > 3 && selected.character.length) {
|
|
|
|
|
event.removeCharacter.addTempClass("controlpressdownx", 500);
|
|
|
|
|
event.removeCharacter.classList.remove("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.money < 150 && !game.data._arena) {
|
|
|
|
|
event.enterArena.classList.add("disabled");
|
|
|
|
|
} else {
|
|
|
|
|
event.enterArena.addTempClass("controlpressdownx", 500);
|
|
|
|
|
event.enterArena.classList.remove("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.money < 100) {
|
|
|
|
|
event.addCharacter.classList.add("disabled");
|
|
|
|
|
} else {
|
|
|
|
|
event.addCharacter.addTempClass("controlpressdownx", 500);
|
|
|
|
|
event.addCharacter.classList.remove("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
initcapt();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 200);
|
|
|
|
|
}, 200);
|
|
|
|
|
}, 500);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.addCharacter = ui.create.control("招募", "nozoom", zhaomu2);
|
|
|
|
|
if (game.data.money < 150 && !game.data._arena) {
|
|
|
|
|
event.enterArena.classList.add("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.money < 100) {
|
|
|
|
|
event.addCharacter.classList.add("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var qianfan = function () {
|
|
|
|
|
if (_status.kaibao) return;
|
|
|
|
|
if (game.data.character.length <= 3) return;
|
|
|
|
|
if (!selected.character.length) return;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// _status.chessclicked=true;
|
|
|
|
|
// _status.qianfan=true;
|
|
|
|
|
// event.enterArena.style.opacity=0.5;
|
|
|
|
|
// event.addCharacter.style.opacity=0.5;
|
|
|
|
|
// event.fight.style.opacity=0.5;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var current = selected.character.slice(0);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
clearSelected();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var maxq = game.data.character.length - 3;
|
|
|
|
|
if (current.length <= maxq) {
|
|
|
|
|
for (var i = 0; i < current.length; i++) {
|
|
|
|
|
current[i].classList.add("selected");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
selected.character.push(current[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < dialog1.buttons.length; i++) {
|
|
|
|
|
if (dialog1.buttons[i].area != "character" || maxq == current.length) {
|
|
|
|
|
dialog1.buttons[i].classList.add("unselectable");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < dialog2.buttons.length; i++) {
|
|
|
|
|
dialog2.buttons[i].classList.add("unselectable");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!selected.character.length) {
|
|
|
|
|
alert("至少需要保留3名武将");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var translation = get.translation(selected.character[0].link);
|
|
|
|
|
for (var i = 1; i < selected.character.length; i++) {
|
|
|
|
|
translation += "、" + get.translation(selected.character[i].link);
|
|
|
|
|
}
|
|
|
|
|
var dust = 0;
|
|
|
|
|
for (var i = 0; i < selected.character.length; i++) {
|
|
|
|
|
var node = selected.character[i];
|
|
|
|
|
var rarity = game.getRarity(node.link);
|
|
|
|
|
switch (rarity) {
|
|
|
|
|
case "common":
|
|
|
|
|
dust += 5;
|
|
|
|
|
break;
|
|
|
|
|
case "rare":
|
|
|
|
|
dust += 20;
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
dust += 100;
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
dust += 400;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
confirm(translation + "将被遣返,一共将获得" + dust + "个招募令。是否确定遣返?")
|
|
|
|
|
) {
|
|
|
|
|
for (var i = 0; i < selected.character.length; i++) {
|
|
|
|
|
var node = selected.character[i];
|
|
|
|
|
var rarity = game.getRarity(node.link);
|
|
|
|
|
switch (rarity) {
|
|
|
|
|
case "common":
|
|
|
|
|
game.changeDust(5);
|
|
|
|
|
break;
|
|
|
|
|
case "rare":
|
|
|
|
|
game.changeDust(20);
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
game.changeDust(100);
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
game.changeDust(400);
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.data.character.remove(node.link);
|
|
|
|
|
game.saveData();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.money >= 100) {
|
|
|
|
|
event.addCharacter.addTempClass("controlpressdownx", 500);
|
|
|
|
|
event.addCharacter.classList.remove("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.money >= 150) {
|
|
|
|
|
event.enterArena.addTempClass("controlpressdownx", 500);
|
|
|
|
|
event.enterArena.classList.remove("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
node.delete();
|
|
|
|
|
dialog1.buttons.remove(node);
|
|
|
|
|
}
|
|
|
|
|
initcapt();
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.removeCharacter = ui.create.control("遣返", "nozoom", qianfan);
|
|
|
|
|
event.removeCharacter.classList.add("disabled");
|
|
|
|
|
event.fight = ui.create.control("开始战斗", "nozoom", function () {
|
|
|
|
|
if (_status.kaibao || _status.qianfan) return;
|
|
|
|
|
if (selected.challenge.length) {
|
|
|
|
|
var cname = selected.challenge[0].link;
|
|
|
|
|
var rarity = game.getRarity(cname);
|
|
|
|
|
switch (rarity) {
|
|
|
|
|
case "common":
|
|
|
|
|
rarity = 40;
|
|
|
|
|
break;
|
|
|
|
|
case "rare":
|
|
|
|
|
rarity = 100;
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
rarity = 400;
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
rarity = 1600;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
!confirm(
|
|
|
|
|
"即将挑战" +
|
|
|
|
|
get.translation(cname) +
|
|
|
|
|
",战斗胜利后可消耗" +
|
|
|
|
|
rarity +
|
|
|
|
|
"招募令招募该武将,无论是否招募,挑战列表将被刷新。是否继续?"
|
|
|
|
|
)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.enemylist = [];
|
|
|
|
|
_status.mylist = [];
|
|
|
|
|
if (selected.lord.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.mylist.push(selected.lord[0].link);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.lord = selected.lord[0].link;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (selected.character.length) {
|
|
|
|
|
for (var i = 0; i < selected.character.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.mylist.push(selected.character[i].link);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
_status.mylist = _status.mylist.concat(
|
|
|
|
|
game.data.character.randomGets(_status.lord ? 2 : 3)
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
var difficulty;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (selected.challenge.length) {
|
|
|
|
|
_status.challenge = selected.challenge[0].link;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.enemylist.push(_status.challenge);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
switch (game.getRarity(_status.challenge)) {
|
|
|
|
|
case "common":
|
|
|
|
|
_status.challengeMoney = 40;
|
|
|
|
|
break;
|
|
|
|
|
case "rare":
|
|
|
|
|
_status.challengeMoney = 100;
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
_status.challengeMoney = 400;
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
_status.challengeMoney = 1600;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
var rank = get.rank(_status.challenge);
|
|
|
|
|
var total = Math.max(2, _status.mylist.length - 1);
|
|
|
|
|
var list;
|
|
|
|
|
switch (rank) {
|
|
|
|
|
case "s":
|
|
|
|
|
list = lib.rank.ap;
|
|
|
|
|
break;
|
|
|
|
|
case "ap":
|
|
|
|
|
list = lib.rank.s.concat(lib.rank.a);
|
|
|
|
|
break;
|
|
|
|
|
case "a":
|
|
|
|
|
list = lib.rank.ap.concat(lib.rank.am);
|
|
|
|
|
break;
|
|
|
|
|
case "am":
|
|
|
|
|
list = lib.rank.a.concat(lib.rank.bp);
|
|
|
|
|
break;
|
|
|
|
|
case "bp":
|
|
|
|
|
list = lib.rank.am.concat(lib.rank.b);
|
|
|
|
|
break;
|
|
|
|
|
case "b":
|
|
|
|
|
list = lib.rank.bp.concat(lib.rank.bm);
|
|
|
|
|
break;
|
|
|
|
|
case "bm":
|
|
|
|
|
list = lib.rank.b.concat(lib.rank.c);
|
|
|
|
|
break;
|
|
|
|
|
case "c":
|
|
|
|
|
list = lib.rank.bm.concat(lib.rank.d);
|
|
|
|
|
break;
|
|
|
|
|
case "d":
|
|
|
|
|
list = lib.rank.c;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < total; i++) {
|
|
|
|
|
if (Math.random() < 0.7) {
|
|
|
|
|
_status.enemylist.push(
|
|
|
|
|
Array.prototype.randomGet.apply(
|
|
|
|
|
lib.rank[rank],
|
|
|
|
|
_status.enemylist.concat(_status.mylist)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
_status.enemylist.push(
|
|
|
|
|
Array.prototype.randomGet.apply(
|
|
|
|
|
list,
|
|
|
|
|
_status.enemylist.concat(_status.mylist)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var number, list;
|
|
|
|
|
if (selected.difficulty.length) {
|
|
|
|
|
difficulty = selected.difficulty[0].link[2];
|
|
|
|
|
} else {
|
|
|
|
|
difficulty = "leader_easy";
|
|
|
|
|
}
|
|
|
|
|
_status.difficulty = difficulty;
|
|
|
|
|
if (selected.number.length) {
|
|
|
|
|
number = selected.number[0].link[2];
|
|
|
|
|
number = parseInt(number[number.length - 1]);
|
|
|
|
|
} else {
|
|
|
|
|
number = 3;
|
|
|
|
|
}
|
|
|
|
|
switch (difficulty) {
|
|
|
|
|
case "leader_easy":
|
|
|
|
|
list = lib.rank.d.concat(lib.rank.c).concat(lib.rank.bm);
|
|
|
|
|
break;
|
|
|
|
|
case "leader_medium":
|
|
|
|
|
list = lib.rank.b.concat(lib.rank.bp).concat(lib.rank.am);
|
|
|
|
|
break;
|
|
|
|
|
case "leader_hard":
|
|
|
|
|
list = lib.rank.a
|
|
|
|
|
.concat(lib.rank.ap)
|
|
|
|
|
.concat(lib.rank.s)
|
|
|
|
|
.concat(lib.rank.am.randomGets(Math.floor(lib.rank.am.length / 2)));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < lib.hiddenCharacters.length; i++) {
|
|
|
|
|
if (list.length <= number) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
list.remove(lib.hiddenCharacters[i]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < _status.mylist.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.remove(_status.mylist[i]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.enemylist = list.randomGets(number);
|
|
|
|
|
}
|
|
|
|
|
var numdel = _status.enemylist.length - _status.mylist.length;
|
|
|
|
|
var reward = 0;
|
|
|
|
|
for (var i = 0; i < _status.enemylist.length; i++) {
|
|
|
|
|
switch (get.rank(_status.enemylist[i])) {
|
|
|
|
|
case "s":
|
|
|
|
|
reward += 50;
|
|
|
|
|
break;
|
|
|
|
|
case "ap":
|
|
|
|
|
reward += 40;
|
|
|
|
|
break;
|
|
|
|
|
case "a":
|
|
|
|
|
reward += 32;
|
|
|
|
|
break;
|
|
|
|
|
case "am":
|
|
|
|
|
reward += 25;
|
|
|
|
|
break;
|
|
|
|
|
case "bp":
|
|
|
|
|
reward += 19;
|
|
|
|
|
break;
|
|
|
|
|
case "b":
|
|
|
|
|
reward += 14;
|
|
|
|
|
break;
|
|
|
|
|
case "bm":
|
|
|
|
|
reward += 10;
|
|
|
|
|
break;
|
|
|
|
|
case "c":
|
|
|
|
|
reward += 7;
|
|
|
|
|
break;
|
|
|
|
|
case "d":
|
|
|
|
|
reward += 5;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (numdel > 0) {
|
|
|
|
|
switch (difficulty) {
|
|
|
|
|
case "leader_easy":
|
|
|
|
|
reward += 10 * numdel;
|
|
|
|
|
break;
|
|
|
|
|
case "leader_medium":
|
|
|
|
|
reward += 20 * numdel;
|
|
|
|
|
break;
|
|
|
|
|
case "leader_hard":
|
|
|
|
|
reward += 40 * numdel;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var punish = 0;
|
|
|
|
|
for (var i = 0; i < _status.mylist.length; i++) {
|
|
|
|
|
switch (get.rank(_status.mylist[i])) {
|
|
|
|
|
case "s":
|
|
|
|
|
punish += 25;
|
|
|
|
|
break;
|
|
|
|
|
case "ap":
|
|
|
|
|
punish += 20;
|
|
|
|
|
break;
|
|
|
|
|
case "a":
|
|
|
|
|
punish += 16;
|
|
|
|
|
break;
|
|
|
|
|
case "am":
|
|
|
|
|
punish += 12;
|
|
|
|
|
break;
|
|
|
|
|
case "bp":
|
|
|
|
|
punish += 9;
|
|
|
|
|
break;
|
|
|
|
|
case "b":
|
|
|
|
|
punish += 7;
|
|
|
|
|
break;
|
|
|
|
|
case "bm":
|
|
|
|
|
punish += 5;
|
|
|
|
|
break;
|
|
|
|
|
case "c":
|
|
|
|
|
punish += 3;
|
|
|
|
|
break;
|
|
|
|
|
case "d":
|
|
|
|
|
punish += 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (numdel < 0) {
|
|
|
|
|
switch (difficulty) {
|
|
|
|
|
case "leader_easy":
|
|
|
|
|
punish -= 5 * numdel;
|
|
|
|
|
break;
|
|
|
|
|
case "leader_medium":
|
|
|
|
|
punish -= 10 * numdel;
|
|
|
|
|
break;
|
|
|
|
|
case "leader_hard":
|
|
|
|
|
punish -= 20 * numdel;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.reward = Math.max(3 * _status.enemylist.length, reward - punish);
|
|
|
|
|
if (!_status.lord) {
|
|
|
|
|
switch (difficulty) {
|
|
|
|
|
case "leader_easy":
|
|
|
|
|
game.reward += 10;
|
|
|
|
|
break;
|
|
|
|
|
case "leader_medium":
|
|
|
|
|
game.reward += 20;
|
|
|
|
|
break;
|
|
|
|
|
case "leader_hard":
|
|
|
|
|
game.reward += 40;
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.resume();
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.custom.replace.button = function (button) {
|
|
|
|
|
if (_status.kaibao) return;
|
|
|
|
|
if (
|
|
|
|
|
button.classList.contains("unselectable") &&
|
|
|
|
|
!button.classList.contains("selected")
|
|
|
|
|
)
|
|
|
|
|
return;
|
|
|
|
|
_status.chessclicked = true;
|
|
|
|
|
button.classList.toggle("selected");
|
|
|
|
|
if (button.classList.contains("selected")) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
selected[button.area].add(button);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
selected[button.area].remove(button);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
switch (button.area) {
|
|
|
|
|
case "lord": {
|
|
|
|
|
for (var i = 0; i < dialog1.buttons.length; i++) {
|
|
|
|
|
if (dialog1.buttons[i].area == "lord") {
|
|
|
|
|
if (selected.lord.length) {
|
|
|
|
|
dialog1.buttons[i].classList.add("unselectable");
|
|
|
|
|
} else {
|
|
|
|
|
dialog1.buttons[i].classList.remove("unselectable");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "character": {
|
|
|
|
|
for (var i = 0; i < dialog1.buttons.length; i++) {
|
|
|
|
|
if (dialog1.buttons[i].area == "character") {
|
|
|
|
|
var maxq = game.data.character.length - 3;
|
|
|
|
|
if (
|
|
|
|
|
(!_status.qianfan && selected.character.length > 5) ||
|
|
|
|
|
(_status.qianfan && selected.character.length >= maxq)
|
|
|
|
|
) {
|
|
|
|
|
dialog1.buttons[i].classList.add("unselectable");
|
|
|
|
|
} else {
|
|
|
|
|
dialog1.buttons[i].classList.remove("unselectable");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "difficulty":
|
|
|
|
|
case "number": {
|
|
|
|
|
for (var i = 0; i < dialog2.buttons.length; i++) {
|
|
|
|
|
if (dialog2.buttons[i].area == button.area) {
|
|
|
|
|
if (selected[button.area].length) {
|
|
|
|
|
dialog2.buttons[i].classList.add("unselectable");
|
|
|
|
|
} else {
|
|
|
|
|
dialog2.buttons[i].classList.remove("unselectable");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "challenge": {
|
|
|
|
|
if (selected.challenge.length) {
|
|
|
|
|
for (var i = 0; i < dialog2.buttons.length; i++) {
|
|
|
|
|
if (dialog2.buttons[i].area == "challenge") {
|
|
|
|
|
dialog2.buttons[i].classList.add("unselectable");
|
|
|
|
|
} else {
|
|
|
|
|
dialog2.buttons[i].classList.add("unselectable");
|
|
|
|
|
dialog2.buttons[i].classList.remove("selected");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
for (var i = 0; i < dialog2.buttons.length; i++) {
|
|
|
|
|
dialog2.buttons[i].classList.remove("unselectable");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (selected.character.length && game.data.character.length > 3) {
|
|
|
|
|
event.removeCharacter.addTempClass("controlpressdownx", 500);
|
|
|
|
|
event.removeCharacter.classList.remove("disabled");
|
|
|
|
|
} else {
|
|
|
|
|
event.removeCharacter.classList.add("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.custom.add.window = function () {
|
|
|
|
|
if (!_status.kaibao) {
|
|
|
|
|
var glows = document.querySelectorAll(".button.glow2");
|
|
|
|
|
for (var i = 0; i < glows.length; i++) {
|
|
|
|
|
glows[i].classList.remove("glow2");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.chessclicked) {
|
|
|
|
|
_status.chessclicked = false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.kaibao && event.cardnodes && event.cardnodes.length) {
|
|
|
|
|
for (var i = 0; i < event.cardnodes.length; i++) {
|
|
|
|
|
if (!event.cardnodes[i].turned) return;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < event.cardnodes.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.cardnodes[i].delete();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.arena.classList.remove("leaderhide");
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
ui.arena.classList.remove("leadercontrol");
|
|
|
|
|
}, 500);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.money.show();
|
|
|
|
|
delete event.cardnodes;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.kaibao = false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.qianfan) {
|
|
|
|
|
_status.qianfan = false;
|
|
|
|
|
event.removeCharacter.replace("遣返", qianfan);
|
|
|
|
|
if (game.data.money >= 100) {
|
|
|
|
|
event.addCharacter.addTempClass("controlpressdownx", 500);
|
|
|
|
|
event.addCharacter.classList.remove("disabled");
|
|
|
|
|
} else {
|
|
|
|
|
event.addCharacter.classList.add("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.money >= 150 || game.data._arena) {
|
|
|
|
|
event.enterArena.addTempClass("controlpressdownx", 500);
|
|
|
|
|
event.enterArena.classList.remove("disabled");
|
|
|
|
|
} else {
|
|
|
|
|
event.enterArena.classList.add("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.fight.style.opacity = 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
clearSelected();
|
|
|
|
|
};
|
|
|
|
|
lib.init.onfree();
|
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 2";
|
|
|
|
|
if (!game.data.arena) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.dialog1.close();
|
|
|
|
|
event.dialog2.close();
|
|
|
|
|
event.fight.close();
|
|
|
|
|
event.enterArena.close();
|
|
|
|
|
event.addCharacter.close();
|
|
|
|
|
event.removeCharacter.close();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.arena.classList.add("leaderhide");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.money.hide();
|
|
|
|
|
game.delay();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 3";
|
|
|
|
|
ui.arena.classList.remove("leaderhide");
|
|
|
|
|
if (!_status.enterArena) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.wuxie.show();
|
|
|
|
|
ui.auto.show();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.control.style.top = "";
|
|
|
|
|
if (!get.is.safari()) {
|
|
|
|
|
ui.control.style.transition = "";
|
|
|
|
|
ui.control.style.display = "none";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
event.finish();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
game.minskin = false;
|
|
|
|
|
event.arenanodes = [];
|
|
|
|
|
event.arenachoice = [];
|
|
|
|
|
event.arenachoicenodes = [];
|
|
|
|
|
event.arrangeNodes = function () {
|
|
|
|
|
var num = event.arenachoicenodes.length;
|
|
|
|
|
var width = num * 75 + (num - 1) * 8;
|
|
|
|
|
for (var i = 0; i < event.arenachoicenodes.length; i++) {
|
|
|
|
|
var left = -width / 2 + i * 83 - 37.5;
|
|
|
|
|
if (left < 0) {
|
|
|
|
|
event.arenachoicenodes[i].style.left = "calc(50% - " + -left + "px)";
|
|
|
|
|
} else {
|
|
|
|
|
event.arenachoicenodes[i].style.left = "calc(50% + " + left + "px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
|
|
|
|
event.clickNode = function () {
|
|
|
|
|
if (this.classList.contains("removing")) return;
|
|
|
|
|
if (this.isChosen) {
|
|
|
|
|
if (_status.chessgiveup) return;
|
|
|
|
|
if (!event.choosefinished) return;
|
|
|
|
|
if (
|
|
|
|
|
this.classList.contains("unselectable") &&
|
|
|
|
|
!this.classList.contains("selected")
|
|
|
|
|
)
|
|
|
|
|
return;
|
|
|
|
|
_status.chessclicked = true;
|
|
|
|
|
this.classList.toggle("selected");
|
|
|
|
|
if (this.classList.contains("selected")) {
|
|
|
|
|
this.style.transform = "scale(0.85)";
|
|
|
|
|
} else {
|
|
|
|
|
this.style.transform = "scale(0.8)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (document.querySelectorAll(".player.selected").length >= 3) {
|
|
|
|
|
for (var i = 0; i < event.arenachoicenodes.length; i++) {
|
|
|
|
|
if (!event.arenachoicenodes[i].classList.contains("dead")) {
|
|
|
|
|
event.arenachoicenodes[i].classList.add("unselectable");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
for (var i = 0; i < event.arenachoicenodes.length; i++) {
|
|
|
|
|
event.arenachoicenodes[i].classList.remove("unselectable");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
while (event.arenanodes.length) {
|
|
|
|
|
var node = event.arenanodes.shift();
|
|
|
|
|
if (node == this) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.node.hp.hide();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.style.transform = "scale(0.5)";
|
|
|
|
|
node.style.top = "calc(50% + 50px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.arenachoicenodes.push(node);
|
|
|
|
|
event.arrangeNodes();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.delete();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
this.isChosen = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.arenachoice.push(this.name);
|
|
|
|
|
game.resume();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 4";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var choice;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data._arena) {
|
|
|
|
|
game.data.arena = game.data._arena;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete game.data._arena;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.arena && !_status.arenaLoaded) {
|
|
|
|
|
game.data.arena.loaded = true;
|
|
|
|
|
event.arenachoice = game.data.arena.arenachoice;
|
|
|
|
|
for (var i = 0; i < event.arenachoice.length; i++) {
|
|
|
|
|
var node = event.cardNode(0, event.arenachoice[i], true);
|
|
|
|
|
node.node.hp.style.display = "none";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.init(node.name);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.isChosen = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.listen(event.clickNode);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.style.transform = "scale(0.5)";
|
|
|
|
|
node.style.top = "calc(50% + 50px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.arenachoicenodes.push(node);
|
|
|
|
|
}
|
|
|
|
|
event.arrangeNodes();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < event.arenachoicenodes.length; i++) {
|
|
|
|
|
var node = event.arenachoicenodes[i];
|
|
|
|
|
if (game.data.arena.choice) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.refresh(node);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.style.opacity = 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.arena.choice) {
|
|
|
|
|
choice = game.data.arena.choice;
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
switch (event.arenachoice.length) {
|
|
|
|
|
case 0:
|
|
|
|
|
choice = lib.rank.d.randomGets(3);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
choice = lib.rank.c.randomGets(3);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
choice = lib.rank.bm.randomGets(3);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
choice = lib.rank.b.randomGets(3);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
choice = lib.rank.bp.randomGets(3);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
choice = lib.rank.am.randomGets(3);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
choice = lib.rank.a.randomGets(3);
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
choice = lib.rank.ap.randomGets(3);
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
choice = lib.rank.s.randomGets(3);
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.data.arena = {
|
|
|
|
|
win: 0,
|
|
|
|
|
dead: [],
|
|
|
|
|
acted: [],
|
|
|
|
|
choice: choice,
|
|
|
|
|
arenachoice: event.arenachoice,
|
|
|
|
|
};
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.saveData();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.arenaLoaded = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var node;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node = event.cardNode(0, choice[0]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.init(node.name);
|
|
|
|
|
node.listen(event.clickNode);
|
|
|
|
|
event.arenanodes.push(node);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
setTimeout(function () {
|
|
|
|
|
node = event.cardNode(1, choice[1]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.init(node.name);
|
|
|
|
|
node.listen(event.clickNode);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.choosefinished) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.arenanodes.push(node);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
setTimeout(function () {
|
|
|
|
|
node = event.cardNode(2, choice[2]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.init(node.name);
|
|
|
|
|
node.listen(event.clickNode);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.choosefinished) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.arenanodes.push(node);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 200);
|
|
|
|
|
}, 200);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
lib.init.onfree();
|
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 5";
|
|
|
|
|
if (event.arenachoice.length < 9) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.goto(4);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (_status.arenaLoaded) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.delay(2);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
game.data.arena.arenachoice = event.arenachoice;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete game.data.arena.choice;
|
|
|
|
|
game.saveData();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.choosefinished = true;
|
|
|
|
|
}
|
|
|
|
|
"step 6";
|
|
|
|
|
game.minskin = true;
|
|
|
|
|
ui.arena.classList.add("noleft");
|
|
|
|
|
var nodes = event.arenachoicenodes;
|
|
|
|
|
for (var i = 0; i < nodes.length; i++) {
|
|
|
|
|
nodes[i].style.transform = "scale(0.8)";
|
|
|
|
|
}
|
|
|
|
|
if (_status.arenaLoaded) {
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
nodes[0].style.left = "calc(50% - 215px)";
|
|
|
|
|
nodes[0].style.top = "calc(50% - 260px)";
|
|
|
|
|
}, 0);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
nodes[1].style.left = "calc(50% - 75px)";
|
|
|
|
|
nodes[1].style.top = "calc(50% - 260px)";
|
|
|
|
|
}, 50);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
nodes[2].style.left = "calc(50% + 65px)";
|
|
|
|
|
nodes[2].style.top = "calc(50% - 260px)";
|
|
|
|
|
}, 100);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
nodes[3].style.left = "calc(50% - 215px)";
|
|
|
|
|
nodes[3].style.top = "calc(50% - 90px)";
|
|
|
|
|
}, 150);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
nodes[4].style.left = "calc(50% - 75px)";
|
|
|
|
|
nodes[4].style.top = "calc(50% - 90px)";
|
|
|
|
|
}, 200);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
nodes[5].style.left = "calc(50% + 65px)";
|
|
|
|
|
nodes[5].style.top = "calc(50% - 90px)";
|
|
|
|
|
}, 250);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
nodes[6].style.left = "calc(50% - 215px)";
|
|
|
|
|
nodes[6].style.top = "calc(50% + 80px)";
|
|
|
|
|
}, 300);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
nodes[7].style.left = "calc(50% - 75px)";
|
|
|
|
|
nodes[7].style.top = "calc(50% + 80px)";
|
|
|
|
|
}, 350);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
nodes[8].style.left = "calc(50% + 65px)";
|
|
|
|
|
nodes[8].style.top = "calc(50% + 80px)";
|
|
|
|
|
}, 400);
|
|
|
|
|
} else {
|
|
|
|
|
nodes[0].style.left = "calc(50% - 215px)";
|
|
|
|
|
nodes[0].style.top = "calc(50% - 260px)";
|
|
|
|
|
nodes[1].style.left = "calc(50% - 75px)";
|
|
|
|
|
nodes[1].style.top = "calc(50% - 260px)";
|
|
|
|
|
nodes[2].style.left = "calc(50% + 65px)";
|
|
|
|
|
nodes[2].style.top = "calc(50% - 260px)";
|
|
|
|
|
nodes[3].style.left = "calc(50% - 215px)";
|
|
|
|
|
nodes[3].style.top = "calc(50% - 90px)";
|
|
|
|
|
nodes[4].style.left = "calc(50% - 75px)";
|
|
|
|
|
nodes[4].style.top = "calc(50% - 90px)";
|
|
|
|
|
nodes[5].style.left = "calc(50% + 65px)";
|
|
|
|
|
nodes[5].style.top = "calc(50% - 90px)";
|
|
|
|
|
nodes[6].style.left = "calc(50% - 215px)";
|
|
|
|
|
nodes[6].style.top = "calc(50% + 80px)";
|
|
|
|
|
nodes[7].style.left = "calc(50% - 75px)";
|
|
|
|
|
nodes[7].style.top = "calc(50% + 80px)";
|
|
|
|
|
nodes[8].style.left = "calc(50% + 65px)";
|
|
|
|
|
nodes[8].style.top = "calc(50% + 80px)";
|
|
|
|
|
for (var i = 0; i < nodes.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.refresh(nodes[i]);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.arena.dead.includes(nodes[i].name)) {
|
|
|
|
|
nodes[i].classList.add("dead");
|
|
|
|
|
nodes[i].style.opacity = 0.3;
|
|
|
|
|
} else {
|
|
|
|
|
nodes[i].style.opacity = 1;
|
|
|
|
|
if (game.data.arena.acted.includes(nodes[i].name)) {
|
|
|
|
|
var acted = nodes[i].node.action;
|
|
|
|
|
acted.style.opacity = 1;
|
|
|
|
|
acted.innerHTML = "疲劳";
|
|
|
|
|
acted.dataset.nature = "soilm";
|
|
|
|
|
acted.classList.add("freecolor");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var victory = ui.create.div().hide();
|
|
|
|
|
victory.innerHTML = "<span>" + game.data.arena.win + "</span>胜";
|
|
|
|
|
victory.style.top = "auto";
|
|
|
|
|
victory.style.left = "auto";
|
|
|
|
|
victory.style.right = "20px";
|
|
|
|
|
victory.style.bottom = "15px";
|
|
|
|
|
victory.style.fontSize = "30px";
|
|
|
|
|
victory.style.fontFamily = "huangcao";
|
|
|
|
|
victory.firstChild.style.marginRight = "5px";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.window.appendChild(victory);
|
|
|
|
|
ui.refresh(victory);
|
|
|
|
|
victory.show();
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.checkPrize = function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// event.kaibao=true;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.prize = [];
|
|
|
|
|
event.turnCard2 = function () {
|
|
|
|
|
if (this.turned) return;
|
|
|
|
|
_status.chessclicked = true;
|
|
|
|
|
this.turned = true;
|
|
|
|
|
var node = this;
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
node.turned2 = true;
|
|
|
|
|
}, 1000);
|
|
|
|
|
if (node.name == "chess_coin" || node.name == "chess_dust") {
|
|
|
|
|
node.style.transition = "all 0s";
|
|
|
|
|
node.style.transform = "none";
|
|
|
|
|
node.style.overflow = "visible";
|
|
|
|
|
node.style.background = "none";
|
|
|
|
|
node.style.boxShadow = "none";
|
|
|
|
|
var div = ui.create.div(node);
|
|
|
|
|
div.style.transition = "all 0s";
|
|
|
|
|
if (node.name == "chess_coin") {
|
|
|
|
|
div.innerHTML = "<span>㉤</span><span>" + node.num + "</span>";
|
|
|
|
|
div.firstChild.style.color = "rgb(255, 230, 0)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.$coin();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
div.innerHTML = "<span>⚑</span><span>" + node.num + "</span>";
|
|
|
|
|
div.firstChild.style.color = "rgb(111, 198, 255)";
|
|
|
|
|
div.firstChild.style.marginRight = "3px";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.$dust();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
div.style.fontFamily = "huangcao";
|
|
|
|
|
div.style.fontSize = "50px";
|
|
|
|
|
div.style.top = "40px";
|
|
|
|
|
div.style.letterSpacing = "8px";
|
|
|
|
|
div.style.whiteSpace = "nowrap";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// div.dataset.nature='metal';
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.style.transition = "all ease-in 0.3s";
|
|
|
|
|
node.style.transform = "perspective(1200px) rotateY(270deg) translateX(150px)";
|
|
|
|
|
var onEnd = function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.init(node.name);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.node.avatar.style.display = "";
|
|
|
|
|
if (node.rarity) {
|
|
|
|
|
node.node.intro.innerHTML = get.translation(node.rarity);
|
|
|
|
|
node.node.intro.classList.add("showintro");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
node.classList.add("playerflip");
|
|
|
|
|
node.style.transform = "none";
|
|
|
|
|
node.style.transition = "";
|
|
|
|
|
if (lib.config.animation && !lib.config.low_performance) {
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
switch (game.getRarity(node.name)) {
|
|
|
|
|
case "rare":
|
|
|
|
|
node.$rare();
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
node.$epic();
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
node.$legend();
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 150);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
node.listenTransition(onEnd);
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[0].delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 400 + Math.random() * 300);
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[1].delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 400 + Math.random() * 300);
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[2].delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 400 + Math.random() * 300);
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[3].delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 400 + Math.random() * 300);
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[4].delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 400 + Math.random() * 300);
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[5].delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 400 + Math.random() * 300);
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[6].delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 400 + Math.random() * 300);
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[7].delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 400 + Math.random() * 300);
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[8].delete();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 400 + Math.random() * 300);
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
var prize = new Array(6);
|
|
|
|
|
var map = [1, 2, 3, 4, 5];
|
|
|
|
|
var ccount = 3;
|
|
|
|
|
var win = game.data.arena.win;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var prizeValue;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
switch (win) {
|
|
|
|
|
case 0:
|
|
|
|
|
prizeValue = 100;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
prizeValue = 120;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
prizeValue = 150;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
prizeValue = 190;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
prizeValue = 240;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
prizeValue = 300;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
prizeValue = 370;
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
prizeValue = 450;
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
prizeValue = 540;
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
prizeValue = 640;
|
|
|
|
|
break;
|
|
|
|
|
case 10:
|
|
|
|
|
prizeValue = 750;
|
|
|
|
|
break;
|
|
|
|
|
case 11:
|
|
|
|
|
prizeValue = 870;
|
|
|
|
|
break;
|
|
|
|
|
case 12:
|
|
|
|
|
prizeValue = 1000;
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (Math.random() < 0.4) {
|
|
|
|
|
if (win >= 3 && Math.random() < 0.5) {
|
|
|
|
|
ccount = 4;
|
|
|
|
|
prizeValue -= 33;
|
|
|
|
|
} else {
|
|
|
|
|
ccount = 2;
|
|
|
|
|
prizeValue += 33;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}
|
|
|
|
|
prizeValue -= 100;
|
|
|
|
|
while (ccount--) {
|
|
|
|
|
prize[map.randomRemove()] = game.getLeaderCharacter();
|
|
|
|
|
}
|
|
|
|
|
if (map.length) {
|
|
|
|
|
prizeValue /= map.length;
|
|
|
|
|
}
|
|
|
|
|
while (map.length) {
|
|
|
|
|
var val = Math.round((Math.random() * 0.4 + 0.8) * prizeValue);
|
|
|
|
|
if (Math.random() < 0.7) {
|
|
|
|
|
prize[map.shift()] = [
|
|
|
|
|
"chess_coin",
|
|
|
|
|
Math.max(Math.ceil(Math.random() * 5), val),
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
val = Math.round(val / 3);
|
|
|
|
|
prize[map.shift()] = [
|
|
|
|
|
"chess_dust",
|
|
|
|
|
Math.max(Math.ceil(Math.random() * 3), val),
|
|
|
|
|
];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 1; i < prize.length; i++) {
|
|
|
|
|
if (typeof prize[i] == "string") {
|
|
|
|
|
var name = prize[i];
|
|
|
|
|
var rarity = game.getRarity(name);
|
|
|
|
|
if (!game.data.character.includes(name)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.data.character.push(name);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.challenge.includes(name)) {
|
|
|
|
|
game.data.challenge = game.getLeaderList();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
switch (rarity) {
|
|
|
|
|
case "common":
|
|
|
|
|
game.data.dust += 10;
|
|
|
|
|
break;
|
|
|
|
|
case "rare":
|
|
|
|
|
game.data.dust += 30;
|
|
|
|
|
break;
|
|
|
|
|
case "epic":
|
|
|
|
|
game.data.dust += 150;
|
|
|
|
|
break;
|
|
|
|
|
case "legend":
|
|
|
|
|
game.data.dust += 600;
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (prize[i][0] == "chess_coin") {
|
|
|
|
|
game.data.money += prize[i][1];
|
|
|
|
|
} else {
|
|
|
|
|
game.data.dust += prize[i][1];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
setTimeout(
|
|
|
|
|
(function (i) {
|
|
|
|
|
return function () {
|
|
|
|
|
var node;
|
|
|
|
|
if (typeof prize[i] == "string") {
|
|
|
|
|
node = event.cardNode("5" + i, prize[i]);
|
|
|
|
|
} else {
|
|
|
|
|
node = event.cardNode("5" + i, prize[i][0]);
|
|
|
|
|
node.num = prize[i][1];
|
|
|
|
|
}
|
|
|
|
|
event.prize.push(node);
|
|
|
|
|
if (i == prize.length - 1) {
|
|
|
|
|
event.kaibao = true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
})(i),
|
|
|
|
|
i * 200
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
delete game.data.arena;
|
|
|
|
|
game.saveData();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 1000);
|
|
|
|
|
};
|
|
|
|
|
if (game.data.arena.dead.length < 9 && game.data.arena.win < 12) {
|
|
|
|
|
event.arenafight = ui.create.control("开始战斗", "nozoom", function () {
|
|
|
|
|
if (_status.chessgiveup) return;
|
|
|
|
|
_status.mylist = [];
|
|
|
|
|
var list = [];
|
|
|
|
|
for (var i = 0; i < nodes.length; i++) {
|
|
|
|
|
if (nodes[i].classList.contains("selected")) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.mylist.push(nodes[i].name);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (!nodes[i].classList.contains("dead")) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.push(nodes[i].name);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.mylist.length == 0) {
|
|
|
|
|
_status.mylist = list.randomGets(3);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.mylist.length == 0) return;
|
|
|
|
|
for (var i = 0; i < _status.mylist.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.data.arena.dead.push(_status.mylist[i]);
|
|
|
|
|
}
|
|
|
|
|
game.saveData();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
switch (game.data.arena.win) {
|
|
|
|
|
case 0:
|
|
|
|
|
list = lib.rank.d.concat(lib.rank.c);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
list = lib.rank.c.concat(lib.rank.bm);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
list = lib.rank.bm.concat(lib.rank.b);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
list = lib.rank.b.concat(lib.rank.bp);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
list = lib.rank.bp.concat(lib.rank.am);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
list = lib.rank.am.concat(lib.rank.a);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
list = lib.rank.a.concat(lib.rank.ap);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
list = lib.rank.ap.concat(lib.rank.s);
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < _status.mylist.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.remove(_status.mylist[i]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.enemylist = list.randomGets(3);
|
|
|
|
|
for (var i = 0; i < nodes.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
nodes[i].delete();
|
|
|
|
|
}
|
|
|
|
|
victory.delete();
|
|
|
|
|
event.arenafight.close();
|
|
|
|
|
event.arenaback.close();
|
|
|
|
|
event.arenagiveup.close();
|
|
|
|
|
game.resume();
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.arenaback = ui.create.control("返回", "nozoom", function () {
|
|
|
|
|
if (_status.chessgiveup) return;
|
|
|
|
|
game.data._arena = game.data.arena;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete game.data.arena;
|
|
|
|
|
game.saveData();
|
|
|
|
|
game.reload();
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var giveup = function () {
|
|
|
|
|
if (confirm("放弃后剩余战斗将视为战败并结算奖励,是否确定放弃?")) {
|
|
|
|
|
_status.chessclicked = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.arenafight.close();
|
|
|
|
|
event.arenaback.close();
|
|
|
|
|
event.arenagiveup.close();
|
|
|
|
|
event.checkPrize();
|
|
|
|
|
}
|
|
|
|
|
// _status.chessclicked=true;
|
|
|
|
|
// _status.chessgiveup=true;
|
|
|
|
|
// event.arenafight.style.opacity=0.5;
|
|
|
|
|
// event.arenaback.style.opacity=0.5;
|
|
|
|
|
// this.replace('确认放弃',function(){
|
|
|
|
|
// _status.chessclicked=true;
|
|
|
|
|
// event.arenafight.close();
|
|
|
|
|
// event.arenaback.close();
|
|
|
|
|
// event.arenagiveup.close();
|
|
|
|
|
// event.checkPrize();
|
|
|
|
|
// });
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.arenagiveup = ui.create.control("放弃", "nozoom", giveup);
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.checkPrize();
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.custom.add.window = function () {
|
|
|
|
|
if (_status.chessclicked) {
|
|
|
|
|
_status.chessclicked = false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.kaibao) {
|
|
|
|
|
for (var i = 0; i < event.prize.length; i++) {
|
|
|
|
|
if (!event.prize[i].turned2) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.reload();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.chessgiveup = false;
|
|
|
|
|
event.arenafight.style.opacity = 1;
|
|
|
|
|
event.arenaback.style.opacity = 1;
|
|
|
|
|
event.arenagiveup.replace("放弃", giveup);
|
|
|
|
|
for (var i = 0; i < nodes.length; i++) {
|
|
|
|
|
nodes[i].style.transform = "scale(0.8)";
|
|
|
|
|
nodes[i].classList.remove("selected");
|
|
|
|
|
nodes[i].classList.remove("unselectable");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
lib.init.onfree();
|
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 7";
|
|
|
|
|
ui.control.style.top = "";
|
|
|
|
|
if (!get.is.safari()) {
|
|
|
|
|
ui.control.style.transition = "";
|
|
|
|
|
ui.control.style.display = "none";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.arena.classList.remove("leaderhide");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.wuxie.show();
|
|
|
|
|
ui.auto.show();
|
|
|
|
|
game.delay();
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
saveData: function () {
|
|
|
|
|
game.save(get.config("chess_leader_save"), game.data);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
getLeaderList: function () {
|
|
|
|
|
var list = lib.rank.all.slice(0);
|
|
|
|
|
for (var i = 0; i < game.data.character.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.remove(game.data.character[i]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!list.length) {
|
|
|
|
|
return ["chess_xingtian"];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return list.randomGets(6);
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
getLeaderCharacter: function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var pleg;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.data.legend <= 20) {
|
|
|
|
|
pleg = 0.01;
|
|
|
|
|
} else {
|
|
|
|
|
pleg = 0.01 + ((game.data.legend - 20) * (game.data.legend - 20) * 0.99) / 10000;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (Math.random() < pleg) {
|
|
|
|
|
game.data.legend = 0;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.saveData();
|
|
|
|
|
return lib.rank.rarity.legend.randomGet();
|
|
|
|
|
}
|
|
|
|
|
game.data.legend++;
|
|
|
|
|
game.saveData();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (Math.random() < 0.05) return lib.rank.rarity.epic.randomGet();
|
|
|
|
|
if (Math.random() < 0.3) return lib.rank.rarity.rare.randomGet();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return lib.rank.rarity.common.randomGet();
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
changeMoney: function (num) {
|
|
|
|
|
game.data.money += num;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.saveData();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.money.lastChild.innerHTML = game.data.money;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
changeDust: function (num) {
|
|
|
|
|
game.data.dust += num;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.saveData();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.money.childNodes[1].innerHTML = game.data.dust;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chooseCharacter: function () {
|
|
|
|
|
var next = game.createEvent("chooseCharacter");
|
|
|
|
|
next.showConfig = true;
|
|
|
|
|
next.ai = function (player, list) {
|
|
|
|
|
if (get.config("double_character")) {
|
|
|
|
|
player.init(list[0], list[1]);
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.init(list[0]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
|
|
|
|
next.setContent(function () {
|
|
|
|
|
"step 0";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.wuxie.hide();
|
|
|
|
|
var i;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var list = [];
|
|
|
|
|
var bosslist = [];
|
|
|
|
|
var jiangelist = [];
|
|
|
|
|
event.list = list;
|
|
|
|
|
for (i in lib.character) {
|
2024-04-23 13:26:29 +00:00
|
|
|
|
if (lib.character[i].isChessBoss) {
|
2024-04-15 18:46:41 +00:00
|
|
|
|
bosslist.push(i);
|
|
|
|
|
continue;
|
2024-04-23 13:26:29 +00:00
|
|
|
|
} else if (lib.character[i].isJiangeBoss) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// if(get.config('chess_jiange')) jiangelist.push(i);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (i.indexOf("treasure_") == 0) continue;
|
2024-04-23 13:26:29 +00:00
|
|
|
|
if (lib.character[i].isMinskin) continue;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (lib.config.forbidchess.includes(i)) continue;
|
|
|
|
|
if (lib.filter.characterDisabled(i)) continue;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.push(i);
|
|
|
|
|
}
|
|
|
|
|
list.randomSort();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var bosses = ui.create.div(".buttons");
|
|
|
|
|
event.bosses = bosses;
|
|
|
|
|
var bossbuttons = ui.create.buttons(bosslist, "character", bosses);
|
|
|
|
|
var addToButton = function () {
|
|
|
|
|
if (ui.cheat2 && ui.cheat2.backup) return;
|
|
|
|
|
_status.event.dialog.content.childNodes[1].innerHTML =
|
|
|
|
|
ui.selected.buttons.length + "/" + _status.event.selectButton();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var jiange = ui.create.div(".buttons");
|
|
|
|
|
event.jiange = jiange;
|
|
|
|
|
var jiangebuttons = ui.create.buttons(jiangelist, "character", jiange);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var clickedBoss = false;
|
|
|
|
|
var clickBoss = function () {
|
|
|
|
|
clickedBoss = true;
|
|
|
|
|
var num = bosses.querySelectorAll(".glow").length;
|
|
|
|
|
if (this.classList.contains("glow")) {
|
|
|
|
|
this.classList.remove("glow");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num--;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (num < 4) {
|
|
|
|
|
this.classList.add("glow");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < bosses.childElementCount; i++) {
|
|
|
|
|
if (num >= 4 && !bosses.childNodes[i].classList.contains("glow")) {
|
|
|
|
|
bosses.childNodes[i].classList.add("forbidden");
|
|
|
|
|
} else {
|
|
|
|
|
bosses.childNodes[i].classList.remove("forbidden");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num) {
|
|
|
|
|
if (!event.asboss) {
|
|
|
|
|
event.asboss = ui.create.control("应战", function () {
|
|
|
|
|
_status.boss = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.click.ok();
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (event.asboss) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.asboss.close();
|
|
|
|
|
delete event.asboss;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addToButton();
|
|
|
|
|
};
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var clickedJiange = false;
|
|
|
|
|
var clickJiange = function () {
|
|
|
|
|
clickedJiange = true;
|
|
|
|
|
if (this.classList.contains("glow2")) {
|
|
|
|
|
this.classList.remove("glow2");
|
|
|
|
|
} else {
|
|
|
|
|
this.classList.add("glow2");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
addToButton();
|
|
|
|
|
};
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < bossbuttons.length; i++) {
|
|
|
|
|
bossbuttons[i].classList.add("noclick");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
bossbuttons[i].listen(clickBoss);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < jiangebuttons.length; i++) {
|
|
|
|
|
jiangebuttons[i].classList.add("noclick");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
jiangebuttons[i].listen(clickJiange);
|
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (get.config("additional_player") == undefined)
|
|
|
|
|
game.saveConfig("additional_player", true, true);
|
|
|
|
|
if (get.config("reward") == undefined) game.saveConfig("reward", 3, true);
|
|
|
|
|
if (get.config("punish") == undefined) game.saveConfig("punish", "无", true);
|
|
|
|
|
if (get.config("battle_number") == undefined) game.saveConfig("battle_number", 3, true);
|
|
|
|
|
if (get.config("choice_number") == undefined) game.saveConfig("choice_number", 6, true);
|
|
|
|
|
if (get.config("seat_order") == undefined) game.saveConfig("seat_order", "交替", true);
|
|
|
|
|
if (get.config("replace_number") == undefined) game.saveConfig("replace_number", 0, true);
|
|
|
|
|
if (get.config("single_control") == undefined)
|
|
|
|
|
game.saveConfig("single_control", false, true);
|
|
|
|
|
if (get.config("first_less") == undefined) game.saveConfig("first_less", true, true);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var dialog = ui.create.dialog("选择出场角色", "hidden");
|
|
|
|
|
dialog.classList.add("fullwidth");
|
|
|
|
|
dialog.classList.add("fullheight");
|
|
|
|
|
dialog.classList.add("fixed");
|
|
|
|
|
dialog.add("0/0");
|
|
|
|
|
dialog.add([
|
|
|
|
|
list.slice(
|
|
|
|
|
0,
|
|
|
|
|
parseInt(get.config("battle_number")) * 4 +
|
|
|
|
|
parseInt(get.config("replace_number")) +
|
|
|
|
|
5
|
|
|
|
|
),
|
|
|
|
|
"character",
|
|
|
|
|
]);
|
|
|
|
|
if (bossbuttons.length) {
|
|
|
|
|
dialog.add("挑战魔王");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
dialog.add(bosses);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (jiangebuttons.length) {
|
|
|
|
|
dialog.add("守卫剑阁");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
dialog.add(jiange);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.addConfig = function (dialog) {
|
|
|
|
|
dialog.add("选项");
|
|
|
|
|
dialog.choice = {};
|
|
|
|
|
dialog.choice.zhu = dialog
|
|
|
|
|
.add(ui.create.switcher("zhu", get.config("zhu")))
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
dialog.choice.main_zhu = dialog
|
|
|
|
|
.add(ui.create.switcher("main_zhu", get.config("main_zhu")))
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
if (get.config("zhu")) {
|
|
|
|
|
dialog.choice.main_zhu.parentNode.classList.remove("disabled");
|
|
|
|
|
} else {
|
|
|
|
|
dialog.choice.main_zhu.parentNode.classList.add("disabled");
|
|
|
|
|
}
|
|
|
|
|
dialog.choice.noreplace_end = dialog
|
|
|
|
|
.add(ui.create.switcher("noreplace_end", get.config("noreplace_end")))
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
dialog.choice.additional_player = dialog
|
|
|
|
|
.add(ui.create.switcher("additional_player", get.config("additional_player")))
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
dialog.choice.single_control = dialog
|
|
|
|
|
.add(ui.create.switcher("single_control", get.config("single_control")))
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
dialog.choice.first_less = dialog
|
|
|
|
|
.add(ui.create.switcher("first_less", get.config("first_less")))
|
|
|
|
|
.querySelector(".toggle");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// dialog.attack_move=dialog.add(ui.create.switcher('attack_move',get.config('attack_move'))).querySelector('.toggle');
|
|
|
|
|
// this.dialog.versus_single_control=this.dialog.add(ui.create.switcher('versus_single_control',lib.storage.single_control)).querySelector('.toggle');
|
|
|
|
|
// this.dialog.versus_first_less=this.dialog.add(ui.create.switcher('versus_first_less',lib.storage.first_less)).querySelector('.toggle');
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dialog.choice.reward = dialog
|
|
|
|
|
.add(ui.create.switcher("reward", [0, 1, 2, 3, 4], get.config("reward")))
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
dialog.choice.punish = dialog
|
|
|
|
|
.add(ui.create.switcher("punish", ["弃牌", "无", "摸牌"], get.config("punish")))
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
dialog.choice.seat_order = dialog
|
|
|
|
|
.add(ui.create.switcher("seat_order", ["指定", "交替"], get.config("seat_order")))
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
dialog.choice.battle_number = dialog
|
|
|
|
|
.add(
|
|
|
|
|
ui.create.switcher(
|
|
|
|
|
"battle_number",
|
|
|
|
|
[1, 2, 3, 4, 6, 8],
|
|
|
|
|
get.config("battle_number")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
dialog.choice.replace_number = dialog
|
|
|
|
|
.add(
|
|
|
|
|
ui.create.switcher(
|
|
|
|
|
"replace_number",
|
|
|
|
|
[0, 1, 2, 3, 5, 7, 9, 17],
|
|
|
|
|
get.config("replace_number")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
dialog.choice.choice_number = dialog
|
|
|
|
|
.add(ui.create.switcher("choice_number", [3, 6, 9], get.config("choice_number")))
|
|
|
|
|
.querySelector(".toggle");
|
|
|
|
|
if (get.config("additional_player")) {
|
|
|
|
|
dialog.choice.noreplace_end.parentNode.classList.add("disabled");
|
|
|
|
|
dialog.choice.replace_number.parentNode.classList.add("disabled");
|
|
|
|
|
dialog.choice.choice_number.parentNode.classList.remove("disabled");
|
|
|
|
|
} else {
|
|
|
|
|
dialog.choice.noreplace_end.parentNode.classList.remove("disabled");
|
|
|
|
|
dialog.choice.replace_number.parentNode.classList.remove("disabled");
|
|
|
|
|
dialog.choice.choice_number.parentNode.classList.add("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
event.addConfig(dialog);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < bosses.childNodes.length; i++) {
|
|
|
|
|
bosses.childNodes[i].classList.add("squarebutton");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < jiange.childNodes.length; i++) {
|
|
|
|
|
jiange.childNodes[i].classList.add("squarebutton");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.control.style.transition = "all 0s";
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (get.is.phoneLayout()) {
|
|
|
|
|
ui.control.style.top = "calc(100% - 80px)";
|
|
|
|
|
} else {
|
|
|
|
|
ui.control.style.top = "calc(100% - 70px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var next = game.me.chooseButton(dialog, true).set("onfree", true);
|
|
|
|
|
next._triggered = null;
|
|
|
|
|
next.selectButton = function () {
|
|
|
|
|
var bossnum = bosses.querySelectorAll(".glow").length;
|
|
|
|
|
if (bossnum) {
|
|
|
|
|
return 3 * bossnum;
|
|
|
|
|
}
|
|
|
|
|
if (!get.config("single_control")) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (get.config("additional_player")) {
|
|
|
|
|
return parseInt(get.config("battle_number"));
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return parseInt(get.config("battle_number")) + parseInt(get.config("replace_number"));
|
2020-11-05 08:26:02 +00:00
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
next.custom.add.button = addToButton;
|
|
|
|
|
next.custom.add.window = function (clicked) {
|
|
|
|
|
if (clicked) return;
|
|
|
|
|
if (clickedBoss) {
|
|
|
|
|
clickedBoss = false;
|
|
|
|
|
} else {
|
|
|
|
|
for (var i = 0; i < bosses.childElementCount; i++) {
|
|
|
|
|
bosses.childNodes[i].classList.remove("forbidden");
|
|
|
|
|
bosses.childNodes[i].classList.remove("glow");
|
|
|
|
|
}
|
|
|
|
|
if (event.asboss) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.asboss.close();
|
|
|
|
|
delete event.asboss;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (clickedJiange) {
|
|
|
|
|
clickedJiange = false;
|
|
|
|
|
} else {
|
|
|
|
|
for (var i = 0; i < jiange.childElementCount; i++) {
|
|
|
|
|
jiange.childNodes[i].classList.remove("forbidden");
|
|
|
|
|
jiange.childNodes[i].classList.remove("glow2");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var dialog = _status.event.dialog;
|
|
|
|
|
if (dialog.choice) {
|
|
|
|
|
for (var i in dialog.choice) {
|
|
|
|
|
game.saveConfig(i, dialog.choice[i].link, true);
|
|
|
|
|
}
|
|
|
|
|
if (get.config("zhu")) {
|
|
|
|
|
dialog.choice.main_zhu.parentNode.classList.remove("disabled");
|
|
|
|
|
} else {
|
|
|
|
|
dialog.choice.main_zhu.parentNode.classList.add("disabled");
|
|
|
|
|
}
|
|
|
|
|
if (get.config("additional_player")) {
|
|
|
|
|
dialog.choice.noreplace_end.parentNode.classList.add("disabled");
|
|
|
|
|
dialog.choice.replace_number.parentNode.classList.add("disabled");
|
|
|
|
|
dialog.choice.choice_number.parentNode.classList.remove("disabled");
|
|
|
|
|
} else {
|
|
|
|
|
dialog.choice.noreplace_end.parentNode.classList.remove("disabled");
|
|
|
|
|
dialog.choice.replace_number.parentNode.classList.remove("disabled");
|
|
|
|
|
dialog.choice.choice_number.parentNode.classList.add("disabled");
|
|
|
|
|
}
|
|
|
|
|
var num =
|
|
|
|
|
parseInt(get.config("battle_number")) * 4 +
|
|
|
|
|
parseInt(get.config("replace_number")) +
|
|
|
|
|
5;
|
|
|
|
|
if (dialog.buttons.length > num) {
|
|
|
|
|
for (var i = num; i < dialog.buttons.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
dialog.buttons[i].remove();
|
|
|
|
|
}
|
|
|
|
|
dialog.buttons.splice(num);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (dialog.buttons.length < num) {
|
|
|
|
|
for (var i = dialog.buttons.length; i < num; i++) {
|
|
|
|
|
dialog.buttons.push(
|
|
|
|
|
ui.create
|
|
|
|
|
.button(list[i], "character", dialog.buttons[0].parentNode)
|
|
|
|
|
.addTempClass("zoom")
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.check();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addToButton();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
|
|
|
|
event.changeDialog = function () {
|
|
|
|
|
if (ui.cheat2 && ui.cheat2.dialog == _status.event.dialog) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (game.changeCoin) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.changeCoin(-3);
|
|
|
|
|
}
|
|
|
|
|
list.randomSort();
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
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.slice(
|
|
|
|
|
0,
|
|
|
|
|
parseInt(get.config("battle_number")) * 4 +
|
|
|
|
|
parseInt(get.config("replace_number")) +
|
|
|
|
|
5
|
|
|
|
|
),
|
|
|
|
|
"character",
|
|
|
|
|
buttons
|
|
|
|
|
);
|
|
|
|
|
_status.event.dialog.content.insertBefore(buttons, node);
|
|
|
|
|
buttons.addTempClass("start");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
node.remove();
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// _status.event.dialog.close();
|
|
|
|
|
// var dialog=ui.create.dialog('选择出场角色','hidden');
|
|
|
|
|
// _status.event.dialog=dialog;
|
|
|
|
|
// dialog.classList.add('fullwidth');
|
|
|
|
|
// dialog.classList.add('fullheight');
|
|
|
|
|
// dialog.classList.add('fixed');
|
|
|
|
|
// dialog.add('0/'+_status.event.selectButton());
|
|
|
|
|
// dialog.add([list.slice(0,parseInt(get.config('battle_number'))*4+parseInt(get.config('replace_number'))+5),'character']);
|
|
|
|
|
// if(bossbuttons.length){
|
|
|
|
|
// dialog.add('挑战魔王');
|
|
|
|
|
// dialog.add(bosses);
|
|
|
|
|
// }
|
|
|
|
|
// if(jiangebuttons.length){
|
|
|
|
|
// dialog.add('守卫剑阁');
|
|
|
|
|
// dialog.add(jiange);
|
|
|
|
|
// }
|
|
|
|
|
// event.addConfig(dialog);
|
|
|
|
|
// dialog.open();
|
|
|
|
|
game.uncheck();
|
|
|
|
|
game.check();
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.create.cheat = function () {
|
|
|
|
|
_status.createControl = ui.cheat2;
|
|
|
|
|
ui.cheat = ui.create.control("更换", event.changeDialog);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
delete _status.createControl;
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var createCharacterDialog = function () {
|
|
|
|
|
event.dialogxx = ui.create.characterDialog();
|
|
|
|
|
event.dialogxx.classList.add("fullwidth");
|
|
|
|
|
event.dialogxx.classList.add("fullheight");
|
|
|
|
|
event.dialogxx.classList.add("fixed");
|
|
|
|
|
if (ui.cheat2) {
|
|
|
|
|
ui.cheat2.addTempClass("controlpressdownx", 500);
|
|
|
|
|
ui.cheat2.classList.remove("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (lib.onfree) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
lib.onfree.push(createCharacterDialog);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
createCharacterDialog();
|
|
|
|
|
}
|
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) {
|
2024-04-20 05:23:28 +00:00
|
|
|
|
game.changeCoin(10);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
this.dialog.close();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.event.dialog = this.backup;
|
2020-11-05 08:26:02 +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");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (game.changeCoin) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.changeCoin(-10);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
this.backup = _status.event.dialog;
|
2020-11-05 08:26:02 +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;
|
2020-11-05 08:26:02 +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");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (lib.onfree) {
|
|
|
|
|
ui.cheat2.classList.add("disabled");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
|
|
|
|
if (!ui.cheat && get.config("change_choice")) ui.create.cheat();
|
|
|
|
|
if (!ui.cheat2 && get.config("free_choose")) ui.create.cheat2();
|
|
|
|
|
"step 1";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.wuxie.show();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (ui.cheat) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.cheat.close();
|
|
|
|
|
delete ui.cheat;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (ui.cheat2) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.cheat2.close();
|
|
|
|
|
delete ui.cheat2;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.asboss) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.asboss.close();
|
|
|
|
|
delete ui.asboss;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.control.style.top = "";
|
|
|
|
|
if (!get.is.safari()) {
|
|
|
|
|
ui.control.style.transition = "";
|
|
|
|
|
ui.control.style.display = "none";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var glows = event.bosses.querySelectorAll(".glow");
|
|
|
|
|
var glows2 = event.jiange.querySelectorAll(".glow2");
|
|
|
|
|
if (!glows.length && !glows2.length) {
|
|
|
|
|
if (!get.config("single_control")) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var addnum;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (get.config("additional_player")) {
|
|
|
|
|
addnum = parseInt(get.config("battle_number"));
|
|
|
|
|
} else {
|
|
|
|
|
addnum =
|
|
|
|
|
parseInt(get.config("battle_number")) +
|
|
|
|
|
parseInt(get.config("replace_number"));
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < addnum - 1; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
result.links.push(event.list.randomRemove());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < result.links.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.addRecentCharacter(result.links[i]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.mode == "combat") {
|
|
|
|
|
_status.mylist = result.links.slice(0, parseInt(get.config("battle_number")));
|
|
|
|
|
_status.replacelist = result.links.slice(parseInt(get.config("battle_number")));
|
|
|
|
|
} else {
|
|
|
|
|
_status.mylist = result.links.slice(0);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (ui.coin) {
|
|
|
|
|
_status.coinCoeff = get.coinCoeff(_status.mylist);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < result.links.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.list.remove(result.links[i]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (glows.length) {
|
|
|
|
|
_status.vsboss = true;
|
|
|
|
|
_status.enemylist = [];
|
|
|
|
|
for (var i = 0; i < glows.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.enemylist.push(glows[i].link);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.boss) {
|
|
|
|
|
var temp = _status.mylist;
|
|
|
|
|
_status.mylist = _status.enemylist;
|
|
|
|
|
_status.enemylist = temp;
|
|
|
|
|
for (var i = _status.enemylist.length; i < _status.mylist.length * 3; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.enemylist.push(event.list.randomRemove());
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (glows2.length) {
|
|
|
|
|
_status.vsboss = true;
|
|
|
|
|
_status.enemylist = [];
|
|
|
|
|
for (var i = 0; i < glows2.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
_status.enemylist.push(glows2[i].link);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.list.randomSort();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.enemylist = event.list.splice(0, _status.mylist.length);
|
|
|
|
|
if (_status.mode == "combat" && _status.replacelist) {
|
|
|
|
|
_status.enemyreplacelist = event.list.splice(0, _status.replacelist.length);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (_status.mode == "combat" && get.config("additional_player")) {
|
|
|
|
|
_status.additionallist = event.list;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
modeSwapPlayer: function (player) {
|
|
|
|
|
var content = [game.me.dataset.position, player.dataset.position];
|
|
|
|
|
game.me.classList.remove("current_action");
|
|
|
|
|
player.classList.add("current_action");
|
|
|
|
|
game.addVideo("chessSwap", null, content);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.swapControl(player);
|
|
|
|
|
player.chessFocus();
|
|
|
|
|
ui.create.fakeme();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
skill: {
|
|
|
|
|
_tempobstacle: {
|
|
|
|
|
trigger: { player: "phaseAfter" },
|
|
|
|
|
silent: true,
|
|
|
|
|
content: function () {
|
|
|
|
|
var list = game.obstacles.slice(0);
|
|
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
|
|
if (typeof list[i].tempObstacle == "number") {
|
|
|
|
|
if (--list[i].tempObstacle == 0) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.removeObstacle(list[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_attackmove: {
|
|
|
|
|
trigger: { player: "damage" },
|
|
|
|
|
silent: true,
|
|
|
|
|
priority: 50,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
if (!event.source) return false;
|
|
|
|
|
if (get.distance(event.source, player, "pure") > 2) return false;
|
|
|
|
|
var xy1 = event.source.getXY();
|
|
|
|
|
var xy2 = player.getXY();
|
|
|
|
|
var dx = xy2[0] - xy1[0];
|
|
|
|
|
var dy = xy2[1] - xy1[1];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// if(dx*dy!=0) return false;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (dx == 0 && Math.abs(dy) == 2) {
|
|
|
|
|
dy /= 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (dy == 0 && Math.abs(dx) == 2) {
|
|
|
|
|
dx /= 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return player.movable(dx, dy);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
var xy1 = trigger.source.getXY();
|
|
|
|
|
var xy2 = player.getXY();
|
|
|
|
|
var dx = xy2[0] - xy1[0];
|
|
|
|
|
var dy = xy2[1] - xy1[1];
|
|
|
|
|
if (dx == 0 && Math.abs(dy) == 2) {
|
|
|
|
|
dy /= 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (dy == 0 && Math.abs(dx) == 2) {
|
|
|
|
|
dx /= 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player.movable(dx, dy)) {
|
|
|
|
|
player.move(dx, dy);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dubiaoxianjing: {
|
|
|
|
|
global: "dubiaoxianjing2",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dubiaoxianjing2: {
|
|
|
|
|
trigger: { player: "phaseAfter" },
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
if (player.hp <= 1) return false;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_dubiaoxianjing") {
|
|
|
|
|
return get.chessDistance(game.treasures[i], player) <= 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var source = null;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_dubiaoxianjing") {
|
|
|
|
|
source = game.treasures[i];
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (source) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.chessFocus();
|
|
|
|
|
source.playerfocus(1000);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
source.line(player, "thunder");
|
|
|
|
|
if (lib.config.animation && !lib.config.low_performance) {
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.$epic2();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 300);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.delay(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
game.log("毒镖陷阱发动");
|
|
|
|
|
player.damage("nosource");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.draw(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
jiqishi: {
|
|
|
|
|
global: "jiqishi2",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
jiqishi2: {
|
|
|
|
|
trigger: { player: "phaseAfter" },
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
if (player.hp == player.maxHp) return false;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_jiqishi") {
|
|
|
|
|
return get.chessDistance(game.treasures[i], player) <= 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var source = null;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_jiqishi") {
|
|
|
|
|
source = game.treasures[i];
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (source) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.chessFocus();
|
|
|
|
|
source.playerfocus(1000);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
source.line(player, "thunder");
|
|
|
|
|
if (lib.config.animation && !lib.config.low_performance) {
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.$epic2();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 300);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.delay(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
game.log("集气石发动");
|
|
|
|
|
player.recover("nosource");
|
|
|
|
|
var he = player.getCards("he");
|
|
|
|
|
if (he.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.discard(he.randomGets(2));
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
wuyashenxiang: {
|
|
|
|
|
global: "wuyashenxiang2",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
wuyashenxiang2: {
|
|
|
|
|
trigger: { player: "phaseAfter" },
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
if (player.hp > 1) return false;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_wuyashenxiang") {
|
|
|
|
|
return get.chessDistance(game.treasures[i], player) <= 3;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var source = null;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_wuyashenxiang") {
|
|
|
|
|
source = game.treasures[i];
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (source) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.chessFocus();
|
|
|
|
|
source.playerfocus(1000);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
source.line(player, "thunder");
|
|
|
|
|
if (lib.config.animation && !lib.config.low_performance) {
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.$epic2();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 300);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.delay(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
game.log("乌鸦神像发动");
|
|
|
|
|
player.recover("nosource");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// player.draw();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var card = get.cardPile(function (c) {
|
|
|
|
|
return get.type(c) == "delay";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (card) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.addJudge(card);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
shenpanxianjing: {
|
|
|
|
|
global: "shenpanxianjing2",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
shenpanxianjing2: {
|
|
|
|
|
trigger: { player: "phaseAfter" },
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
var nh = player.countCards("h");
|
|
|
|
|
if (!nh) return false;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_shenpanxianjing") {
|
|
|
|
|
for (var j = 0; j < game.players.length; j++) {
|
|
|
|
|
if (game.players[j].countCards("h") > nh) return false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var source = null;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_shenpanxianjing") {
|
|
|
|
|
source = game.treasures[i];
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (source) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.chessFocus();
|
|
|
|
|
source.playerfocus(1000);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
source.line(player, "thunder");
|
|
|
|
|
if (lib.config.animation && !lib.config.low_performance) {
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.$epic2();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 300);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.delay(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
game.log("审判之刃发动");
|
|
|
|
|
var hs = player.getCards("h");
|
|
|
|
|
if (hs.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.discard(hs.randomGet());
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
shiyuansu: {
|
|
|
|
|
global: "shiyuansu2",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
shiyuansu2: {
|
|
|
|
|
trigger: { player: "damageAfter" },
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
if (event.num < 2) return false;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_shiyuansu") {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.delayx();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
var source = null;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_shiyuansu") {
|
|
|
|
|
source = game.treasures[i];
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (source) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.chessFocus();
|
|
|
|
|
source.playerfocus(1000);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
source.line(player, "thunder");
|
|
|
|
|
if (lib.config.animation && !lib.config.low_performance) {
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.$epic2();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 300);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.delay(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 2";
|
|
|
|
|
game.log("石元素像发动");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.changeHujia();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
shenmidiaoxiang: {
|
|
|
|
|
global: "shenmidiaoxiang2",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
shenmidiaoxiang2: {
|
|
|
|
|
trigger: { player: "phaseAfter" },
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_shenmidiaoxiang") {
|
|
|
|
|
return (
|
|
|
|
|
player.canMoveTowards(game.treasures[i]) &&
|
|
|
|
|
get.chessDistance(game.treasures[i], player) > 3
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var source = null;
|
|
|
|
|
for (var i = 0; i < game.treasures.length; i++) {
|
|
|
|
|
if (game.treasures[i].name == "treasure_shenmidiaoxiang") {
|
|
|
|
|
source = game.treasures[i];
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (source) {
|
|
|
|
|
event.source = source;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.chessFocus();
|
|
|
|
|
source.playerfocus(1000);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
source.line(player, "thunder");
|
|
|
|
|
if (lib.config.animation && !lib.config.low_performance) {
|
|
|
|
|
setTimeout(function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
source.$epic2();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
}, 300);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.delay(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
game.log("神秘雕像发动");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.moveTowards(event.source);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
arenaAdd: {
|
|
|
|
|
enable: "phaseUse",
|
|
|
|
|
usable: 1,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return (
|
|
|
|
|
_status.enterArena &&
|
|
|
|
|
player.side == game.me.side &&
|
|
|
|
|
game.data.arena.arenachoice.length > game.data.arena.dead.length
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
direct: true,
|
|
|
|
|
delay: 0,
|
|
|
|
|
preservecancel: true,
|
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var list = game.data.arena.arenachoice.slice(0);
|
|
|
|
|
for (var i = 0; i < game.data.arena.dead.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.remove(game.data.arena.dead[i]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.dialog = ui.create.dialog("选择一个出场武将", [list, "character"]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.imchoosing = true;
|
|
|
|
|
event.custom.replace.button = function (button) {
|
|
|
|
|
event.choice = button.link;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
|
|
|
|
event.custom.replace.confirm = game.resume;
|
|
|
|
|
event.switchToAuto = game.resume;
|
|
|
|
|
"step 1";
|
|
|
|
|
if (ui.confirm) {
|
|
|
|
|
ui.confirm.classList.add("removing");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.imchoosing = false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.dialog.close();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.choice) {
|
|
|
|
|
var name = event.choice;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.addChessPlayer(name);
|
|
|
|
|
game.data.arena.dead.push(name);
|
|
|
|
|
game.saveData();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!_status.arenaAdd) {
|
|
|
|
|
_status.arenaAdd = [];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
_status.arenaAdd.push(name);
|
|
|
|
|
game.delay();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
player.getStat("skill").arenaAdd--;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_zhaoxiang: {
|
|
|
|
|
unique: true,
|
|
|
|
|
enable: "phaseUse",
|
|
|
|
|
usable: 1,
|
|
|
|
|
promptfunc: function (event, player) {
|
|
|
|
|
var targets = [];
|
|
|
|
|
var skill = lib.skill.leader_zhaoxiang;
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (
|
|
|
|
|
!game.data.character.includes(game.players[i].name) &&
|
|
|
|
|
game.players[i].side != player.side
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
targets.push(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var str = lib.translate.leader_zhaoxiang_info;
|
|
|
|
|
if (targets.length) {
|
|
|
|
|
str =
|
|
|
|
|
'<p style="text-align:center;line-height:20px;margin-top:0">⚑ ' +
|
|
|
|
|
game.data.dust +
|
|
|
|
|
'</p><p style="text-align:center;line-height:20px;margin-top:8px">';
|
|
|
|
|
for (var i = 0; i < targets.length; i++) {
|
|
|
|
|
str +=
|
|
|
|
|
'<span style="width:120px;display:inline-block;text-align:right">' +
|
|
|
|
|
get.translation(targets[i]) +
|
|
|
|
|
':</span><span style="width:120px;display:inline-block;text-align:left">' +
|
|
|
|
|
(skill.chance(targets[i], player) * 100).toFixed(2) +
|
|
|
|
|
"%</span><br>";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
str += "</p>";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chance: function (target, player) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var chance;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var renyi = player.hasSkill("leader_renyi");
|
|
|
|
|
switch (target.hp) {
|
|
|
|
|
case 1:
|
|
|
|
|
chance = 0.7;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
chance = 0.4;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
chance = 0.2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (target.countCards("he")) {
|
|
|
|
|
case 0:
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
chance /= 1.2;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
chance /= 1.4;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
chance /= 1.7;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
chance /= 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (game.getRarity(target.name)) {
|
|
|
|
|
case "common": {
|
|
|
|
|
if (renyi) chance *= 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "rare": {
|
|
|
|
|
chance /= 2;
|
|
|
|
|
if (renyi) chance *= 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "epic": {
|
|
|
|
|
chance /= 5;
|
|
|
|
|
if (renyi) chance *= 1.5;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
case "legend": {
|
|
|
|
|
chance /= 15;
|
|
|
|
|
if (renyi) chance *= 1.2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return Math.min(1, chance);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
filter: function () {
|
|
|
|
|
return game.data.dust >= 10;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
filterTarget: function (card, player, target) {
|
|
|
|
|
return (
|
|
|
|
|
game.isChessNeighbour(player, target) && !game.data.character.includes(target.name)
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
var chance = lib.skill.leader_zhaoxiang.chance(target, player);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.changeDust(-10);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (Math.random() < chance) {
|
|
|
|
|
_status.zhaoxiang = target.name;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.data.character.add(target.name);
|
|
|
|
|
game.saveData();
|
|
|
|
|
game.over();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
game.log("招降", target, "失败");
|
|
|
|
|
player.popup("招降失败");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.damage(target);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_xiaoxiong: {
|
|
|
|
|
unique: true,
|
|
|
|
|
forced: true,
|
|
|
|
|
trigger: { source: "damageSource" },
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return event.num > 0;
|
|
|
|
|
},
|
|
|
|
|
content: function () {
|
|
|
|
|
switch (_status.difficulty) {
|
|
|
|
|
case "leader_easy":
|
|
|
|
|
game.reward += 2 * trigger.num;
|
|
|
|
|
break;
|
|
|
|
|
case "leader_medium":
|
|
|
|
|
game.reward += 4 * trigger.num;
|
|
|
|
|
break;
|
|
|
|
|
case "leader_hard":
|
|
|
|
|
game.reward += 6 * trigger.num;
|
|
|
|
|
break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_renyi: {
|
|
|
|
|
unique: true,
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_mouduan: {
|
|
|
|
|
unique: true,
|
|
|
|
|
global: "leader_mouduan2",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_mouduan2: {
|
|
|
|
|
mod: {
|
|
|
|
|
chessMove: function (player, current) {
|
|
|
|
|
if (player.side && player.name != _status.lord) return current + 1;
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_zhenlve: {
|
|
|
|
|
trigger: { global: "useCard1" },
|
|
|
|
|
unique: true,
|
|
|
|
|
charlotte: true,
|
|
|
|
|
firstDo: true,
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return get.type(event.card) == "trick" && event.player.isFriendOf(player);
|
|
|
|
|
},
|
|
|
|
|
content: function () {
|
|
|
|
|
trigger.nowuxie = true;
|
2020-11-24 14:08:57 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
tongshuai: {
|
|
|
|
|
unique: true,
|
|
|
|
|
forbid: ["guozhan"],
|
|
|
|
|
init: function (player) {
|
|
|
|
|
player.storage.tongshuai = {
|
|
|
|
|
list: [],
|
|
|
|
|
owned: {},
|
|
|
|
|
player: player,
|
|
|
|
|
get: function (num) {
|
|
|
|
|
if (typeof num != "number") num = 1;
|
|
|
|
|
var player = this.player;
|
|
|
|
|
while (num--) {
|
|
|
|
|
var name = player.storage.tongshuai.unowned.shift();
|
|
|
|
|
if (!name) return;
|
|
|
|
|
var skills = lib.character[name][3].slice(0);
|
|
|
|
|
for (var i = 0; i < skills.length; i++) {
|
|
|
|
|
var info = lib.skill[skills[i]];
|
|
|
|
|
if (info.unique && !info.gainable) {
|
|
|
|
|
skills.splice(i--, 1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player.storage.tongshuai.owned[name] = skills;
|
|
|
|
|
game.addVideo("chess_tongshuai", player, player.storage.tongshuai.owned);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
|
|
|
|
};
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
group: ["tongshuai1", "tongshuai2", "tongshuai3"],
|
|
|
|
|
intro: {
|
|
|
|
|
content: function (storage, player) {
|
|
|
|
|
var str = "";
|
|
|
|
|
var slist = storage.owned;
|
|
|
|
|
var list = [];
|
|
|
|
|
for (var i in slist) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.push(i);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (list.length) {
|
|
|
|
|
str += get.translation(list[0]);
|
|
|
|
|
for (var i = 1; i < list.length; i++) {
|
|
|
|
|
str += "、" + get.translation(list[i]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var skill = player.additionalSkills.tongshuai[0];
|
|
|
|
|
if (skill) {
|
|
|
|
|
str += "<p>当前技能:" + get.translation(skill);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
mark: function (dialog, content, player) {
|
|
|
|
|
var slist = content.owned;
|
|
|
|
|
var list = [];
|
|
|
|
|
for (var i in slist) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.push(i);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (list.length) {
|
|
|
|
|
dialog.addSmall([list, "character"]);
|
|
|
|
|
}
|
|
|
|
|
var skill = player.additionalSkills.tongshuai[0];
|
|
|
|
|
if (skill) {
|
|
|
|
|
dialog.add(
|
|
|
|
|
'<div><div class="skill">【' +
|
|
|
|
|
get.translation(skill) +
|
|
|
|
|
"】</div><div>" +
|
|
|
|
|
lib.translate[skill + "_info"] +
|
|
|
|
|
"</div></div>"
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
|
|
|
|
// mark:true
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
tongshuai1: {
|
|
|
|
|
trigger: { global: "gameStart" },
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
priority: 10,
|
|
|
|
|
content: function () {
|
|
|
|
|
for (var i = 0; i < game.data.character.length; i++) {
|
|
|
|
|
var skills = lib.character[game.data.character[i]][3];
|
|
|
|
|
var add = false;
|
|
|
|
|
for (var j = 0; j < skills.length; j++) {
|
|
|
|
|
var info = lib.skill[skills[j]];
|
|
|
|
|
if (info.gainable || !info.unique) {
|
|
|
|
|
add = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (add) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.storage.tongshuai.list.push(game.data.character[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.storage.tongshuai.list.remove([game.players[i].name]);
|
|
|
|
|
player.storage.tongshuai.list.remove([game.players[i].name1]);
|
|
|
|
|
player.storage.tongshuai.list.remove([game.players[i].name2]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player.storage.tongshuai.unowned = player.storage.tongshuai.list.slice(0);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.storage.tongshuai.unowned.sort(lib.sort.random);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player.storage.tongshuai.unowned.length > 1) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.storage.tongshuai.get(2);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (player.storage.tongshuai.unowned.length == 1) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.storage.tongshuai.get();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
player.removeSkill("tongshuai");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
tongshuai2: {
|
|
|
|
|
audio: 2,
|
|
|
|
|
trigger: { player: ["phaseBegin", "phaseEnd"], global: "gameStart" },
|
|
|
|
|
filter: function (event, player, name) {
|
|
|
|
|
if (!player.hasSkill("tongshuai")) return false;
|
|
|
|
|
if (name == "phaseBegin" && game.phaseNumber == 1) return false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return true;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
priority: -9,
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
content: function () {
|
|
|
|
|
var slist = player.storage.tongshuai.owned;
|
|
|
|
|
var list = [];
|
|
|
|
|
for (var i in slist) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
list.push(i);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.isMine()) {
|
|
|
|
|
event.dialog = ui.create.dialog("选择获得一项技能", [list, "character"]);
|
|
|
|
|
if (trigger.name == "game") {
|
|
|
|
|
event.control = ui.create.control();
|
|
|
|
|
} else {
|
|
|
|
|
event.control = ui.create.control(["cancel"]);
|
|
|
|
|
}
|
|
|
|
|
event.clickControl = function (link) {
|
|
|
|
|
if (link != "cancel") {
|
|
|
|
|
var currentname = event.dialog.querySelector(".selected.button").link;
|
|
|
|
|
var mark = player.marks.tongshuai;
|
|
|
|
|
if (!mark) {
|
|
|
|
|
player.markSkill("tongshuai");
|
|
|
|
|
mark = player.marks.tongshuai;
|
|
|
|
|
if (mark.firstChild) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
mark.firstChild.remove();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
mark.setBackground(currentname, "character");
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player.addAdditionalSkill("tongshuai", link);
|
|
|
|
|
game.addVideo("chess_tongshuai_skill", player, [currentname, link]);
|
|
|
|
|
player.logSkill("tongshuai2");
|
|
|
|
|
game.log(player, "获得技能", "【" + get.translation(link) + "】");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.popup(link);
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < event.dialog.buttons.length; i++) {
|
|
|
|
|
if (event.dialog.buttons[i].classList.contains("selected")) {
|
|
|
|
|
var name = event.dialog.buttons[i].link;
|
|
|
|
|
player.sex = lib.character[name][0];
|
|
|
|
|
player.group = lib.character[name][1];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// player.node.identity.style.backgroundColor=get.translation(player.group+'Color');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ui.auto.show();
|
|
|
|
|
event.dialog.close();
|
|
|
|
|
event.control.close();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.imchoosing = false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
|
|
|
|
};
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.control.custom = event.clickControl;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.auto.hide();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.imchoosing = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < event.dialog.buttons.length; i++) {
|
|
|
|
|
event.dialog.buttons[i].classList.add("selectable");
|
|
|
|
|
}
|
|
|
|
|
event.custom.replace.button = function (button) {
|
|
|
|
|
if (button.classList.contains("selected")) {
|
|
|
|
|
button.classList.remove("selected");
|
|
|
|
|
if (trigger.name == "game") {
|
|
|
|
|
event.control.style.opacity = 0;
|
|
|
|
|
} else {
|
|
|
|
|
event.control.replace(["cancel"]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
for (var i = 0; i < event.dialog.buttons.length; i++) {
|
|
|
|
|
event.dialog.buttons[i].classList.remove("selected");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
button.classList.add("selected");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.control.replace(slist[button.link]);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (trigger.name == "game" && getComputedStyle(event.control).opacity == 0) {
|
|
|
|
|
event.control.style.transition = "opacity 0.5s";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.refresh(event.control);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.control.style.opacity = 1;
|
|
|
|
|
event.control.style.transition = "";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.refresh(event.control);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
event.control.style.opacity = 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.control.custom = event.clickControl;
|
|
|
|
|
};
|
|
|
|
|
event.custom.replace.window = function () {
|
|
|
|
|
for (var i = 0; i < event.dialog.buttons.length; i++) {
|
|
|
|
|
if (event.dialog.buttons[i].classList.contains("selected")) {
|
|
|
|
|
event.dialog.buttons[i].classList.remove("selected");
|
|
|
|
|
if (trigger.name == "game") {
|
|
|
|
|
event.control.style.opacity = 0;
|
|
|
|
|
} else {
|
|
|
|
|
event.control.replace(["cancel"]);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.control.custom = event.clickControl;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
};
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
tongshuai3: {
|
|
|
|
|
unique: true,
|
|
|
|
|
trigger: { player: "phaseBegin" },
|
|
|
|
|
forced: true,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return (
|
|
|
|
|
player.storage.tongshuai &&
|
|
|
|
|
player.storage.tongshuai.unowned &&
|
|
|
|
|
player.storage.tongshuai.unowned.length > 0
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
content: function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.storage.tongshuai.get();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
cangming: {
|
|
|
|
|
enable: "phaseUse",
|
|
|
|
|
usable: 1,
|
|
|
|
|
unique: true,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
if (player.isTurnedOver()) return false;
|
|
|
|
|
var suits = [];
|
|
|
|
|
var hs = player.getCards("h");
|
|
|
|
|
for (var i = 0; i < hs.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
suits.add(get.suit(hs[i]));
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (suits.length >= 4) return true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
filterCard: function (card) {
|
|
|
|
|
var suit = get.suit(card);
|
|
|
|
|
for (var i = 0; i < ui.selected.cards.length; i++) {
|
|
|
|
|
if (suit == get.suit(ui.selected.cards[i])) return false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
complexCard: true,
|
|
|
|
|
selectCard: 4,
|
|
|
|
|
check: function (card) {
|
|
|
|
|
return 10 - get.value(card);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
filterTarget: function (card, player, target) {
|
|
|
|
|
return player != target;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
selectTarget: -1,
|
|
|
|
|
content: function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
target.goMad();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!player.isTurnedOver()) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.turnOver();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player.addSkill("cangming2");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ai: {
|
|
|
|
|
order: 10,
|
|
|
|
|
effect: {
|
|
|
|
|
player: function (card, player) {
|
|
|
|
|
var num = 0;
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (get.attitude(player, game.players[i]) < 0) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num > 1) break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num <= 1) return;
|
|
|
|
|
if (
|
|
|
|
|
_status.currentPhase == player &&
|
|
|
|
|
player.countCards("h") < player.hp &&
|
|
|
|
|
player.hp >= 6
|
|
|
|
|
) {
|
|
|
|
|
if (typeof card == "string") return;
|
|
|
|
|
if (card.name == "wuzhong") return;
|
|
|
|
|
if (card.name == "shunshou") return;
|
|
|
|
|
if (card.name == "yuanjiao") return;
|
|
|
|
|
if (card.name == "yiyi") return;
|
|
|
|
|
if (!player.hasSkill("cangming2")) return "zeroplayertarget";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
result: {
|
|
|
|
|
target: function (player) {
|
|
|
|
|
var num = 0;
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (get.attitude(player, game.players[i]) < 0) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num > 1) break;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num <= 1) return 0;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return -10;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
cangming2: {
|
|
|
|
|
trigger: { player: "phaseZhunbeiBegin" },
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
content: function () {
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.players[i].unMad();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player.removeSkill("cangming2");
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
boss_moyan: {
|
|
|
|
|
trigger: { player: "phaseEnd" },
|
|
|
|
|
forced: true,
|
|
|
|
|
unique: true,
|
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
event.players = get.players(player);
|
|
|
|
|
"step 1";
|
|
|
|
|
if (event.players.length) {
|
|
|
|
|
event.players.shift().damage("fire");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.redo();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
boss_stonebaolin: {
|
|
|
|
|
inherit: "juece",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
boss_stoneqiangzheng: {
|
|
|
|
|
trigger: { player: "phaseJieshuBegin" },
|
|
|
|
|
forced: true,
|
|
|
|
|
unique: true,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i] != player && game.players[i].countCards("h")) return true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var players = get.players(player);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
players.remove(player);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.players = players;
|
|
|
|
|
player.line(players, "green");
|
|
|
|
|
"step 1";
|
|
|
|
|
if (event.players.length) {
|
|
|
|
|
var current = event.players.shift();
|
|
|
|
|
var hs = current.getCards("h");
|
|
|
|
|
if (hs.length) {
|
|
|
|
|
var card = hs.randomGet();
|
|
|
|
|
player.gain(card, current);
|
|
|
|
|
current.$giveAuto(card, player);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
event.redo();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
guanchuan: {
|
|
|
|
|
trigger: { player: "useCardToPlayer" },
|
|
|
|
|
getTargets: function (player, target) {
|
|
|
|
|
var targets = [];
|
|
|
|
|
var pxy = player.getXY();
|
|
|
|
|
var txy = target.getXY();
|
|
|
|
|
var dx = txy[0] - pxy[0];
|
|
|
|
|
var dy = txy[1] - pxy[1];
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (game.players[i] != player && game.players[i] != target) {
|
|
|
|
|
var axy = game.players[i].getXY();
|
|
|
|
|
var dx2 = axy[0] - pxy[0];
|
|
|
|
|
var dy2 = axy[1] - pxy[1];
|
|
|
|
|
if (dx * dx2 < 0) continue;
|
|
|
|
|
if (dy * dy2 < 0) continue;
|
|
|
|
|
if (dx == 0) {
|
|
|
|
|
if (dx2 == 0) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
targets.push(game.players[i]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (dx2 != 0) {
|
|
|
|
|
if (dy2 / dx2 == dy / dx) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
targets.push(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return targets;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
if (event.targets.length != 1 || event.card.name != "sha") return false;
|
|
|
|
|
return lib.skill.guanchuan.getTargets(player, event.targets[0]).length > 0;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
check: function (event, player) {
|
|
|
|
|
var targets = lib.skill.guanchuan.getTargets(player, event.targets[0]);
|
|
|
|
|
var eff = 0;
|
|
|
|
|
for (var i = 0; i < targets.length; i++) {
|
|
|
|
|
eff += get.effect(targets[i], event.card, player, player);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return eff > 0;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
var targets = lib.skill.guanchuan.getTargets(player, trigger.targets[0]);
|
|
|
|
|
for (var i = 0; i < targets.length; i++) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
trigger.targets.push(targets[i]);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player.logSkill("guanchuan", targets);
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
sanjiansheji: {
|
|
|
|
|
enable: "phaseUse",
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return (
|
|
|
|
|
player.countCards("h", "sha") > 1 && lib.filter.filterCard({ name: "sha" }, player)
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
filterCard: { name: "sha" },
|
|
|
|
|
selectCard: 2,
|
|
|
|
|
check: function (card) {
|
|
|
|
|
var num = 0;
|
|
|
|
|
var player = _status.event.player;
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (
|
|
|
|
|
lib.filter.targetEnabled({ name: "sha" }, player, game.players[i]) &&
|
|
|
|
|
get.effect(game.players[i], { name: "sha" }, player) > 0
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num > 1) return 8 - get.value(card);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
selectTarget: [1, Infinity],
|
|
|
|
|
discard: false,
|
|
|
|
|
prepare: "throw",
|
|
|
|
|
filterTarget: function (card, player, target) {
|
|
|
|
|
return (
|
|
|
|
|
lib.filter.targetEnabled({ name: "sha" }, player, target) &&
|
|
|
|
|
get.distance(player, target, "pure") <= 5
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
targets.sort(lib.sort.seat);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player.useCard({ name: "sha" }, cards, targets, "luanjian").animate = false;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
multitarget: true,
|
|
|
|
|
ai: {
|
|
|
|
|
order: function () {
|
|
|
|
|
return get.order({ name: "sha" }) + 0.1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
result: {
|
|
|
|
|
target: function (player, target) {
|
|
|
|
|
return get.effect(target, { name: "sha" }, player, target);
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
effect: {
|
|
|
|
|
player: function (card, player) {
|
|
|
|
|
if (_status.currentPhase != player) return;
|
|
|
|
|
if (
|
|
|
|
|
card.name == "sha" &&
|
|
|
|
|
player.countCards("h", "sha") < 2 &&
|
|
|
|
|
player.countCards("h") <= player.hp
|
|
|
|
|
) {
|
|
|
|
|
var num = 0;
|
|
|
|
|
var player = _status.event.player;
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (
|
|
|
|
|
lib.filter.targetEnabled({ name: "sha" }, player, game.players[i]) &&
|
|
|
|
|
get.attitude(player, game.players[i]) < 0
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num > 1) return "zeroplayertarget";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
zhiming: {
|
|
|
|
|
trigger: { source: "damageBegin1" },
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return (
|
|
|
|
|
get.distance(event.player, player, "attack") > 1 &&
|
|
|
|
|
event.card &&
|
|
|
|
|
event.card.name == "sha"
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
forced: true,
|
|
|
|
|
content: function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
trigger.num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
lianshe: {
|
|
|
|
|
mod: {
|
|
|
|
|
cardUsable: function (card, player, num) {
|
|
|
|
|
if (card.name == "sha") {
|
|
|
|
|
return (
|
|
|
|
|
num +
|
|
|
|
|
player.getHistory("useCard", function (evt) {
|
|
|
|
|
return evt.card.name != "sha";
|
|
|
|
|
}).length
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
trigger: { player: "useCard" },
|
|
|
|
|
frequent: true,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return (
|
|
|
|
|
event.card &&
|
|
|
|
|
event.card.name == "sha" &&
|
|
|
|
|
player.getHistory("useCard", function (evt) {
|
|
|
|
|
return evt.card.name == "sha";
|
|
|
|
|
})[0] == event
|
|
|
|
|
);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.draw();
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ai: {
|
|
|
|
|
threaten: 1.5,
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
pianyi: {
|
|
|
|
|
direct: true,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return !player.getStat("damage");
|
|
|
|
|
},
|
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
player.chooseToMoveChess(2, get.prompt("pianyi"));
|
|
|
|
|
"step 1";
|
|
|
|
|
if (result.bool) {
|
|
|
|
|
player.logSkill("pianyi");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
lingdong: {
|
|
|
|
|
trigger: { player: "phaseJieshuBegin" },
|
|
|
|
|
direct: true,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return (
|
|
|
|
|
player.getHistory("useCard", function (evt) {
|
|
|
|
|
return evt.card.name == "sha";
|
|
|
|
|
}).length > 0
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
player.chooseToMoveChess(
|
|
|
|
|
player.getHistory("useCard", function (evt) {
|
|
|
|
|
return evt.card.name == "sha";
|
|
|
|
|
}).length,
|
|
|
|
|
get.prompt("lingdong")
|
|
|
|
|
);
|
|
|
|
|
"step 1";
|
|
|
|
|
if (result.bool) {
|
|
|
|
|
player.logSkill("lingdong");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_noactpunish: {
|
|
|
|
|
trigger: { player: "useCard" },
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return (
|
|
|
|
|
_status.currentPhase == player &&
|
|
|
|
|
event.targets &&
|
|
|
|
|
(event.targets.length > 1 || event.targets[0] != player)
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
content: function () {
|
|
|
|
|
player.addTempSkill("noactpunish");
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
noactpunish: {},
|
|
|
|
|
_chess_chuzhang: {
|
|
|
|
|
enable: "phaseUse",
|
|
|
|
|
usable: 1,
|
|
|
|
|
direct: true,
|
|
|
|
|
delay: false,
|
|
|
|
|
preservecancel: true,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
var num = 0;
|
|
|
|
|
var xy = player.getXY();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var neighbour;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(-1, 0);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
typeof neighbour.tempObstacle != "number" &&
|
|
|
|
|
game.obstacles.includes(neighbour)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (xy[0] == 0) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(1, 0);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
typeof neighbour.tempObstacle != "number" &&
|
|
|
|
|
game.obstacles.includes(neighbour)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (xy[0] + 1 >= ui.chesswidth) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, -1);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
typeof neighbour.tempObstacle != "number" &&
|
|
|
|
|
game.obstacles.includes(neighbour)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (xy[1] == 0) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, 1);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
typeof neighbour.tempObstacle != "number" &&
|
|
|
|
|
game.obstacles.includes(neighbour)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (xy[1] + 1 >= ui.chessheight) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return num >= 3;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
event.obstacles = [];
|
|
|
|
|
event.movemap = {};
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var neighbour;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(-1, 0);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
typeof neighbour.tempObstacle != "number" &&
|
|
|
|
|
game.obstacles.includes(neighbour)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.obstacles.push(neighbour);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player.movable(-2, 0)) {
|
|
|
|
|
event.movemap["[-1,0]"] = neighbour;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(1, 0);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
typeof neighbour.tempObstacle != "number" &&
|
|
|
|
|
game.obstacles.includes(neighbour)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.obstacles.push(neighbour);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player.movable(2, 0)) {
|
|
|
|
|
event.movemap["[1,0]"] = neighbour;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, -1);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
typeof neighbour.tempObstacle != "number" &&
|
|
|
|
|
game.obstacles.includes(neighbour)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.obstacles.push(neighbour);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player.movable(0, -2)) {
|
|
|
|
|
event.movemap["[0,-1]"] = neighbour;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, 1);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
typeof neighbour.tempObstacle != "number" &&
|
|
|
|
|
game.obstacles.includes(neighbour)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.obstacles.push(neighbour);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (player.movable(0, 2)) {
|
|
|
|
|
event.movemap["[0,1]"] = neighbour;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!event.obstacles.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
return;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (event.obstacles.length == 1) {
|
|
|
|
|
event.obstacle = event.obstacles[0];
|
|
|
|
|
} else if (event.isMine()) {
|
|
|
|
|
for (var i = 0; i < event.obstacles.length; i++) {
|
|
|
|
|
event.obstacles[i].classList.add("glow");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.chooseObstacle = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.imchoosing = true;
|
|
|
|
|
event.dialog = ui.create.dialog("移动一个与你相邻的路障");
|
|
|
|
|
event.dialog.add(
|
|
|
|
|
'<div class="text">' + lib.translate._chess_chuzhang_info + "</div>"
|
|
|
|
|
);
|
|
|
|
|
event.custom.replace.confirm = function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.getStat().skill._chess_chuzhang--;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.cancelled = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
|
|
|
|
};
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
if (ui.confirm) {
|
|
|
|
|
ui.confirm.classList.add("removing");
|
|
|
|
|
}
|
|
|
|
|
_status.imchoosing = false;
|
|
|
|
|
if (!event.cancelled) {
|
|
|
|
|
if (!event.obstacle) {
|
|
|
|
|
event.obstacle = event.obstacles.randomGet();
|
|
|
|
|
}
|
|
|
|
|
var moved = false;
|
|
|
|
|
for (var i in event.movemap) {
|
|
|
|
|
if (event.movemap[i] == event.obstacle) {
|
|
|
|
|
var xy = JSON.parse(i);
|
|
|
|
|
if (game.moveObstacle(event.obstacle, xy[0], xy[1])) {
|
|
|
|
|
moved = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!moved) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.removeObstacle(event.obstacle);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player.popup("除障");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.delay();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < event.obstacles.length; i++) {
|
|
|
|
|
event.obstacles[i].classList.remove("glow");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.dialog) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.dialog.close();
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ai: {
|
|
|
|
|
result: {
|
|
|
|
|
player: 1,
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
order: 7.5,
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_phasequeue: {
|
|
|
|
|
trigger: { player: "phaseBegin" },
|
|
|
|
|
forced: true,
|
|
|
|
|
popup: false,
|
|
|
|
|
content: function () {
|
|
|
|
|
var current = ui.chessinfo.firstChild.querySelector(".glow2");
|
|
|
|
|
if (current) {
|
|
|
|
|
current.classList.remove("glow2");
|
|
|
|
|
}
|
|
|
|
|
if (player.instance) {
|
|
|
|
|
player.instance.classList.add("glow2");
|
|
|
|
|
ui.chessinfo.firstChild.scrollTop = player.instance.offsetTop - 8;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_chessmove: {
|
|
|
|
|
enable: "phaseUse",
|
|
|
|
|
usable: 1,
|
|
|
|
|
direct: true,
|
|
|
|
|
delay: false,
|
|
|
|
|
preservecancel: true,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
if (
|
|
|
|
|
!player.movable(0, 1) &&
|
|
|
|
|
!player.movable(0, -1) &&
|
|
|
|
|
!player.movable(1, 0) &&
|
|
|
|
|
!player.movable(-1, 0)
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var move = 2;
|
|
|
|
|
move = game.checkMod(player, move, "chessMove", player);
|
|
|
|
|
return move > 0;
|
|
|
|
|
},
|
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var move = 2;
|
|
|
|
|
move = game.checkMod(player, move, "chessMove", player);
|
|
|
|
|
player.chooseToMoveChess(move).phasing = true;
|
|
|
|
|
"step 1";
|
|
|
|
|
if (ui.confirm) {
|
|
|
|
|
ui.confirm.classList.add("removing");
|
|
|
|
|
}
|
|
|
|
|
if (!result.bool) {
|
|
|
|
|
var skill = player.getStat().skill;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
skill._chessmove--;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (typeof skill._chessmovetried == "number") {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
skill._chessmovetried++;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
skill._chessmovetried = 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ai: {
|
|
|
|
|
order: 5,
|
|
|
|
|
result: {
|
|
|
|
|
playerx: function (player) {
|
|
|
|
|
if (get.mode() == "tafang" && _status.enemies.includes(player)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var nh = player.countCards("h");
|
|
|
|
|
if (
|
|
|
|
|
!player.countCards("h", "sha") &&
|
|
|
|
|
!player.countCards("h", "shunshou") &&
|
|
|
|
|
!player.countCards("h", "bingliang")
|
|
|
|
|
) {
|
|
|
|
|
if (nh <= Math.min(3, player.hp)) return Math.random() - 0.3;
|
|
|
|
|
else if (nh <= Math.min(2, player.hp)) return Math.random() - 0.4;
|
|
|
|
|
return Math.random() - 0.5;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
var neighbour;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, 1);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
game.players.includes(neighbour) &&
|
|
|
|
|
neighbour.side != player.side
|
|
|
|
|
) {
|
|
|
|
|
if (get.distance(player, neighbour, "attack") < 1) return 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, -1);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
game.players.includes(neighbour) &&
|
|
|
|
|
neighbour.side != player.side
|
|
|
|
|
) {
|
|
|
|
|
if (get.distance(player, neighbour, "attack") < 1) return 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(1, 0);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
game.players.includes(neighbour) &&
|
|
|
|
|
neighbour.side != player.side
|
|
|
|
|
) {
|
|
|
|
|
if (get.distance(player, neighbour, "attack") < 1) return 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(-1, 0);
|
|
|
|
|
if (
|
|
|
|
|
neighbour &&
|
|
|
|
|
game.players.includes(neighbour) &&
|
|
|
|
|
neighbour.side != player.side
|
|
|
|
|
) {
|
|
|
|
|
if (get.distance(player, neighbour, "attack") < 1) return 1;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
player: function (player) {
|
|
|
|
|
if (player.getStat().skill._chessmovetried >= 10) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
var x = lib.skill._chessmove.ai.result.playerx(player);
|
|
|
|
|
if (player.isMad()) return -x;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return x;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_chesscenter: {
|
|
|
|
|
trigger: {
|
|
|
|
|
player: [
|
|
|
|
|
"phaseBegin",
|
|
|
|
|
"useCardBegin",
|
|
|
|
|
"useSkillBegin",
|
|
|
|
|
"respondBegin",
|
|
|
|
|
"damageBegin",
|
|
|
|
|
"loseHpBegin",
|
|
|
|
|
],
|
|
|
|
|
target: "useCardToBegin",
|
|
|
|
|
},
|
|
|
|
|
forced: true,
|
|
|
|
|
priority: 100,
|
|
|
|
|
popup: false,
|
|
|
|
|
content: function () {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.chessFocus();
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
boss_bfengxing: {
|
|
|
|
|
mod: {
|
|
|
|
|
chessMove: function (player, current) {
|
|
|
|
|
return current + 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
attackFrom: function (from, to, current) {
|
|
|
|
|
return current - 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
trigger: { player: "phaseDrawBegin2" },
|
|
|
|
|
forced: true,
|
|
|
|
|
filter: function (event) {
|
2020-11-17 08:21:06 +00:00
|
|
|
|
return !event.numFixed;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
trigger.num += 2;
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
boss_chiyu: {
|
|
|
|
|
enable: "phaseUse",
|
|
|
|
|
usable: 1,
|
|
|
|
|
filterCard: { color: "red" },
|
|
|
|
|
nodelay: true,
|
|
|
|
|
check: function (card) {
|
|
|
|
|
return 8 - get.value(card);
|
|
|
|
|
},
|
|
|
|
|
filterTarget: function (card, player, target) {
|
|
|
|
|
return get.distance(player, target) <= 5 && player != target;
|
|
|
|
|
},
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return player.countCards("h", { color: "red" }) > 0;
|
|
|
|
|
},
|
|
|
|
|
selectTarget: -1,
|
|
|
|
|
content: function () {
|
|
|
|
|
target.damage("fire");
|
|
|
|
|
},
|
|
|
|
|
line: "fire",
|
|
|
|
|
ai: {
|
|
|
|
|
order: 1,
|
|
|
|
|
result: {
|
|
|
|
|
target: function (player, target) {
|
|
|
|
|
return get.damageEffect(target, player, target, "fire");
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
boss_tenglong: {
|
|
|
|
|
enable: "phaseUse",
|
|
|
|
|
usable: 1,
|
|
|
|
|
position: "he",
|
|
|
|
|
filterCard: { type: "equip" },
|
|
|
|
|
init: function (player) {
|
|
|
|
|
for (var i = 1; i < 6; i++) {
|
|
|
|
|
player.$disableEquip("equip" + i);
|
2023-11-06 18:07:27 +00:00
|
|
|
|
}
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
check: function (card) {
|
|
|
|
|
var player = _status.currentPhase;
|
|
|
|
|
if (player.countCards("he", { subtype: get.subtype(card) }) > 1) {
|
|
|
|
|
return 12 - get.equipValue(card);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
return 8 - get.equipValue(card);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
return player.countCards("he", { type: "equip" });
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
filterTarget: function (card, player, target) {
|
|
|
|
|
return player != target && get.distance(player, target) <= 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
target.damage(3, "fire");
|
|
|
|
|
},
|
|
|
|
|
ai: {
|
|
|
|
|
order: 9,
|
|
|
|
|
result: {
|
|
|
|
|
target: function (player, target) {
|
|
|
|
|
return get.damageEffect(target, player, target, "fire");
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
boss_wuying: {
|
|
|
|
|
mod: {
|
|
|
|
|
globalTo: function (from, to, distance) {
|
|
|
|
|
return distance + 2;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chessMove: function (player, current) {
|
|
|
|
|
return current - 1;
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
boss_wushang: {
|
|
|
|
|
trigger: { player: "phaseZhunbeiBegin" },
|
|
|
|
|
forced: true,
|
|
|
|
|
filter: function (event, player) {
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (
|
|
|
|
|
game.players[i] != player &&
|
|
|
|
|
game.players[i].countCards("h") &&
|
|
|
|
|
get.distance(player, game.players[i]) <= 5
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var players = [];
|
|
|
|
|
for (var i = 0; i < game.players.length; i++) {
|
|
|
|
|
if (
|
|
|
|
|
game.players[i] != player &&
|
|
|
|
|
game.players[i].countCards("h") &&
|
|
|
|
|
get.distance(player, game.players[i]) <= 5
|
|
|
|
|
) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
players.push(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
players.sort(lib.sort.seat);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.players = players;
|
|
|
|
|
"step 1";
|
|
|
|
|
if (event.players.length) {
|
|
|
|
|
event.current = event.players.shift();
|
|
|
|
|
event.current.chooseCard(
|
|
|
|
|
"神天并地:交给" + get.translation(player) + "一张手牌",
|
|
|
|
|
true
|
|
|
|
|
);
|
|
|
|
|
} else {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 2";
|
|
|
|
|
if (result.cards.length) {
|
|
|
|
|
player.gain(result.cards, event.current);
|
|
|
|
|
event.current.$give(1, player);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.goto(1);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
translate: {
|
|
|
|
|
zhu_config: "启用主将",
|
|
|
|
|
main_zhu_config: "启用副将",
|
|
|
|
|
noreplace_end_config: "无替补时结束",
|
|
|
|
|
reward_config: "杀敌摸牌",
|
|
|
|
|
punish_config: "杀死队友",
|
|
|
|
|
seat_order_config: "行动顺序",
|
|
|
|
|
battle_number_config: "对战人数",
|
|
|
|
|
replace_number_config: "替补人数",
|
|
|
|
|
first_less_config: "先手少摸牌",
|
|
|
|
|
single_control_config: "单人控制",
|
|
|
|
|
additional_player_config: "无尽模式",
|
|
|
|
|
choice_number_config: "无尽模式候选",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
friend: "友",
|
|
|
|
|
enemy: "敌",
|
|
|
|
|
neutral: "中",
|
|
|
|
|
trueColor: "zhu",
|
|
|
|
|
falseColor: "wei",
|
|
|
|
|
_chessmove: "移动",
|
|
|
|
|
leader: "君主",
|
|
|
|
|
combat: "对阵",
|
|
|
|
|
chessscroll_speed_config: "边缘滚动速度",
|
|
|
|
|
chess_character_config: "战棋武将",
|
|
|
|
|
only_chess_character_config: "只用战棋武将",
|
|
|
|
|
chess_ordered_config: "指定行动顺序",
|
|
|
|
|
chess_mode_config: "游戏模式",
|
|
|
|
|
chess_leader_save_config: "选择历程",
|
|
|
|
|
chess_leader_clear_config: "清除进度",
|
|
|
|
|
save1: "一",
|
|
|
|
|
save2: "二",
|
|
|
|
|
save3: "三",
|
|
|
|
|
save4: "四",
|
|
|
|
|
save5: "五",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_2: " ",
|
|
|
|
|
leader_2_bg: "二",
|
|
|
|
|
leader_3: " ",
|
|
|
|
|
leader_3_bg: "三",
|
|
|
|
|
leader_5: " ",
|
|
|
|
|
leader_5_bg: "五",
|
|
|
|
|
leader_8: " ",
|
|
|
|
|
leader_8_bg: "八",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_easy: " ",
|
|
|
|
|
leader_easy_bg: "简单",
|
|
|
|
|
leader_medium: " ",
|
|
|
|
|
leader_medium_bg: "普通",
|
|
|
|
|
leader_hard: " ",
|
|
|
|
|
leader_hard_bg: "困难",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_caocao: "曹操",
|
|
|
|
|
chess_xunyu: "荀彧",
|
|
|
|
|
chess_simayi: "司马懿",
|
|
|
|
|
chess_xiahoudun: "夏侯惇",
|
|
|
|
|
chess_dianwei: "典韦",
|
|
|
|
|
chess_xuzhu: "许褚",
|
|
|
|
|
chess_zhangliao: "张辽",
|
|
|
|
|
chess_jiaxu: "贾诩",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_liubei: "刘备",
|
|
|
|
|
chess_guanyu: "关羽",
|
|
|
|
|
chess_zhangfei: "张飞",
|
|
|
|
|
chess_zhaoyun: "赵云",
|
|
|
|
|
chess_machao: "马超",
|
|
|
|
|
chess_huangzhong: "黄忠",
|
|
|
|
|
chess_maliang: "马良",
|
|
|
|
|
chess_zhugeliang: "诸葛亮",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_sunquan: "孙权",
|
|
|
|
|
chess_zhouyu: "周瑜",
|
|
|
|
|
chess_lvmeng: "吕蒙",
|
|
|
|
|
chess_huanggai: "黄盖",
|
|
|
|
|
chess_lusu: "鲁肃",
|
|
|
|
|
chess_luxun: "陆逊",
|
|
|
|
|
chess_ganning: "甘宁",
|
|
|
|
|
chess_taishici: "太史慈",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_lvbu: "吕布",
|
|
|
|
|
chess_sunshangxiang: "孙尚香",
|
|
|
|
|
chess_diaochan: "貂蝉",
|
|
|
|
|
chess_huatuo: "华佗",
|
|
|
|
|
chess_zhangjiao: "张辽",
|
|
|
|
|
chess_menghuo: "孟获",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_dongzhuo: "董卓",
|
|
|
|
|
chess_xingtian: "刑天",
|
|
|
|
|
chess_jinchidiao: "金翅雕",
|
|
|
|
|
chess_beimingjukun: "北溟巨鲲",
|
|
|
|
|
chess_wuzhaojinlong: "五爪金龙",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
treasure_dubiaoxianjing: "毒镖陷阱",
|
|
|
|
|
treasure_jiqishi: "集气石",
|
|
|
|
|
treasure_shenmidiaoxiang: "神秘雕像",
|
|
|
|
|
treasure_shenpanxianjing: "审判之刃",
|
|
|
|
|
treasure_shiyuansu: "石元素",
|
|
|
|
|
treasure_wuyashenxiang: "乌鸦神像",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
dubiaoxianjing: "飞刃",
|
|
|
|
|
dubiaoxianjing_info: "距离两格体力值大于1的角色在回合结束后受到1点伤害,然后摸两张牌。",
|
|
|
|
|
jiqishi: "集气",
|
|
|
|
|
jiqishi_info: "距离两格以内的已受伤角色在回合结束后回复1点体力,然后弃置两张牌。",
|
|
|
|
|
shenmidiaoxiang: "秘咒",
|
|
|
|
|
shenmidiaoxiang_info: "距离三格以外的所有角色在回合结束后强制向此处移动一格。",
|
|
|
|
|
shenpanxianjing: "审判",
|
|
|
|
|
shenpanxianjing_info:
|
|
|
|
|
"在任意一名角色回合结束后,若没有其他角色手牌数比其多,随机弃置其一张手牌。",
|
|
|
|
|
shiyuansu: "护体",
|
|
|
|
|
shiyuansu_info: "任意一名角色一次性受到不少于2点伤害后,使其获得1点护甲。",
|
|
|
|
|
wuyashenxiang: "厄音",
|
|
|
|
|
wuyashenxiang_info:
|
|
|
|
|
"距离3格以内的角色在其回合结束后,若体力值不大于1,令其回复1点体力,然后将牌堆中的一张延时锦囊牌置于其判定区。",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_caocao: "曹操",
|
|
|
|
|
leader_liubei: "刘备",
|
|
|
|
|
leader_sunquan: "孙权",
|
|
|
|
|
leader_yuri: "由理",
|
|
|
|
|
leader_xiaoxiong: "枭雄",
|
|
|
|
|
leader_xiaoxiong_info: "当你造成伤害后,获胜后会得到一定数量的额外金币奖励。",
|
|
|
|
|
leader_renyi: "仁义",
|
|
|
|
|
leader_renyi_info: "你招降敌将的成功率大幅增加。",
|
|
|
|
|
leader_mouduan: "谋断",
|
|
|
|
|
leader_mouduan_info: "其他友方角色回合内的行动范围+1。",
|
|
|
|
|
leader_zhenlve: "缜略",
|
|
|
|
|
leader_zhenlve_info: "友方角色使用的普通锦囊牌不可被【无懈可击】响应。",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
tongshuai: "统率",
|
|
|
|
|
tongshuai_info: "准备阶段和结束阶段,你可以选择一名未上场的已方武将的一个技能作为你的技能。",
|
|
|
|
|
leader_zhaoxiang: "招降",
|
|
|
|
|
leader_zhaoxiang_info:
|
|
|
|
|
"出牌阶段限一次,你可以尝试对相邻敌方武将进行招降,若成功,你获得该武将并立即结束本局游戏,若失败,你受到1点伤害。每发动一次消耗10招募令。",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
common: "普通",
|
|
|
|
|
rare: "精品",
|
|
|
|
|
epic: "史诗",
|
|
|
|
|
legend: "传说",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_shezhang: "设置路障",
|
|
|
|
|
chess_shezhang_info: "选择一名角色,在其四周设置临时路障,持续X回合(X为存活角色数)。",
|
|
|
|
|
chess_chuzhang: "清除路障",
|
|
|
|
|
chess_chuzhang_info: "将与你相邻的路障向后推移一格,每影响一个路障你摸一张牌。",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_chess_chuzhang: "除障",
|
|
|
|
|
_chess_chuzhang_info:
|
|
|
|
|
"出牌阶段限一次,若你周围四格至少有三个为障碍或在边缘外,你可以选择将其中一个障碍向后推移一格(若无法推移则改为清除之)。",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
arenaAdd: "援军",
|
|
|
|
|
arenaAdd_info:
|
|
|
|
|
"出牌阶段限一次,你可以令一名未出场的已方角色加入战场。战斗结束后,该角色无论是否存活均不能再次出场。",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
pianyi: "翩仪",
|
|
|
|
|
pianyi_info: "结束阶段,若你于本回合内未造成过伤害,你获得一次移动机会。",
|
|
|
|
|
lingdong: "灵动",
|
|
|
|
|
lingdong_info: "结束阶段,你可以移动至多X格(X为你本回合内使用【杀】的次数)。",
|
|
|
|
|
lianshe: "箭舞",
|
|
|
|
|
lianshe_info:
|
|
|
|
|
"当你于一回合内首次使用【杀】时,你可以摸一张牌;你的回合内,当你使用一张不为【杀】的牌时,你令本回合内使用【杀】的次数上限+1。",
|
|
|
|
|
zhiming: "穿杨",
|
|
|
|
|
zhiming_info: "锁定技,当你使用【杀】造成伤害时,若你不在目标角色的攻击范围内,此伤害+1。",
|
|
|
|
|
sanjiansheji: "散箭",
|
|
|
|
|
sanjiansheji_info:
|
|
|
|
|
"你可以将两张【杀】当做【杀】使用,你以此法使用的【杀】可以指定距离5格内的角色为目标。",
|
|
|
|
|
guanchuan: "强弩",
|
|
|
|
|
guanchuan_info: "当你使用【杀】指定唯一目标后,你可令攻击射线内的其他角色也成为此【杀】的目标。",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
boss_stoneqiangzheng: "强征",
|
|
|
|
|
boss_stoneqiangzheng_info: "锁定技,结束阶段,你获得所有其他角色的各一张手牌。",
|
|
|
|
|
boss_stonebaolin: "暴凌",
|
|
|
|
|
boss_moyan: "魔焰",
|
|
|
|
|
boss_moyan_info: "锁定技,结束阶段,你对场上所有角色造成1点火焰伤害。",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
cangming: "颠动沧溟",
|
|
|
|
|
cangming_info:
|
|
|
|
|
"出牌阶段限一次,你可弃置四张花色不同的手牌并将武将牌翻至背面,然后令所有其他角色进入混乱状态直到你的下一回合开始。",
|
|
|
|
|
boss_bfengxing: "风行",
|
|
|
|
|
boss_bfengxing_info: "锁定技,摸牌阶段,你多摸两张牌;你的攻击范围+2;你回合内的移动距离+2。",
|
|
|
|
|
boss_chiyu: "炽羽",
|
|
|
|
|
boss_chiyu_info:
|
|
|
|
|
"出牌阶段限一次,你可以弃置一张红色牌,对距离5以内的所有其他角色各造成1点火焰伤害。",
|
|
|
|
|
boss_tenglong: "腾龙八齐",
|
|
|
|
|
boss_tenglong_info:
|
|
|
|
|
"锁定技,你废除你的装备区;出牌阶段限一次,你可以弃置一张装备牌并对一名距离你2以内的其他角色造成3点火焰伤害。",
|
|
|
|
|
boss_wushang: "神天并地",
|
|
|
|
|
boss_wushang_info: "锁定技,准备阶段,距离你5以内的所有其他角色需交给你一张手牌。",
|
|
|
|
|
boss_wuying: "无影",
|
|
|
|
|
boss_wuying_info: "锁定技,你回合内的移动距离-1;其他角色至你的距离+2。",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_default: "常规",
|
|
|
|
|
chess_boss: "魔王",
|
|
|
|
|
chess_leader: "君主",
|
2024-01-12 03:38:36 +00:00
|
|
|
|
|
2024-04-15 18:46:41 +00:00
|
|
|
|
mode_chess_character_config: "战棋模式",
|
|
|
|
|
mode_chess_card_config: "战棋模式",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui: {
|
|
|
|
|
placeChess: function (player, pos) {
|
|
|
|
|
player.dataset.position = pos;
|
|
|
|
|
pos = parseInt(pos);
|
|
|
|
|
var j = Math.floor(pos / ui.chesswidth);
|
|
|
|
|
var i = pos - j * ui.chesswidth;
|
|
|
|
|
var dx = i * 148;
|
|
|
|
|
var dy = j * 148;
|
|
|
|
|
player._chesstransform = [dx, dy];
|
|
|
|
|
player.style.transform = "translate(" + dx + "px," + dy + "px)";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
create: {
|
|
|
|
|
playergrid: function (player, x, y) {
|
|
|
|
|
var pos = player.getDataPos(x, y);
|
|
|
|
|
if (get.mode() == "tafang") {
|
|
|
|
|
if (pos < ui.chesswidth) return false;
|
|
|
|
|
if (pos / ui.chesswidth >= ui.chessheight - 1) return false;
|
|
|
|
|
}
|
|
|
|
|
var node = ui.create.div(".player.minskin.playergrid", player.parentNode);
|
|
|
|
|
node.link = player;
|
|
|
|
|
ui.placeChess(node, pos);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return node;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
fakeme: function () {
|
|
|
|
|
if (ui.fakeme) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.fakeme.delete();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.fakeme = ui.create.div(".fakeme.avatar", ui.me);
|
|
|
|
|
ui.fakeme.style.backgroundImage = game.me.node.avatar.style.backgroundImage;
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
click: {
|
|
|
|
|
moveContainer: function (x, y, scroll) {
|
|
|
|
|
if (scroll) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
clearTimeout(ui.chessContainer._scrolling);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chessContainer._scrolling = true;
|
|
|
|
|
ui.chess.style.transition = "transform 0.5s";
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.refresh(ui.chess);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (ui.chessContainer._scrolling) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (typeof x === "number") ui.chessContainer.chessLeft += x;
|
|
|
|
|
if (typeof y === "number") ui.chessContainer.chessTop += y;
|
|
|
|
|
var xmin = 0;
|
|
|
|
|
if (lib.config.show_history == "left") {
|
|
|
|
|
xmin = -50;
|
|
|
|
|
}
|
|
|
|
|
if (ui.chessContainer.chessLeft < xmin) ui.chessContainer.chessLeft = xmin;
|
|
|
|
|
if (ui.chessContainer.chessTop < 0) ui.chessContainer.chessTop = 0;
|
|
|
|
|
var xmax = ui.chessContainer.xmax;
|
|
|
|
|
var ymax = ui.chessContainer.ymax;
|
|
|
|
|
if (ui.chessContainer.chessLeft > xmax) ui.chessContainer.chessLeft = xmax;
|
|
|
|
|
if (ui.chessContainer.chessTop > ymax) ui.chessContainer.chessTop = ymax;
|
|
|
|
|
ui.chess.style.transform =
|
|
|
|
|
"translate(" +
|
|
|
|
|
-ui.chessContainer.chessLeft +
|
|
|
|
|
"px," +
|
|
|
|
|
-ui.chessContainer.chessTop +
|
|
|
|
|
"px)";
|
|
|
|
|
if (scroll) {
|
|
|
|
|
var ending = ui.chess.listenTransition(function () {
|
|
|
|
|
if (ui.chess._ending == ending) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
clearTimeout(ui.chessContainer._scrolling);
|
|
|
|
|
delete ui.chess._ending;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chess._scrolling = setTimeout(function () {
|
|
|
|
|
ui.chessContainer._scrolling = null;
|
|
|
|
|
ui.chess.style.transition = "";
|
|
|
|
|
}, 500);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ui.chess._ending = ending;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chessInfo: function (e) {
|
|
|
|
|
if (this.link.isAlive()) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
this.link.chessFocus();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (
|
|
|
|
|
this.link.classList.contains("selectable") ||
|
|
|
|
|
this.link.classList.contains("selected")
|
|
|
|
|
) {
|
|
|
|
|
ui.click.target.call(this.link, e);
|
|
|
|
|
ui.click.window.call(ui.window, e);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
playergrid: function () {
|
|
|
|
|
if (!_status.paused) return;
|
|
|
|
|
var pos = parseInt(this.dataset.position);
|
|
|
|
|
this.link.moveTo(pos % ui.chesswidth, Math.floor(pos / ui.chesswidth));
|
|
|
|
|
if (ui.movegrids) {
|
|
|
|
|
while (ui.movegrids.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
ui.movegrids.shift().delete();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.event.result = {
|
|
|
|
|
bool: true,
|
|
|
|
|
move: this.link.dataset.position,
|
2020-11-05 08:26:02 +00:00
|
|
|
|
};
|
|
|
|
|
game.resume();
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
obstacle: function () {
|
|
|
|
|
if (
|
|
|
|
|
_status.event.chooseObstacle &&
|
|
|
|
|
_status.paused &&
|
|
|
|
|
_status.event.obstacles &&
|
|
|
|
|
_status.event.obstacles.includes(this)
|
|
|
|
|
) {
|
|
|
|
|
_status.event.obstacle = this;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
get: {
|
|
|
|
|
chessDistance: function (from, to) {
|
|
|
|
|
var fxy = from.getXY();
|
|
|
|
|
var txy = to.getXY();
|
|
|
|
|
return Math.abs(fxy[0] - txy[0]) + Math.abs(fxy[1] - txy[1]);
|
|
|
|
|
},
|
|
|
|
|
rawAttitude: function (from, to) {
|
|
|
|
|
return from.side === to.side ? 6 : -6;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
card: {
|
|
|
|
|
chess_shezhang: {
|
|
|
|
|
type: "basic",
|
|
|
|
|
fullskin: true,
|
|
|
|
|
modeimage: "chess",
|
|
|
|
|
enable: true,
|
|
|
|
|
filterTarget: function (card, player, target) {
|
|
|
|
|
if (target.movable(-1, 0)) return true;
|
|
|
|
|
if (target.movable(1, 0)) return true;
|
|
|
|
|
if (target.movable(0, -1)) return true;
|
|
|
|
|
if (target.movable(0, 1)) return true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return false;
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content: function () {
|
|
|
|
|
var xy = target.getXY();
|
|
|
|
|
var x = xy[0];
|
|
|
|
|
var y = xy[1];
|
|
|
|
|
if (target.movable(-1, 0)) {
|
|
|
|
|
game.addTempObstacle(x - 1, y, game.countPlayer());
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (target.movable(1, 0)) {
|
|
|
|
|
game.addTempObstacle(x + 1, y, game.countPlayer());
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (target.movable(0, 1)) {
|
|
|
|
|
game.addTempObstacle(x, y + 1, game.countPlayer());
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (target.movable(0, -1)) {
|
|
|
|
|
game.addTempObstacle(x, y - 1, game.countPlayer());
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content_old: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
var pos = parseInt(player.dataset.position);
|
|
|
|
|
var poses = [];
|
|
|
|
|
if (player.movable(-1, 0)) {
|
|
|
|
|
poses.push(pos - 1);
|
|
|
|
|
}
|
|
|
|
|
if (player.movable(1, 0)) {
|
|
|
|
|
poses.push(pos + 1);
|
|
|
|
|
}
|
|
|
|
|
if (player.movable(0, -1)) {
|
|
|
|
|
poses.push(pos - ui.chesswidth);
|
|
|
|
|
}
|
|
|
|
|
if (player.movable(0, 1)) {
|
|
|
|
|
poses.push(pos + ui.chesswidth);
|
|
|
|
|
}
|
|
|
|
|
event.poses = poses;
|
|
|
|
|
if (poses.length == 1) {
|
|
|
|
|
event.obstacle = poses[0];
|
|
|
|
|
event.grids = [];
|
|
|
|
|
} else if (event.isMine()) {
|
|
|
|
|
event.grids = player.createRangeShadow(1, function () {
|
|
|
|
|
event.obstacle = this.dataset.position;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.resume();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
});
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.imchoosing = true;
|
|
|
|
|
for (var i = 0; i < event.grids.length; i++) {
|
|
|
|
|
event.grids[i].addTempClass("start");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.dialog = ui.create.dialog("选择一个位置放置障碍");
|
|
|
|
|
} else {
|
|
|
|
|
event.grids = [];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
_status.imchoosing = false;
|
|
|
|
|
if (!event.obstacle) {
|
|
|
|
|
event.obstacle = event.poses.randomGet();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.obstacle) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.addObstacle(event.obstacle.toString());
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
while (event.grids.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.grids.shift().delete();
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.dialog) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.dialog.close();
|
|
|
|
|
}
|
|
|
|
|
player.draw();
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ai: {
|
|
|
|
|
result: {
|
|
|
|
|
target: function (player, target) {
|
|
|
|
|
if (target.getNeighbours().length) return 0;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
return -1;
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
order: 1,
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_chuzhang: {
|
|
|
|
|
type: "basic",
|
|
|
|
|
fullskin: true,
|
|
|
|
|
modeimage: "chess",
|
|
|
|
|
filterTarget: function (card, player, target) {
|
|
|
|
|
return player == target;
|
|
|
|
|
},
|
|
|
|
|
selectTarget: -1,
|
|
|
|
|
enable: function (event, player) {
|
|
|
|
|
if (game.obstacles.includes(player.getNeighbour(-1, 0)) && player.movable(-2, 0))
|
|
|
|
|
return true;
|
|
|
|
|
if (game.obstacles.includes(player.getNeighbour(1, 0)) && player.movable(2, 0))
|
|
|
|
|
return true;
|
|
|
|
|
if (game.obstacles.includes(player.getNeighbour(0, -1)) && player.movable(0, -2))
|
|
|
|
|
return true;
|
|
|
|
|
if (game.obstacles.includes(player.getNeighbour(0, 1)) && player.movable(0, 2))
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
content: function () {
|
|
|
|
|
var neighbour,
|
|
|
|
|
num = 0;
|
|
|
|
|
neighbour = player.getNeighbour(-1, 0);
|
|
|
|
|
if (neighbour && game.obstacles.includes(neighbour) && player.movable(-2, 0)) {
|
|
|
|
|
game.moveObstacle(neighbour, -1, 0);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(1, 0);
|
|
|
|
|
if (neighbour && game.obstacles.includes(neighbour) && player.movable(2, 0)) {
|
|
|
|
|
game.moveObstacle(neighbour, 1, 0);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, -1);
|
|
|
|
|
if (neighbour && game.obstacles.includes(neighbour) && player.movable(0, -2)) {
|
|
|
|
|
game.moveObstacle(neighbour, 0, -1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, 1);
|
|
|
|
|
if (neighbour && game.obstacles.includes(neighbour) && player.movable(0, 2)) {
|
|
|
|
|
game.moveObstacle(neighbour, 0, 1);
|
2020-11-05 08:26:02 +00:00
|
|
|
|
num++;
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (num) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
player.draw(num);
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
content_old: function () {
|
|
|
|
|
"step 0";
|
|
|
|
|
event.obstacles = [];
|
2020-11-05 08:26:02 +00:00
|
|
|
|
var neighbour;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(-1, 0);
|
|
|
|
|
if (neighbour && game.obstacles.includes(neighbour)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.obstacles.push(neighbour);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(1, 0);
|
|
|
|
|
if (neighbour && game.obstacles.includes(neighbour)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.obstacles.push(neighbour);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, -1);
|
|
|
|
|
if (neighbour && game.obstacles.includes(neighbour)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.obstacles.push(neighbour);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
neighbour = player.getNeighbour(0, 1);
|
|
|
|
|
if (neighbour && game.obstacles.includes(neighbour)) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.obstacles.push(neighbour);
|
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (!event.obstacles.length) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.finish();
|
|
|
|
|
return;
|
2024-04-15 18:46:41 +00:00
|
|
|
|
} else if (event.obstacles.length == 1) {
|
|
|
|
|
event.obstacle = event.obstacles[0];
|
|
|
|
|
} else if (event.isMine()) {
|
|
|
|
|
for (var i = 0; i < event.obstacles.length; i++) {
|
|
|
|
|
event.obstacles[i].classList.add("glow");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
event.chooseObstacle = true;
|
2020-11-05 08:26:02 +00:00
|
|
|
|
game.pause();
|
2024-04-15 18:46:41 +00:00
|
|
|
|
_status.imchoosing = true;
|
|
|
|
|
event.dialog = ui.create.dialog("选择一个与你相邻的障碍清除之");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
"step 1";
|
|
|
|
|
_status.imchoosing = false;
|
|
|
|
|
if (!event.obstacle) {
|
|
|
|
|
event.obstacle = event.obstacles.randomGet();
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
|
|
|
|
game.removeObstacle(event.obstacle.dataset.position);
|
2024-04-15 18:46:41 +00:00
|
|
|
|
for (var i = 0; i < event.obstacles.length; i++) {
|
|
|
|
|
event.obstacles[i].classList.remove("glow");
|
2020-11-05 08:26:02 +00:00
|
|
|
|
}
|
2024-04-15 18:46:41 +00:00
|
|
|
|
if (event.dialog) {
|
2020-11-05 08:26:02 +00:00
|
|
|
|
event.dialog.close();
|
|
|
|
|
}
|
|
|
|
|
player.draw();
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
ai: {
|
|
|
|
|
result: {
|
|
|
|
|
player: 1,
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
order: 8,
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_2: {
|
|
|
|
|
opacity: 1,
|
|
|
|
|
color: "white",
|
|
|
|
|
textShadow: "black 0 0 2px",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_3: {
|
|
|
|
|
opacity: 1,
|
|
|
|
|
color: "white",
|
|
|
|
|
textShadow: "black 0 0 2px",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_5: {
|
|
|
|
|
opacity: 1,
|
|
|
|
|
color: "white",
|
|
|
|
|
textShadow: "black 0 0 2px",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_8: {
|
|
|
|
|
opacity: 1,
|
|
|
|
|
color: "white",
|
|
|
|
|
textShadow: "black 0 0 2px",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_easy: {
|
|
|
|
|
color: "white",
|
|
|
|
|
opacity: 1,
|
|
|
|
|
textShadow: "black 0 0 2px",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// image:'mode/chess/difficulty/leader_easy'
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_medium: {
|
|
|
|
|
color: "white",
|
|
|
|
|
opacity: 1,
|
|
|
|
|
textShadow: "black 0 0 2px",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// image:'mode/chess/difficulty/leader_medium'
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
leader_hard: {
|
|
|
|
|
color: "white",
|
|
|
|
|
opacity: 1,
|
|
|
|
|
textShadow: "black 0 0 2px",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// image:'mode/chess/difficulty/leader_hard'
|
2024-04-15 18:46:41 +00:00
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
characterSort: {
|
|
|
|
|
mode_chess: {
|
|
|
|
|
chess_default: [
|
|
|
|
|
"chess_zhangliao",
|
|
|
|
|
"chess_huangzhong",
|
|
|
|
|
"chess_taishici",
|
|
|
|
|
"chess_sunshangxiang",
|
|
|
|
|
"chess_diaochan",
|
|
|
|
|
],
|
|
|
|
|
chess_boss: [
|
|
|
|
|
"chess_jinchidiao",
|
|
|
|
|
"chess_beimingjukun",
|
|
|
|
|
"chess_wuzhaojinlong",
|
|
|
|
|
"chess_dongzhuo",
|
|
|
|
|
"chess_xingtian",
|
|
|
|
|
],
|
|
|
|
|
chess_leader: ["leader_caocao", "leader_liubei", "leader_sunquan", "leader_yuri"],
|
2020-11-24 14:08:57 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
characterPack: {
|
|
|
|
|
mode_chess: {
|
|
|
|
|
leader_caocao: ["male", "wei", 4, ["leader_xiaoxiong"]],
|
|
|
|
|
leader_liubei: ["male", "shu", 4, ["leader_renyi"]],
|
|
|
|
|
leader_sunquan: ["male", "wu", 4, ["leader_mouduan"]],
|
|
|
|
|
leader_yuri: ["female", "key", 4, ["leader_zhenlve"]],
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// chess_caocao:['male','wei',3,['']],
|
|
|
|
|
// chess_xunyu:['male','wei',3,['']],
|
|
|
|
|
// chess_simayi:['male','wei',3,['']],
|
|
|
|
|
// chess_xiahoudun:['male','wei',3,['']],
|
|
|
|
|
// chess_dianwei:['male','wei',3,['']],
|
|
|
|
|
// chess_xuzhu:['male','wei',3,['']],
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_zhangliao: ["male", "wei", 4, ["gongji", "zhiming"]],
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// chess_jiaxu:['male','wei',3,['']],
|
|
|
|
|
//
|
|
|
|
|
// chess_liubei:['male','shu',3,['']],
|
|
|
|
|
// chess_guanyu:['male','shu',3,['']],
|
|
|
|
|
// chess_zhangfei:['male','shu',3,['']],
|
|
|
|
|
// chess_zhaoyun:['male','shu',3,['']],
|
|
|
|
|
// chess_machao:['male','shu',3,['']],
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_huangzhong: ["male", "shu", 4, ["sanjiansheji", "liegong"]],
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// chess_maliang:['male','shu',3,['']],
|
|
|
|
|
// chess_zhugeliang:['male','shu',3,['']],
|
|
|
|
|
//
|
|
|
|
|
// chess_sunquan:['male','wu',3,['']],
|
|
|
|
|
// chess_zhouyu:['male','wu',3,['qinyin']],
|
|
|
|
|
// chess_lvmeng:['male','wu',3,['']],
|
|
|
|
|
// chess_huanggai:['male','wu',3,['']],
|
|
|
|
|
// chess_lusu:['male','wu',3,['']],
|
|
|
|
|
// chess_luxun:['male','wu',3,['']],
|
|
|
|
|
// chess_ganning:['male','wu',3,['']],
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_taishici: ["male", "wu", 4, ["gongji", "guanchuan", "pojun"]],
|
2020-11-05 08:26:02 +00:00
|
|
|
|
//
|
|
|
|
|
// chess_lvbu:['male','qun',3,['']],
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_sunshangxiang: ["female", "wu", 3, ["lingdong", "lianshe", "gongji"]],
|
|
|
|
|
chess_diaochan: ["female", "qun", 3, ["xingzhui", "pianyi", "rebiyue"]],
|
2020-11-05 08:26:02 +00:00
|
|
|
|
// chess_huatuo:['male','qun',3,['zhenjiu','mazui']],
|
|
|
|
|
// chess_zhangjiao:['male','qun',3,['']],
|
|
|
|
|
// chess_menghuo:['male','qun',3,['']],
|
|
|
|
|
//
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_jinchidiao: [
|
|
|
|
|
"male",
|
|
|
|
|
"qun",
|
|
|
|
|
15,
|
|
|
|
|
["boss_bfengxing", "boss_chiyu"],
|
|
|
|
|
["boss", "chessboss"],
|
|
|
|
|
],
|
|
|
|
|
chess_beimingjukun: ["male", "qun", 25, ["boss_wuying", "cangming"], ["boss", "chessboss"]],
|
|
|
|
|
chess_wuzhaojinlong: [
|
|
|
|
|
"male",
|
|
|
|
|
"qun",
|
|
|
|
|
30,
|
|
|
|
|
["boss_tenglong", "boss_wushang"],
|
|
|
|
|
["boss", "chessboss"],
|
|
|
|
|
],
|
|
|
|
|
chess_dongzhuo: [
|
|
|
|
|
"male",
|
|
|
|
|
"qun",
|
|
|
|
|
20,
|
|
|
|
|
["jiuchi", "boss_stoneqiangzheng", "boss_stonebaolin"],
|
|
|
|
|
["boss", "chessboss"],
|
|
|
|
|
],
|
|
|
|
|
chess_xingtian: ["male", "qun", 99, ["boss_moyan", "wushuang"], ["boss", "chessboss"]],
|
|
|
|
|
},
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
cardPack: {
|
|
|
|
|
mode_chess: ["chess_shezhang", "chess_chuzhang"],
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
2024-04-15 18:46:41 +00:00
|
|
|
|
chess_cardlist: [
|
|
|
|
|
["heart", 1, "chess_shezhang"],
|
|
|
|
|
["diamond", 1, "chess_shezhang"],
|
|
|
|
|
["club", 1, "chess_chuzhang"],
|
|
|
|
|
["spade", 1, "chess_chuzhang"],
|
2020-11-05 08:26:02 +00:00
|
|
|
|
],
|
2024-04-15 18:46:41 +00:00
|
|
|
|
rank: {},
|
|
|
|
|
posmap: {},
|
|
|
|
|
help: {
|
|
|
|
|
战棋模式:
|
|
|
|
|
'<div style="margin:10px">对阵模式</div><ul style="margin-top:0"><li>n人对战n人的模式,由单人控制,开始游戏后随机分配位置与出牌顺序<li>' +
|
|
|
|
|
"每人在出牌阶段有一次移动的机会,可移动的最大距离为2<li>" +
|
|
|
|
|
"任何卡牌或技能无法指定位置相隔8个格以上的角色为目标<li>" +
|
|
|
|
|
"杀死对方阵营的角色可摸一张牌,杀死本方阵营无惩罚<li>" +
|
|
|
|
|
"若开启主将,双方各选择一名角色成为主将。主将体力上限加一,主将死亡后,若有副将,副将代替之成为主将,否则游戏结束<li>" +
|
|
|
|
|
"开启无尽模式后,任何一方有角色死亡都将选择一名新角色重新加入战场,直到点击左上角的结束游戏按钮手动结束游戏。结束游戏时,杀敌更多的一方获胜<li>" +
|
|
|
|
|
"行动顺序为指定时,双方无论存活角色角色多少都将轮流进行行动。在一方所有角色行动完毕进行下一轮行动时,若其人数比另一方少,另一方可指定至多X名角色名摸一张牌,X为人数之差<li>" +
|
|
|
|
|
"开启战场机关后,每个回合结束时有一定机率出现一个机关,该机关不参与战斗,并有一个影响周围或全体角色的效果。机关在出现后的5~10个回合内消失<li>" +
|
|
|
|
|
"开启击退效果后,当一名角色对距离两格以内的目标造成伤害后,受伤害角色将沿反方向移动一格<li>" +
|
|
|
|
|
"战场上可设置出现随机路障,角色无法移动到路障处。当一名角色的周围四格有至少三格为路障或在战场外时,其可以在回合内清除一个相邻路障</ul>" +
|
|
|
|
|
'<div style="margin:10px">君主模式</div><ul style="margin-top:0"><li>收集武将进行战斗,根据战斗难度及我方出场武将的强度,战斗胜利后将获得数量不等的金钱。没有君主出场时,获得的金钱较多<li>' +
|
|
|
|
|
"金钱可以用来招募随机武将,招到已有武将,或遣返不需要的武将时可得到招募令<li>" +
|
|
|
|
|
"战斗中有君主出场时可招降敌将,成功率取决于敌将的稀有度、剩余体力值以及手牌数。成功后战斗立即结束且没有金钱奖励。每发动一次招降,无论成功还是失败,都会扣除10招募令<li>" +
|
|
|
|
|
"挑战武将会与该武将以及与其强度相近的武将进行战斗,敌方人数与我方出场人数相同,但不少于3。胜利后可通过招募令招募该武将,普通/稀有/史诗/传说武将分别需要40/100/400/1600招募令<li>" +
|
|
|
|
|
"竞技场:<br>随机选择9名武将,每次派出1~3名武将参战。战斗中阵亡的武将不能再次上场。<br><br>战斗后武将进入疲劳状态,若立即再次出场则初始体力值-1。<br><br>战斗中本方武将行动时可召唤后援,令一名未出场的已方武将加入战斗。后援武将在战斗结束后无论存活与否均不能再次出场<br><br>当取得12场胜利或所有武将全部阵亡后结束,并根据胜场数获得随机奖励<li>" +
|
|
|
|
|
"修改金钱:<br>game.changeMoney<br>修改招募令:<br>game.changeDust</ul>",
|
2020-11-05 08:26:02 +00:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
});
|