Merge remote-tracking branch 'refs/remotes/ckcz123/v2.0' into v2.x
This commit is contained in:
commit
bd60e15685
@ -342,7 +342,7 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
setValue_s
|
setValue_s
|
||||||
: '变量设置' ':' '名称' idString_e '值' expression Newline
|
: '数值操作' ':' '名称' idString_e '值' expression Newline
|
||||||
|
|
||||||
|
|
||||||
/* setValue_s
|
/* setValue_s
|
||||||
|
|||||||
@ -245,6 +245,18 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
"_data": "显示在状态栏中的层数"
|
"_data": "显示在状态栏中的层数"
|
||||||
},
|
},
|
||||||
|
"width": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "textarea",
|
||||||
|
"_range": "false",
|
||||||
|
"_data": "地图x方向大小,这里不能更改,仅能在新建地图时设置,null视为13"
|
||||||
|
},
|
||||||
|
"height": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "textarea",
|
||||||
|
"_range": "false",
|
||||||
|
"_data": "地图y方向大小,这里不能更改,仅能在新建地图时设置,null视为13"
|
||||||
|
},
|
||||||
"canFlyTo": {
|
"canFlyTo": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "checkbox",
|
"_type": "checkbox",
|
||||||
|
|||||||
@ -89,6 +89,10 @@ body {
|
|||||||
height: 630px;
|
height: 630px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#mapEdit {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.map {
|
.map {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 20px;
|
left: 20px;
|
||||||
|
|||||||
@ -82,6 +82,10 @@ body {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#mapEdit {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.map {
|
.map {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 4vw;
|
left: 4vw;
|
||||||
|
|||||||
@ -426,6 +426,12 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"_bool": "bool",
|
"_bool": "bool",
|
||||||
"_data": "是否在状态栏显示三色钥匙数量"
|
"_data": "是否在状态栏显示三色钥匙数量"
|
||||||
},
|
},
|
||||||
|
"enablePZF": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "checkbox",
|
||||||
|
"_bool": "bool",
|
||||||
|
"_data": "是否在状态栏显示破炸飞数量"
|
||||||
|
},
|
||||||
"enableDebuff": {
|
"enableDebuff": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "checkbox",
|
"_type": "checkbox",
|
||||||
|
|||||||
@ -18,9 +18,10 @@ editor.prototype.init = function (callback) {
|
|||||||
return editor.ids[[editor.indexs[parseInt(v)][0]]]
|
return editor.ids[[editor.indexs[parseInt(v)][0]]]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
editor.updateMap();
|
|
||||||
editor.currentFloorId = core.status.floorId;
|
editor.currentFloorId = core.status.floorId;
|
||||||
editor.currentFloorData = core.floors[core.status.floorId];
|
editor.currentFloorData = core.floors[core.status.floorId];
|
||||||
|
editor.updateMap();
|
||||||
|
editor.buildMark();
|
||||||
editor.drawEventBlock();
|
editor.drawEventBlock();
|
||||||
if (Boolean(callback)) callback();
|
if (Boolean(callback)) callback();
|
||||||
});
|
});
|
||||||
@ -159,12 +160,13 @@ editor.prototype.drawInitData = function (icons) {
|
|||||||
}
|
}
|
||||||
editor.prototype.mapInit = function () {
|
editor.prototype.mapInit = function () {
|
||||||
var ec = document.getElementById('event').getContext('2d');
|
var ec = document.getElementById('event').getContext('2d');
|
||||||
ec.clearRect(0, 0, 416, 416);
|
ec.clearRect(0, 0, core.bigmap.width*32, core.bigmap.height*32);
|
||||||
document.getElementById('event2').getContext('2d').clearRect(0, 0, 416, 416);
|
document.getElementById('event2').getContext('2d').clearRect(0, 0, core.bigmap.width*32, core.bigmap.height*32);
|
||||||
editor.map = [];
|
editor.map = [];
|
||||||
for (var y = 0; y < 13; y++) {
|
var sy=editor.currentFloorData.map.length,sy=editor.currentFloorData.map[0].length;
|
||||||
|
for (var y = 0; y < sy; y++) {
|
||||||
editor.map[y] = [];
|
editor.map[y] = [];
|
||||||
for (var x = 0; x < 13; x++) {
|
for (var x = 0; x < sx; x++) {
|
||||||
editor.map[y][x] = 0;
|
editor.map[y][x] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,23 +202,23 @@ editor.prototype.drawEventBlock = function () {
|
|||||||
fg.clearRect(0, 0, 416, 416);
|
fg.clearRect(0, 0, 416, 416);
|
||||||
for (var i=0;i<13;i++) {
|
for (var i=0;i<13;i++) {
|
||||||
for (var j=0;j<13;j++) {
|
for (var j=0;j<13;j++) {
|
||||||
var color=null;
|
var color=[];
|
||||||
var loc=i+","+j;
|
var loc=(i+core.bigmap.offsetX/32)+","+(j+core.bigmap.offsetY/32);
|
||||||
if (core.isset(editor.currentFloorData.events[loc]))
|
if (core.isset(editor.currentFloorData.events[loc]))
|
||||||
color = '#FF0000';
|
color.push('#FF0000');
|
||||||
else if (core.isset(editor.currentFloorData.changeFloor[loc]))
|
if (core.isset(editor.currentFloorData.changeFloor[loc]))
|
||||||
color = '#00FF00';
|
color.push('#00FF00');
|
||||||
else if (core.isset(editor.currentFloorData.afterBattle[loc]))
|
if (core.isset(editor.currentFloorData.afterBattle[loc]))
|
||||||
color = '#FFFF00';
|
color.push('#FFFF00');
|
||||||
else if (core.isset(editor.currentFloorData.afterGetItem[loc]))
|
if (core.isset(editor.currentFloorData.afterGetItem[loc]))
|
||||||
color = '#00FFFF';
|
color.push('#00FFFF');
|
||||||
else if (core.isset(editor.currentFloorData.afterOpenDoor[loc]))
|
if (core.isset(editor.currentFloorData.afterOpenDoor[loc]))
|
||||||
color = '#FF00FF';
|
color.push('#FF00FF');
|
||||||
else if (core.isset(editor.currentFloorData.cannotMove[loc]))
|
if (core.isset(editor.currentFloorData.cannotMove[loc]))
|
||||||
color = '#0000FF';
|
color.push('#0000FF');
|
||||||
if (color!=null) {
|
for(var kk=0,cc;cc=color[kk];kk++){
|
||||||
fg.fillStyle = color;
|
fg.fillStyle = cc;
|
||||||
fg.fillRect(32*i, 32*j+32-8, 8, 8);
|
fg.fillRect(32*i+8*kk, 32*j+32-8, 8, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +229,7 @@ editor.prototype.updateMap = function () {
|
|||||||
return v.map(function (v) {
|
return v.map(function (v) {
|
||||||
return v.idnum || v || 0
|
return v.idnum || v || 0
|
||||||
})
|
})
|
||||||
}), {'events': {}, 'changeFloor': {}});
|
}), {'events': {}, 'changeFloor': {}}, editor.currentFloorId);
|
||||||
core.status.thisMap.blocks = blocks;
|
core.status.thisMap.blocks = blocks;
|
||||||
main.editor.updateMap();
|
main.editor.updateMap();
|
||||||
|
|
||||||
@ -252,96 +254,10 @@ editor.prototype.updateMap = function () {
|
|||||||
}
|
}
|
||||||
//ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
//ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// autotile的相关处理
|
|
||||||
var indexArrs = [ //16种组合的图块索引数组; // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块
|
|
||||||
// +----+----+----+----+----+----+
|
|
||||||
[10, 9, 4, 3 ], //0 bin:0000 | 1 | 2 | 3 | 4 | 5 | 6 |
|
|
||||||
[10, 9, 4, 13], //1 bin:0001 +----+----+----+----+----+----+
|
|
||||||
[10, 9, 18, 3 ], //2 bin:0010 | 7 | 8 | 9 | 10 | 11 | 12 |
|
|
||||||
[10, 9, 16, 15], //3 bin:0011 +----+----+----+----+----+----+
|
|
||||||
[10, 43, 4, 3 ], //4 bin:0100 | 13 | 14 | 15 | 16 | 17 | 18 |
|
|
||||||
[10, 31, 4, 25], //5 bin:0101 +----+----+----+----+----+----+
|
|
||||||
[10, 7, 2, 3 ], //6 bin:0110 | 19 | 20 | 21 | 22 | 23 | 24 |
|
|
||||||
[10, 31, 16, 5 ], //7 bin:0111 +----+----+----+----+----+----+
|
|
||||||
[48, 9, 4, 3 ], //8 bin:1000 | 25 | 26 | 27 | 28 | 29 | 30 |
|
|
||||||
[ 8, 9, 4, 1 ], //9 bin:1001 +----+----+----+----+----+----+
|
|
||||||
[36, 9, 30, 3 ], //10 bin:1010 | 31 | 32 | 33 | 34 | 35 | 36 |
|
|
||||||
[36, 9, 6, 15], //11 bin:1011 +----+----+----+----+----+----+
|
|
||||||
[46, 45, 4, 3 ], //12 bin:1100 | 37 | 38 | 39 | 40 | 41 | 42 |
|
|
||||||
[46, 11, 4, 25], //13 bin:1101 +----+----+----+----+----+----+
|
|
||||||
[12, 45, 30, 3 ], //14 bin:1110 | 43 | 44 | 45 | 46 | 47 | 48 |
|
|
||||||
[34, 33, 28, 27] //15 bin:1111 +----+----+----+----+----+----+
|
|
||||||
];
|
|
||||||
var drawBlockByIndex = function(ctx, dx, dy, autotileImg, index){ //index为autotile的图块索引1-48
|
|
||||||
var sx = 16*((index-1)%6), sy = 16*(~~((index-1)/6));
|
|
||||||
ctx.drawImage(autotileImg, sx, sy, 16, 16, dx, dy, 16, 16);
|
|
||||||
}
|
|
||||||
var isAutotile = function(info){
|
|
||||||
if(typeof(info)=='object' && hasOwnProp(info, 'images') && info.images=='autotile') return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var getAutotileAroundId = function(currId, x, y){ //与autotile当前idnum一致返回1,否则返回0
|
|
||||||
if(x>=0 && y >=0 && x<13 && y<13 && isAutotile(editor.map[y][x]) && editor.map[y][x].idnum == currId)
|
|
||||||
return 1;
|
|
||||||
else if(x<0 || y<0 || x>12 || y>12) return 1; //边界外视为通用autotile,这样好看些
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
var checkAround = function(x, y){ // 得到周围四个32*32块(周围每块都包含当前块的1/4,不清楚的话画下图你就明白)的数组索引
|
|
||||||
var currId = editor.map[y][x].idnum;
|
|
||||||
var pointBlock = [];
|
|
||||||
for(var i=0; i<4; i++){
|
|
||||||
var bsum = 0;
|
|
||||||
var offsetx = i%2, offsety = ~~(i/2);
|
|
||||||
for(var j=0; j<4; j++){
|
|
||||||
var mx = j%2, my = ~~(j/2);
|
|
||||||
var b = getAutotileAroundId(currId, x+offsetx+mx-1, y+offsety+my-1);
|
|
||||||
bsum += b*(Math.pow(2, 3-j));
|
|
||||||
}
|
|
||||||
pointBlock.push(bsum);
|
|
||||||
}
|
|
||||||
return pointBlock;
|
|
||||||
}
|
|
||||||
var addIndexToAutotileInfo = function(x, y){
|
|
||||||
var indexArr = [];
|
|
||||||
var pointBlocks = checkAround(x, y);
|
|
||||||
for(var i=0; i<4; i++){
|
|
||||||
var arr = indexArrs[pointBlocks[i]]
|
|
||||||
indexArr.push(arr[3-i]);
|
|
||||||
}
|
|
||||||
editor.map[y][x].blockIndex = indexArr;
|
|
||||||
}
|
|
||||||
var drawAutotile = function(ctx, x, y, info){ // 绘制一个autotile
|
|
||||||
ctx.clearRect(x*32, y*32, 32, 32);
|
|
||||||
//修正四个边角的固定搭配
|
|
||||||
if(info.blockIndex[0] == 13){
|
|
||||||
if(info.blockIndex[1] == 16) info.blockIndex[1] = 14;
|
|
||||||
if(info.blockIndex[2] == 31) info.blockIndex[2] = 19;
|
|
||||||
}
|
|
||||||
if(info.blockIndex[1] == 18){
|
|
||||||
if(info.blockIndex[0] == 15) info.blockIndex[0] = 17;
|
|
||||||
if(info.blockIndex[3] == 36) info.blockIndex[3] = 24;
|
|
||||||
}
|
|
||||||
if(info.blockIndex[2] == 43){
|
|
||||||
if(info.blockIndex[0] == 25) info.blockIndex[0] = 37;
|
|
||||||
if(info.blockIndex[3] == 46) info.blockIndex[3] = 44;
|
|
||||||
}
|
|
||||||
if(info.blockIndex[3] == 48){
|
|
||||||
if(info.blockIndex[1] == 30) info.blockIndex[1] = 42;
|
|
||||||
if(info.blockIndex[2] == 45) info.blockIndex[2] = 47;
|
|
||||||
}
|
|
||||||
for(var i=0; i<4; i++){
|
|
||||||
var index = info.blockIndex[i];
|
|
||||||
var dx = x*32 + 16*(i%2), dy = y*32 + 16*(~~(i/2));
|
|
||||||
drawBlockByIndex(ctx, dx, dy, editor.material.images[info.images][info.id], index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// 绘制地图 start
|
// 绘制地图 start
|
||||||
var eventCtx = document.getElementById('event').getContext("2d");
|
var eventCtx = document.getElementById('event').getContext("2d");
|
||||||
for (var y = 0; y < 13; y++)
|
for (var y = 0; y < editor.map.length; y++)
|
||||||
for (var x = 0; x < 13; x++) {
|
for (var x = 0; x < editor.map[0].length; x++) {
|
||||||
var tileInfo = editor.map[y][x];
|
var tileInfo = editor.map[y][x];
|
||||||
if (false && isAutotile(tileInfo)) {
|
if (false && isAutotile(tileInfo)) {
|
||||||
addIndexToAutotileInfo(x, y);
|
addIndexToAutotileInfo(x, y);
|
||||||
@ -352,6 +268,64 @@ editor.prototype.updateMap = function () {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editor.prototype.buildMark = function(){
|
||||||
|
// 生成定位编号
|
||||||
|
var arrColMark=document.getElementById('arrColMark');
|
||||||
|
var arrRowMark=document.getElementById('arrRowMark');
|
||||||
|
var mapColMark=document.getElementById('mapColMark');
|
||||||
|
var mapRowMark=document.getElementById('mapRowMark');
|
||||||
|
var buildMark = function (offsetX,offsetY) {
|
||||||
|
var colNum = ' ';
|
||||||
|
for (var i = 0; i < 13; i++) {
|
||||||
|
var tpl = '<td>' + (i+offsetX) + '<div class="colBlock" style="left:' + (i * 32 + 1) + 'px;"></div></td>';
|
||||||
|
colNum += tpl;
|
||||||
|
}
|
||||||
|
arrColMark.innerHTML = '<tr>' + colNum + '</tr>';
|
||||||
|
mapColMark.innerHTML = '<tr>' + colNum + '</tr>';
|
||||||
|
var rowNum = ' ';
|
||||||
|
for (var i = 0; i < 13; i++) {
|
||||||
|
var tpl = '<tr><td>' + (i+offsetY) + '<div class="rowBlock" style="top:' + (i * 32 + 1) + 'px;"></div></td></tr>';
|
||||||
|
rowNum += tpl;
|
||||||
|
}
|
||||||
|
arrRowMark.innerHTML = rowNum;
|
||||||
|
mapRowMark.innerHTML = rowNum;
|
||||||
|
}
|
||||||
|
var buildMark_mobile = function (offsetX,offsetY) {
|
||||||
|
var colNum = ' ';
|
||||||
|
for (var i = 0; i < 13; i++) {
|
||||||
|
var tpl = '<td>' + (' '+i).slice(-2).replace(' ',' ') + '<div class="colBlock" style="left:' + (i * 96/13 ) + 'vw;"></div></td>';
|
||||||
|
colNum += tpl;
|
||||||
|
}
|
||||||
|
arrColMark.innerHTML = '<tr>' + colNum + '</tr>';
|
||||||
|
//mapColMark.innerHTML = '<tr>' + colNum + '</tr>';
|
||||||
|
var rowNum = ' ';
|
||||||
|
for (var i = 0; i < 13; i++) {
|
||||||
|
var tpl = '<tr><td>' + (' '+i).slice(-2).replace(' ',' ') + '<div class="rowBlock" style="top:' + (i * 96/13 ) + 'vw;"></div></td></tr>';
|
||||||
|
rowNum += tpl;
|
||||||
|
}
|
||||||
|
arrRowMark.innerHTML = rowNum;
|
||||||
|
//mapRowMark.innerHTML = rowNum;
|
||||||
|
//=====
|
||||||
|
var colNum = ' ';
|
||||||
|
for (var i = 0; i < 13; i++) {
|
||||||
|
var tpl = '<div class="coltd" style="left:' + (i * 96/13 ) + 'vw;"><div class="coltext">' + (' '+(i+offsetX)).slice(-2).replace(' ',' ') + '</div><div class="colBlock"></div></div>';
|
||||||
|
colNum += tpl;
|
||||||
|
}
|
||||||
|
mapColMark.innerHTML = '<div class="coltr">' + colNum + '</div>';
|
||||||
|
var rowNum = ' ';
|
||||||
|
for (var i = 0; i < 13; i++) {
|
||||||
|
var tpl = '<div class="rowtr"><div class="rowtd" style="top:' + (i * 96/13 ) + 'vw;"><div class="rowtext">' + (' '+(i+offsetY)).slice(-2).replace(' ',' ') + '</div><div class="rowBlock"></div></div></div>';
|
||||||
|
rowNum += tpl;
|
||||||
|
}
|
||||||
|
mapRowMark.innerHTML = rowNum;
|
||||||
|
}
|
||||||
|
if(editor.isMobile){
|
||||||
|
buildMark_mobile(core.bigmap.offsetX/32,core.bigmap.offsetY/32);
|
||||||
|
} else {
|
||||||
|
buildMark(core.bigmap.offsetX/32,core.bigmap.offsetY/32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
editor.prototype.changeFloor = function (floorId, callback) {
|
editor.prototype.changeFloor = function (floorId, callback) {
|
||||||
editor.currentFloorData.map = editor.map.map(function (v) {
|
editor.currentFloorData.map = editor.map.map(function (v) {
|
||||||
return v.map(function (v) {
|
return v.map(function (v) {
|
||||||
@ -366,9 +340,9 @@ editor.prototype.changeFloor = function (floorId, callback) {
|
|||||||
return editor.ids[[editor.indexs[parseInt(v)][0]]]
|
return editor.ids[[editor.indexs[parseInt(v)][0]]]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
editor.updateMap();
|
|
||||||
editor.currentFloorId = core.status.floorId;
|
editor.currentFloorId = core.status.floorId;
|
||||||
editor.currentFloorData = core.floors[core.status.floorId];
|
editor.currentFloorData = core.floors[core.status.floorId];
|
||||||
|
editor.updateMap();
|
||||||
editor_mode.floor();
|
editor_mode.floor();
|
||||||
editor.drawEventBlock();
|
editor.drawEventBlock();
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
@ -394,7 +368,7 @@ editor.prototype.listen = function () {
|
|||||||
|
|
||||||
function fillPos(pos) {
|
function fillPos(pos) {
|
||||||
uc.fillStyle = '#' + ~~(Math.random() * 8) + ~~(Math.random() * 8) + ~~(Math.random() * 8);
|
uc.fillStyle = '#' + ~~(Math.random() * 8) + ~~(Math.random() * 8) + ~~(Math.random() * 8);
|
||||||
uc.fillRect(pos.x * 32 + 12, pos.y * 32 + 12, 8, 8);
|
uc.fillRect(pos.x * 32 + 12 - core.bigmap.offsetX, pos.y * 32 + 12 - core.bigmap.offsetY, 8, 8);
|
||||||
}//在格子内画一个随机色块
|
}//在格子内画一个随机色块
|
||||||
|
|
||||||
function eToLoc(e) {
|
function eToLoc(e) {
|
||||||
@ -410,8 +384,13 @@ editor.prototype.listen = function () {
|
|||||||
return editor.loc;
|
return editor.loc;
|
||||||
}//返回可用的组件内坐标
|
}//返回可用的组件内坐标
|
||||||
|
|
||||||
function locToPos(loc) {
|
function locToPos(loc, addViewportOffset) {
|
||||||
editor.pos = {'x': ~~(loc.x / loc.size), 'y': ~~(loc.y / loc.size)}
|
var offsetX=0, offsetY=0;
|
||||||
|
if (addViewportOffset){
|
||||||
|
offsetX=core.bigmap.offsetX/32;
|
||||||
|
offsetY=core.bigmap.offsetY/32;
|
||||||
|
}
|
||||||
|
editor.pos = {'x': ~~(loc.x / loc.size)+offsetX, 'y': ~~(loc.y / loc.size)+offsetY}
|
||||||
return editor.pos;
|
return editor.pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,13 +415,13 @@ editor.prototype.listen = function () {
|
|||||||
eui.onmousedown = function (e) {
|
eui.onmousedown = function (e) {
|
||||||
if (e.button==2){
|
if (e.button==2){
|
||||||
var loc = eToLoc(e);
|
var loc = eToLoc(e);
|
||||||
var pos = locToPos(loc);
|
var pos = locToPos(loc,true);
|
||||||
editor.showMidMenu(e.clientX,e.clientY);
|
editor.showMidMenu(e.clientX,e.clientY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!selectBox.isSelected) {
|
if (!selectBox.isSelected) {
|
||||||
var loc = eToLoc(e);
|
var loc = eToLoc(e);
|
||||||
var pos = locToPos(loc);
|
var pos = locToPos(loc,true);
|
||||||
editor_mode.onmode('nextChange');
|
editor_mode.onmode('nextChange');
|
||||||
editor_mode.onmode('loc');
|
editor_mode.onmode('loc');
|
||||||
//editor_mode.loc();
|
//editor_mode.loc();
|
||||||
@ -458,7 +437,7 @@ editor.prototype.listen = function () {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
uc.clearRect(0, 0, 416, 416);
|
uc.clearRect(0, 0, 416, 416);
|
||||||
var loc = eToLoc(e);
|
var loc = eToLoc(e);
|
||||||
var pos = locToPos(loc);
|
var pos = locToPos(loc,true);
|
||||||
stepPostfix = [];
|
stepPostfix = [];
|
||||||
stepPostfix.push(pos);
|
stepPostfix.push(pos);
|
||||||
fillPos(pos);
|
fillPos(pos);
|
||||||
@ -476,7 +455,7 @@ editor.prototype.listen = function () {
|
|||||||
mouseOutCheck = 2;
|
mouseOutCheck = 2;
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
var loc = eToLoc(e);
|
var loc = eToLoc(e);
|
||||||
var pos = locToPos(loc);
|
var pos = locToPos(loc,true);
|
||||||
var pos0 = stepPostfix[stepPostfix.length - 1]
|
var pos0 = stepPostfix[stepPostfix.length - 1]
|
||||||
var directionDistance = [pos.y - pos0.y, pos0.x - pos.x, pos0.y - pos.y, pos.x - pos0.x]
|
var directionDistance = [pos.y - pos0.y, pos0.x - pos.x, pos0.y - pos.y, pos.x - pos0.x]
|
||||||
var max = 0, index = 4;
|
var max = 0, index = 4;
|
||||||
@ -532,6 +511,24 @@ editor.prototype.listen = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
document.getElementById('mid').onkeydown = function (e) {
|
||||||
|
console.log(e);
|
||||||
|
if (e.keyCode==37) {
|
||||||
|
editor.moveViewport(-1, 0);
|
||||||
|
}
|
||||||
|
if (e.keyCode==38) {
|
||||||
|
editor.moveViewport(0, -1);
|
||||||
|
}
|
||||||
|
if (e.keyCode==39) {
|
||||||
|
editor.moveViewport(1, 0);
|
||||||
|
}
|
||||||
|
if (e.keyCode==40) {
|
||||||
|
editor.moveViewport(0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
document.getElementById('mid').onmousewheel = function (e) {
|
document.getElementById('mid').onmousewheel = function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var wheel = function (direct) {
|
var wheel = function (direct) {
|
||||||
@ -864,6 +861,24 @@ editor.prototype.listen = function () {
|
|||||||
editor.brushMod=brushMod2.value;
|
editor.brushMod=brushMod2.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
editor.moveViewport=function(x,y){
|
||||||
|
core.bigmap.offsetX = core.clamp(core.bigmap.offsetX+32*x, 0, 32*core.bigmap.width-416);
|
||||||
|
core.bigmap.offsetY = core.clamp(core.bigmap.offsetY+32*y, 0, 32*core.bigmap.height-416);
|
||||||
|
core.control.updateViewport();
|
||||||
|
editor.buildMark();
|
||||||
|
editor.drawEventBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
var viewportButtons=document.getElementById('viewportButtons');
|
||||||
|
for(var ii=0,node;node=viewportButtons.children[ii];ii++){
|
||||||
|
(function(x,y){
|
||||||
|
node.onclick=function(){
|
||||||
|
editor.moveViewport(x,y);
|
||||||
|
}
|
||||||
|
})([-1,0,0,1][ii],[0,-1,1,0][ii]);
|
||||||
|
}
|
||||||
|
|
||||||
}//绑定事件
|
}//绑定事件
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -83,12 +83,21 @@ editor_file = function (editor, callback) {
|
|||||||
} */
|
} */
|
||||||
var filename = 'project/floors/' + editor.currentFloorId + '.js';
|
var filename = 'project/floors/' + editor.currentFloorId + '.js';
|
||||||
var datastr = ['main.floors.', editor.currentFloorId, '=\n{'];
|
var datastr = ['main.floors.', editor.currentFloorId, '=\n{'];
|
||||||
if (editor.currentFloorData.map == 'new')
|
if (editor.currentFloorData.map == 'new') {
|
||||||
|
/*
|
||||||
editor.currentFloorData.map = editor.map.map(function (v) {
|
editor.currentFloorData.map = editor.map.map(function (v) {
|
||||||
return v.map(function () {
|
return v.map(function () {
|
||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
var width = parseInt(document.getElementById('newMapWidth').value);
|
||||||
|
var height = parseInt(document.getElementById('newMapHeight').value);
|
||||||
|
var row = [];
|
||||||
|
for (var i=0;i<width;i++) row.push(0);
|
||||||
|
editor.currentFloorData.map = [];
|
||||||
|
for (var i=0;i<height;i++) editor.currentFloorData.map.push(row);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
editor.currentFloorData.map = editor.map.map(function (v) {
|
editor.currentFloorData.map = editor.map.map(function (v) {
|
||||||
return v.map(function (v) {
|
return v.map(function (v) {
|
||||||
@ -115,14 +124,15 @@ editor_file = function (editor, callback) {
|
|||||||
if (!isset(callback)) {
|
if (!isset(callback)) {
|
||||||
printe('未设置callback');
|
printe('未设置callback');
|
||||||
throw('未设置callback')
|
throw('未设置callback')
|
||||||
}
|
};
|
||||||
;
|
|
||||||
var currData=editor.currentFloorData;
|
var currData=editor.currentFloorData;
|
||||||
var saveStatus = document.getElementById('newMapStatus').checked;
|
var saveStatus = document.getElementById('newMapStatus').checked;
|
||||||
editor.currentFloorData = {
|
editor.currentFloorData = {
|
||||||
floorId: saveFilename,
|
floorId: saveFilename,
|
||||||
title: saveStatus?currData.title:"新建楼层",
|
title: saveStatus?currData.title:"新建楼层",
|
||||||
name: saveStatus?currData.name:"0",
|
name: saveStatus?currData.name:"0",
|
||||||
|
width: parseInt(document.getElementById('newMapWidth').value),
|
||||||
|
height: parseInt(document.getElementById('newMapHeight').value),
|
||||||
canFlyTo: saveStatus?currData.canFlyTo:true,
|
canFlyTo: saveStatus?currData.canFlyTo:true,
|
||||||
canUseQuickShop: saveStatus?currData.canUseQuickShop:true,
|
canUseQuickShop: saveStatus?currData.canUseQuickShop:true,
|
||||||
cannotViewMap: saveStatus?currData.cannotViewMap:false,
|
cannotViewMap: saveStatus?currData.cannotViewMap:false,
|
||||||
@ -695,19 +705,20 @@ editor_file = function (editor, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var formatMap = function (mapArr) {
|
var formatMap = function (mapArr) {
|
||||||
//把13*13或者1*169数组格式化
|
//把二维数组格式化
|
||||||
var formatArrStr = '';
|
var formatArrStr = '';
|
||||||
var arr = JSON.stringify(mapArr).replace(/\s+/g, '').split('],[');
|
var arr = JSON.stringify(mapArr).replace(/\s+/g, '').split('],[');
|
||||||
for (var i = 0; i < 13; i++) {
|
var si=mapArr.length-1,sk=mapArr[0].length-1;
|
||||||
|
for (var i = 0; i <= si; i++) {
|
||||||
var a = [];
|
var a = [];
|
||||||
formatArrStr += ' [';
|
formatArrStr += ' [';
|
||||||
if (i == 0 || i == 12) a = arr[i].split(/\D+/).join(' ').trim().split(' ');
|
if (i == 0 || i == si) a = arr[i].split(/\D+/).join(' ').trim().split(' ');
|
||||||
else a = arr[i].split(/\D+/);
|
else a = arr[i].split(/\D+/);
|
||||||
for (var k = 0; k < 13; k++) {
|
for (var k = 0; k <= sk; k++) {
|
||||||
var num = parseInt(a[k]);
|
var num = parseInt(a[k]);
|
||||||
formatArrStr += Array(Math.max(4 - String(num).length, 0)).join(' ') + num + (k == 12 ? '' : ',');
|
formatArrStr += Array(Math.max(4 - String(num).length, 0)).join(' ') + num + (k == sk ? '' : ',');
|
||||||
}
|
}
|
||||||
formatArrStr += ']' + (i == 12 ? '' : ',\n');
|
formatArrStr += ']' + (i == si ? '' : ',\n');
|
||||||
}
|
}
|
||||||
return formatArrStr;
|
return formatArrStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -469,6 +469,12 @@ editor_mode = function (editor) {
|
|||||||
printe("楼层名不合法!请使用字母、数字、下划线,且不能以数字开头!");
|
printe("楼层名不合法!请使用字母、数字、下划线,且不能以数字开头!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var width = parseInt(document.getElementById('newMapWidth').value);
|
||||||
|
var height = parseInt(document.getElementById('newMapHeight').value);
|
||||||
|
if (!core.isset(width) || !core.isset(height) || width<13 || height<13 || width*height>1000) {
|
||||||
|
printe("新建地图的宽高都不得小于13,且宽高之积不能超过1000");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
editor_mode.onmode('');
|
editor_mode.onmode('');
|
||||||
editor.file.saveNewFile(newFileName.value, function (err) {
|
editor.file.saveNewFile(newFileName.value, function (err) {
|
||||||
|
|||||||
@ -24,7 +24,14 @@ document.body.onmousedown = function (e) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (clickpath.indexOf('edit') === -1 && clickpath.indexOf('tip') === -1 && clickpath.indexOf('brushMod') === -1 && clickpath.indexOf('brushMod2') === -1) {
|
var unselect=true;
|
||||||
|
for(var ii=0,thisId;thisId=['edit','tip','brushMod','brushMod2','viewportButtons'][ii];ii++){
|
||||||
|
if (clickpath.indexOf(thisId) !== -1){
|
||||||
|
unselect=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (unselect) {
|
||||||
if (clickpath.indexOf('eui') === -1) {
|
if (clickpath.indexOf('eui') === -1) {
|
||||||
if (selectBox.isSelected) {
|
if (selectBox.isSelected) {
|
||||||
editor_mode.onmode('');
|
editor_mode.onmode('');
|
||||||
@ -60,11 +67,12 @@ var exportMap = new Vue({
|
|||||||
methods: {
|
methods: {
|
||||||
exportMap: function () {
|
exportMap: function () {
|
||||||
editor.updateMap();
|
editor.updateMap();
|
||||||
|
var sx=editor.map.length-1,sy=editor.map[0].length-1;
|
||||||
|
|
||||||
var filestr = '';
|
var filestr = '';
|
||||||
for (var yy = 0; yy < 13; yy++) {
|
for (var yy = 0; yy <= sy; yy++) {
|
||||||
filestr += '['
|
filestr += '['
|
||||||
for (var xx = 0; xx < 13; xx++) {
|
for (var xx = 0; xx <= sx; xx++) {
|
||||||
var mapxy = editor.map[yy][xx];
|
var mapxy = editor.map[yy][xx];
|
||||||
if (typeof(mapxy) == typeof({})) {
|
if (typeof(mapxy) == typeof({})) {
|
||||||
if ('idnum' in mapxy) mapxy = mapxy.idnum;
|
if ('idnum' in mapxy) mapxy = mapxy.idnum;
|
||||||
@ -79,10 +87,10 @@ var exportMap = new Vue({
|
|||||||
}
|
}
|
||||||
mapxy = String(mapxy);
|
mapxy = String(mapxy);
|
||||||
mapxy = Array(Math.max(4 - mapxy.length, 0)).join(' ') + mapxy;
|
mapxy = Array(Math.max(4 - mapxy.length, 0)).join(' ') + mapxy;
|
||||||
filestr += mapxy + (xx == 12 ? '' : ',')
|
filestr += mapxy + (xx == sx ? '' : ',')
|
||||||
}
|
}
|
||||||
|
|
||||||
filestr += ']' + (yy == 12 ? '' : ',\n');
|
filestr += ']' + (yy == sy ? '' : ',\n');
|
||||||
}
|
}
|
||||||
pout.value = filestr;
|
pout.value = filestr;
|
||||||
editArea.mapArr = filestr;
|
editArea.mapArr = filestr;
|
||||||
@ -97,7 +105,7 @@ var editArea = new Vue({
|
|||||||
data: {
|
data: {
|
||||||
mapArr: '',
|
mapArr: '',
|
||||||
errors: [ // 编号1,2,3,4
|
errors: [ // 编号1,2,3,4
|
||||||
"格式错误!请使用正确格式(13*13数组,如不清楚,可先点击生成地图查看正确格式)",
|
"格式错误!请使用正确格式(width*height数组,如不清楚,可先点击生成地图查看正确格式)",
|
||||||
"当前有未定义ID(在地图区域显示红块),请修改ID或者到icons.js和maps.js中进行定义!",
|
"当前有未定义ID(在地图区域显示红块),请修改ID或者到icons.js和maps.js中进行定义!",
|
||||||
"ID越界(在地图区域显示红块),当前编辑器暂时支持编号小于400,请修改编号!",
|
"ID越界(在地图区域显示红块),当前编辑器暂时支持编号小于400,请修改编号!",
|
||||||
// "发生错误!",
|
// "发生错误!",
|
||||||
@ -138,8 +146,9 @@ var editArea = new Vue({
|
|||||||
|
|
||||||
// var mapArray = that.mapArr.split(/\D+/).join(' ').trim().split(' ');
|
// var mapArray = that.mapArr.split(/\D+/).join(' ').trim().split(' ');
|
||||||
var mapArray = JSON.parse('[' + that.mapArr + ']');
|
var mapArray = JSON.parse('[' + that.mapArr + ']');
|
||||||
for (var y = 0; y < 13; y++)
|
var sy=editor.map.length,sx=editor.map[0].length;
|
||||||
for (var x = 0; x < 13; x++) {
|
for (var y = 0; y < sy; y++)
|
||||||
|
for (var x = 0; x < sx; x++) {
|
||||||
var num = mapArray[y][x];
|
var num = mapArray[y][x];
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
editor.map[y][x] = 0;
|
editor.map[y][x] = 0;
|
||||||
@ -159,25 +168,26 @@ var editArea = new Vue({
|
|||||||
var formatArrStr = '';
|
var formatArrStr = '';
|
||||||
var that = this;
|
var that = this;
|
||||||
clearTimeout(that.formatTimer);
|
clearTimeout(that.formatTimer);
|
||||||
if (this.mapArr.split(/\D+/).join(' ').trim().split(' ').length != 169) return false;
|
var si=this.mapArr.length,sk=this.mapArr[0].length;
|
||||||
|
if (this.mapArr.split(/\D+/).join(' ').trim().split(' ').length != si*sk) return false;
|
||||||
var arr = this.mapArr.replace(/\s+/g, '').split('],[');
|
var arr = this.mapArr.replace(/\s+/g, '').split('],[');
|
||||||
|
|
||||||
if (arr.length != 13) return;
|
if (arr.length != si) return;
|
||||||
for (var i = 0; i < 13; i++) {
|
for (var i = 0; i < si; i++) {
|
||||||
var a = [];
|
var a = [];
|
||||||
formatArrStr += '[';
|
formatArrStr += '[';
|
||||||
if (i == 0 || i == 12) a = arr[i].split(/\D+/).join(' ').trim().split(' ');
|
if (i == 0 || i == si-1) a = arr[i].split(/\D+/).join(' ').trim().split(' ');
|
||||||
else a = arr[i].split(/\D+/);
|
else a = arr[i].split(/\D+/);
|
||||||
if (a.length != 13) {
|
if (a.length != sk) {
|
||||||
formatArrStr = '';
|
formatArrStr = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var k = 0; k < 13; k++) {
|
for (var k = 0; k < sk; k++) {
|
||||||
var num = parseInt(a[k]);
|
var num = parseInt(a[k]);
|
||||||
formatArrStr += Array(Math.max(4 - String(num).length, 0)).join(' ') + num + (k == 12 ? '' : ',');
|
formatArrStr += Array(Math.max(4 - String(num).length, 0)).join(' ') + num + (k == sk-1 ? '' : ',');
|
||||||
}
|
}
|
||||||
formatArrStr += ']' + (i == 12 ? '' : ',\n');
|
formatArrStr += ']' + (i == si-1 ? '' : ',\n');
|
||||||
}
|
}
|
||||||
return formatArrStr;
|
return formatArrStr;
|
||||||
}
|
}
|
||||||
|
|||||||
15
docs/api.md
15
docs/api.md
@ -184,22 +184,29 @@ core.enemyExists(x, y, id, floorId)
|
|||||||
x和y为坐标;id为怪物ID,可为null表示任意怪物;floorId为楼层ID,可忽略表示当前楼层。
|
x和y为坐标;id为怪物ID,可为null表示任意怪物;floorId为楼层ID,可忽略表示当前楼层。
|
||||||
|
|
||||||
|
|
||||||
core.getBlock(x, y, floorId, needEnable)
|
core.getBlock(x, y, floorId, showDisable)
|
||||||
获得某个点的当前图块信息。
|
获得某个点的当前图块信息。
|
||||||
x和y为坐标;floorId为楼层ID,可忽略或null表示当前楼层。
|
x和y为坐标;floorId为楼层ID,可忽略或null表示当前楼层。
|
||||||
needEnable表示该点是否启用时才返回,其值不设置则默认为true。
|
showDisable如果为true,则对于禁用的点和事件也会进行返回。
|
||||||
如果该点不存在图块,则返回null。
|
如果该点不存在图块,则返回null。
|
||||||
否则,返回值如下: {"index": xxx, "block": xxx}
|
否则,返回值如下: {"index": xxx, "block": xxx}
|
||||||
其中index为该点在该楼层blocks数组中的索引,block为该图块实际内容。
|
其中index为该点在该楼层blocks数组中的索引,block为该图块实际内容。
|
||||||
|
|
||||||
|
|
||||||
core.getBlockId(x, y, floorId, needEnable)
|
core.getBlockId(x, y, floorId, showDisable)
|
||||||
获得某个点的图块ID。
|
获得某个点的图块ID。
|
||||||
x和y为坐标;floorId为楼层ID,可忽略或null表示当前楼层。
|
x和y为坐标;floorId为楼层ID,可忽略或null表示当前楼层。
|
||||||
needEnable表示是否需要该点处于启用状态才返回,其值不设置则默认为true。
|
showDisable如果为true,则对于禁用的点和事件也会进行返回。
|
||||||
如果该点不存在图块,则返回null,否则返回该点的图块ID。
|
如果该点不存在图块,则返回null,否则返回该点的图块ID。
|
||||||
|
|
||||||
|
|
||||||
|
core.getBlockCls(x, y, floorId, showDisable)
|
||||||
|
获得某个点的图块cls。
|
||||||
|
x和y为坐标;floorId为楼层ID,可忽略或null表示当前楼层。
|
||||||
|
showDisable如果为true,则对于禁用的点和事件也会进行返回。
|
||||||
|
如果该点不存在图块,则返回null,否则返回该点的图块cls。
|
||||||
|
|
||||||
|
|
||||||
core.showBlock(x, y, floorId)
|
core.showBlock(x, y, floorId)
|
||||||
将某个点从禁用变成启用状态。
|
将某个点从禁用变成启用状态。
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@ HTML5魔塔是使用画布(canvas)来绘制,存在若干个图层,它们
|
|||||||
- animate:动画层;主要用来绘制动画,图块的淡入/淡出效果,图块的移动。showImage事件绘制的图片也是在这一层。
|
- animate:动画层;主要用来绘制动画,图块的淡入/淡出效果,图块的移动。showImage事件绘制的图片也是在这一层。
|
||||||
- weather:天气层;主要用来绘制天气(雨/雪)
|
- weather:天气层;主要用来绘制天气(雨/雪)
|
||||||
- curtain:色调层;用来控制当前楼层的画面色调
|
- curtain:色调层;用来控制当前楼层的画面色调
|
||||||
|
- route:路线层;主要用来绘制勇士的行走路线图
|
||||||
- ui:UI层;用来绘制一切UI窗口,如剧情文本、怪物手册、楼传器、系统菜单等等
|
- ui:UI层;用来绘制一切UI窗口,如剧情文本、怪物手册、楼传器、系统菜单等等
|
||||||
- data:数据层;用来绘制一些顶层的或更新比较快的数据,如左上角的提示,战斗界面中数据的变化等等。
|
- data:数据层;用来绘制一些顶层的或更新比较快的数据,如左上角的提示,战斗界面中数据的变化等等。
|
||||||
|
|
||||||
@ -299,7 +300,7 @@ enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, her
|
|||||||
// 检查领域、夹击、阻击事件
|
// 检查领域、夹击、阻击事件
|
||||||
control.prototype.checkBlock = function () {
|
control.prototype.checkBlock = function () {
|
||||||
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
||||||
var damage = core.status.checkBlock.damage[13*x+y];
|
var damage = core.status.checkBlock.damage[x+core.bigmap.width*y];
|
||||||
if (damage>0) {
|
if (damage>0) {
|
||||||
if (core.hasFlag("shield5")) damage = 0; // 如果存在神圣盾,则将伤害变成0
|
if (core.hasFlag("shield5")) damage = 0; // 如果存在神圣盾,则将伤害变成0
|
||||||
core.status.hero.hp -= damage;
|
core.status.hero.hp -= damage;
|
||||||
|
|||||||
@ -24,9 +24,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="editTip" style="position: absolute; width: 95vw;margin-bottom: 10%;bottom: 0;left: 4vw;">
|
<div id="editTip" style="position: absolute; width: 95vw;margin-bottom: 10%;bottom: 0;left: 4vw;">
|
||||||
<input type="button" value="新建空白地图" id='newMap'/>
|
<input type="button" value="新建空白地图" id='newMap'/>
|
||||||
<input id='newFileName' placeholder="输入新楼层id" style="width: 120px"/>
|
<input id='newFileName' placeholder="新楼层id" style="width: 70px"/>
|
||||||
|
<span style="vertical-align: bottom">宽</span>
|
||||||
|
<input id='newMapWidth' value="13" style="width: 20px"/>
|
||||||
|
<span style="vertical-align: bottom">高</span>
|
||||||
|
<input id='newMapHeight' value="13" style="width: 20px"/>
|
||||||
<input type="checkbox" id='newMapStatus' checked='checked' style='vertical-align: bottom'/>
|
<input type="checkbox" id='newMapStatus' checked='checked' style='vertical-align: bottom'/>
|
||||||
<span style='vertical-align: bottom; margin-left: -4px'>保留楼层属性</span>
|
<span style='vertical-align: bottom; margin-left: -4px'>保留属性</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="position: absolute;left: 10px;bottom:0; margin-bottom: 0%">
|
<div style="position: absolute;left: 10px;bottom:0; margin-bottom: 0%">
|
||||||
<input type="button" value="导出地图" id="exportMap" v-on:click="exportMap"/>
|
<input type="button" value="导出地图" id="exportMap" v-on:click="exportMap"/>
|
||||||
@ -268,7 +272,12 @@
|
|||||||
<option value="line">画线</option>
|
<option value="line">画线</option>
|
||||||
<option value="rectangle">画矩形</option>
|
<option value="rectangle">画矩形</option>
|
||||||
</select>
|
</select>
|
||||||
<br>
|
<div id="viewportButtons">
|
||||||
|
<input type="button" value="←"/>
|
||||||
|
<input type="button" value="↑"/>
|
||||||
|
<input type="button" value="↓"/>
|
||||||
|
<input type="button" value="→"/>
|
||||||
|
</div>
|
||||||
<select id="selectFloor"></select>
|
<select id="selectFloor"></select>
|
||||||
<input type="button" value="保存地图" id='saveFloor'/>
|
<input type="button" value="保存地图" id='saveFloor'/>
|
||||||
<span id='mobileeditdata' style="display:none">
|
<span id='mobileeditdata' style="display:none">
|
||||||
@ -363,11 +372,16 @@
|
|||||||
<img id="img-up">
|
<img id="img-up">
|
||||||
<p class='statusLabel' id='up'></p>
|
<p class='statusLabel' id='up'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status" id='keyCol'>
|
||||||
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
||||||
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
||||||
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="status" id='pzfCol'>
|
||||||
|
<span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>
|
||||||
|
<span class='statusLabel' id='bomb' style="color: #FA14B9"></span>
|
||||||
|
<span class='statusLabel' id='fly' style="color: #8DB600"></span>
|
||||||
|
</div>
|
||||||
<div class="status" id="debuffCol">
|
<div class="status" id="debuffCol">
|
||||||
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
||||||
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
||||||
@ -387,50 +401,20 @@
|
|||||||
<div id="gif"></div>
|
<div id="gif"></div>
|
||||||
<div id="gif2"></div>
|
<div id="gif2"></div>
|
||||||
<div id="curtain"></div>
|
<div id="curtain"></div>
|
||||||
<!-- <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas> -->
|
<div id="gameDraw">
|
||||||
<!-- <canvas class='gameCanvas' id='event' width='416' height='416'></canvas> -->
|
<!-- <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas> -->
|
||||||
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
<!-- <canvas class='gameCanvas' id='event' width='416' height='416'></canvas> -->
|
||||||
<!-- <canvas class='gameCanvas' id='event2' width='416' height='416'></canvas> -->
|
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
<!-- <canvas class='gameCanvas' id='event2' width='416' height='416'></canvas> -->
|
||||||
<canvas class='gameCanvas' id='animate' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='animate' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
<canvas class='gameCanvas' id='route' width='416' height='416'></canvas>
|
||||||
|
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
|
||||||
|
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- */</script> -->
|
<!-- */</script> -->
|
||||||
<script>
|
|
||||||
// 生成定位编号
|
|
||||||
(function () {
|
|
||||||
var colNum = ' ';
|
|
||||||
for (var i = 0; i < 13; i++) {
|
|
||||||
var tpl = '<td>' + (' '+i).slice(-2).replace(' ',' ') + '<div class="colBlock" style="left:' + (i * 96/13 ) + 'vw;"></div></td>';
|
|
||||||
colNum += tpl;
|
|
||||||
}
|
|
||||||
arrColMark.innerHTML = '<tr>' + colNum + '</tr>';
|
|
||||||
//mapColMark.innerHTML = '<tr>' + colNum + '</tr>';
|
|
||||||
var rowNum = ' ';
|
|
||||||
for (var i = 0; i < 13; i++) {
|
|
||||||
var tpl = '<tr><td>' + (' '+i).slice(-2).replace(' ',' ') + '<div class="rowBlock" style="top:' + (i * 96/13 ) + 'vw;"></div></td></tr>';
|
|
||||||
rowNum += tpl;
|
|
||||||
}
|
|
||||||
arrRowMark.innerHTML = rowNum;
|
|
||||||
//mapRowMark.innerHTML = rowNum;
|
|
||||||
})();
|
|
||||||
(function () {
|
|
||||||
var colNum = ' ';
|
|
||||||
for (var i = 0; i < 13; i++) {
|
|
||||||
var tpl = '<div class="coltd" style="left:' + (i * 96/13 ) + 'vw;"><div class="coltext">' + (' '+i).slice(-2).replace(' ',' ') + '</div><div class="colBlock"></div></div>';
|
|
||||||
colNum += tpl;
|
|
||||||
}
|
|
||||||
mapColMark.innerHTML = '<div class="coltr">' + colNum + '</div>';
|
|
||||||
var rowNum = ' ';
|
|
||||||
for (var i = 0; i < 13; i++) {
|
|
||||||
var tpl = '<div class="rowtr"><div class="rowtd" style="top:' + (i * 96/13 ) + 'vw;"><div class="rowtext">' + (' '+i).slice(-2).replace(' ',' ') + '</div><div class="rowBlock"></div></div></div>';
|
|
||||||
rowNum += tpl;
|
|
||||||
}
|
|
||||||
mapRowMark.innerHTML = rowNum;
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- =========================================================== -->
|
<!-- =========================================================== -->
|
||||||
|
|
||||||
|
|||||||
62
editor.html
62
editor.html
@ -23,7 +23,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="editTip">
|
<div id="editTip">
|
||||||
<input type="button" value="新建空白地图" id='newMap'/>
|
<input type="button" value="新建空白地图" id='newMap'/>
|
||||||
<input id='newFileName' placeholder="输入新楼层id" style="width: 120px"/>
|
<input id='newFileName' placeholder="新楼层id" style="width: 70px"/>
|
||||||
|
<span style="vertical-align: bottom">宽</span>
|
||||||
|
<input id='newMapWidth' value="13" style="width: 20px"/>
|
||||||
|
<span style="vertical-align: bottom">高</span>
|
||||||
|
<input id='newMapHeight' value="13" style="width: 20px"/>
|
||||||
<input type="checkbox" id='newMapStatus' checked='checked' style='vertical-align: bottom'/>
|
<input type="checkbox" id='newMapStatus' checked='checked' style='vertical-align: bottom'/>
|
||||||
<span style='vertical-align: bottom; margin-left: -4px'>保留楼层属性</span>
|
<span style='vertical-align: bottom; margin-left: -4px'>保留楼层属性</span>
|
||||||
</div>
|
</div>
|
||||||
@ -241,7 +245,14 @@
|
|||||||
<input type="radio" id="brushMod" name="brushMod" value="line" checked="checked" />画线
|
<input type="radio" id="brushMod" name="brushMod" value="line" checked="checked" />画线
|
||||||
<input type="radio" id="brushMod2" name="brushMod" value="rectangle" />画矩形
|
<input type="radio" id="brushMod2" name="brushMod" value="rectangle" />画矩形
|
||||||
</span>
|
</span>
|
||||||
<br><br><br>
|
<br>
|
||||||
|
<div id="viewportButtons">
|
||||||
|
<input type="button" value="←"/>
|
||||||
|
<input type="button" value="↑"/>
|
||||||
|
<input type="button" value="↓"/>
|
||||||
|
<input type="button" value="→"/>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
<select id="selectFloor"></select>
|
<select id="selectFloor"></select>
|
||||||
<input type="button" value="保存地图" id='saveFloor'/>
|
<input type="button" value="保存地图" id='saveFloor'/>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
@ -346,11 +357,16 @@
|
|||||||
<img id="img-up">
|
<img id="img-up">
|
||||||
<p class='statusLabel' id='up'></p>
|
<p class='statusLabel' id='up'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status" id='keyCol'>
|
||||||
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
||||||
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
||||||
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="status" id='pzfCol'>
|
||||||
|
<span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>
|
||||||
|
<span class='statusLabel' id='bomb' style="color: #FA14B9"></span>
|
||||||
|
<span class='statusLabel' id='fly' style="color: #8DB600"></span>
|
||||||
|
</div>
|
||||||
<div class="status" id="debuffCol">
|
<div class="status" id="debuffCol">
|
||||||
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
||||||
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
||||||
@ -370,36 +386,20 @@
|
|||||||
<div id="gif"></div>
|
<div id="gif"></div>
|
||||||
<div id="gif2"></div>
|
<div id="gif2"></div>
|
||||||
<div id="curtain"></div>
|
<div id="curtain"></div>
|
||||||
<!-- <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas> -->
|
<div id="gameDraw">
|
||||||
<!-- <canvas class='gameCanvas' id='event' width='416' height='416'></canvas> -->
|
<!-- <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas> -->
|
||||||
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
<!-- <canvas class='gameCanvas' id='event' width='416' height='416'></canvas> -->
|
||||||
<!-- <canvas class='gameCanvas' id='event2' width='416' height='416'></canvas> -->
|
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
<!-- <canvas class='gameCanvas' id='event2' width='416' height='416'></canvas> -->
|
||||||
<canvas class='gameCanvas' id='animate' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='animate' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
<canvas class='gameCanvas' id='route' width='416' height='416'></canvas>
|
||||||
|
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
|
||||||
|
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- */</script> -->
|
<!-- */</script> -->
|
||||||
<script>
|
|
||||||
// 生成定位编号
|
|
||||||
(function () {
|
|
||||||
var colNum = ' ';
|
|
||||||
for (var i = 0; i < 13; i++) {
|
|
||||||
var tpl = '<td>' + i + '<div class="colBlock" style="left:' + (i * 32 + 1) + 'px;"></div></td>';
|
|
||||||
colNum += tpl;
|
|
||||||
}
|
|
||||||
arrColMark.innerHTML = '<tr>' + colNum + '</tr>';
|
|
||||||
mapColMark.innerHTML = '<tr>' + colNum + '</tr>';
|
|
||||||
var rowNum = ' ';
|
|
||||||
for (var i = 0; i < 13; i++) {
|
|
||||||
var tpl = '<tr><td>' + i + '<div class="rowBlock" style="top:' + (i * 32 + 1) + 'px;"></div></td></tr>';
|
|
||||||
rowNum += tpl;
|
|
||||||
}
|
|
||||||
arrRowMark.innerHTML = rowNum;
|
|
||||||
mapRowMark.innerHTML = rowNum;
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- =========================================================== -->
|
<!-- =========================================================== -->
|
||||||
|
|
||||||
|
|||||||
27
index.html
27
index.html
@ -87,6 +87,11 @@
|
|||||||
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
||||||
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="status" id='pzfCol'>
|
||||||
|
<span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>
|
||||||
|
<span class='statusLabel' id='bomb' style="color: #FA14B9"></span>
|
||||||
|
<span class='statusLabel' id='fly' style="color: #8DB600"></span>
|
||||||
|
</div>
|
||||||
<div class="status" id="debuffCol">
|
<div class="status" id="debuffCol">
|
||||||
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
||||||
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
||||||
@ -106,18 +111,22 @@
|
|||||||
<div id="gif"></div>
|
<div id="gif"></div>
|
||||||
<div id="gif2"></div>
|
<div id="gif2"></div>
|
||||||
<div id="curtain"></div>
|
<div id="curtain"></div>
|
||||||
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
|
<div id="gameDraw">
|
||||||
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='animate' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='animate' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
<canvas class='gameCanvas' id='route' width='416' height='416'></canvas>
|
||||||
|
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
|
||||||
|
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src='libs/thirdparty/mid.min.js'></script>
|
<script src='libs/thirdparty/mid.min.js'></script>
|
||||||
<script src='libs/thirdparty/lz-string.min.js'></script>
|
<script src='libs/thirdparty/lz-string.min.js'></script>
|
||||||
|
<script src='libs/thirdparty/priority-queue.min.js'></script>
|
||||||
<script id='mainScript' src='main.js'></script>
|
<script id='mainScript' src='main.js'></script>
|
||||||
<script>main.init();main.listen();</script>
|
<script>main.init();main.listen();</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
261
libs/actions.js
261
libs/actions.js
@ -13,7 +13,8 @@ actions.prototype.init = function () {
|
|||||||
|
|
||||||
////// 按下某个键时 //////
|
////// 按下某个键时 //////
|
||||||
actions.prototype.onkeyDown = function (e) {
|
actions.prototype.onkeyDown = function (e) {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||||
if (!core.isset(core.status.holdingKeys))core.status.holdingKeys=[];
|
if (!core.isset(core.status.holdingKeys))core.status.holdingKeys=[];
|
||||||
var isArrow={37:true,38:true,39:true,40:true}[e.keyCode]
|
var isArrow={37:true,38:true,39:true,40:true}[e.keyCode]
|
||||||
if(isArrow && !core.status.lockControl){
|
if(isArrow && !core.status.lockControl){
|
||||||
@ -32,7 +33,8 @@ actions.prototype.onkeyDown = function (e) {
|
|||||||
|
|
||||||
////// 放开某个键时 //////
|
////// 放开某个键时 //////
|
||||||
actions.prototype.onkeyUp = function(e) {
|
actions.prototype.onkeyUp = function(e) {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) {
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') {
|
||||||
if (e.keyCode==27) // ESCAPE
|
if (e.keyCode==27) // ESCAPE
|
||||||
core.stopReplay();
|
core.stopReplay();
|
||||||
else if (e.keyCode==90) // Z
|
else if (e.keyCode==90) // Z
|
||||||
@ -47,6 +49,8 @@ actions.prototype.onkeyUp = function(e) {
|
|||||||
core.saveReplay();
|
core.saveReplay();
|
||||||
else if (e.keyCode==67)
|
else if (e.keyCode==67)
|
||||||
core.bookReplay();
|
core.bookReplay();
|
||||||
|
else if (e.keyCode==33||e.keyCode==34)
|
||||||
|
core.viewMapReplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +81,8 @@ actions.prototype.pressKey = function (keyCode) {
|
|||||||
|
|
||||||
////// 根据按下键的code来执行一系列操作 //////
|
////// 根据按下键的code来执行一系列操作 //////
|
||||||
actions.prototype.keyDown = function(keyCode) {
|
actions.prototype.keyDown = function(keyCode) {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||||
if (core.status.lockControl) {
|
if (core.status.lockControl) {
|
||||||
// Ctrl跳过对话
|
// Ctrl跳过对话
|
||||||
if (keyCode==17) {
|
if (keyCode==17) {
|
||||||
@ -165,40 +170,14 @@ actions.prototype.keyDown = function(keyCode) {
|
|||||||
case 40:
|
case 40:
|
||||||
core.moveHero('down');
|
core.moveHero('down');
|
||||||
break;
|
break;
|
||||||
case 13: case 32: case 67: case 51: // 快捷键3:飞
|
|
||||||
// 因为加入了两次的检测机制,从keydown转移到keyup,同时保证位置信息正确,但以下情况会触发作图的bug:
|
|
||||||
// 在鼠标的路线移动中使用飞,绿块会滞后一格,显示的位置不对,同时也不会倍以下的代码清除
|
|
||||||
if (core.status.heroStop && core.hasItem('centerFly')) {
|
|
||||||
if (core.status.usingCenterFly) {
|
|
||||||
if (core.canUseItem('centerFly')) {
|
|
||||||
core.useItem('centerFly');
|
|
||||||
core.clearMap('ui', core.getHeroLoc('x')*32,core.getHeroLoc('y')*32,32,32);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.drawTip('当前不能使用中心对称飞行器');
|
|
||||||
core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32);
|
|
||||||
}
|
|
||||||
core.status.usingCenterFly = false;
|
|
||||||
} else if (keyCode==51) {
|
|
||||||
core.status.usingCenterFly = true;
|
|
||||||
core.setAlpha('ui', 0.5);
|
|
||||||
core.fillRect('ui',(12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32,core.canUseItem('centerFly')?'#00FF00':'#FF0000');
|
|
||||||
core.setAlpha('ui', 1);
|
|
||||||
core.drawTip("请确认当前中心对称飞行器的位置");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (core.status.usingCenterFly && keyCode!=51) {
|
|
||||||
core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32);
|
|
||||||
core.status.usingCenterFly= false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 根据放开键的code来执行一系列操作 //////
|
////// 根据放开键的code来执行一系列操作 //////
|
||||||
actions.prototype.keyUp = function(keyCode, fromReplay) {
|
actions.prototype.keyUp = function(keyCode, fromReplay) {
|
||||||
if (!fromReplay&&core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0)
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
return;
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||||
|
|
||||||
if (core.status.lockControl) {
|
if (core.status.lockControl) {
|
||||||
core.status.holdingKeys = [];
|
core.status.holdingKeys = [];
|
||||||
@ -283,6 +262,10 @@ actions.prototype.keyUp = function(keyCode, fromReplay) {
|
|||||||
this.keyUpReplay(keyCode);
|
this.keyUpReplay(keyCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (core.status.event.id=='centerFly') {
|
||||||
|
this.keyUpCenterFly(keyCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +334,7 @@ actions.prototype.keyUp = function(keyCode, fromReplay) {
|
|||||||
case 33: case 34: // PAGEUP/PAGEDOWN
|
case 33: case 34: // PAGEUP/PAGEDOWN
|
||||||
if (core.status.heroStop) {
|
if (core.status.heroStop) {
|
||||||
if (core.flags.enableViewMaps) {
|
if (core.flags.enableViewMaps) {
|
||||||
core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId));
|
core.ui.drawMaps();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.drawTip("本塔不允许浏览地图!");
|
core.drawTip("本塔不允许浏览地图!");
|
||||||
@ -366,7 +349,7 @@ actions.prototype.keyUp = function(keyCode, fromReplay) {
|
|||||||
break;
|
break;
|
||||||
case 40: // DOWN
|
case 40: // DOWN
|
||||||
break;
|
break;
|
||||||
case 49: // 快捷键1:破
|
case 49: // 快捷键1: 破
|
||||||
if (core.status.heroStop && core.hasItem('pickaxe')) {
|
if (core.status.heroStop && core.hasItem('pickaxe')) {
|
||||||
if (core.canUseItem('pickaxe')) {
|
if (core.canUseItem('pickaxe')) {
|
||||||
core.useItem('pickaxe');
|
core.useItem('pickaxe');
|
||||||
@ -376,7 +359,7 @@ actions.prototype.keyUp = function(keyCode, fromReplay) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 50: // 快捷键2:炸
|
case 50: // 快捷键2: 炸
|
||||||
if (core.status.heroStop) {
|
if (core.status.heroStop) {
|
||||||
if (core.hasItem('bomb')) {
|
if (core.hasItem('bomb')) {
|
||||||
if (core.canUseItem('bomb')) {
|
if (core.canUseItem('bomb')) {
|
||||||
@ -397,6 +380,11 @@ actions.prototype.keyUp = function(keyCode, fromReplay) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 51: // 快捷键3: 飞
|
||||||
|
if (core.status.heroStop && core.hasItem('centerFly')) {
|
||||||
|
core.events.useItem('centerFly');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +398,8 @@ actions.prototype.keyUp = function(keyCode, fromReplay) {
|
|||||||
|
|
||||||
////// 点击(触摸)事件按下时 //////
|
////// 点击(触摸)事件按下时 //////
|
||||||
actions.prototype.ondown = function (x ,y) {
|
actions.prototype.ondown = function (x ,y) {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||||
if (!core.status.played || core.status.lockControl) {
|
if (!core.status.played || core.status.lockControl) {
|
||||||
this.onclick(x, y, []);
|
this.onclick(x, y, []);
|
||||||
if (core.timeout.onDownTimeout==null) {
|
if (core.timeout.onDownTimeout==null) {
|
||||||
@ -429,7 +418,7 @@ actions.prototype.ondown = function (x ,y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
core.status.downTime = new Date();
|
core.status.downTime = new Date();
|
||||||
core.clearMap('ui', 0, 0, 416,416);
|
core.clearMap('route');
|
||||||
var pos={'x':x,'y':y}
|
var pos={'x':x,'y':y}
|
||||||
core.status.stepPostfix=[];
|
core.status.stepPostfix=[];
|
||||||
core.status.stepPostfix.push(pos);
|
core.status.stepPostfix.push(pos);
|
||||||
@ -438,7 +427,8 @@ actions.prototype.ondown = function (x ,y) {
|
|||||||
|
|
||||||
////// 当在触摸屏上滑动时 //////
|
////// 当在触摸屏上滑动时 //////
|
||||||
actions.prototype.onmove = function (x ,y) {
|
actions.prototype.onmove = function (x ,y) {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||||
// if (core.status.holdingPath==0){return;}
|
// if (core.status.holdingPath==0){return;}
|
||||||
//core.status.mouseOutCheck =1;
|
//core.status.mouseOutCheck =1;
|
||||||
var pos={'x':x,'y':y};
|
var pos={'x':x,'y':y};
|
||||||
@ -462,7 +452,8 @@ actions.prototype.onmove = function (x ,y) {
|
|||||||
|
|
||||||
////// 当点击(触摸)事件放开时 //////
|
////// 当点击(触摸)事件放开时 //////
|
||||||
actions.prototype.onup = function () {
|
actions.prototype.onup = function () {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||||
|
|
||||||
clearTimeout(core.timeout.onDownTimeout);
|
clearTimeout(core.timeout.onDownTimeout);
|
||||||
core.timeout.onDownTimeout = null;
|
core.timeout.onDownTimeout = null;
|
||||||
@ -476,14 +467,14 @@ actions.prototype.onup = function () {
|
|||||||
for(var ii=1;ii<core.status.stepPostfix.length;ii++){
|
for(var ii=1;ii<core.status.stepPostfix.length;ii++){
|
||||||
var pos0 = core.status.stepPostfix[ii-1];
|
var pos0 = core.status.stepPostfix[ii-1];
|
||||||
var pos = core.status.stepPostfix[ii];
|
var pos = core.status.stepPostfix[ii];
|
||||||
stepPostfix.push({'direction': direction[pos.x-pos0.x][pos.y-pos0.y], 'x': pos.x, 'y': pos.y});
|
stepPostfix.push({'direction': direction[pos.x-pos0.x][pos.y-pos0.y], 'x': pos.x+parseInt(core.bigmap.offsetX/32), 'y': pos.y+parseInt(core.bigmap.offsetY/32)});
|
||||||
}
|
}
|
||||||
var posx=core.status.stepPostfix[0].x;
|
var posx=core.status.stepPostfix[0].x;
|
||||||
var posy=core.status.stepPostfix[0].y;
|
var posy=core.status.stepPostfix[0].y;
|
||||||
core.status.stepPostfix=[];
|
core.status.stepPostfix=[];
|
||||||
if (!core.status.lockControl) {
|
if (!core.status.lockControl) {
|
||||||
core.canvas.ui.clearRect(0, 0, 416,416);
|
core.clearMap('route');
|
||||||
core.canvas.ui.restore();
|
core.canvas.route.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 长按
|
// 长按
|
||||||
@ -525,7 +516,8 @@ actions.prototype.getClickLoc = function (x, y) {
|
|||||||
|
|
||||||
////// 具体点击屏幕上(x,y)点时,执行的操作 //////
|
////// 具体点击屏幕上(x,y)点时,执行的操作 //////
|
||||||
actions.prototype.onclick = function (x, y, stepPostfix) {
|
actions.prototype.onclick = function (x, y, stepPostfix) {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||||
// console.log("Click: (" + x + "," + y + ")");
|
// console.log("Click: (" + x + "," + y + ")");
|
||||||
|
|
||||||
stepPostfix=stepPostfix||[];
|
stepPostfix=stepPostfix||[];
|
||||||
@ -533,27 +525,15 @@ actions.prototype.onclick = function (x, y, stepPostfix) {
|
|||||||
// 非游戏屏幕内
|
// 非游戏屏幕内
|
||||||
if (x<0 || y<0 || x>12 || y>12) return;
|
if (x<0 || y<0 || x>12 || y>12) return;
|
||||||
|
|
||||||
// 中心对称飞行器
|
|
||||||
if (core.status.usingCenterFly) {
|
|
||||||
if (x!=12-core.getHeroLoc('x') || y!=12-core.getHeroLoc('y')) {
|
|
||||||
core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32);
|
|
||||||
} else {
|
|
||||||
if (core.canUseItem('centerFly')) {
|
|
||||||
core.useItem('centerFly');
|
|
||||||
core.clearMap('ui', core.getHeroLoc('x')*32,core.getHeroLoc('y')*32,32,32);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.drawTip('当前不能使用中心对称飞行器');
|
|
||||||
core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
core.status.usingCenterFly= false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 寻路
|
// 寻路
|
||||||
if (!core.status.lockControl) {
|
if (!core.status.lockControl) {
|
||||||
core.setAutomaticRoute(x, y, stepPostfix);
|
core.setAutomaticRoute(x+parseInt(core.bigmap.offsetX/32), y+parseInt(core.bigmap.offsetY/32), stepPostfix);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 中心对称飞行器
|
||||||
|
if (core.status.event.id == 'centerFly') {
|
||||||
|
this.clickCenterFly(x, y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,7 +659,8 @@ actions.prototype.onclick = function (x, y, stepPostfix) {
|
|||||||
|
|
||||||
////// 滑动鼠标滚轮时的操作 //////
|
////// 滑动鼠标滚轮时的操作 //////
|
||||||
actions.prototype.onmousewheel = function (direct) {
|
actions.prototype.onmousewheel = function (direct) {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return;
|
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||||
|
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||||
// 向下滚动是 -1 ,向上是 1
|
// 向下滚动是 -1 ,向上是 1
|
||||||
|
|
||||||
// 楼层飞行器
|
// 楼层飞行器
|
||||||
@ -705,8 +686,8 @@ actions.prototype.onmousewheel = function (direct) {
|
|||||||
|
|
||||||
// 浏览地图
|
// 浏览地图
|
||||||
if (core.status.lockControl && core.status.event.id == 'viewMaps') {
|
if (core.status.lockControl && core.status.event.id == 'viewMaps') {
|
||||||
if (direct==1) this.clickViewMaps(6,2);
|
if (direct==1) this.clickViewMaps(6,3);
|
||||||
if (direct==-1) this.clickViewMaps(6,10);
|
if (direct==-1) this.clickViewMaps(6,9);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -747,6 +728,32 @@ actions.prototype.keyDownCtrl = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////
|
||||||
|
actions.prototype.clickCenterFly = function(x, y) {
|
||||||
|
if (x==core.status.event.data.x && y==core.status.event.data.y) {
|
||||||
|
if (core.canUseItem('centerFly')) {
|
||||||
|
core.useItem('centerFly');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.drawTip('当前不能使用中心对称飞行器');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
core.ui.closePanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
actions.prototype.keyUpCenterFly = function (keycode) {
|
||||||
|
if (keycode==51 || keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
if (core.canUseItem('centerFly')) {
|
||||||
|
core.useItem('centerFly');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.drawTip('当前不能使用中心对称飞行器');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
core.ui.closePanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////// 点击确认框时 //////
|
////// 点击确认框时 //////
|
||||||
actions.prototype.clickConfirmBox = function (x,y) {
|
actions.prototype.clickConfirmBox = function (x,y) {
|
||||||
if ((x == 4 || x == 5) && y == 7 && core.isset(core.status.event.data.yes))
|
if ((x == 4 || x == 5) && y == 7 && core.isset(core.status.event.data.yes))
|
||||||
@ -923,7 +930,7 @@ actions.prototype.keyUpBook = function (keycode) {
|
|||||||
|
|
||||||
////// 怪物手册属性显示界面时的点击操作 //////
|
////// 怪物手册属性显示界面时的点击操作 //////
|
||||||
actions.prototype.clickBookDetail = function () {
|
actions.prototype.clickBookDetail = function () {
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.status.event.id = 'book';
|
core.status.event.id = 'book';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -968,24 +975,49 @@ actions.prototype.keyUpFly = function (keycode) {
|
|||||||
|
|
||||||
////// 查看地图界面时的点击操作 //////
|
////// 查看地图界面时的点击操作 //////
|
||||||
actions.prototype.clickViewMaps = function (x,y) {
|
actions.prototype.clickViewMaps = function (x,y) {
|
||||||
|
if (!core.isset(core.status.event.data)) {
|
||||||
|
core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var now = core.floorIds.indexOf(core.status.floorId);
|
var now = core.floorIds.indexOf(core.status.floorId);
|
||||||
var nextId = core.status.event.data;
|
var index = core.status.event.data.index;
|
||||||
if(y<=4) {
|
var cx = core.status.event.data.x, cy = core.status.event.data.y;
|
||||||
nextId++;
|
var floorId = core.floorIds[index], mw = core.floors[floorId].width||13, mh = core.floors[floorId].height||13;
|
||||||
while (nextId<core.floorIds.length && nextId!=now && core.floors[core.floorIds[nextId]].cannotViewMap)
|
|
||||||
nextId++;
|
if (x>=2 && x<=10 && y<=1 && mh>13) {
|
||||||
if (nextId<core.floorIds.length)
|
core.ui.drawMaps(index, cx, cy-1);
|
||||||
core.ui.drawMaps(nextId);
|
return;
|
||||||
}
|
}
|
||||||
else if (y>=8) {
|
if (x>=2 && x<=10 && y>=11 && mh>13) {
|
||||||
nextId--;
|
core.ui.drawMaps(index, cx, cy+1);
|
||||||
while (nextId>=0 && nextId!=now && core.floors[core.floorIds[nextId]].cannotViewMap)
|
return;
|
||||||
nextId--;
|
|
||||||
if (nextId>=0)
|
|
||||||
core.ui.drawMaps(nextId);
|
|
||||||
}
|
}
|
||||||
else {
|
if (x<=1 && y>=2 && y<=10) {
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.ui.drawMaps(index, cx-1, cy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (x>=11 && y>=2 && y<=10) {
|
||||||
|
core.ui.drawMaps(index, cx+1, cy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(x>=2 && x<=10 && y<=4) {
|
||||||
|
index++;
|
||||||
|
while (index<core.floorIds.length && index!=now && core.floors[core.floorIds[index]].cannotViewMap)
|
||||||
|
index++;
|
||||||
|
if (index<core.floorIds.length)
|
||||||
|
core.ui.drawMaps(index);
|
||||||
|
}
|
||||||
|
else if (x>=2 && x<=10 && y>=8) {
|
||||||
|
index--;
|
||||||
|
while (index>=0 && index!=now && core.floors[core.floorIds[index]].cannotViewMap)
|
||||||
|
index--;
|
||||||
|
if (index>=0)
|
||||||
|
core.ui.drawMaps(index);
|
||||||
|
}
|
||||||
|
else if (x>=2 && x<=10 && y>=5 && y<=7) {
|
||||||
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
}
|
}
|
||||||
@ -993,24 +1025,37 @@ actions.prototype.clickViewMaps = function (x,y) {
|
|||||||
|
|
||||||
////// 查看地图界面时,按下某个键的操作 //////
|
////// 查看地图界面时,按下某个键的操作 //////
|
||||||
actions.prototype.keyDownViewMaps = function (keycode) {
|
actions.prototype.keyDownViewMaps = function (keycode) {
|
||||||
if (keycode==37 || keycode==38 || keycode==33) {
|
if (!core.isset(core.status.event.data)) return;
|
||||||
this.clickViewMaps(6,2);
|
|
||||||
}
|
var floorId = core.floorIds[core.status.event.data.index], mh = core.floors[floorId].height||13;
|
||||||
else if (keycode==39 || keycode==40 || keycode==34) {
|
|
||||||
this.clickViewMaps(6,10);
|
if (keycode==38||keycode==33) this.clickViewMaps(6, 3);
|
||||||
}
|
if (keycode==40||keycode==34) this.clickViewMaps(6, 9);
|
||||||
|
if (keycode==87 && mh>13) this.clickViewMaps(6,0);
|
||||||
|
if (keycode==65) this.clickViewMaps(0,6);
|
||||||
|
if (keycode==83 && mh>13) this.clickViewMaps(6,12);
|
||||||
|
if (keycode==68) this.clickViewMaps(12,6);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 查看地图界面时,放开某个键的操作 //////
|
////// 查看地图界面时,放开某个键的操作 //////
|
||||||
actions.prototype.keyUpViewMaps = function (keycode) {
|
actions.prototype.keyUpViewMaps = function (keycode) {
|
||||||
if (keycode==27 || keycode==13 || keycode==32 || keycode==67) {
|
if (!core.isset(core.status.event.data)) {
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keycode==27 || keycode==13 || keycode==32 || (!core.status.replay.replaying && keycode==67)) {
|
||||||
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
}
|
}
|
||||||
if (keycode==88) {
|
if (keycode==88 || (core.status.replay.replaying && keycode==67)) {
|
||||||
core.openBook(false);
|
if (core.isset(core.status.replay)&&core.status.replay.replaying) {
|
||||||
|
core.bookReplay();
|
||||||
|
} else {
|
||||||
|
core.openBook(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1351,8 +1396,17 @@ actions.prototype.clickSL = function(x,y) {
|
|||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
if (x>=0 && x<=2 && y==12) {
|
if (x>=0 && x<=2 && y==12) {
|
||||||
core.status.event.selection=!core.status.event.selection;
|
|
||||||
core.ui.drawSLPanel(index);
|
if (core.status.event.id=='save') {
|
||||||
|
core.status.event.selection=!core.status.event.selection;
|
||||||
|
core.ui.drawSLPanel(index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var index = parseInt(prompt("请输入读档编号"))||0;
|
||||||
|
if (index>0) {
|
||||||
|
core.doSL(index, core.status.event.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1457,6 +1511,13 @@ actions.prototype.keyUpSL = function (keycode) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (keycode==69 && core.status.event.id == 'load') { // E
|
||||||
|
var index = parseInt(prompt("请输入读档编号"))||0;
|
||||||
|
if (index>0) {
|
||||||
|
core.doSL(index, core.status.event.id);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (keycode==46) {
|
if (keycode==46) {
|
||||||
if (offset==0) {
|
if (offset==0) {
|
||||||
core.drawTip("无法删除自动存档!");
|
core.drawTip("无法删除自动存档!");
|
||||||
@ -1585,9 +1646,12 @@ actions.prototype.clickSettings = function (x,y) {
|
|||||||
core.drawTip("本塔不允许浏览地图!");
|
core.drawTip("本塔不允许浏览地图!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/*
|
||||||
core.drawText("\t[系统提示]即将进入浏览地图模式。\n\n点击地图上半部分,或按[↑]键可查看前一张地图\n点击地图下半部分,或按[↓]键可查看后一张地图\n点击地图中间,或按[ESC]键可离开浏览地图模式\n此模式下可以打开怪物手册以查看某层楼的怪物属性", function () {
|
core.drawText("\t[系统提示]即将进入浏览地图模式。\n\n点击地图上半部分,或按[↑]键可查看前一张地图\n点击地图下半部分,或按[↓]键可查看后一张地图\n点击地图中间,或按[ESC]键可离开浏览地图模式\n此模式下可以打开怪物手册以查看某层楼的怪物属性", function () {
|
||||||
core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId));
|
core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId));
|
||||||
})
|
})
|
||||||
|
*/
|
||||||
|
core.ui.drawMaps();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@ -2011,6 +2075,19 @@ actions.prototype.clickReplay = function (x, y) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
|
if (core.hasFlag('debug')) {
|
||||||
|
core.drawText("\t[系统提示]调试模式下无法下载录像");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route", JSON.stringify({
|
||||||
|
'name': core.firstData.name,
|
||||||
|
'hard': core.status.hard,
|
||||||
|
'seed': core.getFlag('seed'),
|
||||||
|
'route': core.encodeRoute(core.status.route)
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
385
libs/control.js
385
libs/control.js
@ -104,7 +104,7 @@ control.prototype.setRequestAnimationFrame = function () {
|
|||||||
if (core.isPlaying() && timestamp-core.animateFrame.weather.time>30) {
|
if (core.isPlaying() && timestamp-core.animateFrame.weather.time>30) {
|
||||||
if (core.animateFrame.weather.type == 'rain' && core.animateFrame.weather.level > 0) {
|
if (core.animateFrame.weather.type == 'rain' && core.animateFrame.weather.level > 0) {
|
||||||
|
|
||||||
core.clearMap('weather', 0, 0, 416, 416);
|
core.clearMap('weather');
|
||||||
|
|
||||||
core.canvas.weather.strokeStyle = 'rgba(174,194,224,0.8)';
|
core.canvas.weather.strokeStyle = 'rgba(174,194,224,0.8)';
|
||||||
core.canvas.weather.lineWidth = 1;
|
core.canvas.weather.lineWidth = 1;
|
||||||
@ -130,7 +130,7 @@ control.prototype.setRequestAnimationFrame = function () {
|
|||||||
}
|
}
|
||||||
else if (core.animateFrame.weather.type == 'snow' && core.animateFrame.weather.level > 0) {
|
else if (core.animateFrame.weather.type == 'snow' && core.animateFrame.weather.level > 0) {
|
||||||
|
|
||||||
core.clearMap('weather', 0, 0, 416, 416);
|
core.clearMap('weather');
|
||||||
|
|
||||||
core.canvas.weather.fillStyle = "rgba(255, 255, 255, 0.8)";
|
core.canvas.weather.fillStyle = "rgba(255, 255, 255, 0.8)";
|
||||||
core.canvas.weather.beginPath();
|
core.canvas.weather.beginPath();
|
||||||
@ -251,7 +251,16 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
|
|||||||
totalTime=core.status.hero.statistics.totalTime;
|
totalTime=core.status.hero.statistics.totalTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clearStatus();
|
// 停止各个Timeout和Interval
|
||||||
|
for (var i in core.timeout) {
|
||||||
|
clearTimeout(core.timeout[i]);
|
||||||
|
core.timeout[i] = null;
|
||||||
|
}
|
||||||
|
for (var i in core.interval) {
|
||||||
|
clearInterval(core.interval[i]);
|
||||||
|
core.interval[i] = null;
|
||||||
|
}
|
||||||
|
core.clearStatusBar();
|
||||||
|
|
||||||
// 初始化status
|
// 初始化status
|
||||||
core.status = core.clone(core.initStatus);
|
core.status = core.clone(core.initStatus);
|
||||||
@ -334,7 +343,7 @@ control.prototype.restart = function() {
|
|||||||
////// 清除自动寻路路线 //////
|
////// 清除自动寻路路线 //////
|
||||||
control.prototype.clearAutomaticRouteNode = function (x, y) {
|
control.prototype.clearAutomaticRouteNode = function (x, y) {
|
||||||
if (core.status.event.id==null)
|
if (core.status.event.id==null)
|
||||||
core.canvas.ui.clearRect(x * 32 + 5, y * 32 + 5, 27, 27);
|
core.canvas.route.clearRect(x * 32 + 5, y * 32 + 5, 27, 27);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 停止自动寻路操作 //////
|
////// 停止自动寻路操作 //////
|
||||||
@ -352,7 +361,7 @@ control.prototype.stopAutomaticRoute = function () {
|
|||||||
core.status.automaticRoute.lastDirection = null;
|
core.status.automaticRoute.lastDirection = null;
|
||||||
core.stopHero();
|
core.stopHero();
|
||||||
if (core.status.automaticRoute.moveStepBeforeStop.length==0)
|
if (core.status.automaticRoute.moveStepBeforeStop.length==0)
|
||||||
core.canvas.ui.clearRect(0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 继续剩下的自动寻路操作 //////
|
////// 继续剩下的自动寻路操作 //////
|
||||||
@ -370,7 +379,7 @@ control.prototype.continueAutomaticRoute = function () {
|
|||||||
|
|
||||||
////// 清空剩下的自动寻路列表 //////
|
////// 清空剩下的自动寻路列表 //////
|
||||||
control.prototype.clearContinueAutomaticRoute = function () {
|
control.prototype.clearContinueAutomaticRoute = function () {
|
||||||
core.canvas.ui.clearRect(0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
core.status.automaticRoute.moveStepBeforeStop=[];
|
core.status.automaticRoute.moveStepBeforeStop=[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +387,7 @@ control.prototype.clearContinueAutomaticRoute = function () {
|
|||||||
control.prototype.moveDirectly = function (destX, destY) {
|
control.prototype.moveDirectly = function (destX, destY) {
|
||||||
var ignoreSteps = core.canMoveDirectly(destX, destY);
|
var ignoreSteps = core.canMoveDirectly(destX, destY);
|
||||||
if (ignoreSteps>=0) {
|
if (ignoreSteps>=0) {
|
||||||
core.clearMap('hero', 0, 0, 416, 416);
|
core.clearMap('hero');
|
||||||
var lastDirection = core.status.route[core.status.route.length-1];
|
var lastDirection = core.status.route[core.status.route.length-1];
|
||||||
if (['left', 'right', 'up', 'down'].indexOf(lastDirection)>=0)
|
if (['left', 'right', 'up', 'down'].indexOf(lastDirection)>=0)
|
||||||
core.setHeroLoc('direction', lastDirection);
|
core.setHeroLoc('direction', lastDirection);
|
||||||
@ -398,7 +407,7 @@ control.prototype.tryMoveDirectly = function (destX, destY) {
|
|||||||
if (Math.abs(core.getHeroLoc('x')-destX)+Math.abs(core.getHeroLoc('y')-destY)<=1)
|
if (Math.abs(core.getHeroLoc('x')-destX)+Math.abs(core.getHeroLoc('y')-destY)<=1)
|
||||||
return false;
|
return false;
|
||||||
var testMove = function (dx, dy, dir) {
|
var testMove = function (dx, dy, dir) {
|
||||||
if (dx<0 || dx>12 || dy<0 || dy>12) return false;
|
if (dx<0 || dx>=core.bigmap.width|| dy<0 || dy>=core.bigmap.height) return false;
|
||||||
if (core.control.moveDirectly(dx, dy)) {
|
if (core.control.moveDirectly(dx, dy)) {
|
||||||
if (core.isset(dir)) core.moveHero(dir, function() {});
|
if (core.isset(dir)) core.moveHero(dir, function() {});
|
||||||
return true;
|
return true;
|
||||||
@ -458,18 +467,18 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
|
|||||||
if (destX == core.status.hero.loc.x && destY == core.status.hero.loc.y){
|
if (destX == core.status.hero.loc.x && destY == core.status.hero.loc.y){
|
||||||
moveStep=[];
|
moveStep=[];
|
||||||
} else {
|
} else {
|
||||||
core.canvas.ui.clearRect(0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
moveStep=moveStep.concat(stepPostfix);
|
moveStep=moveStep.concat(stepPostfix);
|
||||||
core.status.automaticRoute.destX=destX;
|
core.status.automaticRoute.destX=destX;
|
||||||
core.status.automaticRoute.destY=destY;
|
core.status.automaticRoute.destY=destY;
|
||||||
core.canvas.ui.save();
|
core.canvas.route.save();
|
||||||
core.canvas.ui.clearRect(0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
core.canvas.ui.fillStyle = '#bfbfbf';
|
core.canvas.route.fillStyle = '#bfbfbf';
|
||||||
core.canvas.ui.strokeStyle = '#bfbfbf';
|
core.canvas.route.strokeStyle = '#bfbfbf';
|
||||||
core.canvas.ui.lineWidth = 8;
|
core.canvas.route.lineWidth = 8;
|
||||||
for (var m = 0; m < moveStep.length; m++) {
|
for (var m = 0; m < moveStep.length; m++) {
|
||||||
if (tempStep == null) {
|
if (tempStep == null) {
|
||||||
step++;
|
step++;
|
||||||
@ -487,53 +496,53 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
|
|||||||
if (m == moveStep.length - 1) {
|
if (m == moveStep.length - 1) {
|
||||||
// core.status.automaticRoutingTemp.moveStep.push({'direction': tempStep, 'step': step});
|
// core.status.automaticRoutingTemp.moveStep.push({'direction': tempStep, 'step': step});
|
||||||
core.status.automaticRoute.autoStepRoutes.push({'direction': tempStep, 'step': step});
|
core.status.automaticRoute.autoStepRoutes.push({'direction': tempStep, 'step': step});
|
||||||
core.canvas.ui.fillRect(moveStep[m].x * 32 + 10, moveStep[m].y * 32 + 10, 12, 12);
|
core.canvas.route.fillRect(moveStep[m].x * 32 + 10, moveStep[m].y * 32 + 10, 12, 12);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.canvas.ui.beginPath();
|
core.canvas.route.beginPath();
|
||||||
if (core.isset(moveStep[m + 1]) && tempStep != moveStep[m + 1].direction) {
|
if (core.isset(moveStep[m + 1]) && tempStep != moveStep[m + 1].direction) {
|
||||||
if (tempStep == 'up' && moveStep[m + 1].direction == 'left' || tempStep == 'right' && moveStep[m + 1].direction == 'down') {
|
if (tempStep == 'up' && moveStep[m + 1].direction == 'left' || tempStep == 'right' && moveStep[m + 1].direction == 'down') {
|
||||||
core.canvas.ui.moveTo(moveStep[m].x * 32 + 5, moveStep[m].y * 32 + 16);
|
core.canvas.route.moveTo(moveStep[m].x * 32 + 5, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 16);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 27);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 27);
|
||||||
}
|
}
|
||||||
else if (tempStep == 'up' && moveStep[m + 1].direction == 'right' || tempStep == 'left' && moveStep[m + 1].direction == 'down') {
|
else if (tempStep == 'up' && moveStep[m + 1].direction == 'right' || tempStep == 'left' && moveStep[m + 1].direction == 'down') {
|
||||||
core.canvas.ui.moveTo(moveStep[m].x * 32 + 27, moveStep[m].y * 32 + 16);
|
core.canvas.route.moveTo(moveStep[m].x * 32 + 27, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 16);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 27);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 27);
|
||||||
}
|
}
|
||||||
else if (tempStep == 'left' && moveStep[m + 1].direction == 'up' || tempStep == 'down' && moveStep[m + 1].direction == 'right') {
|
else if (tempStep == 'left' && moveStep[m + 1].direction == 'up' || tempStep == 'down' && moveStep[m + 1].direction == 'right') {
|
||||||
core.canvas.ui.moveTo(moveStep[m].x * 32 + 27, moveStep[m].y * 32 + 16);
|
core.canvas.route.moveTo(moveStep[m].x * 32 + 27, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 16);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 5);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 5);
|
||||||
}
|
}
|
||||||
else if (tempStep == 'right' && moveStep[m + 1].direction == 'up' || tempStep == 'down' && moveStep[m + 1].direction == 'left') {
|
else if (tempStep == 'right' && moveStep[m + 1].direction == 'up' || tempStep == 'down' && moveStep[m + 1].direction == 'left') {
|
||||||
core.canvas.ui.moveTo(moveStep[m].x * 32 + 5, moveStep[m].y * 32 + 16);
|
core.canvas.route.moveTo(moveStep[m].x * 32 + 5, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 16);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 5);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 5);
|
||||||
}
|
}
|
||||||
core.canvas.ui.stroke();
|
core.canvas.route.stroke();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (tempStep) {
|
switch (tempStep) {
|
||||||
case 'up':
|
case 'up':
|
||||||
case 'down':
|
case 'down':
|
||||||
core.canvas.ui.beginPath();
|
core.canvas.route.beginPath();
|
||||||
core.canvas.ui.moveTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 5);
|
core.canvas.route.moveTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 5);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 27);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 16, moveStep[m].y * 32 + 27);
|
||||||
core.canvas.ui.stroke();
|
core.canvas.route.stroke();
|
||||||
break;
|
break;
|
||||||
case 'left':
|
case 'left':
|
||||||
case 'right':
|
case 'right':
|
||||||
core.canvas.ui.beginPath();
|
core.canvas.route.beginPath();
|
||||||
core.canvas.ui.moveTo(moveStep[m].x * 32 + 5, moveStep[m].y * 32 + 16);
|
core.canvas.route.moveTo(moveStep[m].x * 32 + 5, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.lineTo(moveStep[m].x * 32 + 27, moveStep[m].y * 32 + 16);
|
core.canvas.route.lineTo(moveStep[m].x * 32 + 27, moveStep[m].y * 32 + 16);
|
||||||
core.canvas.ui.stroke();
|
core.canvas.route.stroke();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
core.canvas.ui.restore();
|
core.canvas.route.restore();
|
||||||
|
|
||||||
// 立刻移动
|
// 立刻移动
|
||||||
core.setAutoHeroMove();
|
core.setAutoHeroMove();
|
||||||
@ -542,6 +551,7 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
|
|||||||
|
|
||||||
////// 自动寻路算法,找寻最优路径 //////
|
////// 自动寻路算法,找寻最优路径 //////
|
||||||
control.prototype.automaticRoute = function (destX, destY) {
|
control.prototype.automaticRoute = function (destX, destY) {
|
||||||
|
var fw = core.bigmap.width, fh = core.bigmap.height;
|
||||||
var startX = core.getHeroLoc('x');
|
var startX = core.getHeroLoc('x');
|
||||||
var startY = core.getHeroLoc('y');
|
var startY = core.getHeroLoc('y');
|
||||||
var scan = {
|
var scan = {
|
||||||
@ -550,53 +560,46 @@ control.prototype.automaticRoute = function (destX, destY) {
|
|||||||
'down': {'x': 0, 'y': 1},
|
'down': {'x': 0, 'y': 1},
|
||||||
'right': {'x': 1, 'y': 0}
|
'right': {'x': 1, 'y': 0}
|
||||||
};
|
};
|
||||||
var queue = [];
|
|
||||||
var nowDeep = 0;
|
|
||||||
var route = [];
|
|
||||||
var ans = []
|
|
||||||
|
|
||||||
if (destX == startX && destY == startY) return false;
|
if (destX == startX && destY == startY) return false;
|
||||||
queue.push(13 * startX + startY);
|
|
||||||
queue.push(-1);
|
|
||||||
route[13 * startX + startY] = '';
|
|
||||||
|
|
||||||
while (queue.length != 1) {
|
var route = [];
|
||||||
var f = queue.shift();
|
var queue = new PriorityQueue({comparator: function (a,b) {
|
||||||
if (f===-1) {nowDeep+=1;queue.push(-1);continue;}
|
return a.depth - b.depth;
|
||||||
var deep = ~~(f/169);
|
}});
|
||||||
if (deep!==nowDeep) {queue.push(f);continue;}
|
var ans = [];
|
||||||
f=f%169;
|
|
||||||
var nowX = parseInt(f / 13), nowY = f % 13;
|
route[startX + fw * startY] = '';
|
||||||
var nowIsArrow = false, nowId, nowBlock = core.getBlock(nowX,nowY);
|
queue.queue({depth: 0, x: startX, y: startY});
|
||||||
|
while (queue.length!=0) {
|
||||||
|
var curr = queue.dequeue();
|
||||||
|
var deep = curr.depth, nowX = curr.x, nowY = curr.y;
|
||||||
|
|
||||||
for (var direction in scan) {
|
for (var direction in scan) {
|
||||||
if (!core.canMoveHero(nowX, nowY, direction))
|
if (!core.canMoveHero(nowX, nowY, direction))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var nx = nowX + scan[direction].x;
|
var nx = nowX + scan[direction].x;
|
||||||
var ny = nowY + scan[direction].y;
|
var ny = nowY + scan[direction].y;
|
||||||
|
if (nx<0 || nx>=fw || ny<0 || ny>=fh) continue;
|
||||||
|
|
||||||
if (nx<0 || nx>12 || ny<0 || ny>12) continue;
|
var nid = nx + fw * ny;
|
||||||
|
|
||||||
var nid = 13 * nx + ny;
|
|
||||||
|
|
||||||
if (core.isset(route[nid])) continue;
|
if (core.isset(route[nid])) continue;
|
||||||
|
|
||||||
var deepAdd=1;
|
var deepAdd=1;
|
||||||
|
|
||||||
var nextId, nextBlock = core.getBlock(nx,ny);
|
var nextId, nextBlock = core.getBlock(nx,ny);
|
||||||
if (nextBlock!=null){
|
if (nextBlock!=null){
|
||||||
nextId = nextBlock.block.event.id;
|
nextId = nextBlock.block.event.id;
|
||||||
// 绕过亮灯(因为只有一次通行机会很宝贵)
|
// 绕过亮灯(因为只有一次通行机会很宝贵)
|
||||||
if(nextId == "light") deepAdd=100;
|
if(nextId == "light") deepAdd=100;
|
||||||
// 绕过路障
|
// 绕过路障
|
||||||
if (nextId.substring(nextId.length-3)=="Net") deepAdd=core.values.lavaDamage;
|
// if (nextId.substring(nextId.length-3)=="Net") deepAdd=core.values.lavaDamage*10;
|
||||||
// 绕过血瓶
|
// 绕过血瓶
|
||||||
if (!core.flags.potionWhileRouting && nextId.substring(nextId.length-6)=="Potion") deepAdd=20;
|
if (!core.flags.potionWhileRouting && nextId.substring(nextId.length-6)=="Potion") deepAdd+=20;
|
||||||
// 绕过传送点
|
// 绕过传送点
|
||||||
if (nextBlock.block.event.trigger == 'changeFloor') deepAdd = 10;
|
if (nextBlock.block.event.trigger == 'changeFloor') deepAdd+=10;
|
||||||
}
|
}
|
||||||
if (core.status.checkBlock.damage[nid]>0)
|
deepAdd+=core.status.checkBlock.damage[nid]*10;
|
||||||
deepAdd = core.status.checkBlock.damage[nid];
|
|
||||||
|
|
||||||
if (nx == destX && ny == destY) {
|
if (nx == destX && ny == destY) {
|
||||||
route[nid] = direction;
|
route[nid] = direction;
|
||||||
@ -606,18 +609,17 @@ control.prototype.automaticRoute = function (destX, destY) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
route[nid] = direction;
|
route[nid] = direction;
|
||||||
queue.push(169*(nowDeep+deepAdd)+nid);
|
queue.queue({depth: deep+deepAdd, x: nx, y: ny});
|
||||||
}
|
}
|
||||||
if (core.isset(route[13 * destX + destY])) break;
|
if (core.isset(route[destX + fw * destY])) break;
|
||||||
}
|
}
|
||||||
|
if (!core.isset(route[destX + fw * destY])) {
|
||||||
if (!core.isset(route[13 * destX + destY])) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var nowX = destX, nowY = destY;
|
var nowX = destX, nowY = destY;
|
||||||
while (nowX != startX || nowY != startY) {
|
while (nowX != startX || nowY != startY) {
|
||||||
var dir = route[13 * nowX + nowY];
|
var dir = route[nowX + fw * nowY];
|
||||||
ans.push({'direction': dir, 'x': nowX, 'y': nowY});
|
ans.push({'direction': dir, 'x': nowX, 'y': nowY});
|
||||||
nowX -= scan[dir].x;
|
nowX -= scan[dir].x;
|
||||||
nowY -= scan[dir].y;
|
nowY -= scan[dir].y;
|
||||||
@ -629,7 +631,7 @@ control.prototype.automaticRoute = function (destX, destY) {
|
|||||||
|
|
||||||
////// 显示离散的寻路点 //////
|
////// 显示离散的寻路点 //////
|
||||||
control.prototype.fillPosWithPoint = function (pos) {
|
control.prototype.fillPosWithPoint = function (pos) {
|
||||||
core.fillRect('ui', pos.x*32+12,pos.y*32+12,8,8, '#bfbfbf');
|
core.fillRect('route', pos.x*32+12+core.bigmap.offsetX,pos.y*32+12+core.bigmap.offsetY,8,8, '#bfbfbf');
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 设置勇士的自动行走路线 //////
|
////// 设置勇士的自动行走路线 //////
|
||||||
@ -669,7 +671,7 @@ control.prototype.setHeroMoveInterval = function (direction, x, y, callback) {
|
|||||||
core.setHeroLoc('y', y+scan[direction].y, true);
|
core.setHeroLoc('y', y+scan[direction].y, true);
|
||||||
core.control.updateFollowers();
|
core.control.updateFollowers();
|
||||||
core.moveOneStep();
|
core.moveOneStep();
|
||||||
core.clearMap('hero', 0, 0, 416, 416);
|
core.clearMap('hero');
|
||||||
core.drawHero(direction);
|
core.drawHero(direction);
|
||||||
clearInterval(core.interval.heroMoveInterval);
|
clearInterval(core.interval.heroMoveInterval);
|
||||||
core.status.heroMoving = 0;
|
core.status.heroMoving = 0;
|
||||||
@ -756,7 +758,7 @@ control.prototype.turnHero = function() {
|
|||||||
else if (core.status.hero.loc.direction == 'down') core.status.hero.loc.direction = 'left';
|
else if (core.status.hero.loc.direction == 'down') core.status.hero.loc.direction = 'left';
|
||||||
else if (core.status.hero.loc.direction == 'left') core.status.hero.loc.direction = 'up';
|
else if (core.status.hero.loc.direction == 'left') core.status.hero.loc.direction = 'up';
|
||||||
core.drawHero();
|
core.drawHero();
|
||||||
core.canvas.ui.clearRect(0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
core.status.route.push("turn");
|
core.status.route.push("turn");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -783,7 +785,7 @@ control.prototype.moveHero = function (direction, callback) {
|
|||||||
};
|
};
|
||||||
direction = core.getHeroLoc('direction');
|
direction = core.getHeroLoc('direction');
|
||||||
var nx = core.getHeroLoc('x') + scan[direction].x, ny=core.getHeroLoc('y') + scan[direction].y;
|
var nx = core.getHeroLoc('x') + scan[direction].x, ny=core.getHeroLoc('y') + scan[direction].y;
|
||||||
if (nx<0 || nx>12 || ny<0 || ny>12) return;
|
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height) return;
|
||||||
|
|
||||||
core.status.heroMoving=-1;
|
core.status.heroMoving=-1;
|
||||||
core.eventMoveHero([direction], 100, function () {
|
core.eventMoveHero([direction], 100, function () {
|
||||||
@ -814,7 +816,7 @@ control.prototype.eventMoveHero = function(steps, time, callback) {
|
|||||||
|
|
||||||
time = time || 100;
|
time = time || 100;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
|
|
||||||
// 要运行的轨迹:将steps展开
|
// 要运行的轨迹:将steps展开
|
||||||
@ -881,7 +883,7 @@ control.prototype.jumpHero = function (ex, ey, time, callback) {
|
|||||||
if (!core.isset(ey)) ey=sy;
|
if (!core.isset(ey)) ey=sy;
|
||||||
|
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
core.status.replay.animate=true;
|
core.status.replay.animate=true;
|
||||||
|
|
||||||
@ -919,9 +921,14 @@ control.prototype.jumpHero = function (ex, ey, time, callback) {
|
|||||||
var animate=window.setInterval(function() {
|
var animate=window.setInterval(function() {
|
||||||
|
|
||||||
if (jump_count>0) {
|
if (jump_count>0) {
|
||||||
core.clearMap('hero', drawX(), drawY()-height+32, 32, height);
|
core.clearMap('hero', drawX()-core.bigmap.offsetX, drawY()-height+32-core.bigmap.offsetY, 32, height);
|
||||||
updateJump();
|
updateJump();
|
||||||
core.canvas.hero.drawImage(core.material.images.hero, heroIcon[status] * 32, heroIcon.loc * height, 32, height, drawX(), drawY() + 32-height, 32, height);
|
var nowx = drawX(), nowy = drawY();
|
||||||
|
core.bigmap.offsetX = core.clamp(nowx - 32*6, 0, 32*core.bigmap.width-416);
|
||||||
|
core.bigmap.offsetY = core.clamp(nowy - 32*6, 0, 32*core.bigmap.height-416);
|
||||||
|
core.control.updateViewport();
|
||||||
|
core.canvas.hero.drawImage(core.material.images.hero, heroIcon[status] * 32, heroIcon.loc * height, 32, height,
|
||||||
|
nowx - core.bigmap.offsetX, nowy + 32-height - core.bigmap.offsetY, 32, height);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
@ -979,8 +986,33 @@ control.prototype.stopHero = function () {
|
|||||||
core.status.heroStop = true;
|
core.status.heroStop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 设置画布偏移
|
||||||
|
control.prototype.setGameCanvasTranslate = function(canvas,x,y){
|
||||||
|
var c=core.dom.gameCanvas[canvas];
|
||||||
|
x=x*core.domStyle.scale;
|
||||||
|
y=y*core.domStyle.scale;
|
||||||
|
c.style.transform='translate('+x+'px,'+y+'px)';
|
||||||
|
c.style.webkitTransform='translate('+x+'px,'+y+'px)';
|
||||||
|
c.style.OTransform='translate('+x+'px,'+y+'px)';
|
||||||
|
c.style.MozTransform='translate('+x+'px,'+y+'px)';
|
||||||
|
if(main.mode==='editor' && editor.isMobile){
|
||||||
|
c.style.transform='translate('+(x/416*96)+'vw,'+(y/416*96)+'vw)';
|
||||||
|
c.style.webkitTransform='translate('+(x/416*96)+'vw,'+(y/416*96)+'vw)';
|
||||||
|
c.style.OTransform='translate('+(x/416*96)+'vw,'+(y/416*96)+'vw)';
|
||||||
|
c.style.MozTransform='translate('+(x/416*96)+'vw,'+(y/416*96)+'vw)';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
////// 更新视野范围 //////
|
||||||
|
control.prototype.updateViewport = function() {
|
||||||
|
core.bigmap.canvas.forEach(function(cn){
|
||||||
|
core.control.setGameCanvasTranslate(cn,-core.bigmap.offsetX,-core.bigmap.offsetY);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
////// 绘制勇士 //////
|
////// 绘制勇士 //////
|
||||||
control.prototype.drawHero = function (direction, x, y, status, offset) {
|
control.prototype.drawHero = function (direction, x, y, status, offset) {
|
||||||
|
|
||||||
var scan = {
|
var scan = {
|
||||||
'up': {'x': 0, 'y': -1},
|
'up': {'x': 0, 'y': -1},
|
||||||
'left': {'x': -1, 'y': 0},
|
'left': {'x': -1, 'y': 0},
|
||||||
@ -993,9 +1025,17 @@ control.prototype.drawHero = function (direction, x, y, status, offset) {
|
|||||||
status = status || 'stop';
|
status = status || 'stop';
|
||||||
direction = direction || core.getHeroLoc('direction');
|
direction = direction || core.getHeroLoc('direction');
|
||||||
offset = offset || 0;
|
offset = offset || 0;
|
||||||
var dx=offset==0?0:scan[direction].x, dy=offset==0?0:scan[direction].y;
|
var way = scan[direction];
|
||||||
|
var offsetX = way.x*offset;
|
||||||
|
var offsetY = way.y*offset;
|
||||||
|
var dx=offsetX==0?0:offsetX/Math.abs(offsetX), dy=offsetY==0?0:offsetY/Math.abs(offsetY);
|
||||||
|
|
||||||
|
core.bigmap.offsetX = core.clamp((x - 6) * 32 + offsetX, 0, 32*core.bigmap.width-416);
|
||||||
|
core.bigmap.offsetY = core.clamp((y - 6) * 32 + offsetY, 0, 32*core.bigmap.height-416);
|
||||||
|
|
||||||
core.clearAutomaticRouteNode(x+dx, y+dy);
|
core.clearAutomaticRouteNode(x+dx, y+dy);
|
||||||
core.canvas.hero.clearRect(32 * x - 32, 32 * y - 32, 96, 96);
|
|
||||||
|
core.canvas.hero.clearRect(x * 32 - core.bigmap.offsetX - 32, y * 32 - core.bigmap.offsetY - 32, 96, 96);
|
||||||
|
|
||||||
var heroIconArr = core.material.icons.hero;
|
var heroIconArr = core.material.icons.hero;
|
||||||
var drawObjs = [];
|
var drawObjs = [];
|
||||||
@ -1004,8 +1044,8 @@ control.prototype.drawHero = function (direction, x, y, status, offset) {
|
|||||||
"img": core.material.images.hero,
|
"img": core.material.images.hero,
|
||||||
"height": core.material.icons.hero.height,
|
"height": core.material.icons.hero.height,
|
||||||
"heroIcon": heroIconArr[direction],
|
"heroIcon": heroIconArr[direction],
|
||||||
"posx": 32 * x + scan[direction].x*offset,
|
"posx": x * 32 - core.bigmap.offsetX + offsetX,
|
||||||
"posy": 32 * y + scan[direction].y*offset,
|
"posy": y * 32 - core.bigmap.offsetY + offsetY,
|
||||||
"status": status,
|
"status": status,
|
||||||
"index": 0,
|
"index": 0,
|
||||||
});
|
});
|
||||||
@ -1014,14 +1054,14 @@ control.prototype.drawHero = function (direction, x, y, status, offset) {
|
|||||||
if (core.isset(core.status.hero.followers)) {
|
if (core.isset(core.status.hero.followers)) {
|
||||||
var index=1;
|
var index=1;
|
||||||
core.status.hero.followers.forEach(function (t) {
|
core.status.hero.followers.forEach(function (t) {
|
||||||
core.canvas.hero.clearRect(32*t.x-32, 32*t.y-32, 96, 96);
|
core.canvas.hero.clearRect(32*t.x-core.bigmap.offsetX-32, 32*t.y-core.bigmap.offsetY-32, 96, 96);
|
||||||
if (core.isset(core.material.images.images[t.img])) {
|
if (core.isset(core.material.images.images[t.img])) {
|
||||||
drawObjs.push({
|
drawObjs.push({
|
||||||
"img": core.material.images.images[t.img],
|
"img": core.material.images.images[t.img],
|
||||||
"height": core.material.images.images[t.img].height/4,
|
"height": core.material.images.images[t.img].height/4,
|
||||||
"heroIcon": heroIconArr[t.direction],
|
"heroIcon": heroIconArr[t.direction],
|
||||||
"posx": 32*t.x + (t.stop?0:scan[t.direction].x*offset),
|
"posx": 32*t.x - core.bigmap.offsetX + (t.stop?0:scan[t.direction].x*offset),
|
||||||
"posy": 32*t.y + (t.stop?0:scan[t.direction].y*offset),
|
"posy": 32*t.y - core.bigmap.offsetY + (t.stop?0:scan[t.direction].y*offset),
|
||||||
"status": t.stop?"stop":status,
|
"status": t.stop?"stop":status,
|
||||||
"index": index++
|
"index": index++
|
||||||
});
|
});
|
||||||
@ -1031,13 +1071,15 @@ control.prototype.drawHero = function (direction, x, y, status, offset) {
|
|||||||
|
|
||||||
drawObjs.sort(function (a, b) {
|
drawObjs.sort(function (a, b) {
|
||||||
return a.posy==b.posy?b.index-a.index:a.posy-b.posy;
|
return a.posy==b.posy?b.index-a.index:a.posy-b.posy;
|
||||||
})
|
});
|
||||||
|
|
||||||
drawObjs.forEach(function (block) {
|
drawObjs.forEach(function (block) {
|
||||||
core.canvas.hero.drawImage(block.img, block.heroIcon[block.status]*32,
|
core.canvas.hero.drawImage(block.img, block.heroIcon[block.status]*32,
|
||||||
block.heroIcon.loc * block.height, 32, block.height,
|
block.heroIcon.loc * block.height, 32, block.height,
|
||||||
block.posx, block.posy+32-block.height, 32, block.height);
|
block.posx, block.posy+32-block.height, 32, block.height);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
core.control.updateViewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 设置勇士的位置 //////
|
////// 设置勇士的位置 //////
|
||||||
@ -1142,30 +1184,30 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
core.status.checkBlock.map = []; // 记录怪物地图
|
core.status.checkBlock.map = []; // 记录怪物地图
|
||||||
for (var n=0;n<blocks.length;n++) {
|
for (var n=0;n<blocks.length;n++) {
|
||||||
var block = blocks[n];
|
var block = blocks[n];
|
||||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0) {
|
if (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0) {
|
||||||
var id = block.event.id, enemy = core.material.enemys[id];
|
var id = block.event.id, enemy = core.material.enemys[id];
|
||||||
if (core.isset(enemy)) {
|
if (core.isset(enemy)) {
|
||||||
core.status.checkBlock.map[13*block.x+block.y]=id;
|
core.status.checkBlock.map[block.x+core.bigmap.width*block.y]=id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 血网
|
// 血网
|
||||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) &&
|
if (core.isset(block.event) && !block.disable &&
|
||||||
block.event.id=='lavaNet' && block.event.trigger=='passNet' && !core.hasItem("shoes")) {
|
block.event.id=='lavaNet' && block.event.trigger=='passNet' && !core.hasItem("shoes")) {
|
||||||
core.status.checkBlock.map[13*block.x+block.y]="lavaNet";
|
core.status.checkBlock.map[block.x+core.bigmap.width*block.y]="lavaNet";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step2: 更新领域、阻击伤害
|
// Step2: 更新领域、阻击伤害
|
||||||
core.status.checkBlock.damage = []; // 记录(x,y)点的伤害
|
core.status.checkBlock.damage = []; // 记录(x,y)点的伤害
|
||||||
for (var x=0;x<13*13;x++) core.status.checkBlock.damage[x]=0;
|
for (var x=0;x<core.bigmap.width*core.bigmap.height;x++) core.status.checkBlock.damage[x]=0;
|
||||||
|
|
||||||
for (var x=0;x<13;x++) {
|
for (var x=0;x<core.bigmap.width;x++) {
|
||||||
for (var y=0;y<13;y++) {
|
for (var y=0;y<core.bigmap.height;y++) {
|
||||||
var id = core.status.checkBlock.map[13*x+y];
|
var id = core.status.checkBlock.map[x+core.bigmap.width*y];
|
||||||
if (core.isset(id)) {
|
if (core.isset(id)) {
|
||||||
|
|
||||||
if (id=="lavaNet") {
|
if (id=="lavaNet") {
|
||||||
core.status.checkBlock.damage[13*x+y]+=core.values.lavaDamage;
|
core.status.checkBlock.damage[x+core.bigmap.width*y]+=core.values.lavaDamage||0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,20 +1221,29 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
for (var dy=-range;dy<=range;dy++) {
|
for (var dy=-range;dy<=range;dy++) {
|
||||||
if (dx==0 && dy==0) continue;
|
if (dx==0 && dy==0) continue;
|
||||||
var nx=x+dx, ny=y+dy;
|
var nx=x+dx, ny=y+dy;
|
||||||
if (nx<0 || nx>12 || ny<0 || ny>12) continue;
|
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height) continue;
|
||||||
if (!zoneSquare && Math.abs(dx)+Math.abs(dy)>range) continue;
|
if (!zoneSquare && Math.abs(dx)+Math.abs(dy)>range) continue;
|
||||||
core.status.checkBlock.damage[13*nx+ny]+=enemy.value;
|
core.status.checkBlock.damage[nx+ny*core.bigmap.width]+=enemy.value||0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 存在激光
|
||||||
|
if (core.enemys.hasSpecial(enemy.special, 24)) {
|
||||||
|
for (var nx=0;nx<core.bigmap.width;nx++) {
|
||||||
|
if (nx!=x) core.status.checkBlock.damage[nx+y*core.bigmap.width]+=enemy.value||0;
|
||||||
|
}
|
||||||
|
for (var ny=0;ny<core.bigmap.height;ny++) {
|
||||||
|
if (ny!=y) core.status.checkBlock.damage[x+ny*core.bigmap.width]+=enemy.value||0;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 存在阻击
|
// 存在阻击
|
||||||
if (core.enemys.hasSpecial(enemy.special, 18)) {
|
if (core.enemys.hasSpecial(enemy.special, 18)) {
|
||||||
for (var dx=-1;dx<=1;dx++) {
|
for (var dx=-1;dx<=1;dx++) {
|
||||||
for (var dy=-1;dy<=1;dy++) {
|
for (var dy=-1;dy<=1;dy++) {
|
||||||
if (dx==0 && dy==0) continue;
|
if (dx==0 && dy==0) continue;
|
||||||
var nx=x+dx, ny=y+dy;
|
var nx=x+dx, ny=y+dy;
|
||||||
if (nx<0 || nx>12 || ny<0 || ny>12 || Math.abs(dx)+Math.abs(dy)>1) continue;
|
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height || Math.abs(dx)+Math.abs(dy)>1) continue;
|
||||||
core.status.checkBlock.damage[13*nx+ny]+=enemy.value;
|
core.status.checkBlock.damage[nx+ny*core.bigmap.width]+=enemy.value||0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1203,12 +1254,12 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
|
|
||||||
// Step3: 更新夹击点坐标,并将夹击伤害加入到damage中
|
// Step3: 更新夹击点坐标,并将夹击伤害加入到damage中
|
||||||
core.status.checkBlock.betweenAttack = []; // 记录(x,y)点是否有夹击
|
core.status.checkBlock.betweenAttack = []; // 记录(x,y)点是否有夹击
|
||||||
for (var x=0;x<13;x++) {
|
for (var x=0;x<core.bigmap.width;x++) {
|
||||||
for (var y=0;y<13;y++) {
|
for (var y=0;y<core.bigmap.height;y++) {
|
||||||
var has=false;
|
var has=false;
|
||||||
if (x>0 && x<12) {
|
if (x>0 && x<core.bigmap.width-1) {
|
||||||
var id1=core.status.checkBlock.map[13*(x-1)+y],
|
var id1=core.status.checkBlock.map[x-1+core.bigmap.width*y],
|
||||||
id2=core.status.checkBlock.map[13*(x+1)+y];
|
id2=core.status.checkBlock.map[x+1+core.bigmap.height*y];
|
||||||
if (core.isset(id1) && core.isset(id2) && id1==id2) {
|
if (core.isset(id1) && core.isset(id2) && id1==id2) {
|
||||||
var enemy = core.material.enemys[id1];
|
var enemy = core.material.enemys[id1];
|
||||||
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
|
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
|
||||||
@ -1216,9 +1267,9 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (y>0 && y<12) {
|
if (y>0 && y<core.bigmap.height-1) {
|
||||||
var id1=core.status.checkBlock.map[13*x+y-1],
|
var id1=core.status.checkBlock.map[x+core.bigmap.width*(y-1)],
|
||||||
id2=core.status.checkBlock.map[13*x+y+1];
|
id2=core.status.checkBlock.map[x+core.bigmap.width*(y+1)];
|
||||||
if (core.isset(id1) && core.isset(id2) && id1==id2) {
|
if (core.isset(id1) && core.isset(id2) && id1==id2) {
|
||||||
var enemy = core.material.enemys[id1];
|
var enemy = core.material.enemys[id1];
|
||||||
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
|
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
|
||||||
@ -1228,10 +1279,10 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
}
|
}
|
||||||
// 存在夹击
|
// 存在夹击
|
||||||
if (has) {
|
if (has) {
|
||||||
core.status.checkBlock.betweenAttack[13*x+y]=true;
|
core.status.checkBlock.betweenAttack[x+core.bigmap.width*y]=true;
|
||||||
var leftHp = core.status.hero.hp - core.status.checkBlock.damage[13*x+y];
|
var leftHp = core.status.hero.hp - core.status.checkBlock.damage[x+core.bigmap.width*y];
|
||||||
if (leftHp>1)
|
if (leftHp>1)
|
||||||
core.status.checkBlock.damage[13*x+y] += Math.floor((leftHp+(core.flags.betweenAttackCeil?0:1))/2);
|
core.status.checkBlock.damage[x+core.bigmap.width*y] += Math.floor((leftHp+(core.flags.betweenAttackCeil?0:1))/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1240,7 +1291,7 @@ control.prototype.updateCheckBlock = function() {
|
|||||||
////// 检查并执行领域、夹击、阻击事件 //////
|
////// 检查并执行领域、夹击、阻击事件 //////
|
||||||
control.prototype.checkBlock = function () {
|
control.prototype.checkBlock = function () {
|
||||||
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
||||||
var damage = core.status.checkBlock.damage[13*x+y];
|
var damage = core.status.checkBlock.damage[x+core.bigmap.width*y];
|
||||||
if (damage>0) {
|
if (damage>0) {
|
||||||
core.status.hero.hp -= damage;
|
core.status.hero.hp -= damage;
|
||||||
|
|
||||||
@ -1254,8 +1305,8 @@ control.prototype.checkBlock = function () {
|
|||||||
}
|
}
|
||||||
for (var direction in scan) {
|
for (var direction in scan) {
|
||||||
var nx = x+scan[direction].x, ny=y+scan[direction].y;
|
var nx = x+scan[direction].x, ny=y+scan[direction].y;
|
||||||
if (nx<0 || nx>12 || ny<0 || ny>12) continue;
|
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height) continue;
|
||||||
var id=core.status.checkBlock.map[13*nx+ny];
|
var id=core.status.checkBlock.map[nx+core.bigmap.width*ny];
|
||||||
if (core.isset(id)) {
|
if (core.isset(id)) {
|
||||||
var enemy = core.material.enemys[id];
|
var enemy = core.material.enemys[id];
|
||||||
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 18)) {
|
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 18)) {
|
||||||
@ -1264,10 +1315,10 @@ control.prototype.checkBlock = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core.status.checkBlock.betweenAttack[13*x+y] && damage>0) {
|
if (core.status.checkBlock.betweenAttack[x+core.bigmap.width*y] && damage>0) {
|
||||||
core.drawTip('受到夹击,生命变成一半');
|
core.drawTip('受到夹击,生命变成一半');
|
||||||
}
|
}
|
||||||
else if (core.status.checkBlock.map[13*x+y]=='lavaNet') {
|
else if (core.status.checkBlock.map[x+core.bigmap.width*y]=='lavaNet') {
|
||||||
core.drawTip('受到血网伤害'+damage+'点');
|
core.drawTip('受到血网伤害'+damage+'点');
|
||||||
}
|
}
|
||||||
// 阻击
|
// 阻击
|
||||||
@ -1275,7 +1326,7 @@ control.prototype.checkBlock = function () {
|
|||||||
core.drawTip('受到阻击伤害'+damage+'点');
|
core.drawTip('受到阻击伤害'+damage+'点');
|
||||||
}
|
}
|
||||||
else if (damage>0) {
|
else if (damage>0) {
|
||||||
core.drawTip('受到领域伤害'+damage+'点');
|
core.drawTip('受到领域或激光伤害'+damage+'点');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damage>0) {
|
if (damage>0) {
|
||||||
@ -1294,7 +1345,7 @@ control.prototype.checkBlock = function () {
|
|||||||
var x=t.x, y=t.y, direction = t.direction;
|
var x=t.x, y=t.y, direction = t.direction;
|
||||||
var nx = x+scan[direction].x, ny=y+scan[direction].y;
|
var nx = x+scan[direction].x, ny=y+scan[direction].y;
|
||||||
|
|
||||||
return nx>=0 && nx<=12 && ny>=0 && ny<=12 && core.getBlock(nx, ny, core.status.floorId, false)==null;
|
return nx>=0 && nx<core.bigmap.width && ny>=0 && ny<core.bigmap.height && core.getBlock(nx, ny, null, true)==null;
|
||||||
});
|
});
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
if (snipe.length>0)
|
if (snipe.length>0)
|
||||||
@ -1434,7 +1485,7 @@ control.prototype.setWeather = function (type, level) {
|
|||||||
|
|
||||||
// 非雨雪
|
// 非雨雪
|
||||||
if (type!='rain' && type!='snow') {
|
if (type!='rain' && type!='snow') {
|
||||||
core.clearMap('weather', 0, 0, 416, 416)
|
core.clearMap('weather')
|
||||||
core.animateFrame.weather.type = null;
|
core.animateFrame.weather.type = null;
|
||||||
core.animateFrame.weather.level = 0;
|
core.animateFrame.weather.level = 0;
|
||||||
core.animateFrame.weather.nodes = [];
|
core.animateFrame.weather.nodes = [];
|
||||||
@ -1453,7 +1504,7 @@ control.prototype.setWeather = function (type, level) {
|
|||||||
if (level<1) level=1; if (level>10) level=10;
|
if (level<1) level=1; if (level>10) level=10;
|
||||||
level *= 20;
|
level *= 20;
|
||||||
|
|
||||||
core.clearMap('weather', 0, 0, 416, 416)
|
core.clearMap('weather')
|
||||||
core.animateFrame.weather.type = type;
|
core.animateFrame.weather.type = type;
|
||||||
core.animateFrame.weather.level = level;
|
core.animateFrame.weather.level = level;
|
||||||
|
|
||||||
@ -1536,7 +1587,7 @@ control.prototype.updateFg = function () {
|
|||||||
if (!core.isset(core.status.thisMap) || !core.isset(core.status.thisMap.blocks)) return;
|
if (!core.isset(core.status.thisMap) || !core.isset(core.status.thisMap.blocks)) return;
|
||||||
// 更新显伤
|
// 更新显伤
|
||||||
var mapBlocks = core.status.thisMap.blocks;
|
var mapBlocks = core.status.thisMap.blocks;
|
||||||
core.clearMap('fg', 0, 0, 416, 416);
|
core.clearMap('fg');
|
||||||
// 没有怪物手册
|
// 没有怪物手册
|
||||||
if (!core.hasItem('book')) return;
|
if (!core.hasItem('book')) return;
|
||||||
core.setFont('fg', "bold 11px Arial");
|
core.setFont('fg', "bold 11px Arial");
|
||||||
@ -1546,7 +1597,7 @@ control.prototype.updateFg = function () {
|
|||||||
for (var b = 0; b < mapBlocks.length; b++) {
|
for (var b = 0; b < mapBlocks.length; b++) {
|
||||||
var x = mapBlocks[b].x, y = mapBlocks[b].y;
|
var x = mapBlocks[b].x, y = mapBlocks[b].y;
|
||||||
if (core.isset(mapBlocks[b].event) && mapBlocks[b].event.cls.indexOf('enemy')==0
|
if (core.isset(mapBlocks[b].event) && mapBlocks[b].event.cls.indexOf('enemy')==0
|
||||||
&& !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable)) {
|
&& !mapBlocks[b].disable) {
|
||||||
|
|
||||||
// 非系统默认的战斗事件(被覆盖)
|
// 非系统默认的战斗事件(被覆盖)
|
||||||
if (mapBlocks[b].event.trigger != 'battle') {
|
if (mapBlocks[b].event.trigger != 'battle') {
|
||||||
@ -1610,9 +1661,9 @@ control.prototype.updateFg = function () {
|
|||||||
// 如果是领域&夹击
|
// 如果是领域&夹击
|
||||||
if (core.flags.displayExtraDamage) {
|
if (core.flags.displayExtraDamage) {
|
||||||
core.canvas.fg.textAlign = 'center';
|
core.canvas.fg.textAlign = 'center';
|
||||||
for (var x=0;x<13;x++) {
|
for (var x=0;x<core.bigmap.width;x++) {
|
||||||
for (var y=0;y<13;y++) {
|
for (var y=0;y<core.bigmap.height;y++) {
|
||||||
var damage = core.status.checkBlock.damage[13*x+y];
|
var damage = core.status.checkBlock.damage[x+core.bigmap.width*y];
|
||||||
if (damage>0) {
|
if (damage>0) {
|
||||||
damage = core.formatBigNumber(damage);
|
damage = core.formatBigNumber(damage);
|
||||||
core.setFillStyle('fg', '#000000');
|
core.setFillStyle('fg', '#000000');
|
||||||
@ -1687,14 +1738,14 @@ control.prototype.startReplay = function (list) {
|
|||||||
|
|
||||||
////// 更改播放状态 //////
|
////// 更改播放状态 //////
|
||||||
control.prototype.triggerReplay = function () {
|
control.prototype.triggerReplay = function () {
|
||||||
if (core.status.event.id=='save' || core.status.event.id=='book') return;
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return;
|
||||||
if (core.status.replay.pausing) this.resumeReplay();
|
if (core.status.replay.pausing) this.resumeReplay();
|
||||||
else this.pauseReplay();
|
else this.pauseReplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 暂停播放 //////
|
////// 暂停播放 //////
|
||||||
control.prototype.pauseReplay = function () {
|
control.prototype.pauseReplay = function () {
|
||||||
if (core.status.event.id=='save' || core.status.event.id=='book') return;
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return;
|
||||||
if (!core.status.replay.replaying) return;
|
if (!core.status.replay.replaying) return;
|
||||||
core.status.replay.pausing = true;
|
core.status.replay.pausing = true;
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
@ -1703,7 +1754,7 @@ control.prototype.pauseReplay = function () {
|
|||||||
|
|
||||||
////// 恢复播放 //////
|
////// 恢复播放 //////
|
||||||
control.prototype.resumeReplay = function () {
|
control.prototype.resumeReplay = function () {
|
||||||
if (core.status.event.id=='save' || core.status.event.id=='book') return;
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return;
|
||||||
if (!core.status.replay.replaying) return;
|
if (!core.status.replay.replaying) return;
|
||||||
core.status.replay.pausing = false;
|
core.status.replay.pausing = false;
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
@ -1713,7 +1764,7 @@ control.prototype.resumeReplay = function () {
|
|||||||
|
|
||||||
////// 加速播放 //////
|
////// 加速播放 //////
|
||||||
control.prototype.speedUpReplay = function () {
|
control.prototype.speedUpReplay = function () {
|
||||||
if (core.status.event.id=='save' || core.status.event.id=='book') return;
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return;
|
||||||
if (!core.status.replay.replaying) return;
|
if (!core.status.replay.replaying) return;
|
||||||
var toAdd = core.status.replay.speed>=3?3:core.status.replay.speed>=2?2:1;
|
var toAdd = core.status.replay.speed>=3?3:core.status.replay.speed>=2?2:1;
|
||||||
core.status.replay.speed = parseInt(10*core.status.replay.speed + toAdd)/10;
|
core.status.replay.speed = parseInt(10*core.status.replay.speed + toAdd)/10;
|
||||||
@ -1723,7 +1774,7 @@ control.prototype.speedUpReplay = function () {
|
|||||||
|
|
||||||
////// 减速播放 //////
|
////// 减速播放 //////
|
||||||
control.prototype.speedDownReplay = function () {
|
control.prototype.speedDownReplay = function () {
|
||||||
if (core.status.event.id=='save' || core.status.event.id=='book') return;
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return;
|
||||||
if (!core.status.replay.replaying) return;
|
if (!core.status.replay.replaying) return;
|
||||||
var toAdd = core.status.replay.speed>3?3:core.status.replay.speed>2?2:1;
|
var toAdd = core.status.replay.speed>3?3:core.status.replay.speed>2?2:1;
|
||||||
core.status.replay.speed = parseInt(10*core.status.replay.speed - toAdd)/10;
|
core.status.replay.speed = parseInt(10*core.status.replay.speed - toAdd)/10;
|
||||||
@ -1733,7 +1784,7 @@ control.prototype.speedDownReplay = function () {
|
|||||||
|
|
||||||
////// 停止播放 //////
|
////// 停止播放 //////
|
||||||
control.prototype.stopReplay = function () {
|
control.prototype.stopReplay = function () {
|
||||||
if (core.status.event.id=='save' || core.status.event.id=='book') return;
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return;
|
||||||
if (!core.status.replay.replaying) return;
|
if (!core.status.replay.replaying) return;
|
||||||
core.status.replay.toReplay = [];
|
core.status.replay.toReplay = [];
|
||||||
core.status.replay.totalList = [];
|
core.status.replay.totalList = [];
|
||||||
@ -1748,7 +1799,7 @@ control.prototype.stopReplay = function () {
|
|||||||
|
|
||||||
////// 回退 //////
|
////// 回退 //////
|
||||||
control.prototype.rewindReplay = function () {
|
control.prototype.rewindReplay = function () {
|
||||||
if (core.status.event.id=='save' || core.status.event.id=='book') return;
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return;
|
||||||
if (!core.status.replay.replaying) return;
|
if (!core.status.replay.replaying) return;
|
||||||
if (!core.status.replay.pausing) {
|
if (!core.status.replay.pausing) {
|
||||||
core.drawTip("请先暂停录像");
|
core.drawTip("请先暂停录像");
|
||||||
@ -1783,7 +1834,7 @@ control.prototype.rewindReplay = function () {
|
|||||||
|
|
||||||
////// 回放时存档 //////
|
////// 回放时存档 //////
|
||||||
control.prototype.saveReplay = function () {
|
control.prototype.saveReplay = function () {
|
||||||
if (core.status.event.id=='save' || core.status.event.id=='book') return;
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return;
|
||||||
if (!core.status.replay.replaying) return;
|
if (!core.status.replay.replaying) return;
|
||||||
if (!core.status.replay.pausing) {
|
if (!core.status.replay.pausing) {
|
||||||
core.drawTip("请先暂停录像");
|
core.drawTip("请先暂停录像");
|
||||||
@ -1804,7 +1855,33 @@ control.prototype.saveReplay = function () {
|
|||||||
|
|
||||||
////// 回放时查看怪物手册 //////
|
////// 回放时查看怪物手册 //////
|
||||||
control.prototype.bookReplay = function () {
|
control.prototype.bookReplay = function () {
|
||||||
if (core.status.event.id=='save' || core.status.event.id=='book') return;
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0) return;
|
||||||
|
if (!core.status.replay.replaying) return;
|
||||||
|
if (!core.status.replay.pausing) {
|
||||||
|
core.drawTip("请先暂停录像");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从“浏览地图”页面打开
|
||||||
|
if (core.status.event.id=='viewMaps') {
|
||||||
|
core.status.event.selection = core.status.event.data;
|
||||||
|
core.status.event.id=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (core.status.replay.animate || core.isset(core.status.event.id)) {
|
||||||
|
core.drawTip("请等待当前事件的处理结束");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.lockControl();
|
||||||
|
core.status.event.id='book';
|
||||||
|
core.useItem('book');
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 回放录像时浏览地图 //////
|
||||||
|
control.prototype.viewMapReplay = function () {
|
||||||
|
if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return;
|
||||||
|
|
||||||
if (!core.status.replay.replaying) return;
|
if (!core.status.replay.replaying) return;
|
||||||
if (!core.status.replay.pausing) {
|
if (!core.status.replay.pausing) {
|
||||||
core.drawTip("请先暂停录像");
|
core.drawTip("请先暂停录像");
|
||||||
@ -1816,8 +1893,8 @@ control.prototype.bookReplay = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
core.lockControl();
|
core.lockControl();
|
||||||
core.status.event.id='book';
|
core.status.event.id='viewMaps';
|
||||||
core.useItem('book');
|
core.ui.drawMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 回放 //////
|
////// 回放 //////
|
||||||
@ -1951,8 +2028,11 @@ control.prototype.replay = function () {
|
|||||||
|
|
||||||
var pos=action.substring(5).split(":");
|
var pos=action.substring(5).split(":");
|
||||||
var x=parseInt(pos[0]), y=parseInt(pos[1]);
|
var x=parseInt(pos[0]), y=parseInt(pos[1]);
|
||||||
|
var nowx=core.getHeroLoc('x'), nowy=core.getHeroLoc('y');
|
||||||
if (core.control.moveDirectly(x,y)) {
|
if (core.control.moveDirectly(x,y)) {
|
||||||
|
core.ui.drawArrow('route', 32*nowx+16, 32*nowy+16, 32*x+16, 32*y+16, '#FF0000', 3);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
core.clearMap('route');
|
||||||
core.replay();
|
core.replay();
|
||||||
}, 750 / Math.max(1, core.status.replay.speed));
|
}, 750 / Math.max(1, core.status.replay.speed));
|
||||||
return;
|
return;
|
||||||
@ -2567,6 +2647,11 @@ control.prototype.updateStatusBar = function () {
|
|||||||
core.statusBar.weak.innerHTML = core.hasFlag('weak')?"衰":"";
|
core.statusBar.weak.innerHTML = core.hasFlag('weak')?"衰":"";
|
||||||
core.statusBar.curse.innerHTML = core.hasFlag('curse')?"咒":"";
|
core.statusBar.curse.innerHTML = core.hasFlag('curse')?"咒":"";
|
||||||
}
|
}
|
||||||
|
if (core.flags.enablePZF) {
|
||||||
|
core.statusBar.pickaxe.innerHTML = "破"+core.itemCount('pickaxe');
|
||||||
|
core.statusBar.bomb.innerHTML = "炸"+core.itemCount('bomb');
|
||||||
|
core.statusBar.fly.innerHTML = "飞"+core.itemCount('centerFly');
|
||||||
|
}
|
||||||
|
|
||||||
core.statusBar.hard.innerHTML = core.status.hard;
|
core.statusBar.hard.innerHTML = core.status.hard;
|
||||||
|
|
||||||
@ -2651,6 +2736,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
if (!core.flags.enableLevelUp) count--;
|
if (!core.flags.enableLevelUp) count--;
|
||||||
if (!core.flags.enableDebuff) count--;
|
if (!core.flags.enableDebuff) count--;
|
||||||
if (core.isset(core.flags.enableKeys) && !core.flags.enableKeys) count--;
|
if (core.isset(core.flags.enableKeys) && !core.flags.enableKeys) count--;
|
||||||
|
if (!core.flags.enablePZF) count--;
|
||||||
|
|
||||||
var statusLineHeight = BASE_LINEHEIGHT * 9 / count;
|
var statusLineHeight = BASE_LINEHEIGHT * 9 / count;
|
||||||
var statusLineFontSize = DEFAULT_FONT_SIZE;
|
var statusLineFontSize = DEFAULT_FONT_SIZE;
|
||||||
@ -2790,11 +2876,8 @@ control.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
{
|
{
|
||||||
className: 'gameCanvas',
|
className: 'gameCanvas',
|
||||||
rules:{
|
rules:{
|
||||||
width: canvasWidth + unit,
|
width: (canvasWidth - SPACE*2) + unit,
|
||||||
height: canvasWidth + unit,
|
height: (canvasWidth - SPACE*2) + unit,
|
||||||
top: canvasTop + unit,
|
|
||||||
right: 0,
|
|
||||||
border: '3px '+borderColor+' solid',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2824,6 +2907,16 @@ control.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
right: SPACE + unit,
|
right: SPACE + unit,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'gameDraw',
|
||||||
|
rules: {
|
||||||
|
width: (canvasWidth - SPACE*2) + unit,
|
||||||
|
height:(canvasWidth - SPACE*2) + unit,
|
||||||
|
top: canvasTop + unit,
|
||||||
|
right: 0,
|
||||||
|
border: '3px #fff solid'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'floorMsgGroup',
|
id: 'floorMsgGroup',
|
||||||
rules:{
|
rules:{
|
||||||
@ -2943,6 +3036,12 @@ control.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
display: !core.isset(core.flags.enableKeys)||core.flags.enableKeys?'block':'none'
|
display: !core.isset(core.flags.enableKeys)||core.flags.enableKeys?'block':'none'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'pzfCol',
|
||||||
|
rules: {
|
||||||
|
display: core.flags.enablePZF?'block':'none'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'id': 'debuffCol',
|
'id': 'debuffCol',
|
||||||
rules: {
|
rules: {
|
||||||
@ -2993,4 +3092,12 @@ control.prototype.domRenderer = function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// resize map
|
||||||
|
if (core.isPlaying() && core.isset(core.status) && core.isset(core.bigmap)) {
|
||||||
|
core.bigmap.canvas.forEach(function(cn){
|
||||||
|
core.canvas[cn].canvas.style.width = core.bigmap.width*32*core.domStyle.scale + "px";
|
||||||
|
core.canvas[cn].canvas.style.height = core.bigmap.height*32*core.domStyle.scale + "px";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
34
libs/core.js
34
libs/core.js
@ -71,6 +71,14 @@ function core() {
|
|||||||
styles: [],
|
styles: [],
|
||||||
scale: 1.0,
|
scale: 1.0,
|
||||||
}
|
}
|
||||||
|
this.bigmap = {
|
||||||
|
canvas: ["bg", "event", "event2", "fg", "route"],
|
||||||
|
offsetX: 0, // in pixel
|
||||||
|
offsetY: 0,
|
||||||
|
width: 13, // map width and height
|
||||||
|
height: 13,
|
||||||
|
tempCanvas: null, // A temp canvas for drawing
|
||||||
|
}
|
||||||
this.initStatus = {
|
this.initStatus = {
|
||||||
'played': false,
|
'played': false,
|
||||||
'gameOver': false,
|
'gameOver': false,
|
||||||
@ -143,7 +151,6 @@ function core() {
|
|||||||
"time": 0,
|
"time": 0,
|
||||||
},
|
},
|
||||||
'curtainColor': null,
|
'curtainColor': null,
|
||||||
'usingCenterFly':false,
|
|
||||||
'openingDoor': null,
|
'openingDoor': null,
|
||||||
'isSkiing': false,
|
'isSkiing': false,
|
||||||
|
|
||||||
@ -263,6 +270,8 @@ core.prototype.init = function (coreData, callback) {
|
|||||||
core.material.ground = new Image();
|
core.material.ground = new Image();
|
||||||
core.material.ground.src = "project/images/ground.png";
|
core.material.ground.src = "project/images/ground.png";
|
||||||
|
|
||||||
|
core.bigmap.tempCanvas = document.createElement('canvas').getContext('2d');
|
||||||
|
|
||||||
core.loader.load(function () {
|
core.loader.load(function () {
|
||||||
console.log(core.material);
|
console.log(core.material);
|
||||||
// 设置勇士高度
|
// 设置勇士高度
|
||||||
@ -657,13 +666,18 @@ core.prototype.enemyExists = function (x, y, id,floorId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 获得某个点的block //////
|
////// 获得某个点的block //////
|
||||||
core.prototype.getBlock = function (x, y, floorId, needEnable) {
|
core.prototype.getBlock = function (x, y, floorId, showDisable) {
|
||||||
return core.maps.getBlock(x,y,floorId,needEnable);
|
return core.maps.getBlock(x,y,floorId,showDisable);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 获得某个点的blockId //////
|
////// 获得某个点的blockId //////
|
||||||
core.prototype.getBlockId = function (x, y, floorId, needEnable) {
|
core.prototype.getBlockId = function (x, y, floorId, showDisable) {
|
||||||
return core.maps.getBlockId(x, y, floorId, needEnable);
|
return core.maps.getBlockId(x, y, floorId, showDisable);
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 获得某个点的blockCls //////
|
||||||
|
core.prototype.getBlockCls = function (x, y, floorId, showDisable) {
|
||||||
|
return core.maps.getBlockCls(x, y, floorId, showDisable);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 显示移动某块的动画,达到{“type”:”move”}的效果 //////
|
////// 显示移动某块的动画,达到{“type”:”move”}的效果 //////
|
||||||
@ -988,10 +1002,16 @@ core.prototype.saveReplay = function () {
|
|||||||
core.control.saveReplay();
|
core.control.saveReplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 回放时查看怪物手册 //////
|
||||||
core.prototype.bookReplay = function () {
|
core.prototype.bookReplay = function () {
|
||||||
core.control.bookReplay();
|
core.control.bookReplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 回放录像时浏览地图 //////
|
||||||
|
core.prototype.viewMapReplay = function () {
|
||||||
|
core.control.viewMapReplay();
|
||||||
|
}
|
||||||
|
|
||||||
////// 回放 //////
|
////// 回放 //////
|
||||||
core.prototype.replay = function () {
|
core.prototype.replay = function () {
|
||||||
core.control.replay();
|
core.control.replay();
|
||||||
@ -1141,6 +1161,10 @@ core.prototype.subarray = function (a, b) {
|
|||||||
return core.utils.subarray(a, b);
|
return core.utils.subarray(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.prototype.clamp = function (x, a, b) {
|
||||||
|
return core.utils.clamp(x, a, b);
|
||||||
|
}
|
||||||
|
|
||||||
////// Base64加密 //////
|
////// Base64加密 //////
|
||||||
core.prototype.encodeBase64 = function (str) {
|
core.prototype.encodeBase64 = function (str) {
|
||||||
return core.utils.encodeBase64(str);
|
return core.utils.encodeBase64(str);
|
||||||
|
|||||||
@ -228,7 +228,7 @@ enemys.prototype.getCurrentEnemys = function (floorId) {
|
|||||||
var used = {};
|
var used = {};
|
||||||
var mapBlocks = core.status.maps[floorId].blocks;
|
var mapBlocks = core.status.maps[floorId].blocks;
|
||||||
for (var b = 0; b < mapBlocks.length; b++) {
|
for (var b = 0; b < mapBlocks.length; b++) {
|
||||||
if (core.isset(mapBlocks[b].event) && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable)
|
if (core.isset(mapBlocks[b].event) && !mapBlocks[b].disable
|
||||||
&& mapBlocks[b].event.cls.indexOf('enemy')==0) {
|
&& mapBlocks[b].event.cls.indexOf('enemy')==0) {
|
||||||
var enemyId = mapBlocks[b].event.id;
|
var enemyId = mapBlocks[b].event.id;
|
||||||
if (core.isset(used[enemyId])) continue;
|
if (core.isset(used[enemyId])) continue;
|
||||||
|
|||||||
@ -131,9 +131,9 @@ events.prototype.lose = function (reason) {
|
|||||||
events.prototype.gameOver = function (ending, fromReplay, norank) {
|
events.prototype.gameOver = function (ending, fromReplay, norank) {
|
||||||
|
|
||||||
// 清空图片和天气
|
// 清空图片和天气
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
core.dom.gif2.innerHTML = "";
|
core.dom.gif2.innerHTML = "";
|
||||||
core.clearMap('weather', 0, 0, 416, 416)
|
core.clearMap('weather')
|
||||||
core.animateFrame.weather.type = null;
|
core.animateFrame.weather.type = null;
|
||||||
core.animateFrame.weather.level = 0;
|
core.animateFrame.weather.level = 0;
|
||||||
core.animateFrame.weather.nodes = [];
|
core.animateFrame.weather.nodes = [];
|
||||||
@ -281,7 +281,7 @@ events.prototype.doAction = function() {
|
|||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
clearInterval(core.status.event.interval);
|
clearInterval(core.status.event.interval);
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
|
|
||||||
// 事件处理完毕
|
// 事件处理完毕
|
||||||
@ -513,7 +513,7 @@ events.prototype.doAction = function() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "changePos": // 直接更换勇士位置,不切换楼层
|
case "changePos": // 直接更换勇士位置,不切换楼层
|
||||||
core.clearMap('hero', 0, 0, 416, 416);
|
core.clearMap('hero');
|
||||||
if (core.isset(data.loc)) {
|
if (core.isset(data.loc)) {
|
||||||
core.setHeroLoc('x', core.calValue(data.loc[0]));
|
core.setHeroLoc('x', core.calValue(data.loc[0]));
|
||||||
core.setHeroLoc('y', core.calValue(data.loc[1]));
|
core.setHeroLoc('y', core.calValue(data.loc[1]));
|
||||||
@ -527,7 +527,7 @@ events.prototype.doAction = function() {
|
|||||||
core.canvas.animate.drawImage(core.material.images.images[data.name],
|
core.canvas.animate.drawImage(core.material.images.images[data.name],
|
||||||
core.calValue(data.loc[0]), core.calValue(data.loc[1]));
|
core.calValue(data.loc[0]), core.calValue(data.loc[1]));
|
||||||
}
|
}
|
||||||
else core.clearMap('animate', 0, 0, 416, 416);
|
else core.clearMap('animate');
|
||||||
this.doAction();
|
this.doAction();
|
||||||
break;
|
break;
|
||||||
case "animateImage": // 淡入淡出图片
|
case "animateImage": // 淡入淡出图片
|
||||||
@ -587,8 +587,12 @@ events.prototype.doAction = function() {
|
|||||||
break;
|
break;
|
||||||
case "openDoor": // 开一个门,包括暗墙
|
case "openDoor": // 开一个门,包括暗墙
|
||||||
{
|
{
|
||||||
|
if (core.isset(data.loc)) {
|
||||||
|
x = core.calValue(data.loc[0]);
|
||||||
|
y = core.calValue(data.loc[1]);
|
||||||
|
}
|
||||||
var floorId=data.floorId || core.status.floorId;
|
var floorId=data.floorId || core.status.floorId;
|
||||||
var block=core.getBlock(core.calValue(data.loc[0]), core.calValue(data.loc[1]), floorId);
|
var block=core.getBlock(x, y, floorId);
|
||||||
if (block!=null) {
|
if (block!=null) {
|
||||||
if (floorId==core.status.floorId)
|
if (floorId==core.status.floorId)
|
||||||
core.openDoor(block.block.event.id, block.block.x, block.block.y, false, function() {
|
core.openDoor(block.block.event.id, block.block.x, block.block.y, false, function() {
|
||||||
@ -1026,7 +1030,7 @@ events.prototype.trigger = function (x, y) {
|
|||||||
var mapBlocks = core.status.thisMap.blocks;
|
var mapBlocks = core.status.thisMap.blocks;
|
||||||
var noPass;
|
var noPass;
|
||||||
for (var b = 0; b < mapBlocks.length; b++) {
|
for (var b = 0; b < mapBlocks.length; b++) {
|
||||||
if (mapBlocks[b].x == x && mapBlocks[b].y == y && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable)) { // 启用事件
|
if (mapBlocks[b].x == x && mapBlocks[b].y == y && !mapBlocks[b].disable) { // 启用事件
|
||||||
noPass = mapBlocks[b].event && mapBlocks[b].event.noPass;
|
noPass = mapBlocks[b].event && mapBlocks[b].event.noPass;
|
||||||
if (noPass) {
|
if (noPass) {
|
||||||
core.clearAutomaticRouteNode(x, y);
|
core.clearAutomaticRouteNode(x, y);
|
||||||
@ -1102,7 +1106,7 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
|
|||||||
else {
|
else {
|
||||||
var blocks = core.status.maps[floorId].blocks;
|
var blocks = core.status.maps[floorId].blocks;
|
||||||
for (var i in blocks) {
|
for (var i in blocks) {
|
||||||
if (core.isset(blocks[i].event) && !(core.isset(blocks[i].enable) && !blocks[i].enable) && blocks[i].event.id === stair) {
|
if (core.isset(blocks[i].event) && !blocks[i].disable && blocks[i].event.id === stair) {
|
||||||
heroLoc.x = blocks[i].x;
|
heroLoc.x = blocks[i].x;
|
||||||
heroLoc.y = blocks[i].y;
|
heroLoc.y = blocks[i].y;
|
||||||
break;
|
break;
|
||||||
@ -1179,18 +1183,21 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
|
|||||||
// 检查重生
|
// 检查重生
|
||||||
if (!core.isset(fromLoad)) {
|
if (!core.isset(fromLoad)) {
|
||||||
core.status.maps[floorId].blocks.forEach(function(block) {
|
core.status.maps[floorId].blocks.forEach(function(block) {
|
||||||
if (core.isset(block.enable) && !block.enable && core.isset(block.event) && block.event.cls.indexOf('enemy')==0
|
if (block.disable && core.isset(block.event) && block.event.cls.indexOf('enemy')==0
|
||||||
&& core.enemys.hasSpecial(core.material.enemys[block.event.id].special, 23)) {
|
&& core.enemys.hasSpecial(core.material.enemys[block.event.id].special, 23)) {
|
||||||
block.enable = true;
|
block.disable = false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 重置画布尺寸
|
||||||
|
core.maps.resizeMap(floorId);
|
||||||
|
// 画地图
|
||||||
core.drawMap(floorId, function () {
|
core.drawMap(floorId, function () {
|
||||||
if (core.isset(heroLoc.direction))
|
if (core.isset(heroLoc.direction))
|
||||||
core.setHeroLoc('direction', heroLoc.direction);
|
core.setHeroLoc('direction', heroLoc.direction);
|
||||||
core.setHeroLoc('x', heroLoc.x);
|
core.setHeroLoc('x', heroLoc.x);
|
||||||
core.setHeroLoc('y', heroLoc.y);
|
core.setHeroLoc('y', heroLoc.y);
|
||||||
core.clearMap('hero', 0, 0, 416, 416);
|
core.clearMap('hero');
|
||||||
core.drawHero();
|
core.drawHero();
|
||||||
|
|
||||||
var changed = function () {
|
var changed = function () {
|
||||||
@ -1244,7 +1251,7 @@ events.prototype.animateImage = function (type, image, loc, time, callback) {
|
|||||||
core.setOpacity('data', opacityVal);
|
core.setOpacity('data', opacityVal);
|
||||||
if (opacityVal >=1 || opacityVal<=0) {
|
if (opacityVal >=1 || opacityVal<=0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
core.status.replay.animate=false;
|
core.status.replay.animate=false;
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
@ -1264,7 +1271,7 @@ events.prototype.moveImage = function (image, from, to, time, callback) {
|
|||||||
toX = core.calValue(to[0]), toY = core.calValue(to[1]);
|
toX = core.calValue(to[0]), toY = core.calValue(to[1]);
|
||||||
var step = 0;
|
var step = 0;
|
||||||
var drawImage = function () {
|
var drawImage = function () {
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
var nowX = parseInt(fromX + (toX-fromX)*step/64);
|
var nowX = parseInt(fromX + (toX-fromX)*step/64);
|
||||||
var nowY = parseInt(fromY + (toY-fromY)*step/64);
|
var nowY = parseInt(fromY + (toY-fromY)*step/64);
|
||||||
core.canvas.data.drawImage(image, nowX, nowY);
|
core.canvas.data.drawImage(image, nowX, nowY);
|
||||||
@ -1276,7 +1283,7 @@ events.prototype.moveImage = function (image, from, to, time, callback) {
|
|||||||
drawImage();
|
drawImage();
|
||||||
if (step>=64) {
|
if (step>=64) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.status.replay.animate=false;
|
core.status.replay.animate=false;
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
}
|
}
|
||||||
@ -1325,13 +1332,16 @@ events.prototype.vibrate = function(time, callback) {
|
|||||||
|
|
||||||
core.status.replay.animate=true;
|
core.status.replay.animate=true;
|
||||||
|
|
||||||
var setGameCanvasTranslate=function(x,y){
|
var addGameCanvasTranslate=function(x,y){
|
||||||
for(var ii=0,canvas;canvas=core.dom.gameCanvas[ii];ii++){
|
for(var ii=0,canvas;canvas=core.dom.gameCanvas[ii];ii++){
|
||||||
if(['data','ui'].indexOf(canvas.getAttribute('id'))!==-1)continue;
|
var id = canvas.getAttribute('id');
|
||||||
canvas.style.transform='translate('+x+'px,'+y+'px)';
|
if (id=='ui' || id=='data') continue;
|
||||||
canvas.style.webkitTransform='translate('+x+'px,'+y+'px)';
|
var offsetX = x, offsetY = y;
|
||||||
canvas.style.OTransform='translate('+x+'px,'+y+'px)';
|
if (core.bigmap.canvas.indexOf(id)>=0) {
|
||||||
canvas.style.MozTransform='translate('+x+'px,'+y+'px)';
|
offsetX-=core.bigmap.offsetX;
|
||||||
|
offsetY-=core.bigmap.offsetY;
|
||||||
|
}
|
||||||
|
core.control.setGameCanvasTranslate(id, offsetX, offsetY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1365,7 +1375,7 @@ events.prototype.vibrate = function(time, callback) {
|
|||||||
|
|
||||||
var animate=setInterval(function(){
|
var animate=setInterval(function(){
|
||||||
update();
|
update();
|
||||||
setGameCanvasTranslate(shake,0);
|
addGameCanvasTranslate(shake, 0);
|
||||||
if(shake_duration===0) {
|
if(shake_duration===0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.status.replay.animate=false;
|
core.status.replay.animate=false;
|
||||||
@ -1487,10 +1497,15 @@ events.prototype.useItem = function(itemId) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (itemId=='centerFly') {
|
if (itemId=='centerFly') {
|
||||||
core.status.usingCenterFly= true;
|
core.lockControl();
|
||||||
|
core.status.event.id = 'centerFly';
|
||||||
var fillstyle = 'rgba(255,0,0,0.5)';
|
var fillstyle = 'rgba(255,0,0,0.5)';
|
||||||
if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)';
|
if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)';
|
||||||
core.fillRect('ui',(12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32,fillstyle);
|
var toX = core.bigmap.width-1 - core.getHeroLoc('x'), toY = core.bigmap.height-1-core.getHeroLoc('y');
|
||||||
|
core.ui.drawThumbnail(core.status.floorId, 'ui', core.status.thisMap.blocks, 0, 0, 416, toX, toY, core.status.hero.loc, core.getFlag('heroIcon', "hero.png"));
|
||||||
|
var offsetX = core.clamp(toX-6, 0, core.bigmap.width-13), offsetY = core.clamp(toY-6, 0, core.bigmap.height-13);
|
||||||
|
core.fillRect('ui',(toX-offsetX)*32,(toY-offsetY)*32,32,32,fillstyle);
|
||||||
|
core.status.event.data = {"x": toX, "y": toY, "poxX": toX-offsetX, "posY": toY-offsetY};
|
||||||
core.drawTip("请确认当前中心对称飞行器的位置");
|
core.drawTip("请确认当前中心对称飞行器的位置");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1607,9 +1622,9 @@ events.prototype.pushBox = function (data) {
|
|||||||
|
|
||||||
var direction = core.getHeroLoc('direction'), nx=data.x+scan[direction].x, ny=data.y+scan[direction].y;
|
var direction = core.getHeroLoc('direction'), nx=data.x+scan[direction].x, ny=data.y+scan[direction].y;
|
||||||
|
|
||||||
if (nx<0||nx>12||ny<0||ny>12) return;
|
if (nx<0||nx>=core.bigmap.width||ny<0||ny>=core.bigmap.height) return;
|
||||||
|
|
||||||
var block = core.getBlock(nx, ny, null, false);
|
var block = core.getBlock(nx, ny, null, true);
|
||||||
if (block!=null && !(core.isset(block.block.event) && block.block.event.id=='flower'))
|
if (block!=null && !(core.isset(block.block.event) && block.block.event.id=='flower'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
222
libs/maps.js
222
libs/maps.js
@ -16,11 +16,13 @@ maps.prototype.loadFloor = function (floorId, map) {
|
|||||||
content['title'] = floor.title;
|
content['title'] = floor.title;
|
||||||
content['canFlyTo'] = floor.canFlyTo;
|
content['canFlyTo'] = floor.canFlyTo;
|
||||||
if (!core.isset(map)) map=floor.map;
|
if (!core.isset(map)) map=floor.map;
|
||||||
var mapIntoBlocks = function(map,maps,floor){
|
var mapIntoBlocks = function(map,maps,floor,floorId){
|
||||||
var blocks = [];
|
var blocks = [];
|
||||||
for (var i = 0; i < 13; i++) {
|
var mw = core.floors[floorId].width || 13;
|
||||||
for (var j = 0; j < 13; j++) {
|
var mh = core.floors[floorId].height || 13;
|
||||||
var block = maps.initBlock(j, i, map[i][j]);
|
for (var i = 0; i < mh; i++) {
|
||||||
|
for (var j = 0; j < mw; j++) {
|
||||||
|
var block = maps.initBlock(j, i, (map[i]||[])[j]||0);
|
||||||
maps.addInfo(block);
|
maps.addInfo(block);
|
||||||
maps.addEvent(block,j,i,floor.events[j+","+i])
|
maps.addEvent(block,j,i,floor.events[j+","+i])
|
||||||
maps.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
maps.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
||||||
@ -30,32 +32,32 @@ maps.prototype.loadFloor = function (floorId, map) {
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
if (main.mode=='editor'){
|
if (main.mode=='editor'){
|
||||||
main.editor.mapIntoBlocks = function(map,floor){
|
main.editor.mapIntoBlocks = function(map,floor,floorId){
|
||||||
return mapIntoBlocks(map,core.maps,floor);
|
return mapIntoBlocks(map,core.maps,floor,floorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 事件处理
|
// 事件处理
|
||||||
content['blocks'] = mapIntoBlocks(map,this,floor);
|
content['blocks'] = mapIntoBlocks(map,this,floor,floorId);
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 数字和ID的对应关系 //////
|
////// 数字和ID的对应关系 //////
|
||||||
maps.prototype.initBlock = function (x, y, id) {
|
maps.prototype.initBlock = function (x, y, id) {
|
||||||
var enable=null;
|
var disable=null;
|
||||||
id = ""+id;
|
id = ""+id;
|
||||||
if (id.length>2) {
|
if (id.length>2) {
|
||||||
if (id.indexOf(":f")==id.length-2) {
|
if (id.indexOf(":f")==id.length-2) {
|
||||||
id = id.substring(0, id.length - 2);
|
id = id.substring(0, id.length - 2);
|
||||||
enable = false;
|
disable = false;
|
||||||
}
|
}
|
||||||
else if (id.indexOf(":t")==id.length-2) {
|
else if (id.indexOf(":t")==id.length-2) {
|
||||||
id = id.substring(0, id.length - 2);
|
id = id.substring(0, id.length - 2);
|
||||||
enable = true;
|
disable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
id=parseInt(id);
|
id=parseInt(id);
|
||||||
var tmp = {'x': x, 'y': y, 'id': id};
|
var tmp = {'x': x, 'y': y, 'id': id};
|
||||||
if (enable!=null) tmp.enable = enable;
|
if (disable!=null) tmp.disable = disable;
|
||||||
|
|
||||||
if (id in this.blocksInfo) tmp.event = JSON.parse(JSON.stringify(this.blocksInfo[id]));
|
if (id in this.blocksInfo) tmp.event = JSON.parse(JSON.stringify(this.blocksInfo[id]));
|
||||||
|
|
||||||
@ -111,8 +113,8 @@ maps.prototype.addEvent = function (block, x, y, event) {
|
|||||||
block.event.noPass = event.noPass;
|
block.event.noPass = event.noPass;
|
||||||
|
|
||||||
// 覆盖enable
|
// 覆盖enable
|
||||||
if (!core.isset(block.enable) && core.isset(event.enable)) {
|
if (!core.isset(block.disable) && core.isset(event.enable)) {
|
||||||
block.enable=event.enable;
|
block.disable=!event.enable;
|
||||||
}
|
}
|
||||||
// 覆盖trigger
|
// 覆盖trigger
|
||||||
if (!core.isset(block.event.trigger)) {
|
if (!core.isset(block.event.trigger)) {
|
||||||
@ -124,7 +126,7 @@ maps.prototype.addEvent = function (block, x, y, event) {
|
|||||||
}
|
}
|
||||||
// 覆盖其他属性
|
// 覆盖其他属性
|
||||||
for (var key in event) {
|
for (var key in event) {
|
||||||
if (key!="enable" && key!="trigger" && key!="noPass" && core.isset(event[key])) {
|
if (key!="disable" && key!="trigger" && key!="noPass" && core.isset(event[key])) {
|
||||||
block.event[key]=core.clone(event[key]);
|
block.event[key]=core.clone(event[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,17 +160,19 @@ maps.prototype.save = function(maps, floorId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var thisFloor = maps[floorId];
|
var thisFloor = maps[floorId];
|
||||||
|
var mw = core.floors[floorId].width || 13;
|
||||||
|
var mh = core.floors[floorId].height || 13;
|
||||||
|
|
||||||
var blocks = [];
|
var blocks = [];
|
||||||
for (var x=0;x<13;x++) {
|
for (var x=0;x<mw;x++) {
|
||||||
blocks[x]=[];
|
blocks[x]=[];
|
||||||
for (var y=0;y<13;y++) {
|
for (var y=0;y<mh;y++) {
|
||||||
blocks[x].push(0);
|
blocks[x].push(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thisFloor.blocks.forEach(function (block) {
|
thisFloor.blocks.forEach(function (block) {
|
||||||
if (core.isset(block.enable)) {
|
if (core.isset(block.disable)) {
|
||||||
if (block.enable) blocks[block.y][block.x] = block.id+":t";
|
if (!block.disable) blocks[block.y][block.x] = block.id+":t";
|
||||||
else blocks[block.y][block.x] = block.id+":f";
|
else blocks[block.y][block.x] = block.id+":f";
|
||||||
}
|
}
|
||||||
else blocks[block.y][block.x] = block.id;
|
else blocks[block.y][block.x] = block.id;
|
||||||
@ -176,6 +180,25 @@ maps.prototype.save = function(maps, floorId) {
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 更改地图画布的尺寸
|
||||||
|
maps.prototype.resizeMap = function(floorId) {
|
||||||
|
floorId = floorId || core.status.floorId;
|
||||||
|
core.bigmap.width = core.floors[floorId].width || 13;
|
||||||
|
core.bigmap.height = core.floors[floorId].height || 13;
|
||||||
|
var cwidth = core.bigmap.width * 32;
|
||||||
|
var cheight = core.bigmap.height * 32;
|
||||||
|
core.bigmap.canvas.forEach(function(cn){
|
||||||
|
core.canvas[cn].canvas.setAttribute("width",cwidth);
|
||||||
|
core.canvas[cn].canvas.setAttribute("height",cheight);
|
||||||
|
core.canvas[cn].canvas.style.width = cwidth*core.domStyle.scale + "px";
|
||||||
|
core.canvas[cn].canvas.style.height = cheight*core.domStyle.scale + "px";
|
||||||
|
if(main.mode==='editor' && editor.isMobile){
|
||||||
|
core.canvas[cn].canvas.style.width = core.bigmap.width*32/416*96 + "vw";
|
||||||
|
core.canvas[cn].canvas.style.height = core.bigmap.height*32/416*96 + "vw";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
////// 将存档中的地图信息重新读取出来 //////
|
////// 将存档中的地图信息重新读取出来 //////
|
||||||
maps.prototype.load = function (data, floorId) {
|
maps.prototype.load = function (data, floorId) {
|
||||||
if (floorId == undefined) {
|
if (floorId == undefined) {
|
||||||
@ -189,17 +212,17 @@ maps.prototype.load = function (data, floorId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 将当前地图重新变成二维数组形式 //////
|
////// 将当前地图重新变成二维数组形式 //////
|
||||||
maps.prototype.getMapArray = function (blockArray){
|
maps.prototype.getMapArray = function (blockArray,width,height){
|
||||||
|
|
||||||
var blocks = [];
|
var blocks = [];
|
||||||
for (var x=0;x<13;x++) {
|
for (var x=0;x<width;x++) {
|
||||||
blocks[x]=[];
|
blocks[x]=[];
|
||||||
for (var y=0;y<13;y++) {
|
for (var y=0;y<height;y++) {
|
||||||
blocks[x].push(0);
|
blocks[x].push(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blockArray.forEach(function (block) {
|
blockArray.forEach(function (block) {
|
||||||
if (!(core.isset(block.enable) && !block.enable))
|
if (!block.disable)
|
||||||
blocks[block.y][block.x] = block.id;
|
blocks[block.y][block.x] = block.id;
|
||||||
});
|
});
|
||||||
return blocks;
|
return blocks;
|
||||||
@ -253,7 +276,8 @@ maps.prototype.canMoveHero = function(x,y,direction,floorId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 检查将死的领域
|
// 检查将死的领域
|
||||||
if (core.status.hero.hp <= core.status.checkBlock.damage[13*nx+ny] && !core.flags.canGoDeadZone)
|
if (floorId==core.status.floorId && core.status.hero.hp <= core.status.checkBlock.damage[nx+core.bigmap.width*ny]
|
||||||
|
&& !core.flags.canGoDeadZone && core.getBlock(nx, ny)==null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -274,24 +298,24 @@ maps.prototype.canMoveDirectly = function (destX,destY) {
|
|||||||
// 可以无视起点事件
|
// 可以无视起点事件
|
||||||
var nowBlockId = core.getBlockId(fromX, fromY);
|
var nowBlockId = core.getBlockId(fromX, fromY);
|
||||||
if ((nowBlockId!=null&&nowBlockId!='upFloor'&&nowBlockId!='downFloor')
|
if ((nowBlockId!=null&&nowBlockId!='upFloor'&&nowBlockId!='downFloor')
|
||||||
||core.status.checkBlock.damage[13*fromX+fromY]>0)
|
||core.status.checkBlock.damage[fromX+core.bigmap.width*fromY]>0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// BFS
|
// BFS
|
||||||
var visited=[], queue=[];
|
var visited=[], queue=[];
|
||||||
visited[13*fromX+fromY]=0;
|
visited[fromX+core.bigmap.width*fromY]=0;
|
||||||
queue.push(13*fromX+fromY);
|
queue.push(fromX+core.bigmap.width*fromY);
|
||||||
|
|
||||||
var directions = [[-1,0],[1,0],[0,1],[0,-1]];
|
var directions = [[-1,0],[1,0],[0,1],[0,-1]];
|
||||||
while (queue.length>0) {
|
while (queue.length>0) {
|
||||||
var now=queue.shift(), nowX=parseInt(now/13), nowY=now%13;
|
var now=queue.shift(), nowX=parseInt(now%core.bigmap.width), nowY=parseInt(now/core.bigmap.width);
|
||||||
|
|
||||||
for (var dir in directions) {
|
for (var dir in directions) {
|
||||||
var nx=nowX+directions[dir][0], ny=nowY+directions[dir][1];
|
var nx=nowX+directions[dir][0], ny=nowY+directions[dir][1];
|
||||||
if (nx<0||nx>=13||ny<0||ny>=13||visited[13*nx+ny]||core.getBlock(nx,ny)!=null||core.status.checkBlock.damage[13*nx+ny]>0) continue;
|
if (nx<0||nx>=core.bigmap.width||ny<0||ny>=core.bigmap.height||visited[nx+core.bigmap.width*ny]||core.getBlock(nx,ny)!=null||core.status.checkBlock.damage[nx+core.bigmap.width*ny]>0) continue;
|
||||||
visited[13*nx+ny]=visited[13*nowX+nowY]+1;
|
visited[nx+core.bigmap.width*ny]=visited[nowX+core.bigmap.width*nowY]+1;
|
||||||
if (nx==destX&&ny==destY) return visited[13*nx+ny];
|
if (nx==destX&&ny==destY) return visited[nx+core.bigmap.width*ny];
|
||||||
queue.push(13*nx+ny);
|
queue.push(nx+core.bigmap.width*ny);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -320,8 +344,9 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
var groundId = core.floors[mapName].defaultGround || "ground";
|
var groundId = core.floors[mapName].defaultGround || "ground";
|
||||||
var blockIcon = core.material.icons.terrains[groundId];
|
var blockIcon = core.material.icons.terrains[groundId];
|
||||||
var blockImage = core.material.images.terrains;
|
var blockImage = core.material.images.terrains;
|
||||||
for (var x = 0; x < 13; x++) {
|
|
||||||
for (var y = 0; y < 13; y++) {
|
for (var x = 0; x < core.bigmap.width; x++) {
|
||||||
|
for (var y = 0; y < core.bigmap.height; y++) {
|
||||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32);
|
core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,10 +359,8 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
images.forEach(function (t) {
|
images.forEach(function (t) {
|
||||||
var size=416, ratio=1;
|
|
||||||
var dx=parseInt(t[0]), dy=parseInt(t[1]), p=t[2];
|
var dx=parseInt(t[0]), dy=parseInt(t[1]), p=t[2];
|
||||||
if (core.isset(dx) && core.isset(dy) && core.isset(core.material.images.images[p])) {
|
if (core.isset(dx) && core.isset(dy) && core.isset(core.material.images.images[p])) {
|
||||||
dx*=32; dy*=32;
|
|
||||||
var image = core.material.images.images[p];
|
var image = core.material.images.images[p];
|
||||||
if (!t[3]) {
|
if (!t[3]) {
|
||||||
if (/.*\.gif/i.test(p) && main.mode=='play') {
|
if (/.*\.gif/i.test(p) && main.mode=='play') {
|
||||||
@ -345,23 +368,23 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
var gif = new Image();
|
var gif = new Image();
|
||||||
gif.src = core.material.images.images[p].src;
|
gif.src = core.material.images.images[p].src;
|
||||||
gif.style.position = 'absolute';
|
gif.style.position = 'absolute';
|
||||||
gif.style.left = (dx*core.domStyle.scale)+"px";
|
gif.style.left = (32*dx*core.domStyle.scale)+"px";
|
||||||
gif.style.top = (dy*core.domStyle.scale)+"px";
|
gif.style.top = (32*dy*core.domStyle.scale)+"px";
|
||||||
gif.style.width = core.material.images.images[p].width*core.domStyle.scale+"px";
|
gif.style.width = core.material.images.images[p].width*core.domStyle.scale+"px";
|
||||||
gif.style.height = core.material.images.images[p].height*core.domStyle.scale+"px";
|
gif.style.height = core.material.images.images[p].height*core.domStyle.scale+"px";
|
||||||
core.dom.gif.appendChild(gif);
|
core.dom.gif.appendChild(gif);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.canvas.bg.drawImage(image, dx * ratio, dy * ratio, Math.min(size - dx * ratio, ratio * image.width), Math.min(size - dy * ratio, ratio * image.height));
|
core.canvas.bg.drawImage(image, 32*dx, 32*dy, image.width, image.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (t[3]==1)
|
else if (t[3]==1)
|
||||||
core.canvas.event2.drawImage(image, dx*ratio, dy*ratio, Math.min(size-dx*ratio, ratio*image.width), Math.min(size-dy*ratio, ratio*image.height));
|
core.canvas.event2.drawImage(image, 32*dx, 32*dy, image.width, image.height);
|
||||||
else if (t[3]==2) {
|
else if (t[3]==2) {
|
||||||
core.canvas.event2.drawImage(image, 0, 0, image.width, image.height-32,
|
core.canvas.event2.drawImage(image, 0, 0, image.width, image.height-32,
|
||||||
dx * ratio, dy * ratio, ratio * image.width, ratio * (image.height-32));
|
32*dx, 32*dy, image.width, image.height-32);
|
||||||
core.canvas.bg.drawImage(image, 0, image.height-32, image.width, 32,
|
core.canvas.bg.drawImage(image, 0, image.height-32, image.width, 32,
|
||||||
dx * ratio, (dy + image.height - 32) * ratio, ratio*image.width, 32*ratio);
|
32*dx, 32*dy + image.height - 32, image.width, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -369,7 +392,7 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
}
|
}
|
||||||
if (main.mode=='editor'){
|
if (main.mode=='editor'){
|
||||||
main.editor.drawMapBg = function(){
|
main.editor.drawMapBg = function(){
|
||||||
core.clearMap('bg', 0, 0, 416, 416);
|
core.clearMap('bg');
|
||||||
drawBg();
|
drawBg();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -382,11 +405,11 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
var mapData = core.status.maps[core.status.floorId];
|
var mapData = core.status.maps[core.status.floorId];
|
||||||
var mapBlocks = mapData.blocks;
|
var mapBlocks = mapData.blocks;
|
||||||
|
|
||||||
var mapArray = core.maps.getMapArray(mapBlocks);
|
var mapArray = core.maps.getMapArray(mapBlocks,core.bigmap.width,core.bigmap.height);
|
||||||
for (var b = 0; b < mapBlocks.length; b++) {
|
for (var b = 0; b < mapBlocks.length; b++) {
|
||||||
// 事件启用
|
// 事件启用
|
||||||
var block = mapBlocks[b];
|
var block = mapBlocks[b];
|
||||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) {
|
if (core.isset(block.event) && !block.disable) {
|
||||||
if (block.event.cls == 'autotile') {
|
if (block.event.cls == 'autotile') {
|
||||||
core.drawAutotile(core.canvas.event, mapArray, block, 32, 0, 0);
|
core.drawAutotile(core.canvas.event, mapArray, block, 32, 0, 0);
|
||||||
}
|
}
|
||||||
@ -403,9 +426,9 @@ maps.prototype.drawMap = function (mapName, callback) {
|
|||||||
if (main.mode=='editor'){
|
if (main.mode=='editor'){
|
||||||
main.editor.updateMap = function(){
|
main.editor.updateMap = function(){
|
||||||
core.removeGlobalAnimate(null, null, true);
|
core.removeGlobalAnimate(null, null, true);
|
||||||
core.clearMap('bg', 0, 0, 416, 416);
|
core.clearMap('bg');
|
||||||
core.clearMap('event', 0, 0, 416, 416);
|
core.clearMap('event');
|
||||||
core.clearMap('event2', 0, 0, 416, 416);
|
core.clearMap('event2');
|
||||||
drawBg();
|
drawBg();
|
||||||
drawEvent();
|
drawEvent();
|
||||||
core.setGlobalAnimate(core.values.animateSpeed);
|
core.setGlobalAnimate(core.values.animateSpeed);
|
||||||
@ -446,8 +469,8 @@ maps.prototype.drawAutotile = function(ctx, mapArr, block, size, left, top){
|
|||||||
var sx = 16*((index-1)%6), sy = 16*(~~((index-1)/6));
|
var sx = 16*((index-1)%6), sy = 16*(~~((index-1)/6));
|
||||||
ctx.drawImage(autotileImg, sx, sy, 16, 16, dx, dy, size/2, size/2);
|
ctx.drawImage(autotileImg, sx, sy, 16, 16, dx, dy, size/2, size/2);
|
||||||
}
|
}
|
||||||
var getAutotileAroundId = function(currId, x, y){
|
var getAutotileAroundId = function(currId, x, y) {
|
||||||
if(x<0 || y<0 || x>12 || y>12) return 1;
|
if(x<0 || y<0 || x>=mapArr[0].length || y>=mapArr.length) return 1;
|
||||||
else return mapArr[y][x]==currId ? 1:0;
|
else return mapArr[y][x]==currId ? 1:0;
|
||||||
}
|
}
|
||||||
var checkAround = function(x, y){ // 得到周围四个32*32块(周围每块都包含当前块的1/4,不清楚的话画下图你就明白)的数组索引
|
var checkAround = function(x, y){ // 得到周围四个32*32块(周围每块都包含当前块的1/4,不清楚的话画下图你就明白)的数组索引
|
||||||
@ -511,7 +534,7 @@ maps.prototype.noPassExists = function (x, y, floorId) {
|
|||||||
|
|
||||||
////// 某个点是否在区域内且不可通行 //////
|
////// 某个点是否在区域内且不可通行 //////
|
||||||
maps.prototype.noPass = function (x, y) {
|
maps.prototype.noPass = function (x, y) {
|
||||||
return x<0 || x>12 || y<0 || y>12 || this.noPassExists(x,y);
|
return x<0 || x>=core.bigmap.width || y<0 || y>=core.bigmap.height || this.noPassExists(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 某个点是否存在NPC //////
|
////// 某个点是否存在NPC //////
|
||||||
@ -549,13 +572,12 @@ maps.prototype.enemyExists = function (x, y, id,floorId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 获得某个点的block //////
|
////// 获得某个点的block //////
|
||||||
maps.prototype.getBlock = function (x, y, floorId, needEnable) {
|
maps.prototype.getBlock = function (x, y, floorId, showDisable) {
|
||||||
if (!core.isset(floorId)) floorId=core.status.floorId;
|
if (!core.isset(floorId)) floorId=core.status.floorId;
|
||||||
if (!core.isset(needEnable)) needEnable=true;
|
|
||||||
var blocks = core.status.maps[floorId].blocks;
|
var blocks = core.status.maps[floorId].blocks;
|
||||||
for (var n=0;n<blocks.length;n++) {
|
for (var n=0;n<blocks.length;n++) {
|
||||||
if (blocks[n].x==x && blocks[n].y==y && core.isset(blocks[n].event)) {
|
if (blocks[n].x==x && blocks[n].y==y && core.isset(blocks[n].event)) {
|
||||||
if (needEnable && core.isset(blocks[n].enable) && !blocks[n].enable) return null;
|
if (!showDisable && blocks[n].disable) return null;
|
||||||
return {"index": n, "block": blocks[n]};
|
return {"index": n, "block": blocks[n]};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -563,18 +585,26 @@ maps.prototype.getBlock = function (x, y, floorId, needEnable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 获得某个点的blockId //////
|
////// 获得某个点的blockId //////
|
||||||
maps.prototype.getBlockId = function (x, y, floorId, needEnable) {
|
maps.prototype.getBlockId = function (x, y, floorId, showDisable) {
|
||||||
var block = core.getBlock(x, y, floorId, needEnable);
|
var block = core.getBlock(x, y, floorId, showDisable);
|
||||||
if (block == null) return null;
|
if (block == null) return null;
|
||||||
if (core.isset(block.block.event)) return block.block.event.id;
|
if (core.isset(block.block.event)) return block.block.event.id;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 获得某个点的blockCls //////
|
||||||
|
maps.prototype.getBlockCls = function (x, y, floorId, showDisable) {
|
||||||
|
var block = core.getBlock(x, y, floorId, showDisable);
|
||||||
|
if (block == null) return null;
|
||||||
|
if (core.isset(block.block.event)) return block.block.event.cls;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
////// 显示移动某块的动画,达到{“type”:”move”}的效果 //////
|
////// 显示移动某块的动画,达到{“type”:”move”}的效果 //////
|
||||||
maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
|
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
|
|
||||||
var block = core.getBlock(x,y);
|
var block = core.getBlock(x,y);
|
||||||
if (block==null) {// 不存在
|
if (block==null) {// 不存在
|
||||||
@ -588,7 +618,7 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
// 需要删除该块
|
// 需要删除该块
|
||||||
core.removeBlock(x,y);
|
core.removeBlock(x,y);
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
|
|
||||||
block=block.block;
|
block=block.block;
|
||||||
@ -597,8 +627,8 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
var height = block.event.height || 32;
|
var height = block.event.height || 32;
|
||||||
|
|
||||||
var opacityVal = 1;
|
var opacityVal = 1;
|
||||||
core.setOpacity('animate', opacityVal);
|
core.setOpacity('route', opacityVal);
|
||||||
core.canvas.animate.drawImage(blockImage, 0, blockIcon * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
|
core.canvas.route.drawImage(blockImage, 0, blockIcon * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
|
||||||
|
|
||||||
// 要运行的轨迹:将steps展开
|
// 要运行的轨迹:将steps展开
|
||||||
var moveSteps=[];
|
var moveSteps=[];
|
||||||
@ -643,13 +673,13 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
if (moveSteps.length==0) {
|
if (moveSteps.length==0) {
|
||||||
if (keep) opacityVal=0;
|
if (keep) opacityVal=0;
|
||||||
else opacityVal -= 0.06;
|
else opacityVal -= 0.06;
|
||||||
core.setOpacity('animate', opacityVal);
|
core.setOpacity('route', opacityVal);
|
||||||
core.clearMap('animate', nowX, nowY-height+32, 32, height);
|
core.clearMap('route', nowX, nowY-height+32, 32, height);
|
||||||
core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height);
|
core.canvas.route.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height);
|
||||||
if (opacityVal<=0) {
|
if (opacityVal<=0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
core.setOpacity('animate', 1);
|
core.setOpacity('route', 1);
|
||||||
// 不消失
|
// 不消失
|
||||||
if (keep) {
|
if (keep) {
|
||||||
core.setBlock(id, nowX/32, nowY/32);
|
core.setBlock(id, nowX/32, nowY/32);
|
||||||
@ -664,9 +694,9 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
step++;
|
step++;
|
||||||
nowX+=scan[moveSteps[0]].x*2;
|
nowX+=scan[moveSteps[0]].x*2;
|
||||||
nowY+=scan[moveSteps[0]].y*2;
|
nowY+=scan[moveSteps[0]].y*2;
|
||||||
core.clearMap('animate', nowX-32, nowY-32, 96, 96);
|
core.clearMap('route', nowX-32, nowY-32, 96, 96);
|
||||||
// 绘制
|
// 绘制
|
||||||
core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height);
|
core.canvas.route.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height);
|
||||||
if (step==16) {
|
if (step==16) {
|
||||||
// 该移动完毕,继续
|
// 该移动完毕,继续
|
||||||
step=0;
|
step=0;
|
||||||
@ -679,7 +709,7 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
|
|||||||
////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 //////
|
////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 //////
|
||||||
maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
var block = core.getBlock(sx,sy);
|
var block = core.getBlock(sx,sy);
|
||||||
if (block==null) {
|
if (block==null) {
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
@ -691,7 +721,7 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
|
|
||||||
// 需要删除该块
|
// 需要删除该块
|
||||||
core.removeBlock(sx,sy);
|
core.removeBlock(sx,sy);
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
|
|
||||||
block=block.block;
|
block=block.block;
|
||||||
@ -700,8 +730,8 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
var height = block.event.height || 32;
|
var height = block.event.height || 32;
|
||||||
|
|
||||||
var opacityVal = 1;
|
var opacityVal = 1;
|
||||||
core.setOpacity('animate', opacityVal);
|
core.setOpacity('route', opacityVal);
|
||||||
core.canvas.animate.drawImage(blockImage, 0, blockIcon * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
|
core.canvas.route.drawImage(blockImage, 0, blockIcon * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
|
||||||
|
|
||||||
core.playSound('jump.mp3');
|
core.playSound('jump.mp3');
|
||||||
|
|
||||||
@ -742,20 +772,20 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jump_count>0) {
|
if (jump_count>0) {
|
||||||
core.clearMap('animate', drawX(), drawY()-height+32, 32, height);
|
core.clearMap('route', drawX(), drawY()-height+32, 32, height);
|
||||||
updateJump();
|
updateJump();
|
||||||
core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
core.canvas.route.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (keep) opacityVal=0;
|
if (keep) opacityVal=0;
|
||||||
else opacityVal -= 0.06;
|
else opacityVal -= 0.06;
|
||||||
core.setOpacity('animate', opacityVal);
|
core.setOpacity('route', opacityVal);
|
||||||
core.clearMap('animate', drawX(), drawY()-height+32, 32, height);
|
core.clearMap('route', drawX(), drawY()-height+32, 32, height);
|
||||||
core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
core.canvas.route.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height);
|
||||||
if (opacityVal<=0) {
|
if (opacityVal<=0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
core.setOpacity('animate', 1);
|
core.setOpacity('route', 1);
|
||||||
if (keep) {
|
if (keep) {
|
||||||
core.setBlock(id, ex, ey);
|
core.setBlock(id, ex, ey);
|
||||||
core.showBlock(ex, ey);
|
core.showBlock(ex, ey);
|
||||||
@ -772,14 +802,14 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
|
|||||||
maps.prototype.animateBlock = function (loc,type,time,callback) {
|
maps.prototype.animateBlock = function (loc,type,time,callback) {
|
||||||
if (type!='hide') type='show';
|
if (type!='hide') type='show';
|
||||||
|
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
|
|
||||||
if (typeof loc[0] == 'number' && typeof loc[1] == 'number')
|
if (typeof loc[0] == 'number' && typeof loc[1] == 'number')
|
||||||
loc = [loc];
|
loc = [loc];
|
||||||
|
|
||||||
var list = [];
|
var list = [];
|
||||||
loc.forEach(function (t) {
|
loc.forEach(function (t) {
|
||||||
var block = core.getBlock(t[0],t[1],core.status.floorId,false);
|
var block = core.getBlock(t[0],t[1],null,true);
|
||||||
if (block==null) return;
|
if (block==null) return;
|
||||||
block=block.block;
|
block=block.block;
|
||||||
list.push({
|
list.push({
|
||||||
@ -797,24 +827,24 @@ maps.prototype.animateBlock = function (loc,type,time,callback) {
|
|||||||
core.status.replay.animate=true;
|
core.status.replay.animate=true;
|
||||||
var draw = function () {
|
var draw = function () {
|
||||||
list.forEach(function (t) {
|
list.forEach(function (t) {
|
||||||
core.canvas.animate.drawImage(t.blockImage, 0, t.blockIcon*t.height, 32, t.height, t.x*32, t.y*32+32-t.height, 32, t.height);
|
core.canvas.route.drawImage(t.blockImage, 0, t.blockIcon*t.height, 32, t.height, t.x*32, t.y*32+32-t.height, 32, t.height);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var opacityVal = 0;
|
var opacityVal = 0;
|
||||||
if (type=='hide') opacityVal=1;
|
if (type=='hide') opacityVal=1;
|
||||||
|
|
||||||
core.setOpacity('animate', opacityVal);
|
core.setOpacity('route', opacityVal);
|
||||||
draw();
|
draw();
|
||||||
|
|
||||||
var animate = window.setInterval(function () {
|
var animate = window.setInterval(function () {
|
||||||
if (type=='show') opacityVal += 0.1;
|
if (type=='show') opacityVal += 0.1;
|
||||||
else opacityVal -= 0.1;
|
else opacityVal -= 0.1;
|
||||||
core.setOpacity('animate', opacityVal);
|
core.setOpacity('route', opacityVal);
|
||||||
if (opacityVal >=1 || opacityVal<=0) {
|
if (opacityVal >=1 || opacityVal<=0) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('route');
|
||||||
core.setOpacity('animate', 1);
|
core.setOpacity('route', 1);
|
||||||
core.status.replay.animate=false;
|
core.status.replay.animate=false;
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
}
|
}
|
||||||
@ -824,12 +854,12 @@ maps.prototype.animateBlock = function (loc,type,time,callback) {
|
|||||||
////// 将某个块从禁用变成启用状态 //////
|
////// 将某个块从禁用变成启用状态 //////
|
||||||
maps.prototype.showBlock = function(x, y, floodId) {
|
maps.prototype.showBlock = function(x, y, floodId) {
|
||||||
floodId = floodId || core.status.floorId;
|
floodId = floodId || core.status.floorId;
|
||||||
var block = core.getBlock(x,y,floodId,false);
|
var block = core.getBlock(x,y,floodId,true);
|
||||||
if (block==null) return; // 不存在
|
if (block==null) return; // 不存在
|
||||||
block=block.block;
|
block=block.block;
|
||||||
// 本身是禁用事件,启用之
|
// 本身是禁用事件,启用之
|
||||||
if (core.isset(block.enable) && !block.enable) {
|
if (block.disable) {
|
||||||
block.enable = true;
|
block.disable = false;
|
||||||
// 在本层,添加动画
|
// 在本层,添加动画
|
||||||
if (floodId == core.status.floorId && core.isset(block.event)) {
|
if (floodId == core.status.floorId && core.isset(block.event)) {
|
||||||
core.drawBlock(block);
|
core.drawBlock(block);
|
||||||
@ -844,7 +874,7 @@ maps.prototype.showBlock = function(x, y, floodId) {
|
|||||||
maps.prototype.removeBlock = function (x, y, floorId) {
|
maps.prototype.removeBlock = function (x, y, floorId) {
|
||||||
floorId = floorId || core.status.floorId;
|
floorId = floorId || core.status.floorId;
|
||||||
|
|
||||||
var block = core.getBlock(x,y,floorId,false);
|
var block = core.getBlock(x,y,floorId,true);
|
||||||
if (block==null) return; // 不存在
|
if (block==null) return; // 不存在
|
||||||
|
|
||||||
var index=block.index;
|
var index=block.index;
|
||||||
@ -886,7 +916,7 @@ maps.prototype.removeBlockById = function (index, floorId) {
|
|||||||
blocks.splice(index,1);
|
blocks.splice(index,1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
block.enable = false;
|
block.disable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 一次性删除多个block //////
|
////// 一次性删除多个block //////
|
||||||
@ -900,9 +930,9 @@ maps.prototype.removeBlockByIds = function (floorId, ids) {
|
|||||||
maps.prototype.setBlock = function (number, x, y, floorId) {
|
maps.prototype.setBlock = function (number, x, y, floorId) {
|
||||||
floorId = floorId || core.status.floorId;
|
floorId = floorId || core.status.floorId;
|
||||||
if (!core.isset(number) || !core.isset(x) || !core.isset(y)) return;
|
if (!core.isset(number) || !core.isset(x) || !core.isset(y)) return;
|
||||||
if (x<0 || x>12 || y<0 || y>12) return;
|
if (x<0 || x>=core.bigmap.width || y<0 || y>=core.bigmap.height) return;
|
||||||
|
|
||||||
var originBlock=core.getBlock(x,y,floorId,false);
|
var originBlock=core.getBlock(x,y,floorId,true);
|
||||||
var block = core.maps.initBlock(x,y,number);
|
var block = core.maps.initBlock(x,y,number);
|
||||||
core.maps.addInfo(block);
|
core.maps.addInfo(block);
|
||||||
core.maps.addEvent(block,x,y,core.floors[floorId].events[x+","+y]);
|
core.maps.addEvent(block,x,y,core.floors[floorId].events[x+","+y]);
|
||||||
@ -994,7 +1024,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
|
|
||||||
// 清空animate层
|
// 清空animate层
|
||||||
clearInterval(core.interval.animateInterval);
|
clearInterval(core.interval.animateInterval);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
|
|
||||||
// 开始绘制
|
// 开始绘制
|
||||||
var animate = core.material.animates[name];
|
var animate = core.material.animates[name];
|
||||||
@ -1006,7 +1036,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
core.playSound(animate.se);
|
core.playSound(animate.se);
|
||||||
|
|
||||||
var draw = function (index) {
|
var draw = function (index) {
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
|
|
||||||
var frame = animate.frames[index];
|
var frame = animate.frames[index];
|
||||||
frame.forEach(function (t) {
|
frame.forEach(function (t) {
|
||||||
@ -1019,7 +1049,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
var cx = centerX+t.x, cy=centerY+t.y;
|
var cx = centerX+t.x, cy=centerY+t.y;
|
||||||
|
|
||||||
if (!t.mirror && !t.angle) {
|
if (!t.mirror && !t.angle) {
|
||||||
core.canvas.animate.drawImage(image, cx-realWidth/2, cy-realHeight/2, realWidth, realHeight);
|
core.canvas.animate.drawImage(image, cx-realWidth/2 - core.bigmap.offsetX, cy-realHeight/2 - core.bigmap.offsetY, realWidth, realHeight);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.saveCanvas('animate');
|
core.saveCanvas('animate');
|
||||||
@ -1028,7 +1058,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
core.canvas.animate.rotate(-t.angle*Math.PI/180);
|
core.canvas.animate.rotate(-t.angle*Math.PI/180);
|
||||||
if (t.mirror)
|
if (t.mirror)
|
||||||
core.canvas.animate.scale(-1,1);
|
core.canvas.animate.scale(-1,1);
|
||||||
core.canvas.animate.drawImage(image, -realWidth/2, -realHeight/2, realWidth, realHeight);
|
core.canvas.animate.drawImage(image, -realWidth/2 - core.bigmap.offsetX, -realHeight/2 - core.bigmap.offsetY, realWidth, realHeight);
|
||||||
core.loadCanvas('animate');
|
core.loadCanvas('animate');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1039,7 +1069,7 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
|
|||||||
core.interval.animateInterval = setInterval(function (t) {
|
core.interval.animateInterval = setInterval(function (t) {
|
||||||
if (index == animate.frames.length) {
|
if (index == animate.frames.length) {
|
||||||
clearInterval(core.interval.animateInterval);
|
clearInterval(core.interval.animateInterval);
|
||||||
core.clearMap('animate', 0, 0, 416, 416);
|
core.clearMap('animate');
|
||||||
core.setAlpha('animate', 1);
|
core.setAlpha('animate', 1);
|
||||||
if (core.isset(callback)) callback();
|
if (core.isset(callback)) callback();
|
||||||
return;
|
return;
|
||||||
|
|||||||
1
libs/thirdparty/priority-queue.min.js
vendored
Normal file
1
libs/thirdparty/priority-queue.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
216
libs/ui.js
216
libs/ui.js
@ -18,12 +18,12 @@ ui.prototype.init = function () {
|
|||||||
ui.prototype.clearMap = function (map, x, y, width, height) {
|
ui.prototype.clearMap = function (map, x, y, width, height) {
|
||||||
if (map == 'all') {
|
if (map == 'all') {
|
||||||
for (var m in core.canvas) {
|
for (var m in core.canvas) {
|
||||||
core.canvas[m].clearRect(0, 0, 416, 416);
|
core.canvas[m].clearRect(0, 0, core.bigmap.width*32, core.bigmap.height*32);
|
||||||
}
|
}
|
||||||
core.dom.gif.innerHTML = "";
|
core.dom.gif.innerHTML = "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.canvas[map].clearRect(x||0, y||0, width||416, height||416);
|
core.canvas[map].clearRect(x||0, y||0, width||core.bigmap.width*32, height||core.bigmap.height*32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,27 @@ ui.prototype.drawLine = function (map, x1, y1, x2, y2, style, lineWidth) {
|
|||||||
core.canvas[map].beginPath();
|
core.canvas[map].beginPath();
|
||||||
core.canvas[map].moveTo(x1, y1);
|
core.canvas[map].moveTo(x1, y1);
|
||||||
core.canvas[map].lineTo(x2, y2);
|
core.canvas[map].lineTo(x2, y2);
|
||||||
core.canvas[map].closePath();
|
core.canvas[map].stroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 在某个canvas上绘制一个箭头 //////
|
||||||
|
ui.prototype.drawArrow = function (map, x1, y1, x2, y2, style, lineWidth) {
|
||||||
|
if (x1==x2 && y1==y2) return;
|
||||||
|
if (core.isset(style)) {
|
||||||
|
core.setStrokeStyle(map, style);
|
||||||
|
}
|
||||||
|
if (core.isset(lineWidth)) {
|
||||||
|
core.setLineWidth(map, lineWidth);
|
||||||
|
}
|
||||||
|
var head = 10;
|
||||||
|
var dx = x2-x1, dy=y2-y1;
|
||||||
|
var angle = Math.atan2(dy,dx);
|
||||||
|
core.canvas[map].beginPath();
|
||||||
|
core.canvas[map].moveTo(x1,y1);
|
||||||
|
core.canvas[map].lineTo(x2, y2);
|
||||||
|
core.canvas[map].lineTo(x2-head*Math.cos(angle-Math.PI/6),y2-head*Math.sin(angle-Math.PI/6));
|
||||||
|
core.canvas[map].moveTo(x2, y2);
|
||||||
|
core.canvas[map].lineTo(x2-head*Math.cos(angle+Math.PI/6),y2-head*Math.sin(angle+Math.PI/6));
|
||||||
core.canvas[map].stroke();
|
core.canvas[map].stroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +169,7 @@ ui.prototype.setFillStyle = function (map, style) {
|
|||||||
ui.prototype.closePanel = function () {
|
ui.prototype.closePanel = function () {
|
||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
clearInterval(core.status.event.interval);
|
clearInterval(core.status.event.interval);
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
core.unLockControl();
|
core.unLockControl();
|
||||||
core.status.event.data = null;
|
core.status.event.data = null;
|
||||||
@ -380,7 +400,7 @@ ui.prototype.drawTextBox = function(content) {
|
|||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
|
|
||||||
// var contents = content.split('\n');
|
// var contents = content.split('\n');
|
||||||
// var contents = core.splitLines('ui', content, );
|
// var contents = core.splitLines('ui', content, );
|
||||||
@ -541,7 +561,7 @@ ui.prototype.drawChoices = function(content, choices) {
|
|||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
|
|
||||||
@ -728,7 +748,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
|||||||
if (core.status.event.selection<0) core.status.event.selection=0;
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
core.setFont('ui', "bold 19px Verdana");
|
core.setFont('ui', "bold 19px Verdana");
|
||||||
@ -872,7 +892,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
var left=10, right=416-2*left;
|
var left=10, right=416-2*left;
|
||||||
|
|
||||||
|
|
||||||
@ -891,7 +911,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
core.fillRect('ui', left, top, right, bottom, '#000000');
|
core.fillRect('ui', left, top, right, bottom, '#000000');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||||
core.clearMap('data',0,0,416,416);
|
core.clearMap('data');
|
||||||
|
|
||||||
clearInterval(core.interval.tipAnimate);
|
clearInterval(core.interval.tipAnimate);
|
||||||
core.setAlpha('data', 1);
|
core.setAlpha('data', 1);
|
||||||
@ -1099,9 +1119,9 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
// 战斗结束
|
// 战斗结束
|
||||||
clearInterval(battleInterval);
|
clearInterval(battleInterval);
|
||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1.0);
|
core.setAlpha('ui', 1.0);
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
if (core.status.event.id=='battle') {
|
if (core.status.event.id=='battle') {
|
||||||
core.unLockControl();
|
core.unLockControl();
|
||||||
core.status.event.id=null;
|
core.status.event.id=null;
|
||||||
@ -1121,7 +1141,7 @@ ui.prototype.drawWaiting = function(text) {
|
|||||||
core.status.event.id = 'waiting';
|
core.status.event.id = 'waiting';
|
||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
|
|
||||||
@ -1178,7 +1198,7 @@ ui.prototype.drawReplay = function () {
|
|||||||
core.lockControl();
|
core.lockControl();
|
||||||
core.status.event.id = 'replay';
|
core.status.event.id = 'replay';
|
||||||
this.drawChoices(null, [
|
this.drawChoices(null, [
|
||||||
"从头回放录像", "从存档开始回放", "返回游戏"
|
"从头回放录像", "从存档开始回放", "下载当前录像", "返回游戏"
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1219,7 +1239,7 @@ ui.prototype.drawCursor = function () {
|
|||||||
core.status.event.id = 'cursor';
|
core.status.event.id = 'cursor';
|
||||||
core.lockControl();
|
core.lockControl();
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
|
|
||||||
var width = 4;
|
var width = 4;
|
||||||
@ -1235,10 +1255,10 @@ ui.prototype.drawBook = function (index) {
|
|||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
|
|
||||||
clearInterval(core.interval.tipAnimate);
|
clearInterval(core.interval.tipAnimate);
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
core.fillRect('ui', 0, 0, 416, 416);
|
core.fillRect('ui', 0, 0, 416, 416);
|
||||||
@ -1400,7 +1420,7 @@ ui.prototype.drawBookDetail = function (index) {
|
|||||||
core.status.event.id = 'book-detail';
|
core.status.event.id = 'book-detail';
|
||||||
clearInterval(core.interval.tipAnimate);
|
clearInterval(core.interval.tipAnimate);
|
||||||
|
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
|
|
||||||
var left=10, right=416-2*left;
|
var left=10, right=416-2*left;
|
||||||
@ -1453,7 +1473,7 @@ ui.prototype.drawFly = function(page) {
|
|||||||
var floorId = core.status.hero.flyRange[page];
|
var floorId = core.status.hero.flyRange[page];
|
||||||
var title = core.status.maps[floorId].title;
|
var title = core.status.maps[floorId].title;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
@ -1476,33 +1496,86 @@ ui.prototype.drawFly = function(page) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 绘制浏览地图界面 //////
|
////// 绘制浏览地图界面 //////
|
||||||
ui.prototype.drawMaps = function (index) {
|
ui.prototype.drawMaps = function (index, x, y) {
|
||||||
if (!core.isset(index)) index=core.floorIds.indexOf(core.status.floorId);
|
core.lockControl();
|
||||||
|
core.status.event.id = 'viewMaps';
|
||||||
|
|
||||||
|
if (!core.isset(index)) {
|
||||||
|
core.status.event.data = null;
|
||||||
|
core.clearMap('ui');
|
||||||
|
core.setAlpha('ui', 1);
|
||||||
|
|
||||||
|
core.clearMap('animate');
|
||||||
|
core.setOpacity('animate', 0.4);
|
||||||
|
core.fillRect('animate', 0, 0, 416, 416, '#000000');
|
||||||
|
|
||||||
|
core.strokeRect('ui', 66, 2, 284, 60, "#FFD700", 4);
|
||||||
|
core.strokeRect('ui', 2, 66, 60, 284);
|
||||||
|
core.strokeRect('ui', 66, 416-62, 284, 60);
|
||||||
|
core.strokeRect('ui', 416-62, 66, 60, 284);
|
||||||
|
core.strokeRect('ui', 66, 66, 284, 92);
|
||||||
|
core.strokeRect('ui', 66, 32*8+2, 284, 92);
|
||||||
|
core.canvas.ui.textAlign = 'center';
|
||||||
|
core.fillText('ui', "上移地图 [W]", 208, 38, '#FFD700', '20px Arial');
|
||||||
|
core.fillText('ui', "下移地图 [S]", 208, 390);
|
||||||
|
|
||||||
|
var top = 150;
|
||||||
|
core.fillText('ui', "左", 32, top);
|
||||||
|
core.fillText('ui', "移", 32, top+32);
|
||||||
|
core.fillText('ui', "地", 32, top+32*2);
|
||||||
|
core.fillText('ui', "图", 32, top+32*3);
|
||||||
|
core.fillText('ui', "[A]", 32, top+32*4);
|
||||||
|
core.fillText('ui', "右", 384, top);
|
||||||
|
core.fillText('ui', "移", 384, top+32);
|
||||||
|
core.fillText('ui', "地", 384, top+32*2);
|
||||||
|
core.fillText('ui', "图", 384, top+32*3);
|
||||||
|
core.fillText('ui', "[D]", 384, top+32*4);
|
||||||
|
|
||||||
|
core.fillText('ui', "前张地图 [▲ / PGUP]", 208, 64+54);
|
||||||
|
core.fillText('ui', "后张地图 [▼ / PGDN]", 208, 32*8+54);
|
||||||
|
|
||||||
|
core.fillText('ui', "退出 [ESC / ENTER]", 208, 208+8);
|
||||||
|
core.fillText('ui', "[X] 可查看怪物手册", 285, 208+40, null, '13px Arial');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.clearMap('animate');
|
||||||
|
core.setOpacity('animate', 1);
|
||||||
|
|
||||||
|
if (core.isset(index.index)) {
|
||||||
|
x=index.x;
|
||||||
|
y=index.y;
|
||||||
|
index=index.index;
|
||||||
|
}
|
||||||
|
|
||||||
if (index<0) index=0;
|
if (index<0) index=0;
|
||||||
if (index>=core.floorIds.length) index=core.floorIds.length-1;
|
if (index>=core.floorIds.length) index=core.floorIds.length-1;
|
||||||
|
var floorId = core.floorIds[index], mw = core.floors[floorId].width||13, mh = core.floors[floorId].height||13;
|
||||||
|
if (!core.isset(x)) x = parseInt(mw/2);
|
||||||
|
if (!core.isset(y)) y = parseInt(mh/2);
|
||||||
|
if (x<6) x=6;
|
||||||
|
if (x>mw-7) x=mw-7;
|
||||||
|
if (y<6) y=6;
|
||||||
|
if (y>mh-7) y=mh-7;
|
||||||
|
|
||||||
core.lockControl();
|
core.status.event.data = {"index": index, "x": x, "y": y};
|
||||||
core.status.event.id = 'viewMaps';
|
|
||||||
core.status.event.data = index;
|
|
||||||
|
|
||||||
var floorId = core.floorIds[index];
|
|
||||||
|
|
||||||
clearTimeout(core.interval.tipAnimate);
|
clearTimeout(core.interval.tipAnimate);
|
||||||
|
core.clearMap('ui');
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 0, 0, 416);
|
this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 0, 0, 416, x, y);
|
||||||
|
|
||||||
core.clearMap('data', 0, 0, 416, 416);
|
core.clearMap('data');
|
||||||
core.setOpacity('data', 0.2);
|
core.setOpacity('data', 0.2);
|
||||||
core.canvas.data.textAlign = 'left';
|
core.canvas.data.textAlign = 'left';
|
||||||
core.setFont('data', '16px Arial');
|
core.setFont('data', '16px Arial');
|
||||||
|
|
||||||
|
|
||||||
var text = core.floors[floorId].title;
|
var text = core.floors[floorId].title;
|
||||||
|
if (mw>13 || mh>13) text+=" ["+(x-6)+","+(y-6)+"]";
|
||||||
var textX = 16, textY = 18, width = textX + core.canvas.data.measureText(text).width + 16, height = 42;
|
var textX = 16, textY = 18, width = textX + core.canvas.data.measureText(text).width + 16, height = 42;
|
||||||
core.fillRect('data', 5, 5, width, height, '#000');
|
core.fillRect('data', 5, 5, width, height, '#000');
|
||||||
core.setOpacity('data', 0.5);
|
core.setOpacity('data', 0.4);
|
||||||
core.fillText('data', text, textX + 5, textY + 15, '#fff');
|
core.fillText('data', text, textX + 5, textY + 15, '#fff');
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1538,7 +1611,7 @@ ui.prototype.drawToolbox = function(index) {
|
|||||||
|
|
||||||
core.status.event.data=selectId;
|
core.status.event.data=selectId;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
@ -1660,7 +1733,7 @@ ui.prototype.drawSLPanel = function(index) {
|
|||||||
|
|
||||||
core.status.event.data=index;
|
core.status.event.data=index;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
core.fillRect('ui', 0, 0, 416, 416, '#000000');
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
@ -1679,7 +1752,7 @@ ui.prototype.drawSLPanel = function(index) {
|
|||||||
core.fillText('ui', i==0?"自动存档":name+id, (2*i+1)*u, 35, '#FFFFFF', "bold 17px Verdana");
|
core.fillText('ui', i==0?"自动存档":name+id, (2*i+1)*u, 35, '#FFFFFF', "bold 17px Verdana");
|
||||||
core.strokeRect('ui', (2*i+1)*u-size/2, 50, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
|
core.strokeRect('ui', (2*i+1)*u-size/2, 50, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
|
||||||
if (core.isset(data) && core.isset(data.floorId)) {
|
if (core.isset(data) && core.isset(data.floorId)) {
|
||||||
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
|
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
|
||||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, '#FFFFFF', '10px Verdana');
|
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, '#FFFFFF', '10px Verdana');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1691,7 +1764,7 @@ ui.prototype.drawSLPanel = function(index) {
|
|||||||
core.fillText('ui', name+id, (2*i-5)*u, 230, '#FFFFFF', "bold 17px Verdana");
|
core.fillText('ui', name+id, (2*i-5)*u, 230, '#FFFFFF', "bold 17px Verdana");
|
||||||
core.strokeRect('ui', (2*i-5)*u-size/2, 245, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
|
core.strokeRect('ui', (2*i-5)*u-size/2, 245, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
|
||||||
if (core.isset(data) && core.isset(data.floorId)) {
|
if (core.isset(data) && core.isset(data.floorId)) {
|
||||||
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
|
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
|
||||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, '#FFFFFF', '10px Verdana');
|
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, '#FFFFFF', '10px Verdana');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1704,23 +1777,34 @@ ui.prototype.drawSLPanel = function(index) {
|
|||||||
|
|
||||||
if (core.status.event.selection)
|
if (core.status.event.selection)
|
||||||
core.setFillStyle('ui', '#FF6A6A');
|
core.setFillStyle('ui', '#FF6A6A');
|
||||||
core.fillText('ui', '删除模式', 48, 403);
|
if (core.status.event.id=='save')
|
||||||
|
core.fillText('ui', '删除模式', 48, 403);
|
||||||
|
else
|
||||||
|
core.fillText('ui', '输入编号', 48, 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 绘制一个缩略图 //////
|
////// 绘制一个缩略图 //////
|
||||||
ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, heroLoc, heroIcon) {
|
ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, centerX, centerY, heroLoc, heroIcon) {
|
||||||
core.clearMap(canvas, x, y, size, size);
|
|
||||||
|
var mw = core.floors[floorId].width || 13;
|
||||||
|
var mh = core.floors[floorId].height || 13;
|
||||||
|
// 绘制到tempCanvas上面
|
||||||
|
var tempCanvas = core.bigmap.tempCanvas;
|
||||||
|
var tempWidth = mw*32, tempHeight = mh*32;
|
||||||
|
tempCanvas.canvas.width = tempWidth;
|
||||||
|
tempCanvas.canvas.height = tempHeight;
|
||||||
|
tempCanvas.clearRect(0, 0, tempWidth, tempHeight);
|
||||||
|
|
||||||
var groundId = core.floors[floorId].defaultGround || "ground";
|
var groundId = core.floors[floorId].defaultGround || "ground";
|
||||||
var blockIcon = core.material.icons.terrains[groundId];
|
var blockIcon = core.material.icons.terrains[groundId];
|
||||||
var blockImage = core.material.images.terrains;
|
var blockImage = core.material.images.terrains;
|
||||||
var persize = size/13;
|
// background
|
||||||
for (var i=0;i<13;i++) {
|
for (var i=0;i<mw;i++) {
|
||||||
for (var j=0;j<13;j++) {
|
for (var j=0;j<mh;j++) {
|
||||||
core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + i * persize, y + j * persize, persize, persize);
|
tempCanvas.drawImage(blockImage, 0, blockIcon * 32, 32, 32, i * 32, j * 32, 32, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// background image
|
||||||
var images = [];
|
var images = [];
|
||||||
if (core.isset(core.floors[floorId].images)) {
|
if (core.isset(core.floors[floorId].images)) {
|
||||||
images = core.floors[floorId].images;
|
images = core.floors[floorId].images;
|
||||||
@ -1728,69 +1812,71 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, heroL
|
|||||||
images = [[0, 0, images]];
|
images = [[0, 0, images]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
images.forEach(function (t) {
|
images.forEach(function (t) {
|
||||||
var ratio = size/416;
|
|
||||||
var dx=parseInt(t[0]), dy=parseInt(t[1]), p=t[2];
|
var dx=parseInt(t[0]), dy=parseInt(t[1]), p=t[2];
|
||||||
if (core.isset(dx) && core.isset(dy) && core.isset(core.material.images.images[p])) {
|
if (core.isset(dx) && core.isset(dy) && core.isset(core.material.images.images[p])) {
|
||||||
dx*=32; dy*=32;
|
|
||||||
var image = core.material.images.images[p];
|
var image = core.material.images.images[p];
|
||||||
if (!t[3])
|
if (!t[3])
|
||||||
core.canvas.ui.drawImage(image, x+dx*ratio, y+dy*ratio, Math.min(size-dx*ratio, ratio*image.width), Math.min(size-dy*ratio, ratio*image.height));
|
tempCanvas.drawImage(image, 32 * dx, 32 * dy, image.width, image.height);
|
||||||
else if (t[3]==2)
|
else if (t[3]==2)
|
||||||
core.canvas.ui.drawImage(image, 0, image.height-32, image.width, 32,
|
tempCanvas.drawImage(image, 0, image.height-32, image.width, 32,
|
||||||
x+dx * ratio, y+(dy + image.height - 32) * ratio, ratio*image.width, 32*ratio);
|
32 * dx, 32 * dy + image.height - 32, image.width, 32);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// draw block
|
||||||
var mapArray = core.maps.getMapArray(blocks);
|
var mapArray = core.maps.getMapArray(blocks,mw,mh);
|
||||||
for (var b in blocks) {
|
for (var b in blocks) {
|
||||||
var block = blocks[b];
|
var block = blocks[b];
|
||||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) {
|
if (core.isset(block.event) && !block.disable) {
|
||||||
if (block.event.cls == 'autotile') {
|
if (block.event.cls == 'autotile') {
|
||||||
core.drawAutotile(core.canvas.ui, mapArray, block, persize, x, y);
|
core.drawAutotile(tempCanvas, mapArray, block, 32, 0, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (block.event.id!='none') {
|
if (block.event.id!='none') {
|
||||||
var blockIcon = core.material.icons[block.event.cls][block.event.id];
|
var blockIcon = core.material.icons[block.event.cls][block.event.id];
|
||||||
var blockImage = core.material.images[block.event.cls];
|
var blockImage = core.material.images[block.event.cls];
|
||||||
var height = block.event.height || 32;
|
var height = block.event.height || 32;
|
||||||
core.canvas[canvas].drawImage(blockImage, 0, blockIcon * height, 32, height, x + block.x * persize, y + block.y * persize + (persize-persize*height/32), persize, persize * height/32);
|
tempCanvas.drawImage(blockImage, 0, blockIcon * height, 32, height, 32*block.x, 32*block.y + 32 - height, 32, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// draw hero
|
||||||
if (core.isset(heroLoc)) {
|
if (core.isset(heroLoc)) {
|
||||||
if (!core.isset(core.material.images.images[heroIcon]))
|
if (!core.isset(core.material.images.images[heroIcon]))
|
||||||
heroIcon = "hero.png";
|
heroIcon = "hero.png";
|
||||||
var icon = core.material.icons.hero[heroLoc.direction];
|
var icon = core.material.icons.hero[heroLoc.direction];
|
||||||
var height = core.material.images.images[heroIcon].height/4;
|
var height = core.material.images.images[heroIcon].height/4;
|
||||||
var realHeight = persize*height/32;
|
tempCanvas.drawImage(core.material.images.images[heroIcon], icon.stop * 32, icon.loc * height, 32, height, 32*heroLoc.x, 32*heroLoc.y+32-height, 32, height);
|
||||||
core.canvas[canvas].drawImage(core.material.images.images[heroIcon], icon.stop * 32, icon.loc * height, 32, height, x+persize*heroLoc.x, y+persize*heroLoc.y+persize-realHeight, persize, realHeight);
|
|
||||||
}
|
}
|
||||||
|
// draw fg
|
||||||
images.forEach(function (t) {
|
images.forEach(function (t) {
|
||||||
var ratio = size/416;
|
|
||||||
var dx=parseInt(t[0]), dy=parseInt(t[1]), p=t[2];
|
var dx=parseInt(t[0]), dy=parseInt(t[1]), p=t[2];
|
||||||
if (core.isset(dx) && core.isset(dy) && core.isset(core.material.images.images[p])) {
|
if (core.isset(dx) && core.isset(dy) && core.isset(core.material.images.images[p])) {
|
||||||
dx*=32; dy*=32;
|
|
||||||
var image = core.material.images.images[p];
|
var image = core.material.images.images[p];
|
||||||
if (t[3]==1)
|
if (t[3]==1)
|
||||||
core.canvas.ui.drawImage(image, x+dx*ratio, y+dy*ratio, Math.min(size-dx*ratio, ratio*image.width), Math.min(size-dy*ratio, ratio*image.height));
|
tempCanvas.drawImage(image, 32*dx, 32*dy, image.width, image.height);
|
||||||
else if (t[3]==2)
|
else if (t[3]==2)
|
||||||
core.canvas.ui.drawImage(image, 0, 0, image.width, image.height-32,
|
tempCanvas.drawImage(image, 0, 0, image.width, image.height-32,
|
||||||
x+dx * ratio, y+dy * ratio, ratio * image.width, ratio * (image.height-32));
|
32*dx, 32*dy, image.width, image.height-32);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// draw to canvas
|
||||||
|
core.clearMap(canvas, x, y, size, size);
|
||||||
|
if (!core.isset(centerX)) centerX=parseInt(mw/2);
|
||||||
|
if (!core.isset(centerY)) centerY=parseInt(mh/2);
|
||||||
|
|
||||||
|
var offsetX = core.clamp(centerX-6, 0, mw-13), offsetY = core.clamp(centerY-6, 0, mh-13);
|
||||||
|
// offsetX~offsetX+12; offsetY~offsetY+12
|
||||||
|
core.canvas[canvas].drawImage(tempCanvas.canvas, offsetX*32, offsetY*32, 416, 416, x, y, size, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.prototype.drawKeyBoard = function () {
|
ui.prototype.drawKeyBoard = function () {
|
||||||
core.lockControl();
|
core.lockControl();
|
||||||
core.status.event.id = 'keyBoard';
|
core.status.event.id = 'keyBoard';
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
|
|
||||||
var left = 16, top = 48, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
var left = 16, top = 48, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
@ -1863,7 +1949,7 @@ ui.prototype.drawStatistics = function () {
|
|||||||
if (floor.cannotViewMap && floorId!=core.status.floorId) return;
|
if (floor.cannotViewMap && floorId!=core.status.floorId) return;
|
||||||
|
|
||||||
blocks.forEach(function (block) {
|
blocks.forEach(function (block) {
|
||||||
if (!core.isset(block.event) || (core.isset(block.enable) && !block.enable))
|
if (!core.isset(block.event) || block.disable)
|
||||||
return;
|
return;
|
||||||
var event = block.event;
|
var event = block.event;
|
||||||
if (event.cls.indexOf("enemy")==0) {
|
if (event.cls.indexOf("enemy")==0) {
|
||||||
|
|||||||
@ -352,6 +352,11 @@ utils.prototype.subarray = function (a, b) {
|
|||||||
return na;
|
return na;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils.prototype.clamp = function (x, a, b) {
|
||||||
|
var min=Math.min(a, b), max=Math.max(a, b);
|
||||||
|
return Math.min(Math.max(x||0, min), max);
|
||||||
|
}
|
||||||
|
|
||||||
////// Base64加密 //////
|
////// Base64加密 //////
|
||||||
utils.prototype.encodeBase64 = function (str) {
|
utils.prototype.encodeBase64 = function (str) {
|
||||||
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
||||||
|
|||||||
5
main.js
5
main.js
@ -43,6 +43,7 @@ function main() {
|
|||||||
'gif': document.getElementById('gif'),
|
'gif': document.getElementById('gif'),
|
||||||
'gif2': document.getElementById('gif2'),
|
'gif2': document.getElementById('gif2'),
|
||||||
'curtain': document.getElementById('curtain'),
|
'curtain': document.getElementById('curtain'),
|
||||||
|
'gameDraw': document.getElementById('gameDraw'),
|
||||||
'startButtons': document.getElementById('startButtons'),
|
'startButtons': document.getElementById('startButtons'),
|
||||||
'playGame': document.getElementById('playGame'),
|
'playGame': document.getElementById('playGame'),
|
||||||
'loadGame': document.getElementById('loadGame'),
|
'loadGame': document.getElementById('loadGame'),
|
||||||
@ -58,6 +59,7 @@ function main() {
|
|||||||
'expCol': document.getElementById('expCol'),
|
'expCol': document.getElementById('expCol'),
|
||||||
'upCol': document.getElementById('upCol'),
|
'upCol': document.getElementById('upCol'),
|
||||||
'keyCol': document.getElementById('keyCol'),
|
'keyCol': document.getElementById('keyCol'),
|
||||||
|
'pzfCol': document.getElementById('pzfCol'),
|
||||||
'debuffCol': document.getElementById('debuffCol'),
|
'debuffCol': document.getElementById('debuffCol'),
|
||||||
'hard': document.getElementById('hard'),
|
'hard': document.getElementById('hard'),
|
||||||
};
|
};
|
||||||
@ -133,6 +135,9 @@ function main() {
|
|||||||
'poison': document.getElementById('poison'),
|
'poison': document.getElementById('poison'),
|
||||||
'weak':document.getElementById('weak'),
|
'weak':document.getElementById('weak'),
|
||||||
'curse': document.getElementById('curse'),
|
'curse': document.getElementById('curse'),
|
||||||
|
'pickaxe': document.getElementById('pickaxe'),
|
||||||
|
'bomb': document.getElementById('bomb'),
|
||||||
|
'fly': document.getElementById('fly'),
|
||||||
'hard': document.getElementById("hard")
|
'hard': document.getElementById("hard")
|
||||||
}
|
}
|
||||||
this.floors = {}
|
this.floors = {}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
{
|
{
|
||||||
"main" : {
|
"main" : {
|
||||||
"floorIds" : [
|
"floorIds" : [
|
||||||
"sample0", "sample1", "sample2", "MT0"
|
"sample0", "sample1", "sample2", "sample3", "MT0"
|
||||||
],
|
],
|
||||||
"images" : [
|
"images" : [
|
||||||
"bg.jpg"
|
"bg.jpg"
|
||||||
@ -142,6 +142,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"enableExperience": false,
|
"enableExperience": false,
|
||||||
"enableLevelUp": false,
|
"enableLevelUp": false,
|
||||||
"enableKeys": true,
|
"enableKeys": true,
|
||||||
|
"enablePZF": false,
|
||||||
"enableDebuff": false,
|
"enableDebuff": false,
|
||||||
"flyNearStair": true,
|
"flyNearStair": true,
|
||||||
"pickaxeFourDirections": false,
|
"pickaxeFourDirections": false,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
|
enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
|
||||||
{
|
{
|
||||||
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'point': 0, 'special': [1,5,7,8]},
|
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'point': 0, 'special': [1,5,7,8]},
|
||||||
'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
|
'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': [16,18], 'value': 10},
|
||||||
'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
|
'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
|
||||||
'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'point': 0, 'special': [1,9]},
|
'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'point': 0, 'special': [1,9]},
|
||||||
'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'point': 0, 'special': 1},
|
'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'point': 0, 'special': 1},
|
||||||
|
|||||||
@ -1,35 +1,35 @@
|
|||||||
main.floors.MT0=
|
main.floors.MT0=
|
||||||
{
|
{
|
||||||
"floorId": "MT0",
|
"floorId": "MT0",
|
||||||
"title": "主塔 0 层",
|
"title": "主塔 0 层",
|
||||||
"name": "0",
|
"name": "0",
|
||||||
"canFlyTo": true,
|
"canFlyTo": true,
|
||||||
"canUseQuickShop": true,
|
"canUseQuickShop": true,
|
||||||
"cannotViewMap": false,
|
"cannotViewMap": false,
|
||||||
"defaultGround": "ground",
|
"defaultGround": "ground",
|
||||||
"images": [],
|
"images": [],
|
||||||
"item_ratio": 1,
|
"item_ratio": 1,
|
||||||
"map": [
|
"map": [
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
],
|
],
|
||||||
"firstArrive": [],
|
"firstArrive": [],
|
||||||
"events": {},
|
"events": {},
|
||||||
"changeFloor": {},
|
"changeFloor": {},
|
||||||
"afterBattle": {},
|
"afterBattle": {},
|
||||||
"afterGetItem": {},
|
"afterGetItem": {},
|
||||||
"afterOpenDoor": {},
|
"afterOpenDoor": {},
|
||||||
"cannotMove": {},
|
"cannotMove": {},
|
||||||
"upFloor": null,
|
"upFloor": null,
|
||||||
}
|
}
|
||||||
@ -1,410 +1,50 @@
|
|||||||
main.floors.sample2 =
|
main.floors.sample2=
|
||||||
{
|
{
|
||||||
"floorId": "sample2", // 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
"floorId": "sample2",
|
||||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
"title": "样板 2 层",
|
||||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
"name": "2",
|
||||||
// 楼层唯一标识符,需要和名字完全一致
|
"canFlyTo": true,
|
||||||
"title": "主塔 40 层", // 楼层中文名
|
"canUseQuickShop": true,
|
||||||
"name": "40", // 显示在状态栏中的层数
|
"cannotViewMap": false,
|
||||||
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"defaultGround": "ground",
|
||||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
"images": [],
|
||||||
"defaultGround": "snowGround", // 默认地面的图块ID(terrains中)
|
"item_ratio": 1,
|
||||||
"images": [], // // 该层默认显示的所有图片;详细用法请查看文档“自定义素材”中的说明。
|
"map": [
|
||||||
"color": [255,0,0,0.3], // 该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组。
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
"weather": ["rain",10], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪,第二项为1-10之间的数代表强度。
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
"bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。
|
[ 0, 0, 1, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
"item_ratio": 1, // 该层的宝石/血瓶倍率
|
[ 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0],
|
||||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
|
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
[ 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4, 4, 1, 85, 1, 4, 4, 4, 4, 5],
|
[ 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4,247, 1,247, 1,247, 4, 4, 4, 5],
|
[ 0, 0, 0, 0, 1, 1, 45, 0, 1, 0,202,202, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0],
|
||||||
[ 5, 4, 4, 4, 1,247,247,247, 1, 4, 4, 4, 5],
|
[ 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4, 1,247, 30,247, 1, 4, 4, 4, 5],
|
[ 0, 0, 0, 0, 0, 0, 88, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4,247, 1,124, 1,247, 4, 4, 4, 5],
|
[ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4, 4, 1,123, 1, 4, 4, 4, 4, 5],
|
[ 0, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 0, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, 4, 5],
|
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[ 5, 4, 4, 4, 4, 4, 85, 4, 4, 4, 4, 4, 5],
|
[ 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0],
|
||||||
[ 5, 5, 5, 5, 5, 5, 88, 5, 5, 5, 5, 5, 5]
|
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
],
|
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
[ 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
|
||||||
"\t[实战!]本楼将尝试复刻《宿命的旋律》40F剧情。"
|
[ 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
|
||||||
],
|
[ 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0],
|
||||||
"events": { // 该楼的所有可能事件列表
|
[ 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
|
||||||
"6,11": {"enable": false}, // 下楼梯口的机关门,初始处于关闭状态
|
[ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0],
|
||||||
"6,10": [ // 进入陷阱后关门
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
{"type": "playSound", "name": "door.mp3"},
|
],
|
||||||
{"type": "show", "loc": [6,11]}, // 显示机关门
|
"width":26,
|
||||||
{"type": "hide"}, // 隐藏该事件
|
"height":26,
|
||||||
{"type": "trigger", "loc": [6,7]}, // 直接引发"6,7"处的事件,即下面的杰克
|
"firstArrive": [],
|
||||||
// 请再次注意"trigger"会立刻结束当前事件,因此"type":"hide"需要在trigger前调用
|
"events": {"3,2":["123"],"12,12":["234"]},
|
||||||
],
|
"changeFloor": {"6,10": {"floorId": "sample1", "stair": "upFloor"}, "7,12": {"floorId": "sample3", "stair": "downFloor"}},
|
||||||
"6,7": [ // 杰克事件
|
"afterBattle": {},
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
"afterGetItem": {},
|
||||||
"\t[hero]杰克,你究竟是什么人?",
|
"afterOpenDoor": {},
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
"cannotMove": {},
|
||||||
"\t[杰克,thief]……",
|
"upFloor": null,
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
}
|
||||||
"\t[hero]我们……是朋友对吧?\n是朋友就应该相互信任对吧?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[杰克,thief]……事到如今也没有什么好隐瞒的了。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[杰克,thief]没错,我就是这一切的背后主谋。",
|
|
||||||
{"type": "move", "steps": [ // 移动到黑暗大法师的位置;使用move会自动调用hide进行隐藏,无需再手动调用
|
|
||||||
{"direction": "up", "value": 3}
|
|
||||||
], "time": 1000},
|
|
||||||
{"type": "show", "loc": [6,4], "time": 1000}, // 显示黑暗大法师
|
|
||||||
{"type": "sleep", "time": 500}, // 等待500毫秒
|
|
||||||
// 下面是黑暗大法师的事件
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]我的真名为——黑暗大法师,第四区域的头目。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]呵呵,不知道为什么,我竟然对事情走到现在这一步毫不感觉意外。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]以杰克的名义利用了你这么久,真是抱歉啊。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]真正的杰克现在在哪里?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]盗贼杰克这个人类从未存在过,他只是我用来接近你的一副皮囊而已。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……这样啊,呵呵。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]为什么你看上去丝毫不生气?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]多亏了鬼帝,我现在的脾气好得连我自己都害怕。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]说起来我还得好好感谢你呢,如果没有杰克……你的帮助,我早就死在第一区域了。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]不论你的目的如何,你的所作所为都是对我有利的。不是吗?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]能够如此淡定的面对背叛,看来跟五年前相比,你确实成长了很多啊。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]五年前?……黑暗大法师,在这之前,我们好像素未谋面吧?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]五年前那场屠城你应该这一生都不会忘记吧。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]很不巧,那场屠城的主谋,也是我。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]这么说,击中我双亲的那道紫色闪电,也就是你释放的吧……",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]你的双亲?这种事情我怎么可能会记得?\n你难道在踩死蚂蚁的时候还会一只只记下他们的样子吗?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]老 子 要 你 的 命",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]你应该对我心怀感激才对,如果不是那时的我看出了你隐藏的稀有勇者体质,你绝对不可能活到今天。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]在暗中动手脚让你通过勇者选拔的人也是我,我一直一直在暗中引导你走到今天这一步。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]是我救赎了一无是处的你。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]为什么只有我一个人活了下来!!!!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]为什么偏偏是我!!!!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]我刚才不是说过了吗?因为我看出了你有稀有勇者体质啊。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]你刚刚跟鬼帝交过手,应该已经很清楚这稀有勇者体质意味着什么了吧?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……就因为我有这种体质,就不得不背负如此残酷的宿命吗?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]愚蠢!这意味着只要我对你加以引导跟培养,你就能成为这世间实力最强的存在!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……所以,你究竟想利用我干什么?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]我利用你干的事情,你不是已经完成了吗?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……你说什么?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]不知不觉间,你已经在我的指引下跟鬼帝正面交手并且杀掉了他啊。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]就连我跟鬼帝的对决……也是被你安排好了的?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]你们两个一个是人类勇者,一个是魔物勇者,迟早会有交手的一天。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]我只不过是操纵了一系列的连锁事件让这一天提早了数十年到来而已。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……你这样做对谁有好处?他可是你们魔物世界的救世主啊。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]一个惧怕征战,爱好和平的懦夫,也配叫救世主?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]获得了力量,却只会被动挨打而不主动向人类世界出击,龟缩在第二区域惶惶度日,他根本就不配拥有稀有勇者体质。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]为了不让这种人霸占着积累多年的庞大灵魂能量无作为,我设计让你杀掉了他。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]你没有辜负我的期待,成功战胜了那个废物,现在你体内累积的灵魂能量……也就是魔力,已经达到了能跟魔王匹敌的地步。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……是吗?现在的我能与魔王匹敌?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]不止如此,你现在的力量之强就算是统治世界也是绰绰有余!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]怎么样?要不要加入我的麾下,跟随我去征战人类世界?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]能与魔王匹敌的话,也就是说。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]我 现 在 对 付 你 这 种 杂 碎 也 绰 绰 有 余 吧 ?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]……什么?!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]等一下!别冲动!你先等我把这利害关系理一理——",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]你给老子闭嘴。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]老子什么都不想听。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]老子现在想做的事情只有一件——",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]剁掉你的头,把它放回我双亲的墓前。",
|
|
||||||
{"type": "update"} // 本事件剧情结束,更新地图显伤
|
|
||||||
],
|
|
||||||
"6,4": { // 黑暗大法师战斗事件
|
|
||||||
"enable": false, // 初始时是禁用状态
|
|
||||||
// 打败后将触发afterBattle事件
|
|
||||||
},
|
|
||||||
"5,4": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
|
||||||
"7,4": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
|
||||||
"5,5": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
|
||||||
"7,5": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
|
||||||
"6,3": { // 大法师本尊
|
|
||||||
"trigger": "action", // 注意:这里要写 trigger:action ,来覆盖掉系统默认的battle事件。
|
|
||||||
"enable":false,
|
|
||||||
"data": [
|
|
||||||
"\t[blackMagician]听不进去人话的蠢货,就要用疼痛来管教!",
|
|
||||||
{"type": "changePos", "direction": "up"},
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]出来吧!禁忌——紫电凶杀阵!",
|
|
||||||
{"type": "show", "loc": [[4,3],[4,6],[8,6],[8,3]], "time": 500}, // 依次显示四个角的法师
|
|
||||||
{"type": "sleep", "time": 500},
|
|
||||||
"\t[blackMagician]感受绝望吧!冥顽不化的蠢货!",
|
|
||||||
/*
|
|
||||||
{"type": "hide", "loc": [4,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
|
||||||
{"type": "show", "loc": [4,3], "time": 150},
|
|
||||||
{"type": "hide", "loc": [4,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
|
||||||
{"type": "show", "loc": [4,6], "time": 150},
|
|
||||||
{"type": "hide", "loc": [8,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
|
||||||
{"type": "show", "loc": [8,6], "time": 150},
|
|
||||||
{"type": "hide", "loc": [8,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
|
||||||
{"type": "show", "loc": [8,3], "time": 150},
|
|
||||||
*/
|
|
||||||
{"type": "animate", "name": "yongchang", "loc": [4,3]},
|
|
||||||
{"type": "animate", "name": "yongchang", "loc": [4,6]},
|
|
||||||
{"type": "animate", "name": "yongchang", "loc": [8,6]},
|
|
||||||
{"type": "animate", "name": "yongchang", "loc": [8,3]},
|
|
||||||
{"type": "sleep", "time": 200},
|
|
||||||
{"type": "playSound", "name": "attack.mp3"}, // 播放攻击音效
|
|
||||||
{"type": "animate", "name": "thunder", "loc": "hero"},
|
|
||||||
{"type": "sleep", "time": 200},
|
|
||||||
"\t[hero]唔……!!(吐血)",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]我的魔力可是充足的很啊!我会一直折磨到你屈服于我为止!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]人类!好好感受吧!当初你们施加于我的痛苦!如今我要百倍奉还!",
|
|
||||||
{"type": "show", "loc": [6,6], "time": 1000}, // 显示妖精
|
|
||||||
{"type": "sleep", "time": 700},
|
|
||||||
{"type": "trigger", "loc": [6,6]} // 立刻触发妖精事件
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"4,3": { // 四个角的大法师,
|
|
||||||
"trigger": "action",
|
|
||||||
"displayDamage": false,
|
|
||||||
"enable":false
|
|
||||||
},
|
|
||||||
"8,3": { // 四个角的大法师,
|
|
||||||
"trigger": "action",
|
|
||||||
"displayDamage": false,
|
|
||||||
"enable":false
|
|
||||||
},
|
|
||||||
"4,6": { // 四个角的大法师,
|
|
||||||
"trigger": "action",
|
|
||||||
"displayDamage": false,
|
|
||||||
"enable":false
|
|
||||||
},
|
|
||||||
"8,6": { // 四个角的大法师,
|
|
||||||
"trigger": "action",
|
|
||||||
"displayDamage": false,
|
|
||||||
"enable":false
|
|
||||||
},
|
|
||||||
|
|
||||||
"6,6": { // 妖精
|
|
||||||
"enable":false, // 初始时禁用状态
|
|
||||||
"data": [ // 妖精事件
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]…妖精…小姐……是你吗?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]不要绝望,也不要悲伤。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]你从来都不是独自一人在前进。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]咱一直,一直都在注视着你。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]耍小聪明的你、笨笨的你呆呆的你、胆小的你、勇敢的你帅气的你……全部全部都是你。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]所以放心吧,无论发生什么,咱都会陪伴在你身边的。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]因为你要是离开我的话,立刻就会死掉吧?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]…妖精…小姐……其实一直以来,我都非常感激你……",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]笨蛋!都这种时候了就不要作出像是临终遗言的发言了啊!!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]喂!那边穿衣品味差到极点的黑暗大法师,别左顾右盼说的就是你!你应该知道咱的身份吧?\n还不速速退下!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]可恶…多管闲事的妖精族…明明只要再让他承受一点疼痛来瓦解他的意志力,我的计划就成功了!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]哼哼哼~抱歉哦,这个笨蛋的意志力可不像你想象的那么薄弱哦!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]不甘心!我不甘心!妖精公主又如何!\n只要是阻挡我的,不管是谁我都要铲除!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]终于露出狐狸尾巴了,其实咱早就看出你有谋反的念头。你的计划就是拉拢这家伙入伙然后推翻魔王对魔塔的统治对吧?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]呵呵呵……那个昏庸的魔王,掌握着那么庞大的魔物军队却只知道固守魔塔,而不主动侵略人类世界扩张领土!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]我实在是看不过眼,所以我才决定把这个具备稀有勇者体质的家伙培养成新一任魔王!\n来让这个世界的势力重新洗牌!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]你觉得一个满脑子想着回家种田的废柴勇者会成为改变世界的魔王?你晃晃脑袋试试,是不是能听到大海的声音?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]恼人至极的妖精族!呵呵呵……我干脆一不做二不休,连你也一块收拾了吧!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]别小瞧咱!咱好歹也是妖精族里实力数一数二的存在!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]只会耍嘴皮子的恼人苍蝇!我倒要看看一块焦炭会不会说话!\n——招雷弹!!",
|
|
||||||
/*
|
|
||||||
{"type": "hide", "loc": [4,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
|
||||||
{"type": "show", "loc": [4,3], "time": 150},
|
|
||||||
{"type": "hide", "loc": [4,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
|
||||||
{"type": "show", "loc": [4,6], "time": 150},
|
|
||||||
{"type": "hide", "loc": [8,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
|
||||||
{"type": "show", "loc": [8,6], "time": 150},
|
|
||||||
{"type": "hide", "loc": [8,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
|
||||||
{"type": "show", "loc": [8,3], "time": 150},
|
|
||||||
*/
|
|
||||||
{"type": "animate", "name": "yongchang", "loc": [4,3]},
|
|
||||||
{"type": "animate", "name": "yongchang", "loc": [4,6]},
|
|
||||||
{"type": "animate", "name": "yongchang", "loc": [8,6]},
|
|
||||||
{"type": "animate", "name": "yongchang", "loc": [8,3]},
|
|
||||||
{"type": "playSound", "name": "attack.mp3"}, // 播放攻击音效
|
|
||||||
/*
|
|
||||||
{"type": "hide", "loc": [6,6], "time": 150}, // 妖精也闪一下表示收到了伤害
|
|
||||||
{"type": "show", "loc": [6,6], "time": 150}, // 妖精也闪一下表示收到了伤害
|
|
||||||
*/
|
|
||||||
{"type": "animate", "name": "thunder", "loc": [6,6]},
|
|
||||||
{"type": "sleep", "time": 500}, // 等待500毫秒
|
|
||||||
"\t[小妖精,fairy]切,这点伤痛跟他刚才经历的身心地狱相比根本就不算什么。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]哼!翅膀都被烧焦了还要嘴硬?你难不成真以为我不会对你动真格?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……你这混蛋!给我离她远点!!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]!…你现在受了很严重的致命伤,乱动什么?\n乖。别怕,这里有咱顶着!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]对了,咱再问你一遍,你是很珍惜自己性命的对吧?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]!…等等…妖精小姐,你不会是……?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]喂,黑暗大法师,你作为魔塔里最博学多识的蠢货,应该对咱妖精族的特殊能力再清楚不过吧?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]什么?!难不成你是想!!不可能……\n就为了一个渺小的人类,不可理喻!!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]哼哼哼!你害怕的表情可真美味!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]不过比起这个,咱更期待你吃到“妖精自灭冲击”之后的死状哦!~",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[blackMagician]不!!不应该是这样的!我完美的计划竟然会被一只小小的妖精破坏!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]不要!……千万不要!……为了我这种人……唔!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]笨蛋,动都动不了了就不要强撑着站起来了啊。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]真是的,都到最后一刻了,你这家伙好歹也让咱省点心吧。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[小妖精,fairy]那么,再见了……我的勇者大人。",
|
|
||||||
{"type": "move", "time": 700, "steps": [ // 向上移动三个,撞上黑暗大大法师;本事件的hide会自动被调用
|
|
||||||
{"direction": "up", "value": 3}
|
|
||||||
]},
|
|
||||||
{"type": "playSound", "name": "attack.mp3"}, // 播放攻击音效
|
|
||||||
{"type": "sleep", "time": 200},
|
|
||||||
"\t[blackMagician]不可能!!!!!",
|
|
||||||
{"type": "hide", "loc": [6,3]}, // 法师消失
|
|
||||||
{"type": "hide", "loc": [4,3]}, // 四个分身消失
|
|
||||||
{"type": "hide", "loc": [4,6]},
|
|
||||||
{"type": "hide", "loc": [8,6]},
|
|
||||||
{"type": "hide", "loc": [8,3]},
|
|
||||||
{"type": "changeFloor", "floorId": "sample2", "loc": [6,6], "direction": "up", "time": 1000}, // 更换勇士地点,合计1秒
|
|
||||||
{"type": "show", "loc": [6,5]}, // 显示黄宝石
|
|
||||||
{"type": "sleep", "time": 200}, // 等待200毫秒
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
{"type": "sleep", "time": 200}, // 等待200毫秒
|
|
||||||
"\t[hero]…妖精…小姐……",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……妖精小姐!",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]是梦吗?……不对,为什么我在流泪?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]这颗漂亮的宝石是……?",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]我全都想起来了……妖精小姐为了我……\n牺牲了自己的性命。",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]在这颗宝石上,我能感受到你的温度……\n熟悉而又令人安心,这就是你最后留给我的东西吗……",
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]好温暖……",
|
|
||||||
{"type": "setValue", "name": "item:yellowJewel", "value": "1"}, // 获得1个黄宝石
|
|
||||||
{"type": "hide", "loc": [6,5]}, // 隐藏黄宝石
|
|
||||||
{"type": "playSound", "name": "item.mp3"},
|
|
||||||
"\t[hero]……",
|
|
||||||
{"type": "openDoor", "loc": [6,2]}, // 开门
|
|
||||||
{"type": "openDoor", "loc": [6,11]}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"6,5": { // 黄宝石
|
|
||||||
"enable": false
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
|
||||||
"6,0": {"floorId": "sample2", "stair": "upFloor"},
|
|
||||||
"6,12": {"floorId": "sample1", "stair": "upFloor"}
|
|
||||||
},
|
|
||||||
"afterBattle": { // 战斗后可能触发的事件列表
|
|
||||||
"6,4": [ // 和黑暗大法师战斗结束
|
|
||||||
"\t[blackMagician]天真!你以为这样就能战胜我吗?",
|
|
||||||
{"type": "show", "loc": [7,5], "time": 500},
|
|
||||||
{"type": "update"}, // 更新地图显伤
|
|
||||||
],
|
|
||||||
"7,5": [ // 和分身1的战斗
|
|
||||||
"\t[blackMagician]你打败的不过是我众多分身中的其中一个而已。",
|
|
||||||
{"type": "show", "loc": [5,4], "time": 500},
|
|
||||||
{"type": "update"}, // 更新地图显伤
|
|
||||||
],
|
|
||||||
"5,4": [ // 和分身2的战斗
|
|
||||||
"\t[blackMagician]你的身体已经伤痕累累了,可我还留有着九成多的魔力。",
|
|
||||||
{"type": "show", "loc": [5,5], "time": 500},
|
|
||||||
{"type": "update"}, // 更新地图显伤
|
|
||||||
],
|
|
||||||
"5,5": [ // 和分身3的战斗
|
|
||||||
"\t[blackMagician]顽固的家伙!放弃抵抗吧!",
|
|
||||||
{"type": "show", "loc": [7,4], "time": 500},
|
|
||||||
{"type": "update"}, // 更新地图显伤
|
|
||||||
],
|
|
||||||
"7,4": [ // 和分身4的战斗
|
|
||||||
"\t[blackMagician]哈哈哈哈!我的灵魂远比你想象的强大!\n我即是永恒!",
|
|
||||||
{"type": "show", "loc": [6,3], "time": 500},
|
|
||||||
{"type": "trigger", "loc": [6,3]} // 显示大法师本尊
|
|
||||||
],
|
|
||||||
},
|
|
||||||
"afterGetItem": { // 获得道具后可能触发的事件列表
|
|
||||||
|
|
||||||
},
|
|
||||||
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
|
||||||
|
|
||||||
},
|
|
||||||
"cannotMove": { // 每个图块不可通行的方向
|
|
||||||
// 可以在这里定义每个点不能前往哪个方向,例如悬崖边不能跳下去
|
|
||||||
// "x,y": ["up", "left"], // (x,y)点不能往上和左走
|
|
||||||
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
409
project/floors/sample3.js
Normal file
409
project/floors/sample3.js
Normal file
@ -0,0 +1,409 @@
|
|||||||
|
main.floors.sample3 =
|
||||||
|
{
|
||||||
|
"floorId": "sample3", // 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||||
|
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||||
|
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||||
|
// 楼层唯一标识符,需要和名字完全一致
|
||||||
|
"title": "主塔 40 层", // 楼层中文名
|
||||||
|
"name": "40", // 显示在状态栏中的层数
|
||||||
|
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
|
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||||
|
"defaultGround": "snowGround", // 默认地面的图块ID(terrains中)
|
||||||
|
"images": [], // // 该层默认显示的所有图片;详细用法请查看文档“自定义素材”中的说明。
|
||||||
|
"color": [255,0,0,0.3], // 该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组。
|
||||||
|
"weather": ["rain",10], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪,第二项为1-10之间的数代表强度。
|
||||||
|
"bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。
|
||||||
|
"item_ratio": 1, // 该层的宝石/血瓶倍率
|
||||||
|
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||||
|
[ 5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
|
||||||
|
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4, 4, 1, 85, 1, 4, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4,247, 1,247, 1,247, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4, 1,247,247,247, 1, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4, 1,247, 30,247, 1, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4,247, 1,124, 1,247, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4, 4, 1,123, 1, 4, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, 4, 5],
|
||||||
|
[ 5, 4, 4, 4, 4, 4, 85, 4, 4, 4, 4, 4, 5],
|
||||||
|
[ 5, 5, 5, 5, 5, 5, 88, 5, 5, 5, 5, 5, 5]
|
||||||
|
],
|
||||||
|
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||||
|
"\t[实战!]本楼将尝试复刻《宿命的旋律》40F剧情。"
|
||||||
|
],
|
||||||
|
"events": { // 该楼的所有可能事件列表
|
||||||
|
|
||||||
|
"6,11": {"enable": false}, // 下楼梯口的机关门,初始处于关闭状态
|
||||||
|
"6,10": [ // 进入陷阱后关门
|
||||||
|
{"type": "playSound", "name": "door.mp3"},
|
||||||
|
{"type": "show", "loc": [6,11]}, // 显示机关门
|
||||||
|
{"type": "hide"}, // 隐藏该事件
|
||||||
|
{"type": "trigger", "loc": [6,7]}, // 直接引发"6,7"处的事件,即下面的杰克
|
||||||
|
// 请再次注意"trigger"会立刻结束当前事件,因此"type":"hide"需要在trigger前调用
|
||||||
|
],
|
||||||
|
"6,7": [ // 杰克事件
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]杰克,你究竟是什么人?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[杰克,thief]……",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]我们……是朋友对吧?\n是朋友就应该相互信任对吧?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[杰克,thief]……事到如今也没有什么好隐瞒的了。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[杰克,thief]没错,我就是这一切的背后主谋。",
|
||||||
|
{"type": "move", "steps": [ // 移动到黑暗大法师的位置;使用move会自动调用hide进行隐藏,无需再手动调用
|
||||||
|
{"direction": "up", "value": 3}
|
||||||
|
], "time": 1000},
|
||||||
|
{"type": "show", "loc": [6,4], "time": 1000}, // 显示黑暗大法师
|
||||||
|
{"type": "sleep", "time": 500}, // 等待500毫秒
|
||||||
|
// 下面是黑暗大法师的事件
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]我的真名为——黑暗大法师,第四区域的头目。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]呵呵,不知道为什么,我竟然对事情走到现在这一步毫不感觉意外。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]以杰克的名义利用了你这么久,真是抱歉啊。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]真正的杰克现在在哪里?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]盗贼杰克这个人类从未存在过,他只是我用来接近你的一副皮囊而已。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……这样啊,呵呵。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]为什么你看上去丝毫不生气?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]多亏了鬼帝,我现在的脾气好得连我自己都害怕。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]说起来我还得好好感谢你呢,如果没有杰克……你的帮助,我早就死在第一区域了。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]不论你的目的如何,你的所作所为都是对我有利的。不是吗?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]能够如此淡定的面对背叛,看来跟五年前相比,你确实成长了很多啊。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]五年前?……黑暗大法师,在这之前,我们好像素未谋面吧?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]五年前那场屠城你应该这一生都不会忘记吧。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]很不巧,那场屠城的主谋,也是我。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]这么说,击中我双亲的那道紫色闪电,也就是你释放的吧……",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]你的双亲?这种事情我怎么可能会记得?\n你难道在踩死蚂蚁的时候还会一只只记下他们的样子吗?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]老 子 要 你 的 命",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]你应该对我心怀感激才对,如果不是那时的我看出了你隐藏的稀有勇者体质,你绝对不可能活到今天。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]在暗中动手脚让你通过勇者选拔的人也是我,我一直一直在暗中引导你走到今天这一步。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]是我救赎了一无是处的你。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]为什么只有我一个人活了下来!!!!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]为什么偏偏是我!!!!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]我刚才不是说过了吗?因为我看出了你有稀有勇者体质啊。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]你刚刚跟鬼帝交过手,应该已经很清楚这稀有勇者体质意味着什么了吧?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……就因为我有这种体质,就不得不背负如此残酷的宿命吗?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]愚蠢!这意味着只要我对你加以引导跟培养,你就能成为这世间实力最强的存在!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……所以,你究竟想利用我干什么?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]我利用你干的事情,你不是已经完成了吗?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……你说什么?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]不知不觉间,你已经在我的指引下跟鬼帝正面交手并且杀掉了他啊。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]就连我跟鬼帝的对决……也是被你安排好了的?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]你们两个一个是人类勇者,一个是魔物勇者,迟早会有交手的一天。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]我只不过是操纵了一系列的连锁事件让这一天提早了数十年到来而已。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……你这样做对谁有好处?他可是你们魔物世界的救世主啊。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]一个惧怕征战,爱好和平的懦夫,也配叫救世主?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]获得了力量,却只会被动挨打而不主动向人类世界出击,龟缩在第二区域惶惶度日,他根本就不配拥有稀有勇者体质。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]为了不让这种人霸占着积累多年的庞大灵魂能量无作为,我设计让你杀掉了他。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]你没有辜负我的期待,成功战胜了那个废物,现在你体内累积的灵魂能量……也就是魔力,已经达到了能跟魔王匹敌的地步。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……是吗?现在的我能与魔王匹敌?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]不止如此,你现在的力量之强就算是统治世界也是绰绰有余!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]怎么样?要不要加入我的麾下,跟随我去征战人类世界?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]能与魔王匹敌的话,也就是说。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]我 现 在 对 付 你 这 种 杂 碎 也 绰 绰 有 余 吧 ?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]……什么?!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]等一下!别冲动!你先等我把这利害关系理一理——",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]你给老子闭嘴。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]老子什么都不想听。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]老子现在想做的事情只有一件——",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]剁掉你的头,把它放回我双亲的墓前。",
|
||||||
|
{"type": "update"} // 本事件剧情结束,更新地图显伤
|
||||||
|
],
|
||||||
|
"6,4": { // 黑暗大法师战斗事件
|
||||||
|
"enable": false, // 初始时是禁用状态
|
||||||
|
// 打败后将触发afterBattle事件
|
||||||
|
},
|
||||||
|
"5,4": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
||||||
|
"7,4": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
||||||
|
"5,5": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
||||||
|
"7,5": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
||||||
|
"6,3": { // 大法师本尊
|
||||||
|
"trigger": "action", // 注意:这里要写 trigger:action ,来覆盖掉系统默认的battle事件。
|
||||||
|
"enable":false,
|
||||||
|
"data": [
|
||||||
|
"\t[blackMagician]听不进去人话的蠢货,就要用疼痛来管教!",
|
||||||
|
{"type": "changePos", "direction": "up"},
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]出来吧!禁忌——紫电凶杀阵!",
|
||||||
|
{"type": "show", "loc": [[4,3],[4,6],[8,6],[8,3]], "time": 500}, // 依次显示四个角的法师
|
||||||
|
{"type": "sleep", "time": 500},
|
||||||
|
"\t[blackMagician]感受绝望吧!冥顽不化的蠢货!",
|
||||||
|
/*
|
||||||
|
{"type": "hide", "loc": [4,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||||
|
{"type": "show", "loc": [4,3], "time": 150},
|
||||||
|
{"type": "hide", "loc": [4,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||||
|
{"type": "show", "loc": [4,6], "time": 150},
|
||||||
|
{"type": "hide", "loc": [8,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||||
|
{"type": "show", "loc": [8,6], "time": 150},
|
||||||
|
{"type": "hide", "loc": [8,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||||
|
{"type": "show", "loc": [8,3], "time": 150},
|
||||||
|
*/
|
||||||
|
{"type": "animate", "name": "yongchang", "loc": [4,3]},
|
||||||
|
{"type": "animate", "name": "yongchang", "loc": [4,6]},
|
||||||
|
{"type": "animate", "name": "yongchang", "loc": [8,6]},
|
||||||
|
{"type": "animate", "name": "yongchang", "loc": [8,3]},
|
||||||
|
{"type": "sleep", "time": 200},
|
||||||
|
{"type": "playSound", "name": "attack.mp3"}, // 播放攻击音效
|
||||||
|
{"type": "animate", "name": "thunder", "loc": "hero"},
|
||||||
|
{"type": "sleep", "time": 200},
|
||||||
|
"\t[hero]唔……!!(吐血)",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]我的魔力可是充足的很啊!我会一直折磨到你屈服于我为止!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]人类!好好感受吧!当初你们施加于我的痛苦!如今我要百倍奉还!",
|
||||||
|
{"type": "show", "loc": [6,6], "time": 1000}, // 显示妖精
|
||||||
|
{"type": "sleep", "time": 700},
|
||||||
|
{"type": "trigger", "loc": [6,6]} // 立刻触发妖精事件
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"4,3": { // 四个角的大法师,
|
||||||
|
"trigger": "action",
|
||||||
|
"displayDamage": false,
|
||||||
|
"enable":false
|
||||||
|
},
|
||||||
|
"8,3": { // 四个角的大法师,
|
||||||
|
"trigger": "action",
|
||||||
|
"displayDamage": false,
|
||||||
|
"enable":false
|
||||||
|
},
|
||||||
|
"4,6": { // 四个角的大法师,
|
||||||
|
"trigger": "action",
|
||||||
|
"displayDamage": false,
|
||||||
|
"enable":false
|
||||||
|
},
|
||||||
|
"8,6": { // 四个角的大法师,
|
||||||
|
"trigger": "action",
|
||||||
|
"displayDamage": false,
|
||||||
|
"enable":false
|
||||||
|
},
|
||||||
|
|
||||||
|
"6,6": { // 妖精
|
||||||
|
"enable":false, // 初始时禁用状态
|
||||||
|
"data": [ // 妖精事件
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]…妖精…小姐……是你吗?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]不要绝望,也不要悲伤。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]你从来都不是独自一人在前进。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]咱一直,一直都在注视着你。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]耍小聪明的你、笨笨的你呆呆的你、胆小的你、勇敢的你帅气的你……全部全部都是你。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]所以放心吧,无论发生什么,咱都会陪伴在你身边的。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]因为你要是离开我的话,立刻就会死掉吧?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]…妖精…小姐……其实一直以来,我都非常感激你……",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]笨蛋!都这种时候了就不要作出像是临终遗言的发言了啊!!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]喂!那边穿衣品味差到极点的黑暗大法师,别左顾右盼说的就是你!你应该知道咱的身份吧?\n还不速速退下!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]可恶…多管闲事的妖精族…明明只要再让他承受一点疼痛来瓦解他的意志力,我的计划就成功了!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]哼哼哼~抱歉哦,这个笨蛋的意志力可不像你想象的那么薄弱哦!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]不甘心!我不甘心!妖精公主又如何!\n只要是阻挡我的,不管是谁我都要铲除!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]终于露出狐狸尾巴了,其实咱早就看出你有谋反的念头。你的计划就是拉拢这家伙入伙然后推翻魔王对魔塔的统治对吧?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]呵呵呵……那个昏庸的魔王,掌握着那么庞大的魔物军队却只知道固守魔塔,而不主动侵略人类世界扩张领土!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]我实在是看不过眼,所以我才决定把这个具备稀有勇者体质的家伙培养成新一任魔王!\n来让这个世界的势力重新洗牌!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]你觉得一个满脑子想着回家种田的废柴勇者会成为改变世界的魔王?你晃晃脑袋试试,是不是能听到大海的声音?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]恼人至极的妖精族!呵呵呵……我干脆一不做二不休,连你也一块收拾了吧!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]别小瞧咱!咱好歹也是妖精族里实力数一数二的存在!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]只会耍嘴皮子的恼人苍蝇!我倒要看看一块焦炭会不会说话!\n——招雷弹!!",
|
||||||
|
/*
|
||||||
|
{"type": "hide", "loc": [4,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||||
|
{"type": "show", "loc": [4,3], "time": 150},
|
||||||
|
{"type": "hide", "loc": [4,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||||
|
{"type": "show", "loc": [4,6], "time": 150},
|
||||||
|
{"type": "hide", "loc": [8,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||||
|
{"type": "show", "loc": [8,6], "time": 150},
|
||||||
|
{"type": "hide", "loc": [8,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||||
|
{"type": "show", "loc": [8,3], "time": 150},
|
||||||
|
*/
|
||||||
|
{"type": "animate", "name": "yongchang", "loc": [4,3]},
|
||||||
|
{"type": "animate", "name": "yongchang", "loc": [4,6]},
|
||||||
|
{"type": "animate", "name": "yongchang", "loc": [8,6]},
|
||||||
|
{"type": "animate", "name": "yongchang", "loc": [8,3]},
|
||||||
|
{"type": "playSound", "name": "attack.mp3"}, // 播放攻击音效
|
||||||
|
/*
|
||||||
|
{"type": "hide", "loc": [6,6], "time": 150}, // 妖精也闪一下表示收到了伤害
|
||||||
|
{"type": "show", "loc": [6,6], "time": 150}, // 妖精也闪一下表示收到了伤害
|
||||||
|
*/
|
||||||
|
{"type": "animate", "name": "thunder", "loc": [6,6]},
|
||||||
|
{"type": "sleep", "time": 500}, // 等待500毫秒
|
||||||
|
"\t[小妖精,fairy]切,这点伤痛跟他刚才经历的身心地狱相比根本就不算什么。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]哼!翅膀都被烧焦了还要嘴硬?你难不成真以为我不会对你动真格?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……你这混蛋!给我离她远点!!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]!…你现在受了很严重的致命伤,乱动什么?\n乖。别怕,这里有咱顶着!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]对了,咱再问你一遍,你是很珍惜自己性命的对吧?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]!…等等…妖精小姐,你不会是……?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]喂,黑暗大法师,你作为魔塔里最博学多识的蠢货,应该对咱妖精族的特殊能力再清楚不过吧?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]什么?!难不成你是想!!不可能……\n就为了一个渺小的人类,不可理喻!!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]哼哼哼!你害怕的表情可真美味!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]不过比起这个,咱更期待你吃到“妖精自灭冲击”之后的死状哦!~",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[blackMagician]不!!不应该是这样的!我完美的计划竟然会被一只小小的妖精破坏!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]不要!……千万不要!……为了我这种人……唔!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]笨蛋,动都动不了了就不要强撑着站起来了啊。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]真是的,都到最后一刻了,你这家伙好歹也让咱省点心吧。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[小妖精,fairy]那么,再见了……我的勇者大人。",
|
||||||
|
{"type": "move", "time": 700, "steps": [ // 向上移动三个,撞上黑暗大大法师;本事件的hide会自动被调用
|
||||||
|
{"direction": "up", "value": 3}
|
||||||
|
]},
|
||||||
|
{"type": "playSound", "name": "attack.mp3"}, // 播放攻击音效
|
||||||
|
{"type": "sleep", "time": 200},
|
||||||
|
"\t[blackMagician]不可能!!!!!",
|
||||||
|
{"type": "hide", "loc": [6,3]}, // 法师消失
|
||||||
|
{"type": "hide", "loc": [4,3]}, // 四个分身消失
|
||||||
|
{"type": "hide", "loc": [4,6]},
|
||||||
|
{"type": "hide", "loc": [8,6]},
|
||||||
|
{"type": "hide", "loc": [8,3]},
|
||||||
|
{"type": "changeFloor", "floorId": "sample3", "loc": [6,6], "direction": "up", "time": 1000}, // 更换勇士地点,合计1秒
|
||||||
|
{"type": "show", "loc": [6,5]}, // 显示黄宝石
|
||||||
|
{"type": "sleep", "time": 200}, // 等待200毫秒
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
{"type": "sleep", "time": 200}, // 等待200毫秒
|
||||||
|
"\t[hero]…妖精…小姐……",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……妖精小姐!",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]是梦吗?……不对,为什么我在流泪?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]这颗漂亮的宝石是……?",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]我全都想起来了……妖精小姐为了我……\n牺牲了自己的性命。",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]在这颗宝石上,我能感受到你的温度……\n熟悉而又令人安心,这就是你最后留给我的东西吗……",
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]好温暖……",
|
||||||
|
{"type": "setValue", "name": "item:yellowJewel", "value": "1"}, // 获得1个黄宝石
|
||||||
|
{"type": "hide", "loc": [6,5]}, // 隐藏黄宝石
|
||||||
|
{"type": "playSound", "name": "item.mp3"},
|
||||||
|
"\t[hero]……",
|
||||||
|
{"type": "openDoor", "loc": [6,2]}, // 开门
|
||||||
|
{"type": "openDoor", "loc": [6,11]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"6,5": { // 黄宝石
|
||||||
|
"enable": false
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
||||||
|
"6,0": {"floorId": "sample3", "stair": "upFloor"},
|
||||||
|
"6,12": {"floorId": "sample2", "stair": "upFloor"}
|
||||||
|
},
|
||||||
|
"afterBattle": { // 战斗后可能触发的事件列表
|
||||||
|
"6,4": [ // 和黑暗大法师战斗结束
|
||||||
|
"\t[blackMagician]天真!你以为这样就能战胜我吗?",
|
||||||
|
{"type": "show", "loc": [7,5], "time": 500},
|
||||||
|
{"type": "update"}, // 更新地图显伤
|
||||||
|
],
|
||||||
|
"7,5": [ // 和分身1的战斗
|
||||||
|
"\t[blackMagician]你打败的不过是我众多分身中的其中一个而已。",
|
||||||
|
{"type": "show", "loc": [5,4], "time": 500},
|
||||||
|
{"type": "update"}, // 更新地图显伤
|
||||||
|
],
|
||||||
|
"5,4": [ // 和分身2的战斗
|
||||||
|
"\t[blackMagician]你的身体已经伤痕累累了,可我还留有着九成多的魔力。",
|
||||||
|
{"type": "show", "loc": [5,5], "time": 500},
|
||||||
|
{"type": "update"}, // 更新地图显伤
|
||||||
|
],
|
||||||
|
"5,5": [ // 和分身3的战斗
|
||||||
|
"\t[blackMagician]顽固的家伙!放弃抵抗吧!",
|
||||||
|
{"type": "show", "loc": [7,4], "time": 500},
|
||||||
|
{"type": "update"}, // 更新地图显伤
|
||||||
|
],
|
||||||
|
"7,4": [ // 和分身4的战斗
|
||||||
|
"\t[blackMagician]哈哈哈哈!我的灵魂远比你想象的强大!\n我即是永恒!",
|
||||||
|
{"type": "show", "loc": [6,3], "time": 500},
|
||||||
|
{"type": "trigger", "loc": [6,3]} // 显示大法师本尊
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"afterGetItem": { // 获得道具后可能触发的事件列表
|
||||||
|
|
||||||
|
},
|
||||||
|
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
||||||
|
|
||||||
|
},
|
||||||
|
"cannotMove": { // 每个图块不可通行的方向
|
||||||
|
// 可以在这里定义每个点不能前往哪个方向,例如悬崖边不能跳下去
|
||||||
|
// "x,y": ["up", "left"], // (x,y)点不能往上和左走
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
@ -149,7 +149,6 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
// 删除该块
|
// 删除该块
|
||||||
if (core.isset(x) && core.isset(y)) {
|
if (core.isset(x) && core.isset(y)) {
|
||||||
core.removeBlock(x, y);
|
core.removeBlock(x, y);
|
||||||
core.canvas.event.clearRect(32 * x, 32 * y, 32, 32);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 毒衰咒的处理
|
// 毒衰咒的处理
|
||||||
@ -209,6 +208,15 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
core.unshift(todo, core.events.addPoint(core.material.enemys[enemyId]));
|
core.unshift(todo, core.events.addPoint(core.material.enemys[enemyId]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 在这里增加其他的自定义事件需求
|
||||||
|
/*
|
||||||
|
if (enemyId=='xxx') {
|
||||||
|
core.unshift(todo, [
|
||||||
|
{"type": "...", ...},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// 如果事件不为空,将其插入
|
// 如果事件不为空,将其插入
|
||||||
if (todo.length>0) {
|
if (todo.length>0) {
|
||||||
core.events.insertAction(todo,x,y);
|
core.events.insertAction(todo,x,y);
|
||||||
@ -322,7 +330,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
[8, "反击", "战斗时,怪物每回合附加角色攻击的"+Math.floor(100*core.values.counterAttack||0)+"%作为伤害,无视角色防御"],
|
[8, "反击", "战斗时,怪物每回合附加角色攻击的"+Math.floor(100*core.values.counterAttack||0)+"%作为伤害,无视角色防御"],
|
||||||
[9, "净化", "战斗前,怪物附加勇士魔防的"+core.values.purify+"倍作为伤害"],
|
[9, "净化", "战斗前,怪物附加勇士魔防的"+core.values.purify+"倍作为伤害"],
|
||||||
[10, "模仿", "怪物的攻防和勇士攻防相等"],
|
[10, "模仿", "怪物的攻防和勇士攻防相等"],
|
||||||
[11, "吸血", function (enemy) {return "吸血:战斗前,怪物首先吸取角色的"+Math.floor(100*enemy.value||0)+"%生命作为伤害"+(enemy.add?",并把伤害数值加到自身生命上":"");}],
|
[11, "吸血", function (enemy) {return "战斗前,怪物首先吸取角色的"+Math.floor(100*enemy.value||0)+"%生命作为伤害"+(enemy.add?",并把伤害数值加到自身生命上":"");}],
|
||||||
[12, "中毒", "战斗后,勇士陷入中毒状态,每一步损失生命"+core.values.poisonDamage+"点"],
|
[12, "中毒", "战斗后,勇士陷入中毒状态,每一步损失生命"+core.values.poisonDamage+"点"],
|
||||||
[13, "衰弱", "战斗后,勇士陷入衰弱状态,攻防暂时下降"+(core.values.weakValue>=1?core.values.weakValue+"点":parseInt(core.values.weakValue*100)+"%")],
|
[13, "衰弱", "战斗后,勇士陷入衰弱状态,攻防暂时下降"+(core.values.weakValue>=1?core.values.weakValue+"点":parseInt(core.values.weakValue*100)+"%")],
|
||||||
[14, "诅咒", "战斗后,勇士陷入诅咒状态,战斗无法获得金币和经验"],
|
[14, "诅咒", "战斗后,勇士陷入诅咒状态,战斗无法获得金币和经验"],
|
||||||
@ -334,7 +342,8 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
[20, "无敌", "勇士无法打败怪物,除非拥有十字架"],
|
[20, "无敌", "勇士无法打败怪物,除非拥有十字架"],
|
||||||
[21, "退化", function (enemy) {return "战斗后勇士永久下降"+(enemy.atkValue||0)+"点攻击和"+(enemy.defValue||0)+"点防御";}],
|
[21, "退化", function (enemy) {return "战斗后勇士永久下降"+(enemy.atkValue||0)+"点攻击和"+(enemy.defValue||0)+"点防御";}],
|
||||||
[22, "固伤", function (enemy) {return "战斗前,怪物对勇士造成"+(enemy.damage||0)+"点固定伤害,无视勇士魔防。";}],
|
[22, "固伤", function (enemy) {return "战斗前,怪物对勇士造成"+(enemy.damage||0)+"点固定伤害,无视勇士魔防。";}],
|
||||||
[23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现"]
|
[23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现"],
|
||||||
|
[24, "激光", function (enemy) {return "经过怪物同行或同列时自动减生命"+(enemy.value||0)+"点";}]
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
"getDamageInfo" : function (enemy, hero_hp, hero_atk, hero_def, hero_mdef) {
|
"getDamageInfo" : function (enemy, hero_hp, hero_atk, hero_def, hero_mdef) {
|
||||||
@ -453,7 +462,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
core.lockControl();
|
core.lockControl();
|
||||||
core.status.event.id = 'about';
|
core.status.event.id = 'about';
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui');
|
||||||
var left = 48, top = 36, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
var left = 48, top = 36, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
||||||
|
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
|
|||||||
@ -290,7 +290,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
"bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||||
"bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
"bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
||||||
"hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
"hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
||||||
"centerFly": "core.clearMap('hero', 0, 0, 416, 416);\ncore.setHeroLoc('x', core.status.event.data.x);\ncore.setHeroLoc('y', core.status.event.data.y);\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
"centerFly": "core.clearMap('hero');\ncore.setHeroLoc('x', (core.bigmap.width||13)-1-core.getHeroLoc('x'));\ncore.setHeroLoc('y', (core.bigmap.height||13)-1-core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
||||||
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
||||||
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
||||||
"poisonWine": "core.setFlag('poison', false);",
|
"poisonWine": "core.setFlag('poison', false);",
|
||||||
@ -315,16 +315,16 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"canUseItemEffect": {
|
"canUseItemEffect": {
|
||||||
"book": "true",
|
"book": "true",
|
||||||
"fly": "core.status.hero.flyRange.indexOf(core.status.floorId)>=0",
|
"fly": "core.status.hero.flyRange.indexOf(core.status.floorId)>=0",
|
||||||
"pickaxe": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) \n\t\t&& Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1\n\t\t&& (block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙\n\t{\n\t\t// 四个方向\n\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
"pickaxe": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1\n\t\t&& (block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙\n\t{\n\t\t// 四个方向\n\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||||
"icePickaxe": "var able=false;\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\tcore.status.event.data = [i];\n\t\table=true;\n\t}\n}\nable",
|
"icePickaxe": "var able=false;\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\tcore.status.event.data = [i];\n\t\table=true;\n\t}\n}\nable",
|
||||||
"bomb": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
"bomb": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||||
"hammer": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
"hammer": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||||
"earthquake": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) // 能炸的墙壁\n ids.push(i);\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
"earthquake": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !block.disable && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) // 能炸的墙壁\n ids.push(i);\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
||||||
"centerFly": "var able=false;\nvar toX = 12 - core.getHeroLoc('x'), toY = 12-core.getHeroLoc('y');\nvar block = core.getBlock(toX, toY);\nif (block==null) {\n core.status.event.data = {'x': toX, 'y': toY};\n able = true;\n}\nable",
|
"centerFly": "var toX = (core.bigmap.width||13)-1-core.getHeroLoc('x'), toY = (core.bigmap.height||13)-1-core.getHeroLoc('y');\ncore.getBlockId(toX, toY) == null",
|
||||||
"upFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index<core.floorIds.length-1) {\n\tvar toId = core.floorIds[index+1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tif (core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
|
"upFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index<core.floorIds.length-1) {\n\tvar toId = core.floorIds[index+1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tvar mw = core.floors[toId].width||13, mh = core.floors[toId].height||13;\n\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
|
||||||
"downFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index>0) {\n\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tif (core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
|
"downFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index>0) {\n\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tvar mw = core.floors[toId].width||13, mh = core.floors[toId].height||13;\n\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
|
||||||
"snow": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) \n\t\t&& block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
"snow": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||||
"bigKey": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'yellowDoor') {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
"bigKey": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !block.disable && block.event.id == 'yellowDoor') {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
||||||
"poisonWine": "core.hasFlag('poison')",
|
"poisonWine": "core.hasFlag('poison')",
|
||||||
"weakWine": "core.hasFlag('weak')",
|
"weakWine": "core.hasFlag('weak')",
|
||||||
"curseWine": "core.hasFlag('curse')",
|
"curseWine": "core.hasFlag('curse')",
|
||||||
@ -343,6 +343,6 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"shiled5": "true",
|
"shiled5": "true",
|
||||||
"shield5": "true",
|
"shield5": "true",
|
||||||
"lifeWand": "true",
|
"lifeWand": "true",
|
||||||
"jumpShoes": "var nx=core.nextX(2),ny=core.nextY(2);nx>=0&&nx<=12&&ny>=0&&ny<=12&&core.getBlock(nx,ny)==null"
|
"jumpShoes": "var nx=core.nextX(2),ny=core.nextY(2);nx>=0&&nx<core.bigmap.width&&ny>=0&&ny<core.bigmap.height&&core.getBlock(nx,ny)==null"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
15
styles.css
15
styles.css
@ -170,7 +170,7 @@
|
|||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
background: url(project/images/ground.png) repeat;
|
background: url(project/images/ground.png) repeat;
|
||||||
z-index: 150;
|
z-index: 135;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#statusBar .status{
|
#statusBar .status{
|
||||||
@ -222,7 +222,7 @@ p#hard {
|
|||||||
margin: 0 6px 6px 0;
|
margin: 0 6px 6px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
span#poison, span#weak, span#curse {
|
span#poison, span#weak, span#curse, span#pickaxe, span#bomb, span#fly {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
@ -253,6 +253,13 @@ span#poison, span#weak, span#curse {
|
|||||||
background: #000000;
|
background: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#gameDraw {
|
||||||
|
position: absolute;
|
||||||
|
background: #000000;
|
||||||
|
overflow: hidden;
|
||||||
|
z-index: 135;
|
||||||
|
}
|
||||||
|
|
||||||
#bg {
|
#bg {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
@ -281,6 +288,10 @@ span#poison, span#weak, span#curse {
|
|||||||
z-index: 80;
|
z-index: 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#route {
|
||||||
|
z-index: 105;
|
||||||
|
}
|
||||||
|
|
||||||
#ui {
|
#ui {
|
||||||
z-index: 110;
|
z-index: 110;
|
||||||
}
|
}
|
||||||
|
|||||||
14
更新说明.txt
14
更新说明.txt
@ -1,4 +1,16 @@
|
|||||||
HTML5魔塔样板V2.3.3
|
HTML5魔塔样板V2.3.4
|
||||||
|
|
||||||
|
大地图的支持
|
||||||
|
修复超大数值领域导致自动寻路卡死的问题
|
||||||
|
同点多事件的颜色块绘制
|
||||||
|
录像播放时可以按PgUp/PgDn浏览地图
|
||||||
|
可以在读档时E键直接指定编号
|
||||||
|
破炸飞可以在状态栏显示个数
|
||||||
|
部分细节优化
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
HTML5魔塔样板V2.3.3
|
||||||
|
|
||||||
将怪物特殊属性定义和伤害计算函数移动到脚本编辑中
|
将怪物特殊属性定义和伤害计算函数移动到脚本编辑中
|
||||||
地图编辑器可以使用矩形方式绘制地图
|
地图编辑器可以使用矩形方式绘制地图
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user