楼梯、传送器

This commit is contained in:
oc 2017-12-05 12:10:58 +08:00
parent 6f89f0dbdc
commit 959b84b26d
3 changed files with 35 additions and 45 deletions

View File

@ -1031,9 +1031,16 @@ core.prototype.automaticRoute = function (destX, destY) {
if (core.noPassExists(nx, ny))
continue;
var deepAdd=1;
if (core.idEndWith(nx,ny,'Net')) deepAdd=100;
// 自动绕过血瓶
if (!core.flags.potionWhileRouting && core.idEndWith(nx,ny,'Potion')) deepAdd=20;
var block = core.getBlock(nx,ny);
if (block!=null) {
var id = block.block.event.id;
// 绕过路障
if (id.substring(id.length-3)=="Net") deepAdd=100;
// 绕过血瓶
if (!core.flags.potionWhileRouting && id.substring(id.length-6)=="Potion") deepAdd=20;
// 绕过可能的夹击点
if (block.block.event.trigger == 'checkBlock') deepAdd=200;
}
route[nid] = direction;
queue.push(169*(nowDeep+deepAdd)+nid);
}
@ -1699,13 +1706,6 @@ core.prototype.enemyExists = function (x, y, id) {
return false;
}
core.prototype.idEndWith = function (x, y, idStr) {
var block = core.getBlock(x,y);
if (block==null) return false;
var id = block.block.event.id;
return id.substring(id.length-idStr.length)==idStr;
}
core.prototype.getBlock = function (x, y, floorId, needEnable) {
floorId = floorId || core.status.floorId;
needEnable = needEnable || true;
@ -2774,7 +2774,7 @@ core.prototype.hide = function (obj, speed, callback) {
////// 状态栏相关 //////
core.prototype.clearStatusBar = function() {
var statusList = ['floor', 'hp', 'atk', 'def', /*'mdef',*/ 'money', 'experience', 'yellowKey', 'blueKey', 'redKey', 'hard'];
var statusList = ['floor', 'hp', 'atk', 'def', 'mdef', 'money', 'experience', 'yellowKey', 'blueKey', 'redKey', 'poison', 'weak', 'curse', 'hard'];
statusList.forEach(function (e) {
core.statusBar[e].innerHTML = "";
});

View File

@ -49,7 +49,7 @@ main.floors.sample0 = {
{"type": "disappear"}
],
"2,8": [ // 守着第一批怪物的老人
"\t[老人,magician]这些都是各种各样的怪物。\n所有怪物的属性都在enemys.js中设置。\n\n每个怪物最多只能有一个属性。",
"\t[老人,magician]这些都是各种各样的怪物。\n所有怪物的数据都在enemys.js中设置。\n\n每个怪物最多只能有一个特殊属性。",
"\t[老人,magician]这批怪物分别为:普通、先攻、魔攻、坚固、\n2连击、3连击、4连击、破甲、反击、净化。",
"\t[老人,magician]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",
{"type": "disappear"}
@ -62,6 +62,7 @@ main.floors.sample0 = {
"\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值\n可参见样板中初级巫师的写法。",
"\t[老人,magician]出于游戏性能的考虑,我们不可能每走一步都\n对领域和夹击进行检查。\n因此我们需要在本楼层的 events 中指明哪些\n点可能会触发领域和夹击事件在这些点才会\n对领域和夹击进行检查和处理。\n\n具体可参见本层样板中events的做法。",
"\t[老人,magician]夹击和领域同时发生时先计算领域,再夹击。\n\n另本塔不支持阻击怪。",
"\t[老人,magician]自动寻路会尽量绕过你设置的这些点。",
{"type": "disappear"}
],
@ -80,6 +81,7 @@ main.floors.sample0 = {
/****** 领域、夹击检查事件 ******/
"1,0": {"trigger": "checkBlock"},
"0,1": {"trigger": "checkBlock"},
"1,1": {"trigger": "checkBlock"},
"1,2": {"trigger": "checkBlock"},
"2,1": {"trigger": "checkBlock"},
"3,0": {"trigger": "checkBlock"},

View File

@ -14,6 +14,27 @@ maps.prototype.loadFloor = function (floorId, map, enables) {
for (var i = 0; i < 13; i++) {
for (var j = 0; j < 13; j++) {
var block = this.getBlock(j, i, map[i][j]);
if (block.event != undefined) {
if (block.event.cls == 'enemys' && block.event.trigger==undefined) {
block.event.trigger = 'battle';
}
if (block.event.cls == 'items' && block.event.trigger==undefined) {
block.event.trigger = 'getItem';
}
if (block.event.noPass == undefined) {
if (block.event.cls=='enemys' || block.event.cls=='terrains' || block.event.cls=='npcs') {
block.event.noPass = true;
}
}
if (block.event.animate == undefined) {
if (block.event.cls=='enemys' || block.event.cls=='npcs') {
block.event.animate = 2;
}
if (block.event.cls == 'animates') {
block.event.animate = 4;
}
}
}
this.addEvent(block,j,i,floor.events[j+","+i])
if (core.isset(block.event)) blocks.push(block);
}
@ -235,39 +256,6 @@ maps.prototype.initMaps = function (floorIds) {
var floorId = floorIds[i];
maps[floorId] = this.loadFloor(floorId);
}
return this.fill(maps);
}
maps.prototype.fill = function (maps) {
if (maps.floorId == undefined) {
for (var floorId in maps) {
this.fill(maps[floorId]);
}
return maps;
}
var blocks = maps['blocks'];
blocks.forEach(function (t) {
if (t.event == undefined) return;
if (t.event.cls == 'enemys' && t.event.trigger==undefined) {
t.event.trigger = 'battle';
}
if (t.event.cls == 'items' && t.event.trigger==undefined) {
t.event.trigger = 'getItem';
}
if (t.event.noPass == undefined) {
if (t.event.cls=='enemys' || t.event.cls=='terrains' || t.event.cls=='npcs') {
t.event.noPass = true;
}
}
if (t.event.animate == undefined) {
if (t.event.cls=='enemys' || t.event.cls=='npcs') {
t.event.animate = 2;
}
if (t.event.cls == 'animates') {
t.event.animate = 4;
}
}
});
return maps;
}