Merge pull request #241 from ckcz123/v2.0
Console Detector & Save Protect
This commit is contained in:
commit
a347eba21c
@ -225,6 +225,17 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
]
|
||||
},
|
||||
"_data": "该图块是否不可通行;true代表不可通行,false代表可通行,null代表使用系统缺省值"
|
||||
},
|
||||
"canBreak": {
|
||||
"_leaf": true,
|
||||
"_type": "select",
|
||||
"_select": {
|
||||
"values": [
|
||||
true,
|
||||
false
|
||||
]
|
||||
},
|
||||
"_data": "该图块是否可被破炸;true代表可以,false代表不可以"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -190,6 +190,11 @@ control.prototype.setRequestAnimationFrame = function () {
|
||||
// 执行用户的并行事件处理内容
|
||||
functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.plugins.parallelDo(timestamp);
|
||||
|
||||
// 检查控制台状态
|
||||
if (core.utils.consoleOpened()) {
|
||||
core.setFlag('consoleOpened', true);
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(draw);
|
||||
}
|
||||
window.requestAnimationFrame(draw);
|
||||
@ -2213,7 +2218,12 @@ control.prototype.doSL = function (id, type) {
|
||||
}
|
||||
}, function(err) {
|
||||
console.info(err);
|
||||
core.drawTip("存档失败,请将控制台的报错信息反馈给管理员。");
|
||||
if (core.platform.useLocalForage) {
|
||||
alert("存档失败,请将控制台的报错信息反馈给管理员。");
|
||||
}
|
||||
else {
|
||||
alert("存档空间不足,请先使用垃圾存档清理工具进行清理!");
|
||||
}
|
||||
})
|
||||
return;
|
||||
}
|
||||
@ -2222,7 +2232,11 @@ control.prototype.doSL = function (id, type) {
|
||||
|
||||
core.getLocalForage(id=='autoSave'?id:"save"+id, null, function(data) {
|
||||
if (!core.isset(data)) {
|
||||
core.drawTip("无效的存档");
|
||||
alert("无效的存档");
|
||||
return;
|
||||
}
|
||||
if (core.isset(data.hashCode) && data.hashCode != core.utils.hashCode(data.hero)) {
|
||||
alert("存档校验失败,请勿修改存档文件!");
|
||||
return;
|
||||
}
|
||||
if (data.version != core.firstData.version) {
|
||||
@ -2250,7 +2264,7 @@ control.prototype.doSL = function (id, type) {
|
||||
});
|
||||
}, function(err) {
|
||||
console.log(err);
|
||||
core.drawTip("无效的存档");
|
||||
alert("无效的存档");
|
||||
})
|
||||
|
||||
return;
|
||||
@ -2270,6 +2284,10 @@ control.prototype.doSL = function (id, type) {
|
||||
core.drawTip("游戏难度不匹配!");
|
||||
return;
|
||||
}
|
||||
if (core.isset(data.hashCode) && data.hashCode != core.utils.hashCode(data.hero)) {
|
||||
alert("存档校验失败,请勿修改存档文件!");
|
||||
return;
|
||||
}
|
||||
var route = core.subarray(core.status.route, core.decodeRoute(data.route));
|
||||
if (!core.isset(route) || data.hero.flags.seed!=core.getFlag('seed')) {
|
||||
core.drawTip("无法从此存档回放录像");
|
||||
@ -2389,16 +2407,20 @@ control.prototype.syncLoad = function () {
|
||||
|
||||
////// 存档到本地 //////
|
||||
control.prototype.saveData = function() {
|
||||
var hero = core.clone(core.status.hero);
|
||||
var hashCode = core.utils.hashCode(hero);
|
||||
|
||||
var data = {
|
||||
'floorId': core.status.floorId,
|
||||
'hero': core.clone(core.status.hero),
|
||||
'hero': hero,
|
||||
'hard': core.status.hard,
|
||||
'maps': core.maps.save(core.status.maps),
|
||||
'route': core.encodeRoute(core.status.route),
|
||||
'values': core.clone(core.values),
|
||||
'shops': {},
|
||||
'version': core.firstData.version,
|
||||
"time": new Date().getTime()
|
||||
"time": new Date().getTime(),
|
||||
"hashCode": hashCode
|
||||
};
|
||||
// set shop times
|
||||
for (var shop in core.status.shops) {
|
||||
|
||||
@ -169,7 +169,7 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
|
||||
if (nextAtk!=pre) {
|
||||
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;
|
||||
list.push([nextAtk-hero_atk,info.damage-nextInfo.damage]);
|
||||
list.push([nextAtk-hero_atk,Math.floor(info.damage-nextInfo.damage)]);
|
||||
if (nextInfo.damage<=0 && !core.flags.enableNegativeDamage) break;
|
||||
pre = nextAtk;
|
||||
}
|
||||
@ -184,7 +184,7 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
|
||||
if (nextInfo==null) break;
|
||||
if (pre>nextInfo.damage) {
|
||||
pre = nextInfo.damage;
|
||||
list.push([atk-hero_atk, info.damage-nextInfo.damage]);
|
||||
list.push([atk-hero_atk, Math.floor(info.damage-nextInfo.damage)]);
|
||||
if (nextInfo.damage<=0 && !core.flags.enableNegativeDamage) break;
|
||||
if (list.length>=number) break;
|
||||
}
|
||||
|
||||
@ -242,6 +242,11 @@ events.prototype.gameOver = function (ending, fromReplay, norank) {
|
||||
core.restart();
|
||||
})
|
||||
}
|
||||
else if (core.hasFlag('consoleOpened')) {
|
||||
core.drawText("\t[系统提示]本存档开启过控制台,无法上传成绩", function () {
|
||||
core.restart();
|
||||
})
|
||||
}
|
||||
else {
|
||||
confirmUpload();
|
||||
}
|
||||
@ -1420,10 +1425,11 @@ events.prototype.moveImage = function (image, from, to, time, keep, callback) {
|
||||
var fromX = core.calValue(from[0]), fromY = core.calValue(from[1]),
|
||||
toX = core.calValue(to[0]), toY = core.calValue(to[1]);
|
||||
var step = 0;
|
||||
var per_time = 10, steps = parseInt(time / per_time);
|
||||
var drawImage = function () {
|
||||
core.clearMap('data');
|
||||
var nowX = parseInt(fromX + (toX-fromX)*step/64);
|
||||
var nowY = parseInt(fromY + (toY-fromY)*step/64);
|
||||
var nowX = parseInt(fromX + (toX-fromX)*step/steps);
|
||||
var nowY = parseInt(fromY + (toY-fromY)*step/steps);
|
||||
core.canvas.data.drawImage(image, nowX, nowY);
|
||||
}
|
||||
|
||||
@ -1431,14 +1437,14 @@ events.prototype.moveImage = function (image, from, to, time, keep, callback) {
|
||||
var animate = setInterval(function () {
|
||||
step++;
|
||||
drawImage();
|
||||
if (step>=64) {
|
||||
if (step>=steps) {
|
||||
clearInterval(animate);
|
||||
core.clearMap('data');
|
||||
core.status.replay.animate=false;
|
||||
if (keep) core.canvas.data.drawImage(image, toX, toY);
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
}, time / 64);
|
||||
}, per_time);
|
||||
}
|
||||
|
||||
////// 淡入淡出音乐 //////
|
||||
|
||||
41
libs/ui.js
41
libs/ui.js
@ -1443,6 +1443,43 @@ ui.prototype.drawBookDetail = function (index) {
|
||||
if (hints.length==0)
|
||||
hints.push("该怪物无特殊属性。");
|
||||
|
||||
// 模仿临界计算器
|
||||
if (core.enemys.hasSpecial(core.material.enemys[enemyId].special, 10)) {
|
||||
var hp = core.material.enemys[enemyId].hp;
|
||||
var delta = core.status.hero.atk - core.status.hero.def;
|
||||
if (delta<hp && hp<=10000 && hp>0) {
|
||||
hints.push("");
|
||||
hints.push("模仿临界计算器:(当前攻防差"+core.formatBigNumber(delta)+")");
|
||||
var arr = [];
|
||||
(function () {
|
||||
var last=0, start=0;
|
||||
for (var i=1;i<hp;i++) {
|
||||
var now=parseInt((hp-1)/i);
|
||||
if (now!=last) {
|
||||
if (last!=0) {
|
||||
arr.push([start, last+"x"]);
|
||||
}
|
||||
last=now;
|
||||
start=i;
|
||||
}
|
||||
}
|
||||
if (last!=0) {
|
||||
arr.push([start,"1x"]);
|
||||
arr.push([hp,"0"]);
|
||||
}
|
||||
})();
|
||||
var u = [];
|
||||
arr.forEach(function (t) {
|
||||
if (u.length < 20) u.push(t);
|
||||
else if (Math.abs(t[0]-delta)<Math.abs(u[0][0]-delta)) {
|
||||
u.shift();
|
||||
u.push(t);
|
||||
}
|
||||
});
|
||||
hints.push(JSON.stringify(u.map(function (v) {return v[0]+":"+v[1];})));
|
||||
}
|
||||
}
|
||||
|
||||
// 吸血怪的最低生命值
|
||||
if (core.enemys.hasSpecial(core.material.enemys[enemyId].special, 11)) {
|
||||
var damage = core.getDamage(enemyId);
|
||||
@ -1989,7 +2026,7 @@ ui.prototype.drawSLPanel = function(index, refresh) {
|
||||
core.strokeRect('ui', (2*i+1)*u-size/2, 50, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
|
||||
if (core.isset(data) && core.isset(data.floorId)) {
|
||||
core.ui.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
|
||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, '#FFFFFF', '10px Verdana');
|
||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, data.hero.flags.consoleOpened?'#FF6A6A':'#FFFFFF', '10px Verdana');
|
||||
}
|
||||
else {
|
||||
core.fillRect('ui', (2*i+1)*u-size/2, 50, size, size, '#333333', 2);
|
||||
@ -2001,7 +2038,7 @@ ui.prototype.drawSLPanel = function(index, refresh) {
|
||||
core.strokeRect('ui', (2*i-5)*u-size/2, 245, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
|
||||
if (core.isset(data) && core.isset(data.floorId)) {
|
||||
core.ui.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
|
||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, '#FFFFFF', '10px Verdana');
|
||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, data.hero.flags.consoleOpened?'#FF6A6A':'#FFFFFF', '10px Verdana');
|
||||
}
|
||||
else {
|
||||
core.fillRect('ui', (2*i-5)*u-size/2, 245, size, size, '#333333', 2);
|
||||
|
||||
@ -127,8 +127,12 @@ utils.prototype.removeLocalStorage = function (key) {
|
||||
utils.prototype.setLocalForage = function (key, value, successCallback, errorCallback) {
|
||||
|
||||
if (!core.platform.useLocalForage) {
|
||||
this.setLocalStorage(key, value);
|
||||
if (core.isset(successCallback)) successCallback();
|
||||
if (this.setLocalStorage(key, value)) {
|
||||
if (core.isset(successCallback)) successCallback();
|
||||
}
|
||||
else {
|
||||
if (core.isset(errorCallback)) errorCallback();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -722,6 +726,29 @@ utils.prototype.hide = function (obj, speed, callback) {
|
||||
}, speed);
|
||||
}
|
||||
|
||||
utils.prototype.consoleOpened = function () {
|
||||
var threshold = 160;
|
||||
var widthThreshold = window.outerWidth - window.innerWidth > threshold;
|
||||
var heightThreshold = window.outerHeight - window.innerHeight > threshold;
|
||||
return !(heightThreshold && widthThreshold) &&
|
||||
((window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized)
|
||||
|| widthThreshold || heightThreshold);
|
||||
}
|
||||
|
||||
utils.prototype.hashCode = function (obj) {
|
||||
if (typeof obj == 'string') {
|
||||
var hash = 0, i, chr;
|
||||
if (obj.length === 0) return hash;
|
||||
for (i = 0; i < obj.length; i++) {
|
||||
chr = obj.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash |= 0;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
return this.hashCode(JSON.stringify(obj).split("").sort().join(""));
|
||||
}
|
||||
|
||||
utils.prototype._export = function (floorIds) {
|
||||
if (!core.isset(floorIds)) floorIds = [core.status.floorId];
|
||||
else if (floorIds=='all') floorIds = core.clone(core.floorIds);
|
||||
|
||||
@ -59,7 +59,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "铁剑",
|
||||
"text": "一把很普通的铁剑",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 10,
|
||||
"animate": "sword"
|
||||
@ -69,7 +69,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "银剑",
|
||||
"text": "一把很普通的银剑",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 20,
|
||||
"animate": "sword"
|
||||
@ -79,7 +79,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "骑士剑",
|
||||
"text": "一把很普通的骑士剑",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 40,
|
||||
"animate": "sword"
|
||||
@ -89,7 +89,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "圣剑",
|
||||
"text": "一把很普通的圣剑",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 80,
|
||||
"animate": "sword"
|
||||
@ -99,7 +99,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "神圣剑",
|
||||
"text": "一把很普通的神圣剑",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 100,
|
||||
"animate": "sword"
|
||||
@ -118,7 +118,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "铁盾",
|
||||
"text": "一个很普通的铁盾",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 10
|
||||
}
|
||||
@ -127,7 +127,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "银盾",
|
||||
"text": "一个很普通的银盾",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 20
|
||||
}
|
||||
@ -136,7 +136,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "骑士盾",
|
||||
"text": "一个很普通的骑士盾",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 40
|
||||
}
|
||||
@ -145,7 +145,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "圣盾",
|
||||
"text": "一个很普通的圣盾",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 80
|
||||
}
|
||||
@ -154,11 +154,11 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "items",
|
||||
"name": "神圣盾",
|
||||
"text": "一个很普通的神圣盾",
|
||||
"equip":{
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 100,
|
||||
"mdef": 100
|
||||
},
|
||||
}
|
||||
},
|
||||
"superPotion": {
|
||||
"cls": "items",
|
||||
@ -287,7 +287,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "tools",
|
||||
"name": "跳跃靴",
|
||||
"text": "能跳跃到前方两格处"
|
||||
},
|
||||
}
|
||||
},
|
||||
"itemEffect": {
|
||||
"redJewel": "core.status.hero.atk += core.values.redJewel * ratio",
|
||||
@ -342,36 +342,36 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"useItemEffect": {
|
||||
"book": "core.ui.drawBook(0);",
|
||||
"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 core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"pickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"snow": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
||||
"hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
||||
"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});",
|
||||
"pickaxe": "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.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.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.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"bomb": "core.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.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});",
|
||||
"centerFly": "core.clearMap('hero');\ncore.setHeroLoc('x', (core.bigmap.width||13)-1-core.getHeroLoc('x'));\ncore.setHeroLoc('y', (core.bigmap.height||13)-1-core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
||||
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
||||
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
||||
"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});",
|
||||
"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});",
|
||||
"poisonWine": "core.setFlag('poison', false);",
|
||||
"weakWine": "core.setFlag('weak', false);\ncore.status.hero.atk += core.getFlag('weakAtk', core.values.weakValue);\ncore.status.hero.def += core.getFlag('weakDef', core.values.weakValue);",
|
||||
"curseWine": "core.setFlag('curse', false);",
|
||||
"superWine": "core.setFlag('poison', false);\nif (core.hasFlag('weak')) {\n core.setFlag('weak', false);\n core.status.hero.atk += core.getFlag('weakAtk', core.values.weakValue);\n core.status.hero.def += core.getFlag('weakDef', core.values.weakValue);\n}\ncore.setFlag('curse', false);",
|
||||
"lifeWand": "core.insertAction([\n\t{\"type\": \"input\", \"text\": \"请输入生命魔杖使用次数:(0-${item:lifeWand})\"},\n\t{\"type\": \"if\", \"condition\": \"flag:input<=item:lifeWand\",\n\t\t\"true\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"item:lifeWand\", \"value\": \"item:lifeWand-flag:input\"},\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+flag:input*100\"},\n\t\t\t\"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。\"\n\t\t],\n\t\t\"false\": [\"输入不合法!\"]\n\t},\n]);\ncore.setItem('lifeWand', core.itemCount('lifeWand')+1);",
|
||||
"superWine": "core.setFlag('poison', false);\nif (core.hasFlag('weak')) {\n\tcore.setFlag('weak', false);\n\tcore.status.hero.atk += core.getFlag('weakAtk', core.values.weakValue);\n\tcore.status.hero.def += core.getFlag('weakDef', core.values.weakValue);\n}\ncore.setFlag('curse', false);",
|
||||
"lifeWand": "core.insertAction([\n\t{\"type\": \"input\", \"text\": \"请输入生命魔杖使用次数:(0-${item:lifeWand})\"},\n\t{\"type\": \"if\", \"condition\": \"flag:input<=item:lifeWand\",\n\t\t\"true\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"item:lifeWand\", \"value\": \"item:lifeWand-flag:input\"},\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+flag:input*100\"},\n\t\t\t\"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。\"\n\t\t],\n\t\t\"false\": [\"输入不合法!\"]\n\t},\n]);\ncore.addItem('lifeWand', 1);",
|
||||
"jumpShoes": "core.insertAction({\"type\":\"jumpHero\",\"loc\":[core.nextX(2),core.nextY(2)]});"
|
||||
},
|
||||
"canUseItemEffect": {
|
||||
"book": "true",
|
||||
"fly": "core.status.hero.flyRange.indexOf(core.status.floorId)>=0",
|
||||
"pickaxe": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1\n\t\t&& (block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙\n\t{\n\t\t// 四个方向\n\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||
"pickaxe": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1 && \n\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) { // 能破哪些墙\n\t\t// 四个方向\n\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||
"icePickaxe": "var able=false;\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\tcore.status.event.data = [i];\n\t\table=true;\n\t}\n}\nable",
|
||||
"bomb": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||
"hammer": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||
"earthquake": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !block.disable && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) // 能炸的墙壁\n ids.push(i);\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
||||
"bomb": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && Math.abs(block.x-core.getHeroLoc('x'))+Math.abs(block.y-core.getHeroLoc('y'))<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||
"hammer": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && Math.abs(block.x-core.getHeroLoc('x'))+Math.abs(block.y-core.getHeroLoc('y'))<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||
"earthquake": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable &&\n\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) { // 能炸的墙壁\n\t\tids.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nable",
|
||||
"centerFly": "var toX = (core.bigmap.width||13)-1-core.getHeroLoc('x'), toY = (core.bigmap.height||13)-1-core.getHeroLoc('y');\ncore.getBlockId(toX, toY) == null",
|
||||
"upFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index<core.floorIds.length-1) {\n\tvar toId = core.floorIds[index+1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tvar mw = core.floors[toId].width||13, mh = core.floors[toId].height||13;\n\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
|
||||
"downFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index>0) {\n\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tvar mw = core.floors[toId].width||13, mh = core.floors[toId].height||13;\n\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
|
||||
"snow": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||
"bigKey": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !block.disable && block.event.id == 'yellowDoor') {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
||||
"snow": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.id == 'lava' && Math.abs(block.x-core.getHeroLoc('x'))+Math.abs(block.y-core.getHeroLoc('y'))<=1) {\n\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable",
|
||||
"bigKey": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.id == 'yellowDoor') {\n\t\tids.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nable",
|
||||
"poisonWine": "core.hasFlag('poison')",
|
||||
"weakWine": "core.hasFlag('weak')",
|
||||
"curseWine": "core.hasFlag('curse')",
|
||||
|
||||
@ -3,9 +3,9 @@ maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
////////////////////////// 地形部分 //////////////////////////
|
||||
|
||||
// 0-20 地形
|
||||
'1':{'cls': 'terrains', 'id': 'yellowWall'}, // 黄墙
|
||||
'2':{'cls': 'terrains', 'id': 'whiteWall'}, // 白墙
|
||||
'3':{'cls': 'terrains', 'id': 'blueWall'}, // 蓝墙
|
||||
'1':{'cls': 'terrains', 'id': 'yellowWall', 'canBreak': true}, // 黄墙
|
||||
'2':{'cls': 'terrains', 'id': 'whiteWall', 'canBreak': true}, // 白墙
|
||||
'3':{'cls': 'terrains', 'id': 'blueWall', 'canBreak': true}, // 蓝墙
|
||||
'4':{'cls': 'animates', 'id': 'star', 'noPass': true}, // 星空
|
||||
'5':{'cls': 'animates', 'id': 'lava', 'noPass': true}, // 岩浆
|
||||
'6':{'cls': 'terrains', 'id': 'ice'}, // 冰面
|
||||
|
||||
Loading…
Reference in New Issue
Block a user