Update Template
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 18 KiB |
BIN
images/items.png
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 27 KiB |
BIN
images/magictower.png
Normal file
|
After Width: | Height: | Size: 298 KiB |
@ -1,4 +1,4 @@
|
||||
# 此文件是每个数字所代表的意思,可被地图生成器读取和使用
|
||||
# 此文件是每个数字所代表的意思,可被地图生成器读取和使用
|
||||
# 可以模仿此格式在后面写上任意被识别内容
|
||||
|
||||
|
||||
@ -7,18 +7,22 @@
|
||||
# 注意中间以小逗号分开;不要有空格;后面可以加任意"#"代表注释
|
||||
|
||||
### 0-20 地形 ###
|
||||
0,terrains,0 # 路面
|
||||
0,terrains,0 # 路面;此项必须在第一条。
|
||||
1,terrains,1 # 黄色墙(经典墙)
|
||||
2,terrains,2 # 白色墙
|
||||
3,terrains,3 # 蓝色墙
|
||||
4,terrains,4 # 星空
|
||||
5,terrains,5 # 岩浆
|
||||
6,terrains,15 # 蓝色商店左
|
||||
7,terrains,16 # 蓝色商店右
|
||||
8,terrains,17 # 红色商店左
|
||||
9,terrains,18 # 红色商店右
|
||||
10,animates,23 #血网(经过收到伤害)
|
||||
# 备注:11-20待定,也许是毒网等地形
|
||||
6,terrains,5 # 冰面
|
||||
7,terrains,15 # 蓝色商店左
|
||||
8,terrains,16 # 蓝色商店右
|
||||
9,terrains,17 # 红色商店左
|
||||
10,terrains,18 # 红色商店右
|
||||
11,animates,23 # 血网(经过受到伤害)
|
||||
12,animates,24 # 毒网(经过中毒)
|
||||
13,animates,25 # 衰网(经过衰弱)
|
||||
14,animates,26 # 咒网(经过诅咒)
|
||||
# 可自行往后添加
|
||||
|
||||
### 21-80 物品 ###
|
||||
# 消耗品
|
||||
@ -62,12 +66,15 @@
|
||||
57,items,8 # 地震卷轴
|
||||
58,items,24 # 解毒药水
|
||||
59,items,25 # 解衰药水
|
||||
60,items,26 # 解咒药水
|
||||
60,items,27 # 解咒药水
|
||||
61,items,28 # 万能药水
|
||||
62,items,42 # 屠龙匕首
|
||||
# 备注:63-80待定,比如类似于新新魔塔的魔杖
|
||||
63,items,46 # 金钱袋
|
||||
64,items,47 # 绿鞋
|
||||
65,items,48 # 圣锤
|
||||
# 可自行往后添加
|
||||
|
||||
### 81-100 门、楼梯、传送门 ###
|
||||
### 81-120 门、楼梯、传送门 ###
|
||||
81,terrains,9 # 黄门
|
||||
82,terrains,10 # 蓝门
|
||||
83,terrains,11 # 红门
|
||||
@ -77,7 +84,31 @@
|
||||
87,terrains,7 # 上楼梯
|
||||
88,terrains,6 # 下楼梯
|
||||
89,animates,21 # 传送门
|
||||
90,animates,19 # 星空传送
|
||||
91,animates,30 # 上箭头传送
|
||||
92,animates,28 # 左箭头传送
|
||||
93,animates,27 # 下箭头传送
|
||||
94,animates,29 # 右箭头传送
|
||||
|
||||
### 101-200 怪物 ###
|
||||
### 121-150 NPC ###
|
||||
121,npcs,0 # 经典老人
|
||||
122,npcs,1 # 经典商人
|
||||
123,npcs,2 # 小偷
|
||||
124,npcs,3 # 仙子
|
||||
125,npcs,4 # 神秘男老人
|
||||
126,npcs,5 # 神秘女老人
|
||||
127,npcs,6 # 老头
|
||||
128,npcs,7 # 小孩
|
||||
129,npcs,8 # 木牌
|
||||
130,npcs,9 # 经验商店
|
||||
131,npcs,10 # 金币商店
|
||||
132,npcs,11 # 公主
|
||||
# 可以添加更多的NPC图标
|
||||
|
||||
|
||||
# 在此可以继续添加更多的事件,比如单向箭头、感叹号开关、箱子等等
|
||||
|
||||
|
||||
### 201-300 怪物 ###
|
||||
# 将会按照enemys.png顺序依次读取怪物
|
||||
# 如101绿色史莱姆,102红色史莱姆,依次类推
|
||||
# 如201绿色史莱姆,202红色史莱姆,依次类推
|
||||
|
||||
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 6.5 KiB |
@ -70,7 +70,7 @@
|
||||
<p class='statusLabel' id='redKey' style="color:#FF8888"></p>
|
||||
<p class='statusLabel' id='poison' style="color: #AFFCA8;"></p>
|
||||
<p class='statusLabel' id='weak' style="color: #FECCD0;"></p>
|
||||
<p class='statusLabel' id='curse' style="color: #59ACFF;"></p>
|
||||
<p class='statusLabel' id='curse' style="color: #C2F4E7;"></p>
|
||||
<img src="images/book.png" id='img-book'>
|
||||
<img src="images/fly.png" id='img-fly'>
|
||||
<img src="images/toolbox.png" id='img-toolbox'>
|
||||
|
||||
355
libs/core.js
@ -8,6 +8,8 @@ function core() {
|
||||
this.canvas = {};
|
||||
this.images = [];
|
||||
this.sounds = {};
|
||||
this.floorIds = [];
|
||||
this.floors = {};
|
||||
this.firstData = {};
|
||||
this.material = {
|
||||
'images': {},
|
||||
@ -54,19 +56,7 @@ function core() {
|
||||
'played': false,
|
||||
|
||||
// 勇士属性
|
||||
'hero': {
|
||||
'id': '',
|
||||
'name': '',
|
||||
'hp': 0,
|
||||
'atk': 0,
|
||||
'def': 0,
|
||||
'mdef': 0,
|
||||
'money': 0,
|
||||
'experience': 0,
|
||||
'loc': {'direction': 'down', 'x': 0, 'y': 0},
|
||||
'flyRange': [],
|
||||
'items': [],
|
||||
},
|
||||
'hero': {},
|
||||
|
||||
// 当前地图
|
||||
'floorId': null,
|
||||
@ -111,28 +101,29 @@ function core() {
|
||||
|
||||
/////////// 系统事件相关 ///////////
|
||||
|
||||
core.prototype.init = function (dom, statusBar, canvas, images, sounds, coreData) {
|
||||
core.prototype.init = function (dom, statusBar, canvas, images, sounds, floorIds, floors, coreData) {
|
||||
core.dom = dom;
|
||||
core.statusBar = statusBar;
|
||||
core.canvas = canvas;
|
||||
core.images = images;
|
||||
core.sounds = sounds;
|
||||
core.floorIds = floorIds;
|
||||
core.floors = floors;
|
||||
for (var key in coreData) {
|
||||
core[key] = coreData[key];
|
||||
}
|
||||
core.flags = core.data.flags;
|
||||
core.firstData = core.data.getFirstData();
|
||||
core.initStatus.shops = core.firstData.shops;
|
||||
core.initStatus.npcs = core.firstData.npcs;
|
||||
core.dom.versionLabel.innerHTML = core.firstData.version;
|
||||
core.dom.logoLabel.innerHTML = core.firstData.title;
|
||||
core.material.items = core.items.getItems();
|
||||
// core.status.maps = core.maps.getMaps();
|
||||
core.initStatus.maps = core.maps.getMaps();
|
||||
core.initStatus.maps = core.maps.initMaps(floorIds);
|
||||
core.material.enemys = core.clone(core.enemys.getEnemys());
|
||||
core.material.icons = core.icons.getIcons();
|
||||
core.material.events = core.events.getEvents();
|
||||
core.material.npcs = core.npcs.getNpcs();
|
||||
core.flags = core.data.flags;
|
||||
|
||||
// test if iOS
|
||||
core.musicStatus.soundStatus = core.getLocalStorage('soundStatus', true);
|
||||
@ -368,7 +359,49 @@ core.prototype.restart = function() {
|
||||
|
||||
/////////// 键盘、鼠标事件相关 ///////////
|
||||
|
||||
core.prototype.keyDown = function(e) {
|
||||
core.prototype.onkeyDown = function(e) {
|
||||
if (!core.isset(core.status.holdingKeys))core.status.holdingKeys=[];
|
||||
var isArrow={37:true,38:true,39:true,40:true}[e.keyCode]
|
||||
if(isArrow){
|
||||
for(var ii =0;ii<core.status.holdingKeys.length;ii++){
|
||||
if (core.status.holdingKeys[ii]===e.keyCode){
|
||||
return;
|
||||
}
|
||||
}
|
||||
core.status.holdingKeys.push(e.keyCode);
|
||||
core.pressKey(e.keyCode);
|
||||
} else {
|
||||
core.keyDown(e.keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
core.prototype.onkeyUp = function(e) {
|
||||
var isArrow={37:true,38:true,39:true,40:true}[e.keyCode]
|
||||
if(isArrow){
|
||||
for(var ii =0;ii<core.status.holdingKeys.length;ii++){
|
||||
if (core.status.holdingKeys[ii]===e.keyCode){
|
||||
core.status.holdingKeys= core.status.holdingKeys.slice(0,ii).concat(core.status.holdingKeys.slice(ii+1));
|
||||
if (ii === core.status.holdingKeys.length && core.status.holdingKeys.length!==0)core.pressKey(core.status.holdingKeys.slice(-1)[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
core.stopHero();
|
||||
} else {
|
||||
core.keyUp(e.keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
core.prototype.pressKey = function (keyCode) {
|
||||
if (keyCode === core.status.holdingKeys.slice(-1)[0]) {
|
||||
core.keyDown(keyCode);
|
||||
window.setTimeout(function(){core.pressKey(keyCode);},30);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
core.prototype.keyDown = function(keyCode) {
|
||||
if(!core.status.played) {
|
||||
return;
|
||||
}
|
||||
@ -377,23 +410,23 @@ core.prototype.keyDown = function(e) {
|
||||
}
|
||||
if (core.status.lockControl) {
|
||||
if (core.status.event.id == 'book') {
|
||||
if (e.keyCode==37) core.ui.drawEnemyBook(core.status.event.data - 1);
|
||||
else if (e.keyCode==39) core.ui.drawEnemyBook(core.status.event.data + 1);
|
||||
if (keyCode==37) core.ui.drawEnemyBook(core.status.event.data - 1);
|
||||
else if (keyCode==39) core.ui.drawEnemyBook(core.status.event.data + 1);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id == 'fly') {
|
||||
if (e.keyCode==38) core.ui.drawFly(core.status.event.data+1);
|
||||
else if (e.keyCode==40) core.ui.drawFly(core.status.event.data-1);
|
||||
if (keyCode==38) core.ui.drawFly(core.status.event.data+1);
|
||||
else if (keyCode==40) core.ui.drawFly(core.status.event.data-1);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id == 'save' || core.status.event.id == 'load') {
|
||||
if (e.keyCode==37) core.ui.drawSLPanel(core.status.event.data-1);
|
||||
else if (e.keyCode==39) core.ui.drawSLPanel(core.status.event.data+1);
|
||||
if (keyCode==37) core.ui.drawSLPanel(core.status.event.data-1);
|
||||
else if (keyCode==39) core.ui.drawSLPanel(core.status.event.data+1);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
switch(e.keyCode) {
|
||||
switch(keyCode) {
|
||||
case 37:
|
||||
core.moveHero('left');
|
||||
break;
|
||||
@ -409,46 +442,46 @@ core.prototype.keyDown = function(e) {
|
||||
}
|
||||
}
|
||||
|
||||
core.prototype.keyUp = function(e) {
|
||||
core.prototype.keyUp = function(keyCode) {
|
||||
if(!core.status.played) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (core.status.lockControl) {
|
||||
if (core.status.event.id == 'book' && (e.keyCode==27 || e.keyCode==88))
|
||||
if (core.status.event.id == 'book' && (keyCode==27 || keyCode==88))
|
||||
core.ui.closePanel(true);
|
||||
if (core.status.event.id == 'fly' && (e.keyCode==71 || e.keyCode==27))
|
||||
if (core.status.event.id == 'fly' && (keyCode==71 || keyCode==27))
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'fly' && e.keyCode==13) {
|
||||
if (core.status.event.id == 'fly' && keyCode==13) {
|
||||
var index=core.status.hero.flyRange.indexOf(core.status.floorId);
|
||||
var stair=core.status.event.data<index?"upFloor":"downFloor";
|
||||
var floorId=core.status.event.data;
|
||||
core.ui.closePanel();
|
||||
core.changeFloor(core.status.hero.flyRange[floorId], stair);
|
||||
}
|
||||
if (core.status.event.id == 'save' && (e.keyCode==83 || e.keyCode==27))
|
||||
if (core.status.event.id == 'save' && (keyCode==83 || keyCode==27))
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'load' && (e.keyCode==76 || e.keyCode==27))
|
||||
if (core.status.event.id == 'load' && (keyCode==76 || keyCode==27))
|
||||
core.ui.closePanel();
|
||||
if ((core.status.event.id == 'shop' || core.status.event.id == 'settings'
|
||||
|| core.status.event.id == 'selectShop') && e.keyCode==27)
|
||||
|| core.status.event.id == 'selectShop') && keyCode==27)
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'selectShop' && e.keyCode==75)
|
||||
if (core.status.event.id == 'selectShop' && keyCode==75)
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'toolbox' && (e.keyCode==84 || e.keyCode==27))
|
||||
if (core.status.event.id == 'toolbox' && (keyCode==84 || keyCode==27))
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'about' && (e.keyCode==13 || e.keyCode==32))
|
||||
if (core.status.event.id == 'about' && (keyCode==13 || keyCode==32))
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'text' && (e.keyCode==13 || e.keyCode==32))
|
||||
if (core.status.event.id == 'text' && (keyCode==13 || keyCode==32))
|
||||
core.drawText();
|
||||
if (core.status.event.id == 'npc' && core.isset(core.status.event.data.current)
|
||||
&& core.status.event.data.current.action=='text' && (e.keyCode==13 || e.keyCode==32))
|
||||
core.npcAction();
|
||||
if (core.status.event.id == 'action' && core.isset(core.status.event.data.current)
|
||||
&& core.status.event.data.type=='text' && (keyCode==13 || keyCode==32))
|
||||
core.events.doAction();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.keyCode) {
|
||||
switch (keyCode) {
|
||||
case 27: // ESC
|
||||
core.ui.drawSettings(true);
|
||||
break;
|
||||
@ -645,6 +678,11 @@ core.prototype.onclick = function (x, y, stepPostfix) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (core.status.event.id == 'action') {
|
||||
core.events.clickAction(x,y);
|
||||
return;
|
||||
}
|
||||
|
||||
// 纯文本
|
||||
if (core.status.event.id == 'text') {
|
||||
core.drawText();
|
||||
@ -842,7 +880,7 @@ core.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
|
||||
core.stopAutomaticRoute();
|
||||
return;
|
||||
}
|
||||
if (destX == core.status.hero.loc.x && destY == core.status.hero.loc.y) {
|
||||
if (destX == core.status.hero.loc.x && destY == core.status.hero.loc.y && stepPostfix.length==0) {
|
||||
core.turnHero();
|
||||
return;
|
||||
}
|
||||
@ -860,8 +898,12 @@ core.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
|
||||
var moveStep;
|
||||
core.status.automaticRoutingTemp = {'destX': 0, 'destY': 0, 'moveStep': []};
|
||||
if (!(moveStep = core.automaticRoute(destX, destY))) {
|
||||
core.canvas.ui.clearRect(0, 0, 416, 416);
|
||||
return false;
|
||||
if (destX == core.status.hero.loc.x && destY == core.status.hero.loc.y){
|
||||
moveStep=[];
|
||||
} else {
|
||||
core.canvas.ui.clearRect(0, 0, 416, 416);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
moveStep=moveStep.concat(stepPostfix);
|
||||
core.status.automaticRoutingTemp.destX = destX;
|
||||
@ -989,7 +1031,7 @@ core.prototype.automaticRoute = function (destX, destY) {
|
||||
if (core.noPassExists(nx, ny))
|
||||
continue;
|
||||
var deepAdd=1;
|
||||
if (core.idEndWith(nx,ny,'lavaNet')) deepAdd=100;
|
||||
if (core.idEndWith(nx,ny,'Net')) deepAdd=100;
|
||||
// 自动绕过血瓶
|
||||
if (!core.flags.potionWhileRouting && core.idEndWith(nx,ny,'Potion')) deepAdd=20;
|
||||
route[nid] = direction;
|
||||
@ -1239,13 +1281,28 @@ core.prototype.moveHero = function (direction) {
|
||||
|
||||
core.prototype.moveOneStep = function() {
|
||||
core.status.hero.steps++;
|
||||
// 中毒状态
|
||||
if (core.hasFlag('poison')) {
|
||||
core.status.hero.hp -= core.flags.poisonDamage;
|
||||
if (core.status.hero.hp<=0) {
|
||||
core.status.hero.hp=0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose('poison');
|
||||
return;
|
||||
}
|
||||
core.updateStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
core.prototype.waitHeroToStop = function(callback) {
|
||||
core.stopAutomaticRoute();
|
||||
core.clearContinueAutomaticRoute();
|
||||
if (core.isset(callback)) {
|
||||
core.lockControl();
|
||||
setTimeout(function(){callback()}, 30);
|
||||
setTimeout(function(){
|
||||
core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');
|
||||
callback();
|
||||
}, 30);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1258,10 +1315,10 @@ core.prototype.drawHero = function (direction, x, y, status, offsetX, offsetY) {
|
||||
offsetY = offsetY || 0;
|
||||
core.clearAutomaticRouteNode(x, y);
|
||||
var heroIcon = core.material.icons.heros[core.status.hero.id][direction];
|
||||
x = x * heroIcon.size;
|
||||
y = y * heroIcon.size;
|
||||
x = x * 32;
|
||||
y = y * 32;
|
||||
core.canvas.hero.clearRect(x - 32, y - 32, 96, 96);
|
||||
core.canvas.hero.drawImage(core.material.images.heros, heroIcon.loc[status] * heroIcon.size, heroIcon.loc.iconLoc * heroIcon.size, heroIcon.size, heroIcon.size, x + offsetX, y + offsetY, heroIcon.size, heroIcon.size);
|
||||
core.canvas.hero.drawImage(core.material.images.heros, heroIcon[status] * 32, heroIcon.loc * 32, 32, 32, x + offsetX, y + offsetY, 32, 32);
|
||||
}
|
||||
|
||||
/////////// 自动行走 & 行走控制 END ///////////
|
||||
@ -1283,10 +1340,10 @@ core.prototype.openDoor = function (id, x, y, needKey, callback) {
|
||||
core.stopAutomaticRoute();
|
||||
if (needKey) {
|
||||
var key = id.replace("Door", "Key");
|
||||
if (!core.useKey(key)) {
|
||||
if (!core.rmItem(key)) {
|
||||
if (key != "specialKey")
|
||||
core.drawTip("你没有" + core.material.items[key].name + "!", "normal");
|
||||
else core.drawTip("无法开启此门。");
|
||||
core.drawTip("你没有" + core.material.items[key].name + "!");
|
||||
else core.drawTip("无法开启此门");
|
||||
core.clearContinueAutomaticRoute();
|
||||
return;
|
||||
}
|
||||
@ -1300,12 +1357,11 @@ core.prototype.openDoor = function (id, x, y, needKey, callback) {
|
||||
if (state == 4) {
|
||||
clearInterval(core.interval.openDoorAnimate);
|
||||
core.removeBlock('event', x, y);
|
||||
core.events.afterOpenDoor(id);
|
||||
if (core.isset(callback)) callback();
|
||||
core.events.afterOpenDoor(id,x,y,callback);
|
||||
return;
|
||||
}
|
||||
core.canvas.event.clearRect(32 * x, 32 * y, 32, 32);
|
||||
core.canvas.event.drawImage(core.material.images.animates, 32 * state, 32 * door.loc, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||
core.canvas.event.drawImage(core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||
}, 30)
|
||||
}
|
||||
|
||||
@ -1327,10 +1383,12 @@ core.prototype.battle = function (id, x, y, callback) {
|
||||
core.playSound('attack', 'ogg');
|
||||
core.status.hero.hp -= damage;
|
||||
var money = core.material.enemys[id].money;
|
||||
if (core.hasItem('coin'))
|
||||
core.status.hero.money += core.material.enemys[id].money;
|
||||
if (core.hasItem('coin')) money *= 2;
|
||||
if (core.hasFlag('curse')) money=0;
|
||||
core.status.hero.money += money;
|
||||
core.status.hero.experience += core.material.enemys[id].experience;
|
||||
var experience = core.material.enemys[id].experience;
|
||||
if (core.hasFlag('curse')) experience=0;
|
||||
core.status.hero.experience += experience;
|
||||
core.updateStatusBar();
|
||||
core.removeBlock('event', x, y);
|
||||
core.canvas.event.clearRect(32 * x, 32 * y, 32, 32);
|
||||
@ -1341,9 +1399,7 @@ core.prototype.battle = function (id, x, y, callback) {
|
||||
core.drawTip(hint);
|
||||
|
||||
// 打完怪物,触发事件
|
||||
core.events.afterBattle(id);
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
core.events.afterBattle(id,x,y,callback);
|
||||
}
|
||||
|
||||
// 楼层切换
|
||||
@ -1362,10 +1418,12 @@ core.prototype.changeFloor = function (floorId, stair, heroLoc, callback) {
|
||||
heroLoc.y = blocks[i].y;
|
||||
}
|
||||
}
|
||||
if (core.status.maps[floorId].canFlyTo && core.status.hero.flyRange.indexOf(floorId)<0) {
|
||||
if (stair=='upFloor') core.status.hero.flyRange.unshift(floorId);
|
||||
if (stair=='downFloor') core.status.hero.flyRange.push(floorId);
|
||||
}
|
||||
}
|
||||
if (core.status.maps[floorId].canFlyTo && core.status.hero.flyRange.indexOf(floorId)<0) {
|
||||
if (core.floorIds.indexOf(floorId)>core.floorIds.indexOf(core.status.floorId))
|
||||
core.status.hero.flyRange.push(floorId);
|
||||
else
|
||||
core.status.hero.flyRange.unshift(floorId);
|
||||
}
|
||||
|
||||
window.setTimeout(function () {
|
||||
@ -1530,45 +1588,23 @@ core.prototype.drawMap = function (mapName, callback) {
|
||||
var mapBlocks = mapData.blocks;
|
||||
core.status.floorId = mapName;
|
||||
core.status.thisMap = mapData;
|
||||
var x, y, blockIcon, blockImage;
|
||||
var blockIcon, blockImage;
|
||||
core.clearMap('all');
|
||||
core.rmGlobalAnimate(null, null, true);
|
||||
core.enabledAllTrigger();
|
||||
for (x = 0; x < 13; x++) {
|
||||
for (y = 0; y < 13; y++) {
|
||||
for (var x = 0; x < 13; x++) {
|
||||
for (var y = 0; y < 13; y++) {
|
||||
blockIcon = core.material.icons.terrains.ground;
|
||||
blockImage = core.material.images.terrains;
|
||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon.loc * blockIcon.size, blockIcon.size, blockIcon.size, x * blockIcon.size, y * blockIcon.size, blockIcon.size, blockIcon.size);
|
||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||
}
|
||||
}
|
||||
x = 0;
|
||||
y = 0;
|
||||
for (var b = 0; b < mapBlocks.length; b++) {
|
||||
if (core.isset(mapBlocks[b].bg)) {
|
||||
blockIcon = core.material.icons[mapBlocks[b].bg.cls][mapBlocks[b].bg.id];
|
||||
blockImage = core.material.images[mapBlocks[b].bg.cls];
|
||||
x = mapBlocks[b].x * blockIcon.size;
|
||||
y = mapBlocks[b].y * blockIcon.size;
|
||||
if (mapBlocks[b].bg.cls != 'empty') {
|
||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon.loc * blockIcon.size, blockIcon.size, blockIcon.size, x, y, blockIcon.size, blockIcon.size);
|
||||
core.addGlobalAnimate(mapBlocks[b].bg.animate, x, y, 'bg', blockIcon.loc, blockIcon.size, blockImage);
|
||||
}
|
||||
else {
|
||||
core.canvas.bg.clearRect(x, y, blockIcon.size, blockIcon.size);
|
||||
}
|
||||
}
|
||||
else {
|
||||
blockIcon = core.material.icons.terrains.ground;
|
||||
blockImage = core.material.images.terrains;
|
||||
x = mapBlocks[b].x * blockIcon.size;
|
||||
y = mapBlocks[b].y * blockIcon.size;
|
||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon.loc * blockIcon.size, blockIcon.size, blockIcon.size, x, y, blockIcon.size, blockIcon.size);
|
||||
}
|
||||
if (core.isset(mapBlocks[b].event)) {
|
||||
blockIcon = core.material.icons[mapBlocks[b].event.cls][mapBlocks[b].event.id];
|
||||
blockImage = core.material.images[mapBlocks[b].event.cls];
|
||||
core.canvas.event.drawImage(core.material.images[mapBlocks[b].event.cls], 0, blockIcon.loc * blockIcon.size, blockIcon.size, blockIcon.size, x, y, blockIcon.size, blockIcon.size);
|
||||
core.addGlobalAnimate(mapBlocks[b].event.animate, x, y, 'event', blockIcon.loc, blockIcon.size, blockImage);
|
||||
core.canvas.event.drawImage(core.material.images[mapBlocks[b].event.cls], 0, blockIcon * 32, 32, 32, mapBlocks[b].x * 32, mapBlocks[b].y * 32, 32, 32);
|
||||
core.addGlobalAnimate(mapBlocks[b].event.animate, mapBlocks[b].x * 32, mapBlocks[b].y * 32, blockIcon, blockImage);
|
||||
}
|
||||
}
|
||||
core.setGlobalAnimate(core.firstData.animateSpeed);
|
||||
@ -1662,14 +1698,23 @@ core.prototype.enemyExists = function (x, y, id) {
|
||||
}
|
||||
|
||||
core.prototype.idEndWith = function (x, y, idStr) {
|
||||
var blocks = core.status.thisMap.blocks;
|
||||
for (var n = 0; n < blocks.length; n++) {
|
||||
if (blocks[n].x == x && blocks[n].y == y && core.isset(blocks[n].event)) {
|
||||
var id = blocks[n].event.id;
|
||||
return id.substring(id.length-idStr.length)==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;
|
||||
var blocks = core.status.maps[floorId].blocks;
|
||||
for (var n=0;n<blocks.length;n++) {
|
||||
if (blocks[n].x==x && blocks[n].y==y && core.isset(blocks[n].event)) {
|
||||
if (needEnable && core.isset(blocks[n].enable) && !blocks[n].enable) return null;
|
||||
return {"index": n, "block": blocks[n]};
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
core.prototype.removeBlock = function (map, x, y) {
|
||||
@ -1684,7 +1729,7 @@ core.prototype.removeBlock = function (map, x, y) {
|
||||
continue;
|
||||
}
|
||||
blockIcon = core.material.icons[mapBlocks[b][map[m]].cls][mapBlocks[b][map[m]].id];
|
||||
core.canvas[map[m]].clearRect(x * blockIcon.size, y * blockIcon.size, blockIcon.size, blockIcon.size);
|
||||
core.canvas[map[m]].clearRect(x * 32, y * 32, 32, 32);
|
||||
// delete core.status.thisMap.blocks[b][map[m]];
|
||||
}
|
||||
core.status.thisMap.blocks.splice(b, 1);
|
||||
@ -1790,15 +1835,13 @@ core.prototype.rmTrigger = function (x, y, map) {
|
||||
}
|
||||
}
|
||||
|
||||
core.prototype.addGlobalAnimate = function (animateMore, x, y, map, loc, size, image) {
|
||||
core.prototype.addGlobalAnimate = function (animateMore, x, y, loc, image) {
|
||||
if (animateMore == 2) {
|
||||
core.status.twoAnimateObjs.push({
|
||||
'x': x,
|
||||
'y': y,
|
||||
'map': map,
|
||||
'status': 0,
|
||||
'loc': loc,
|
||||
'size': size,
|
||||
'image': image
|
||||
});
|
||||
}
|
||||
@ -1806,10 +1849,8 @@ core.prototype.addGlobalAnimate = function (animateMore, x, y, map, loc, size, i
|
||||
core.status.fourAnimateObjs.push({
|
||||
'x': x,
|
||||
'y': y,
|
||||
'map': map,
|
||||
'status': 0,
|
||||
'loc': loc,
|
||||
'size': size,
|
||||
'image': image
|
||||
});
|
||||
}
|
||||
@ -1821,13 +1862,13 @@ core.prototype.rmGlobalAnimate = function (x, y, all) {
|
||||
core.status.fourAnimateObjs = [];
|
||||
}
|
||||
for (var t = 0; t < core.status.twoAnimateObjs.length; t++) {
|
||||
if (core.status.twoAnimateObjs[t].x == x * core.status.twoAnimateObjs[t].size && core.status.twoAnimateObjs[t].y == y * core.status.twoAnimateObjs[t].size) {
|
||||
if (core.status.twoAnimateObjs[t].x == x * 32 && core.status.twoAnimateObjs[t].y == y * 32) {
|
||||
core.status.twoAnimateObjs.splice(t, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (var f = 0; f < core.status.fourAnimateObjs.length; f++) {
|
||||
if (core.status.fourAnimateObjs[f].x == x * core.status.fourAnimateObjs[f].size && core.status.fourAnimateObjs[f].y == y * core.status.fourAnimateObjs[f].size) {
|
||||
if (core.status.fourAnimateObjs[f].x == x * 32 && core.status.fourAnimateObjs[f].y == y * 32) {
|
||||
core.status.fourAnimateObjs.splice(f, 1);
|
||||
return;
|
||||
}
|
||||
@ -1840,44 +1881,50 @@ core.prototype.setGlobalAnimate = function (speed) {
|
||||
var animateClose = false;
|
||||
core.interval.twoAnimate = window.setInterval(function () {
|
||||
for (var a = 0; a < core.status.twoAnimateObjs.length; a++) {
|
||||
core.status.twoAnimateObjs[a].status = core.status.twoAnimateObjs[a].status == 0 ? 1 : 0;
|
||||
core.canvas[core.status.twoAnimateObjs[a].map].clearRect(core.status.twoAnimateObjs[a].x, core.status.twoAnimateObjs[a].y, core.status.twoAnimateObjs[a].size, core.status.twoAnimateObjs[a].size);
|
||||
var obj = core.status.twoAnimateObjs[a];
|
||||
obj.status = (obj.status+1)%2;
|
||||
core.canvas.event.clearRect(obj.x, obj.y, 32, 32);
|
||||
/*
|
||||
for (var b = 0; b < core.status.thisMap.blocks.length; b++) {
|
||||
if (core.status.thisMap.blocks[b].x * 32 == core.status.twoAnimateObjs[a].x && core.status.thisMap.blocks[b].y * 32 == core.status.twoAnimateObjs[a].y && (!core.isset(core.status.thisMap.blocks[b][core.status.twoAnimateObjs[a].map]) || core.status.thisMap.blocks[b][core.status.twoAnimateObjs[a].map].animate == 0)) {
|
||||
animateClose = true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (!animateClose) {
|
||||
core.canvas[core.status.twoAnimateObjs[a].map].drawImage(core.status.twoAnimateObjs[a].image, core.status.twoAnimateObjs[a].status * 32, core.status.twoAnimateObjs[a].loc * core.status.twoAnimateObjs[a].size, core.status.twoAnimateObjs[a].size, core.status.twoAnimateObjs[a].size, core.status.twoAnimateObjs[a].x, core.status.twoAnimateObjs[a].y, core.status.twoAnimateObjs[a].size, core.status.twoAnimateObjs[a].size);
|
||||
core.canvas.event.drawImage(obj.image, obj.status * 32, obj.loc * 32, 32, 32, obj.x, obj.y, 32, 32);
|
||||
}
|
||||
animateClose = false;
|
||||
}
|
||||
}, speed);
|
||||
core.interval.fourAnimate = window.setInterval(function () {
|
||||
for (var a = 0; a < core.status.fourAnimateObjs.length; a++) {
|
||||
core.status.fourAnimateObjs[a].status = (core.status.fourAnimateObjs[a].status == 0 ? 1 : (core.status.fourAnimateObjs[a].status == 1 ? 2 : (core.status.fourAnimateObjs[a].status == 2 ? 3 : 0)));
|
||||
core.canvas[core.status.fourAnimateObjs[a].map].clearRect(core.status.fourAnimateObjs[a].x, core.status.fourAnimateObjs[a].y, core.status.fourAnimateObjs[a].size, core.status.fourAnimateObjs[a].size);
|
||||
var obj=core.status.fourAnimateObjs[a];
|
||||
obj.status = (obj.status+1)%4;
|
||||
core.canvas.event.clearRect(obj.x, obj.y, 32, 32);
|
||||
/*
|
||||
for (var b = 0; b < core.status.thisMap.blocks.length; b++) {
|
||||
if (core.status.thisMap.blocks[b].x * 32 == core.status.fourAnimateObjs[a].x && core.status.thisMap.blocks[b].y * 32 == core.status.fourAnimateObjs[a].y && (!core.isset(core.status.thisMap.blocks[b][core.status.fourAnimateObjs[a].map]) || core.status.thisMap.blocks[b][core.status.fourAnimateObjs[a].map].animate == 0)) {
|
||||
animateClose = true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (!animateClose) {
|
||||
core.canvas[core.status.fourAnimateObjs[a].map].drawImage(core.status.fourAnimateObjs[a].image, core.status.fourAnimateObjs[a].status * 32, core.status.fourAnimateObjs[a].loc * core.status.fourAnimateObjs[a].size, core.status.fourAnimateObjs[a].size, core.status.fourAnimateObjs[a].size, core.status.fourAnimateObjs[a].x, core.status.fourAnimateObjs[a].y, core.status.fourAnimateObjs[a].size, core.status.fourAnimateObjs[a].size);
|
||||
core.canvas.event.drawImage(obj.image, obj.status * 32, obj.loc * 32, 32, 32, obj.x, obj.y, 32, 32);
|
||||
}
|
||||
animateClose = false;
|
||||
}
|
||||
}, speed / 2);
|
||||
}
|
||||
|
||||
core.prototype.setBoxAnimate = function (speed) {
|
||||
core.prototype.setBoxAnimate = function () {
|
||||
clearInterval(core.interval.boxAnimate);
|
||||
if (core.status.boxAnimateObjs.length > 0) {
|
||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||
core.drawBoxAnimate(background);
|
||||
core.interval.boxAnimate = setInterval(function () {
|
||||
core.drawBoxAnimate(background);
|
||||
}, speed);
|
||||
}, core.firstData.animateSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1887,8 +1934,8 @@ core.prototype.drawBoxAnimate = function (background) {
|
||||
obj.status = obj.status == 0 ? 1 : 0;
|
||||
core.clearMap('ui', obj.bgx, obj.bgy, obj.bgsize, obj.bgsize);
|
||||
core.fillRect('ui', obj.bgx, obj.bgy, obj.bgsize, obj.bgsize, background);
|
||||
core.canvas.ui.drawImage(obj.image, obj.status * obj.icon.size, obj.icon.loc * obj.icon.size,
|
||||
obj.icon.size, obj.icon.size, obj.x, obj.y, obj.icon.size, obj.icon.size);
|
||||
core.canvas.ui.drawImage(obj.image, obj.status * 32, obj.icon * 32,
|
||||
32, 32, obj.x, obj.y, 32, 32);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1908,6 +1955,26 @@ core.prototype.getHeroLoc = function (itemName) {
|
||||
return core.status.hero.loc[itemName];
|
||||
}
|
||||
|
||||
core.prototype.nextX = function() {
|
||||
var scan = {
|
||||
'up': {'x': 0, 'y': -1},
|
||||
'left': {'x': -1, 'y': 0},
|
||||
'down': {'x': 0, 'y': 1},
|
||||
'right': {'x': 1, 'y': 0}
|
||||
};
|
||||
return core.getHeroLoc('x')+scan[core.getHeroLoc('direction')].x;
|
||||
}
|
||||
|
||||
core.prototype.nextY = function () {
|
||||
var scan = {
|
||||
'up': {'x': 0, 'y': -1},
|
||||
'left': {'x': -1, 'y': 0},
|
||||
'down': {'x': 0, 'y': 1},
|
||||
'right': {'x': 1, 'y': 0}
|
||||
};
|
||||
return core.getHeroLoc('y')+scan[core.getHeroLoc('direction')].y;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新显伤
|
||||
*/
|
||||
@ -1973,11 +2040,14 @@ core.prototype.setItem = function (itemId, itemNum) {
|
||||
core.status.hero.items[itemCls][itemId] = itemNum;
|
||||
}
|
||||
|
||||
core.prototype.useKey = function (itemId) {
|
||||
core.prototype.rmItem = function (itemId) {
|
||||
if (!core.hasItem(itemId)) return false;
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
core.status.hero.items[itemCls][itemId]--;
|
||||
core.updateStatusBar();
|
||||
if (itemCls=='tools' && core.status.hero.items[itemCls][itemId]==0) {
|
||||
delete core.status.hero.items[itemCls][itemId];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2004,66 +2074,45 @@ core.prototype.addItem = function (itemId, itemNum) {
|
||||
core.status.hero.items[itemCls][itemId] += itemNum;
|
||||
}
|
||||
|
||||
/*
|
||||
core.prototype.removeBlock = function(itemX, itemY) {
|
||||
var mapBlocks = core.status.thisMap.blocks;
|
||||
for(var b = 0;b < mapBlocks.length;b++) {
|
||||
if(mapBlocks[b].x == itemX && mapBlocks[b].y == itemY) {
|
||||
// delete mapBlocks[b].event;
|
||||
// mapBlocks[b]
|
||||
core.status.thisMap.blocks.splice(b,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
core.prototype.getItemEffect = function (itemId, itemNum) {
|
||||
core.items.getItemEffect(itemId, itemNum);
|
||||
}
|
||||
|
||||
core.prototype.getItemEffectTip = function (itemId) {
|
||||
return core.items.getItemEffectTip(itemId);
|
||||
}
|
||||
|
||||
core.prototype.getItem = function (itemId, itemNum, itemX, itemY, callback) {
|
||||
// core.getItemAnimate(itemId, itemNum, itemX, itemY);
|
||||
core.playSound('item', 'ogg');
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
core.getItemEffect(itemId, itemNum);
|
||||
core.items.getItemEffect(itemId, itemNum);
|
||||
core.removeBlock('event', itemX, itemY);
|
||||
var text = '获得 ' + core.material.items[itemId].name;
|
||||
if (itemNum > 1) text += "x" + itemNum;
|
||||
if (itemCls === 'items') text += core.getItemEffectTip(itemId);
|
||||
core.drawTip(text, 'image', core.material.icons.items[itemId]);
|
||||
if (itemCls === 'items') text += core.items.getItemEffectTip(itemId);
|
||||
core.drawTip(text, core.material.icons.items[itemId]);
|
||||
core.canvas.event.clearRect(itemX * 32, itemY * 32, 32, 32);
|
||||
core.updateStatusBar();
|
||||
if (core.isset(callback)) callback();
|
||||
|
||||
// 检查处理后的事件。
|
||||
var event = core.floors[core.status.floorId].afterGetItem[itemX+","+itemY];
|
||||
if (core.isset(event)) {
|
||||
core.events.doEvents(event, itemX, itemY, callback);
|
||||
}
|
||||
else if (core.isset(callback)) callback();
|
||||
}
|
||||
|
||||
core.prototype.drawTip = function (text, type, itemIcon) {
|
||||
type = type || 'normal';
|
||||
core.prototype.drawTip = function (text, itemIcon) {
|
||||
var textX, textY, width, height, hide = false, opacityVal = 0;
|
||||
clearInterval(core.interval.tipAnimate);
|
||||
core.setFont('data', "16px Arial");
|
||||
core.saveCanvas('data');
|
||||
core.setOpacity('data', 0);
|
||||
if (type == 'normal') {
|
||||
if (!core.isset(itemIcon)) {
|
||||
textX = 16;
|
||||
textY = 18;
|
||||
width = textX + core.canvas.data.measureText(text).width + 16;
|
||||
height = 42;
|
||||
}
|
||||
else if (type == 'image' && core.isset(itemIcon)) {
|
||||
else {
|
||||
textX = 44;
|
||||
textY = 18;
|
||||
width = textX + core.canvas.data.measureText(text).width + 8;
|
||||
height = 42;
|
||||
}
|
||||
else {
|
||||
core.loadCanvas('data');
|
||||
return;
|
||||
}
|
||||
core.interval.tipAnimate = window.setInterval(function () {
|
||||
if (hide) {
|
||||
opacityVal -= 0.1;
|
||||
@ -2075,7 +2124,7 @@ core.prototype.drawTip = function (text, type, itemIcon) {
|
||||
core.clearMap('data', 5, 5, 400, height);
|
||||
core.fillRect('data', 5, 5, width, height, '#000');
|
||||
if (core.isset(itemIcon)) {
|
||||
core.canvas.data.drawImage(core.material.images.items, 0, itemIcon.loc * itemIcon.size, itemIcon.size, itemIcon.size, 10, 8, itemIcon.size, itemIcon.size);
|
||||
core.canvas.data.drawImage(core.material.images.items, 0, itemIcon * 32, 32, 32, 10, 8, 32, 32);
|
||||
}
|
||||
core.fillText('data', text, textX + 5, textY + 15, '#fff');
|
||||
if (opacityVal > 0.6 || opacityVal < 0) {
|
||||
@ -2218,7 +2267,7 @@ core.prototype.npcAction = function() {
|
||||
'image': core.material.images.npcs,
|
||||
'x': left + 15, 'y': top + 30, 'icon': core.material.icons.npcs[npc.icon]
|
||||
});
|
||||
core.setBoxAnimate(core.firstData.animateSpeed);
|
||||
core.setBoxAnimate();
|
||||
|
||||
// 对话
|
||||
core.canvas.ui.textAlign = "left";
|
||||
|
||||
36
libs/data.js
@ -7,14 +7,13 @@ data.prototype.init = function() {
|
||||
'title': '魔塔样板',
|
||||
'name': 'template',
|
||||
'version': 'Ver 1.0.0 (Beta)',
|
||||
'floorId': 'MT1',
|
||||
'enableExperience': true,
|
||||
'floorId': 'sample0',
|
||||
'hero': {
|
||||
'id': 'hero1',
|
||||
'name': '勇士',
|
||||
'hp': 1000,
|
||||
'atk': 10,
|
||||
'def': 10,
|
||||
'atk': 100,
|
||||
'def': 100,
|
||||
'mdef': 0,
|
||||
'money': 0,
|
||||
'experience': 0,
|
||||
@ -28,22 +27,15 @@ data.prototype.init = function() {
|
||||
'tools': {}
|
||||
},
|
||||
'flyRange': [],
|
||||
'loc': {'direction': 'up', 'x': 6, 'y': 11},
|
||||
'steps': 0,
|
||||
'time': {
|
||||
'starttime': new Date(),
|
||||
'playtime': 0,
|
||||
'totaltime': 0,
|
||||
'lasttime': new Date()
|
||||
},
|
||||
'loc': {'direction': 'up', 'x': 6, 'y': 10},
|
||||
'flags': {
|
||||
'visitFloors': {},
|
||||
'passLava': false, // 经过岩浆则禁用商店
|
||||
'hasShield5': false, // 有神圣盾
|
||||
'seal20F': false, // 20F封印
|
||||
'poison': true,
|
||||
}
|
||||
},
|
||||
'startText': [
|
||||
"Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!",
|
||||
"这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。",
|
||||
"赶快来试一试吧!"
|
||||
],
|
||||
'shops': {
|
||||
'shop1': {
|
||||
'id': 'shop1', 'title': '贪婪之神', 'name': '3楼金币商店', 'icon': 'blueShop',
|
||||
@ -93,9 +85,6 @@ data.prototype.init = function() {
|
||||
},
|
||||
'npcs': {},
|
||||
'animateSpeed': 500,
|
||||
'startText': [
|
||||
"测试"
|
||||
]
|
||||
}
|
||||
// 系统FLAG,在游戏运行中中请不要修改它。
|
||||
this.flags = {
|
||||
@ -103,15 +92,18 @@ data.prototype.init = function() {
|
||||
/****** 角色状态相关 ******/
|
||||
"HPMAX": 999999, // HP上限;-1则无上限
|
||||
"enableMDef": true, // 是否涉及勇士的魔防值;如果此项为false,则状态栏不会显示勇士的魔防值
|
||||
"enableExperience": true, // 是否涉及经验值;如果此项为false,则状态栏和怪物手册均将不会显示经验值
|
||||
"enableExperience": false, // 是否涉及经验值;如果此项为false,则状态栏和怪物手册均将不会显示经验值
|
||||
// 重要说明:如果enableMDef和enableExperience均为true,则在状态栏不会显示当前楼层!!!! //
|
||||
"lavaDamage": 100, // 经过血网受到的伤害
|
||||
"poisonDamage": 10, // 经过毒网受到的伤害
|
||||
"weakValue": 20, // 衰弱状态下攻防减少的数值
|
||||
|
||||
|
||||
/****** 道具相关 ******/
|
||||
"flyNearStair": false, // 是否需要在楼梯边使用传送器
|
||||
"bombTrigger": true, // 使用炸弹后是否触发怪物事件(如开门)
|
||||
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁
|
||||
"bigKeyIsBox": true, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||
|
||||
|
||||
/****** 系统相关 ******/
|
||||
|
||||
159
libs/enemys.js
@ -3,68 +3,69 @@ function enemys() {
|
||||
}
|
||||
|
||||
enemys.prototype.init = function () {
|
||||
// 怪物属性初始化定义:
|
||||
this.enemys = {
|
||||
'greenSlime': {'name': '绿头怪', 'hp': 50, 'atk': 18, 'def': 1, 'money': 1, 'experience': 1, 'special': 0},
|
||||
'redSlime': {'name': '红头怪', 'hp': 70, 'atk': 20, 'def': 2, 'money': 2, 'experience': 2, 'special': 0},
|
||||
/* 'blackSlime': {'name': '青头怪', 'hp': 189, 'atk': 27, 'def': 6, 'money': 3, 'experience': 1, 'special': 0}, */
|
||||
/* 'slimelord': {'name': '怪王', 'hp': 472, 'atk': 300, 'def': 150, 'money': 35, 'experience': 1,'special': 0}, */
|
||||
'bat': {'name': '小蝙蝠', 'hp': 90, 'atk': 30, 'def': 4, 'money': 4, 'experience': 3,'special': 0},
|
||||
/* 'bigBat': {'name': '大蝙蝠', 'hp': 451, 'atk': 92, 'def': 18, 'money': 12,'experience': 1, 'special': 0}, */
|
||||
/* 'redBat': {'name': '红蝙蝠', 'hp': 439, 'atk': 260, 'def': 140, 'money': 30,'experience': 1, 'special': 0}, */
|
||||
'vampire': {'name': '冥灵魔王', 'hp': 10000, 'atk': 2000, 'def': 2000, 'money': 100,'experience': 100, 'special': 0, 'bomb': false },
|
||||
'skeleton': {'name': '骷髅人', 'hp': 100, 'atk': 35, 'def': 5, 'money': 6,'experience': 4, 'special': 0},
|
||||
'skeletonSoilder': {'name': '骷髅士兵', 'hp': 150, 'atk': 55, 'def': 15, 'money': 10,'experience': 8, 'special': 0},
|
||||
/* 'skeletonCaptain': {'name': '骷髅队长', 'hp': 600, 'atk': 110, 'def': 20, 'money': 13,'experience': 1, 'special': 0}, */
|
||||
/* 'ghostSkeleton': {'name': '冥队长', 'hp': 836, 'atk': 236, 'def': 81, 'money': 28,'experience': 1, 'special': 0}, */
|
||||
'zombie': {'name': '兽人', 'hp': 1000, 'atk': 245, 'def': 45, 'money': 26,'experience': 21, 'special': 0},
|
||||
'zombieKnight': {'name': '兽人武士', 'hp': 2000, 'atk': 340, 'def': 170, 'money': 70,'experience': 55, 'special': 0},
|
||||
'rock': {'name': '石头人', 'hp': 1600, 'atk': 750, 'def': 950, 'money': 31,'experience': 23, 'special': 3},
|
||||
'slimeMan': {'name': '影子战士', 'hp': 3000, 'atk': 500, 'def': 250, 'money': 80,'experience': 60, 'special': 0},
|
||||
'bluePriest': {'name': '初级法师', 'hp': 150, 'atk': 50, 'def': 10, 'money': 8,'experience': 7, 'special': 0},
|
||||
'redPriest': {'name': '高级法师', 'hp': 300, 'atk': 100, 'def': 20, 'money': 20,'experience': 15,'special': 0},
|
||||
/* 'brownWizard': {'name': '初级巫师', 'hp': 500, 'atk': 358, 'def': 222, 'money': 44,'experience': 1, 'special': 2}, */
|
||||
/* 'redWizard': {'name': '高级巫师', 'hp': 1000, 'atk': 100, 'def': 350, 'money': 51,'experience': 1, 'special': 2}, */
|
||||
/* 'yellowGuard': {'name': '初级卫兵', 'hp': 444, 'atk': 85, 'def': 24, 'money': 10,'experience': 1,'special': 0}, */
|
||||
/* 'blueGuard': {'name': '中级卫兵', 'hp': 746, 'atk': 160, 'def': 90, 'money': 24,'experience': 1, 'special': 0}, */
|
||||
/* 'redGuard': {'name': '高级卫兵', 'hp': 560, 'atk': 280, 'def': 160, 'money': 33,'experience': 1, 'special': 0}, */
|
||||
'swordsman': {'name': '双手剑士', 'hp': 600, 'atk': 888, 'def': 60, 'money': 77,'experience': 66, 'special': 4},
|
||||
/* 'soldier': {'name': '冥战士', 'hp': 888, 'atk': 388, 'def': 88, 'money': 39,'experience': 1, 'special': 0}, */
|
||||
'yellowKnight': {'name': '金骑士', 'hp': 2000, 'atk': 1200, 'def': 1000, 'money': 103,'experience': 94, 'special': 0},
|
||||
'redKnight': {'name': '红骑士', 'hp': 3500, 'atk': 1350, 'def': 1200, 'money': 125,'experience': 112, 'special': 0},
|
||||
'darkKnight': {'name': '黑骑士', 'hp': 6000, 'atk': 1600, 'def': 1400, 'money': 173,'experience': 144, 'special': 0},
|
||||
/* 'blackKing': {'name': '黑衣魔王', 'hp': 1356, 'atk': 650, 'def': 356, 'money': 0,'experience': 1, 'special': 0},*/
|
||||
/* 'yellowKing': {'name': '黄衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 1,'special': 0},*/
|
||||
/* 'greenKing': {'name': '青衣武士', 'hp': 688, 'atk': 502, 'def': 332, 'money': 53, 'experience': 1,'special': 0},*/
|
||||
/* 'blueKnight': {'name': '近卫骑士', 'hp': 400, 'atk': 375, 'def': 350, 'money': 49, 'experience': 1,'special': 0},*/
|
||||
/* 'goldSlime': {'name': '黄头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0,'experience': 1, 'special': 0},*/
|
||||
/* 'poisonSkeleton': {'name': '紫骷髅', 'hp': 550, 'atk': 370, 'def': 250, 'money': 42,'experience': 1, 'special': 0},*/
|
||||
/* 'poisonBat': {'name': '紫蝙蝠', 'hp': 743, 'atk': 440, 'def': 304, 'money': 52,'experience': 1, 'special': 0},*/
|
||||
/* 'steelRock': {'name': '铁面人', 'hp': 120, 'atk': 270, 'def': 0, 'money': 50, 'experience': 1,'special': 3},*/
|
||||
/* 'skeletonPriest': {'name': '骷髅法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0,'experience': 1, 'special': 0},*/
|
||||
/* 'skeletonKing': {'name': '骷髅王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0,'experience': 1, 'special': 0},*/
|
||||
/* 'skeletonWizard': {'name': '骷髅巫师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0,'experience': 1, 'special': 0},*/
|
||||
/* 'redSkeletonCaption': {'name': '骷髅武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'special': 0},*/
|
||||
/* 'badHero': {'name': '迷失勇者', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 1,'special': 0},*/
|
||||
/* 'demon': {'name': '魔神武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 1,'special': 0},*/
|
||||
/* 'demonPriest': {'name': '魔神法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 1,'special': 0},*/
|
||||
/* 'goldHornSlime': {'name': '金角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0,'experience': 1, 'special': 0},*/
|
||||
/* 'redKing': {'name': '红衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 1,'special': 0}, */
|
||||
/* 'whiteKing': {'name': '白衣武士', 'hp': 766, 'atk': 544, 'def': 162, 'money': 46, 'experience': 1,'special': 0}, */
|
||||
'blackMagician': {'name': '黑魔法师', 'hp': 7000, 'atk': 2000, 'def': 1500, 'money': 200,'experience': 156,'special': 11, 'value': 1/3},
|
||||
/* 'silverSlime': {'name': '银头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 1,'special': 0}, */
|
||||
/* 'swordEmperor': {'name': '剑圣', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0,'experience': 1, 'special': 0}, */
|
||||
/* 'whiteHornSlime': {'name': '尖角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 1,'special': 0},*/
|
||||
/* 'badPrincess': {'name': '痛苦魔女', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0,'experience': 1, 'special': 0},*/
|
||||
/* 'badFairy': {'name': '黑暗仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 1,'special': 0},*/
|
||||
/* 'grayPriest': {'name': '中级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0,'experience': 1, 'special': 0},*/
|
||||
/* 'redSwordsman': {'name': '剑王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 1,'special': 0},*/
|
||||
'whiteGhost': {'name': '水银战士', 'hp': 4500, 'atk': 1000, 'def': 500, 'money': 100, 'experience': 80,'special': 0},
|
||||
/* 'poisonZombie': {'name': '绿兽人', 'hp': 660, 'atk': 443, 'def': 210, 'money': 43, 'experience': 1,'special': 0},*/
|
||||
'magicDragon': {'name': '魔龙', 'hp': 33333, 'atk': 3333, 'def': 3333, 'money': 0, 'experience': 0,'special': 0, 'bomb': false },
|
||||
'octopus': {'name': '血影', 'hp': 10000, 'atk': 999, 'def': 999, 'money': 999, 'experience': 999, 'special': 0},
|
||||
'fairy': {'name': '仙子', 'hp': 600000, 'atk': 250000, 'def': 50000, 'money': 0, 'experience': 0,'special': 0, 'bomb': false },
|
||||
'greenKnight': {'name': '强盾骑士', 'hp': 15000, 'atk': 3000, 'def': 2000, 'money': 148, 'experience': 133,'special': 3},
|
||||
}
|
||||
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 0, 'special': 0},
|
||||
'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': 9},
|
||||
'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'special': 1},
|
||||
'bigBat': {'name': '大蝙蝠', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redBat': {'name': '红蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 5, 'experience': 0, 'special': 4},
|
||||
'vampire': {'name': '冥灵魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'skeleton': {'name': '骷髅人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'skeletonSoilder': {'name': '骷髅士兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'skeletonCaptain': {'name': '骷髅队长', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'ghostSkeleton': {'name': '冥队长', 'hp': 100, 'atk': 120, 'def': 0, 'money': 8, 'experience': 0, 'special': 7},
|
||||
'zombie': {'name': '兽人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'zombieKnight': {'name': '兽人武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'rock': {'name': '石头人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 4, 'experience': 0, 'special': 3},
|
||||
'slimeMan': {'name': '影子战士', 'hp': 100, 'atk': 0, 'def': 0, 'money': 11, 'experience': 0, 'special': 10}, // 模仿怪的攻防设为0就好
|
||||
'bluePriest': {'name': '初级法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 3, 'experience': 0, 'special': 2},
|
||||
'redPriest': {'name': '高级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'brownWizard': {'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'special': 15, 'value': 100},
|
||||
'redWizard': {'name': '高级巫师', 'hp': 1000, 'atk': 1200, 'def': 0, 'money': 160, 'experience': 0, 'special': 15, 'value': 200},
|
||||
'yellowGuard': {'name': '初级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'blueGuard': {'name': '中级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redGuard': {'name': '高级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'swordsman': {'name': '双手剑士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 6, 'experience': 0, 'special': 5},
|
||||
'soldier': {'name': '冥战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'yellowKnight': {'name': '金骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redKnight': {'name': '红骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'darkKnight': {'name': '黑骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'blackKing': {'name': '黑衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0, 'bomb': false}, // 加入 'bomb': false 代表该怪物不可被炸弹或圣锤炸掉
|
||||
'yellowKing': {'name': '黄衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'greenKing': {'name': '青衣武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'blueKnight': {'name': '蓝骑士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 9, 'experience': 0, 'special': 8},
|
||||
'goldSlime': {'name': '黄头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'poisonSkeleton': {'name': '紫骷髅', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'poisonBat': {'name': '紫蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 14, 'experience': 0, 'special': 13},
|
||||
'steelRock': {'name': '铁面人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'skeletonPriest': {'name': '骷髅法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'skeletonKing': {'name': '骷髅王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'skeletonWizard': {'name': '骷髅巫师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redSkeletonCaption': {'name': '骷髅武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'special': 0},
|
||||
'badHero': {'name': '迷失勇者', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'demon': {'name': '魔神武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'demonPriest': {'name': '魔神法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'goldHornSlime': {'name': '金角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redKing': {'name': '红衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'whiteKing': {'name': '白衣武士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 17, 'experience': 0, 'special': 16},
|
||||
'blackMagician': {'name': '黑魔法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'special': 11, 'value': 1/3}, // 吸血怪需要在后面添加value代表吸血比例
|
||||
'silverSlime': {'name': '银头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 15, 'experience': 0, 'special': 14},
|
||||
'swordEmperor': {'name': '剑圣', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'whiteHornSlime': {'name': '尖角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'badPrincess': {'name': '痛苦魔女', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'badFairy': {'name': '黑暗仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'grayPriest': {'name': '中级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redSwordsman': {'name': '剑王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 7, 'experience': 0, 'special': 6},
|
||||
'whiteGhost': {'name': '水银战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'poisonZombie': {'name': '绿兽人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 13, 'experience': 0, 'special': 12},
|
||||
'magicDragon': {'name': '魔龙', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'octopus': {'name': '血影', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'fairy': {'name': '仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'greenKnight': {'name': '强盾骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
}
|
||||
}
|
||||
|
||||
enemys.prototype.getEnemys = function (enemyId) {
|
||||
@ -86,7 +87,13 @@ enemys.prototype.getSpecialText = function (enemyId) {
|
||||
if (special == 7) return "破甲";
|
||||
if (special == 8) return "反击";
|
||||
if (special == 9) return "净化";
|
||||
if (special == 11) return "吸血";
|
||||
if (special == 10) return "模仿";
|
||||
if (special == 11) return "吸血";
|
||||
if (special == 12) return "中毒";
|
||||
if (special == 13) return "衰弱";
|
||||
if (special == 14) return "诅咒";
|
||||
if (special == 15) return "领域";
|
||||
if (special == 16) return "夹击";
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -111,7 +118,7 @@ enemys.prototype.getDamage = function (monsterId) {
|
||||
// 临界值计算
|
||||
enemys.prototype.getCritical = function (monsterId) {
|
||||
var monster = core.material.enemys[monsterId];
|
||||
if (monster.special == 3) return "???";
|
||||
if (monster.special == 3 || monster.special == 10) return "???";
|
||||
var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef,
|
||||
monster.hp, monster.atk, monster.def, monster.special);
|
||||
if (last == 0) return 0;
|
||||
@ -201,16 +208,28 @@ enemys.prototype.getCurrentEnemys = function () {
|
||||
if (core.isset(used[monsterId])) continue;
|
||||
|
||||
var monster = core.material.enemys[monsterId];
|
||||
var mon_def = monster.def;
|
||||
var mon_atk = monster.atk, mon_def = monster.def;
|
||||
// 坚固
|
||||
if (monster.special==3 && mon_def<core.status.hero.atk-1)
|
||||
mon_def = core.status.hero.atk-1;
|
||||
if (monster.special == 3 && mon_def < core.status.hero.atk - 1)
|
||||
mon_def = core.status.hero.atk - 1;
|
||||
if (monster.special==10) {
|
||||
mon_atk=core.status.hero.atk;
|
||||
mon_def=core.status.hero.def;
|
||||
}
|
||||
|
||||
enemys.push({
|
||||
'id': monsterId, 'name': monster.name, 'hp': monster.hp, 'atk': monster.atk, 'def': mon_def,
|
||||
'money': monster.money, 'experience': monster.experience, 'special': core.enemys.getSpecialText(monsterId),
|
||||
'damage': this.getDamage(monsterId), 'critical': this.getCritical(monsterId),
|
||||
'criticalDamage': this.getCriticalDamage(monsterId), 'defDamage': this.getDefDamage(monsterId)
|
||||
'id': monsterId,
|
||||
'name': monster.name,
|
||||
'hp': monster.hp,
|
||||
'atk': mon_atk,
|
||||
'def': mon_def,
|
||||
'money': monster.money,
|
||||
'experience': monster.experience,
|
||||
'special': core.enemys.getSpecialText(monsterId),
|
||||
'damage': this.getDamage(monsterId),
|
||||
'critical': this.getCritical(monsterId),
|
||||
'criticalDamage': this.getCriticalDamage(monsterId),
|
||||
'defDamage': this.getDefDamage(monsterId)
|
||||
});
|
||||
|
||||
used[monsterId] = true;
|
||||
|
||||
424
libs/events.js
@ -5,8 +5,6 @@ function events() {
|
||||
events.prototype.init = function () {
|
||||
this.events = {
|
||||
'battle': function (data, core, callback) {
|
||||
//core.playSound('floor', 'mp3');
|
||||
//core.rmBlock('event', data.x, data.y);
|
||||
core.battle(data.event.id, data.x, data.y);
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
@ -41,13 +39,17 @@ events.prototype.init = function () {
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
},
|
||||
'blockEvent': function (data, core, callback) {
|
||||
core.events.blockEvent(data);
|
||||
"checkBlock": function (data, core, callback) {
|
||||
core.events.checkBlock(data.x, data.y);
|
||||
},
|
||||
'action': function (data, core, callback) {
|
||||
core.events.doEvents(data.event.data, data.x, data.y);
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
events.prototype.getEvents = function (eventName) {
|
||||
if (eventName == undefined) {
|
||||
return this.events;
|
||||
@ -57,10 +59,9 @@ events.prototype.getEvents = function (eventName) {
|
||||
|
||||
main.instance.events = new events();
|
||||
|
||||
/**
|
||||
* 游戏开始事件
|
||||
* @param hard 难度
|
||||
*/
|
||||
|
||||
|
||||
////// 游戏开始事件 //////
|
||||
events.prototype.startGame = function (hard) {
|
||||
|
||||
core.hideStartAnimate(function() {
|
||||
@ -72,103 +73,120 @@ events.prototype.startGame = function (hard) {
|
||||
|
||||
////// 走到某位置时触发事件 //////
|
||||
events.prototype.blockEvent = function (data) {
|
||||
|
||||
if (core.status.floorId=='MT16' && data.x==6 && data.y==2) {
|
||||
core.waitHeroToStop(function (){
|
||||
// 和魔王对话
|
||||
core.drawText([
|
||||
{'content': '冥灵魔王?你不是已经被我杀了吗?\n为什么会出现在这里??', 'id': 'hero'},
|
||||
{'content': '因为...这里位于魔塔的另一个位面。\n大多数情况下,塔内死亡的生物都会回归这里。', 'id': 'vampire'},
|
||||
{'content': '你的意思是说,我现在已经死了?', 'id': 'hero'},
|
||||
{'content': '是的,能到达这里的,\n除了可以掌控位面的高智慧生物以外,只有\n亡灵。', 'id': 'vampire'},
|
||||
{'content': '呵,既然,我的生命已经不复存在。\n我已经没有什么好怕的了。\n大魔头,我们冤家路窄,居然又见面了,\n决斗吧!', 'id': 'hero'},
|
||||
{'content': '你似乎还没明白。。。', 'id': 'vampire'},
|
||||
{'content': '明白什么?', 'id': 'hero'},
|
||||
{'content': '诶,算了,决一死战吧。', 'id': 'vampire'},
|
||||
], function() {
|
||||
core.removeBlock('data', data.x, data.y);
|
||||
})
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
////// 检查领域、夹击事件 //////
|
||||
events.prototype.checkBlock = function (x,y) {
|
||||
var damage = 0;
|
||||
// 获得四个方向的怪物
|
||||
var directions = [[0,-1],[-1,0],[0,1],[1,0]]; // 上,左,下,右
|
||||
var enemys = [null,null,null,null];
|
||||
for (var i in directions) {
|
||||
var block = core.getBlock(x+directions[i][0], y+directions[i][1]);
|
||||
if (block==null) continue;
|
||||
// 是怪物
|
||||
if (block.block.event.cls=='enemys')
|
||||
enemys[i]=core.material.enemys[block.block.event.id];
|
||||
}
|
||||
|
||||
// 领域
|
||||
for (var i in enemys) {
|
||||
if (enemys[i]!=null && enemys[i].special==15) {
|
||||
damage+=enemys[i].value;
|
||||
}
|
||||
}
|
||||
if (damage>0)
|
||||
core.drawTip('受到领域伤害'+damage+'点');
|
||||
core.status.hero.hp-=damage;
|
||||
if (core.status.hero.hp<=0) {
|
||||
core.status.hero.hp=0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose('zone');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////// onclick事件处理 ///////////////////
|
||||
// 夹击
|
||||
var has=false;
|
||||
if (enemys[0]!=null && enemys[2]!=null && enemys[0].id==enemys[2].id && enemys[0].special==16)
|
||||
has=true;
|
||||
if (enemys[1]!=null && enemys[3]!=null && enemys[1].id==enemys[3].id && enemys[1].special==16)
|
||||
has=true;
|
||||
if (has && core.status.hero.hp>1) { // 1血夹击不死
|
||||
core.status.hero.hp = parseInt(core.status.hero.hp/2);
|
||||
core.drawTip('受到夹击,生命变成一半');
|
||||
}
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
////// 转换楼层结束的事件 //////
|
||||
events.prototype.afterChangeFloor = function (floorId) {
|
||||
|
||||
core.status.hero.flags.passLava = false;
|
||||
|
||||
// 首次到达某层
|
||||
if (!core.isset(core.status.hero.flags.visitFloors[floorId])) {
|
||||
core.status.hero.flags.visitFloors[floorId]=true;
|
||||
if (floorId=='MT1') {
|
||||
core.drawText([
|
||||
{'content': '这里...是哪里?', 'id': 'hero'},
|
||||
{'content': '难道?我还活着?', 'id': 'hero'},
|
||||
{'content': '一股似曾相识的感觉,\n但我又不知道在哪里见过。', 'id': 'hero'},
|
||||
{'content': '魔塔已经被大火烧成了灰烬,\n这里为什么安然无恙?这到底是什么地方?', 'id': 'hero'},
|
||||
{'content': '这里,我感觉到不像是我生活的地方。\n难道我已经到了异世界吗?', 'id': 'hero'},
|
||||
{'content': '算了,不管这么多了。\n只要我还活着,一切都好。', 'id': 'hero'},
|
||||
{'content': '我先四处看看要怎么出去吧。', 'id': 'hero'},
|
||||
{'content': '(系统提示)本塔快捷键如下:\n\n[↑][↓][←][→] 移动\n[X] 怪物手册\n[G] 楼层传送器\n[T] 工具栏\n[K] 快捷商店\n[S/L] 存/读档\n[ESC] 菜单栏\n同时也可以点击状态栏中的图标进行操作。'},
|
||||
{'content': '(系统提示)\n在菜单栏里可以同步存档,这样可以很方便的让你\n在多设备(例如手机/电脑)之间接档游戏。'}
|
||||
]);
|
||||
}
|
||||
if (floorId=='MT2') {
|
||||
core.drawText([
|
||||
{'content': '奇怪,我明明杀死了血影。\n为什么这里又出现了一个。', 'id': 'hero'},
|
||||
{'content': '不过我的力量似乎都被冻结了。\n目前肯定是无法杀死血影,\n等我变强以后再回来吧。', 'id': 'hero'},
|
||||
]);
|
||||
}
|
||||
if (floorId=='MT11') {
|
||||
core.drawText([
|
||||
{'content': '诶,奇怪,我明明只是上了一层楼而已。\n为什么,这里变得如此的寒冷...', 'id': 'hero'},
|
||||
{'content': '诶,毕竟我已经不在我生活的世界了。\n很多事情都是预料不到的。', 'id': 'hero'},
|
||||
{'content': '不管怎么说,我要继续上去看个究竟。', 'id': 'hero'}
|
||||
])
|
||||
}
|
||||
if (floorId=='MT20') {
|
||||
core.drawText([
|
||||
{'content': '这...这里就是塔顶了吗。\n仙子,你怎么也在这里。\n魔塔倒塌了,你也死掉了所以到达这里了吗?', 'id': 'hero'},
|
||||
{'content': '呵,怎么可能。我怎么会这么容易死。\n这里就是位面的交界处了,\n我就是这个位面的操纵者。', 'id': 'fairy'},
|
||||
{'content': '你居然有这样强大的能力!\n跟我第一次遇见你差距太大了吧!', 'id': 'hero'},
|
||||
{'content': '是的,一开始,我弱不禁风。\n但是你帮我集齐了十字架和三个灵杖,\n让我的能力得到了巨幅度的提高。', 'id': 'fairy'},
|
||||
{'content': '估计你自己也想不到这些东西有这么大的威力。\n不过还要感谢你的无私奉献成就了我的现在。', 'id': 'fairy'},
|
||||
{'content': '......', 'id': 'hero'},
|
||||
{'content': '其实,魔塔倒塌是我一手策划的,\n就是为了把所有的生物都驱逐进这个亡灵位面。', 'id': 'fairy'},
|
||||
{'content': '我一直策划着等我有一天变强了,\n我要一人统治世界,消灭掉所有的其他生物。\n如今我的目标达成了。', 'id': 'fairy'},
|
||||
{'content': '消灭其他所有生物?也就是说也包括我?', 'id': 'hero'},
|
||||
{'content': '没错。愚蠢的人类终于觉悟了。', 'id': 'fairy'},
|
||||
{'content': '呵呵,想当初,我就应该一刀把你杀了。\n真没想到我会轻信你的鬼话。', 'id': 'hero'},
|
||||
{'content': '现在说这些还有什么用呢,\n你和我的力量根本就不是一个级别的。\n劝你放弃抵抗吧。', 'id': 'fairy'},
|
||||
{'content': '(仙子有来源于高维度的力量支持,\n所以目前强大无比。我是不可能战胜的。)', 'id': 'hero'},
|
||||
{'content': '(不过,这个位面力量非常不稳定,\n如果我能成功的封印她,切断外界的支持,\n也许还能有机会求胜。)', 'id': 'hero'},
|
||||
{'content': '(仙子目前的位置正好被八个小怪包围,\n如果按照当年封印Zeno的方法去封印她,\n能否成功呢?这是我唯一的希望。)', 'id': 'hero'},
|
||||
{'content': '系统提示:(专门给没玩过TSW的玩家看的)\n击杀仙子周围的四个怪,保留四个角的怪。\n如果还看不懂的,看一眼你的小键盘,\n仙子在5的位置,击杀2468。'},
|
||||
]);
|
||||
}
|
||||
if (!core.hasFlag("visited_"+floorId)) {
|
||||
this.doEvents(core.status.thisMap.firstArrive);
|
||||
core.setFlag("visited_"+floorId, true);
|
||||
}
|
||||
}
|
||||
|
||||
////// 实际事件的处理 //////
|
||||
events.prototype.doEvents = function (list, x, y, callback) {
|
||||
// 停止勇士
|
||||
core.waitHeroToStop(function() {
|
||||
if (!core.isset(list)) return;
|
||||
if (!(list instanceof Array)) {
|
||||
list = [list];
|
||||
}
|
||||
core.lockControl();
|
||||
core.status.event = {'id': 'action', 'data': {
|
||||
'list': list, 'x': x, 'y': y, 'callback': callback
|
||||
}}
|
||||
core.events.doAction();
|
||||
});
|
||||
}
|
||||
|
||||
events.prototype.doAction = function() {
|
||||
// 事件处理完毕
|
||||
if (core.status.event.data.list.length==0) {
|
||||
if (core.isset(core.status.event.data.callback))
|
||||
core.status.event.data.callback();
|
||||
core.ui.closePanel(false);
|
||||
return;
|
||||
}
|
||||
var data = core.status.event.data.list.shift();
|
||||
core.status.event.data.current = data;
|
||||
|
||||
////// 选中菜单栏 //////
|
||||
var x=core.status.event.data.x, y=core.status.event.data.y;
|
||||
|
||||
// 不同种类的事件
|
||||
|
||||
// 如果是文字:显示
|
||||
if (typeof data == "string") {
|
||||
core.status.event.data.type='text';
|
||||
core.ui.drawTextBox(data);
|
||||
return;
|
||||
}
|
||||
core.status.event.data.type=data.type;
|
||||
switch (data.type) {
|
||||
case "text": // 文字/对话
|
||||
core.ui.drawTextBox(data.data);
|
||||
break;
|
||||
case "disappear": // 消失
|
||||
core.removeBlock('event', x, y);
|
||||
this.doAction();
|
||||
break;
|
||||
case "sleep": // 等待多少毫秒
|
||||
setTimeout(function () {
|
||||
core.events.doAction();
|
||||
}, data.data);
|
||||
break;
|
||||
case "exit": // 立刻结束事件
|
||||
core.status.event.data.list = [];
|
||||
core.events.doAction();
|
||||
break;
|
||||
default:
|
||||
core.status.event.data.type='text';
|
||||
core.ui.drawTextBox("\t[警告,]出错啦!\n"+data.type+" 事件不被支持...");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
////// 降低难度 //////
|
||||
events.prototype.decreaseHard = function() {
|
||||
@ -194,13 +212,11 @@ events.prototype.decreaseHard = function() {
|
||||
////// 能否使用快捷商店 //////
|
||||
events.prototype.canUseQuickShop = function(index) {
|
||||
if (core.status.floorId == 'MT20') return '当前不能使用快捷商店。';
|
||||
if (core.status.hero.flags.passLava) return '由于你刚刚经过岩浆,此时不得使用快捷商店。\n切换楼层后恢复。';
|
||||
return null;
|
||||
}
|
||||
|
||||
////// 尝试使用道具 //////
|
||||
events.prototype.useItem = function(itemId) {
|
||||
console.log("使用道具:"+core.material.items[itemId].name);
|
||||
core.ui.closePanel(false);
|
||||
|
||||
if (itemId=='book') {
|
||||
@ -212,73 +228,158 @@ events.prototype.useItem = function(itemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO add other items
|
||||
if (core.canUseItem(itemId)) core.useItem(itemId);
|
||||
else core.drawTip("当前无法使用"+core.material.items[itemId].name);
|
||||
}
|
||||
|
||||
/****** 打完怪物 ******/
|
||||
events.prototype.afterBattle = function(enemyId) {
|
||||
if (core.status.floorId == 'MT14' && !core.enemyExists(5,9) && !core.enemyExists(7,9)) {
|
||||
core.openDoor("specialDoor", 6, 8, false);
|
||||
events.prototype.afterBattle = function(enemyId,x,y,callback) {
|
||||
|
||||
// 毒衰咒的处理
|
||||
var special = core.material.enemys[enemyId].special;
|
||||
// 中毒
|
||||
if (special==12 && !core.hasFlag('poison')) {
|
||||
core.setFlag('poison', true);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
if (core.status.floorId == 'MT20') {
|
||||
// 检查封印
|
||||
if (!core.status.hero.flags.seal20F) {
|
||||
// 四个角都存在,四边都不存在
|
||||
if (core.enemyExists(5,5) && core.enemyExists(5,7) && core.enemyExists(7,7) && core.enemyExists(7,5)
|
||||
&& !core.enemyExists(5,6) && !core.enemyExists(7,6) && !core.enemyExists(6,5) && !core.enemyExists(6,7)) {
|
||||
// 触发封印
|
||||
core.status.hero.flags.seal20F = true;
|
||||
core.material.enemys.fairy.hp /= 10;
|
||||
core.material.enemys.fairy.atk /= 10;
|
||||
core.material.enemys.fairy.def /= 10;
|
||||
core.updateFg();
|
||||
core.drawText([
|
||||
{'content': '啊,我怎么被封印了!\n能量只剩下一成了!', 'id': 'fairy'}
|
||||
]);
|
||||
// core.drawTip("触发仙子封印");
|
||||
core.clearContinueAutomaticRoute();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 打败仙子
|
||||
if (enemyId == 'fairy') {
|
||||
core.events.win();
|
||||
core.clearContinueAutomaticRoute();
|
||||
return;
|
||||
}
|
||||
// 衰弱
|
||||
if (special==13 && !core.hasFlag('weak')) {
|
||||
core.setFlag('weak', true);
|
||||
core.status.hero.atk-=core.flags.weakValue;
|
||||
core.status.hero.def-=core.flags.weakValue;
|
||||
core.updateStatusBar();
|
||||
}
|
||||
// 诅咒
|
||||
if (special==14 && !core.hasFlag('curse')) {
|
||||
core.setFlag('curse', true);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
|
||||
// 检查处理后的事件。
|
||||
var event = core.floors[core.status.floorId].afterBattle[x+","+y];
|
||||
if (core.isset(event)) {
|
||||
core.events.doEvents(event, x, y, callback);
|
||||
}
|
||||
//继续行走
|
||||
core.continueAutomaticRoute();
|
||||
else {
|
||||
core.continueAutomaticRoute();
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
}
|
||||
|
||||
/****** 开完门 ******/
|
||||
events.prototype.afterOpenDoor = function(doorId) {
|
||||
|
||||
events.prototype.afterOpenDoor = function(doorId,x,y,callback) {
|
||||
// 检查处理后的事件。
|
||||
var event = core.floors[core.status.floorId].afterOpenDoor[x+","+y];
|
||||
if (core.isset(event)) {
|
||||
core.events.doEvents(event, x, y, callback);
|
||||
}
|
||||
//继续行走
|
||||
core.continueAutomaticRoute();
|
||||
else {
|
||||
core.continueAutomaticRoute();
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
}
|
||||
|
||||
/****** 经过路障 ******/
|
||||
events.prototype.passNet = function (data) {
|
||||
// 有鞋子
|
||||
if (core.hasItem('shoes')) return;
|
||||
if (data.event.id=='lavaNet') {
|
||||
core.status.hero.hp -= 100;
|
||||
core.status.hero.hp -= core.flags.lavaDamage;
|
||||
if (core.status.hero.hp<=0) {
|
||||
core.status.hero.hp=0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose();
|
||||
core.events.lose('lava');
|
||||
return;
|
||||
}
|
||||
core.status.hero.flags.passLava = true;
|
||||
core.updateStatusBar();
|
||||
core.drawTip('经过熔岩,生命-100');
|
||||
core.drawTip('经过血网,生命-'+core.flags.lavaDamage);
|
||||
}
|
||||
if (data.event.id=='poisonNet') {
|
||||
if (core.hasFlag('poison')) return;
|
||||
core.setFlag('poison', true);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
if (data.event.id=='weakNet') {
|
||||
if (core.hasFlag('weak')) return;
|
||||
core.setFlag('weak', true);
|
||||
core.status.hero.atk-=core.flags.weakValue;
|
||||
core.status.hero.def-=core.flags.weakValue;
|
||||
core.updateStatusBar();
|
||||
}
|
||||
if (data.event.id=='curseNet') {
|
||||
if (core.hasFlag('curse')) return;
|
||||
core.setFlag('curse', true);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
// NPC自定义操作
|
||||
events.prototype.npcCustomAction = function (npcData) {
|
||||
|
||||
}
|
||||
|
||||
// 当点击(x,y)位置后自定义操作
|
||||
events.prototype.npcCustomActionOnClick = function (npcData, x, y) {
|
||||
|
||||
}
|
||||
|
||||
// NPC自定义事件处理
|
||||
events.prototype.npcCustomEffect = function (effect, npc) {
|
||||
|
||||
}
|
||||
|
||||
// 存档事件前一刻的处理
|
||||
events.prototype.beforeSaveData = function(data) {
|
||||
|
||||
}
|
||||
|
||||
// 读档事件后,载入事件前,对数据的处理
|
||||
events.prototype.afterLoadData = function(data) {
|
||||
|
||||
}
|
||||
|
||||
events.prototype.win = function(reason) {
|
||||
// 获胜
|
||||
core.waitHeroToStop(function() {
|
||||
core.clearMap('all');
|
||||
core.rmGlobalAnimate(0,0,true);
|
||||
core.drawText([
|
||||
"\t[结局3]恭喜通关!"
|
||||
], function () {
|
||||
core.restart();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
events.prototype.lose = function(reason) {
|
||||
// 失败
|
||||
core.waitHeroToStop(function() {
|
||||
core.drawText('\t[结局1]你死了。', function () {
|
||||
core.restart();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************/
|
||||
/*********** 界面上的点击事件 ***************/
|
||||
/******************************************/
|
||||
|
||||
// 正在处理事件时的点击操作...
|
||||
events.prototype.clickAction = function (x,y) {
|
||||
|
||||
if (core.status.event.data.type=='text') {
|
||||
// 文字
|
||||
this.doAction();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 怪物手册
|
||||
events.prototype.clickBook = function(x,y) {
|
||||
@ -359,6 +460,7 @@ events.prototype.clickShop = function(x,y) {
|
||||
}
|
||||
}
|
||||
|
||||
// 快捷商店
|
||||
events.prototype.clickSelectShop = function(x,y) {
|
||||
if (x >= 5 && x <= 7) {
|
||||
var shopList = core.status.shops, keys = Object.keys(shopList);
|
||||
@ -394,7 +496,6 @@ events.prototype.clickToolbox = function(x,y) {
|
||||
return;
|
||||
}
|
||||
|
||||
var itemId = null;
|
||||
var items = null;
|
||||
|
||||
if (y>=4 && y<=7 && x!=12)
|
||||
@ -547,60 +648,3 @@ events.prototype.clickNPC = function(x,y) {
|
||||
}
|
||||
|
||||
/*********** 点击事件 END ***************/
|
||||
|
||||
|
||||
// NPC自定义操作
|
||||
events.prototype.npcCustomAction = function (npcData) {
|
||||
|
||||
}
|
||||
|
||||
// 当点击(x,y)位置后自定义操作
|
||||
events.prototype.npcCustomActionOnClick = function (npcData, x, y) {
|
||||
|
||||
}
|
||||
|
||||
// NPC自定义事件处理
|
||||
events.prototype.npcCustomEffect = function (effect, npc) {
|
||||
|
||||
}
|
||||
|
||||
// 存档事件前一刻的处理
|
||||
events.prototype.beforeSaveData = function(data) {
|
||||
|
||||
}
|
||||
|
||||
// 读档事件后,载入事件前,对数据的处理
|
||||
events.prototype.afterLoadData = function(data) {
|
||||
// 重新封印仙子
|
||||
if (core.status.hero.flags.seal20F) {
|
||||
var fairy = core.material.enemys.fairy;
|
||||
fairy.hp/=10;
|
||||
fairy.atk/=10;
|
||||
fairy.def/=10;
|
||||
}
|
||||
}
|
||||
|
||||
events.prototype.win = function() {
|
||||
// 获胜
|
||||
|
||||
core.waitHeroToStop(function() {
|
||||
core.clearMap('all');
|
||||
core.rmGlobalAnimate(0,0,true);
|
||||
core.drawText([
|
||||
{'content': '终于,我逃脱了这个可怕的异空间。', 'id': 'hero'},
|
||||
{'content': '接下来,我要何去何从。', 'id': 'hero'},
|
||||
{'content': '顺着这条漆黑的甬道走下去,\n我能回到我的现实世界吗?', 'id': 'hero'},
|
||||
{'content': '恭喜通关难度' + core.status.hard + '!你的分数是:' + core.status.hero.hp + '\n欢迎截图到发布帖下进行炫耀!\n\n再次感谢对本塔的支持!'}
|
||||
], function () {
|
||||
core.restart();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
events.prototype.lose = function() {
|
||||
// 失败
|
||||
core.drawText('很不好意思,但是你死了。', function () {
|
||||
core.restart();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@ function MT0() {}
|
||||
|
||||
MT0.prototype.init = function() {
|
||||
this.data = {
|
||||
'id': 'MT0', // 楼层唯一标识符
|
||||
'title': "样板层", // 楼层中文名
|
||||
'name': 0, // 显示在status bar中的名称
|
||||
'floorId': 'MT0', // 楼层唯一标识符
|
||||
'title': "样板层", // 楼层中文名;转换楼层时显示
|
||||
'name': 0, // 显示在状态栏中的楼层名称
|
||||
"canFlyTo": true, // 该楼能否被飞行器飞到(不能的话在该楼也不允许使用)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
|
||||
|
||||
111
libs/floors/sample0.js
Normal file
@ -0,0 +1,111 @@
|
||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||
main.floors.sample0 = {
|
||||
'floorId': 'sample0', // 楼层唯一标识符,需要和名字完全一致
|
||||
'title': "样板 0 层", // 楼层中文名
|
||||
'name': 0, // 显示在状态栏中的名称
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[0, 0, 220, 0, 0, 6, 87, 3, 65, 64, 44, 43, 42],
|
||||
[0, 246, 0, 246, 0, 6, 0, 3, 58, 59, 60, 61, 41],
|
||||
[219, 0, 0, 0, 219, 6, 0, 3, 57, 26, 62, 63, 40],
|
||||
[6, 6, 125, 6, 6, 6, 0, 3, 53, 54, 55, 56, 39],
|
||||
[216, 247, 256, 235, 248, 6, 0, 3, 49, 50, 51, 52, 38],
|
||||
[5, 5, 125, 5, 5, 5, 0, 1, 45, 46, 47, 48, 37],
|
||||
[224, 254, 212, 232, 204, 5, 0, 1, 31, 32, 34, 33, 36],
|
||||
[201, 205, 217, 215, 207, 5, 0, 1, 27, 28, 29, 30, 35],
|
||||
[5, 5, 125, 5, 5, 5, 0, 1, 21, 22, 23, 24, 25],
|
||||
[45, 0, 0, 0, 0, 0, 0, 1, 1, 1, 121, 1, 1],
|
||||
[4, 4, 126, 4, 4, 4, 0, 0, 0, 0, 0, 85, 124],
|
||||
[87, 11, 12, 13, 14, 4, 4, 2, 2, 2, 122, 2, 2],
|
||||
[88, 89, 90, 91, 92, 93, 94, 2, 81, 82, 83, 84, 86],
|
||||
],
|
||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||
"\t[样板提示,]首次到达某层可以触发 firstArrive 事件,\n该事件可类似于RMXP中的“自动执行脚本”。",
|
||||
"本事件支持一切的事件类型,常常用来触发对话,\n例如:",
|
||||
"\t[hero]我是谁?\n我从哪来?\n我又要到哪去?",
|
||||
"\t[仙子,fairy]你问我...?我也不知道啊...",
|
||||
"本层主要对道具、门、怪物等进行介绍,\n有关事件的各种信息在下一层会有更为详细的说明。",
|
||||
],
|
||||
"events": { // 该楼的所有可能事件列表;NPC事件和楼层转换事件也需要包括在内
|
||||
|
||||
/****** NPC事件 ******/
|
||||
"10,9": [ // (10,9)位置:守着道具的老人
|
||||
"\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类:items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、\n剑盾等。\nconstants 为永久道具,例如怪物手册、楼层\n传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中\n心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。",
|
||||
"\t[老人,man]有关道具效果,定义在items.js中。\n目前大多数道具已有默认行为,如有自定义\n的需求则需在items.js中修改代码。",
|
||||
"\t[老人,man]constants 和 tools 各最多只允许12种,\n多了会导致图标溢出。",
|
||||
"\t[老人,man]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",
|
||||
{"type": "disappear"} // 消失
|
||||
],
|
||||
"10,11": [ // (10,11)位置,守着门的老人
|
||||
"\t[老人,woman]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。",
|
||||
"\t[老人,woman]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",
|
||||
{'type': 'disappear'}
|
||||
],
|
||||
"2,10": [ // (2,10)位置,守着楼梯、传送门、路障的老人
|
||||
"\t[老人,womanMagician]这些是楼梯、路障、传送门。",
|
||||
"\t[老人,womanMagician]楼梯和传送门需要在events中定义目标楼层\n和位置,可参见样板里已有的的写法。",
|
||||
"\t[老人,womanMagician]血网的伤害数值、中毒后每步伤害数值、衰弱\n时攻防下降的数值,都在 data.js 内定义。\n\n路障同样会尽量被自动寻路绕过。",
|
||||
{"type": "disappear"}
|
||||
],
|
||||
"2,8": [ // 守着第一批怪物的老人
|
||||
"\t[老人,magician]这些都是各种各样的怪物。\n所有怪物的属性都在enemys.js中设置。\n\n每个怪物最多只能有一个属性。",
|
||||
"\t[老人,magician]这批怪物分别为:普通、先攻、魔攻、坚固、\n2连击、3连击、4连击、破甲、反击、净化。",
|
||||
"\t[老人,magician]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",
|
||||
{"type": "disappear"}
|
||||
],
|
||||
"2,5": [
|
||||
"\t[老人,magician]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值,\n可参见样板中黑魔法师的写法。",
|
||||
{"type": "disappear"}
|
||||
],
|
||||
"2,3": [
|
||||
"\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值,\n可参见样板中初级巫师的写法。",
|
||||
"\t[老人,magician]出于游戏性能的考虑,我们不可能每走一步都\n对领域和夹击进行检查。\n因此我们需要在本楼层的 events 中指明哪些\n点可能会触发领域和夹击事件,在这些点才会\n对领域和夹击进行检查和处理。\n\n具体可参见本层样板中events的做法。",
|
||||
"\t[老人,magician]夹击和领域同时发生时先计算领域,再夹击。\n\n另:本塔不支持阻击怪。",
|
||||
{"type": "disappear"}
|
||||
],
|
||||
|
||||
/****** 楼层转换事件 ******/
|
||||
|
||||
|
||||
|
||||
|
||||
/****** 领域、夹击检查事件 ******/
|
||||
"1,0": {"trigger": "checkBlock"},
|
||||
"0,1": {"trigger": "checkBlock"},
|
||||
"1,1": {"trigger": "checkBlock"},
|
||||
"1,2": {"trigger": "checkBlock"},
|
||||
"2,1": {"trigger": "checkBlock"},
|
||||
"1,0": {"trigger": "checkBlock"},
|
||||
"3,0": {"trigger": "checkBlock"},
|
||||
"3,2": {"trigger": "checkBlock"},
|
||||
"4,1": {"trigger": "checkBlock"},
|
||||
|
||||
},
|
||||
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
||||
"11,12": "你开了一个绿门,触发了一个afterOpenDoor事件"
|
||||
},
|
||||
"afterBattle": { // 战斗后可能触发的事件列表
|
||||
"2,6": "\t[ghostSkeleton]不可能,你怎么可能打败我!\n(一个打败怪物触发的事件)"
|
||||
},
|
||||
"afterGetItem": { // 获得道具后可能触发的事件列表
|
||||
"11,8": "由于状态栏放不下,绿钥匙和铁门钥匙均视为tools,\n放入工具栏中。\n碰到绿门和铁门仍然会自动使用开门。",
|
||||
"8,6": "由于吸血和夹击等的存在,血瓶默认自动被绕路。\n你可以修改data.js中的系统Flag来设置这一项。",
|
||||
"8,7": "如需修改消耗品的效果,请前往items.js,修改\ngetItemEffect 和 getItemEffectTip 两个函数\n的具体数值即可。",
|
||||
"9,5": [
|
||||
"每层楼的 canFlyTo 决定了该楼层能否被飞到。\n\n不能被飞到的楼层也无法使用楼层传送器。",
|
||||
"飞行的楼层顺序由 main.js 中 floorIds 加载顺序\n所决定。\n\n是否必须在楼梯边使用楼传器由 data.js 中的系统\nFlag所决定。"
|
||||
],
|
||||
"10,5": "破墙镐是破面前的墙壁还是四个方向的墙壁,\n由data.js中的系统Flag所决定。",
|
||||
"8,4": [
|
||||
"炸弹可以炸四个方向的怪物。\n如只需要炸前方怪物请使用上面的圣锤。",
|
||||
"不能被炸的怪物在enemys中可以定义。\n可参见样板里黑衣魔王的写法。\n\n炸死怪物是否触发事件由 data.js 中的系统Flag\n所决定。"
|
||||
],
|
||||
"9,4": "中心对称飞行器飞向的目标不能在楼层的events\n列表里存在,即使事件已经结束(如刚刚的老人)。",
|
||||
"10,4": "上楼器和下楼器的目标点要求同中心对称飞行器。\n\n“上楼”和“下楼”的目标层由 main.js 的 floorIds\n顺序所决定。",
|
||||
"10,3": "十字架目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。",
|
||||
"9,2": "该道具默认是大黄门钥匙,如需改为钥匙盒直接\n修改 data.js 中的系统Flag即可。",
|
||||
"10,2": "屠龙匕首目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。",
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
function MT1() {}
|
||||
function sample1() {}
|
||||
|
||||
MT1.prototype.init = function() {
|
||||
sample1.prototype.init = function() {
|
||||
this.data = {
|
||||
'id': 'MT1', // 楼层唯一标识符
|
||||
'floorId': 'template', // 楼层唯一标识符,需要和名字完全一致
|
||||
'title': "样板层", // 楼层中文名
|
||||
'name': 0, // 显示在status bar中的名称
|
||||
"canFlyTo": true, // 该楼能否被飞行器飞到(不能的话在该楼也不允许使用)
|
||||
@ -27,4 +27,4 @@ MT1.prototype.init = function() {
|
||||
};
|
||||
}
|
||||
|
||||
main.floors.template = new MT1();
|
||||
main.floors.sample1 = new sample1();
|
||||
@ -1,30 +0,0 @@
|
||||
function template() {}
|
||||
|
||||
template.prototype.init = function() {
|
||||
this.data = {
|
||||
'id': 'template', // 楼层唯一标识符,需要和名字完全一致
|
||||
'title': "样板层", // 楼层中文名
|
||||
'name': 0, // 显示在status bar中的名称
|
||||
"canFlyTo": true, // 该楼能否被飞行器飞到(不能的话在该楼也不允许使用)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
|
||||
],
|
||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||
|
||||
],
|
||||
"events": [ // 该楼的所有可能事件列表
|
||||
|
||||
],
|
||||
"afterOpenDoor": [ // 开完门后可能触发的事件列表
|
||||
|
||||
],
|
||||
"afterBattle": [ // 战斗后可能触发的事件列表
|
||||
|
||||
],
|
||||
"afterGetItem": [ // 获得道具后可能触发的事件列表
|
||||
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
main.floors.template = new template();
|
||||
326
libs/icons.js
@ -6,172 +6,188 @@ icons.prototype.init = function () {
|
||||
this.icons = {
|
||||
'heros': {
|
||||
'hero1': {
|
||||
'down': {'loc': {'iconLoc': 0, 'stop': 0, 'leftFoot': 1, 'rightFoot': 2}, 'size': 32},
|
||||
'left': {'loc': {'iconLoc': 1, 'stop': 0, 'leftFoot': 1, 'rightFoot': 2}, 'size': 32},
|
||||
'right': {'loc': {'iconLoc': 2, 'stop': 0, 'leftFoot': 1, 'rightFoot': 2}, 'size': 32},
|
||||
'up': {'loc': {'iconLoc': 3, 'stop': 0, 'leftFoot': 1, 'rightFoot': 2}, 'size': 32}
|
||||
'down': {'loc': 0, 'stop': 0, 'leftFoot': 1, 'rightFoot': 2},
|
||||
'left': {'loc': 1, 'stop': 0, 'leftFoot': 1, 'rightFoot': 2},
|
||||
'right': {'loc': 2, 'stop': 0, 'leftFoot': 1, 'rightFoot': 2},
|
||||
'up': {'loc': 3, 'stop': 0, 'leftFoot': 1, 'rightFoot': 2}
|
||||
}
|
||||
},
|
||||
'terrains': {
|
||||
'ground': {'loc': 0, 'size': 32},
|
||||
'yellowWall': {'loc': 1, 'size': 32},
|
||||
'whiteWall': {'loc': 2, 'size': 32},
|
||||
'blueWall': {'loc': 3, 'size': 32},
|
||||
'starWall': {'loc': 4, 'size': 32},
|
||||
'lavaWall': {'loc': 5, 'size': 32},
|
||||
'downFloor': {'loc': 6, 'size': 32},
|
||||
'upFloor': {'loc': 7, 'size': 32},
|
||||
'cavity': {'loc': 8, 'size': 32},
|
||||
'yellowDoor': {'loc': 9, 'size': 32},
|
||||
'blueDoor': {'loc': 10, 'size': 32},
|
||||
'redDoor': {'loc': 11, 'size': 32},
|
||||
'greenDoor': {'loc': 12, 'size': 32},
|
||||
'specialDoor': {'loc': 13, 'size': 32},
|
||||
'steelDoor': {'loc': 14, 'size': 32},
|
||||
'blueShop-left': {'loc': 15, 'size': 32},
|
||||
'blueShop-right': {'loc': 16, 'size': 32},
|
||||
'redShop-left': {'loc': 17, 'size': 32},
|
||||
'redShop-right': {'loc': 18, 'size': 32}
|
||||
'ground': 0,
|
||||
'yellowWall': 1,
|
||||
'whiteWall': 2,
|
||||
'blueWall': 3,
|
||||
'star': 4,
|
||||
'lava': 5,
|
||||
'ice': 6,
|
||||
'downFloor': 7,
|
||||
'upFloor': 8,
|
||||
'yellowDoor': 9,
|
||||
'blueDoor': 10,
|
||||
'redDoor': 11,
|
||||
'greenDoor': 12,
|
||||
'specialDoor': 13,
|
||||
'steelDoor': 14,
|
||||
'blueShop-left': 15,
|
||||
'blueShop-right': 16,
|
||||
'pinkShop-left': 17,
|
||||
'pinkShop-right': 18
|
||||
},
|
||||
'animates': {
|
||||
'star': {'loc': 0, 'size': 32},
|
||||
'lava': {'loc': 1, 'size': 32},
|
||||
'water': {'loc': 2, 'size': 32},
|
||||
'yellowDoor': {'loc': 3, 'size': 32},
|
||||
'blueDoor': {'loc': 4, 'size': 32},
|
||||
'redDoor': {'loc': 5, 'size': 32},
|
||||
'greenDoor': {'loc': 6, 'size': 32},
|
||||
'specialDoor': {'loc': 7, 'size': 32},
|
||||
'blueWallDoor': {'loc': 8, 'size': 32},
|
||||
'yellowWallDoor': {'loc': 9, 'size': 32},
|
||||
'whiteWallDoor': {'loc': 10, 'size': 32},
|
||||
'ironDoor': {'loc': 11, 'size': 32},
|
||||
'lavaDoor': {'loc': 12, 'size': 32},
|
||||
'grayLavaDoor': {'loc': 13, 'size': 32},
|
||||
'starDoor': {'loc': 14, 'size': 32},
|
||||
'mockBlueWallDoor': {'loc': 15, 'size': 32},
|
||||
'mockYellowWallDoor': {'loc': 16, 'size': 32},
|
||||
'mockWhiteWallDoor': {'loc': 17, 'size': 32},
|
||||
'iceYellowWallDoor': {'loc': 18, 'size': 32},
|
||||
'transparentStar': {'loc': 19, 'size': 32},
|
||||
'exclamation': {'loc': 20, 'size': 32},
|
||||
'portal': {'loc': 21, 'size': 32},
|
||||
'switch': {'loc': 22, 'size': 32},
|
||||
'lavaNet': {'loc': 23, 'size': 32}
|
||||
'star': 0,
|
||||
'lava': 1,
|
||||
'water': 2,
|
||||
'yellowDoor': 3,
|
||||
'blueDoor': 4,
|
||||
'redDoor': 5,
|
||||
'greenDoor': 6,
|
||||
'specialDoor': 7,
|
||||
'blueWallDoor': 8,
|
||||
'yellowWallDoor': 9,
|
||||
'whiteWallDoor': 10,
|
||||
'steelDoor': 11,
|
||||
'lavaDoor': 12,
|
||||
'grayLavaDoor': 13,
|
||||
'starDoor': 14,
|
||||
'mockBlueWallDoor': 15,
|
||||
'mockYellowWallDoor': 16,
|
||||
'mockWhiteWallDoor': 17,
|
||||
'iceYellowWallDoor': 18,
|
||||
'starPortal': 19,
|
||||
'exclamation': 20,
|
||||
'portal': 21,
|
||||
'switch': 22,
|
||||
'lavaNet': 23,
|
||||
'poisonNet': 24,
|
||||
'weakNet': 25,
|
||||
'curseNet': 26,
|
||||
'downPortal': 27,
|
||||
'leftPortal': 28,
|
||||
'rightPortal': 29,
|
||||
'upPortal': 30
|
||||
},
|
||||
'npcs': {
|
||||
'man': {'loc': 0, 'size': 32},
|
||||
'woman': {'loc': 1, 'size': 32},
|
||||
'thief': {'loc': 2, 'size': 32},
|
||||
'fairy': {'loc': 3, 'size': 32},
|
||||
'magician': {'loc': 4, 'size': 32},
|
||||
'womanMagician': {'loc': 5, 'size': 32},
|
||||
'wood': {'loc': 8, 'size': 32},
|
||||
'blueShop': {'loc': 10, 'size': 32},
|
||||
'redShop': {'loc': 9, 'size': 32},
|
||||
'princess': {'loc': 11, 'size': 32}
|
||||
'man': 0,
|
||||
'woman': 1,
|
||||
'thief': 2,
|
||||
'fairy': 3,
|
||||
'magician': 4,
|
||||
'womanMagician': 5,
|
||||
'oldMan': 6,
|
||||
'child': 7,
|
||||
'wood': 8,
|
||||
'pinkShop': 9,
|
||||
'blueShop': 10,
|
||||
'princess': 11
|
||||
},
|
||||
'enemys': {
|
||||
'greenSlime': {'loc': 0, 'size': 32},
|
||||
'redSlime': {'loc': 1, 'size': 32},
|
||||
'blackSlime': {'loc': 2, 'size': 32},
|
||||
'slimelord': {'loc': 3, 'size': 32},
|
||||
'bat': {'loc': 4, 'size': 32},
|
||||
'bigBat': {'loc': 5, 'size': 32},
|
||||
'redBat': {'loc': 6, 'size': 32},
|
||||
'vampire': {'loc': 7, 'size': 32},
|
||||
'skeleton': {'loc': 8, 'size': 32},
|
||||
'skeletonSoilder': {'loc': 9, 'size': 32},
|
||||
'skeletonCaptain': {'loc': 10, 'size': 32},
|
||||
'ghostSkeleton': {'loc': 11, 'size': 32},
|
||||
'zombie': {'loc': 12, 'size': 32},
|
||||
'zombieKnight': {'loc': 13, 'size': 32},
|
||||
'rock': {'loc': 14, 'size': 32},
|
||||
'slimeMan': {'loc': 15, 'size': 32},
|
||||
'bluePriest': {'loc': 16, 'size': 32},
|
||||
'redPriest': {'loc': 17, 'size': 32},
|
||||
'brownWizard': {'loc': 18, 'size': 32},
|
||||
'redWizard': {'loc': 19, 'size': 32},
|
||||
'yellowGuard': {'loc': 20, 'size': 32},
|
||||
'blueGuard': {'loc': 21, 'size': 32},
|
||||
'redGuard': {'loc': 22, 'size': 32},
|
||||
'swordsman': {'loc': 23, 'size': 32},
|
||||
'soldier': {'loc': 24, 'size': 32},
|
||||
'yellowKnight': {'loc': 25, 'size': 32},
|
||||
'redKnight': {'loc': 26, 'size': 32},
|
||||
'darkKnight': {'loc': 27, 'size': 32},
|
||||
'blackKing': {'loc': 28, 'size': 32},
|
||||
'yellowKing': {'loc': 29, 'size': 32},
|
||||
'greenKing': {'loc': 30, 'size': 32},
|
||||
'blueKnight': {'loc': 31, 'size': 32},
|
||||
'goldSlime': {'loc': 32, 'size': 32},
|
||||
'poisonSkeleton': {'loc': 33, 'size': 32},
|
||||
'poisonBat': {'loc': 34, 'size': 32},
|
||||
'steelRock': {'loc': 35, 'size': 32},
|
||||
'skeletonPriest': {'loc': 36, 'size': 32},
|
||||
'skeletonKing': {'loc': 37, 'size': 32},
|
||||
'skeletonWizard': {'loc': 38, 'size': 32},
|
||||
'redSkeletonCaption': {'loc': 39, 'size': 32},
|
||||
'badHero': {'loc': 40, 'size': 32},
|
||||
'demon': {'loc': 41, 'size': 32},
|
||||
'demonPriest': {'loc': 42, 'size': 32},
|
||||
'goldHornSlime': {'loc': 43, 'size': 32},
|
||||
'redKing': {'loc': 44, 'size': 32},
|
||||
'whiteKing': {'loc': 45, 'size': 32},
|
||||
'blackMagician': {'loc': 46, 'size': 32},
|
||||
'silverSlime': {'loc': 47, 'size': 32},
|
||||
'swordEmperor': {'loc': 48, 'size': 32},
|
||||
'whiteHornSlime': {'loc': 49, 'size': 32},
|
||||
'badPrincess': {'loc': 50, 'size': 32},
|
||||
'badFairy': {'loc': 51, 'size': 32},
|
||||
'grayPriest': {'loc': 52, 'size': 32},
|
||||
'redSwordsman': {'loc': 53, 'size': 32},
|
||||
'whiteGhost': {'loc': 54, 'size': 32},
|
||||
'poisonZombie': {'loc': 55, 'size': 32},
|
||||
'magicDragon': {'loc': 56, 'size': 32},
|
||||
'octopus': {'loc': 57, 'size': 32},
|
||||
'fairy': {'loc': 58, 'size': 32},
|
||||
'greenKnight': {'loc': 59, 'size': 32},
|
||||
'greenSlime': 0,
|
||||
'redSlime': 1,
|
||||
'blackSlime': 2,
|
||||
'slimelord': 3,
|
||||
'bat': 4,
|
||||
'bigBat': 5,
|
||||
'redBat': 6,
|
||||
'vampire': 7,
|
||||
'skeleton': 8,
|
||||
'skeletonSoilder': 9,
|
||||
'skeletonCaptain': 10,
|
||||
'ghostSkeleton': 11,
|
||||
'zombie': 12,
|
||||
'zombieKnight': 13,
|
||||
'rock': 14,
|
||||
'slimeMan': 15,
|
||||
'bluePriest': 16,
|
||||
'redPriest': 17,
|
||||
'brownWizard': 18,
|
||||
'redWizard': 19,
|
||||
'yellowGuard': 20,
|
||||
'blueGuard': 21,
|
||||
'redGuard': 22,
|
||||
'swordsman': 23,
|
||||
'soldier': 24,
|
||||
'yellowKnight': 25,
|
||||
'redKnight': 26,
|
||||
'darkKnight': 27,
|
||||
'blackKing': 28,
|
||||
'yellowKing': 29,
|
||||
'greenKing': 30,
|
||||
'blueKnight': 31,
|
||||
'goldSlime': 32,
|
||||
'poisonSkeleton': 33,
|
||||
'poisonBat': 34,
|
||||
'steelRock': 35,
|
||||
'skeletonPriest': 36,
|
||||
'skeletonKing': 37,
|
||||
'skeletonWizard': 38,
|
||||
'redSkeletonCaption': 39,
|
||||
'badHero': 40,
|
||||
'demon': 41,
|
||||
'demonPriest': 42,
|
||||
'goldHornSlime': 43,
|
||||
'redKing': 44,
|
||||
'whiteKing': 45,
|
||||
'blackMagician': 46,
|
||||
'silverSlime': 47,
|
||||
'swordEmperor': 48,
|
||||
'whiteHornSlime': 49,
|
||||
'badPrincess': 50,
|
||||
'badFairy': 51,
|
||||
'grayPriest': 52,
|
||||
'redSwordsman': 53,
|
||||
'whiteGhost': 54,
|
||||
'poisonZombie': 55,
|
||||
'magicDragon': 56,
|
||||
'octopus': 57,
|
||||
'fairy': 58,
|
||||
'greenKnight': 59,
|
||||
},
|
||||
'items': {
|
||||
'yellowKey': {'loc': 0, 'size': 32},
|
||||
'blueKey': {'loc': 1, 'size': 32},
|
||||
'redKey': {'loc': 2, 'size': 32},
|
||||
'greenKey': {'loc': 3, 'size': 32},
|
||||
'steelKey': {'loc': 4, 'size': 32},
|
||||
'bigKey': {'loc': 6, 'size': 32},
|
||||
'redJewel': {'loc': 16, 'size': 32},
|
||||
'blueJewel': {'loc': 17, 'size': 32},
|
||||
'greenJewel': {'loc': 18, 'size': 32},
|
||||
'yellowJewel': {'loc': 19, 'size': 32},
|
||||
'redPotion': {'loc': 20, 'size': 32},
|
||||
'bluePotion': {'loc': 21, 'size': 32},
|
||||
'greenPotion': {'loc': 22, 'size': 32},
|
||||
'yellowPotion': {'loc': 23, 'size': 32},
|
||||
'book': {'loc': 9, 'size': 32},
|
||||
'fly': {'loc': 12, 'size': 32},
|
||||
'coin': {'loc': 11, 'size': 32},
|
||||
'wand': {'loc': 10, 'size': 32},
|
||||
'cross': {'loc': 40, 'size': 32},
|
||||
'snow': {'loc': 41, 'size': 32},
|
||||
'pickaxe': {'loc': 45, 'size': 32},
|
||||
'icePickaxe': {'loc': 44, 'size': 32},
|
||||
'bomb': {'loc': 43, 'size': 32},
|
||||
'centerFly': {'loc': 13, 'size': 32},
|
||||
'downFly': {'loc': 14, 'size': 32},
|
||||
'upFly': {'loc': 15, 'size': 32},
|
||||
'earthquake': {'loc': 8, 'size': 32},
|
||||
'sword1': {'loc': 50, 'size': 32},
|
||||
'sword2': {'loc': 51, 'size': 32},
|
||||
'sword3': {'loc': 52, 'size': 32},
|
||||
'sword4': {'loc': 53, 'size': 32},
|
||||
'sword5': {'loc': 54, 'size': 32},
|
||||
'shield1': {'loc': 55, 'size': 32},
|
||||
'shield2': {'loc': 56, 'size': 32},
|
||||
'shield3': {'loc': 57, 'size': 32},
|
||||
'shield4': {'loc': 58, 'size': 32},
|
||||
'shield5': {'loc': 59, 'size': 32},
|
||||
'superPotion': {'loc': 29, 'size': 32},
|
||||
'yellowKey': 0,
|
||||
'blueKey': 1,
|
||||
'redKey': 2,
|
||||
'greenKey': 3,
|
||||
'steelKey': 4,
|
||||
'bigKey': 6,
|
||||
'redJewel': 16,
|
||||
'blueJewel': 17,
|
||||
'greenJewel': 18,
|
||||
'yellowJewel': 19,
|
||||
'redPotion': 20,
|
||||
'bluePotion': 21,
|
||||
'greenPotion': 22,
|
||||
'yellowPotion': 23,
|
||||
'sword1': 50,
|
||||
'sword2': 51,
|
||||
'sword3': 52,
|
||||
'sword4': 53,
|
||||
'sword5': 54,
|
||||
'shield1': 55,
|
||||
'shield2': 56,
|
||||
'shield3': 57,
|
||||
'shield4': 58,
|
||||
'shield5': 59,
|
||||
'book': 9,
|
||||
'fly': 12,
|
||||
'pickaxe': 45,
|
||||
'icePickaxe': 44,
|
||||
'bomb': 43,
|
||||
'centerFly': 13,
|
||||
'upFly': 15,
|
||||
'downFly': 14,
|
||||
'coin': 11,
|
||||
'snow': 41,
|
||||
'cross': 40,
|
||||
'superPotion': 29,
|
||||
'earthquake': 8,
|
||||
'poisonWine': 24,
|
||||
'weakWine': 25,
|
||||
'curseWine': 27,
|
||||
'superWine': 28,
|
||||
'knife': 42,
|
||||
'moneyPocket': 46,
|
||||
'shoes': 47,
|
||||
'hammer': 48
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
360
libs/items.js
@ -29,85 +29,174 @@ items.prototype.init = function () {
|
||||
'shield4': {'cls': 'items', 'name': '圣盾'},
|
||||
'shield5': {'cls': 'items', 'name': '神圣盾'},
|
||||
'superPotion': {'cls': 'items', 'name': '圣水'},
|
||||
'bigKey': {'cls': 'items', 'name': '钥匙盒'},
|
||||
'moneyPocket': {'cls': 'items', 'name': '金钱袋'},
|
||||
|
||||
// 物品
|
||||
'greenKey': {'cls': 'tools', 'name': '绿钥匙', 'text': '可以打开一扇绿门'},
|
||||
'steelKey': {'cls': 'tools', 'name': '铁门钥匙', 'text': '可以打开一扇铁门'},
|
||||
'book': {'cls': 'constants', 'name': '怪物手册', 'text': '可以查看当前楼层各怪物属性。'},
|
||||
'fly': {'cls': 'constants', 'name': '楼层传送器', 'text': '可以自由往来去过的楼层。'},
|
||||
'book': {'cls': 'constants', 'name': '怪物手册', 'text': '可以查看当前楼层各怪物属性'},
|
||||
'fly': {'cls': 'constants', 'name': '楼层传送器', 'text': '可以自由往来去过的楼层'},
|
||||
'coin': {'cls': 'constants', 'name': '幸运金币', 'text': '持有时打败怪物可得双倍金币'},
|
||||
'snow': {'cls': 'constants', 'name': '冰冻徽章', 'text': '可以将面前的一块熔岩变成平地'},
|
||||
'cross': {'cls': 'constants', 'name': '十字架', 'text': '持有后无视怪物的无敌属性'},
|
||||
'snow': {'cls': 'constants', 'name': '冰冻徽章', 'text': '可以将四周的熔岩变成平地'},
|
||||
'cross': {'cls': 'constants', 'name': '十字架', 'text': '该道具尚未被定义'},
|
||||
'knife': {'cls': 'constants', 'name': '屠龙匕首', 'text': '该道具尚未被定义'},
|
||||
'shoes': {'cls': 'constants', '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': '可以破坏当前层的所有墙'}
|
||||
|
||||
'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': '可以炸掉勇士面前的怪物'}
|
||||
}
|
||||
}
|
||||
|
||||
items.prototype.getItems = function (itemName) {
|
||||
if (itemName == undefined) {
|
||||
return this.items;
|
||||
}
|
||||
return this.items[itemsName];
|
||||
// 初始化道具
|
||||
items.prototype.getItems = function () {
|
||||
// 大黄门钥匙?钥匙盒?
|
||||
if (core.flags.bigKeyIsBox)
|
||||
this.items['bigKey'] = {'cls': 'items', 'name': '钥匙盒'};
|
||||
// 面前的墙?四周的墙?
|
||||
if (core.flags.pickaxeFourDirections)
|
||||
this.items.pickaxe.text = "可以破坏勇士四周的墙";
|
||||
return this.items;
|
||||
}
|
||||
|
||||
main.instance.items = new items();
|
||||
|
||||
|
||||
items.prototype.getItemEffect = function(itemId, itemNum) {
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
// 消耗品
|
||||
if (itemCls === 'items') {
|
||||
if (itemId === 'redJewel') core.status.hero.atk += 3;
|
||||
if (itemId === 'blueJewel') core.status.hero.def += 3;
|
||||
if (itemId === 'greenJewel') core.status.hero.mdef += 5;
|
||||
if (itemId == 'yellowJewel') {
|
||||
core.status.hero.hp+=1000;
|
||||
core.status.hero.atk+=6;
|
||||
core.status.hero.def+=6;
|
||||
core.status.hero.mdef+=10;
|
||||
}
|
||||
if (itemId === 'redPotion') core.status.hero.hp += 200;
|
||||
if (itemId === 'bluePotion') core.status.hero.hp += 500;
|
||||
if (itemId === 'yellowPotion') core.status.hero.hp += 500;
|
||||
if (itemId === 'greenPotion') core.status.hero.hp += 800;
|
||||
if (itemId === 'sword1') core.status.hero.atk += 10;
|
||||
if (itemId === 'sword2') core.status.hero.atk += 20;
|
||||
if (itemId == 'sword3') core.status.hero.atk += 40;
|
||||
if (itemId == 'sword4') core.status.hero.atk += 80;
|
||||
if (itemId === 'sword5') core.status.hero.atk += 160;
|
||||
if (itemId === 'shield1') core.status.hero.def += 10;
|
||||
if (itemId === 'shield2') core.status.hero.def += 20;
|
||||
if (itemId === 'shield3') core.status.hero.def += 40;
|
||||
if (itemId === 'shield4') core.status.hero.def += 80;
|
||||
if (itemId === 'shield5') core.status.hero.def += 160;
|
||||
if (itemId === 'bigKey') {
|
||||
core.status.hero.items.keys.yellowKey++;
|
||||
core.status.hero.items.keys.blueKey++;
|
||||
core.status.hero.items.keys.redKey++;
|
||||
}
|
||||
if (itemId == 'superPotion') core.status.hero.hp *= 2;
|
||||
if (itemId == 'moneyPocket') core.status.hero.money += 500;
|
||||
}
|
||||
else {
|
||||
core.addItem(itemId, itemNum);
|
||||
}
|
||||
}
|
||||
|
||||
items.prototype.getItemEffectTip = function(itemId) {
|
||||
if (itemId === 'redJewel') return ",攻击+3";
|
||||
if (itemId === 'blueJewel') return ",防御+3";
|
||||
if (itemId === 'greenJewel') return ",魔防+3";
|
||||
if (itemId == 'yellowJewel') return ",全属性提升";
|
||||
if (itemId === 'redPotion') return ",生命+200";
|
||||
if (itemId === 'bluePotion') return ",生命+500";
|
||||
if (itemId === 'yellowPotion') return ",生命+500";
|
||||
if (itemId === 'greenPotion') return ",生命+800";
|
||||
if (itemId === 'sword1') return ",攻击+10";
|
||||
if (itemId === 'sword2') return ",攻击+20";
|
||||
if (itemId === 'sword3') return ",攻击+40";
|
||||
if (itemId === 'sword4') return ",攻击+80";
|
||||
if (itemId === 'sword5') return ",攻击+160";
|
||||
if (itemId === 'shield1') return ",防御+10";
|
||||
if (itemId === 'shield2') return ",防御+20";
|
||||
if (itemId === 'shield3') return ",防御+40";
|
||||
if (itemId === 'shield4') return ",防御+80";
|
||||
if (itemId === 'shield5') return ",防御+160";
|
||||
if (itemId === 'bigKey') return ",全钥匙+1";
|
||||
if (itemId === 'superPotion') return ",生命值翻倍";
|
||||
if (itemId == 'moneyPocket') return ",金币+500";
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
items.prototype.useItem = function (itemId) {
|
||||
// 使用道具
|
||||
if (!this.canUseItem(itemId)) return;
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
|
||||
// 永久道具
|
||||
if (itemCls == 'constants') {
|
||||
if (itemId=='book') {
|
||||
core.ui.drawEnemyBook(1);
|
||||
}
|
||||
if (itemId=='fly') {
|
||||
core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));
|
||||
}
|
||||
}
|
||||
// 消耗道具
|
||||
if (itemCls == 'tools') {
|
||||
core.status.hero.items[itemCls][itemId]--;
|
||||
if (itemId == 'earthquake' || itemId == 'bomb' || itemId == 'pickaxe') {
|
||||
// 地震卷轴/炸弹/破墙镐
|
||||
core.removeBlockByIds(core.status.floorId, core.status.event.data);
|
||||
core.drawMap(core.status.floorId, function () {
|
||||
core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');
|
||||
core.updateFg();
|
||||
core.drawTip(core.material.items[itemId].name + "使用成功");
|
||||
if (itemId == 'bomb' && core.flags.bombTrigger) {
|
||||
core.events.afterBattle();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (itemId == 'centerFly') {
|
||||
// 对称飞
|
||||
core.clearMap('hero', 0, 0, 416, 416);
|
||||
core.setHeroLoc('x', core.status.event.data.x);
|
||||
core.setHeroLoc('y', core.status.event.data.y);
|
||||
if (itemId=='book') core.ui.drawEnemyBook(1);
|
||||
if (itemId=='fly') core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));
|
||||
if (itemId == 'earthquake' || itemId == 'bomb' || itemId == 'pickaxe' || itemId=='icePickaxe'
|
||||
|| itemId == 'snow' || itemId == 'hammer' || itemId=='bigKey') {
|
||||
// 消除当前层的某些块
|
||||
core.removeBlockByIds(core.status.floorId, core.status.event.data);
|
||||
core.drawMap(core.status.floorId, function () {
|
||||
core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');
|
||||
core.updateFg();
|
||||
core.drawTip(core.material.items[itemId].name + "使用成功");
|
||||
}
|
||||
if (itemId == 'upFly' || itemId == 'downFly') {
|
||||
// 上楼器/下楼器
|
||||
core.changeFloor(core.status.event.data.id, null, {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y}, function (){
|
||||
core.drawTip(core.material.items[itemId].name + "使用成功");
|
||||
});
|
||||
}
|
||||
if (core.status.hero.items[itemCls][itemId]==0)
|
||||
delete core.status.hero.items[itemCls][itemId];
|
||||
if (itemId == 'bomb' && core.flags.bombTrigger) {
|
||||
core.events.afterBattle();
|
||||
}
|
||||
else if (itemId=='hammer' && core.flags.bombTrigger) {
|
||||
core.events.afterBattle(core.status.event.data[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (itemId == 'centerFly') {
|
||||
// 对称飞
|
||||
core.clearMap('hero', 0, 0, 416, 416);
|
||||
core.setHeroLoc('x', core.status.event.data.x);
|
||||
core.setHeroLoc('y', core.status.event.data.y);
|
||||
core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');
|
||||
core.drawTip(core.material.items[itemId].name + "使用成功");
|
||||
}
|
||||
if (itemId == 'upFly' || itemId == 'downFly') {
|
||||
// 上楼器/下楼器
|
||||
core.changeFloor(core.status.event.data.id, null, {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y}, function (){
|
||||
core.drawTip(core.material.items[itemId].name + "使用成功");
|
||||
});
|
||||
}
|
||||
if (itemId == 'poisonWine') core.setFlag('poison', false);
|
||||
if (itemId == 'weakWine') {
|
||||
core.setFlag('weak', false);
|
||||
core.status.hero.atk += core.flags.weakValue;
|
||||
core.status.hero.def += core.flags.weakValue;
|
||||
}
|
||||
if (itemId == 'curseWine') core.setFlag('curse', false);
|
||||
if (itemId == 'superWine') {
|
||||
core.setFlag('poison', false);
|
||||
core.setFlag('weak', false);
|
||||
core.status.hero.atk += core.flags.weakValue;
|
||||
core.status.hero.def += core.flags.weakValue;
|
||||
core.setFlag('curse', false);
|
||||
}
|
||||
core.updateStatusBar();
|
||||
// 道具使用完毕:删除
|
||||
if (itemCls=='tools')
|
||||
core.status.hero.items[itemCls][itemId]--;
|
||||
if (core.status.hero.items[itemCls][itemId]==0)
|
||||
delete core.status.hero.items[itemCls][itemId];
|
||||
}
|
||||
|
||||
items.prototype.canUseItem = function (itemId) {
|
||||
@ -123,8 +212,9 @@ items.prototype.canUseItem = function (itemId) {
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.event.id == 'yellowWall') {
|
||||
|
||||
if (core.isset(block.event) &&
|
||||
(block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙
|
||||
{
|
||||
// 四个方向
|
||||
if (core.flags.pickaxeFourDirections) {
|
||||
if (Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {
|
||||
@ -132,14 +222,7 @@ items.prototype.canUseItem = function (itemId) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 获得勇士的下一个位置
|
||||
var scan = {
|
||||
'up': {'x': 0, 'y': -1},
|
||||
'left': {'x': -1, 'y': 0},
|
||||
'down': {'x': 0, 'y': 1},
|
||||
'right': {'x': 1, 'y': 0}
|
||||
};
|
||||
if (block.x == core.status.hero.loc.x+scan[core.status.hero.loc.direction].x && block.y == core.status.hero.loc.y+scan[core.status.hero.loc.direction].y) {
|
||||
if (block.x == core.nextX() && block.y == core.nextY()) {
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
@ -151,6 +234,17 @@ items.prototype.canUseItem = function (itemId) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'icePickaxe') {
|
||||
// 破冰镐
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {
|
||||
core.status.event.data = [i];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'bomb') {
|
||||
// 炸弹
|
||||
var ids = [];
|
||||
@ -168,6 +262,19 @@ items.prototype.canUseItem = function (itemId) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'hammer') {
|
||||
// 圣锤
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.event.cls == 'enemys' && block.x==core.nextX() && block.y==core.nextY()) {
|
||||
var enemy = core.material.enemys[block.event.id];
|
||||
if (core.isset(enemy.bomb) && !enemy.bomb) continue;
|
||||
core.status.event.data = [i];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'earthquake') {
|
||||
var ids = []
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
@ -195,14 +302,11 @@ items.prototype.canUseItem = function (itemId) {
|
||||
}
|
||||
if (itemId == 'upFly') {
|
||||
// 上楼器
|
||||
if (core.status.floorId == 'MT20' || core.status.floorId == 'MT21') // 禁用条件
|
||||
return false;
|
||||
var toId = null, found = false; // 上楼后的楼层ID
|
||||
for (var id in core.status.maps) {
|
||||
if (found) {toId = id; break;}
|
||||
if (id == core.status.floorId) found=true;
|
||||
}
|
||||
if (!found) return false;
|
||||
var floorId = core.status.floorId;
|
||||
var index = core.floorIds.indexOf(floorId);
|
||||
if (index==core.floorIds.length-1) return false;
|
||||
var toId = core.floorIds[index+1];
|
||||
|
||||
// 检查是否存在block(不是空地)
|
||||
var toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');
|
||||
var blocks = core.status.maps[toId].blocks;
|
||||
@ -211,20 +315,19 @@ items.prototype.canUseItem = function (itemId) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 可以上楼,记录下位置信息,返回true
|
||||
core.status.event.data = {'id': toId, 'x': toX, 'y': toY};
|
||||
return true;
|
||||
}
|
||||
if (itemId == 'downFly') {
|
||||
// 下楼器
|
||||
if (core.status.floorId == 'MT0' || core.status.floorId == 'MT21')
|
||||
return false;
|
||||
var toId = null;
|
||||
for (var id in core.status.maps) {
|
||||
if (id == core.status.floorId) break;
|
||||
toId = id;
|
||||
}
|
||||
if (toId == null) return false;
|
||||
var floorId = core.status.floorId;
|
||||
var index = core.floorIds.indexOf(floorId);
|
||||
if (index==0) return false;
|
||||
var toId = core.floorIds[index-1];
|
||||
|
||||
// 检查是否存在block(不是空地)
|
||||
var toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');
|
||||
var blocks = core.status.maps[toId].blocks;
|
||||
for (var s = 0; s < blocks.length; s++) {
|
||||
@ -232,61 +335,44 @@ items.prototype.canUseItem = function (itemId) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 可以上楼,记录下位置信息,返回true
|
||||
core.status.event.data = {'id': toId, 'x': toX, 'y': toY};
|
||||
return true;
|
||||
}
|
||||
if (itemId=='snow') {
|
||||
// 冰冻徽章
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
if (ids.length>0) {
|
||||
core.status.event.data = ids;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId=='bigKey') {
|
||||
// 大黄门钥匙
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.event.id == 'yellowDoor') {
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
if (ids.length>0) {
|
||||
core.status.event.data = ids;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId=='poisonWine') return core.hasFlag('poison');
|
||||
if (itemId=='weakWine') return core.hasFlag('weak');
|
||||
if (itemId=='curseWine') return core.hasFlag('curse');
|
||||
if (itemId=='superWine') return core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse');
|
||||
return false;
|
||||
}
|
||||
|
||||
items.prototype.getItemEffect = function(itemId, itemNum) {
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
// 消耗品
|
||||
if (itemCls === 'items') {
|
||||
if (itemId === 'redJewel') core.status.hero.atk += 3;
|
||||
if (itemId === 'blueJewel') core.status.hero.def += 3;
|
||||
if (itemId === 'greenJewel') core.status.hero.mdef += 3;
|
||||
// if (itemId == 'yellowJewel') core.status.hero.atk+=0;
|
||||
if (itemId === 'redPotion') core.status.hero.hp += 200;
|
||||
if (itemId === 'bluePotion') core.status.hero.hp += 500;
|
||||
if (itemId === 'yellowPotion') core.status.hero.hp += 500;
|
||||
if (itemId === 'greenPotion') core.status.hero.hp += 800;
|
||||
if (itemId === 'sword1') core.status.hero.atk += 10;
|
||||
if (itemId === 'sword2') core.status.hero.atk += 100;
|
||||
if (itemId === 'sword5') core.status.hero.atk += 1000;
|
||||
if (itemId === 'shield1') core.status.hero.def += 10;
|
||||
if (itemId === 'shield2') core.status.hero.def += 100;
|
||||
if (itemId === 'shield5') {
|
||||
core.status.hero.def += 1000;
|
||||
core.status.hero.flags.hasShield5 = true;
|
||||
}
|
||||
if (itemId === 'bigKey') {
|
||||
core.status.hero.items.keys.yellowKey++;
|
||||
core.status.hero.items.keys.blueKey++;
|
||||
core.status.hero.items.keys.redKey++;
|
||||
}
|
||||
if (itemId == 'superPotion') core.status.hero.hp *= 2;
|
||||
}
|
||||
else {
|
||||
core.addItem(itemId, itemNum);
|
||||
}
|
||||
}
|
||||
|
||||
items.prototype.getItemEffectTip = function(itemId) {
|
||||
if (itemId === 'redJewel') return ",攻击+3";
|
||||
if (itemId === 'blueJewel') return ",防御+3";
|
||||
if (itemId === 'greenJewel') return ",魔防+3";
|
||||
// if (itemId == 'yellowJewel') ;
|
||||
if (itemId === 'redPotion') return ",生命+200";
|
||||
if (itemId === 'bluePotion') return ",生命+500";
|
||||
if (itemId === 'yellowPotion') return ",生命+500";
|
||||
if (itemId === 'greenPotion') return ",生命+800";
|
||||
if (itemId === 'sword1') return ",攻击+10";
|
||||
if (itemId === 'sword2') return ",攻击+100";
|
||||
if (itemId === 'sword5') return ",攻击+1000";
|
||||
if (itemId === 'shield1') return ",防御+10";
|
||||
if (itemId === 'shield2') return ",防御+100";
|
||||
if (itemId === 'shield5') return ",防御+1000";
|
||||
if (itemId === 'bigKey') return ",全钥匙+1";
|
||||
if (itemId === 'superPotion') return ",生命值翻倍";
|
||||
return "";
|
||||
}
|
||||
|
||||
749
libs/maps.js
@ -1,557 +1,255 @@
|
||||
function maps() {
|
||||
function maps() {}
|
||||
maps.prototype.init = function() {}
|
||||
|
||||
}
|
||||
|
||||
maps.prototype.init = function () {
|
||||
|
||||
var map_txt = [
|
||||
[ // 0F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 87, 0, 0, 0, 0, 0, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 1F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 87, 0, 101, 102, 101, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 6],
|
||||
[6, 18, 0, 105, 81, 0, 1, 12, 19, 15, 1, 0, 6],
|
||||
[6, 15, 113, 12, 1, 0, 1, 1, 82, 1, 1, 0, 6],
|
||||
[6, 1, 81, 1, 1, 0, 1, 0, 105, 0, 1, 101, 6],
|
||||
[6, 0, 113, 0, 1, 0, 1, 15, 102, 15, 1, 0, 6],
|
||||
[6, 15, 113, 11, 1, 0, 1, 1, 81, 1, 1, 0, 6],
|
||||
[6, 1, 81, 1, 1, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 12, 114, 11, 1, 1, 81, 1, 1, 1, 83, 1, 6],
|
||||
[6, 0, 18, 0, 1, 15, 15, 16, 1, 16, 113, 16, 6],
|
||||
[6, 15, 35, 16, 1, 32, 0, 33, 1, 15, 15, 15, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 2F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 88, 1, 117, 19, 19, 19, 0, 19, 19, 19, 117, 6],
|
||||
[6, 0, 1, 0, 1, 1, 1, 81, 1, 1, 1, 0, 6],
|
||||
[6, 0, 1, 12, 1, 1, 0, 0, 0, 1, 1, 11, 6],
|
||||
[6, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 6],
|
||||
[6, 0, 1, 118, 1, 1, 0, 143, 0, 1, 1, 118, 6],
|
||||
[6, 0, 1, 141, 37, 1, 1, 83, 1, 1, 38, 141, 6],
|
||||
[6, 0, 1, 12, 1, 1, 1, 11, 1, 1, 1, 11, 6],
|
||||
[6, 0, 1, 1, 1, 1, 12, 12, 12, 1, 1, 1, 6],
|
||||
[6, 0, 1, 0, 1, 19, 110, 16, 110, 15, 0, 117, 6],
|
||||
[6, 0, 81, 110, 1, 1, 1, 1, 1, 1, 1, 81, 6],
|
||||
[6, 87, 1, 0, 0, 0, 18, 18, 18, 0, 0, 0, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 3F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 15, 113, 16, 1, 113, 71, 113, 1, 11, 18, 101, 6],
|
||||
[6, 105, 1, 105, 1, 12, 113, 11, 1, 18, 101, 0, 6],
|
||||
[6, 0, 1, 0, 1, 1, 82, 1, 1, 101, 113, 19, 6],
|
||||
[6, 0, 81, 0, 15, 15, 0, 0, 1, 1, 81, 1, 6],
|
||||
[6, 101, 1, 81, 1, 1, 1, 0, 1, 0, 0, 0, 6],
|
||||
[6, 102, 1, 0, 1, 0, 81, 0, 1, 0, 1, 0, 6],
|
||||
[6, 101, 1, 0, 102, 0, 1, 101, 1, 17, 1, 0, 6],
|
||||
[6, 0, 1, 1, 1, 81, 1, 113, 1, 15, 1, 113, 6],
|
||||
[6, 0, 0, 0, 1, 105, 1, 101, 1, 15, 1, 0, 6],
|
||||
[6, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 6],
|
||||
[6, 88, 0, 0, 1, 0, 102, 0, 105, 0, 1, 87, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 4F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 0, 0, 0, 0, 114, 105, 105, 0, 0, 0, 87, 6],
|
||||
[6, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 0, 0, 0, 0, 18, 0, 109, 0, 0, 81, 0, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 6],
|
||||
[6, 1, 117, 15, 1, 11, 18, 1, 12, 15, 1, 114, 6],
|
||||
[6, 1, 47, 117, 81, 0, 110, 82, 19, 109, 81, 0, 6],
|
||||
[6, 1, 117, 15, 1, 11, 19, 1, 12, 15, 1, 113, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 6],
|
||||
[6, 0, 0, 0, 0, 18, 0, 109, 0, 0, 81, 0, 6],
|
||||
[6, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 0, 0, 0, 0, 113, 105, 105, 0, 0, 0, 88, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 5F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 22, 1, 118, 81, 0, 72, 0, 82, 0, 81, 88, 6],
|
||||
[6, 0, 1, 0, 1, 0, 0, 0, 1, 113, 1, 0, 6],
|
||||
[6, 110, 1, 110, 1, 1, 110, 1, 1, 19, 1, 0, 6],
|
||||
[6, 0, 0, 0, 1, 16, 114, 15, 1, 12, 1, 0, 6],
|
||||
[6, 1, 83, 1, 1, 1, 81, 1, 1, 1, 1, 0, 6],
|
||||
[6, 0, 0, 0, 114, 0, 0, 81, 0, 0, 0, 0, 6],
|
||||
[6, 1, 81, 1, 1, 1, 114, 1, 110, 1, 1, 1, 6],
|
||||
[6, 19, 117, 19, 1, 0, 0, 1, 0, 11, 11, 0, 6],
|
||||
[6, 15, 15, 15, 1, 0, 1, 1, 1, 1, 1, 0, 6],
|
||||
[6, 1, 1, 1, 1, 81, 1, 15, 1, 15, 1, 0, 6],
|
||||
[6, 87, 117, 0, 7, 0, 114, 18, 110, 18, 114, 0, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 6F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 19, 19, 19, 1, 118, 34, 118, 1, 12, 12, 12, 6],
|
||||
[6, 18, 18, 18, 1, 0, 117, 0, 1, 11, 11, 11, 6],
|
||||
[6, 1, 81, 1, 1, 1, 82, 1, 1, 1, 81, 1, 6],
|
||||
[6, 114, 0, 0, 110, 81, 117, 81, 110, 0, 0, 114, 6],
|
||||
[6, 1, 1, 7, 1, 1, 1, 1, 1, 7, 1, 1, 6],
|
||||
[6, 18, 1, 110, 1, 17, 16, 15, 1, 110, 1, 19, 6],
|
||||
[6, 114, 81, 0, 1, 1, 82, 1, 1, 0, 81, 114, 6],
|
||||
[6, 11, 1, 109, 1, 19, 114, 19, 1, 109, 1, 12, 6],
|
||||
[6, 11, 1, 110, 1, 1, 81, 1, 1, 110, 1, 12, 6],
|
||||
[6, 1, 1, 109, 1, 18, 0, 73, 1, 109, 1, 1, 6],
|
||||
[6, 88, 81, 0, 0, 0, 114, 0, 0, 0, 81, 87, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 7F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 23, 7, 7, 7, 0, 16, 0, 83, 18, 118, 18, 6],
|
||||
[6, 1, 1, 1, 1, 117, 1, 117, 1, 117, 18, 117, 6],
|
||||
[6, 0, 1, 0, 1, 117, 1, 19, 1, 1, 81, 1, 6],
|
||||
[6, 118, 0, 117, 0, 12, 1, 11, 1, 15, 19, 19, 6],
|
||||
[6, 1, 1, 1, 81, 1, 1, 1, 1, 15, 1, 81, 6],
|
||||
[6, 11, 0, 0, 118, 0, 1, 0, 81, 0, 1, 117, 6],
|
||||
[6, 11, 1, 117, 19, 117, 19, 117, 1, 117, 1, 117, 6],
|
||||
[6, 11, 1, 1, 1, 1, 1, 1, 1, 117, 1, 46, 6],
|
||||
[6, 0, 0, 117, 12, 117, 0, 0, 1, 81, 1, 1, 6],
|
||||
[6, 1, 81, 1, 1, 1, 1, 7, 1, 117, 0, 0, 6],
|
||||
[6, 87, 118, 117, 11, 117, 0, 0, 1, 0, 0, 88, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 8F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 120, 0, 120, 0, 0, 0, 0, 0, 81, 0, 87, 6],
|
||||
[6, 0, 81, 6, 6, 6, 6, 6, 6, 6, 0, 0, 6],
|
||||
[6, 120, 6, 6, 12, 12, 6, 11, 11, 6, 6, 82, 6],
|
||||
[6, 0, 6, 12, 12, 12, 6, 11, 11, 11, 6, 0, 6],
|
||||
[6, 0, 6, 12, 12, 12, 6, 11, 11, 11, 6, 0, 6],
|
||||
[6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6],
|
||||
[6, 0, 6, 19, 19, 19, 6, 15, 15, 15, 6, 0, 6],
|
||||
[6, 0, 6, 19, 19, 19, 6, 16, 16, 16, 6, 0, 6],
|
||||
[6, 81, 6, 6, 19, 19, 6, 17, 17, 6, 6, 118, 6],
|
||||
[6, 0, 51, 6, 6, 6, 6, 6, 6, 6, 81, 0, 6],
|
||||
[6, 88, 0, 81, 0, 0, 0, 0, 0, 118, 0, 120, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 9F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 25, 7, 0, 1, 0, 1, 0, 0, 0, 0, 88, 6],
|
||||
[6, 7, 120, 124, 83, 15, 1, 124, 1, 1, 1, 1, 6],
|
||||
[6, 1, 81, 1, 1, 15, 1, 12, 1, 19, 12, 11, 6],
|
||||
[6, 19, 19, 19, 1, 124, 1, 118, 1, 0, 118, 0, 6],
|
||||
[6, 124, 0, 124, 1, 15, 1, 12, 1, 118, 124, 118, 6],
|
||||
[6, 1, 82, 1, 1, 15, 1, 118, 1, 1, 81, 1, 6],
|
||||
[6, 118, 0, 118, 120, 0, 1, 0, 118, 18, 18, 18, 6],
|
||||
[6, 1, 81, 1, 1, 0, 81, 0, 1, 1, 81, 1, 6],
|
||||
[6, 18, 0, 0, 1, 1, 81, 1, 1, 0, 120, 0, 6],
|
||||
[6, 1, 1, 118, 1, 118, 0, 118, 1, 81, 1, 81, 6],
|
||||
[6, 87, 120, 0, 82, 0, 1, 46, 1, 12, 1, 11, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 10F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 12, 1, 11, 1, 19, 1, 16, 1, 17, 1, 15, 6],
|
||||
[6, 12, 1, 11, 1, 19, 1, 16, 1, 17, 1, 15, 6],
|
||||
[6, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 6],
|
||||
[6, 119, 0, 119, 0, 119, 1, 124, 0, 124, 0, 124, 6],
|
||||
[6, 81, 1, 82, 1, 1, 1, 1, 1, 82, 1, 81, 6],
|
||||
[6, 18, 1, 0, 120, 145, 119, 145, 120, 0, 1, 18, 6],
|
||||
[6, 18, 1, 0, 1, 1, 1, 1, 1, 0, 1, 18, 6],
|
||||
[6, 1, 1, 145, 1, 120, 74, 120, 1, 145, 1, 1, 6],
|
||||
[6, 19, 120, 0, 1, 0, 145, 0, 1, 0, 120, 19, 6],
|
||||
[6, 1, 83, 1, 1, 15, 15, 15, 1, 1, 83, 1, 6],
|
||||
[6, 88, 0, 0, 120, 0, 145, 0, 120, 0, 0, 87, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 11F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 1, 1, 24, 1, 1, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 87, 0, 145, 46, 145, 119, 145, 46, 145, 0, 88, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 12F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 19, 1, 1, 1, 1, 0, 0, 0, 0, 0, 87, 6],
|
||||
[6, 0, 1, 0, 0, 127, 0, 1, 1, 1, 1, 0, 6],
|
||||
[6, 0, 1, 0, 1, 1, 0, 1, 12, 12, 1, 0, 6],
|
||||
[6, 0, 1, 0, 43, 1, 0, 1, 12, 12, 1, 0, 6],
|
||||
[6, 119, 1, 1, 1, 1, 119, 1, 1, 1, 1, 119, 6],
|
||||
[6, 0, 0, 0, 0, 145, 0, 145, 0, 0, 0, 0, 6],
|
||||
[6, 126, 1, 1, 1, 1, 126, 1, 1, 1, 1, 126, 6],
|
||||
[6, 0, 1, 11, 11, 1, 0, 1, 47, 0, 141, 0, 6],
|
||||
[6, 0, 1, 11, 11, 1, 0, 1, 1, 1, 1, 0, 6],
|
||||
[6, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 6],
|
||||
[6, 88, 0, 0, 0, 0, 0, 1, 0, 0, 0, 19, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 13F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 87, 0, 126, 0, 0, 82, 0, 0, 126, 0, 88, 6],
|
||||
[6, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 6],
|
||||
[6, 126, 1, 1, 15, 1, 0, 1, 19, 1, 1, 126, 6],
|
||||
[6, 0, 1, 36, 15, 1, 0, 1, 19, 19, 1, 0, 6],
|
||||
[6, 127, 1, 15, 126, 1, 0, 1, 126, 19, 1, 127, 6],
|
||||
[6, 0, 1, 126, 127, 82, 128, 82, 127, 126, 1, 0, 6],
|
||||
[6, 127, 1, 12, 126, 1, 0, 1, 126, 11, 1, 127, 6],
|
||||
[6, 0, 1, 12, 12, 1, 0, 1, 11, 11, 1, 0, 6],
|
||||
[6, 127, 1, 1, 12, 1, 0, 1, 11, 1, 1, 127, 6],
|
||||
[6, 0, 0, 1, 1, 1, 83, 1, 1, 1, 0, 0, 6],
|
||||
[6, 0, 0, 128, 0, 128, 0, 128, 0, 128, 0, 0, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 14F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 1, 1, 18, 1, 1, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 1, 18, 31, 18, 1, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 1, 1, 18, 1, 1, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 1, 85, 1, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 141, 0, 141, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6],
|
||||
[6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 15F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 53, 6, 18, 1, 19, 1, 12, 12, 12, 1, 87, 6],
|
||||
[6, 0, 1, 131, 1, 126, 1, 12, 128, 12, 1, 0, 6],
|
||||
[6, 141, 82, 0, 1, 81, 1, 1, 81, 1, 1, 0, 6],
|
||||
[6, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 6],
|
||||
[6, 19, 18, 1, 127, 1, 126, 1, 1, 0, 1, 0, 6],
|
||||
[6, 19, 18, 18, 1, 75, 0, 1, 52, 127, 83, 0, 6],
|
||||
[6, 19, 18, 1, 127, 1, 126, 1, 1, 0, 1, 0, 6],
|
||||
[6, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 6],
|
||||
[6, 0, 82, 0, 1, 81, 1, 1, 81, 1, 1, 0, 6],
|
||||
[6, 43, 1, 131, 1, 126, 1, 11, 128, 11, 1, 0, 6],
|
||||
[6, 44, 6, 18, 1, 19, 1, 11, 11, 11, 1, 88, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 16F
|
||||
[4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[4, 4, 4, 4, 6, 0, 0, 0, 0, 0, 0, 88, 6],
|
||||
[4, 4, 4, 4, 6, 6, 0, 6, 6, 6, 6, 6, 6],
|
||||
[4, 4, 4, 4, 4, 6, 0, 6, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 6, 0, 6, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 6, 0, 6, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 6, 108, 6, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 6, 0, 6, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 6, 87, 6, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 6, 6, 6, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
],
|
||||
[ // 17F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 1, 131, 128, 0, 0, 0, 0, 0, 0, 0, 131, 6],
|
||||
[6, 1, 128, 1, 1, 1, 1, 1, 1, 1, 1, 0, 6],
|
||||
[6, 1, 0, 1, 131, 0, 0, 0, 0, 0, 0, 131, 6],
|
||||
[6, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 6],
|
||||
[6, 1, 0, 1, 0, 1, 131, 0, 0, 0, 131, 89, 6],
|
||||
[6, 1, 0, 1, 131, 0, 0, 1, 1, 1, 0, 1, 6],
|
||||
[6, 1, 0, 1, 1, 1, 1, 1, 131, 0, 131, 1, 6],
|
||||
[6, 1, 128, 1, 1, 1, 88, 1, 0, 1, 1, 1, 6],
|
||||
[6, 1, 131, 128, 0, 0, 0, 1, 131, 0, 0, 131, 6],
|
||||
[6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 6],
|
||||
[6, 87, 84, 131, 0, 0, 0, 0, 0, 0, 0, 131, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 18F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 1, 1, 1, 126, 0, 87, 0, 131, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 1, 19, 1, 19, 1, 1, 1, 1, 6],
|
||||
[6, 1, 1, 1, 126, 0, 19, 0, 131, 1, 1, 1, 6],
|
||||
[6, 126, 1, 126, 1, 128, 1, 128, 1, 131, 1, 131, 6],
|
||||
[6, 0, 15, 0, 128, 0, 0, 0, 128, 0, 15, 0, 6],
|
||||
[6, 15, 1, 15, 1, 0, 54, 0, 1, 15, 1, 15, 6],
|
||||
[6, 0, 15, 0, 128, 0, 0, 0, 128, 0, 15, 0, 6],
|
||||
[6, 131, 1, 131, 1, 128, 1, 128, 1, 127, 1, 127, 6],
|
||||
[6, 0, 0, 0, 131, 0, 17, 0, 127, 1, 1, 1, 6],
|
||||
[6, 0, 1, 0, 1, 17, 1, 17, 1, 1, 1, 1, 6],
|
||||
[6, 88, 0, 0, 131, 0, 17, 0, 127, 1, 1, 1, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 19F
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
[6, 128, 0, 12, 12, 0, 88, 0, 18, 18, 0, 141, 6],
|
||||
[6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6],
|
||||
[6, 19, 6, 4, 4, 4, 4, 4, 4, 4, 6, 11, 6],
|
||||
[6, 19, 6, 4, 4, 4, 4, 4, 4, 4, 6, 11, 6],
|
||||
[6, 0, 6, 4, 4, 4, 4, 4, 4, 4, 6, 0, 6],
|
||||
[6, 131, 6, 4, 4, 4, 4, 4, 4, 4, 6, 131, 6],
|
||||
[6, 0, 6, 4, 4, 4, 4, 4, 4, 4, 6, 0, 6],
|
||||
[6, 11, 6, 4, 4, 4, 4, 4, 4, 4, 6, 19, 6],
|
||||
[6, 11, 6, 4, 4, 4, 4, 4, 4, 4, 6, 19, 6],
|
||||
[6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6],
|
||||
[6, 141, 0, 18, 18, 0, 89, 0, 12, 12, 0, 128, 6],
|
||||
[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
||||
],
|
||||
[ // 20F
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
[4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4],
|
||||
[4, 4, 6, 0, 0, 0, 0, 0, 0, 0, 6, 4, 4],
|
||||
[4, 4, 6, 0, 0, 0, 0, 0, 0, 0, 6, 4, 4],
|
||||
[4, 4, 6, 0, 0, 131, 131, 131, 0, 0, 6, 4, 4],
|
||||
[4, 4, 6, 0, 0, 131, 144, 131, 0, 0, 6, 4, 4],
|
||||
[4, 4, 6, 0, 0, 131, 131, 131, 0, 0, 6, 4, 4],
|
||||
[4, 4, 6, 0, 0, 0, 0, 0, 0, 0, 6, 4, 4],
|
||||
[4, 4, 6, 0, 0, 0, 0, 0, 0, 0, 6, 4, 4],
|
||||
[4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
],
|
||||
|
||||
// 隐藏1层
|
||||
[
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
[4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4],
|
||||
[4, 4, 2, 11, 2, 43, 0, 30, 2, 12, 2, 4, 4],
|
||||
[4, 4, 2, 11, 2, 2, 81, 2, 2, 12, 2, 4, 4],
|
||||
[4, 4, 2, 11, 81, 0, 0, 0, 81, 12, 2, 4, 4],
|
||||
[4, 4, 2, 11, 2, 0, 0, 0, 2, 12, 2, 4, 4],
|
||||
[4, 4, 2, 11, 2, 0, 142, 0, 2, 12, 2, 4, 4],
|
||||
[4, 4, 2, 2, 2, 2, 83, 2, 2, 2, 2, 4, 4],
|
||||
[4, 4, 2, 0, 0, 0, 0, 0, 0, 89, 2, 4, 4],
|
||||
[4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
||||
]
|
||||
]
|
||||
|
||||
this.maps = [];
|
||||
for (var f = 0; f < map_txt.length; f++) {
|
||||
var floorId = 'MT' + f;
|
||||
var map = map_txt[f];
|
||||
var content = {};
|
||||
content['floorId'] = floorId;
|
||||
content['name'] = f;
|
||||
content['title'] = '主塔 ' + f + ' 层';
|
||||
if (f==21) { // 隐藏层
|
||||
content['name'] = '17';
|
||||
content['title'] = '隐藏层';
|
||||
maps.prototype.loadFloor = function (floorId, map, enables) {
|
||||
var floor = core.floors[floorId];
|
||||
var content = {};
|
||||
content['floorId'] = floor.floorId;
|
||||
content['name'] = floor.name;
|
||||
content['title'] = floor.title;
|
||||
content['canFlyTo'] = floor.canFlyTo;
|
||||
content['firstArrive'] = floor.firstArrive;
|
||||
if (!core.isset(map)) map=floor.map;
|
||||
var blocks = [];
|
||||
for (var i = 0; i < 13; i++) {
|
||||
for (var j = 0; j < 13; j++) {
|
||||
var block = this.getBlock(j, i, map[i][j]);
|
||||
this.addEvent(block,j,i,floor.events[j+","+i])
|
||||
if (core.isset(block.event)) blocks.push(block);
|
||||
}
|
||||
content['canFlyTo'] = true;
|
||||
if (f==0 || f==14 || f==20 || f==21) content['canFlyTo'] = false;
|
||||
var blocks = [];
|
||||
for (var i = 0; i < 13; i++) {
|
||||
for (var j = 0; j < 13; j++) {
|
||||
var id = map[i][j];
|
||||
var block = this.getBlock(floorId, f, j, i, id);
|
||||
if (block!=null) blocks.push(block);
|
||||
}
|
||||
}
|
||||
content['blocks'] = blocks;
|
||||
this.maps[floorId] = content;
|
||||
}
|
||||
// 事件处理
|
||||
content['blocks'] = blocks;
|
||||
return content;
|
||||
}
|
||||
|
||||
maps.prototype.getBlock = function (floorId, f, x, y, id) {
|
||||
maps.prototype.getBlock = function (x, y, id) {
|
||||
var enable=null;
|
||||
id = ""+id;
|
||||
if (id.length>2) {
|
||||
if (id.indexOf(":f")==id.length-2) {
|
||||
id = id.substring(0, id.length - 2);
|
||||
enable = false;
|
||||
}
|
||||
else if (id.indexOf(":t")==id.length-2) {
|
||||
id = id.substring(0, id.length - 2);
|
||||
enable = true;
|
||||
}
|
||||
}
|
||||
var tmp = {'x': x, 'y': y, 'id': id};
|
||||
if (enable!=null) tmp.enable = enable;
|
||||
|
||||
// 16F的事件处理
|
||||
if (id == 0) {
|
||||
if (floorId=="MT16" && x==6 && y==2) {
|
||||
tmp.event = {'cls': 'terrains', 'id': 'ground', 'noPass': false, 'trigger': 'blockEvent'};
|
||||
}
|
||||
}
|
||||
// 0-9 地形
|
||||
if (id == 1) tmp.event = {'cls': 'terrains', 'id': 'yellowWall'}; // 黄墙
|
||||
if (id == 2) tmp.event = {'cls': 'terrains', 'id': 'blueWall'}; // 蓝墙
|
||||
if (id == 3) tmp.event = {'cls': 'animates', 'id': 'lava', 'animate': 4, 'noPass': true}; // 岩浆
|
||||
if (id == 4) tmp.event = {'cls': 'animates', 'id': 'star', 'animate': 4, 'noPass': true}; // 星空
|
||||
// if (id==5) tmp.fg = {'cls': 'animates', 'id': 'star', 'animate': 4, 'noPass': true}; // 栅栏
|
||||
if (id == 6) tmp.event = {'cls': 'terrains', 'id': 'whiteWall'}; // 白墙
|
||||
if (id == 7) tmp.event = {'cls': 'animates', 'id': 'lavaNet', 'animate': 4, 'noPass': false, 'trigger': 'passNet'};
|
||||
|
||||
// 11-50 物品
|
||||
if (id == 11) tmp.event = {'cls': 'items', 'id': 'redJewel', 'trigger': 'getItem'}; // 红宝石
|
||||
if (id == 12) tmp.event = {'cls': 'items', 'id': 'blueJewel', 'trigger': 'getItem'}; // 蓝宝石
|
||||
if (id == 13) tmp.event = {'cls': 'items', 'id': 'greenJewel', 'trigger': 'getItem'}; // 绿宝石
|
||||
if (id == 14) tmp.event = {'cls': 'items', 'id': 'yellowJewel', 'trigger': 'getItem'}; // 黄宝石
|
||||
if (id == 15) tmp.event = {'cls': 'items', 'id': 'yellowKey', 'trigger': 'getItem'}; // 黄钥匙
|
||||
if (id == 16) tmp.event = {'cls': 'items', 'id': 'blueKey', 'trigger': 'getItem'}; // 蓝钥匙
|
||||
if (id == 17) tmp.event = {'cls': 'items', 'id': 'redKey', 'trigger': 'getItem'}; // 红钥匙
|
||||
if (id == 18) tmp.event = {'cls': 'items', 'id': 'redPotion', 'trigger': 'getItem'}; // 红血瓶
|
||||
if (id == 19) tmp.event = {'cls': 'items', 'id': 'bluePotion', 'trigger': 'getItem'}; // 蓝血瓶
|
||||
if (id == 20) tmp.event = {'cls': 'items', 'id': 'yellowPotion', 'trigger': 'getItem'}; // 黄血瓶
|
||||
if (id == 21) tmp.event = {'cls': 'items', 'id': 'greenPotion', 'trigger': 'getItem'}; // 绿血瓶
|
||||
if (id == 22) tmp.event = {'cls': 'items', 'id': 'sword1', 'trigger': 'getItem'}; // 铁剑
|
||||
if (id == 23) tmp.event = {'cls': 'items', 'id': 'shield1', 'trigger': 'getItem'}; // 铁盾
|
||||
if (id == 24) tmp.event = {'cls': 'items', 'id': 'sword2', 'trigger': 'getItem'}; // 银剑
|
||||
if (id == 25) tmp.event = {'cls': 'items', 'id': 'shield2', 'trigger': 'getItem'}; // 银盾
|
||||
if (id == 26) tmp.event = {'cls': 'items', 'id': 'sword3', 'trigger': 'getItem'}; // 骑士剑
|
||||
if (id == 27) tmp.event = {'cls': 'items', 'id': 'shield3', 'trigger': 'getItem'}; // 骑士盾
|
||||
if (id == 28) tmp.event = {'cls': 'items', 'id': 'sword4', 'trigger': 'getItem'}; // 圣剑
|
||||
if (id == 29) tmp.event = {'cls': 'items', 'id': 'shield4', 'trigger': 'getItem'}; // 圣盾
|
||||
if (id == 30) tmp.event = {'cls': 'items', 'id': 'sword5', 'trigger': 'getItem'}; // 神圣剑
|
||||
if (id == 31) tmp.event = {'cls': 'items', 'id': 'shield5', 'trigger': 'getItem'}; // 神圣盾
|
||||
if (id == 32) tmp.event = {'cls': 'items', 'id': 'book', 'trigger': 'getItem'}; // 怪物手册
|
||||
if (id == 33) tmp.event = {'cls': 'items', 'id': 'fly', 'trigger': 'getItem'}; // 楼层传送器
|
||||
if (id == 34) tmp.event = {'cls': 'items', 'id': 'pickaxe', 'trigger': 'getItem'}; // 破墙镐
|
||||
if (id == 35) tmp.event = {'cls': 'items', 'id': 'bomb', 'trigger': 'getItem'}; // 炸弹
|
||||
if (id == 36) tmp.event = {'cls': 'items', 'id': 'centerFly', 'trigger': 'getItem'}; // 中心对称
|
||||
if (id == 37) tmp.event = {'cls': 'items', 'id': 'upFly', 'trigger': 'getItem'}; // 上楼器
|
||||
if (id == 38) tmp.event = {'cls': 'items', 'id': 'downFly', 'trigger': 'getItem'}; // 下楼器
|
||||
if (id == 39) tmp.event = {'cls': 'items', 'id': 'icePickaxe', 'trigger': 'getItem'}; // 破冰镐
|
||||
if (id == 40) tmp.event = {'cls': 'items', 'id': 'coin', 'trigger': 'getItem'}; // 幸运金币
|
||||
if (id == 41) tmp.event = {'cls': 'items', 'id': 'snow', 'trigger': 'getItem'}; // 冰冻徽章
|
||||
if (id == 42) tmp.event = {'cls': 'items', 'id': 'cross', 'trigger': 'getItem'}; // 十字架
|
||||
if (id == 43) tmp.event = {'cls': 'items', 'id': 'superPotion', 'trigger': 'getItem'}; // 圣水
|
||||
if (id == 44) tmp.event = {'cls': 'items', 'id': 'greenKey', 'trigger': 'getItem'}; // 绿钥匙
|
||||
if (id == 45) tmp.event = {'cls': 'items', 'id': 'steelKey', 'trigger': 'getItem'}; // 铁门钥匙
|
||||
if (id == 46) tmp.event = {'cls': 'items', 'id': 'bigKey', 'trigger': 'getItem'}; // 钥匙盒/大黄门钥匙
|
||||
if (id == 47) tmp.event = {'cls': 'items', 'id': 'earthquake', 'trigger': 'getItem'} // 地震卷轴
|
||||
|
||||
// 51-80 NPC
|
||||
if (id == 51) tmp.event = {'cls': 'npcs', 'id': 'magician', 'trigger': 'visitNpc', 'npcid': 'npc1'};
|
||||
if (id == 52) tmp.event = {'cls': 'npcs', 'id': 'magician', 'trigger': 'visitNpc', 'npcid': 'npc2'};
|
||||
if (id == 53) tmp.event = {'cls': 'npcs', 'id': 'womanMagician', 'trigger': 'visitNpc', 'npcid': 'npc3'};
|
||||
if (id == 54) tmp.event = {'cls': 'npcs', 'id': 'womanMagician', 'trigger': 'visitNpc', 'npcid': 'npc4'};
|
||||
|
||||
// 商店
|
||||
if (id == 71) tmp.event = {'cls': 'npcs', 'id': 'blueShop', 'trigger': 'openShop', 'shopid': 'shop1'};
|
||||
if (id == 72) tmp.event = {'cls': 'npcs', 'id': 'redShop', 'trigger': 'openShop', 'shopid': 'shop2'};
|
||||
if (id == 73) tmp.event = {'cls': 'npcs', 'id': 'womanMagician', 'trigger': 'openShop', 'shopid': 'shop3'};
|
||||
if (id == 74) tmp.event = {'cls': 'npcs', 'id': 'blueShop', 'trigger': 'openShop', 'shopid': 'shop4'};
|
||||
if (id == 75) tmp.event = {'cls': 'npcs', 'id': 'redShop', 'trigger': 'openShop', 'shopid': 'shop5'};
|
||||
if (id == 2) tmp.event = {'cls': 'terrains', 'id': 'whiteWall'}; // 白墙
|
||||
if (id == 3) tmp.event = {'cls': 'terrains', 'id': 'blueWall'}; // 白墙
|
||||
if (id == 4) tmp.event = {'cls': 'animates', 'id': 'star', 'noPass': true}; // 星空
|
||||
if (id == 5) tmp.event = {'cls': 'animates', 'id': 'lava', 'noPass': true}; // 岩浆
|
||||
if (id == 6) tmp.event = {'cls': 'terrains', 'id': 'ice'}; // 岩浆
|
||||
if (id == 7) tmp.event = {'cls': 'terrains', 'id': 'blueShop-left'}; // 蓝色商店左
|
||||
if (id == 8) tmp.event = {'cls': 'terrains', 'id': 'blueShop-right'}; // 蓝色商店右
|
||||
if (id == 9) tmp.event = {'cls': 'terrains', 'id': 'pinkShop-left'}; // 粉色商店左
|
||||
if (id == 10) tmp.event = {'cls': 'terrains', 'id': 'pinkShop-right'}; // 粉色商店左
|
||||
if (id == 11) tmp.event = {'cls': 'animates', 'id': 'lavaNet', 'noPass': false, 'trigger': 'passNet'}; // 血网
|
||||
if (id == 12) tmp.event = {'cls': 'animates', 'id': 'poisonNet', 'noPass': false, 'trigger': 'passNet'}; // 毒网
|
||||
if (id == 13) tmp.event = {'cls': 'animates', 'id': 'weakNet', 'noPass': false, 'trigger': 'passNet'}; // 衰网
|
||||
if (id == 14) tmp.event = {'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}; // 咒网
|
||||
|
||||
// 21-80 物品
|
||||
if (id == 21) tmp.event = {'cls': 'items', 'id': 'yellowKey'}; // 黄钥匙
|
||||
if (id == 22) tmp.event = {'cls': 'items', 'id': 'blueKey'}; // 蓝钥匙
|
||||
if (id == 23) tmp.event = {'cls': 'items', 'id': 'redKey'}; // 红钥匙
|
||||
if (id == 24) tmp.event = {'cls': 'items', 'id': 'greenKey'}; // 绿钥匙
|
||||
if (id == 25) tmp.event = {'cls': 'items', 'id': 'steelKey'}; // 铁门钥匙
|
||||
if (id == 26) tmp.event = {'cls': 'items', 'id': 'bigKey'}; // 大黄门钥匙(钥匙盒)
|
||||
if (id == 27) tmp.event = {'cls': 'items', 'id': 'redJewel'}; // 红宝石
|
||||
if (id == 28) tmp.event = {'cls': 'items', 'id': 'blueJewel'}; // 蓝宝石
|
||||
if (id == 29) tmp.event = {'cls': 'items', 'id': 'greenJewel'}; // 绿宝石
|
||||
if (id == 30) tmp.event = {'cls': 'items', 'id': 'yellowJewel'}; // 黄宝石
|
||||
if (id == 31) tmp.event = {'cls': 'items', 'id': 'redPotion'}; // 红血瓶
|
||||
if (id == 32) tmp.event = {'cls': 'items', 'id': 'bluePotion'}; // 蓝血瓶
|
||||
if (id == 33) tmp.event = {'cls': 'items', 'id': 'greenPotion'}; // 绿血瓶
|
||||
if (id == 34) tmp.event = {'cls': 'items', 'id': 'yellowPotion'}; // 黄血瓶
|
||||
if (id == 35) tmp.event = {'cls': 'items', 'id': 'sword1'}; // 铁剑
|
||||
if (id == 36) tmp.event = {'cls': 'items', 'id': 'shield1'}; // 铁盾
|
||||
if (id == 37) tmp.event = {'cls': 'items', 'id': 'sword2'}; // 银剑
|
||||
if (id == 38) tmp.event = {'cls': 'items', 'id': 'shield2'}; // 银盾
|
||||
if (id == 39) tmp.event = {'cls': 'items', 'id': 'sword3'}; // 骑士剑
|
||||
if (id == 40) tmp.event = {'cls': 'items', 'id': 'shield3'}; // 骑士盾
|
||||
if (id == 41) tmp.event = {'cls': 'items', 'id': 'sword4'}; // 圣剑
|
||||
if (id == 42) tmp.event = {'cls': 'items', 'id': 'shield4'}; // 圣盾
|
||||
if (id == 43) tmp.event = {'cls': 'items', 'id': 'sword5'}; // 神圣剑
|
||||
if (id == 44) tmp.event = {'cls': 'items', 'id': 'shield5'}; // 神圣盾
|
||||
if (id == 45) tmp.event = {'cls': 'items', 'id': 'book'}; // 怪物手册
|
||||
if (id == 46) tmp.event = {'cls': 'items', 'id': 'fly'}; // 楼层传送器
|
||||
if (id == 47) tmp.event = {'cls': 'items', 'id': 'pickaxe'}; // 破墙镐
|
||||
if (id == 48) tmp.event = {'cls': 'items', 'id': 'icePickaxe'}; // 破冰镐
|
||||
if (id == 49) tmp.event = {'cls': 'items', 'id': 'bomb'}; // 炸弹
|
||||
if (id == 50) tmp.event = {'cls': 'items', 'id': 'centerFly'}; // 中心对称
|
||||
if (id == 51) tmp.event = {'cls': 'items', 'id': 'upFly'}; // 上楼器
|
||||
if (id == 52) tmp.event = {'cls': 'items', 'id': 'downFly'}; // 下楼器
|
||||
if (id == 53) tmp.event = {'cls': 'items', 'id': 'coin'}; // 幸运金币
|
||||
if (id == 54) tmp.event = {'cls': 'items', 'id': 'snow'}; // 冰冻徽章
|
||||
if (id == 55) tmp.event = {'cls': 'items', 'id': 'cross'}; // 十字架
|
||||
if (id == 56) tmp.event = {'cls': 'items', 'id': 'superPotion'}; // 圣水
|
||||
if (id == 57) tmp.event = {'cls': 'items', 'id': 'earthquake'} // 地震卷轴
|
||||
if (id == 58) tmp.event = {'cls': 'items', 'id': 'poisonWine'} // 解毒药水
|
||||
if (id == 59) tmp.event = {'cls': 'items', 'id': 'weakWine'} // 解衰药水
|
||||
if (id == 60) tmp.event = {'cls': 'items', 'id': 'curseWine'} // 解咒药水
|
||||
if (id == 61) tmp.event = {'cls': 'items', 'id': 'superWine'} // 万能药水
|
||||
if (id == 62) tmp.event = {'cls': 'items', 'id': 'knife'} // 屠龙匕首
|
||||
if (id == 63) tmp.event = {'cls': 'items', 'id': 'moneyPocket'} // 金钱袋
|
||||
if (id == 64) tmp.event = {'cls': 'items', 'id': 'shoes'} // 绿鞋
|
||||
if (id == 65) tmp.event = {'cls': 'items', 'id': 'hammer'} // 圣锤
|
||||
|
||||
// 81-100 门
|
||||
if (id == 81) tmp.event = {'cls': 'terrains', 'id': 'yellowDoor', 'trigger': 'openDoor'};
|
||||
if (id == 82) tmp.event = {'cls': 'terrains', 'id': 'blueDoor', 'trigger': 'openDoor'};
|
||||
if (id == 83) tmp.event = {'cls': 'terrains', 'id': 'redDoor', 'trigger': 'openDoor'};
|
||||
if (id == 84) tmp.event = {'cls': 'terrains', 'id': 'greenDoor', 'trigger': 'openDoor'};
|
||||
if (id == 85) tmp.event = {'cls': 'terrains', 'id': 'specialDoor', 'trigger': 'openDoor'}; // 商店左
|
||||
if (id == 86) tmp.event = {'cls': 'terrains', 'id': 'steelDoor', 'trigger': 'openDoor'}; // 商店左
|
||||
if (id == 87) {
|
||||
var toFloor = f+1;
|
||||
if (f==13) toFloor = 15;
|
||||
tmp.event = {
|
||||
'cls': 'terrains', 'id': 'upFloor', 'trigger': 'changeFloor', 'noPass': false,
|
||||
'data': {'floorId': 'MT' + toFloor, 'stair': 'downFloor'}, 'noTriggerCross': true
|
||||
};
|
||||
}
|
||||
if (id == 88) {
|
||||
var toFloor = f-1;
|
||||
if (f==15) toFloor = 13;
|
||||
tmp.event = {
|
||||
'cls': 'terrains', 'id': 'downFloor', 'trigger': 'changeFloor', 'noPass': false,
|
||||
'data': {'floorId': 'MT' + toFloor, 'stair': 'upFloor'}, 'noTriggerCross': true
|
||||
};
|
||||
}
|
||||
// 传送门
|
||||
if (id==89) {
|
||||
var toFloor = 0, toX = 0, toY = 0;
|
||||
if (floorId == "MT17") {toFloor = 21; toX = 9; toY = 9;}
|
||||
else if (floorId == "MT21") {toFloor = 17; toX = 11; toY = 5;}
|
||||
else if (floorId == "MT19") {toFloor = 20; toX = 6; toY = 9;}
|
||||
tmp.event = {
|
||||
'cls': 'animates', 'id': 'portal', 'trigger': 'changeFloor', 'noPass': false, 'animate': 4,
|
||||
'data': {'floorId': 'MT' + toFloor, 'heroLoc': {'direction': 'up', 'x': toX, 'y': toY}}
|
||||
}
|
||||
}
|
||||
if (id == 81) tmp.event = {'cls': 'terrains', 'id': 'yellowDoor', 'trigger': 'openDoor'}; // 黄门
|
||||
if (id == 82) tmp.event = {'cls': 'terrains', 'id': 'blueDoor', 'trigger': 'openDoor'}; // 蓝门
|
||||
if (id == 83) tmp.event = {'cls': 'terrains', 'id': 'redDoor', 'trigger': 'openDoor'}; // 红门
|
||||
if (id == 84) tmp.event = {'cls': 'terrains', 'id': 'greenDoor', 'trigger': 'openDoor'}; // 绿门
|
||||
if (id == 85) tmp.event = {'cls': 'terrains', 'id': 'specialDoor', 'trigger': 'openDoor'}; // 机关门左
|
||||
if (id == 86) tmp.event = {'cls': 'terrains', 'id': 'steelDoor', 'trigger': 'openDoor'}; // 铁门
|
||||
if (id == 87) tmp.event = {'cls': 'terrains', 'id': 'upFloor', 'noPass': false}; // 上楼梯
|
||||
if (id == 88) tmp.event = {'cls': 'terrains', 'id': 'downFloor', 'noPass': false}; // 下楼梯
|
||||
if (id == 89) tmp.event = {'cls': 'animates', 'id': 'portal', 'noPass': false}; // 传送门
|
||||
if (id == 90) tmp.event = {'cls': 'animates', 'id': 'starPortal', 'noPass': false}; // 星空传送门
|
||||
if (id == 91) tmp.event = {'cls': 'animates', 'id': 'upPortal', 'noPass': false}; // 上箭头
|
||||
if (id == 92) tmp.event = {'cls': 'animates', 'id': 'leftPortal', 'noPass': false}; // 左箭头
|
||||
if (id == 93) tmp.event = {'cls': 'animates', 'id': 'downPortal', 'noPass': false}; // 下箭头
|
||||
if (id == 94) tmp.event = {'cls': 'animates', 'id': 'rightPortal', 'noPass': false}; // 右箭头
|
||||
|
||||
// 101-200 怪物
|
||||
if (id == 101) tmp.event = {'cls': 'enemys', 'id': 'greenSlime', 'trigger': 'battle'};
|
||||
if (id == 102) tmp.event = {'cls': 'enemys', 'id': 'redSlime', 'trigger': 'battle'};
|
||||
if (id == 103) tmp.event = {'cls': 'enemys', 'id': 'blackSlime', 'trigger': 'battle'};
|
||||
if (id == 104) tmp.event = {'cls': 'enemys', 'id': 'slimelord', 'trigger': 'battle'};
|
||||
if (id == 105) tmp.event = {'cls': 'enemys', 'id': 'bat', 'trigger': 'battle'};
|
||||
if (id == 106) tmp.event = {'cls': 'enemys', 'id': 'bigBat', 'trigger': 'battle'};
|
||||
if (id == 107) tmp.event = {'cls': 'enemys', 'id': 'redBat', 'trigger': 'battle'};
|
||||
if (id == 108) tmp.event = {'cls': 'enemys', 'id': 'vampire', 'trigger': 'battle'};
|
||||
if (id == 109) tmp.event = {'cls': 'enemys', 'id': 'bluePriest', 'trigger': 'battle'};
|
||||
if (id == 110) tmp.event = {'cls': 'enemys', 'id': 'redPriest', 'trigger': 'battle'};
|
||||
if (id == 111) tmp.event = {'cls': 'enemys', 'id': 'brownWizard', 'trigger': 'battle'};
|
||||
if (id == 112) tmp.event = {'cls': 'enemys', 'id': 'redWizard', 'trigger': 'battle'};
|
||||
if (id == 113) tmp.event = {'cls': 'enemys', 'id': 'skeleton', 'trigger': 'battle'};
|
||||
if (id == 114) tmp.event = {'cls': 'enemys', 'id': 'skeletonSoilder', 'trigger': 'battle'};
|
||||
if (id == 115) tmp.event = {'cls': 'enemys', 'id': 'skeletonCaptain', 'trigger': 'battle'};
|
||||
if (id == 116) tmp.event = {'cls': 'enemys', 'id': 'ghostSkeleton', 'trigger': 'battle'};
|
||||
if (id == 117) tmp.event = {'cls': 'enemys', 'id': 'zombie', 'trigger': 'battle'};
|
||||
if (id == 118) tmp.event = {'cls': 'enemys', 'id': 'zombieKnight', 'trigger': 'battle'};
|
||||
if (id == 119) tmp.event = {'cls': 'enemys', 'id': 'rock', 'trigger': 'battle'};
|
||||
if (id == 120) tmp.event = {'cls': 'enemys', 'id': 'slimeMan', 'trigger': 'battle'};
|
||||
if (id == 121) tmp.event = {'cls': 'enemys', 'id': 'yellowGuard', 'trigger': 'battle'};
|
||||
if (id == 122) tmp.event = {'cls': 'enemys', 'id': 'blueGuard', 'trigger': 'battle'};
|
||||
if (id == 123) tmp.event = {'cls': 'enemys', 'id': 'redGuard', 'trigger': 'battle'};
|
||||
if (id == 124) tmp.event = {'cls': 'enemys', 'id': 'swordsman', 'trigger': 'battle'};
|
||||
if (id == 125) tmp.event = {'cls': 'enemys', 'id': 'soldier', 'trigger': 'battle'};
|
||||
if (id == 126) tmp.event = {'cls': 'enemys', 'id': 'yellowKnight', 'trigger': 'battle'};
|
||||
if (id == 127) tmp.event = {'cls': 'enemys', 'id': 'redKnight', 'trigger': 'battle'};
|
||||
if (id == 128) tmp.event = {'cls': 'enemys', 'id': 'darkKnight', 'trigger': 'battle'};
|
||||
if (id == 129) tmp.event = {'cls': 'enemys', 'id': 'redKing', 'trigger': 'battle'};
|
||||
if (id == 130) tmp.event = {'cls': 'enemys', 'id': 'whiteKing', 'trigger': 'battle'};
|
||||
if (id == 131) tmp.event = {'cls': 'enemys', 'id': 'blackMagician', 'trigger': 'battle'};
|
||||
if (id == 132) tmp.event = {'cls': 'enemys', 'id': 'silverSlime', 'trigger': 'battle'};
|
||||
if (id == 133) tmp.event = {'cls': 'enemys', 'id': 'poisonSkeleton', 'trigger': 'battle'};
|
||||
if (id == 134) tmp.event = {'cls': 'enemys', 'id': 'poisonBat', 'trigger': 'battle'};
|
||||
if (id == 135) tmp.event = {'cls': 'enemys', 'id': 'steelRock', 'trigger': 'battle'};
|
||||
if (id == 136) tmp.event = {'cls': 'enemys', 'id': 'poisonZombie', 'trigger': 'battle'};
|
||||
if (id == 137) tmp.event = {'cls': 'enemys', 'id': 'blackKing', 'trigger': 'battle'};
|
||||
if (id == 138) tmp.event = {'cls': 'enemys', 'id': 'yellowKing', 'trigger': 'battle'};
|
||||
if (id == 139) tmp.event = {'cls': 'enemys', 'id': 'greenKing', 'trigger': 'battle'};
|
||||
if (id == 140) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
|
||||
if (id == 141) tmp.event = {'cls': 'enemys', 'id': 'greenKnight', 'trigger': 'battle'};
|
||||
if (id == 142) tmp.event = {'cls': 'enemys', 'id': 'magicDragon', 'trigger': 'battle'};
|
||||
if (id == 143) tmp.event = {'cls': 'enemys', 'id': 'octopus', 'trigger': 'battle'};
|
||||
if (id == 144) tmp.event = {'cls': 'enemys', 'id': 'fairy', 'trigger': 'battle'};
|
||||
if (id == 145) tmp.event = {'cls': 'enemys', 'id': 'whiteGhost', 'trigger': 'battle'};
|
||||
if (id == 146) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
if (id == 147) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
if (id == 148) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
if (id == 149) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
if (id == 150) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
if (id == 151) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
if (id == 152) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
if (id == 153) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
if (id == 154) tmp.event = {'cls': 'enemys', 'id': 'blueKnight', 'trigger': 'battle'};
|
||||
// 121-150 NPC
|
||||
if (id == 121) tmp.event = {'cls': 'npcs', 'id': 'man'};
|
||||
if (id == 122) tmp.event = {'cls': 'npcs', 'id': 'woman'};
|
||||
if (id == 123) tmp.event = {'cls': 'npcs', 'id': 'thief'};
|
||||
if (id == 124) tmp.event = {'cls': 'npcs', 'id': 'fairy'};
|
||||
if (id == 125) tmp.event = {'cls': 'npcs', 'id': 'magician'};
|
||||
if (id == 126) tmp.event = {'cls': 'npcs', 'id': 'womanMagician'};
|
||||
if (id == 127) tmp.event = {'cls': 'npcs', 'id': 'oldMan'};
|
||||
if (id == 128) tmp.event = {'cls': 'npcs', 'id': 'child'};
|
||||
if (id == 129) tmp.event = {'cls': 'npcs', 'id': 'wood'};
|
||||
if (id == 130) tmp.event = {'cls': 'npcs', 'id': 'pinkShop'};
|
||||
if (id == 131) tmp.event = {'cls': 'npcs', 'id': 'blueShop'};
|
||||
if (id == 132) tmp.event = {'cls': 'npcs', 'id': 'princess'};
|
||||
|
||||
// 200+ 特殊
|
||||
|
||||
if (tmp.event == undefined) return null;
|
||||
// 201-300 怪物
|
||||
if (id == 201) tmp.event = {'cls': 'enemys', 'id': 'greenSlime'};
|
||||
if (id == 202) tmp.event = {'cls': 'enemys', 'id': 'redSlime'};
|
||||
if (id == 203) tmp.event = {'cls': 'enemys', 'id': 'blackSlime'};
|
||||
if (id == 204) tmp.event = {'cls': 'enemys', 'id': 'slimelord'};
|
||||
if (id == 205) tmp.event = {'cls': 'enemys', 'id': 'bat'};
|
||||
if (id == 206) tmp.event = {'cls': 'enemys', 'id': 'bigBat'};
|
||||
if (id == 207) tmp.event = {'cls': 'enemys', 'id': 'redBat'};
|
||||
if (id == 208) tmp.event = {'cls': 'enemys', 'id': 'vampire'};
|
||||
if (id == 209) tmp.event = {'cls': 'enemys', 'id': 'skeleton'};
|
||||
if (id == 210) tmp.event = {'cls': 'enemys', 'id': 'skeletonSoilder'};
|
||||
if (id == 211) tmp.event = {'cls': 'enemys', 'id': 'skeletonCaptain'};
|
||||
if (id == 212) tmp.event = {'cls': 'enemys', 'id': 'ghostSkeleton'};
|
||||
if (id == 213) tmp.event = {'cls': 'enemys', 'id': 'zombie'};
|
||||
if (id == 214) tmp.event = {'cls': 'enemys', 'id': 'zombieKnight'};
|
||||
if (id == 215) tmp.event = {'cls': 'enemys', 'id': 'rock'};
|
||||
if (id == 216) tmp.event = {'cls': 'enemys', 'id': 'slimeMan'};
|
||||
if (id == 217) tmp.event = {'cls': 'enemys', 'id': 'bluePriest'};
|
||||
if (id == 218) tmp.event = {'cls': 'enemys', 'id': 'redPriest'};
|
||||
if (id == 219) tmp.event = {'cls': 'enemys', 'id': 'brownWizard'};
|
||||
if (id == 220) tmp.event = {'cls': 'enemys', 'id': 'redWizard'};
|
||||
if (id == 221) tmp.event = {'cls': 'enemys', 'id': 'yellowGuard'};
|
||||
if (id == 222) tmp.event = {'cls': 'enemys', 'id': 'blueGuard'};
|
||||
if (id == 223) tmp.event = {'cls': 'enemys', 'id': 'redGuard'};
|
||||
if (id == 224) tmp.event = {'cls': 'enemys', 'id': 'swordsman'};
|
||||
if (id == 225) tmp.event = {'cls': 'enemys', 'id': 'soldier'};
|
||||
if (id == 226) tmp.event = {'cls': 'enemys', 'id': 'yellowKnight'};
|
||||
if (id == 227) tmp.event = {'cls': 'enemys', 'id': 'redKnight'};
|
||||
if (id == 228) tmp.event = {'cls': 'enemys', 'id': 'darkKnight'};
|
||||
if (id == 229) tmp.event = {'cls': 'enemys', 'id': 'blackKing'};
|
||||
if (id == 230) tmp.event = {'cls': 'enemys', 'id': 'yellowKing'};
|
||||
if (id == 231) tmp.event = {'cls': 'enemys', 'id': 'greenKing'};
|
||||
if (id == 232) tmp.event = {'cls': 'enemys', 'id': 'blueKnight'};
|
||||
if (id == 233) tmp.event = {'cls': 'enemys', 'id': 'goldSlime'};
|
||||
if (id == 234) tmp.event = {'cls': 'enemys', 'id': 'poisonSkeleton'};
|
||||
if (id == 235) tmp.event = {'cls': 'enemys', 'id': 'poisonBat'};
|
||||
if (id == 236) tmp.event = {'cls': 'enemys', 'id': 'steelRock'};
|
||||
if (id == 237) tmp.event = {'cls': 'enemys', 'id': 'skeletonPriest'};
|
||||
if (id == 238) tmp.event = {'cls': 'enemys', 'id': 'skeletonKing'};
|
||||
if (id == 239) tmp.event = {'cls': 'enemys', 'id': 'skeletonWizard'};
|
||||
if (id == 240) tmp.event = {'cls': 'enemys', 'id': 'redSkeletonCaption'};
|
||||
if (id == 241) tmp.event = {'cls': 'enemys', 'id': 'badHero'};
|
||||
if (id == 242) tmp.event = {'cls': 'enemys', 'id': 'demon'};
|
||||
if (id == 243) tmp.event = {'cls': 'enemys', 'id': 'demonPriest'};
|
||||
if (id == 244) tmp.event = {'cls': 'enemys', 'id': 'goldHornSlime'};
|
||||
if (id == 245) tmp.event = {'cls': 'enemys', 'id': 'redKing'};
|
||||
if (id == 246) tmp.event = {'cls': 'enemys', 'id': 'whiteKing'};
|
||||
if (id == 247) tmp.event = {'cls': 'enemys', 'id': 'blackMagician'};
|
||||
if (id == 248) tmp.event = {'cls': 'enemys', 'id': 'silverSlime'};
|
||||
if (id == 249) tmp.event = {'cls': 'enemys', 'id': 'swordEmperor'};
|
||||
if (id == 250) tmp.event = {'cls': 'enemys', 'id': 'whiteHornSlime'};
|
||||
if (id == 251) tmp.event = {'cls': 'enemys', 'id': 'badPrincess'};
|
||||
if (id == 252) tmp.event = {'cls': 'enemys', 'id': 'badFairy'};
|
||||
if (id == 253) tmp.event = {'cls': 'enemys', 'id': 'grayPriest'};
|
||||
if (id == 254) tmp.event = {'cls': 'enemys', 'id': 'redSwordsman'};
|
||||
if (id == 255) tmp.event = {'cls': 'enemys', 'id': 'whiteGhost'};
|
||||
if (id == 256) tmp.event = {'cls': 'enemys', 'id': 'poisonZombie'};
|
||||
if (id == 257) tmp.event = {'cls': 'enemys', 'id': 'magicDragon'};
|
||||
if (id == 258) tmp.event = {'cls': 'enemys', 'id': 'octopus'};
|
||||
if (id == 259) tmp.event = {'cls': 'enemys', 'id': 'fairy'};
|
||||
if (id == 260) tmp.event = {'cls': 'enemys', 'id': 'greenKnight'};
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
maps.prototype.getMaps = function (mapName) {
|
||||
if (mapName == undefined) {
|
||||
return this.updateNoPass(this.maps);
|
||||
maps.prototype.addEvent = function (block, x, y, event) {
|
||||
if (!core.isset(event)) return;
|
||||
if (!core.isset(block.event)) { // 本身是空地?
|
||||
block.event = {'cls': 'terrains', 'id': 'ground', 'noPass': false};
|
||||
}
|
||||
return this.maps[mapName];
|
||||
// event是字符串或数组?
|
||||
if (typeof event == "string") {
|
||||
event = {"data": [event]};
|
||||
}
|
||||
else if (event instanceof Array) {
|
||||
event = {"data": event};
|
||||
}
|
||||
|
||||
// 覆盖enable
|
||||
if (!core.isset(block.event.enable) && core.isset(event.enable)) {
|
||||
block.enable=event.enable;
|
||||
}
|
||||
// 覆盖trigger
|
||||
if (!core.isset(block.event.trigger)) {
|
||||
if (core.isset(event.trigger)) block.event.trigger=event.trigger;
|
||||
else block.event.trigger='action';
|
||||
}
|
||||
// 覆盖data
|
||||
block.event.data = event.data;
|
||||
}
|
||||
|
||||
maps.prototype.updateNoPass = function (maps) {
|
||||
maps.prototype.initMaps = function (floorIds) {
|
||||
var maps = {};
|
||||
for (var i=0;i<floorIds.length;i++) {
|
||||
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.updateNoPass(maps[floorId]);
|
||||
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;
|
||||
@ -561,6 +259,9 @@ maps.prototype.updateNoPass = function (maps) {
|
||||
if (t.event.cls=='enemys' || t.event.cls=='npcs') {
|
||||
t.event.animate = 2;
|
||||
}
|
||||
if (t.event.cls == 'animates') {
|
||||
t.event.animate = 4;
|
||||
}
|
||||
}
|
||||
});
|
||||
return maps;
|
||||
|
||||
103
libs/ui.js
@ -18,7 +18,7 @@ main.instance.ui = new ui();
|
||||
*/
|
||||
ui.prototype.closePanel = function (clearData) {
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.setBoxAnimate(core.firstData.animateSpeed);
|
||||
core.setBoxAnimate();
|
||||
core.clearMap('ui', 0, 0, 416, 416);
|
||||
core.setAlpha('ui', 1.0);
|
||||
if (core.isset(clearData) && clearData)
|
||||
@ -34,12 +34,43 @@ ui.prototype.closePanel = function (clearData) {
|
||||
* @param content
|
||||
* @param id
|
||||
*/
|
||||
ui.prototype.drawTextBox = function(content, id) {
|
||||
ui.prototype.drawTextBox = function(content) {
|
||||
|
||||
core.lockControl();
|
||||
|
||||
if (core.status.event.id == null)
|
||||
core.status.event.id = 'text';
|
||||
// 获得name, image, icon
|
||||
var id=null, name=null, image=null, icon=null;
|
||||
if (content.indexOf("\t[")==0) {
|
||||
var index = content.indexOf("]");
|
||||
if (index>=0) {
|
||||
var str=content.substring(2, index);
|
||||
content=content.substring(index+1);
|
||||
var ss=str.split(",");
|
||||
if (ss.length==1) {
|
||||
// id
|
||||
id=ss[0];
|
||||
// monster
|
||||
if (id!='hero') {
|
||||
var enemys = core.material.enemys[id];
|
||||
if (core.isset(enemys)) {
|
||||
name = core.material.enemys[id].name;
|
||||
image = core.material.images.enemys;
|
||||
icon = core.material.icons.enemys[id];
|
||||
}
|
||||
else {
|
||||
name=id;
|
||||
id='npc';
|
||||
image=null;
|
||||
icon=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
id='npc';
|
||||
name=ss[0];
|
||||
image=core.material.images.npcs;
|
||||
icon=core.material.icons.npcs[ss[1]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||
var contents = content.split('\n');
|
||||
@ -54,6 +85,8 @@ ui.prototype.drawTextBox = function(content, id) {
|
||||
core.fillRect('ui', left, top, right, bottom, '#000000');
|
||||
core.setAlpha('ui', 1);
|
||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.setBoxAnimate();
|
||||
|
||||
// 名称
|
||||
core.canvas.ui.textAlign = "left";
|
||||
@ -61,42 +94,30 @@ ui.prototype.drawTextBox = function(content, id) {
|
||||
var content_left = left + 25, content_top = top + 35;
|
||||
if (core.isset(id)) {
|
||||
|
||||
content_left = left+63;
|
||||
content_top = top+57;
|
||||
|
||||
var name, image, cls;
|
||||
// 动画
|
||||
core.strokeRect('ui', left + 15 - 1, top + 40 - 1, 34, 34, '#FFD700', 2);
|
||||
if (id=='hero' || core.isset(icon)) {
|
||||
core.strokeRect('ui', left + 15 - 1, top + 40 - 1, 34, 34, '#FFD700', 2);
|
||||
content_left = left+63;
|
||||
}
|
||||
|
||||
if (id == 'hero') {
|
||||
core.fillText('ui', core.status.hero.name, left + 63, top + 30, '#FFD700', 'bold 22px Verdana');
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.setBoxAnimate(core.firstData.animateSpeed);
|
||||
core.fillText('ui', core.status.hero.name, content_left, top + 30, '#FFD700', 'bold 22px Verdana');
|
||||
core.clearMap('ui', left + 15, top + 40, 32, 32);
|
||||
core.fillRect('ui', left + 15, top + 40, 32, 32, background);
|
||||
var heroIcon = core.material.icons.heros[core.status.hero.id]['down'];
|
||||
core.canvas.ui.drawImage(core.material.images.heros, heroIcon.loc['stop'] * heroIcon.size, heroIcon.loc.iconLoc * heroIcon.size, heroIcon.size, heroIcon.size, left+15, top+40, 32, 32);
|
||||
core.canvas.ui.drawImage(core.material.images.heros, heroIcon.stop * 32, heroIcon.loc *32, 32, 32, left+15, top+40, 32, 32);
|
||||
}
|
||||
else {
|
||||
var name = null, image = null, icon = null;
|
||||
if (core.material.npcs.hasOwnProperty(id)) {
|
||||
name = core.material.npcs[id].name;
|
||||
image = core.material.images.npcs;
|
||||
icon = core.material.icons.npcs[core.material.npcs[id].icon];
|
||||
}
|
||||
else if (core.material.enemys.hasOwnProperty(id)) {
|
||||
name = core.material.enemys[id].name;
|
||||
image = core.material.images.enemys;
|
||||
icon = core.material.icons.enemys[id];
|
||||
}
|
||||
if (name != null) {
|
||||
core.fillText('ui', name, left + 63, top + 30, '#FFD700', 'bold 22px Verdana');
|
||||
core.fillText('ui', name, content_left, top + 30, '#FFD700', 'bold 22px Verdana');
|
||||
if (core.isset(icon)) {
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.status.boxAnimateObjs.push({
|
||||
'bgx': left + 15, 'bgy': top + 40, 'bgsize': 32,
|
||||
'image': image, 'x': left + 15, 'y': top + 40, 'icon': icon
|
||||
});
|
||||
core.setBoxAnimate(core.firstData.animateSpeed);
|
||||
core.setBoxAnimate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -254,7 +275,7 @@ ui.prototype.drawShop = function (id) {
|
||||
'image': core.material.images.npcs,
|
||||
'x': left + 15, 'y': top + 30, 'icon': core.material.icons.npcs[shop.icon]
|
||||
});
|
||||
core.setBoxAnimate(core.firstData.animateSpeed);
|
||||
core.setBoxAnimate();
|
||||
|
||||
// 对话
|
||||
core.canvas.ui.textAlign = "left";
|
||||
@ -451,7 +472,7 @@ ui.prototype.drawEnemyBook = function (page) {
|
||||
core.fillText('ui', enemy.defDamage, 365, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana');
|
||||
|
||||
}
|
||||
core.setBoxAnimate(core.firstData.animateSpeed);
|
||||
core.setBoxAnimate();
|
||||
this.drawPagination(page, totalPage);
|
||||
}
|
||||
|
||||
@ -547,16 +568,18 @@ ui.prototype.drawToolbox = function(selectId) {
|
||||
var tool=tools[i];
|
||||
var icon=core.material.icons.items[tool];
|
||||
if (i<6) {
|
||||
core.canvas.ui.drawImage(images, 0, icon.loc*icon.size, icon.size, icon.size, 16*(4*i+1)+5, 144+5, icon.size, icon.size)
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*i+1)+5, 144+5, 32, 32)
|
||||
// 个数
|
||||
core.fillText('ui', core.itemCount(tool), 16*(4*i+1)+40, 144+38, '#FFFFFF', "bold 14px Verdana");
|
||||
if (selectId == tool)
|
||||
core.strokeRect('ui', 16*(4*i+1)+1, 144+1, icon.size+8, icon.size+8, '#FFD700');
|
||||
core.strokeRect('ui', 16*(4*i+1)+1, 144+1, 40, 40, '#FFD700');
|
||||
}
|
||||
else {
|
||||
core.canvas.ui.drawImage(images, 0, icon.loc*icon.size, icon.size, icon.size, 16*(4*(i-6)+1)+5, 144+64+5, icon.size, icon.size)
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i-6)+1)+5, 144+64+5, 32, 32)
|
||||
// 个数
|
||||
core.fillText('ui', core.itemCount(tool), 16*(4*(i-6)+1)+40, 144+64+38, '#FFFFFF', "bold 14px Verdana");
|
||||
if (selectId == tool)
|
||||
core.strokeRect('ui', 16*(4*(i-6)+1)+1, 144+64+1, icon.size+8, icon.size+8, '#FFD700');
|
||||
core.strokeRect('ui', 16*(4*(i-6)+1)+1, 144+64+1, 40, 40, '#FFD700');
|
||||
|
||||
}
|
||||
}
|
||||
@ -567,15 +590,15 @@ ui.prototype.drawToolbox = function(selectId) {
|
||||
var constant=constants[i];
|
||||
var icon=core.material.icons.items[constant];
|
||||
if (i<6) {
|
||||
core.canvas.ui.drawImage(images, 0, icon.loc*icon.size, icon.size, icon.size, 16*(4*i+1)+5, 304+5, icon.size, icon.size)
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*i+1)+5, 304+5, 32, 32)
|
||||
// core.fillText('ui', core.itemCount(constant), 16*(4*i+1)+40, 304+38, '#FFFFFF', "bold 16px Verdana")
|
||||
if (selectId == constant)
|
||||
core.strokeRect('ui', 16*(4*i+1)+1, 304+1, icon.size+8, icon.size+8, '#FFD700');
|
||||
core.strokeRect('ui', 16*(4*i+1)+1, 304+1, 40, 40, '#FFD700');
|
||||
}
|
||||
else {
|
||||
core.canvas.ui.drawImage(images, 0, icon.loc*icon.size, icon.size, icon.size, 16*(4*(i-6)+1)+5, 304+64+5, icon.size, icon.size)
|
||||
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i-6)+1)+5, 304+64+5, 32, 32)
|
||||
if (selectId == constant)
|
||||
core.strokeRect('ui', 16*(4*(i-6)+1)+1, 304+64+1, icon.size+8, icon.size+8, '#FFD700');
|
||||
core.strokeRect('ui', 16*(4*(i-6)+1)+1, 304+64+1, 40, 40, '#FFD700');
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,7 +677,7 @@ ui.prototype.drawThumbnail = function(canvas, blocks, x, y, size, heroLoc, heroI
|
||||
for (var j=0;j<13;j++) {
|
||||
var blockIcon = core.material.icons.terrains.ground;
|
||||
var blockImage = core.material.images.terrains;
|
||||
core.canvas[canvas].drawImage(blockImage, 0, blockIcon.loc * blockIcon.size, blockIcon.size, blockIcon.size, x + i * persize, y + j * persize, persize, persize);
|
||||
core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + i * persize, y + j * persize, persize, persize);
|
||||
}
|
||||
}
|
||||
for (var b in blocks) {
|
||||
@ -664,13 +687,13 @@ ui.prototype.drawThumbnail = function(canvas, blocks, x, y, size, heroLoc, heroI
|
||||
var blockIcon = core.material.icons[block.event.cls][block.event.id];
|
||||
var blockImage = core.material.images[block.event.cls];
|
||||
//core.canvas[canvas].clearRect(x + i * persize, y + j * persize, persize, persize);
|
||||
core.canvas[canvas].drawImage(blockImage, 0, blockIcon.loc * blockIcon.size, blockIcon.size, blockIcon.size, x + i * persize, y + j * persize, persize, persize);
|
||||
core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + i * persize, y + j * persize, persize, persize);
|
||||
}
|
||||
}
|
||||
if (core.isset(heroLoc)) {
|
||||
var id = core.isset(heroId)?heroId:core.status.hero.id;
|
||||
var heroIcon = core.material.icons.heros[id][heroLoc.direction];
|
||||
core.canvas[canvas].drawImage(core.material.images.heros, heroIcon.loc['stop'] * heroIcon.size, heroIcon.loc.iconLoc * heroIcon.size, heroIcon.size, heroIcon.size, x+persize*heroLoc.x, y+persize*heroLoc.y, persize, persize);
|
||||
core.canvas[canvas].drawImage(core.material.images.heros, heroIcon.stop * 32, heroIcon.loc * 32, 32, 32, x+persize*heroLoc.x, y+persize*heroLoc.y, persize, persize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
51
main.js
@ -1,4 +1,5 @@
|
||||
function main() {
|
||||
this.version = "0.0.1";
|
||||
this.dom = {
|
||||
'body': document.body,
|
||||
'gameGroup': document.getElementById('gameGroup'),
|
||||
@ -76,7 +77,7 @@ function main() {
|
||||
'hard': document.getElementById("hard")
|
||||
}
|
||||
this.floorIds = [
|
||||
"MT1"
|
||||
"sample0"
|
||||
]
|
||||
this.floors = {}
|
||||
this.instance = {};
|
||||
@ -87,7 +88,7 @@ main.prototype.init = function () {
|
||||
for (var i = 0; i < main.dom.gameCanvas.length; i++) {
|
||||
main.canvas[main.dom.gameCanvas[i].id] = main.dom.gameCanvas[i].getContext('2d');
|
||||
}
|
||||
main.loader(function () {
|
||||
main.loaderJs(function () {
|
||||
var coreData = {};
|
||||
for (i = 0; i < main.loadList.length; i++) {
|
||||
var name = main.loadList[i];
|
||||
@ -100,13 +101,24 @@ main.prototype.init = function () {
|
||||
main[name].init(main.dom);
|
||||
coreData[name] = main[name];
|
||||
}
|
||||
main.core.init(main.dom, main.statusBar, main.canvas, main.images, main.sounds, coreData);
|
||||
main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
|
||||
main.loaderFloors(function() {
|
||||
// 处理.min
|
||||
for (var i=0;i<main.floorIds.length;i++) {
|
||||
if (name.indexOf(".min")==name.length-4) {
|
||||
name = name.substring(0, name.length - 4);
|
||||
main.floorIds[i] = name.substring(0, name.length - 4);
|
||||
}
|
||||
}
|
||||
main.core.init(main.dom, main.statusBar, main.canvas, main.images, main.sounds, main.floorIds, main.floors, coreData);
|
||||
main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
main.prototype.loader = function (callback) {
|
||||
main.prototype.loaderJs = function (callback) {
|
||||
var instanceNum = 0;
|
||||
// 加载js
|
||||
main.setMainTipsText('正在加载核心js文件...')
|
||||
for (var i = 0; i < main.loadList.length; i++) {
|
||||
main.loadMod(main.loadList[i], function (modName) {
|
||||
instanceNum = 0;
|
||||
@ -116,6 +128,20 @@ main.prototype.loader = function (callback) {
|
||||
}
|
||||
if (instanceNum === main.loadList.length) {
|
||||
delete main.instance;
|
||||
// main.dom.mainTips.style.display = 'none';
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
main.prototype.loaderFloors = function (callback) {
|
||||
// 加载js
|
||||
main.setMainTipsText('正在加载楼层文件...')
|
||||
for (var i = 0; i < main.floorIds.length; i++) {
|
||||
main.loadFloor(main.floorIds[i], function (modName) {
|
||||
main.setMainTipsText("楼层 " + modName + '.js 加载完毕');
|
||||
if (Object.keys(main.floors).length === main.floorIds.length) {
|
||||
main.dom.mainTips.style.display = 'none';
|
||||
callback();
|
||||
}
|
||||
@ -129,7 +155,7 @@ main.prototype.loadMod = function (modName, callback) {
|
||||
// end with ".min"
|
||||
if (name.indexOf(".min")==name.length-4)
|
||||
name=name.substring(0, name.length-4);
|
||||
script.src = 'libs/' + modName + '.js';
|
||||
script.src = 'libs/' + modName + '.js?' + this.version;
|
||||
main.dom.body.appendChild(script);
|
||||
script.onload = function () {
|
||||
main[name] = main.instance[name];
|
||||
@ -137,6 +163,15 @@ main.prototype.loadMod = function (modName, callback) {
|
||||
}
|
||||
}
|
||||
|
||||
main.prototype.loadFloor = function(floorId, callback) {
|
||||
var script = document.createElement('script');
|
||||
script.src = 'libs/floors/' + floorId +'.js?' + this.version;
|
||||
main.dom.body.appendChild(script);
|
||||
script.onload = function () {
|
||||
callback(floorId);
|
||||
}
|
||||
}
|
||||
|
||||
main.prototype.setMainTipsText = function (text) {
|
||||
main.dom.mainTips.innerHTML = text;
|
||||
}
|
||||
@ -152,13 +187,13 @@ window.onresize = function () {
|
||||
|
||||
main.dom.body.onkeydown = function(e) {
|
||||
if (main.core.isPlaying())
|
||||
main.core.keyDown(e);
|
||||
main.core.onkeyDown(e);
|
||||
}
|
||||
|
||||
main.dom.body.onkeyup = function(e) {
|
||||
try {
|
||||
if (main.core.isPlaying())
|
||||
main.core.keyUp(e);
|
||||
main.core.onkeyUp(e);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
|
||||