From 7d6f5f35fb6e3f50b22e0d4fb4efa6b13f4520f3 Mon Sep 17 00:00:00 2001
From: ckcz123
Date: Sat, 23 May 2020 11:57:39 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E5=90=88=E5=B9=B6items?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
_server/editor_file.js | 37 +-
_server/table/comment.js | 103 ++---
libs/enemys.js | 6 +-
libs/items.js | 53 ++-
libs/maps.js | 2 +-
libs/ui.js | 2 +-
project/items.js | 877 +++++++++++++++++++--------------------
7 files changed, 532 insertions(+), 548 deletions(-)
diff --git a/_server/editor_file.js b/_server/editor_file.js
index 13a6988b..0c28dc6f 100644
--- a/_server/editor_file.js
+++ b/_server/editor_file.js
@@ -347,7 +347,7 @@ editor_file = function (editor, callback) {
mapActions.push(["add", "['" + idnum + "']", {'cls': image, 'id': id}]);
faceIds.push({idnum: idnum, id: id});
if (image=='items')
- templateActions.push(["add", "['items']['" + id + "']", editor.file.comment._data.items_template]);
+ templateActions.push(["add", "['" + id + "']", editor.file.comment._data.items_template]);
else if (image.indexOf('enemy')==0)
templateActions.push(["add", "['" + id + "']", editor.file.comment._data.enemys_template]);
idnum++;
@@ -449,7 +449,7 @@ editor_file = function (editor, callback) {
saveSetting('maps', [["add", "['" + idnum + "']", {'cls': info.images, 'id': id}]], tempcallback);
saveSetting('icons', [["add", "['" + info.images + "']['" + id + "']", info.y]], tempcallback);
if (info.images === 'items') {
- saveSetting('items', [["add", "['items']['" + id + "']", editor.file.comment._data.items_template]], function (err) {
+ saveSetting('items', [["add", "['" + id + "']", editor.file.comment._data.items_template]], function (err) {
if (err) {
printe(err);
throw(err)
@@ -479,7 +479,7 @@ editor_file = function (editor, callback) {
maps_90f36752_8815_4be8_b32b_d7fad1d0542e[idnum].id = id;
- var arr=[icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1,items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a,{enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80:enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80}]
+ var arr=[icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1,{items: items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a},{enemys: enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80}]
arr.forEach(function (obj) {
for(var jj in obj){
var ii=obj[jj]
@@ -497,8 +497,8 @@ editor_file = function (editor, callback) {
//callback(err:String)
editor.file.editItem = function (id, actionList, callback) {
/*actionList:[
- ["change","['items']['name']","红宝石的新名字"],
- ["add","['items']['新的和name同级的属性']",123],
+ ["change","['name']","红宝石的新名字"],
+ ["add","['新的和name同级的属性']",123],
["change","['itemEffectTip']","',攻击力+'+editor.core.values.redGem"],
]
为[]时只查询不修改
@@ -506,8 +506,7 @@ editor_file = function (editor, callback) {
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) {
- var tempindex = value[1].indexOf(']') + 1;
- value[1] = [value[1].slice(0, tempindex), "['" + id + "']", value[1].slice(tempindex)].join('');
+ value[1] = "['" + id + "']" + value[1];
});
saveSetting('items', actionList, function (err) {
callback([err]);
@@ -515,22 +514,12 @@ editor_file = function (editor, callback) {
} else {
callback([
(function () {
- var locObj_ = {};
+ var locObj = Object.assign({}, editor.core.items.items[id]);
Object.keys(editor.file.comment._data.items._data).forEach(function (v) {
- if (isset(editor.core.items[v][id]) && v !== 'items')
- locObj_[v] = editor.core.items[v][id];
- else
- locObj_[v] = null;
+ if (!isset(editor.core.items.items[id][v]))
+ locObj[v] = null;
});
- locObj_['items'] = (function () {
- var locObj = Object.assign({}, editor.core.items.items[id]);
- Object.keys(editor.file.comment._data.items._data.items._data).forEach(function (v) {
- if (!isset(editor.core.items.items[id][v]))
- locObj[v] = null;
- });
- return locObj;
- })();
- return locObj_;
+ return locObj;
})(),
editor.file.comment._data.items,
null]);
@@ -930,7 +919,10 @@ editor_file = function (editor, callback) {
eval("items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = \n';
- datastr += JSON.stringify(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a, null, '\t');
+ datastr += JSON.stringify(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a, function (k, v) {
+ if (v.id != null) delete v.id;
+ return v;
+ }, '\t');
fs.writeFile('project/items.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
@@ -944,6 +936,7 @@ editor_file = function (editor, callback) {
var emap = {};
var estr = JSON.stringify(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80, function (k, v) {
if (v.hp != null) {
+ delete v.id;
var id_ = editor.util.guid();
emap[id_] = JSON.stringify(v);
return id_;
diff --git a/_server/table/comment.js b/_server/table/comment.js
index 60af0a61..9a88381c 100644
--- a/_server/table/comment.js
+++ b/_server/table/comment.js
@@ -11,54 +11,55 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"items": {
"_type": "object",
"_data": {
- "items": {
- "_type": "object",
- "_data": {
- "cls": {
- "_leaf": true,
- "_type": "select",
- "_select": {
- "values": [
- "items",
- "constants",
- "tools",
- "equips"
- ]
- },
- "_docs": "道具类别",
- "_data": "items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
- },
- "name": {
- "_leaf": true,
- "_type": "textarea",
- "_string": true,
- "_data": "道具名称"
- },
- "text": {
- "_leaf": true,
- "_type": "textarea",
- "_string": true,
- "_docs": "道具描述",
- "_data": "道具在道具栏中显示的描述"
- },
- "hideInToolbox": {
- "_leaf": true,
- "_type": "checkbox",
- "_docs": "不显示在道具栏",
- },
- "equip": {
- "_leaf": true,
- "_type": "event",
- "_event": "equip",
- "_docs": "道具的装备属性"
- },
- "hideInReplay": {
- "_leaf": true,
- "_type": "checkbox",
- "_docs": "回放不绘制道具栏",
- "_data": "此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)"
- }
- }
+ "id": {
+ "_leaf": true,
+ "_type": "disable",
+ "_docs": "道具ID",
+ "_data": "道具ID,可于页面底部修改"
+ },
+ "cls": {
+ "_leaf": true,
+ "_type": "select",
+ "_select": {
+ "values": [
+ "items",
+ "constants",
+ "tools",
+ "equips"
+ ]
+ },
+ "_docs": "道具类别",
+ "_data": "items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
+ },
+ "name": {
+ "_leaf": true,
+ "_type": "textarea",
+ "_string": true,
+ "_data": "道具名称"
+ },
+ "text": {
+ "_leaf": true,
+ "_type": "textarea",
+ "_string": true,
+ "_docs": "道具描述",
+ "_data": "道具在道具栏中显示的描述"
+ },
+ "hideInToolbox": {
+ "_leaf": true,
+ "_type": "checkbox",
+ "_docs": "不显示在道具栏",
+ },
+ "equip": {
+ "_leaf": true,
+ "_type": "event",
+ "_event": "equip",
+ "_docs": "道具的装备属性"
+ },
+ "hideInReplay": {
+ "_leaf": true,
+ "_type": "checkbox",
+ "_docs": "回放不绘制道具栏",
+ "_data": "此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)"
},
"itemEffect": {
"_leaf": true,
@@ -115,6 +116,12 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"enemys": {
"_type": "object",
"_data": {
+ "id": {
+ "_leaf": true,
+ "_type": "disable",
+ "_docs": "怪物ID",
+ "_data": "怪物ID,可于页面底部修改"
+ },
"name": {
"_leaf": true,
"_type": "textarea",
diff --git a/libs/enemys.js b/libs/enemys.js
index b530e738..0eceee34 100644
--- a/libs/enemys.js
+++ b/libs/enemys.js
@@ -10,13 +10,13 @@ function enemys() {
enemys.prototype._init = function () {
this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
this.enemydata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys;
+ for (var enemyId in this.enemys) {
+ this.enemys[enemyId].id = enemyId;
+ }
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;
- }
}
}
diff --git a/libs/items.js b/libs/items.js
index 3a22cac6..4ac6813b 100644
--- a/libs/items.js
+++ b/libs/items.js
@@ -8,17 +8,10 @@ function items() {
////// 初始化 //////
items.prototype._init = function () {
- this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items;
- this.itemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect;
- this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;
- this.useItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEffect;
- this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect;
- if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition)
- items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition = {};
- if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEvent)
- items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEvent = {};
- this.equipCondition = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition;
- this.useItemEvent = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEvent;
+ this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a;
+ for (var itemId in this.items) {
+ this.items[itemId].id = itemId;
+ }
}
////// 获得所有道具 //////
@@ -32,10 +25,11 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
// 消耗品
if (itemCls === 'items') {
var curr_hp = core.status.hero.hp;
- if (itemId in this.itemEffect) {
+ var itemEffect = core.material.items[itemId].itemEffect;
+ if (itemEffect) {
try {
for (var i = 0; i < itemNum; ++i)
- eval(this.itemEffect[itemId]);
+ eval(itemEffect);
}
catch (e) {
main.log(e);
@@ -43,9 +37,10 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
}
core.status.hero.statistics.hp += core.status.hero.hp - curr_hp;
- if (this.useItemEvent[itemId]) {
+ var useItemEvent = core.material.items[itemId].useItemEvent;
+ if (useItemEvent) {
try {
- core.insertAction(this.useItemEvent[itemId]);
+ core.insertAction(useItemEvent);
}
catch (e) {
main.log(e);
@@ -63,9 +58,10 @@ items.prototype.getItemEffectTip = function (itemId) {
var itemCls = core.material.items[itemId].cls;
// 消耗品
if (itemCls === 'items') {
- if (itemId in this.itemEffectTip) {
+ var itemEffectTip = core.material.items[itemId].itemEffectTip;
+ if (itemEffectTip) {
try {
- return core.replaceText(this.itemEffectTip[itemId]) || "";
+ return core.replaceText(itemEffectTip) || "";
} catch (e) {
main.log(e);
return "";
@@ -91,17 +87,19 @@ items.prototype.useItem = function (itemId, noRoute, callback) {
}
items.prototype._useItemEffect = function (itemId) {
- if (itemId in this.useItemEffect) {
+ var useItemEffect = core.material.items[itemId].useItemEffect;
+ if (useItemEffect) {
try {
- eval(this.useItemEffect[itemId]);
+ eval(useItemEffect);
}
catch (e) {
main.log(e);
}
}
- if (this.useItemEvent[itemId]) {
+ var useItemEvent = core.material.items[itemId].useItemEvent;
+ if (useItemEvent) {
try {
- core.insertAction(this.useItemEvent[itemId]);
+ core.insertAction(useItemEvent);
}
catch (e) {
main.log(e);
@@ -123,10 +121,11 @@ items.prototype._afterUseItem = function (itemId) {
items.prototype.canUseItem = function (itemId) {
// 没有道具
if (!core.hasItem(itemId)) return false;
-
- if (itemId in this.canUseItemEffect) {
+
+ var canUseItemEffect = core.material.items[itemId].canUseItemEffect;
+ if (canUseItemEffect) {
try {
- return eval(this.canUseItemEffect[itemId]);
+ return eval(canUseItemEffect);
}
catch (e) {
main.log(e);
@@ -243,10 +242,10 @@ items.prototype.canEquip = function (equipId, hint) {
}
// 可装备条件
- var condition = this.equipCondition[equipId];
- if (condition) {
+ var equipCondition = core.material.items[equipId].equipCondition;
+ if (equipCondition) {
try {
- if (!eval(condition)) {
+ if (!eval(equipCondition)) {
if (hint) core.drawTip("当前不可换上" + equip.name);
return false;
}
diff --git a/libs/maps.js b/libs/maps.js
index ede1ce9c..d13ece8f 100644
--- a/libs/maps.js
+++ b/libs/maps.js
@@ -307,7 +307,7 @@ maps.prototype.saveMap = function (floorId) {
var map = maps[floorId];
var thisFloor = this._compressFloorData(map, core.floors[floorId]);
if (map.blocks) {
- var mapArr = this.compressMap(map.blocks, map.width, map.height, floorId);
+ var mapArr = this.compressMap(this._getMapArrayFromBlocks(map.blocks, map.width, map.height, true), floorId);
if (mapArr != null) thisFloor.map = mapArr;
}
return thisFloor;
diff --git a/libs/ui.js b/libs/ui.js
index c7182d51..a27d5c0b 100644
--- a/libs/ui.js
+++ b/libs/ui.js
@@ -2846,7 +2846,7 @@ ui.prototype._drawStatistics_items = function (floorId, floor, id, obj) {
if (obj.cls[id]=='items' && id!='superPotion') {
var temp = core.clone(core.status.hero);
core.setFlag("__statistics__", true);
- try { eval(core.items.itemEffect[id]); }
+ try { eval(core.material.items[id].itemEffect); }
catch (e) {}
hp = core.status.hero.hp - temp.hp;
atk = core.status.hero.atk - temp.atk;
diff --git a/project/items.js b/project/items.js
index 3e245d26..46706167 100644
--- a/project/items.js
+++ b/project/items.js
@@ -1,454 +1,57 @@
var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
{
- "items": {
- "yellowKey": {
- "cls": "tools",
- "name": "黄钥匙",
- "text": "可以打开一扇黄门",
- "hideInToolbox": true
- },
- "blueKey": {
- "cls": "tools",
- "name": "蓝钥匙",
- "text": "可以打开一扇蓝门",
- "hideInToolbox": true
- },
- "redKey": {
- "cls": "tools",
- "name": "红钥匙",
- "text": "可以打开一扇红门",
- "hideInToolbox": true
- },
- "redGem": {
- "cls": "items",
- "name": "红宝石",
- "text": "攻击+${core.values.redGem}"
- },
- "blueGem": {
- "cls": "items",
- "name": "蓝宝石",
- "text": ",防御+${core.values.blueGem}"
- },
- "greenGem": {
- "cls": "items",
- "name": "绿宝石",
- "text": ",护盾+${core.values.greenGem}"
- },
- "yellowGem": {
- "cls": "items",
- "name": "黄宝石",
- "text": "可以进行加点"
- },
- "redPotion": {
- "cls": "items",
- "name": "红血瓶",
- "text": ",生命+${core.values.redPotion}"
- },
- "bluePotion": {
- "cls": "items",
- "name": "蓝血瓶",
- "text": ",生命+${core.values.bluePotion}"
- },
- "yellowPotion": {
- "cls": "items",
- "name": "黄血瓶",
- "text": ",生命+${core.values.yellowPotion}"
- },
- "greenPotion": {
- "cls": "items",
- "name": "绿血瓶",
- "text": ",生命+${core.values.greenPotion}"
- },
- "sword0": {
- "cls": "items",
- "name": "破旧的剑",
- "text": "一把已经生锈的剑",
- "equip": {
- "type": 0,
- "animate": "sword",
- "value": {
- "atk": 0
- }
- }
- },
- "sword1": {
- "cls": "items",
- "name": "铁剑",
- "text": "一把很普通的铁剑",
- "equip": {
- "type": 0,
- "animate": "sword",
- "value": {
- "atk": 10
- }
- }
- },
- "sword2": {
- "cls": "items",
- "name": "银剑",
- "text": "一把很普通的银剑",
- "equip": {
- "type": 0,
- "animate": "sword",
- "value": {
- "atk": 20
- }
- }
- },
- "sword3": {
- "cls": "items",
- "name": "骑士剑",
- "text": "一把很普通的骑士剑",
- "equip": {
- "type": 0,
- "animate": "sword",
- "value": {
- "atk": 40
- }
- }
- },
- "sword4": {
- "cls": "items",
- "name": "圣剑",
- "text": "一把很普通的圣剑",
- "equip": {
- "type": 0,
- "animate": "sword",
- "value": {
- "atk": 80
- }
- }
- },
- "sword5": {
- "cls": "items",
- "name": "神圣剑",
- "text": "一把很普通的神圣剑",
- "equip": {
- "type": 0,
- "animate": "sword",
- "value": {
- "atk": 160
- }
- }
- },
- "shield0": {
- "cls": "items",
- "name": "破旧的盾",
- "text": "一个很破旧的铁盾",
- "equip": {
- "type": 1,
- "value": {
- "def": 0
- }
- }
- },
- "shield1": {
- "cls": "items",
- "name": "铁盾",
- "text": "一个很普通的铁盾",
- "equip": {
- "type": 1,
- "value": {
- "def": 10
- }
- }
- },
- "shield2": {
- "cls": "items",
- "name": "银盾",
- "text": "一个很普通的银盾",
- "equip": {
- "type": 1,
- "value": {
- "def": 20
- }
- }
- },
- "shield3": {
- "cls": "items",
- "name": "骑士盾",
- "text": "一个很普通的骑士盾",
- "equip": {
- "type": 1,
- "value": {
- "def": 40
- }
- }
- },
- "shield4": {
- "cls": "items",
- "name": "圣盾",
- "text": "一个很普通的圣盾",
- "equip": {
- "type": 1,
- "value": {
- "def": 80
- }
- }
- },
- "shield5": {
- "cls": "items",
- "name": "神圣盾",
- "text": "一个很普通的神圣盾",
- "equip": {
- "type": 1,
- "value": {
- "def": 100,
- "mdef": 100
- }
- }
- },
- "superPotion": {
- "cls": "items",
- "name": "圣水"
- },
- "silverCoin": {
- "cls": "items",
- "name": "银币"
- },
- "book": {
- "cls": "constants",
- "name": "怪物手册",
- "text": "可以查看当前楼层各怪物属性",
- "hideInToolbox": true
- },
- "fly": {
- "cls": "constants",
- "name": "楼层传送器",
- "text": "可以自由往来去过的楼层",
- "hideInReplay": true,
- "hideInToolbox": true
- },
- "coin": {
- "cls": "constants",
- "name": "幸运金币",
- "text": "持有时打败怪物可得双倍金币"
- },
- "freezeBadge": {
- "cls": "constants",
- "name": "冰冻徽章",
- "text": "可以将面前的熔岩变成平地"
- },
- "cross": {
- "cls": "constants",
- "name": "十字架",
- "text": "持有后无视怪物的无敌属性"
- },
- "dagger": {
- "cls": "constants",
- "name": "屠龙匕首",
- "text": "该道具尚未被定义"
- },
- "amulet": {
- "cls": "constants",
- "name": "护符",
- "text": "持有时无视负面地形"
- },
- "bigKey": {
- "cls": "tools",
- "name": "大黄门钥匙",
- "text": "可以开启当前层所有黄门"
- },
- "greenKey": {
- "cls": "tools",
- "name": "绿钥匙",
- "text": "可以打开一扇绿门"
- },
- "steelKey": {
- "cls": "tools",
- "name": "铁门钥匙",
- "text": "可以打开一扇铁门"
- },
- "pickaxe": {
- "cls": "tools",
- "name": "破墙镐",
- "text": "可以破坏勇士面前的墙"
- },
- "icePickaxe": {
- "cls": "tools",
- "name": "破冰镐",
- "text": "可以破坏勇士面前的一堵冰墙"
- },
- "bomb": {
- "cls": "tools",
- "name": "炸弹",
- "text": "可以炸掉勇士面前的怪物"
- },
- "centerFly": {
- "cls": "tools",
- "name": "中心对称飞行器",
- "text": "可以飞向当前楼层中心对称的位置"
- },
- "upFly": {
- "cls": "tools",
- "name": "上楼器",
- "text": "可以飞往楼上的相同位置"
- },
- "downFly": {
- "cls": "tools",
- "name": "下楼器",
- "text": "可以飞往楼下的相同位置"
- },
- "earthquake": {
- "cls": "tools",
- "name": "地震卷轴",
- "text": "可以破坏当前层的所有墙"
- },
- "poisonWine": {
- "cls": "tools",
- "name": "解毒药水",
- "text": "可以解除中毒状态"
- },
- "weakWine": {
- "cls": "tools",
- "name": "解衰药水",
- "text": "可以解除衰弱状态"
- },
- "curseWine": {
- "cls": "tools",
- "name": "解咒药水",
- "text": "可以解除诅咒状态"
- },
- "superWine": {
- "cls": "tools",
- "name": "万能药水",
- "text": "可以解除所有不良状态"
- },
- "hammer": {
- "cls": "tools",
- "name": "圣锤",
- "text": "该道具尚未被定义"
- },
- "lifeWand": {
- "cls": "tools",
- "name": "生命魔杖",
- "text": "可以恢复100点生命值"
- },
- "jumpShoes": {
- "cls": "tools",
- "name": "跳跃靴",
- "text": "能跳跃到前方两格处"
- },
- "skill1": {
- "cls": "constants",
- "name": "技能:二倍斩",
- "text": "可以打开或关闭主动技能二倍斩",
- "hideInReplay": true
- },
- "wand": {
- "cls": "items",
- "name": "新物品"
- }
+ "yellowKey": {
+ "cls": "tools",
+ "name": "黄钥匙",
+ "text": "可以打开一扇黄门",
+ "hideInToolbox": true
},
- "itemEffect": {
- "redGem": "core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio",
- "blueGem": "core.status.hero.def += core.values.blueGem * core.status.thisMap.ratio",
- "greenGem": "core.status.hero.mdef += core.values.greenGem * core.status.thisMap.ratio",
- "yellowGem": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
- "redPotion": "core.status.hero.hp += core.values.redPotion * core.status.thisMap.ratio",
- "bluePotion": "core.status.hero.hp += core.values.bluePotion * core.status.thisMap.ratio",
- "yellowPotion": "core.status.hero.hp += core.values.yellowPotion * core.status.thisMap.ratio",
- "greenPotion": "core.status.hero.hp += core.values.greenPotion * core.status.thisMap.ratio",
- "sword0": "core.status.hero.atk += 0",
- "sword1": "core.status.hero.atk += 10",
- "sword2": "core.status.hero.atk += 20",
- "sword3": "core.status.hero.atk += 40",
- "sword4": "core.status.hero.atk += 80",
- "sword5": "core.status.hero.atk += 100",
- "shield0": "core.status.hero.def += 0",
- "shield1": "core.status.hero.def += 10",
- "shield2": "core.status.hero.def += 20",
- "shield3": "core.status.hero.def += 40",
- "shield4": "core.status.hero.def += 80",
- "shield5": "core.status.hero.def += 100;core.status.hero.mdef += 100",
- "bigKey": "core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
- "superPotion": "core.status.hero.hp *= 2",
- "silverCoin": "core.status.hero.money += 500"
+ "blueKey": {
+ "cls": "tools",
+ "name": "蓝钥匙",
+ "text": "可以打开一扇蓝门",
+ "hideInToolbox": true
},
- "itemEffectTip": {
- "redGem": ",攻击+${core.values.redGem * core.status.thisMap.ratio}",
- "blueGem": ",防御+${core.values.blueGem * core.status.thisMap.ratio}",
- "greenGem": ",护盾+${core.values.greenGem * core.status.thisMap.ratio}",
- "yellowGem": ",全属性提升",
- "redPotion": ",生命+${core.values.redPotion * core.status.thisMap.ratio}",
- "bluePotion": ",生命+${core.values.bluePotion * core.status.thisMap.ratio}",
- "yellowPotion": ",生命+${core.values.yellowPotion * core.status.thisMap.ratio}",
- "greenPotion": ",生命+${core.values.greenPotion * core.status.thisMap.ratio}",
- "sword0": ",攻击+0",
- "sword1": ",攻击+10",
- "sword2": ",攻击+20",
- "sword3": ",攻击+40",
- "sword4": ",攻击+80",
- "sword5": ",攻击+100",
- "shield0": ",防御+0",
- "shield1": ",防御+10",
- "shield2": ",防御+20",
- "shield3": ",防御+40",
- "shield4": ",防御+80",
- "shield5": ",防御+100,护盾+100",
- "bigKey": ",全钥匙+1",
- "superPotion": ",生命值翻倍",
- "silverCoin": ",金币+500"
+ "redKey": {
+ "cls": "tools",
+ "name": "红钥匙",
+ "text": "可以打开一扇红门",
+ "hideInToolbox": true
},
- "useItemEffect": {
- "book": "core.ui.drawBook(0);",
- "fly": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
- "earthquake": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap(core.status.floorId, function () {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t});\n})();",
- "pickaxe": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
- "icePickaxe": "(function () {\n\tcore.removeBlock(core.nextX(), core.nextY());\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();",
- "freezeBadge": "(function () {\n\tvar success = false;\n\n\tvar snowFourDirections = false; // 是否四方向雪花;如果是将其改成true\n\tif (snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (core.getBlockId(nx, ny) == 'lava') {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (core.getBlockId(core.nextX(), core.nextY()) == 'lava') {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
- "bigKey": "(function () {\n\tvar actions = core.searchBlock(\"yellowDoor\").map(function (block) {\n\t\treturn { \"type\": \"openDoor\", \"loc\": [block.x, block.y], \"async\": true };\n\t});\n\tactions.push({ \"type\": \"waitAsync\" });\n\tactions.push({ \"type\": \"tip\", \"text\": core.material.items[itemId].name + \"使用成功\" });\n\tcore.insertAction(actions);\n})();",
- "bomb": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();",
- "centerFly": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', core.bigmap.width - 1 - core.getHeroLoc('x'));\ncore.setHeroLoc('y', core.bigmap.height - 1 - core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
- "upFly": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) + 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
- "downFly": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) - 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
- "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.addBuff(\"atk\", core.values.weakValue);\n\tcore.addBuff(\"def\", core.values.weakValue);\n}",
- "curseWine": "core.removeFlag('curse');",
- "superWine": "core.removeFlag('poison');\nif (core.hasFlag('weak')) {\n\tcore.removeFlag('weak');\n\tif (core.values.weakValue>=1) { // >=1:直接扣数值\n\t\tcore.status.hero.atk += core.values.weakValue;\n\t\tcore.status.hero.def += core.values.weakValue;\n\t}\n\telse { // <1:扣比例\n\t\tcore.addBuff(\"atk\", core.values.weakValue);\n\t\tcore.addBuff(\"def\", core.values.weakValue);\n\t}\n}\ncore.removeFlag('curse');",
- "lifeWand": null,
- "jumpShoes": "core.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });",
- "redPotion": "core.status.hero.hp += core.values.redPotion",
- "bluePotion": "core.status.hero.hp += core.values.bluePotion",
- "greenPotion": "core.status.hero.hp += core.values.greenPotion",
- "yellowPotion": "core.status.hero.hp += core.values.yellowPotion",
- "redGem": "core.status.hero.atk += core.values.redGem",
- "blueGem": "core.status.hero.def += core.values.blueGem",
- "greenGem": "core.status.hero.mdef += core.values.greenGem",
- "yellowGem": null,
- "skill1": "// 二倍斩的flag:skill为1\nif (core.getFlag('skill', 0)==0) { // 判断当前是否已经开了技能\n\tif (core.getStatus('mana')>=5) { // 这里要写当前能否开技能的条件判断,比如魔力值至少要多少\n\t\tcore.setFlag('skill', 1); // 开技能1\n\t\tcore.setFlag('skillName', '二倍斩'); // 设置技能名\n\t}\n\telse {\n\t\tcore.drawTip(\"魔力不足,无法开启技能\");\n\t}\n}\nelse { // 关闭技能\n\tcore.setFlag('skill', 0); // 关闭技能状态\n\tcore.setFlag('skillName', '无');\n}"
+ "redGem": {
+ "cls": "items",
+ "name": "红宝石",
+ "text": "攻击+${core.values.redGem}",
+ "itemEffect": "core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio",
+ "itemEffectTip": ",攻击+${core.values.redGem * core.status.thisMap.ratio}",
+ "useItemEffect": "core.status.hero.atk += core.values.redGem",
+ "canUseItemEffect": "true"
},
- "canUseItemEffect": {
- "book": "true",
- "fly": "(function () {\n\treturn core.status.maps[core.status.floorId].canFlyTo;\n})();",
- "pickaxe": "true",
- "icePickaxe": "(function () {\n\treturn core.getBlockId(core.nextX(), core.nextY()) == 'ice';\n})();",
- "bomb": "true",
- "earthquake": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();",
- "centerFly": "(function () {\n\tvar toX = core.bigmap.width - 1 - core.getHeroLoc('x'),\n\t\ttoY = core.bigmap.height - 1 - core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();",
- "upFly": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index < core.floorIds.length - 1) {\n\t\tvar toId = core.floorIds[index + 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
- "downFly": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index > 0) {\n\t\tvar toId = core.floorIds[index - 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
- "freezeBadge": "true",
- "bigKey": "(function () {\n\treturn core.searchBlock('yellowDoor').length > 0;\n})();",
- "poisonWine": "core.hasFlag('poison');",
- "weakWine": "core.hasFlag('weak');",
- "curseWine": "core.hasFlag('curse');",
- "superWine": "(function() {\n\treturn core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse');\n})();",
- "lifeWand": "true",
- "jumpShoes": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();",
- "redPotion": "true",
- "bluePotion": "true",
- "greenPotion": "true",
- "yellowPotion": "true",
- "redGem": "true",
- "blueGem": "true",
- "greenGem": "true",
- "yellowGem": "true",
- "skill1": "true"
+ "blueGem": {
+ "cls": "items",
+ "name": "蓝宝石",
+ "text": ",防御+${core.values.blueGem}",
+ "itemEffect": "core.status.hero.def += core.values.blueGem * core.status.thisMap.ratio",
+ "itemEffectTip": ",防御+${core.values.blueGem * core.status.thisMap.ratio}",
+ "useItemEffect": "core.status.hero.def += core.values.blueGem",
+ "canUseItemEffect": "true"
},
- "equipCondition": {},
- "useItemEvent": {
- "yellowGem": [
+ "greenGem": {
+ "cls": "items",
+ "name": "绿宝石",
+ "text": ",护盾+${core.values.greenGem}",
+ "itemEffect": "core.status.hero.mdef += core.values.greenGem * core.status.thisMap.ratio",
+ "itemEffectTip": ",护盾+${core.values.greenGem * core.status.thisMap.ratio}",
+ "useItemEffect": "core.status.hero.mdef += core.values.greenGem",
+ "canUseItemEffect": "true"
+ },
+ "yellowGem": {
+ "cls": "items",
+ "name": "黄宝石",
+ "text": "可以进行加点",
+ "itemEffect": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
+ "itemEffectTip": ",全属性提升",
+ "useItemEvent": [
{
"type": "choices",
"choices": [
@@ -488,7 +91,369 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
]
}
],
- "lifeWand": [
+ "canUseItemEffect": "true"
+ },
+ "redPotion": {
+ "cls": "items",
+ "name": "红血瓶",
+ "text": ",生命+${core.values.redPotion}",
+ "itemEffect": "core.status.hero.hp += core.values.redPotion * core.status.thisMap.ratio",
+ "itemEffectTip": ",生命+${core.values.redPotion * core.status.thisMap.ratio}",
+ "useItemEffect": "core.status.hero.hp += core.values.redPotion",
+ "canUseItemEffect": "true"
+ },
+ "bluePotion": {
+ "cls": "items",
+ "name": "蓝血瓶",
+ "text": ",生命+${core.values.bluePotion}",
+ "itemEffect": "core.status.hero.hp += core.values.bluePotion * core.status.thisMap.ratio",
+ "itemEffectTip": ",生命+${core.values.bluePotion * core.status.thisMap.ratio}",
+ "useItemEffect": "core.status.hero.hp += core.values.bluePotion",
+ "canUseItemEffect": "true"
+ },
+ "yellowPotion": {
+ "cls": "items",
+ "name": "黄血瓶",
+ "text": ",生命+${core.values.yellowPotion}",
+ "itemEffect": "core.status.hero.hp += core.values.yellowPotion * core.status.thisMap.ratio",
+ "itemEffectTip": ",生命+${core.values.yellowPotion * core.status.thisMap.ratio}",
+ "useItemEffect": "core.status.hero.hp += core.values.yellowPotion",
+ "canUseItemEffect": "true"
+ },
+ "greenPotion": {
+ "cls": "items",
+ "name": "绿血瓶",
+ "text": ",生命+${core.values.greenPotion}",
+ "itemEffect": "core.status.hero.hp += core.values.greenPotion * core.status.thisMap.ratio",
+ "itemEffectTip": ",生命+${core.values.greenPotion * core.status.thisMap.ratio}",
+ "useItemEffect": "core.status.hero.hp += core.values.greenPotion",
+ "canUseItemEffect": "true"
+ },
+ "sword0": {
+ "cls": "items",
+ "name": "破旧的剑",
+ "text": "一把已经生锈的剑",
+ "equip": {
+ "type": 0,
+ "animate": "sword",
+ "value": {
+ "atk": 0
+ }
+ },
+ "itemEffect": "core.status.hero.atk += 0",
+ "itemEffectTip": ",攻击+0"
+ },
+ "sword1": {
+ "cls": "items",
+ "name": "铁剑",
+ "text": "一把很普通的铁剑",
+ "equip": {
+ "type": 0,
+ "animate": "sword",
+ "value": {
+ "atk": 10
+ }
+ },
+ "itemEffect": "core.status.hero.atk += 10",
+ "itemEffectTip": ",攻击+10"
+ },
+ "sword2": {
+ "cls": "items",
+ "name": "银剑",
+ "text": "一把很普通的银剑",
+ "equip": {
+ "type": 0,
+ "animate": "sword",
+ "value": {
+ "atk": 20
+ }
+ },
+ "itemEffect": "core.status.hero.atk += 20",
+ "itemEffectTip": ",攻击+20"
+ },
+ "sword3": {
+ "cls": "items",
+ "name": "骑士剑",
+ "text": "一把很普通的骑士剑",
+ "equip": {
+ "type": 0,
+ "animate": "sword",
+ "value": {
+ "atk": 40
+ }
+ },
+ "itemEffect": "core.status.hero.atk += 40",
+ "itemEffectTip": ",攻击+40"
+ },
+ "sword4": {
+ "cls": "items",
+ "name": "圣剑",
+ "text": "一把很普通的圣剑",
+ "equip": {
+ "type": 0,
+ "animate": "sword",
+ "value": {
+ "atk": 80
+ }
+ },
+ "itemEffect": "core.status.hero.atk += 80",
+ "itemEffectTip": ",攻击+80"
+ },
+ "sword5": {
+ "cls": "items",
+ "name": "神圣剑",
+ "text": "一把很普通的神圣剑",
+ "equip": {
+ "type": 0,
+ "animate": "sword",
+ "value": {
+ "atk": 160
+ }
+ },
+ "itemEffect": "core.status.hero.atk += 100",
+ "itemEffectTip": ",攻击+100"
+ },
+ "shield0": {
+ "cls": "items",
+ "name": "破旧的盾",
+ "text": "一个很破旧的铁盾",
+ "equip": {
+ "type": 1,
+ "value": {
+ "def": 0
+ }
+ },
+ "itemEffect": "core.status.hero.def += 0",
+ "itemEffectTip": ",防御+0"
+ },
+ "shield1": {
+ "cls": "items",
+ "name": "铁盾",
+ "text": "一个很普通的铁盾",
+ "equip": {
+ "type": 1,
+ "value": {
+ "def": 10
+ }
+ },
+ "itemEffect": "core.status.hero.def += 10",
+ "itemEffectTip": ",防御+10"
+ },
+ "shield2": {
+ "cls": "items",
+ "name": "银盾",
+ "text": "一个很普通的银盾",
+ "equip": {
+ "type": 1,
+ "value": {
+ "def": 20
+ }
+ },
+ "itemEffect": "core.status.hero.def += 20",
+ "itemEffectTip": ",防御+20"
+ },
+ "shield3": {
+ "cls": "items",
+ "name": "骑士盾",
+ "text": "一个很普通的骑士盾",
+ "equip": {
+ "type": 1,
+ "value": {
+ "def": 40
+ }
+ },
+ "itemEffect": "core.status.hero.def += 40",
+ "itemEffectTip": ",防御+40"
+ },
+ "shield4": {
+ "cls": "items",
+ "name": "圣盾",
+ "text": "一个很普通的圣盾",
+ "equip": {
+ "type": 1,
+ "value": {
+ "def": 80
+ }
+ },
+ "itemEffect": "core.status.hero.def += 80",
+ "itemEffectTip": ",防御+80"
+ },
+ "shield5": {
+ "cls": "items",
+ "name": "神圣盾",
+ "text": "一个很普通的神圣盾",
+ "equip": {
+ "type": 1,
+ "value": {
+ "def": 100,
+ "mdef": 100
+ }
+ },
+ "itemEffect": "core.status.hero.def += 100;core.status.hero.mdef += 100",
+ "itemEffectTip": ",防御+100,护盾+100"
+ },
+ "superPotion": {
+ "cls": "items",
+ "name": "圣水",
+ "itemEffect": "core.status.hero.hp *= 2",
+ "itemEffectTip": ",生命值翻倍"
+ },
+ "silverCoin": {
+ "cls": "items",
+ "name": "银币",
+ "itemEffect": "core.status.hero.money += 500",
+ "itemEffectTip": ",金币+500"
+ },
+ "book": {
+ "cls": "constants",
+ "name": "怪物手册",
+ "text": "可以查看当前楼层各怪物属性",
+ "hideInToolbox": true,
+ "useItemEffect": "core.ui.drawBook(0);",
+ "canUseItemEffect": "true"
+ },
+ "fly": {
+ "cls": "constants",
+ "name": "楼层传送器",
+ "text": "可以自由往来去过的楼层",
+ "hideInReplay": true,
+ "hideInToolbox": true,
+ "useItemEffect": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
+ "canUseItemEffect": "(function () {\n\treturn core.status.maps[core.status.floorId].canFlyTo;\n})();"
+ },
+ "coin": {
+ "cls": "constants",
+ "name": "幸运金币",
+ "text": "持有时打败怪物可得双倍金币"
+ },
+ "freezeBadge": {
+ "cls": "constants",
+ "name": "冰冻徽章",
+ "text": "可以将面前的熔岩变成平地",
+ "useItemEffect": "(function () {\n\tvar success = false;\n\n\tvar snowFourDirections = false; // 是否四方向雪花;如果是将其改成true\n\tif (snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (core.getBlockId(nx, ny) == 'lava') {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (core.getBlockId(core.nextX(), core.nextY()) == 'lava') {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
+ "canUseItemEffect": "true"
+ },
+ "cross": {
+ "cls": "constants",
+ "name": "十字架",
+ "text": "持有后无视怪物的无敌属性"
+ },
+ "dagger": {
+ "cls": "constants",
+ "name": "屠龙匕首",
+ "text": "该道具尚未被定义"
+ },
+ "amulet": {
+ "cls": "constants",
+ "name": "护符",
+ "text": "持有时无视负面地形"
+ },
+ "bigKey": {
+ "cls": "tools",
+ "name": "大黄门钥匙",
+ "text": "可以开启当前层所有黄门",
+ "itemEffect": "core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
+ "itemEffectTip": ",全钥匙+1",
+ "useItemEffect": "(function () {\n\tvar actions = core.searchBlock(\"yellowDoor\").map(function (block) {\n\t\treturn { \"type\": \"openDoor\", \"loc\": [block.x, block.y], \"async\": true };\n\t});\n\tactions.push({ \"type\": \"waitAsync\" });\n\tactions.push({ \"type\": \"tip\", \"text\": core.material.items[itemId].name + \"使用成功\" });\n\tcore.insertAction(actions);\n})();",
+ "canUseItemEffect": "(function () {\n\treturn core.searchBlock('yellowDoor').length > 0;\n})();"
+ },
+ "greenKey": {
+ "cls": "tools",
+ "name": "绿钥匙",
+ "text": "可以打开一扇绿门"
+ },
+ "steelKey": {
+ "cls": "tools",
+ "name": "铁门钥匙",
+ "text": "可以打开一扇铁门"
+ },
+ "pickaxe": {
+ "cls": "tools",
+ "name": "破墙镐",
+ "text": "可以破坏勇士面前的墙",
+ "useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
+ "canUseItemEffect": "true"
+ },
+ "icePickaxe": {
+ "cls": "tools",
+ "name": "破冰镐",
+ "text": "可以破坏勇士面前的一堵冰墙",
+ "useItemEffect": "(function () {\n\tcore.removeBlock(core.nextX(), core.nextY());\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();",
+ "canUseItemEffect": "(function () {\n\treturn core.getBlockId(core.nextX(), core.nextY()) == 'ice';\n})();"
+ },
+ "bomb": {
+ "cls": "tools",
+ "name": "炸弹",
+ "text": "可以炸掉勇士面前的怪物",
+ "useItemEffect": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();",
+ "canUseItemEffect": "true"
+ },
+ "centerFly": {
+ "cls": "tools",
+ "name": "中心对称飞行器",
+ "text": "可以飞向当前楼层中心对称的位置",
+ "useItemEffect": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', core.bigmap.width - 1 - core.getHeroLoc('x'));\ncore.setHeroLoc('y', core.bigmap.height - 1 - core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
+ "canUseItemEffect": "(function () {\n\tvar toX = core.bigmap.width - 1 - core.getHeroLoc('x'),\n\t\ttoY = core.bigmap.height - 1 - core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();"
+ },
+ "upFly": {
+ "cls": "tools",
+ "name": "上楼器",
+ "text": "可以飞往楼上的相同位置",
+ "useItemEffect": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) + 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
+ "canUseItemEffect": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index < core.floorIds.length - 1) {\n\t\tvar toId = core.floorIds[index + 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();"
+ },
+ "downFly": {
+ "cls": "tools",
+ "name": "下楼器",
+ "text": "可以飞往楼下的相同位置",
+ "useItemEffect": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) - 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
+ "canUseItemEffect": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index > 0) {\n\t\tvar toId = core.floorIds[index - 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();"
+ },
+ "earthquake": {
+ "cls": "tools",
+ "name": "地震卷轴",
+ "text": "可以破坏当前层的所有墙",
+ "useItemEffect": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap(core.status.floorId, function () {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t});\n})();",
+ "canUseItemEffect": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();"
+ },
+ "poisonWine": {
+ "cls": "tools",
+ "name": "解毒药水",
+ "text": "可以解除中毒状态",
+ "useItemEffect": "core.removeFlag('poison');",
+ "canUseItemEffect": "core.hasFlag('poison');"
+ },
+ "weakWine": {
+ "cls": "tools",
+ "name": "解衰药水",
+ "text": "可以解除衰弱状态",
+ "useItemEffect": "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.addBuff(\"atk\", core.values.weakValue);\n\tcore.addBuff(\"def\", core.values.weakValue);\n}",
+ "canUseItemEffect": "core.hasFlag('weak');"
+ },
+ "curseWine": {
+ "cls": "tools",
+ "name": "解咒药水",
+ "text": "可以解除诅咒状态",
+ "useItemEffect": "core.removeFlag('curse');",
+ "canUseItemEffect": "core.hasFlag('curse');"
+ },
+ "superWine": {
+ "cls": "tools",
+ "name": "万能药水",
+ "text": "可以解除所有不良状态",
+ "useItemEffect": "core.removeFlag('poison');\nif (core.hasFlag('weak')) {\n\tcore.removeFlag('weak');\n\tif (core.values.weakValue>=1) { // >=1:直接扣数值\n\t\tcore.status.hero.atk += core.values.weakValue;\n\t\tcore.status.hero.def += core.values.weakValue;\n\t}\n\telse { // <1:扣比例\n\t\tcore.addBuff(\"atk\", core.values.weakValue);\n\t\tcore.addBuff(\"def\", core.values.weakValue);\n\t}\n}\ncore.removeFlag('curse');",
+ "canUseItemEffect": "(function() {\n\treturn core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse');\n})();"
+ },
+ "hammer": {
+ "cls": "tools",
+ "name": "圣锤",
+ "text": "该道具尚未被定义"
+ },
+ "lifeWand": {
+ "cls": "tools",
+ "name": "生命魔杖",
+ "text": "可以恢复100点生命值",
+ "useItemEvent": [
{
"type": "comment",
"text": "先恢复一个魔杖(因为使用道具必须消耗一个)"
@@ -523,6 +488,26 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"输入不合法!"
]
}
- ]
+ ],
+ "canUseItemEffect": "true"
+ },
+ "jumpShoes": {
+ "cls": "tools",
+ "name": "跳跃靴",
+ "text": "能跳跃到前方两格处",
+ "useItemEffect": "core.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });",
+ "canUseItemEffect": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();"
+ },
+ "skill1": {
+ "cls": "constants",
+ "name": "技能:二倍斩",
+ "text": "可以打开或关闭主动技能二倍斩",
+ "hideInReplay": true,
+ "useItemEffect": "// 二倍斩的flag:skill为1\nif (core.getFlag('skill', 0)==0) { // 判断当前是否已经开了技能\n\tif (core.getStatus('mana')>=5) { // 这里要写当前能否开技能的条件判断,比如魔力值至少要多少\n\t\tcore.setFlag('skill', 1); // 开技能1\n\t\tcore.setFlag('skillName', '二倍斩'); // 设置技能名\n\t}\n\telse {\n\t\tcore.drawTip(\"魔力不足,无法开启技能\");\n\t}\n}\nelse { // 关闭技能\n\tcore.setFlag('skill', 0); // 关闭技能状态\n\tcore.setFlag('skillName', '无');\n}",
+ "canUseItemEffect": "true"
+ },
+ "wand": {
+ "cls": "items",
+ "name": "新物品"
}
}
\ No newline at end of file
From b9957b51a4ac0580ef4eea9355fb87b8cfe01193 Mon Sep 17 00:00:00 2001
From: ckcz123
Date: Sat, 23 May 2020 15:43:04 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BD=95=E5=83=8F?=
=?UTF-8?q?=E7=B3=BB=E7=BB=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
_server/editor_mappanel.js | 41 +-------------------------------------
_server/editor_ui.js | 2 +-
libs/control.js | 2 +-
libs/events.js | 3 ++-
4 files changed, 5 insertions(+), 43 deletions(-)
diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js
index 8cce7cc2..160631bf 100644
--- a/_server/editor_mappanel.js
+++ b/_server/editor_mappanel.js
@@ -232,10 +232,7 @@ editor_mappanel_wrapper = function (editor) {
// 左键拖拽: 交换
//tip.whichShow(1);
// editor.movePos(editor.uivalues.startPos, editor.uivalues.endPos);
- if (editor.layerMod == 'map')
- editor.exchangePos(editor.uivalues.startPos, editor.uivalues.endPos);
- else
- editor.exchangeBgFg(editor.uivalues.startPos, editor.uivalues.endPos, editor.layerMod);
+ editor.exchangePos(editor.uivalues.startPos, editor.uivalues.endPos);
editor.uifunctions.unhighlightSaveFloorButton();
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
}
@@ -973,42 +970,6 @@ editor_mappanel_wrapper = function (editor) {
}
}
- editor.constructor.prototype.moveBgFg = function (startPos, endPos, name, callback) {
- if (!startPos || !endPos || ["bgmap","fgmap"].indexOf(name)<0) return;
- if (startPos.x == endPos.x && startPos.y == endPos.y) return;
- editor[name][endPos.y][endPos.x] = editor[name][startPos.y][startPos.x];
- editor[name][startPos.y][startPos.x] = 0;
- editor.updateMap();
- editor.file.saveFloorFile(function (err) {
- if (err) {
- printe(err);
- throw(err)
- }
- ;printf('移动图块成功');
- editor.drawPosSelection();
- if (callback) callback();
- });
- }
-
- editor.constructor.prototype.exchangeBgFg = function (startPos, endPos, name, callback) {
- if (!startPos || !endPos || ["bgmap","fgmap"].indexOf(name)<0) return;
- if (startPos.x == endPos.x && startPos.y == endPos.y) return;
- var value = editor[name][endPos.y][endPos.x];
- editor[name][endPos.y][endPos.x] = editor[name][startPos.y][startPos.x];
- editor[name][startPos.y][startPos.x] = value;
- editor.updateMap();
- editor.file.saveFloorFile(function (err) {
- if (err) {
- printe(err);
- throw(err)
- }
- ;printf('交换图块成功');
- editor.drawPosSelection();
- if (callback) callback();
- });
-
- }
-
editor.constructor.prototype.clearPos = function (clearPos, pos, callback) {
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
pos = pos || editor.pos;
diff --git a/_server/editor_ui.js b/_server/editor_ui.js
index fff57c1b..f545e4ad 100644
--- a/_server/editor_ui.js
+++ b/_server/editor_ui.js
@@ -31,7 +31,7 @@ editor_ui_wrapper = function (editor) {
'ESC或点击空白处可以自动保存当前修改',
'H键可以打开操作帮助哦',
'tileset平铺模式可以在地图上拖动来平铺框选的图形',
- '可以拖动地图上的图块和事件,或按Ctrl+C, Ctrl+X和Ctrl+V进行复制,剪切和粘贴,Delete删除',
+ '可以拖动地图上的图块和事件;或按Ctrl+C, Ctrl+X和Ctrl+V进行复制,剪切和粘贴,Delete删除;右键也可以拉框选择区域',
'Alt+数字键保存图块,数字键读取保存的图块',
];
if (value == null) value = Math.floor(Math.random() * tips.length);
diff --git a/libs/control.js b/libs/control.js
index 3de2103f..b37438f9 100644
--- a/libs/control.js
+++ b/libs/control.js
@@ -730,7 +730,7 @@ control.prototype.waitHeroToStop = function(callback) {
core.setHeroLoc('direction', lastDirection);
core.drawHero();
callback();
- }, core.status.replay.speed == 24 ? 0 : 30);
+ }, core.status.replay.speed == 24 ? 1 : 30);
}
}
diff --git a/libs/events.js b/libs/events.js
index 44b2054f..96c4548b 100644
--- a/libs/events.js
+++ b/libs/events.js
@@ -444,7 +444,8 @@ events.prototype.openDoor = function (x, y, needKey, callback) {
core.removeBlock(x, y);
setTimeout(function () {
core.status.replay.animate = false;
- core.events.afterOpenDoor(id, x, y, callback);
+ core.events.afterOpenDoor(id, x, y);
+ if (callback) callback();
}, 1); // +1是为了录像检测系统
} else {
this._openDoor_animate(id, x, y, callback);
From 2adf9ed5294b409e7d322d8cc03e548077f49f68 Mon Sep 17 00:00:00 2001
From: ckcz123
Date: Sat, 23 May 2020 19:33:12 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E6=8E=A5=E6=A1=A3=E5=B7=A5=E5=85=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
_server/MotaActionParser.js | 4 +-
_server/fs.js | 33 +-
_server/fsTest_cs.html | 49 ++-
_server/table/comment.js | 2 +-
main.js | 7 +
migration.html | 587 +++++++++++++++++++++++++++++++++
project/materials/animates.png | Bin 35445 -> 34472 bytes
project/materials/npcs.png | Bin 20746 -> 20724 bytes
server.py | 41 +++
9 files changed, 679 insertions(+), 44 deletions(-)
create mode 100644 migration.html
diff --git a/_server/MotaActionParser.js b/_server/MotaActionParser.js
index 6acd654f..e60d61c7 100644
--- a/_server/MotaActionParser.js
+++ b/_server/MotaActionParser.js
@@ -1256,7 +1256,7 @@ MotaActionFunctions.pattern.replaceStatusList = [
MotaActionFunctions.pattern.replaceItemList = [];
for (var id in core.material.items) {
var name = core.material.items[id].name;
- if (id && name && name != '新物品') {
+ if (id && name && name != '新物品' && /^[a-zA-Z0-9_\u4E00-\u9FCC]+$/.test(name)) {
MotaActionFunctions.pattern.replaceItemList.push([id, name]);
}
}
@@ -1264,7 +1264,7 @@ MotaActionFunctions.pattern.replaceStatusList = [
MotaActionFunctions.pattern.replaceEnemyList = [];
for (var id in core.material.enemys) {
var name = core.material.enemys[id].name;
- if (id && name && name != '新敌人') {
+ if (id && name && name != '新敌人' && /^[a-zA-Z0-9_\u4E00-\u9FCC]+$/.test(name)) {
MotaActionFunctions.pattern.replaceEnemyList.push([id, name]);
}
}
diff --git a/_server/fs.js b/_server/fs.js
index 0ece7748..d0110304 100644
--- a/_server/fs.js
+++ b/_server/fs.js
@@ -56,7 +56,8 @@
callback(null, data);
}
}, function (e) {
- main.log(e);
+ if (window.main != null && main.log) main.log(e);
+ else console.log(e);
callback(e+":请检查启动服务是否处于正常运行状态。");
}, "text/plain; charset=x-user-defined");
}
@@ -153,15 +154,7 @@
throw 'Type Error in fs.readdir';
var data = '';
data += 'name=' + path;
- postsomething(data, '/makeDir', function (err, data) {
- try {
- data = JSON.parse(data);
- } catch (e) {
- err = "Invalid /makeDir";
- data = null;
- }
- callback(err, data);
- });
+ postsomething(data, '/makeDir', callback);
return;
}
@@ -174,15 +167,7 @@
throw 'Type Error in fs.readdir';
var data = '';
data += 'src=' + src + "&dest=" + dest;
- postsomething(data, '/moveFile', function (err, data) {
- try {
- data = JSON.parse(data);
- } catch (e) {
- err = "Invalid /moveFile";
- data = null;
- }
- callback(err, data);
- });
+ postsomething(data, '/moveFile', callback);
return;
}
@@ -195,15 +180,7 @@
throw 'Type Error in fs.readdir';
var data = '';
data += 'name=' + path;
- postsomething(data, '/deleteFile', function (err, data) {
- try {
- data = JSON.parse(data);
- } catch (e) {
- err = "Invalid /deleteFile";
- data = null;
- }
- callback(err, data);
- });
+ postsomething(data, '/deleteFile', callback);
return;
}
})();
\ No newline at end of file
diff --git a/_server/fsTest_cs.html b/_server/fsTest_cs.html
index 9a392e4a..0da50c14 100644
--- a/_server/fsTest_cs.html
+++ b/_server/fsTest_cs.html
@@ -7,40 +7,63 @@
+HTML5魔塔样板V2.7接档工具
+
+
+
+
+
+
+
+
+
+
+
+
+请严格按照如下流程,一步步进行接档操作。请勿随意增删接档过程,以免出现编辑器白屏、闪退等情况。
+
+
+
+ - 做好备份,做好备份,做好备份!!!接档前请一定先做好备份!
+ - 使用RM转H5刻塔器所刻的塔不适用于此接档工具。
+ - 将V2.6.6样板中project目录下,除了
project/functions.js和project/plugins.js以外的其他文件和文件夹,直接复制到最新的V2.7样板中,然后打开本接档工具。
+ - 点击上述的「点此一键接档」,并看到红字提示接档成功。此时编辑器应该可以正常打开。若此时无法打开编辑器请联系小艾处理。
+ - 下拉框切到「全塔属性」,并注意以下内容:
+
+ - 现在素材和使用的其他图片等在文件夹中被拆分,请检查对应的图片文件已经正确移动到对应的文件夹。
+ - 「难度选择项」的逻辑在V2.7中被修改;请重新制作。
+ - 「全局商店」的结构在V2.7中被修改;请重新制作。
+ - 部分方框进行了合并,请一个个仔细检查是否存在问题。
+
+
+ - 下拉框切到「楼层属性」,并注意以下内容:
+
+ item_ratio被重命名为ratio,请自行修改。
+ - 楼层贴图的结构在V2.7中被修改;请重新制作。
+
+
+ - 素材区的如下图块有所变动:
+
+ - 三色墙和六色门从terrains中解除引用;请用animates中的进行绘制。
+ - 如下图块的图块属性已被重置:三色墙、六色门、四色网、四个单向箭头、亮灯。
+ - 所有的
noPass:false都改成canPass:true;请仔细检查可通行性。
+ - 如下道具的道具属性已被重置,请仔细检查:三色钥匙、四色宝石(已改名Gem)、四色血瓶、破墙、破冰、炸弹、地震、冰冻、大黄门钥匙、上下楼器。
+ - 即时道具获得的说明和提示文字均改成了
${}计算,ratio需写明全称(参见宝石血瓶写法),请自行处理。
+ - npc48的默认动画帧数
null改回为4;如需静止状态请手动改成1。
+
+
+ - 下拉框切换到「脚本编辑」,并请重新编辑各个自己改过的函数(可以双开一个原版V266项目和当前接档的项目进行处理)。
+
+ - 请注意:V2.7中的经验全部从
experience替换成简写的exp;写伤害计算等时请尤其注意。
+ - 部分文案有所改变,如「阻击」从
snipe改名repulse,shoes改名amulet等等,请自行处理。
+ setInitData已被删除,请将需要的额外初始化代码写入startText中。
+ afterChangeLight, afterUseBomb, afterPassNet已被删除,请去对应图块属性内修改。
+ - 其他基本每个函数都有大幅修改,请勿直接拿原来的脚本整体覆盖,而是重新对函数进行需要的编辑!
+
+
+ - 下拉框切换到「插件编写」,并重新新增自己加过的插件。
+
+ - V2.7不能保证插件的兼容性,请谨慎测试。
+ - 如果插件出现不可用问题,请自行联系插件原作者更新插件到支持V2.7的版本。
+
+
+ - 请仔细检查每个道具的道具效果、每个怪物的属性、每个楼层属性、以及每个点的事件(建议双开对比)。主要变动如下:
+
+ - 「数值增减」事件已被删除并被数值操作+运算符替代,编辑器将解析为自定义事件;但是游戏中仍然可以正确执行(你可以选择替换与否)。
+ - 「隐藏事件」将不再默认删除该点(而只是纯粹的隐藏);请给有需要的「隐藏事件」勾选「同时删除」选项。
+ - 「绘制圆」「绘制圆边框」「重启当前事件」已经被删除,并且无法再在游戏中使用,请替换成等价的写法。
+
+
+ - 接档后请做好充分的测试!最好能跑通录像以确认接档无误!
+
+
+
+
+
+
diff --git a/_server/table/comment.js b/_server/table/comment.js
index 9a88381c..698cf390 100644
--- a/_server/table/comment.js
+++ b/_server/table/comment.js
@@ -335,7 +335,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "select",
"_select": {
- "values": [1,2,3,4],
+ "values": [null,1,2,3,4],
},
"_docs": "动画帧数",
"_data": "null代表素材默认帧数"
diff --git a/main.js b/main.js
index 7f502e20..57e258ef 100644
--- a/main.js
+++ b/main.js
@@ -197,6 +197,13 @@ main.prototype.init = function (mode, callback) {
main.mode = mode;
main.loadJs('project', main.pureData, function(){
+ if (items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect
+ && items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip) {
+ alert('即将跳转到接档工具...');
+ window.location = 'migration.html';
+ return;
+ }
+
var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
for(var ii in mainData)main[ii]=mainData[ii];
diff --git a/migration.html b/migration.html
new file mode 100644
index 00000000..7655fda3
--- /dev/null
+++ b/migration.html
@@ -0,0 +1,587 @@
+
+
+