Merge pull request #310 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2019-01-22 00:11:17 +08:00 committed by GitHub
commit 9185644f3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 687 additions and 369 deletions

View File

@ -257,6 +257,7 @@ action
| changeFloor_s | changeFloor_s
| changePos_0_s | changePos_0_s
| changePos_1_s | changePos_1_s
| useItem_s
| openShop_s | openShop_s
| disableShop_s | disableShop_s
| follow_s | follow_s
@ -951,6 +952,19 @@ var code = '{"type": "changePos", "direction": "'+Direction_List_0+'"},\n';
return code; return code;
*/; */;
useItem_s
: '使用道具' IdString Newline
/* useItem_s
tooltip : useItem: 使用道具
helpUrl : https://h5mota.com/games/template/docs/#/event?id=useItem%ef%bc%9a%e4%bd%bf%e7%94%a8%e9%81%93%e5%85%b7
colour : this.dataColor
default : ["pickaxe"]
var code = '{"type": "useItem", "id": "'+IdString_0+'"},\n';
return code;
*/;
openShop_s openShop_s
: '打开全局商店' IdString Newline : '打开全局商店' IdString Newline
@ -1794,8 +1808,8 @@ Floor_Meta_List
/*Floor_Meta_List ['title','name','canFlyTo', 'canUseQuickShop', 'cannotViewMap', 'cannotMoveDirectly', 'defaultGround', 'images', 'item_ratio', 'upFloor', 'downFloor', 'bgm', 'color', 'weather', 'underGround']*/; /*Floor_Meta_List ['title','name','canFlyTo', 'canUseQuickShop', 'cannotViewMap', 'cannotMoveDirectly', 'defaultGround', 'images', 'item_ratio', 'upFloor', 'downFloor', 'bgm', 'color', 'weather', 'underGround']*/;
Global_Attribute_List Global_Attribute_List
: '全局字体'|'横屏左侧状态栏背景'|'竖屏上方状态栏背景'|'竖屏下方道具栏背景'|'边框颜色'|'状态栏文字色'|'难度显示文字色'|'楼层转换背景'|'楼层转换文字色' : '全局字体'|'横屏左侧状态栏背景'|'竖屏上方状态栏背景'|'竖屏下方道具栏背景'|'边框颜色'|'状态栏文字色'|'难度显示文字色'|'楼层转换背景'|'楼层转换文字色'|'装备列表'
/*Global_Attribute_List ['font','statusLeftBackground','statusTopBackground', 'toolsBackground', 'borderColor', 'statusBarColor', 'hardLabelColor', 'floorChangingBackground', 'floorChangingTextColor']*/; /*Global_Attribute_List ['font','statusLeftBackground','statusTopBackground', 'toolsBackground', 'borderColor', 'statusBarColor', 'hardLabelColor', 'floorChangingBackground', 'floorChangingTextColor', 'equipName']*/;
Global_Value_List Global_Value_List
: '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'行走速度'|'动画时间'|'楼层切换时间' : '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'行走速度'|'动画时间'|'楼层切换时间'
@ -2205,7 +2219,7 @@ ActionParser.prototype.parseAction = function() {
case "showImage": // 显示图片 case "showImage": // 显示图片
data.loc=data.loc||['',''] data.loc=data.loc||['','']
this.next = MotaActionBlocks['showImage_s'].xmlText([ this.next = MotaActionBlocks['showImage_s'].xmlText([
data.code,data.image,data.loc[0],data.loc[1],data.dw,data.dh,data.opacity,data.time||0,data.async||false,this.next]); data.code,data.image||data.name,data.loc[0],data.loc[1],data.dw,data.dh,data.opacity,data.time||0,data.async||false,this.next]);
break; break;
case "hideImage": // 清除图片 case "hideImage": // 清除图片
this.next = MotaActionBlocks['hideImage_s'].xmlText([ this.next = MotaActionBlocks['hideImage_s'].xmlText([
@ -2252,6 +2266,10 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['openDoor_s'].xmlText([ this.next = MotaActionBlocks['openDoor_s'].xmlText([
data.loc[0],data.loc[1],data.floorId||'',this.next]); data.loc[0],data.loc[1],data.floorId||'',this.next]);
break; break;
case "useItem": // 使用道具
this.next = MotaActionBlocks['useItem_s'].xmlText([
data.id,this.next]);
break;
case "openShop": // 打开一个全局商店 case "openShop": // 打开一个全局商店
this.next = MotaActionBlocks['openShop_s'].xmlText([ this.next = MotaActionBlocks['openShop_s'].xmlText([
data.id,this.next]); data.id,this.next]);
@ -2436,6 +2454,8 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['exit_s'].xmlText([ this.next = MotaActionBlocks['exit_s'].xmlText([
this.next]); this.next]);
break; break;
case "animateImage": // 兼容 animateImage
break;
default: default:
throw new Error("[警告]出错啦!\n"+data.type+" 事件不被支持..."); throw new Error("[警告]出错啦!\n"+data.type+" 事件不被支持...");
} }

View File

@ -330,7 +330,7 @@ Blockly.FieldColour.prototype.createWidget_ = function() {
self.setValue(newValue) self.setValue(newValue)
var c=new Colors(); var c=new Colors();
c.setColor(newValue) c.setColor(newValue)
var rgbatext=`${c.colors.webSmart.r},${c.colors.webSmart.g},${c.colors.webSmart.b},${c.colors.alpha}` // 转成r,g,b,a文本 var rgbatext = [c.colors.webSmart.r,c.colors.webSmart.g,c.colors.webSmart.b,c.colors.alpha].join(",");
pb.setFieldValue(rgbatext, targetf) // 放在颜色块左边的域中 pb.setFieldValue(rgbatext, targetf) // 放在颜色块左边的域中
} }

View File

@ -1,14 +1,14 @@
var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
{ {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"items": { "items": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"items": { "items": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"cls": { "cls": {
@ -89,7 +89,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
}, },
"items_template" : {'cls': 'items', 'name': '新物品'}, "items_template" : {'cls': 'items', 'name': '新物品'},
"enemys": { "enemys": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"name": { "name": {
@ -197,7 +197,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
}, },
"enemys_template" : {'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, "enemys_template" : {'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
"maps": { "maps": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"id": { "id": {
@ -271,11 +271,11 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"floors": { "floors": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"floor": { "floor": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"floorId": { "floorId": {
@ -386,7 +386,10 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
}, },
"bgm": { "bgm": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "select",
"_select": {
"values": [null].concat(Object.keys(editor.core.material.bgms))
},
"_data": "到达该层后默认播放的BGM。本项可忽略或者为一个定义过的背景音乐如\"bgm.mp3\"。" "_data": "到达该层后默认播放的BGM。本项可忽略或者为一个定义过的背景音乐如\"bgm.mp3\"。"
}, },
"item_ratio": { "item_ratio": {
@ -404,7 +407,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"loc": { "loc": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"events": { "events": {

View File

@ -254,6 +254,15 @@ body {
overflow: auto; overflow: auto;
} }
#iconImages {
z-index: 0;
overflow: hidden;
}
#iconImages img {
position: absolute;
}
.egameCanvas { .egameCanvas {
position: absolute; position: absolute;
} }

View File

@ -238,6 +238,15 @@ body {
overflow: auto; overflow: auto;
} }
#iconImages {
z-index: 0;
overflow: hidden;
}
#iconImages img {
position: absolute;
}
.egameCanvas { .egameCanvas {
position: absolute; position: absolute;
} }

View File

@ -32,6 +32,7 @@
position: fixed; position: fixed;
top: 15px; top: 15px;
left: 15px; left: 15px;
z-index: 20;
} }
.leftTab .leftTabContent { .leftTab .leftTabContent {

View File

@ -1,10 +1,10 @@
var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
{ {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"main": { "main": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"floorIds": { "floorIds": {
@ -125,7 +125,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"firstData": { "firstData": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"title": { "title": {
@ -154,7 +154,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_data": "初始楼层的ID" "_data": "初始楼层的ID"
}, },
"hero": { "hero": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"name": { "name": {
@ -214,7 +214,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_data": "初始装上的装备,此处建议请直接留空数组" "_data": "初始装上的装备,此处建议请直接留空数组"
}, },
"items": { "items": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"keys": { "keys": {
@ -245,7 +245,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_data": "初始可飞的楼层;一般留空数组即可" "_data": "初始可飞的楼层;一般留空数组即可"
}, },
"loc": { "loc": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"direction": { "direction": {
@ -316,7 +316,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"values": { "values": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"lavaDamage": { "lavaDamage": {
@ -407,7 +407,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"flags": { "flags": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"enableFloor": { "enableFloor": {

View File

@ -62,7 +62,7 @@ editor.prototype.init = function (callback) {
editor.mode.floor(); editor.mode.floor();
editor.mode.tower(); editor.mode.tower();
editor.mode.functions(); editor.mode.functions();
editor.mode.showMode('floor'); editor.mode.showMode('tower');
editor_multi = editor_multi(); editor_multi = editor_multi();
editor_blockly = editor_blockly(); editor_blockly = editor_blockly();
@ -415,9 +415,50 @@ editor.prototype.drawInitData = function (icons) {
var fullWidth = ~~(sumWidth * ratio); var fullWidth = ~~(sumWidth * ratio);
var fullHeight = ~~(maxHeight * ratio); var fullHeight = ~~(maxHeight * ratio);
/*
if (fullWidth > edata.width) edata.style.width = (edata.width = fullWidth) / ratio + 'px'; if (fullWidth > edata.width) edata.style.width = (edata.width = fullWidth) / ratio + 'px';
edata.style.height = (edata.height = fullHeight) / ratio + 'px'; edata.style.height = (edata.height = fullHeight) / ratio + 'px';
var dc = edata.getContext('2d'); */
iconImages.style.width = (iconImages.width = fullWidth) / ratio + 'px';
iconImages.style.height = (iconImages.height = fullHeight) / ratio + 'px';
var dc = {drawImage:function(){
var image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight;
var a=Array.prototype.slice.call(arguments)
if(arguments.length==3){
// [image, dx, dy]=arguments
// [sx, sy, sWidth, sHeight, dWidth, dHeight]=[0,0,image.width,image.height,image.width,image.height]
image=a[0]
a=[a[0],0,0,image.width,image.height,a[1],a[2],image.width,image.height]
}
if(arguments.length==5){
// [image, dx, dy, dWidth, dHeight]=arguments
// [sx, sy, sWidth, sHeight]=[0,0,image.width,image.height]
image=a[0]
a=[a[0],0,0,image.width,image.height,a[1],a[2],a[3],a[4]]
}
if(arguments.length==9){
// [image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight]=arguments
}
image=a[0];
sx=a[1];
sy=a[2];
sWidth=a[3];
sHeight=a[4];
dx=a[5];
dy=a[6];
dWidth=a[7];
dHeight=a[8];
//放弃对 dWidth, dHeight 的支持, 始终画一样大的
var dimg=new Image()
dimg.src = image.src;
dimg.style.clip=['rect(',sy,'px,',sx+sWidth,'px,',sy+sHeight,'px,',sx,'px)'].join('')
dimg.style.top=dy-sy+'px'
dimg.style.left=dx-sx+'px'
dimg.width=image.width/ratio
dimg.height=image.height/ratio
iconImages.appendChild(dimg)
}}
// var dc = edata.getContext('2d');
var nowx = 0; var nowx = 0;
var nowy = 0; var nowy = 0;
for (var ii = 0; ii < imgNames.length; ii++) { for (var ii = 0; ii < imgNames.length; ii++) {
@ -605,6 +646,7 @@ editor.prototype.listen = function () {
var iconLib=document.getElementById('iconLib'); var iconLib=document.getElementById('iconLib');
iconLib.onmousedown = function (e) { iconLib.onmousedown = function (e) {
console.log("iconLib: ("+e.clientX+","+e.clientY+")");
e.stopPropagation(); e.stopPropagation();
} }
@ -661,8 +703,7 @@ editor.prototype.listen = function () {
// 双击地图可以选中素材 // 双击地图可以选中素材
var loc = eToLoc(e); var loc = eToLoc(e);
var pos = locToPos(loc,true); var pos = locToPos(loc,true);
var thisevent = editor.map[pos.y][pos.x]; editor.setSelectBoxFromInfo(editor[editor.layerMod][pos.y][pos.x]);
editor.setSelectBoxFromInfo(thisevent);
return; return;
} }
@ -918,7 +959,7 @@ editor.prototype.listen = function () {
} }
var dataSelection = document.getElementById('dataSelection'); var dataSelection = document.getElementById('dataSelection');
edata.onmousedown = function (e) { iconLib.onmousedown = function (e) {
e.stopPropagation(); e.stopPropagation();
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
@ -1068,7 +1109,7 @@ editor.prototype.listen = function () {
chooseInRight.onmousedown = function(e){ chooseInRight.onmousedown = function(e){
editor.hideMidMenu(); editor.hideMidMenu();
e.stopPropagation(); e.stopPropagation();
var thisevent = editor.map[editor.pos.y][editor.pos.x]; var thisevent = editor[editor.layerMod][editor.pos.y][editor.pos.x];
editor.setSelectBoxFromInfo(thisevent); editor.setSelectBoxFromInfo(thisevent);
} }

View File

@ -100,6 +100,7 @@ editor_blockly = function () {
MotaActionBlocks['changePos_1_s'].xmlText(), MotaActionBlocks['changePos_1_s'].xmlText(),
MotaActionBlocks['battle_s'].xmlText(), MotaActionBlocks['battle_s'].xmlText(),
MotaActionBlocks['openDoor_s'].xmlText(), MotaActionBlocks['openDoor_s'].xmlText(),
MotaActionBlocks['useItem_s'].xmlText(),
MotaActionBlocks['openShop_s'].xmlText(), MotaActionBlocks['openShop_s'].xmlText(),
MotaActionBlocks['setBlock_s'].xmlText(), MotaActionBlocks['setBlock_s'].xmlText(),
MotaActionBlocks['setHeroIcon_s'].xmlText(), MotaActionBlocks['setHeroIcon_s'].xmlText(),
@ -144,7 +145,7 @@ editor_blockly = function () {
MotaActionBlocks['screenFlash_s'].xmlText(), MotaActionBlocks['screenFlash_s'].xmlText(),
MotaActionBlocks['setWeather_s'].xmlText(), MotaActionBlocks['setWeather_s'].xmlText(),
MotaActionBlocks['playBgm_s'].xmlText(), MotaActionBlocks['playBgm_s'].xmlText(),
// MotaActionBlocks['pauseBgm_s'].xmlText(), MotaActionBlocks['pauseBgm_s'].xmlText(),
// MotaActionBlocks['resumeBgm_s'].xmlText(), // MotaActionBlocks['resumeBgm_s'].xmlText(),
MotaActionBlocks['loadBgm_s'].xmlText(), MotaActionBlocks['loadBgm_s'].xmlText(),
MotaActionBlocks['freeBgm_s'].xmlText(), MotaActionBlocks['freeBgm_s'].xmlText(),

View File

@ -82,7 +82,7 @@ editor_file = function (editor, callback) {
callback('未选中文件或无数据'); 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) {
@ -108,14 +108,18 @@ editor_file = function (editor, callback) {
editor.currentFloorData[name]=mapArray; editor.currentFloorData[name]=mapArray;
} }
} }
for (var ii in editor.currentFloorData) // format 更改实现方式以支持undefined删除
if (editor.currentFloorData.hasOwnProperty(ii)) { var tempJsonObj=Object.assign({},editor.currentFloorData);
if (['map','bgmap','fgmap'].indexOf(ii)!==-1) var tempMap=[['map',editor.guid()],['bgmap',editor.guid()],['fgmap',editor.guid()]];
datastr = datastr.concat(['\n"', ii, '": [\n', formatMap(editor.currentFloorData[ii],ii!='map'), '\n],']); tempMap.forEach(function(v){
else v[2]=tempJsonObj[v[0]];
datastr = datastr.concat(['\n"', ii, '": ', JSON.stringify(editor.currentFloorData[ii], null, 4), ',']); tempJsonObj[v[0]]=v[1];
} });
datastr = datastr.concat(['\n}']); var tempJson=JSON.stringify(tempJsonObj, null, 4);
tempMap.forEach(function(v){
tempJson=tempJson.replace('"'+v[1]+'"','[\n'+ formatMap(v[2],v[0]!='map')+ '\n]')
});
datastr = datastr.concat([tempJson]);
datastr = datastr.join(''); datastr = datastr.join('');
alertWhenCompress(); alertWhenCompress();
fs.writeFile(filename, encode(datastr), 'base64', function (err, data) { fs.writeFile(filename, encode(datastr), 'base64', function (err, data) {
@ -626,7 +630,7 @@ editor_file = function (editor, callback) {
actionList.forEach(function (value) { actionList.forEach(function (value) {
value[1] = value[1] + "['" + x + "," + y + "']"; value[1] = value[1] + "['" + x + "," + y + "']";
}); });
saveSetting('floors', actionList, function (err) { saveSetting('floorloc', actionList, function (err) {
callback([ callback([
(function () { (function () {
var locObj = {}; var locObj = {};
@ -745,7 +749,7 @@ editor_file = function (editor, callback) {
if (isset(editor.main[v])) if (isset(editor.main[v]))
locObj.main[v] = data_obj.main[v]; locObj.main[v] = data_obj.main[v];
else else
locObj[v] = null; locObj.main[v] = null;
}); });
return locObj; return locObj;
})(), })(),
@ -761,7 +765,7 @@ editor_file = function (editor, callback) {
if (isset(editor.main[v])) if (isset(editor.main[v]))
locObj.main[v] = data_obj.main[v]; locObj.main[v] = data_obj.main[v];
else else
locObj[v] = null; locObj.main[v] = null;
}); });
return locObj; return locObj;
})(), })(),
@ -976,13 +980,18 @@ editor_file = function (editor, callback) {
}); });
return; return;
} }
if (file == 'floors') { if (file == 'floorloc') {
actionList.forEach(function (value) { actionList.forEach(function (value) {
// 检测null/undefined // 检测null/undefined
if (core.isset(value[2])) if (!core.isset(value[2]))value[2]=undefined;
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
});
editor_file.saveFloorFile(callback);
return;
}
if (file == 'floors') {
actionList.forEach(function (value) {
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2])); eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
else
eval("delete editor.currentFloorData"+value[1]);
}); });
editor_file.saveFloorFile(callback); editor_file.saveFloorFile(callback);
return; return;

View File

@ -18,6 +18,7 @@ editor_mode = function (editor) {
this.mode = ''; this.mode = '';
this.info = {}; this.info = {};
this.appendPic = {}; this.appendPic = {};
this.doubleClickMode='change';
} }
editor_mode.prototype.init = function (callback) { editor_mode.prototype.init = function (callback) {
@ -91,7 +92,25 @@ editor_mode = function (editor) {
* @param {Object} pcobj * @param {Object} pcobj
*/ */
var recursionParse = function (pfield, pcfield, pvobj, pcobj) { var recursionParse = function (pfield, pcfield, pvobj, pcobj) {
for (var ii in pvobj) { var keysForTableOrder={};
var voidMark={};
// 1. 按照pcobj排序生成
if (pcobj && pcobj['_data']){
for (var ii in pcobj['_data']) keysForTableOrder[ii]=voidMark;
}
// 2. 对每个pvobj且不在pcobj的再添加到最后
keysForTableOrder=Object.assign(keysForTableOrder,pvobj)
for (var ii in keysForTableOrder) {
// 3. 对于pcobj有但是pvobj中没有的, 弹出提示, (正常情况下editor_file会补全成null)
// 事实上能执行到这一步工程没崩掉打不开,就继续吧..
if(keysForTableOrder[ii]===voidMark){
if(typeof id_815975ad_ee6f_4684_aac7_397b7e392702==="undefined"){
alert('comment和data不匹配,请在群 HTML5造塔技术交流群 959329661 内反馈')
console.error('comment和data不匹配,请在群 HTML5造塔技术交流群 959329661 内反馈')
id_815975ad_ee6f_4684_aac7_397b7e392702=1;
}
pvobj[ii]=null;
}
var field = pfield + "['" + ii + "']"; var field = pfield + "['" + ii + "']";
var cfield = pcfield + "['_data']['" + ii + "']"; var cfield = pcfield + "['_data']['" + ii + "']";
var vobj = pvobj[ii]; var vobj = pvobj[ii];
@ -126,9 +145,15 @@ editor_mode = function (editor) {
} }
// 开始遍历 // 开始遍历
recursionParse("", "", obj, commentObj); recursionParse("", "", obj, commentObj);
var checkRange = function (evalstr, thiseval) { var checkRange = function (cobj, thiseval) {
if (evalstr) { if (cobj._range) {
return eval(evalstr); return eval(cobj._range);
}
if (cobj._select) {
return cobj._select.values.indexOf(thiseval)!==-1;
}
if (cobj._bool) {
return [true,false].indexOf(thiseval)!==-1;
} }
return true; return true;
} }
@ -142,12 +167,12 @@ editor_mode = function (editor) {
var input = thisTr.children[2].children[0].children[0]; var input = thisTr.children[2].children[0].children[0];
var field = thisTr.children[0].getAttribute('title'); var field = thisTr.children[0].getAttribute('title');
var cobj = JSON.parse(thisTr.children[1].getAttribute('cobj')); var cobj = JSON.parse(thisTr.children[1].getAttribute('cobj'));
input.onchange = function () { var modeNode = thisTr.parentNode;
var node = thisTr.parentNode; while (!editor_mode._ids.hasOwnProperty(modeNode.getAttribute('id'))) {
while (!editor_mode._ids.hasOwnProperty(node.getAttribute('id'))) { modeNode = modeNode.parentNode;
node = node.parentNode;
} }
editor_mode.onmode(editor_mode._ids[node.getAttribute('id')]); input.onchange = function () {
editor_mode.onmode(editor_mode._ids[modeNode.getAttribute('id')]);
var thiseval = null; var thiseval = null;
if (input.checked != null) input.value = input.checked; if (input.checked != null) input.value = input.checked;
try { try {
@ -156,17 +181,32 @@ editor_mode = function (editor) {
printe(field + ' : ' + ee); printe(field + ' : ' + ee);
throw ee; throw ee;
} }
if (checkRange(cobj._range, thiseval)) { if (checkRange(cobj, thiseval)) {
editor_mode.addAction(['change', field, thiseval]); editor_mode.addAction(['change', field, thiseval]);
editor_mode.onmode('save');//自动保存 editor_mode.onmode('save');//自动保存 删掉此行的话点保存按钮才会保存
} else { } else {
printe(field + ' : 输入的值不合要求,请鼠标放置在注释上查看说明'); printe(field + ' : 输入的值不合要求,请鼠标放置在注释上查看说明');
} }
} }
// 双击表格时
// 正常编辑: 尝试用事件编辑器或多行文本编辑器打开
// 添加: 在该项的同一级创建一个内容为null新的项, 刷新后生效并可以继续编辑
// 删除: 删除该项, 刷新后生效
// 在点击按钮 添加/删除 后,下一次双击将被视为 添加/删除
var dblclickfunc=function () { var dblclickfunc=function () {
if(editor_mode.doubleClickMode==='change'){
if (cobj._type === 'event') editor_blockly.import(guid, {type: cobj._event}); if (cobj._type === 'event') editor_blockly.import(guid, {type: cobj._event});
if (cobj._type === 'textarea') editor_multi.import(guid, {lint: cobj._lint, string: cobj._string}); if (cobj._type === 'textarea') editor_multi.import(guid, {lint: cobj._lint, string: cobj._string});
} }
if(editor_mode.doubleClickMode==='add'){
editor_mode.doubleClickMode='change';
addfunc()
}
if(editor_mode.doubleClickMode==='delete'){
editor_mode.doubleClickMode='change';
deletefunc()
}
}
input.ondblclick = dblclickfunc input.ondblclick = dblclickfunc
var doubleClickCheck=[0]; var doubleClickCheck=[0];
thisTr.onclick = function(){ thisTr.onclick = function(){
@ -177,6 +217,49 @@ editor_mode = function (editor) {
dblclickfunc() dblclickfunc()
} }
} }
var deletefunc=function(){
editor_mode.onmode(editor_mode._ids[modeNode.getAttribute('id')]);
if (checkRange(cobj, null)) {
editor_mode.addAction(['delete', field, undefined]);
editor_mode.onmode('save');//自动保存 删掉此行的话点保存按钮才会保存
} else {
printe(field + ' : 该值不允许为null,无法删除');
}
}
var addfunc=function(){
editor_mode.onmode(editor_mode._ids[modeNode.getAttribute('id')]);
// 1.输入id
var newid=prompt('请输入新项的id');
if (newid == null || newid.length==0) {
return;
}
// 2.检查id是否符合规范或与已有id重复
if (!/^[a-zA-Z0-9_]+$/.test(newid)){
printe('id不符合规范, 请使用大小写字母数字下划线来构成');
return;
}
var conflict=true;
var basefield=field.replace(/\[[^\[]*\]$/,'');
if (basefield==="['main']"){
printe("全塔属性 ~ ['main'] 不允许添加新值");
return;
}
try {
var baseobj=eval('obj'+basefield);
conflict=newid in baseobj;
} catch (ee) {
// 理论上这里不会发生错误
printe(ee);
throw ee;
}
if (conflict){
printe('id已存在, 请直接修改该项的值');
return;
}
// 3.添加
editor_mode.addAction(['add',basefield+"['"+newid+"']",null]);
editor_mode.onmode('save');//自动保存 删掉此行的话点保存按钮才会保存
}
}); });
} }
return {"HTML": outstr.join(''), "guids": guids, "listen": listen}; return {"HTML": outstr.join(''), "guids": guids, "listen": listen};
@ -198,7 +281,7 @@ editor_mode = function (editor) {
editor_mode.prototype.objToTr_ = function (obj, commentObj, field, cfield, vobj, cobj) { editor_mode.prototype.objToTr_ = function (obj, commentObj, field, cfield, vobj, cobj) {
var guid = editor.guid(); var guid = editor.guid();
var thiseval = vobj; var thiseval = vobj;
var comment = cobj._data; var comment = String(cobj._data);
var charlength = 10; var charlength = 10;
// "['a']['b']" => "b" // "['a']['b']" => "b"
@ -347,6 +430,7 @@ editor_mode = function (editor) {
editor_mode.dom[name].style = 'z-index:-1;opacity: 0;'; editor_mode.dom[name].style = 'z-index:-1;opacity: 0;';
} }
editor_mode.dom[mode].style = ''; editor_mode.dom[mode].style = '';
editor_mode.doubleClickMode='change';
// clear // clear
editor.drawEventBlock(); editor.drawEventBlock();
if (editor_mode[mode]) editor_mode[mode](); if (editor_mode[mode]) editor_mode[mode]();
@ -1121,6 +1205,19 @@ editor_mode = function (editor) {
return true return true
} }
editor_mode.changeDoubleClickModeByButton=function(mode){
({
delete:function(){
printf('下一次双击表格的项删除, 编辑后刷新浏览器生效 (正常模式下双击是用事件或文本编辑器编辑);切换下拉菜单可取消。');
editor_mode.doubleClickMode=mode;
},
add:function(){
printf('下一次双击表格的项, 在同级添加新项, 编辑后刷新浏览器生效 (正常模式下双击是用事件或文本编辑器编辑);切换下拉菜单可取消。');
editor_mode.doubleClickMode=mode;
}
}[mode])();
}
if (Boolean(callback)) callback(); if (Boolean(callback)) callback();
} }

View File

@ -56,7 +56,7 @@
callback(null, data); callback(null, data);
} }
}, function (e) { }, function (e) {
console.log(e); main.log(e);
callback(e+":请检查启动服务是否处于正常运行状态。"); callback(e+":请检查启动服务是否处于正常运行状态。");
}, "text/plain; charset=x-user-defined"); }, "text/plain; charset=x-user-defined");
} }

View File

@ -1,10 +1,10 @@
var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
{ {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"events": { "events": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"initGame": { "initGame": {
@ -106,7 +106,7 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"enemys": { "enemys": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"getSpecials": { "getSpecials": {
@ -136,7 +136,7 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"actions": { "actions": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"onKeyUp": { "onKeyUp": {
@ -148,7 +148,7 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"control": { "control": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"flyTo": { "flyTo": {
@ -178,7 +178,7 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"ui": { "ui": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"drawStatusBar": { "drawStatusBar": {
@ -202,7 +202,7 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
} }
}, },
"plugins": { "plugins": {
"_leaf": false,
"_type": "object", "_type": "object",
"_data": { "_data": {
"parallelDo": { "parallelDo": {

View File

@ -252,8 +252,9 @@ core.setBlock(number, x, y, floorId)
改变图块。number为要改变到的图块数字x和y为坐标floorId为楼层ID可忽略表示当前楼层。 改变图块。number为要改变到的图块数字x和y为坐标floorId为楼层ID可忽略表示当前楼层。
core.useItem(itemId, callback) core.useItem(itemId, noRoute, callback)
尝试使用某个道具。itemId为道具IDcallback为成功或失败后的回调。 尝试使用某个道具。itemId为道具IDnoRoute如果为真则该道具的使用不计入录像。
callback为成功或失败后的回调。
core.canUseItem(itemId) core.canUseItem(itemId)

View File

@ -85,6 +85,30 @@ percentage为该装备是否按比例增加属性。
更多相关API详见[附录API列表](api)。 更多相关API详见[附录API列表](api)。
### 多重装备
从V2.5.4开始,允许支持多重装备,即有若干的装备可共用若干的格子(例如永不复还那样)。
要实现这一点,上面的写法有所改变。
在全塔属性中的`equipName`项写法不变不过可以写重复的装备孔名称。但仍然最多只能写6个
``` js
"equipName": ["武器", "武器", "武器", "防具", "防具", "首饰"]
```
然后对于某个装备,将其`type`(装备类型)写对应的装备孔名称即可。
``` js
{"type": "武器", "atk": 20, "def": 0, ...}
```
这样写的话,则所有该名称的装备孔均可装上此装备。
当尝试装上此装备时,会取最小的一个空的装备孔进行装备。如果没有空闲的装备孔,则会提示“请先卸下装备”。
装备动画仍然会取第一个装备类型为0的装备的`animate`项,即使装备了多个有动画的武器。
## 门 ## 门
本塔支持6种门黄蓝红绿铁花。前五种门需要有对应的钥匙打开花门只能通过调用`openDoor`事件进行打开。 本塔支持6种门黄蓝红绿铁花。前五种门需要有对应的钥匙打开花门只能通过调用`openDoor`事件进行打开。

View File

@ -882,6 +882,24 @@ time为可选的指定的话将作为楼层切换动画的时间。
] ]
``` ```
### useItem使用道具
调用`{"type": "useItem"}`可以使用一个道具。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "changePos", "id": "pickaxe"}, // 尝试使用破
{"type": "changePos", "id": "bomb"}, // 尝试使用炸
{"type": "changePos", "id": "centerFly"} // 尝试使用飞
]
```
使用道具事件会消耗对应的道具。
如果当前不可使用该道具(如没有,或者达不到使用条件),则会进行提示并跳过本事件。
不可使用“怪物手册”(请使用【呼出怪物手册】事件)或楼层传送器(如果[覆盖楼传事件](personalization#覆盖楼传事件)则可忽视本项)。
### openShop打开一个全局商店 ### openShop打开一个全局商店
使用openShop可以打开一个全局商店。有关全局商店的说明可参见[全局商店](#全局商店)。 使用openShop可以打开一个全局商店。有关全局商店的说明可参见[全局商店](#全局商店)。
@ -1255,15 +1273,13 @@ async可选如果为true则会异步执行即不等待当前事件执行
### pauseBgm暂停背景音乐 ### pauseBgm暂停背景音乐
使用`{"type": "pauseBgm"}`可以暂停背景音乐的播放。 使用`{"type": "pauseBgm"}`可以暂停背景音乐的播放。
<!--
**从V2.5.4开始不再支持此事件,请通过设置音量来达到此效果。**
### resumeBgm恢复背景音乐 ### resumeBgm恢复背景音乐
使用`{"type": "resumeBgm"}`可以恢复背景音乐的播放。 使用`{"type": "resumeBgm"}`可以恢复背景音乐的播放。
**从V2.5.4开始不再支持此事件,请通过设置音量来达到此效果。** **从V2.5.4开始不再支持此事件,请通过设置音量来达到此效果。**
-->
### loadBgm预加载一个背景音乐 ### loadBgm预加载一个背景音乐
使用loadBgm可以预加载一个背景音乐。 使用loadBgm可以预加载一个背景音乐。
@ -1851,7 +1867,7 @@ core.insertAction([
try { try {
eval(core.floors[core.status.floorId].parallelDo); eval(core.floors[core.status.floorId].parallelDo);
} catch (e) { } catch (e) {
console.log(e); main.log(e);
} }
} }

View File

@ -416,14 +416,7 @@ control.prototype.useFly = function (need) {
else core.drawTip("当前无法使用"+core.material.items.fly.name); else core.drawTip("当前无法使用"+core.material.items.fly.name);
} }
``` ```
2. 让录像记下楼传的使用。在items.js的useItem函数中找到记录路线的那几行修改为 2. 修改楼传的使用事件。和其他永久道具一样在地图编辑器的图块属性中修改楼传的useItemEffect和canUseItemEffect两个内容。例如
``` js
// 记录路线
if (itemId!='book') { // 把 `&& itemId!='fly'` 给删除
core.status.route.push("item:"+itemId);
}
```
3. 修改楼传的使用事件。和其他永久道具一样在地图编辑器的图块属性中修改楼传的useItemEffect和canUseItemEffect两个内容。例如
``` js ``` js
"useItemEffect": "core.insertAction([...])" // 执行某段自定义事件,或者其他脚本 "useItemEffect": "core.insertAction([...])" // 执行某段自定义事件,或者其他脚本
"canUseItemEffect": "true" // 任何时候可用 "canUseItemEffect": "true" // 任何时候可用

View File

@ -116,7 +116,7 @@
</div> </div>
</div> </div>
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- enemyitem --> <div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- enemyitem -->
<h3 class="leftTabHeader">图块属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button> <h3 class="leftTabHeader">图块属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button>
</h3> </h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div id='newIdIdnum'><!-- id and idnum --> <div id='newIdIdnum'><!-- id and idnum -->
@ -142,7 +142,7 @@
</div> </div>
</div> </div>
<div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor --> <div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor -->
<h3 class="leftTabHeader">楼层属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button> <h3 class="leftTabHeader">楼层属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button>
</h3> </h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div class='etable'> <div class='etable'>
@ -159,7 +159,7 @@
</div> </div>
</div> </div>
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower --> <div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower -->
<h3 class="leftTabHeader">全塔属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button> <h3 class="leftTabHeader">全塔属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button>
</h3> </h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div class='etable'> <div class='etable'>
@ -257,7 +257,7 @@
</div> </div>
<div id="right" style="z-index:-1;opacity: 0;"> <div id="right" style="z-index:-1;opacity: 0;">
<div id="iconLib"> <div id="iconLib">
<canvas class='egameCanvas' id='edata' width='416' height='416' style='z-index:0'></canvas> <div id="iconImages"></div>
<div id="selectBox"> <div id="selectBox">
<div id='dataSelection' v-show="isSelected" v-cloak></div> <div id='dataSelection' v-show="isSelected" v-cloak></div>
</div> </div>

View File

@ -112,7 +112,7 @@
</div> </div>
</div> </div>
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- enemyitem --> <div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- enemyitem -->
<h3 class="leftTabHeader">图块属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button> <h3 class="leftTabHeader">图块属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button>
</h3> </h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div id='newIdIdnum'><!-- id and idnum --> <div id='newIdIdnum'><!-- id and idnum -->
@ -138,7 +138,7 @@
</div> </div>
</div> </div>
<div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor --> <div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor -->
<h3 class="leftTabHeader">楼层属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button> <h3 class="leftTabHeader">楼层属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button>
</h3> </h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div class='etable'> <div class='etable'>
@ -155,7 +155,7 @@
</div> </div>
</div> </div>
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower --> <div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower -->
<h3 class="leftTabHeader">全塔属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button> <h3 class="leftTabHeader">全塔属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>&nbsp;&nbsp;<button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button>
</h3> </h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div class='etable'> <div class='etable'>
@ -304,7 +304,7 @@
</div> </div>
<div id="right"> <div id="right">
<div id="iconLib"> <div id="iconLib">
<canvas class='egameCanvas' id='edata' width='416' height='416' style='z-index:0'></canvas> <div id="iconImages"></div>
<div id="selectBox"> <div id="selectBox">
<div id='dataSelection' v-show="isSelected" v-cloak></div> <div id='dataSelection' v-show="isSelected" v-cloak></div>
</div> </div>

View File

@ -1539,7 +1539,7 @@ actions.prototype.clickEquipbox = function(x,y) {
////// 选择装备栏界面中某个Index后的操作 ////// ////// 选择装备栏界面中某个Index后的操作 //////
actions.prototype.clickEquipboxIndex = function(index) { actions.prototype.clickEquipboxIndex = function(index) {
if (index<6) { if (index<6) {
if (index>=(main.equipName||[]).length) return; if (index>=core.status.globalAttribute.equipName.length) return;
if (index==core.status.event.selection && core.isset(core.status.hero.equipment[index])) { if (index==core.status.event.selection && core.isset(core.status.hero.equipment[index])) {
core.unloadEquip(index); core.unloadEquip(index);
core.status.route.push("unEquip:"+index); core.status.route.push("unEquip:"+index);
@ -1560,7 +1560,7 @@ actions.prototype.clickEquipboxIndex = function(index) {
actions.prototype.keyDownEquipbox = function (keycode) { actions.prototype.keyDownEquipbox = function (keycode) {
if (!core.isset(core.status.event.data)) return; if (!core.isset(core.status.event.data)) return;
var equipCapacity = (main.equipName||[]).length; var equipCapacity = core.status.globalAttribute.equipName.length;
var ownEquipment = Object.keys(core.status.hero.items.equips).sort(); var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
var index = core.status.event.selection; var index = core.status.event.selection;
var page = core.status.event.data.page; var page = core.status.event.data.page;
@ -1886,6 +1886,7 @@ actions.prototype.clickSwitchs = function (x,y) {
case 8: case 8:
core.platform.extendKeyboard = !core.platform.extendKeyboard; core.platform.extendKeyboard = !core.platform.extendKeyboard;
core.setLocalStorage('extendKeyboard', core.platform.extendKeyboard); core.setLocalStorage('extendKeyboard', core.platform.extendKeyboard);
core.updateStatusBar();
core.ui.drawSwitchs(); core.ui.drawSwitchs();
break; break;
case 9: case 9:

View File

@ -44,19 +44,8 @@ control.prototype.setRequestAnimationFrame = function () {
} }
}()); }());
core.animateFrame.speed = core.values.animateSpeed;
var draw = function(timestamp) { var draw = function(timestamp) {
core.animateFrame.globalTime = core.animateFrame.globalTime||timestamp;
core.animateFrame.boxTime = core.animateFrame.boxTime||timestamp;
core.animateFrame.selectorTime = core.animateFrame.selectorTime||timestamp;
core.animateFrame.animateTime = core.animateFrame.animateTime||timestamp;
core.animateFrame.moveTime = core.animateFrame.moveTime||timestamp;
core.animateFrame.lastLegTime = core.animateFrame.lastLegTime||timestamp;
core.animateFrame.weather.time = core.animateFrame.weather.time||timestamp;
core.saves.autosave.time = core.saves.autosave.time||timestamp;
// move time // move time
if (core.isPlaying() && core.isset(core.status) && core.isset(core.status.hero) if (core.isPlaying() && core.isset(core.status) && core.isset(core.status.hero)
&& core.isset(core.status.hero.statistics)) { && core.isset(core.status.hero.statistics)) {
@ -66,18 +55,17 @@ control.prototype.setRequestAnimationFrame = function () {
} }
// Global Animate // Global Animate
if (core.animateFrame.globalAnimate && core.isPlaying() && core.isset(core.status.floorId)) { if (timestamp - core.animateFrame.globalTime > core.values.animateSpeed && core.isPlaying()) {
if (timestamp-core.animateFrame.globalTime>core.animateFrame.speed && core.isset(core.status.globalAnimateObjs)) { core.status.globalAnimateStatus++;
for (var a = 0; a < core.status.globalAnimateObjs.length; a++) { if (core.animateFrame.globalAnimate && core.isset(core.status.floorId)) {
var obj = core.status.globalAnimateObjs[a]; // Global Animate
obj.status = (obj.status+1)%(obj.event.animate||1); core.status.globalAnimateObjs.forEach(function (block) {
core.drawBlock(obj, obj.status); core.drawBlock(block, core.status.globalAnimateStatus % (block.event.animate||1));
} });
if ((core.status.autotileAnimateObjs.blocks||[]).length>0) { // Global Autotile Animate
core.status.autotileAnimateObjs.status++;
core.status.autotileAnimateObjs.blocks.forEach(function (block) { core.status.autotileAnimateObjs.blocks.forEach(function (block) {
var cv = core.isset(block.name)?core.canvas[block.name]:core.canvas.event; var cv = core.isset(block.name)?core.canvas[block.name]:core.canvas.event;
cv.clearRect(block.x * 32, block.y * 32, 32, 32); cv.clearRect(block.x * 32, block.y * 32, 32, 32);
@ -85,22 +73,17 @@ control.prototype.setRequestAnimationFrame = function () {
if (block.name == 'bg') { if (block.name == 'bg') {
core.drawImage('bg', core.material.groundCanvas.canvas, block.x * 32, block.y * 32); core.drawImage('bg', core.material.groundCanvas.canvas, block.x * 32, block.y * 32);
} }
core.drawAutotile(cv, core.status.autotileAnimateObjs[block.name+"map"], block, 32, 0, 0, core.status.autotileAnimateObjs.status); core.drawAutotile(cv, core.status.autotileAnimateObjs[block.name+"map"], block, 32, 0, 0, core.status.globalAnimateStatus);
} }
else { else {
core.drawAutotile(cv, core.status.autotileAnimateObjs.map, block, 32, 0, 0, core.status.autotileAnimateObjs.status); core.drawAutotile(cv, core.status.autotileAnimateObjs.map, block, 32, 0, 0, core.status.globalAnimateStatus);
} }
}) });
} }
core.animateFrame.globalTime = timestamp; // Box animate
}
}
// Box
if (timestamp-core.animateFrame.boxTime>core.animateFrame.speed && core.isset(core.status.boxAnimateObjs) && core.status.boxAnimateObjs.length>0) {
core.drawBoxAnimate(); core.drawBoxAnimate();
core.animateFrame.boxTime = timestamp; core.animateFrame.globalTime = timestamp;
} }
// AutosaveTime // AutosaveTime
@ -292,7 +275,7 @@ control.prototype.setRequestAnimationFrame = function () {
} }
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
} }
}); });
} }
@ -321,6 +304,8 @@ control.prototype.showStartAnimate = function (noAnimate, callback) {
core.clearMap('all'); core.clearMap('all');
core.deleteAllCanvas(); core.deleteAllCanvas();
core.dom.musicBtn.style.display = 'block';
// 重置音量 // 重置音量
core.events.setVolume(1, 0); core.events.setVolume(1, 0);
@ -453,6 +438,7 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
core.resize(); core.resize();
this.updateGlobalAttribute(Object.keys(core.status.globalAttribute)); this.updateGlobalAttribute(Object.keys(core.status.globalAttribute));
this.triggerStatusBar(core.getFlag('hideStatusBar', false)?'hide':'show', core.getFlag("showToolbox")); this.triggerStatusBar(core.getFlag('hideStatusBar', false)?'hide':'show', core.getFlag("showToolbox"));
core.dom.musicBtn.style.display = 'none';
} }
////// 重新开始游戏;此函数将回到标题页面 ////// ////// 重新开始游戏;此函数将回到标题页面 //////
@ -1439,9 +1425,9 @@ control.prototype.updateDamage = function (floorId, canvas) {
if (!core.hasItem('book')) return; if (!core.hasItem('book')) return;
canvas.font = "bold 11px Arial"; canvas.font = "bold 11px Arial";
var hero_hp = core.status.hero.hp;
if (core.flags.displayEnemyDamage || core.flags.displayCritical) { if (core.flags.displayEnemyDamage || core.flags.displayCritical) {
canvas.textAlign = 'left'; canvas.textAlign = 'left';
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
@ -1454,14 +1440,14 @@ control.prototype.updateDamage = function (floorId, canvas) {
var id = mapBlocks[b].event.id; var id = mapBlocks[b].event.id;
if (core.flags.displayEnemyDamage) { if (core.flags.displayEnemyDamage) {
var damageString = core.enemys.getDamageString(id, x, y); var damageString = core.enemys.getDamageString(id, x, y, floorId);
var damage = damageString.damage, color = damageString.color; var damage = damageString.damage, color = damageString.color;
core.fillBoldText(canvas, damage, 32*x+1, 32*(y+1)-1, color); core.fillBoldText(canvas, damage, 32*x+1, 32*(y+1)-1, color);
} }
// 临界显伤 // 临界显伤
if (core.flags.displayCritical) { if (core.flags.displayCritical) {
var critical = core.enemys.nextCriticals(id); var critical = core.enemys.nextCriticals(id, 1, x, y, floorId);
if (critical.length>0) critical=critical[0]; if (critical.length>0) critical=critical[0];
critical = core.formatBigNumber(critical[0], true); critical = core.formatBigNumber(critical[0], true);
if (critical == '???') critical = '?'; if (critical == '???') critical = '?';
@ -1742,7 +1728,7 @@ control.prototype.bookReplay = function () {
core.lockControl(); core.lockControl();
core.status.event.id='book'; core.status.event.id='book';
core.useItem('book'); core.useItem('book', true);
} }
////// 回放录像时浏览地图 ////// ////// 回放录像时浏览地图 //////
@ -1781,8 +1767,8 @@ control.prototype.replay = function () {
core.status.replay.steps++; core.status.replay.steps++;
if (core.status.replay.steps%50==0) { if (core.status.replay.steps%50==0) {
//if (core.status.replay.save.length == 30) if (core.status.replay.save.length == 30)
// core.status.replay.save.shift(); core.status.replay.save.shift();
core.status.replay.save.push({"data": core.saveData(), "replay": { core.status.replay.save.push({"data": core.saveData(), "replay": {
"totalList": core.clone(core.status.replay.totalList), "totalList": core.clone(core.status.replay.totalList),
"toReplay": core.clone(core.status.replay.toReplay), "toReplay": core.clone(core.status.replay.toReplay),
@ -1806,7 +1792,7 @@ control.prototype.replay = function () {
if (core.canUseItem(itemId)) { if (core.canUseItem(itemId)) {
// 是否绘制道具栏 // 是否绘制道具栏
if (core.material.items[itemId].hideInReplay) { if (core.material.items[itemId].hideInReplay) {
core.useItem(itemId, function () { core.useItem(itemId, false, function () {
core.replay(); core.replay();
}); });
return; return;
@ -1827,7 +1813,7 @@ control.prototype.replay = function () {
core.ui.drawToolbox(index); core.ui.drawToolbox(index);
setTimeout(function () { setTimeout(function () {
core.ui.closePanel(); core.ui.closePanel();
core.useItem(itemId, function () { core.useItem(itemId, false, function () {
core.replay(); core.replay();
}); });
}, 750 / Math.max(1, core.status.replay.speed)); }, 750 / Math.max(1, core.status.replay.speed));
@ -2011,7 +1997,7 @@ control.prototype.openBook = function (need) {
if (!core.checkStatus('book', need, true)) if (!core.checkStatus('book', need, true))
return; return;
core.useItem('book'); core.useItem('book', true);
} }
////// 点击楼层传送器时的打开操作 ////// ////// 点击楼层传送器时的打开操作 //////
@ -2033,7 +2019,7 @@ control.prototype.useFly = function (need) {
core.status.event.id = null; core.status.event.id = null;
return; return;
} }
core.useItem('fly'); core.useItem('fly', true);
return; return;
} }
@ -2067,9 +2053,17 @@ control.prototype.openQuickShop = function (need) {
control.prototype.openKeyBoard = function (need) { control.prototype.openKeyBoard = function (need) {
if (core.isReplaying()) return; if (core.isReplaying()) return;
if (core.platform.extendKeyboard) {
if (!core.checkStatus('keyBoard', need)) if (!core.checkStatus('keyBoard', need))
return; return;
core.ui.drawKeyBoard(); core.ui.drawKeyBoard();
}
else {
if (!core.checkStatus('selectShop', need))
return;
core.ui.drawQuickShop();
}
} }
////// 点击保存按钮时的打开操作 ////// ////// 点击保存按钮时的打开操作 //////
@ -2213,14 +2207,14 @@ control.prototype.doSL = function (id, type) {
}); });
} }
if (id == 'autoSave' && core.saves.autosave.data != null) { if (id == 'autoSave' && core.saves.autosave.data != null) {
afterGet(core.saves.autosave.data); afterGet(core.clone(core.saves.autosave.data));
} }
else { else {
core.getLocalForage(id=='autoSave'?id:"save"+id, null, function(data) { core.getLocalForage(id=='autoSave'?id:"save"+id, null, function(data) {
if (id == 'autoSave') core.saves.autosave.data = core.clone(data); if (id == 'autoSave') core.saves.autosave.data = core.clone(data);
afterGet(data); afterGet(data);
}, function(err) { }, function(err) {
console.log(err); main.log(err);
alert("无效的存档"); alert("无效的存档");
}) })
} }
@ -2255,14 +2249,14 @@ control.prototype.doSL = function (id, type) {
}); });
} }
if (id == 'autoSave' && core.saves.autosave.data != null) { if (id == 'autoSave' && core.saves.autosave.data != null) {
afterGet(core.saves.autosave.data); afterGet(core.clone(core.saves.autosave.data));
} }
else { else {
core.getLocalForage(id=='autoSave'?id:"save"+id, null, function(data) { core.getLocalForage(id=='autoSave'?id:"save"+id, null, function(data) {
if (id == 'autoSave') core.saves.autosave.data = core.clone(data); if (id == 'autoSave') core.saves.autosave.data = core.clone(data);
afterGet(data); afterGet(data);
}, function(err) { }, function(err) {
console.log(err); main.log(err);
alert("无效的存档"); alert("无效的存档");
}) })
} }
@ -2439,7 +2433,7 @@ control.prototype.getSaves = function (index, callback) {
core.getLocalForage("save"+index, null, function(data) { core.getLocalForage("save"+index, null, function(data) {
if (core.isset(callback)) callback(data); if (core.isset(callback)) callback(data);
}, function(err) { }, function(err) {
console.log(err); main.log(err);
if (core.isset(callback)) if (core.isset(callback))
callback(null); callback(null);
}) })
@ -2459,7 +2453,7 @@ control.prototype.getSaves = function (index, callback) {
saves.push(data); saves.push(data);
load(index+1, callback); load(index+1, callback);
}, function(err) { }, function(err) {
console.log(err); main.log(err);
load(index+1, callback); load(index+1, callback);
}) })
} }
@ -2500,6 +2494,7 @@ control.prototype.hasSave = function (index) {
////// 设置勇士属性 ////// ////// 设置勇士属性 //////
control.prototype.setStatus = function (statusName, statusVal) { control.prototype.setStatus = function (statusName, statusVal) {
if (!core.isset(core.status.hero)) return;
if (statusName == 'exp') statusName = 'experience'; if (statusName == 'exp') statusName = 'experience';
if (core.isset(core.status.hero.loc[statusName])) if (core.isset(core.status.hero.loc[statusName]))
core.status.hero.loc[statusName] = statusVal; core.status.hero.loc[statusName] = statusVal;
@ -2509,6 +2504,7 @@ control.prototype.setStatus = function (statusName, statusVal) {
////// 获得勇士属性 ////// ////// 获得勇士属性 //////
control.prototype.getStatus = function (statusName) { control.prototype.getStatus = function (statusName) {
if (!core.isset(core.status.hero)) return null;
// support status:x // support status:x
if (core.isset(core.status.hero.loc[statusName])) if (core.isset(core.status.hero.loc[statusName]))
return core.status.hero.loc[statusName]; return core.status.hero.loc[statusName];
@ -2518,6 +2514,7 @@ control.prototype.getStatus = function (statusName) {
////// 获得某个等级的名称 ////// ////// 获得某个等级的名称 //////
control.prototype.getLvName = function () { control.prototype.getLvName = function () {
if (!core.isset(core.status.hero)) return null;
return ((core.firstData.levelUp||[])[core.status.hero.lv-1]||{}).title || core.status.hero.lv; return ((core.firstData.levelUp||[])[core.status.hero.lv-1]||{}).title || core.status.hero.lv;
} }
@ -2570,7 +2567,7 @@ control.prototype.playBgm = function (bgm) {
core.material.bgms[bgm].pause(); core.material.bgms[bgm].pause();
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
} }
return; return;
} }
@ -2603,7 +2600,7 @@ control.prototype.playBgm = function (bgm) {
} }
catch (e) { catch (e) {
console.log("无法播放BGM "+bgm); console.log("无法播放BGM "+bgm);
console.log(e); main.log(e);
core.musicStatus.playingBgm = null; core.musicStatus.playingBgm = null;
} }
} }
@ -2614,14 +2611,14 @@ control.prototype.pauseBgm = function () {
try { try {
if (core.isset(core.musicStatus.playingBgm)) { if (core.isset(core.musicStatus.playingBgm)) {
core.material.bgms[core.musicStatus.playingBgm].pause(); core.material.bgms[core.musicStatus.playingBgm].pause();
core.musicStatus.playingBgm = null;
} }
} }
catch (e) { catch (e) {
console.log("无法暂停BGM"); console.log("无法暂停BGM");
console.log(e); main.log(e);
} }
this.setMusicBtn(); this.setMusicBtn();
} }
////// 恢复背景音乐的播放 ////// ////// 恢复背景音乐的播放 //////
@ -2634,7 +2631,7 @@ control.prototype.resumeBgm = function () {
} }
catch (e) { catch (e) {
console.log("无法恢复BGM"); console.log("无法恢复BGM");
console.log(e); main.log(e);
} }
this.setMusicBtn(); this.setMusicBtn();
} }
@ -2680,7 +2677,7 @@ control.prototype.playSound = function (sound) {
source.noteOn(0); source.noteOn(0);
} }
catch (ee) { catch (ee) {
console.log(ee); main.log(ee);
} }
} }
} }
@ -2691,7 +2688,7 @@ control.prototype.playSound = function (sound) {
} }
catch (eee) { catch (eee) {
console.log("无法播放SE "+sound); console.log("无法播放SE "+sound);
console.log(eee); main.log(eee);
} }
} }
@ -2714,6 +2711,7 @@ control.prototype.clearStatusBar = function() {
////// 更新状态栏 ////// ////// 更新状态栏 //////
control.prototype.updateStatusBar = function () { control.prototype.updateStatusBar = function () {
if (core.isPlaying())
this.controldata.updateStatusBar(); this.controldata.updateStatusBar();
// 回放 // 回放
@ -2750,7 +2748,8 @@ control.prototype.updateStatusBar = function () {
core.statusBar.image.toolbox.src = core.statusBar.icons.toolbox.src; core.statusBar.image.toolbox.src = core.statusBar.icons.toolbox.src;
core.statusBar.image.keyboard.src = core.statusBar.icons.keyboard.src; core.statusBar.image.keyboard.src =
core.platform.extendKeyboard ? core.statusBar.icons.keyboard.src : core.statusBar.icons.shop.src;
core.statusBar.image.save.src = core.statusBar.icons.save.src; core.statusBar.image.save.src = core.statusBar.icons.save.src;

View File

@ -29,17 +29,15 @@ function core() {
} }
this.animateFrame = { this.animateFrame = {
'globalAnimate': false, 'globalAnimate': false,
'globalTime': null, 'globalTime': 0,
'boxTime': null, 'selectorTime': 0,
'selectorTime': null,
'selectorUp': true, 'selectorUp': true,
'animateTime': null, 'animateTime': 0,
'moveTime': null, 'moveTime': 0,
'lastLegTime': null, 'lastLegTime': 0,
'leftLeg': true, 'leftLeg': true,
'speed': null,
'weather': { 'weather': {
'time': null, 'time': 0,
'type': null, 'type': null,
'level': 0, 'level': 0,
'nodes': [], 'nodes': [],
@ -98,7 +96,7 @@ function core() {
"ids": {}, "ids": {},
"autosave": { "autosave": {
"data": null, "data": null,
"time": null, "time": 0,
"updated": false, "updated": false,
} }
} }
@ -179,6 +177,7 @@ function core() {
"time": 0, "time": 0,
}, },
"globalAttribute": { "globalAttribute": {
'equipName': main.equipName || [],
"statusLeftBackground": main.statusLeftBackground || "url(project/images/ground.png) repeat", "statusLeftBackground": main.statusLeftBackground || "url(project/images/ground.png) repeat",
"statusTopBackground": main.statusTopBackground || "url(project/images/ground.png) repeat", "statusTopBackground": main.statusTopBackground || "url(project/images/ground.png) repeat",
"toolsBackground": main.toolsBackground || "url(project/images/ground.png) repeat", "toolsBackground": main.toolsBackground || "url(project/images/ground.png) repeat",
@ -196,7 +195,8 @@ function core() {
// 动画 // 动画
'globalAnimateObjs': [], 'globalAnimateObjs': [],
'boxAnimateObjs': [], 'boxAnimateObjs': [],
'autotileAnimateObjs': {"status": 0, "blocks": [], "map": null, "bgmap": null, "fgmap": null}, 'autotileAnimateObjs': {"blocks": [], "map": null, "bgmap": null, "fgmap": null},
"globalAnimateStatus": 0,
'animateObjs': [], 'animateObjs': [],
}; };
this.status = {}; this.status = {};
@ -236,11 +236,6 @@ core.prototype.init = function (coreData, callback) {
document.getElementById("startLogo").innerHTML = core.firstData.title; document.getElementById("startLogo").innerHTML = core.firstData.title;
core.material.items = core.clone(core.items.getItems()); core.material.items = core.clone(core.items.getItems());
core.material.enemys = core.clone(core.enemys.getEnemys()); core.material.enemys = core.clone(core.enemys.getEnemys());
if (main.mode == 'play') {
for (var enemyId in core.material.enemys) {
core.material.enemys[enemyId].id = enemyId;
}
}
core.material.icons = core.icons.getIcons(); core.material.icons = core.icons.getIcons();
core.material.events = core.events.getEvents(); core.material.events = core.events.getEvents();
@ -294,13 +289,13 @@ core.prototype.init = function (coreData, callback) {
core.removeLocalForage("__test__"); core.removeLocalForage("__test__");
} }
} }
catch (e) {console.log(e); core.platform.useLocalForage=false;} catch (e) {main.log(e); core.platform.useLocalForage=false;}
}, function(e) {console.log(e); core.platform.useLocalForage=false;}) }, function(e) {main.log(e); core.platform.useLocalForage=false;})
} }
catch (e) {console.log(e); core.platform.useLocalForage=false;} catch (e) {main.log(e); core.platform.useLocalForage=false;}
}, function(e) {console.log(e); core.platform.useLocalForage=false;}) }, function(e) {main.log(e); core.platform.useLocalForage=false;})
} }
catch (e) {console.log(e); core.platform.useLocalForage=false;} catch (e) {main.log(e); core.platform.useLocalForage=false;}
} }
core.platform.extendKeyboard = core.getLocalStorage("extendKeyboard", false); core.platform.extendKeyboard = core.getLocalStorage("extendKeyboard", false);
@ -883,6 +878,10 @@ core.prototype.addGlobalAnimate = function (block) {
core.maps.addGlobalAnimate(block); core.maps.addGlobalAnimate(block);
} }
core.prototype.addAutotileGlobalAnimate = function (block) {
core.maps.addAutotileGlobalAnimate(block);
}
////// 删除一个或所有全局动画 ////// ////// 删除一个或所有全局动画 //////
core.prototype.removeGlobalAnimate = function (x, y, all) { core.prototype.removeGlobalAnimate = function (x, y, all) {
core.maps.removeGlobalAnimate(x, y, all); core.maps.removeGlobalAnimate(x, y, all);
@ -893,11 +892,6 @@ core.prototype.setGlobalAnimate = function (speed) {
core.maps.setGlobalAnimate(speed); core.maps.setGlobalAnimate(speed);
} }
////// 同步所有的全局动画效果 //////
core.prototype.syncGlobalAnimate = function () {
core.maps.syncGlobalAnimate();
}
////// 绘制UI层的box动画 ////// ////// 绘制UI层的box动画 //////
core.prototype.drawBoxAnimate = function () { core.prototype.drawBoxAnimate = function () {
core.maps.drawBoxAnimate(); core.maps.drawBoxAnimate();
@ -994,8 +988,8 @@ core.prototype.removeItem = function (itemId, itemNum) {
} }
////// 使用某个物品 ////// ////// 使用某个物品 //////
core.prototype.useItem = function (itemId, callback) { core.prototype.useItem = function (itemId, noRoute, callback) {
core.items.useItem(itemId, callback); core.items.useItem(itemId, noRoute, callback);
} }
////// 能否使用某个物品 ////// ////// 能否使用某个物品 //////

View File

@ -8,7 +8,12 @@ function enemys() {
enemys.prototype.init = function () { enemys.prototype.init = function () {
this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80; this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
this.enemydata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys; this.enemydata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys;
if (main.mode=='play') this.enemydata.hasSpecial = function (a, b) {return core.enemys.hasSpecial(a, b)}; if (main.mode=='play') {
this.enemydata.hasSpecial = function (a, b) {return core.enemys.hasSpecial(a, b)};
for (var enemyId in this.enemys) {
this.enemys[enemyId].id = enemyId;
}
}
} }
////// 获得一个或所有怪物数据 ////// ////// 获得一个或所有怪物数据 //////
@ -127,9 +132,9 @@ enemys.prototype.getExtraDamage = function (enemy) {
return extra_damage; return extra_damage;
} }
enemys.prototype.getDamageString = function (enemy, x, y) { enemys.prototype.getDamageString = function (enemy, x, y, floorId) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
var damage = core.enemys.getDamage(enemy, x, y); var damage = core.enemys.getDamage(enemy, x, y, floorId);
var color = '#000000'; var color = '#000000';
@ -185,6 +190,11 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
return []; return [];
} }
// getDamageInfo直接返回数字
if (typeof info == 'number') {
return [[0,0]];
}
if (info.damage<=0 && !core.flags.enableNegativeDamage) { if (info.damage<=0 && !core.flags.enableNegativeDamage) {
return [[0,0]]; return [[0,0]];
} }
@ -200,7 +210,7 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
if (nextAtk<=hero_atk) break; if (nextAtk<=hero_atk) break;
if (nextAtk!=pre) { if (nextAtk!=pre) {
var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, nextAtk, core.status.hero.def, core.status.hero.mdef, x, y, floorId); var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, nextAtk, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
if (nextInfo==null) break; if (nextInfo==null || (typeof nextInfo == 'number')) break;
list.push([nextAtk-hero_atk,Math.floor(info.damage-nextInfo.damage)]); list.push([nextAtk-hero_atk,Math.floor(info.damage-nextInfo.damage)]);
if (nextInfo.damage<=0 && !core.flags.enableNegativeDamage) break; if (nextInfo.damage<=0 && !core.flags.enableNegativeDamage) break;
pre = nextAtk; pre = nextAtk;
@ -217,7 +227,7 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
if (hero_atk <= LOOP_MAX_VALUE) { // 循环法 if (hero_atk <= LOOP_MAX_VALUE) { // 循环法
for (var atk=hero_atk+1;atk<=mon_hp+mon_def;atk++) { for (var atk=hero_atk+1;atk<=mon_hp+mon_def;atk++) {
var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, atk, core.status.hero.def, core.status.hero.mdef, x, y, floorId); var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, atk, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
if (nextInfo==null) break; if (nextInfo==null || (typeof nextInfo == 'number')) break;
if (pre>nextInfo.damage) { if (pre>nextInfo.damage) {
pre = nextInfo.damage; pre = nextInfo.damage;
list.push([atk-hero_atk, info.damage-nextInfo.damage]); list.push([atk-hero_atk, info.damage-nextInfo.damage]);
@ -234,12 +244,12 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
while (start<end) { while (start<end) {
var mid = Math.floor((start+end)/2); var mid = Math.floor((start+end)/2);
var nextInfo = core.enemys.getDamageInfo(enemy, core.status.hero.hp, mid, core.status.hero.def, core.status.hero.mdef, x, y, floorId); var nextInfo = core.enemys.getDamageInfo(enemy, core.status.hero.hp, mid, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
if (nextInfo == null) return null; if (nextInfo == null || (typeof nextInfo == 'number')) return null;
if (pre>nextInfo.damage) end = mid; if (pre>nextInfo.damage) end = mid;
else start = mid+1; else start = mid+1;
} }
var nextInfo = core.enemys.getDamageInfo(enemy, core.status.hero.hp, start, core.status.hero.def, core.status.hero.mdef, x, y, floorId); var nextInfo = core.enemys.getDamageInfo(enemy, core.status.hero.hp, start, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
return nextInfo==null||nextInfo.damage>=pre?null:[start,nextInfo.damage]; return nextInfo==null||(typeof nextInfo == 'number')||nextInfo.damage>=pre?null:[start,nextInfo.damage];
} }
var currAtk = hero_atk; var currAtk = hero_atk;
while (true) { while (true) {
@ -285,6 +295,7 @@ enemys.prototype.calDamage = function (enemy, hero_hp, hero_atk, hero_def, hero_
var info = this.getDamageInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId); var info = this.getDamageInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId);
if (info == null) return null; if (info == null) return null;
if (typeof info == 'number') return info;
return info.damage; return info.damage;
} }
@ -328,7 +339,7 @@ enemys.prototype.getCurrentEnemys = function (floorId) {
if (specialText.length>=3) specialText = "多属性..."; if (specialText.length>=3) specialText = "多属性...";
else specialText = specialText.join(" "); else specialText = specialText.join(" ");
var critical = this.nextCriticals(enemyId); var critical = this.nextCriticals(enemyId, 1, null, null, floorId);
if (critical.length>0) critical=critical[0]; if (critical.length>0) critical=critical[0];
var e = core.clone(enemy); var e = core.clone(enemy);

View File

@ -127,6 +127,7 @@ events.prototype.startGame = function (hard, seed, route, callback) {
var post_start = function () { var post_start = function () {
core.control.triggerStatusBar('show'); core.control.triggerStatusBar('show');
core.dom.musicBtn.style.display = 'none';
core.changeFloor(core.firstData.floorId, null, nowLoc, null, function() { core.changeFloor(core.firstData.floorId, null, nowLoc, null, function() {
if (core.isset(callback)) callback(); if (core.isset(callback)) callback();
@ -169,6 +170,8 @@ events.prototype.startGame = function (hard, seed, route, callback) {
if (core.flags.startUsingCanvas) { if (core.flags.startUsingCanvas) {
core.control.triggerStatusBar('hide'); core.control.triggerStatusBar('hide');
core.dom.musicBtn.style.display = 'block';
core.insertAction(core.clone(core.firstData.startCanvas), null, null, function() { core.insertAction(core.clone(core.firstData.startCanvas), null, null, function() {
real_start(); real_start();
}); });
@ -301,7 +304,7 @@ events.prototype.gameOver = function (ending, fromReplay, norank) {
doUpload(""); doUpload("");
} }
else { else {
doUpload(prompt("请输入你的ID", core.getCookie('id'))); doUpload(prompt("请输入你的ID", core.getCookie('id')||""));
} }
}, function () { }, function () {
if (main.isCompetition) if (main.isCompetition)
@ -859,6 +862,18 @@ events.prototype.doAction = function() {
} }
break; break;
} }
case "useItem": // 使用道具
// 考虑到可能覆盖楼传事件的问题这里不对fly进行检查。
if (data.id!='book' && core.canUseItem(data.id)) {
core.useItem(data.id, true, function() {
core.events.doAction();
});
}
else {
core.drawTip("当前无法使用"+((core.material.items[data.id]||{}).name||"未知道具"));
this.doAction();
}
break;
case "openShop": // 打开一个全局商店 case "openShop": // 打开一个全局商店
if (core.isReplaying()) { // 正在播放录像简单将visited置为true if (core.isReplaying()) { // 正在播放录像简单将visited置为true
core.status.shops[data.id].visited=true; core.status.shops[data.id].visited=true;
@ -913,11 +928,11 @@ events.prototype.doAction = function() {
core.playBgm(data.name); core.playBgm(data.name);
this.doAction(); this.doAction();
break; break;
/*
case "pauseBgm": case "pauseBgm":
core.pauseBgm(); core.pauseBgm();
this.doAction(); this.doAction();
break break
/*
case "resumeBgm": case "resumeBgm":
core.resumeBgm(); core.resumeBgm();
this.doAction(); this.doAction();
@ -975,7 +990,7 @@ events.prototype.doAction = function() {
core.setFlag((prefix||"global")+"@"+data.name.substring(7), value); core.setFlag((prefix||"global")+"@"+data.name.substring(7), value);
} }
} }
catch (e) {console.log(e)} catch (e) {main.log(e)}
core.updateStatusBar(); core.updateStatusBar();
this.doAction(); this.doAction();
break; break;
@ -989,6 +1004,9 @@ events.prototype.doAction = function() {
if ((data.value.charAt(0)=='"' && data.value.charAt(data.value.length-1)=='"') if ((data.value.charAt(0)=='"' && data.value.charAt(data.value.length-1)=='"')
|| (data.value.charAt(0)=="'" && data.value.charAt(data.value.length-1)=="'")) || (data.value.charAt(0)=="'" && data.value.charAt(data.value.length-1)=="'"))
data.value = data.value.substring(1, data.value.length-1); data.value = data.value.substring(1, data.value.length-1);
// --- 检查 []
if (data.value.charAt(0) == '[' && data.value.charAt(data.value.length-1)==']')
data.value = eval(data.value);
} }
core.status.globalAttribute[data.name] = data.value; core.status.globalAttribute[data.name] = data.value;
core.control.updateGlobalAttribute(data.name); core.control.updateGlobalAttribute(data.name);
@ -1049,7 +1067,7 @@ events.prototype.doAction = function() {
value = core.decodeBase64(action.substring(7)); value = core.decodeBase64(action.substring(7));
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
core.stopReplay(); core.stopReplay();
core.drawTip("录像文件出错"); core.drawTip("录像文件出错");
return; return;
@ -1144,7 +1162,7 @@ events.prototype.doAction = function() {
} }
} }
} catch (e) { } catch (e) {
console.log(e); main.log(e);
} }
if (!data.async) if (!data.async)
this.doAction(); this.doAction();

View File

@ -35,7 +35,7 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
eval(this.itemEffect[itemId]); eval(this.itemEffect[itemId]);
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
} }
} }
core.status.hero.statistics.hp += core.status.hero.hp - curr_hp; core.status.hero.statistics.hp += core.status.hero.hp - curr_hp;
@ -55,7 +55,7 @@ items.prototype.getItemEffectTip = function(itemId) {
try { try {
return eval(this.itemEffectTip[itemId])||""; return eval(this.itemEffectTip[itemId])||"";
} catch (e) { } catch (e) {
console.log(e); main.log(e);
return ""; return "";
} }
} }
@ -64,7 +64,7 @@ items.prototype.getItemEffectTip = function(itemId) {
} }
////// 使用道具 ////// ////// 使用道具 //////
items.prototype.useItem = function (itemId, callback) { items.prototype.useItem = function (itemId, noRoute, callback) {
if (!this.canUseItem(itemId)) { if (!this.canUseItem(itemId)) {
if (core.isset(callback)) callback(); if (core.isset(callback)) callback();
return; return;
@ -76,11 +76,11 @@ items.prototype.useItem = function (itemId, callback) {
eval(this.useItemEffect[itemId]); eval(this.useItemEffect[itemId]);
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
} }
} }
// 记录路线 // 记录路线
if (itemId!='book' && itemId!='fly') { if (!noRoute) {
core.status.route.push("item:"+itemId); core.status.route.push("item:"+itemId);
} }
@ -91,7 +91,10 @@ items.prototype.useItem = function (itemId, callback) {
delete core.status.hero.items[itemCls][itemId]; delete core.status.hero.items[itemCls][itemId];
core.updateStatusBar(); core.updateStatusBar();
if (!core.isset(core.status.event.id)) core.status.event.data = null; if (!core.isset(core.status.event.id)) {
core.status.event.data = null;
core.status.event.ui = null;
}
if (core.isset(callback)) callback(); if (core.isset(callback)) callback();
} }
@ -107,7 +110,7 @@ items.prototype.canUseItem = function (itemId) {
able = eval(this.canUseItemEffect[itemId]); able = eval(this.canUseItemEffect[itemId]);
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
} }
} }
if (!able) core.status.event.data = null; if (!able) core.status.event.data = null;
@ -117,6 +120,7 @@ items.prototype.canUseItem = function (itemId) {
////// 获得某个物品的个数 ////// ////// 获得某个物品的个数 //////
items.prototype.itemCount = function (itemId) { items.prototype.itemCount = function (itemId) {
if (!core.isset(core.status.hero)) return 0;
if (!core.isset(itemId) || !core.isset(core.material.items[itemId])) return 0; if (!core.isset(itemId) || !core.isset(core.material.items[itemId])) return 0;
var itemCls = core.material.items[itemId].cls; var itemCls = core.material.items[itemId].cls;
if (itemCls=="items") return 0; if (itemCls=="items") return 0;
@ -125,25 +129,31 @@ items.prototype.itemCount = function (itemId) {
////// 是否存在某个物品 ////// ////// 是否存在某个物品 //////
items.prototype.hasItem = function (itemId) { items.prototype.hasItem = function (itemId) {
return core.itemCount(itemId) > 0; return this.itemCount(itemId) > 0;
} }
////// 是否装备某件装备 ////// ////// 是否装备某件装备 //////
items.prototype.hasEquip = function (itemId) { items.prototype.hasEquip = function (itemId) {
if (!core.isset(core.status.hero)) return null;
if (!core.isset(itemId)) return null; if (!core.isset(itemId)) return null;
if (!core.isset((core.material.items[itemId]||{}).equip)) return null; if (!core.isset((core.material.items[itemId]||{}).equip)) return null;
return this.getEquip(core.material.items[itemId].equip.type) == itemId; for (var i in core.status.hero.equipment||[])
if (core.status.hero.equipment[i] == itemId)
return true;
return false
} }
////// 获得某个装备类型的当前装备 ////// ////// 获得某个装备类型的当前装备 //////
items.prototype.getEquip = function (equipType) { items.prototype.getEquip = function (equipType) {
if (!core.isset(core.status.hero)) return null;
return (core.status.hero.equipment||[])[equipType]||null; return (core.status.hero.equipment||[])[equipType]||null;
} }
////// 设置某个物品的个数 ////// ////// 设置某个物品的个数 //////
items.prototype.setItem = function (itemId, itemNum) { items.prototype.setItem = function (itemId, itemNum) {
if (!core.isset(core.status.hero)) return null;
itemNum = itemNum || 0; itemNum = itemNum || 0;
var itemCls = core.material.items[itemId].cls; var itemCls = core.material.items[itemId].cls;
if (itemCls == 'items') return; if (itemCls == 'items') return;
@ -160,6 +170,7 @@ items.prototype.setItem = function (itemId, itemNum) {
////// 删除某个物品 ////// ////// 删除某个物品 //////
items.prototype.removeItem = function (itemId, itemNum) { items.prototype.removeItem = function (itemId, itemNum) {
if (!core.isset(core.status.hero)) return null;
itemNum = itemNum || 1; itemNum = itemNum || 1;
if (!core.hasItem(itemId)) return false; if (!core.hasItem(itemId)) return false;
var itemCls = core.material.items[itemId].cls; var itemCls = core.material.items[itemId].cls;
@ -174,6 +185,7 @@ items.prototype.removeItem = function (itemId, itemNum) {
////// 增加某个物品的个数 ////// ////// 增加某个物品的个数 //////
items.prototype.addItem = function (itemId, itemNum) { items.prototype.addItem = function (itemId, itemNum) {
if (!core.isset(core.status.hero)) return null;
itemNum = itemNum || 1; itemNum = itemNum || 1;
var itemData = core.material.items[itemId]; var itemData = core.material.items[itemId];
var itemCls = itemData.cls; var itemCls = itemData.cls;
@ -196,9 +208,19 @@ items.prototype.addItem = function (itemId, itemNum) {
core.updateStatusBar(); core.updateStatusBar();
} }
items.prototype.getEquipTypeByName = function (name) {
var names = core.status.globalAttribute.equipName;
for (var i = 0; i < names.length; ++i) {
if (names[i] === name && !core.isset((core.status.hero.equipment||[])[i])) {
return i;
}
}
return -1;
}
////// 换上 ////// ////// 换上 //////
items.prototype.loadEquip = function (equipId, callback) { items.prototype.loadEquip = function (equipId, callback) {
if (!core.isset(core.status.hero)) return null;
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = []; if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
@ -218,13 +240,23 @@ items.prototype.loadEquip = function (equipId, callback) {
} }
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
} }
} }
core.playSound('equip.mp3'); core.playSound('equip.mp3');
var loadEquipType = loadEquip.equip.type; var loadEquipType = loadEquip.equip.type;
// ------ 判定多重装备 ------
if (typeof loadEquipType === 'string') {
loadEquipType = this.getEquipTypeByName(loadEquipType);
if (loadEquipType < 0) {
core.drawTip("当前没有"+loadEquip.equip.type+"的空位!");
return;
}
}
var unloadEquipId = core.status.hero.equipment[loadEquipType]; var unloadEquipId = core.status.hero.equipment[loadEquipType];
var unloadEquip = core.material.items[unloadEquipId] || {}; var unloadEquip = core.material.items[unloadEquipId] || {};
@ -269,6 +301,7 @@ items.prototype.loadEquip = function (equipId, callback) {
////// 卸下 ////// ////// 卸下 //////
items.prototype.unloadEquip = function (equipType, callback) { items.prototype.unloadEquip = function (equipType, callback) {
if (!core.isset(core.status.hero)) return null;
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = []; if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
@ -340,7 +373,7 @@ items.prototype.quickLoadEquip = function (index) {
return; return;
} }
// 检查所有的装备 // 检查所有的装备
var equipSize = (main.equipName||[]).length; var equipSize = core.status.globalAttribute.equipName.length;
for (var i=0;i<equipSize;i++) { for (var i=0;i<equipSize;i++) {
var v = current[i]; var v = current[i];
if (core.isset(v) && !core.hasItem(v) && !core.hasEquip(v)) { if (core.isset(v) && !core.hasItem(v) && !core.hasEquip(v)) {
@ -361,14 +394,15 @@ items.prototype.quickLoadEquip = function (index) {
// 快速换装 // 快速换装
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = []; if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
for (var i=0;i<equipSize;i++) { for (var i=0;i<equipSize;i++) {
var now = core.status.hero.equipment[i]||null; var now = core.status.hero.equipment[i] || null;
var to = current[i]||null; if (now != null) {
if (now==to) continue;
if (to==null) {
this.unloadEquip(i); this.unloadEquip(i);
core.status.route.push("unEquip:"+i); core.status.route.push("unEquip:" + i);
} }
else { }
for (var i=0;i<equipSize;i++) {
var to = current[i]||null;
if (to!=null) {
this.loadEquip(to); this.loadEquip(to);
core.status.route.push("equip:"+to); core.status.route.push("equip:"+to);
} }

View File

@ -88,6 +88,8 @@ loader.prototype.loadIcons = function () {
core.statusBar.image[key].src = core.statusBar.icons[key].src; core.statusBar.image[key].src = core.statusBar.icons[key].src;
} }
} }
core.statusBar.image.keyboard.src =
core.platform.extendKeyboard ? core.statusBar.icons.keyboard.src : core.statusBar.icons.shop.src;
}); });
} }
@ -122,7 +124,7 @@ loader.prototype.loadImage = function (imgName, callback) {
image.src = 'project/images/' + name + "?v=" + main.version; image.src = 'project/images/' + name + "?v=" + main.version;
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
} }
} }
@ -146,7 +148,7 @@ loader.prototype.loadAnimates = function () {
image.src = t2; image.src = t2;
data.images.push(image); data.images.push(image);
} catch (e) { } catch (e) {
console.log(e); main.log(e);
data.images.push(null); data.images.push(null);
} }
} }
@ -171,11 +173,11 @@ loader.prototype.loadAnimates = function () {
core.material.animates[t] = data; core.material.animates[t] = data;
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
core.material.animates[t] = null; core.material.animates[t] = null;
} }
}, function (e) { }, function (e) {
console.log(e); main.log(e);
core.material.animates[t] = null; core.material.animates[t] = null;
}, "text/plain; charset=x-user-defined") }, "text/plain; charset=x-user-defined")
}) })
@ -206,11 +208,11 @@ loader.prototype.loadMusic = function () {
core.playBgm(t); core.playBgm(t);
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
core.material.bgms[t] = null; core.material.bgms[t] = null;
} }
}, function (e) { }, function (e) {
console.log(e); main.log(e);
core.material.bgms[t] = null; core.material.bgms[t] = null;
}, "text/plain; charset=x-user-defined") }, "text/plain; charset=x-user-defined")
@ -234,16 +236,16 @@ loader.prototype.loadMusic = function () {
core.musicStatus.audioContext.decodeAudioData(data, function (buffer) { core.musicStatus.audioContext.decodeAudioData(data, function (buffer) {
core.material.sounds[t] = buffer; core.material.sounds[t] = buffer;
}, function (e) { }, function (e) {
console.log(e); main.log(e);
core.material.sounds[t] = null; core.material.sounds[t] = null;
}) })
} }
catch (ee) { catch (ee) {
console.log(ee); main.log(ee);
core.material.sounds[t] = null; core.material.sounds[t] = null;
} }
}, function (e) { }, function (e) {
console.log(e); main.log(e);
core.material.sounds[t] = null; core.material.sounds[t] = null;
}, null, 'arraybuffer'); }, null, 'arraybuffer');
} }

View File

@ -436,7 +436,7 @@ maps.prototype.drawBgFgMap = function (floorId, canvas, name, animate) {
if (cls == 'autotile') { if (cls == 'autotile') {
core.drawAutotile(canvas, arr, block, 32, 0, 0); core.drawAutotile(canvas, arr, block, 32, 0, 0);
if (animate) if (animate)
core.status.autotileAnimateObjs.blocks.push(core.clone(block)); core.addAutotileGlobalAnimate(block);
} }
else if (cls == 'tileset') { else if (cls == 'tileset') {
var offset = core.icons.getTilesetOffset(id); var offset = core.icons.getTilesetOffset(id);
@ -571,7 +571,7 @@ maps.prototype.drawMap = function (floorId, callback) {
if (core.isset(block.event) && !block.disable) { 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);
core.status.autotileAnimateObjs.blocks.push(core.clone(block)); core.addAutotileGlobalAnimate(block);
} }
else { else {
core.drawBlock(block); core.drawBlock(block);
@ -1182,7 +1182,6 @@ maps.prototype.showBlock = function(x, y, floorId) {
if (floorId == core.status.floorId && core.isset(block.event)) { if (floorId == core.status.floorId && core.isset(block.event)) {
core.drawBlock(block); core.drawBlock(block);
core.addGlobalAnimate(block); core.addGlobalAnimate(block);
core.syncGlobalAnimate();
} }
core.updateStatusBar(); core.updateStatusBar();
} }
@ -1304,7 +1303,6 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
if (floorId==core.status.floorId && !block.disable) { if (floorId==core.status.floorId && !block.disable) {
core.drawBlock(block); core.drawBlock(block);
core.addGlobalAnimate(block); core.addGlobalAnimate(block);
core.syncGlobalAnimate();
core.updateStatusBar(); core.updateStatusBar();
} }
} }
@ -1329,11 +1327,16 @@ maps.prototype.setBgFgBlock = function (name, number, x, y, floorId) {
maps.prototype.addGlobalAnimate = function (b) { maps.prototype.addGlobalAnimate = function (b) {
if (main.mode=='editor' && main.editor.disableGlobalAnimate) return; if (main.mode=='editor' && main.editor.disableGlobalAnimate) return;
if (!core.isset(b.event) || !core.isset(b.event.animate) || b.event.animate==1) return; if (!core.isset(b.event) || !core.isset(b.event.animate) || b.event.animate==1) return;
core.status.globalAnimateObjs.push(b);
}
var block = core.clone(b); ////// 添加一个Autotile全局动画 //////
block.status = 0; maps.prototype.addAutotileGlobalAnimate = function (b) {
if (main.mode=='editor' && main.editor.disableGlobalAnimate) return;
core.status.globalAnimateObjs.push(block); if (!core.isset(b.event) || b.event.cls!='autotile') return;
var id = b.event.id, img = core.material.images.autotile[id];
if (!core.isset(img) || img.width==96) return;
core.status.autotileAnimateObjs.blocks.push(b);
} }
////// 删除一个或所有全局动画 ////// ////// 删除一个或所有全局动画 //////
@ -1341,8 +1344,9 @@ maps.prototype.removeGlobalAnimate = function (x, y, all, name) {
if (main.mode=='editor' && main.editor.disableGlobalAnimate) return; if (main.mode=='editor' && main.editor.disableGlobalAnimate) return;
if (all) { if (all) {
core.status.globalAnimateStatus = 0;
core.status.globalAnimateObjs = []; core.status.globalAnimateObjs = [];
core.status.autotileAnimateObjs = {"status": 0, "blocks": [], "map": null, "bgmap": null, "fgmap": null}; core.status.autotileAnimateObjs = {"blocks": [], "map": null, "bgmap": null, "fgmap": null};
return; return;
} }
@ -1359,31 +1363,18 @@ maps.prototype.removeGlobalAnimate = function (x, y, all, name) {
////// 设置全局动画的显示效果 ////// ////// 设置全局动画的显示效果 //////
maps.prototype.setGlobalAnimate = function (speed) { maps.prototype.setGlobalAnimate = function (speed) {
if (main.mode=='editor' && main.editor.disableGlobalAnimate) return; if (main.mode=='editor' && main.editor.disableGlobalAnimate) return;
core.syncGlobalAnimate(); core.status.globalAnimateStatus = 0;
core.animateFrame.speed = speed;
core.animateFrame.globalAnimate = true; core.animateFrame.globalAnimate = true;
} }
////// 同步所有的全局动画效果 //////
maps.prototype.syncGlobalAnimate = function () {
core.status.globalAnimateObjs.forEach(function (t) {
t.status=0;
})
if (core.isset(core.status.autotileAnimateObjs.status)) {
core.status.autotileAnimateObjs.status = 0;
}
}
////// 绘制UI层的box动画 ////// ////// 绘制UI层的box动画 //////
maps.prototype.drawBoxAnimate = function () { maps.prototype.drawBoxAnimate = function () {
for (var a = 0; a < core.status.boxAnimateObjs.length; a++) { core.status.boxAnimateObjs.forEach(function (obj) {
var obj = core.status.boxAnimateObjs[a];
obj.status = ((obj.status||0)+1)%obj.animate;
core.clearMap('ui', obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight); core.clearMap('ui', obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight);
core.fillRect('ui', obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight, core.material.groundPattern); core.fillRect('ui', obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight, core.material.groundPattern);
core.drawImage('ui', obj.image, obj.status * 32, obj.pos, core.drawImage('ui', obj.image, core.status.globalAnimateStatus % obj.animate * 32, obj.pos,
32, obj.height, obj.x, obj.y, 32, obj.height); 32, obj.height, obj.x, obj.y, 32, obj.height);
} });
} }
////// 绘制动画的某一帧 ////// ////// 绘制动画的某一帧 //////

View File

@ -228,6 +228,7 @@ ui.prototype.closePanel = function () {
clearInterval(core.status.event.interval); clearInterval(core.status.event.interval);
core.clearLastEvent(); core.clearLastEvent();
core.maps.generateGroundPattern(); core.maps.generateGroundPattern();
core.updateStatusBar();
core.unLockControl(); core.unLockControl();
core.status.event.data = null; core.status.event.data = null;
core.status.event.id = null; core.status.event.id = null;
@ -1543,6 +1544,7 @@ ui.prototype.drawBook = function (index) {
var enemys = core.enemys.getCurrentEnemys(floorId); var enemys = core.enemys.getCurrentEnemys(floorId);
core.clearLastEvent(); core.clearLastEvent();
core.clearMap('data');
// 生成groundPattern // 生成groundPattern
core.maps.generateGroundPattern(floorId); core.maps.generateGroundPattern(floorId);
@ -1768,7 +1770,7 @@ ui.prototype.drawBookDetail = function (index) {
} }
hints.push(""); hints.push("");
var criticals = core.enemys.nextCriticals(enemyId, 10).map(function (v) { var criticals = core.enemys.nextCriticals(enemyId, 10, null, null, floorId).map(function (v) {
return core.formatBigNumber(v[0])+":"+core.formatBigNumber(v[1]); return core.formatBigNumber(v[0])+":"+core.formatBigNumber(v[1]);
}); });
while (criticals[0]=='0:0') criticals.shift(); while (criticals[0]=='0:0') criticals.shift();
@ -1929,6 +1931,7 @@ ui.prototype.drawMaps = function (index, x, y) {
clearTimeout(core.interval.tipAnimate); clearTimeout(core.interval.tipAnimate);
core.clearLastEvent(); core.clearLastEvent();
core.status.checkBlock.buff = {};
this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 0, 0, 416, x, y); this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 0, 0, 416, x, y);
// 绘图 // 绘图
@ -2104,7 +2107,7 @@ ui.prototype.drawEquipbox = function(index) {
if (!core.isset(core.status.event.data) || !core.isset(core.status.event.data.page)) if (!core.isset(core.status.event.data) || !core.isset(core.status.event.data.page))
core.status.event.data = {"page":1, "selectId":null}; core.status.event.data = {"page":1, "selectId":null};
var allEquips = main.equipName||[]; var allEquips = core.status.globalAttribute.equipName;
var equipLength = allEquips.length; var equipLength = allEquips.length;
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = []; if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
@ -2182,7 +2185,14 @@ ui.prototype.drawEquipbox = function(index) {
var equip=core.material.items[selectId]; var equip=core.material.items[selectId];
if (!core.isset(equip.equip)) equip.equip = {"type": 0}; if (!core.isset(equip.equip)) equip.equip = {"type": 0};
var equipType = equip.equip.type; var equipType = equip.equip.type;
core.fillText('ui', equip.name + "" + (allEquips[equipType]||"未知部位") + "", 10, 32, '#FFD700', "bold 20px "+globalFont) var equipString;
if (typeof equipType === 'string') {
equipString = equipType||"未知部位";
equipType = core.items.getEquipTypeByName(equipType);
}
else equipString = allEquips[equipType]||"未知部位";
core.fillText('ui', equip.name + "" + equipString + "", 10, 32, '#FFD700', "bold 20px "+globalFont)
var text = equip.text||"该装备暂无描述。"; var text = equip.text||"该装备暂无描述。";
var lines = core.splitLines('ui', text, 406, '17px '+globalFont); var lines = core.splitLines('ui', text, 406, '17px '+globalFont);
@ -2191,20 +2201,25 @@ ui.prototype.drawEquipbox = function(index) {
// 比较属性 // 比较属性
if (lines.length==1) { if (lines.length==1) {
var compare, differentMode = false; var compare, differentMode = null;
if (index<12) compare = core.compareEquipment(null, selectId); if (index<12) compare = core.compareEquipment(null, selectId);
else {
if (equipType<0) {
differentMode = '<当前没有该装备的空位,请先卸下装备>';
}
else { else {
var last = core.material.items[equipEquipment[equipType]]||{}; var last = core.material.items[equipEquipment[equipType]]||{};
// 检查是不是数值模式和比例模式之间的切换 // 检查是不是数值模式和比例模式之间的切换
if (core.isset(last.equip) && (last.equip.percentage||false) != (equip.equip.percentage||false)) { if (core.isset(last.equip) && (last.equip.percentage||false) != (equip.equip.percentage||false)) {
differentMode = true; differentMode = '<数值和比例模式之间的切换不显示属性变化>';
} }
else { else {
compare = core.compareEquipment(selectId, equipEquipment[equipType]); compare = core.compareEquipment(selectId, equipEquipment[equipType]);
} }
} }
if (differentMode) { }
core.fillText('ui', '<数值和比例模式之间的切换不显示属性变化>', 10, 89, '#CCCCCC', '14px '+globalFont); if (differentMode != null) {
core.fillText('ui', differentMode, 10, 89, '#CCCCCC', '14px '+globalFont);
} }
else { else {
var drawOffset = 10; var drawOffset = 10;
@ -2367,14 +2382,14 @@ ui.prototype.drawSLPanel = function(index, refresh) {
core.saves.autosave.data = data; core.saves.autosave.data = data;
core.status.event.ui[i]=data; core.status.event.ui[i]=data;
loadSave(i+1, callback); loadSave(i+1, callback);
}, function(err) {console.log(err);}); }, function(err) {main.log(err);});
} }
} }
else { else {
core.getLocalForage("save"+(5*page+i), null, function(data) { core.getLocalForage("save"+(5*page+i), null, function(data) {
core.status.event.ui[i]=data; core.status.event.ui[i]=data;
loadSave(i+1, callback); loadSave(i+1, callback);
}, function(err) {console.log(err);}); }, function(err) {main.log(err);});
} }
} }

View File

@ -40,6 +40,14 @@ utils.prototype.init = function () {
return to; return to;
}; };
} }
if (typeof String.prototype.endsWith != "function") {
String.prototype.endsWith = function(search, this_len) {
if (this_len === undefined || this_len > this.length) {
this_len = this.length;
}
return this.substring(this_len - search.length, this_len) === search;
};
}
} }
@ -136,7 +144,7 @@ utils.prototype.setLocalStorage = function(key, value) {
return true; return true;
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
return false; return false;
} }
} }
@ -160,7 +168,7 @@ utils.prototype.getLocalStorage = function(key, defaultValue) {
return defaultValue; return defaultValue;
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
return defaultValue; return defaultValue;
} }
} }
@ -226,7 +234,7 @@ utils.prototype.getLocalForage = function (key, defaultValue, successCallback, e
successCallback(JSON.parse(output)); successCallback(JSON.parse(output));
return; return;
} }
catch (ee) {console.log(ee);} catch (ee) {main.log(ee);}
} }
if (core.isset(successCallback)) if (core.isset(successCallback))
successCallback(JSON.parse(value)); successCallback(JSON.parse(value));
@ -669,7 +677,7 @@ utils.prototype.readFileContent = function (content) {
} }
} }
catch (e) { catch (e) {
console.log(e); main.log(e);
alert(e); alert(e);
} }
alert("不是有效的JSON文件"); alert("不是有效的JSON文件");

36
main.js
View File

@ -149,7 +149,8 @@ function main() {
'btn4': 33, 'btn4': 33,
'btn5': 34, 'btn5': 34,
'btn6': 35, 'btn6': 35,
'btn7': 36 'btn7': 36,
'shop': 37
}, },
'floor': document.getElementById('floor'), 'floor': document.getElementById('floor'),
'name': document.getElementById('name'), 'name': document.getElementById('name'),
@ -309,6 +310,17 @@ main.prototype.setMainTipsText = function (text) {
main.dom.mainTips.innerHTML = text; main.dom.mainTips.innerHTML = text;
} }
main.prototype.log = function (e) {
if (e) {
if (main.core && main.core.platform && !main.core.platform.isPC) {
console.log((e.stack || e.toString()).replace("\n", " --- "));
}
else {
console.log(e);
}
}
}
main.prototype.listen = function () { main.prototype.listen = function () {
@ -316,7 +328,7 @@ main.prototype.listen = function () {
window.onresize = function () { window.onresize = function () {
try { try {
main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight); main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
}catch (e) { console.log(e); } }catch (e) { main.log(e); }
} }
////// 在界面上按下某按键时 ////// ////// 在界面上按下某按键时 //////
@ -324,7 +336,7 @@ main.dom.body.onkeydown = function(e) {
try { try {
if (main.core && (main.core.isPlaying() || main.core.status.lockControl)) if (main.core && (main.core.isPlaying() || main.core.status.lockControl))
main.core.onkeyDown(e); main.core.onkeyDown(e);
} catch (ee) { console.log(ee); } } catch (ee) { main.log(ee); }
} }
////// 在界面上放开某按键时 ////// ////// 在界面上放开某按键时 //////
@ -332,7 +344,7 @@ main.dom.body.onkeyup = function(e) {
try { try {
if (main.core && (main.core.isPlaying() || main.core.status.lockControl)) if (main.core && (main.core.isPlaying() || main.core.status.lockControl))
main.core.onkeyUp(e); main.core.onkeyUp(e);
} catch (ee) { console.log(ee); } } catch (ee) { main.log(ee); }
} }
////// 开始选择时 ////// ////// 开始选择时 //////
@ -347,7 +359,7 @@ main.dom.data.onmousedown = function (e) {
var loc = main.core.getClickLoc(e.clientX, e.clientY); var loc = main.core.getClickLoc(e.clientX, e.clientY);
if (loc == null) return; if (loc == null) return;
main.core.ondown(loc); main.core.ondown(loc);
} catch (ee) { console.log(ee); } } catch (ee) { main.log(ee); }
} }
////// 鼠标移动时 ////// ////// 鼠标移动时 //////
@ -357,14 +369,14 @@ main.dom.data.onmousemove = function (e) {
var loc = main.core.getClickLoc(e.clientX, e.clientY); var loc = main.core.getClickLoc(e.clientX, e.clientY);
if (loc == null) return; if (loc == null) return;
main.core.onmove(loc); main.core.onmove(loc);
}catch (ee) { console.log(ee); } }catch (ee) { main.log(ee); }
} }
////// 鼠标放开时 ////// ////// 鼠标放开时 //////
main.dom.data.onmouseup = function () { main.dom.data.onmouseup = function () {
try { try {
main.core.onup(); main.core.onup();
}catch (e) { console.log(e); } }catch (e) { main.log(e); }
} }
////// 鼠标滑轮滚动时 ////// ////// 鼠标滑轮滚动时 //////
@ -374,7 +386,7 @@ main.dom.data.onmousewheel = function(e) {
main.core.onmousewheel(Math.sign(e.wheelDelta)) main.core.onmousewheel(Math.sign(e.wheelDelta))
else if (e.detail) else if (e.detail)
main.core.onmousewheel(Math.sign(e.detail)); main.core.onmousewheel(Math.sign(e.detail));
} catch (ee) { console.log(ee); } } catch (ee) { main.log(ee); }
} }
////// 手指在触摸屏开始触摸时 ////// ////// 手指在触摸屏开始触摸时 //////
@ -384,7 +396,7 @@ main.dom.data.ontouchstart = function (e) {
var loc = main.core.getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY); var loc = main.core.getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY);
if (loc == null) return; if (loc == null) return;
main.core.ondown(loc); main.core.ondown(loc);
}catch (ee) { console.log(ee); } }catch (ee) { main.log(ee); }
} }
////// 手指在触摸屏上移动时 ////// ////// 手指在触摸屏上移动时 //////
@ -394,7 +406,7 @@ main.dom.data.ontouchmove = function (e) {
var loc = main.core.getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY); var loc = main.core.getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY);
if (loc == null) return; if (loc == null) return;
main.core.onmove(loc); main.core.onmove(loc);
}catch (ee) { console.log(ee); } }catch (ee) { main.log(ee); }
} }
////// 手指离开触摸屏时 ////// ////// 手指离开触摸屏时 //////
@ -403,7 +415,7 @@ main.dom.data.ontouchend = function (e) {
e.preventDefault(); e.preventDefault();
main.core.onup(); main.core.onup();
} catch (e) { } catch (e) {
console.log(e); main.log(e);
} }
} }
@ -623,7 +635,7 @@ main.dom.musicBtn.onclick = function () {
try { try {
if (main.core) if (main.core)
main.core.triggerBgm(); main.core.triggerBgm();
} catch (e) {console.log(e);} } catch (e) {main.log(e);}
} }
window.onblur = function () { window.onblur = function () {

View File

@ -293,8 +293,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 事件的处理 // 事件的处理
var todo = []; var todo = [];
// 如果不为阻击,且该点存在,且有事件 // 如果该点存在,且有事件 -- V2.5.4 以后阻击怪也可以有战后事件了
if (!core.enemys.hasSpecial(special, 18) && core.isset(x) && core.isset(y)) { if (core.isset(x) && core.isset(y)) {
var event = core.floors[core.status.floorId].afterBattle[x+","+y]; var event = core.floors[core.status.floorId].afterBattle[x+","+y];
if (core.isset(event)) { if (core.isset(event)) {
// 插入事件 // 插入事件
@ -493,14 +493,16 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
mon_def = hero_atk - 1; mon_def = hero_atk - 1;
} }
// V2.5.3备注: // 光环检查
// 这一部分是检查光环代码的,需要对整个地图上的图块进行遍历,可能会造成不必要的性能的损耗,尤其是循环计算临界会变得非常慢。 // 从V2.5.4开始,对光环效果增加缓存,以解决多次重复计算的问题,从而大幅提升运行效率。
// 因此默认注释掉此段代码以加快游戏运行速度。
// 如果游戏中有光环怪物存在取消注释或按需根据floorId加判定即可。
/*
// 检查当前楼层所有光环怪物数字25 // 检查当前楼层所有光环怪物数字25
var hp_delta = 0, atk_delta = 0, def_delta = 0, cnt = 0; var hp_buff = 0, atk_buff = 0, def_buff = 0, cnt = 0;
// 遍历每个图块 // 检查光环缓存
if (!core.isset(core.status.checkBlock.buff)) core.status.checkBlock.buff = {};
var index = core.isset(x) && core.isset(y) ? (x+","+y) : "floor";
var cache = core.status.checkBlock.buff[index];
if (!core.isset(cache)) {
// 没有该点的缓存,则遍历每个图块
core.status.maps[floorId].blocks.forEach(function (block) { core.status.maps[floorId].blocks.forEach(function (block) {
if (core.isset(block.event) && !block.disable) { if (core.isset(block.event) && !block.disable) {
// 获得该图块的ID // 获得该图块的ID
@ -509,19 +511,32 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (core.isset(enemy) && core.hasSpecial(enemy.special, 25)) { if (core.isset(enemy) && core.hasSpecial(enemy.special, 25)) {
// 检查是否可叠加 // 检查是否可叠加
if (enemy.add || cnt == 0) { if (enemy.add || cnt == 0) {
hp_delta += enemy.value || 0; hp_buff += enemy.value || 0;
atk_delta += enemy.atkValue || 0; atk_buff += enemy.atkValue || 0;
def_delta += enemy.defValue || 0; def_buff += enemy.defValue || 0;
cnt++; cnt++;
} }
} }
} }
}); });
// TODO如果有其他类型光环怪物在这里仿照添加检查hp_buff, atk_buff和def_buff即可。
// 放入缓存中
core.status.checkBlock.buff[index] = {"hp_buff": hp_buff, "atk_buff": atk_buff, "def_buff": def_buff};
}
else {
// 直接使用缓存数据
hp_buff = cache.hp_buff;
atk_buff = cache.atk_buff;
def_buff = cache.def_buff;
}
// 增加比例;如果要增加数值可以直接在这里修改 // 增加比例;如果要增加数值可以直接在这里修改
mon_hp *= (1+hp_delta/100); mon_hp *= (1+hp_buff/100);
mon_atk *= (1+atk_delta/100); mon_atk *= (1+atk_buff/100);
mon_def *= (1+def_delta/100); mon_def *= (1+def_buff/100);
*/
// TODO可以在这里新增其他的怪物数据变化 // TODO可以在这里新增其他的怪物数据变化
// 比如仿攻(怪物攻击不低于勇士攻击): // 比如仿攻(怪物攻击不低于勇士攻击):
@ -1211,7 +1226,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
try { try {
eval(core.floors[core.status.floorId].parallelDo); eval(core.floors[core.status.floorId].parallelDo);
} catch (e) { } catch (e) {
console.log(e); main.log(e);
} }
} }
@ -1248,63 +1263,57 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...) // 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...)
// 【参数说明】 // 【参数说明】
// color可选灯光以外部分的颜色可以是一个四元数组或者简单的一个0到1之间的数。忽略则默认为0.9。 // name必填要绘制到的画布名可以是一个系统画布或者是个自定义画布如果不存在则创建
// 如果是四元数组则代表RGBA值如 [255,255,0,0.2] 就代表 #FFFF00 且不透明度0.2 // color可选只能是一个0~1之间的数为不透明度的值。不填则默认为0.9。
// 如果是一个数则只是不透明度的值RGB均为0如 0.9 就代表 [0,0,0,0.9]
// lights可选一个数组定义了每个独立的灯光。 // lights可选一个数组定义了每个独立的灯光。
// 其中每一项是三元组 [x,y,r] 或者四元组 [x,y,r,o] // 其中每一项是三元组 [x,y,r] x和y分别为该灯光的横纵坐标r为该灯光的半径。
// x和y分别为该灯光的横纵坐标r为该灯光的半径o为该灯光中心的不透明度可忽略默认为0。
// lightDec可选0到1之间光从多少百分比才开始衰减在此范围内保持全亮不设置默认为0。 // lightDec可选0到1之间光从多少百分比才开始衰减在此范围内保持全亮不设置默认为0。
// 比如lightDec为0.5代表每个灯光部分内圈50%的范围全亮50%以后才开始快速衰减。 // 比如lightDec为0.5代表每个灯光部分内圈50%的范围全亮50%以后才开始快速衰减。
// 【调用样例】 // 【调用样例】
// core.plugin.drawLight(); // 绘制一个0.9的全图不透明度,等价于更改画面色调为[0,0,0,0.9]。 // core.plugin.drawLight('curtain'); // 在curtain层绘制全图不透明度0.9,等价于更改画面色调为[0,0,0,0.9]。
// core.plugin.drawLight(0.95, [[25,11,46]]); // 全图不透明度0.95,其中在(25,11)点存在一个半径为46的灯光效果。 // core.plugin.drawLight('ui', 0.95, [[25,11,46]]); // 在ui层绘制全图不透明度0.95,其中在(25,11)点存在一个半径为46的灯光效果。
// core.plugin.drawLight([255,255,0,0.2], [[25,11,46,0.1]]); // 全图为不透明度0.2的黄色,其中在(25,11)点存在一个半径为46的灯光效果灯光中心不透明度0.1。 // core.plugin.drawLight('test', 0.2, [[25,11,46,0.1]]); // 创建一个test图层不透明度0.2,其中在(25,11)点存在一个半径为46的灯光效果灯光中心不透明度0.1。
// core.plugin.drawLight(0.9, [[25,11,46],[105,121,88],[301,221,106]]); // 存在三个灯光效果,分别是中心(25,11)半径46中心(105,121)半径88中心(301,221)半径106。 // core.plugin.drawLight('test2', 0.9, [[25,11,46],[105,121,88],[301,221,106]]); // 创建test2图层存在三个灯光效果,分别是中心(25,11)半径46中心(105,121)半径88中心(301,221)半径106。
// core.plugin.drawLight([0,0,255,0.3], [[25,11,46],[105,121,88,0.2]], 0.4); // 存在两个灯光效果它们在内圈40%范围内保持全亮且40%后才开始衰减。 // core.plugin.drawLight('xxx', 0.3, [[25,11,46],[105,121,88,0.2]], 0.4); // 存在两个灯光效果它们在内圈40%范围内保持全亮且40%后才开始衰减。
this.drawLight = function (color, lights, lightDec) { this.drawLight = function (name, color, lights, lightDec) {
// 清空色调层也可以修改成其它层比如animate/weather层或者用自己创建的canvas // 清空色调层也可以修改成其它层比如animate/weather层或者用自己创建的canvas
var canvasName = 'curtain'; var ctx = core.getContextByName(name);
var ctx = core.getContextByName(canvasName); if (ctx == null) {
if (ctx == null) return; if (typeof name == 'string')
ctx = core.createCanvas(name, 0, 0, 416, 416, 98);
else return;
}
ctx.mozImageSmoothingEnabled = false; ctx.mozImageSmoothingEnabled = false;
ctx.webkitImageSmoothingEnabled = false; ctx.webkitImageSmoothingEnabled = false;
ctx.msImageSmoothingEnabled = false; ctx.msImageSmoothingEnabled = false;
ctx.imageSmoothingEnabled = false; ctx.imageSmoothingEnabled = false;
ctx.clearRect(0, 0, 416, 416);
core.clearMap(name);
// 绘制色调层,默认不透明度 // 绘制色调层,默认不透明度
if (!core.isset(color)) color = 0.9; if (!core.isset(color)) color = 0.9;
if (typeof color == "number") color = [0,0,0,color]; ctx.fillStyle = "rgba(0,0,0,"+color+")";
ctx.fillStyle = core.arrayToRGBA(color); ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
ctx.fillRect(0, 0, 416, 416);
lightDec = core.clamp(lightDec, 0, 1);
// 绘制每个灯光效果 // 绘制每个灯光效果
if (!core.isset(lights) || lights.length==0) return; ctx.globalCompositeOperation = 'destination-out';
lightDec = core.clamp(lightDec, 0, 1);
lights.forEach(function (light) { lights.forEach(function (light) {
// 坐标,半径,中心不透明度 // 坐标,半径,中心不透明度
var x = light[0], y = light[1], r = light[2], o = 255 * (1 - core.clamp(light[3], 0, 1)); var x = light[0], y = light[1], r = light[2];
// 计算衰减距离 // 计算衰减距离
var decDistance = parseInt(r * lightDec), leftDistance = r - decDistance; var decDistance = parseInt(r * lightDec);
// 正方形区域的直径和左上角坐标 // 正方形区域的直径和左上角坐标
var d = r * 2, sx = x - r, sy = y - r; var grd=ctx.createRadialGradient(x,y,decDistance,x,y,r);
// 获得正方形区域的颜色信息 grd.addColorStop(0, "rgba(0,0,0,1)");
var imageData = ctx.getImageData(sx, sy, d, d); grd.addColorStop(1, "rgba(0,0,0,0)");
// 对每个像素点进行遍历 ctx.beginPath();
for (var i = 0; i < imageData.data.length; i+=4) { ctx.fillStyle=grd;
// 当前点的坐标 ctx.arc(x,y,r,0,2*Math.PI);
var index = i / 4, cx = parseInt(index/d), cy = index%d; ctx.fill();
// 当前点距离中心点的距离
var dx = r - cx, dy = r - cy, distance = Math.sqrt(dx*dx+dy*dy);
if (distance >= r) continue;
// 计算当前点的alpha值
var alpha = imageData.data[i+3] - (distance<decDistance?1:(r-distance)/leftDistance)*o;
imageData.data[i+3] = core.clamp(alpha, 0, 255);
}
ctx.putImageData(imageData, sx, sy);
}); });
ctx.globalCompositeOperation = 'source-over';
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -361,16 +361,16 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"useItemEffect": { "useItemEffect": {
"book": "core.ui.drawBook(0);", "book": "core.ui.drawBook(0);",
"fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));", "fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));",
"earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});", "earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"pickaxe": "core.playSound('pickaxe.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});", "pickaxe": "core.playSound('pickaxe.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});", "icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"snow": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});", "snow": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});", "bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"bomb": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});", "bomb": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"hammer": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});", "hammer": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"centerFly": "core.playSound('centerFly.mp3');\ncore.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 + '使用成功');", "centerFly": "core.playSound('centerFly.mp3');\ncore.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\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.replay();\n});", "upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.ui.x, 'y': core.status.event.ui.y};\nif (core.status.event.id == 'action') {\n\tcore.insertAction([\n\t\t{\"type\": \"changeFloor\", \"loc\": [loc.x, loc.y], \"direction\": loc.direction, \"floorId\": core.status.event.ui.id},\n\t\t{\"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功'}\n\t]);\n}\nelse {\n\tcore.changeFloor(core.status.event.ui.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\tcore.replay();\n\t});\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\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.replay();\n});", "downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.ui.x, 'y': core.status.event.ui.y};\nif (core.status.event.id == 'action') {\n\tcore.insertAction([\n\t\t{\"type\": \"changeFloor\", \"loc\": [loc.x, loc.y], \"direction\": loc.direction, \"floorId\": core.status.event.ui.id},\n\t\t{\"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功'}\n\t]);\n}\nelse {\n\tcore.changeFloor(core.status.event.ui.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\tcore.replay();\n\t});\n}\n",
"poisonWine": "core.removeFlag('poison');", "poisonWine": "core.removeFlag('poison');",
"weakWine": "core.removeFlag('weak');\nif (core.values.weakValue>=1) { // >=1直接扣数值\n\tcore.status.hero.atk += core.values.weakValue;\n\tcore.status.hero.def += core.values.weakValue;\n}\nelse { // <1扣比例\n\tcore.setFlag(\"equip_atk_buff\", core.getFlag(\"equip_atk_buff\", 1) + core.values.weakValue);\n\tcore.setFlag(\"equip_def_buff\", core.getFlag(\"equip_def_buff\", 1) + core.values.weakValue);\n}", "weakWine": "core.removeFlag('weak');\nif (core.values.weakValue>=1) { // >=1直接扣数值\n\tcore.status.hero.atk += core.values.weakValue;\n\tcore.status.hero.def += core.values.weakValue;\n}\nelse { // <1扣比例\n\tcore.setFlag(\"equip_atk_buff\", core.getFlag(\"equip_atk_buff\", 1) + core.values.weakValue);\n\tcore.setFlag(\"equip_def_buff\", core.getFlag(\"equip_def_buff\", 1) + core.values.weakValue);\n}",
"curseWine": "core.removeFlag('curse');", "curseWine": "core.removeFlag('curse');",
@ -390,16 +390,16 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"canUseItemEffect": { "canUseItemEffect": {
"book": "true", "book": "true",
"fly": "(function () {\n\treturn core.status.hero.flyRange.indexOf(core.status.floorId)>=0;\n})();", "fly": "(function () {\n\treturn core.status.hero.flyRange.indexOf(core.status.floorId)>=0;\n})();",
"pickaxe": "(function() {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && core.nearHero(block.x, block.y) && \n\t\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) { // 能破哪些墙\n\t\t\t// 四个方向\n\t\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse id2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.data = ids;\n\t\treturn true;\n\t}\n\telse if (id2s.length==1) {\n\t\tcore.status.event.data = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();", "pickaxe": "(function() {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && core.nearHero(block.x, block.y) && \n\t\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) { // 能破哪些墙\n\t\t\t// 四个方向\n\t\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse id2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\telse if (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"icePickaxe": "(function() {\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\t\tcore.status.event.data = [i];\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();", "icePickaxe": "(function() {\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\t\tcore.status.event.ui = [i];\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"bomb": "(function () {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && core.nearHero(block.x, block.y)) {\n\t\t\tvar enemy = core.material.enemys[block.event.id];\n\t\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse\n\t\t\t\tid2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.data = ids;\n\t\treturn true;\n\t}\n\tif (id2s.length==1) {\n\t\tcore.status.event.data = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();", "bomb": "(function () {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && core.nearHero(block.x, block.y)) {\n\t\t\tvar enemy = core.material.enemys[block.event.id];\n\t\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse\n\t\t\t\tid2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\tif (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"hammer": "(function() {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && core.nearHero(block.x, block.y)) {\n\t\t\tvar enemy = core.material.enemys[block.event.id];\n\t\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\t\tids.push(i);\n\t\t\telse\n\t\t\t\tid2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.data = ids;\n\t\treturn true;\n\t}\n\telse if (id2s.length==1) {\n\t\tcore.status.event.data = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();", "hammer": "(function() {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && core.nearHero(block.x, block.y)) {\n\t\t\tvar enemy = core.material.enemys[block.event.id];\n\t\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\t\tids.push(i);\n\t\t\telse\n\t\t\t\tid2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\telse if (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"earthquake": "(function () {\n\tvar able=false;\n\tvar ids = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable &&\n\t\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) { // 能炸的墙壁\n\t\t\tids.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.data = ids;\n\t\table=true;\n\t}\n\treturn able;\n})();", "earthquake": "(function () {\n\tvar able=false;\n\tvar ids = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable &&\n\t\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) { // 能炸的墙壁\n\t\t\tids.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\table=true;\n\t}\n\treturn able;\n})();",
"centerFly": "(function () {\n\tvar toX = (core.bigmap.width||13)-1-core.getHeroLoc('x'), toY = (core.bigmap.height||13)-1-core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();", "centerFly": "(function () {\n\tvar toX = (core.bigmap.width||13)-1-core.getHeroLoc('x'), toY = (core.bigmap.height||13)-1-core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();",
"upFly": "(function() {\n\tvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\n\tif (index<core.floorIds.length-1) {\n\t\tvar toId = core.floorIds[index+1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width||13, mh = core.floors[toId].height||13;\n\t\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();", "upFly": "(function() {\n\tvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\n\tif (index<core.floorIds.length-1) {\n\t\tvar toId = core.floorIds[index+1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width||13, mh = core.floors[toId].height||13;\n\t\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\t\tcore.status.event.ui = {'id': toId, 'x': toX, 'y': toY};\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"downFly": "(function() {\n\tvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\n\tif (index>0) {\n\t\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width||13, mh = core.floors[toId].height||13;\n\t\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();", "downFly": "(function() {\n\tvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\n\tif (index>0) {\n\t\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width||13, mh = core.floors[toId].height||13;\n\t\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\t\tcore.status.event.ui = {'id': toId, 'x': toX, 'y': toY};\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"snow": "(function () {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.event.id == 'lava' && core.nearHero(block.x, block.y)) {\n\t\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse id2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.data = ids;\n\t\treturn true;\n\t}\n\tif (id2s.length==1) {\n\t\tcore.status.event.data = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();", "snow": "(function () {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.event.id == 'lava' && core.nearHero(block.x, block.y)) {\n\t\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse id2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\tif (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"bigKey": "(function() {\n\tvar able=false, ids = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.event.id == 'yellowDoor') {\n\t\t\tids.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.data = ids;\n\t\table=true;\n\t}\n\treturn able;\n})();", "bigKey": "(function() {\n\tvar able=false, ids = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (core.isset(block.event) && !block.disable && block.event.id == 'yellowDoor') {\n\t\t\tids.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\table=true;\n\t}\n\treturn able;\n})();",
"poisonWine": "core.hasFlag('poison');", "poisonWine": "core.hasFlag('poison');",
"weakWine": "core.hasFlag('weak');", "weakWine": "core.hasFlag('weak');",
"curseWine": "core.hasFlag('curse');", "curseWine": "core.hasFlag('curse');",

Binary file not shown.

Binary file not shown.

Binary file not shown.