diff --git a/_server/editor.js b/_server/editor.js
index 425de609..d6130e83 100644
--- a/_server/editor.js
+++ b/_server/editor.js
@@ -20,25 +20,25 @@ editor.prototype.init = function(callback){
if (Boolean(callback))callback();
});
}
+
var afterMainInit = function(){
editor.main=main;
editor.core=core;
editor.fs=fs;
- editor_file = editor_file(editor);
- editor.file=editor_file;
- editor_mode = editor_mode(editor);
- editor.mode=editor_mode;
- editor.material.images=core.material.images;
- editor.listen(); // 开始监听事件
- var hard = 'Hard';
- core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, null, core.initStatus.maps);
- //core.status.maps = core.clone(core.maps.initMaps(floorIds));
- core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
- afterCoreReset();
- }, true);
- core.events.setInitData(hard);
+ editor_file = editor_file(editor, function() {
+ editor.file=editor_file;
+ editor_mode = editor_mode(editor);
+ editor.mode=editor_mode;
+ editor.material.images=core.material.images;
+ editor.listen(); // 开始监听事件
+ core.resetStatus(core.firstData.hero, null, core.firstData.floorId, null, core.initStatus.maps);
+ core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
+ afterCoreReset();
+ }, true);
+ core.events.setInitData(null);
+ });
}
- setTimeout(afterMainInit, 500);
+ afterMainInit();
}
editor.prototype.reset = function(callback){
diff --git a/_server/editor_file.js b/_server/editor_file.js
index 741e5d0f..ce340d8a 100644
--- a/_server/editor_file.js
+++ b/_server/editor_file.js
@@ -1,7 +1,9 @@
-editor_file = function(editor){
+editor_file = function(editor, callback){
var editor_file = {};
+
+
(function(){
var script = document.createElement('script');
if (window.location.href.indexOf('_server')!==-1)
@@ -12,6 +14,8 @@ editor_file = function(editor){
script.onload = function () {
editor_file.comment=comment_c456ea59_6018_45ef_8bcc_211a24c627dc;
delete(comment_c456ea59_6018_45ef_8bcc_211a24c627dc);
+ if (editor_file.comment && editor_file.dataComment && callback)
+ callback();
}
})();
(function(){
@@ -24,6 +28,8 @@ editor_file = function(editor){
script.onload = function () {
editor_file.dataComment=data_comment_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d;
delete(data_comment_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d);
+ if (editor_file.comment && editor_file.dataComment && callback)
+ callback();
}
})();
diff --git a/editor.html b/editor.html
index 9fabf604..6cde4cea 100644
--- a/editor.html
+++ b/editor.html
@@ -321,19 +321,21 @@ function hasOwnProp (obj, key) {
diff --git a/libs/core.js b/libs/core.js
index 30de90c1..fc595cc4 100644
--- a/libs/core.js
+++ b/libs/core.js
@@ -151,7 +151,7 @@ function core() {
/////////// 系统事件相关 ///////////
////// 初始化 //////
-core.prototype.init = function (coreData) {
+core.prototype.init = function (coreData, callback) {
for (var key in coreData) {
core[key] = coreData[key];
}
@@ -281,6 +281,9 @@ core.prototype.init = function (coreData) {
core.material.icons.hero.height = core.material.images.hero.height/4;
core.setRequestAnimationFrame();
core.showStartAnimate();
+
+ if (core.isset(callback)) callback();
+
});
}
diff --git a/libs/items.js b/libs/items.js
index df582f25..cc16999a 100644
--- a/libs/items.js
+++ b/libs/items.js
@@ -41,6 +41,7 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
var itemCls = core.material.items[itemId].cls;
// 消耗品
if (itemCls === 'items') {
+ var ratio = parseInt(core.floors[core.status.floorId].item_ratio) || 1;
if (itemId in this.itemEffect)eval(this.itemEffect[itemId]);
}
else {
@@ -50,6 +51,7 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
////// “即捡即用类”道具的文字提示 //////
items.prototype.getItemEffectTip = function(itemId) {
+ var ratio = parseInt(core.floors[core.status.floorId].item_ratio) || 1;
if (itemId in this.itemEffectTip && (!this.items[itemId].isEquipment || !core.flags.equipment)) {
return eval(this.itemEffectTip[itemId]);
}
diff --git a/main.js b/main.js
index 314dee38..693472b1 100644
--- a/main.js
+++ b/main.js
@@ -106,11 +106,10 @@ function main() {
'hard': document.getElementById("hard")
}
this.floors = {}
- this.instance = {};
this.canvas = {};
}
-main.prototype.init = function (mode) {
+main.prototype.init = function (mode, callback) {
for (var i = 0; i < main.dom.gameCanvas.length; i++) {
main.canvas[main.dom.gameCanvas[i].id] = main.dom.gameCanvas[i].getContext('2d');
}
@@ -156,7 +155,7 @@ main.prototype.init = function (mode) {
"animates", "bgms", "sounds", "floorIds", "floors"].forEach(function (t) {
coreData[t] = main[t];
})
- main.core.init(coreData);
+ main.core.init(coreData, callback);
main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
});
});
@@ -213,7 +212,6 @@ main.prototype.loadMod = function (modName, callback) {
script.src = 'libs/' + modName + (this.useCompress?".min":"") + '.js?v=' + this.version;
main.dom.body.appendChild(script);
script.onload = function () {
- main[name] = main.instance[name];
callback(name);
}
}
diff --git a/project/comment.js b/project/comment.js
index 12267989..4bf4c47e 100644
--- a/project/comment.js
+++ b/project/comment.js
@@ -43,6 +43,7 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"weather": "该层的默认天气。本项可忽略表示晴天,如果写则第一项为\"rain\"或\"snow\"代表雨雪,第二项为1-10之间的数代表强度。 \n$leaf(true)$end",
"bgm": "到达该层后默认播放的BGM。本项可忽略。 ",
//"map": "地图数据,需要是13x13,建议使用地图生成器来生成 ",
+ "item_ratio": "每一层的宝石/血瓶效果,即获得宝石和血瓶时框内\"ratio\"的值。",
"firstArrive": "第一次到该楼层触发的事件 \n$leaf(true)$end",
},
'loc' : {
diff --git a/project/floors/MT0.js b/project/floors/MT0.js
index 1c51393b..dc4996fe 100644
--- a/project/floors/MT0.js
+++ b/project/floors/MT0.js
@@ -13,6 +13,7 @@ main.floors.MT0 =
// "color": [0,0,0,0.3], // 该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组。
// "weather": ["snow",5], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪,第二项为1-10之间的数代表强度。
// "bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。
+ "item_ratio": 1, // 该层的宝石/血瓶倍率
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
],
diff --git a/project/floors/sample0.js b/project/floors/sample0.js
index 3cbd4a72..d5815cc9 100644
--- a/project/floors/sample0.js
+++ b/project/floors/sample0.js
@@ -13,6 +13,7 @@ main.floors.sample0 =
// "color": [0,0,0,0.3] // 该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组。
// "weather": ["snow",5], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪,第二项为1-10之间的数代表强度。
"bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。
+ "item_ratio": 2, // 该层的宝石/血瓶倍率
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
[0, 0, 220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42],
[0, 246, 0, 246, 0, 20, 0, 3, 58, 59, 60, 61, 41],
diff --git a/project/floors/sample1.js b/project/floors/sample1.js
index 8764489d..08ce590e 100644
--- a/project/floors/sample1.js
+++ b/project/floors/sample1.js
@@ -13,6 +13,7 @@ main.floors.sample1 =
// "color": [0,0,0,0.3] // 该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组。
"weather": ["snow",6], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪,第二项为1-10之间的数代表强度。
// "bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。
+ "item_ratio": 1, // 该层的宝石/血瓶倍率
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
[7, 131, 8, 152, 9, 130, 10, 152, 166, 165, 132, 165, 166],
[0, 0, 0, 0, 0, 0, 0, 152, 165, 164, 0, 162, 165],
diff --git a/project/floors/sample2.js b/project/floors/sample2.js
index 4b496b83..233473a0 100644
--- a/project/floors/sample2.js
+++ b/project/floors/sample2.js
@@ -13,6 +13,7 @@ main.floors.sample2 =
"color": [255,0,0,0.3], // 该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组。
"weather": ["rain",10], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪,第二项为1-10之间的数代表强度。
"bgm": "qianjin.mid", // 到达该层后默认播放的BGM。本项可忽略。
+ "item_ratio": 1, // 该层的宝石/血瓶倍率
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
[5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
[5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
diff --git a/project/floors/test.js b/project/floors/test.js
deleted file mode 100644
index e2452d33..00000000
--- a/project/floors/test.js
+++ /dev/null
@@ -1,46 +0,0 @@
-main.floors.test =
-{
- "floorId": "test", // 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
- // 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
- // 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
- // 楼层唯一标识符,需要和名字完全一致
- "title": "test", // 楼层中文名
- "name": "", // 显示在状态栏中的层数
- "canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
- "canUseQuickShop": true, // 该层是否允许使用快捷商店
- "defaultGround": "ground", // 默认地面的图块ID(terrains中)
- "map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201,201,201,201,201,201,201,201],
- [201,201,201,201,201,201, 45,201,201,201,201,201,201],
- [201,201,201,201,201,201, 0,201,201,201,201,201,201]
- ],
- "firstArrive": [ // 第一次到该楼层触发的事件
-
- ],
- "events": { // 该楼的所有可能事件列表
-
- },
- "changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
-
- },
- "afterBattle": { // 战斗后可能触发的事件列表
-
- },
- "afterGetItem": { // 获得道具后可能触发的事件列表
-
- },
- "afterOpenDoor": { // 开完门后可能触发的事件列表
-
- }
-}
-
diff --git a/project/items.js b/project/items.js
index 84bbcbf7..b68555f5 100644
--- a/project/items.js
+++ b/project/items.js
@@ -62,16 +62,16 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"itemEffect" : {
- "redJewel":"core.status.hero.atk += core.values.redJewel",
- "blueJewel":"core.status.hero.def += core.values.blueJewel",
- "greenJewel":"core.status.hero.mdef += core.values.greenJewel",
+ "redJewel":"core.status.hero.atk += core.values.redJewel * ratio",
+ "blueJewel":"core.status.hero.def += core.values.blueJewel * ratio",
+ "greenJewel":"core.status.hero.mdef += core.values.greenJewel * ratio",
"yellowJewel":"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",
- "bluePotion":"core.status.hero.hp += core.values.bluePotion",
- "yellowPotion":"core.status.hero.hp += core.values.yellowPotion",
- "greenPotion":"core.status.hero.hp += core.values.greenPotion",
+ "redPotion":"core.status.hero.hp += core.values.redPotion * ratio",
+ "bluePotion":"core.status.hero.hp += core.values.bluePotion * ratio",
+ "yellowPotion":"core.status.hero.hp += core.values.yellowPotion * ratio",
+ "greenPotion":"core.status.hero.hp += core.values.greenPotion * ratio",
"sword1":"core.status.hero.atk += core.values.sword1",
"sword2":"core.status.hero.atk += core.values.sword2",
"sword3":"core.status.hero.atk += core.values.sword3",
@@ -91,14 +91,14 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"itemEffectTip" : {
- "redJewel":"',攻击+'+core.values.redJewel",
- "blueJewel":"',防御+'+core.values.blueJewel",
- "greenJewel":"',魔防+'+core.values.greenJewel",
+ "redJewel":"',攻击+'+core.values.redJewel * ratio",
+ "blueJewel":"',防御+'+core.values.blueJewel * ratio",
+ "greenJewel":"',魔防+'+core.values.greenJewel * ratio",
"yellowJewel":"',全属性提升'",
- "redPotion":"',生命+'+core.values.redPotion",
- "bluePotion":"',生命+'+core.values.bluePotion",
- "yellowPotion":"',生命+'+core.values.yellowPotion",
- "greenPotion":"',生命+'+core.values.greenPotion",
+ "redPotion":"',生命+'+core.values.redPotion * ratio",
+ "bluePotion":"',生命+'+core.values.bluePotion * ratio",
+ "yellowPotion":"',生命+'+core.values.yellowPotion * ratio",
+ "greenPotion":"',生命+'+core.values.greenPotion * ratio",
"sword1":"',攻击+'+core.values.sword1",
"sword2":"',攻击+'+core.values.sword2",
"sword3":"',攻击+'+core.values.sword3",