commit
cdc85d5782
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
.vscode
|
||||
*ce5eec52_2fa1_447b_8dad_764e267a7fab*
|
||||
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
89
_server/editor_file.demo.js
Normal file
89
_server/editor_file.demo.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
23
_server/editor_file_test.html
Normal file
23
_server/editor_file_test.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head><meta charset="utf-8"></head>
|
||||
<body>
|
||||
<pre id='pout'>
|
||||
|
||||
</pre>
|
||||
<script src="fs.js"></script>
|
||||
<script src="editor_file.js"></script>
|
||||
<script>
|
||||
pout.innerHTML='waiting\nwaiting waiting';
|
||||
var editor={};
|
||||
editor.fs=fs;
|
||||
editor.file=editor_file;
|
||||
editor.file.loadFloorFile(editor,'sample0',function(err){console.log(err);
|
||||
editor.file.saveFloorFileAs(editor,'aaa',function(err){console.log(err)});
|
||||
});
|
||||
|
||||
pout.innerHTML='succeed\nsucceed succeed';
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
264
drawMapGUI.html
264
drawMapGUI.html
@ -31,8 +31,8 @@
|
||||
<table class="row" id='mapRowMark'></table>
|
||||
<div class="map" id="mapEdit">
|
||||
<canvas class='gameCanvas' id='bg' width='416' height='416' style='z-index:1'></canvas>
|
||||
<canvas class='gameCanvas' id='eventLayer' width='416' height='416' style='z-index:2'></canvas>
|
||||
<canvas class='gameCanvas' id='ui' width='416' height='416' style='z-index:100'></canvas>
|
||||
<canvas class='gameCanvas' id='event' width='416' height='416' style='z-index:2'></canvas>
|
||||
<canvas class='gameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<div id="tip" v-cloak >
|
||||
@ -70,13 +70,111 @@
|
||||
</div>
|
||||
<div id="right">
|
||||
<div id="iconLib">
|
||||
<canvas class='gameCanvas' id='data' width='416' height='416' style='z-index:0'></canvas>
|
||||
<canvas class='gameCanvas' id='edata' width='416' height='416' style='z-index:0'></canvas>
|
||||
<div id="selectBox">
|
||||
<div id='dataSelection' v-show="isSelected" v-cloak></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <script>/* -->
|
||||
<div id='gameGroup' style='display:none'>
|
||||
<p id='mainTips'>请稍后...</p>
|
||||
<div id='startPanel'>
|
||||
<div id='startTop'>
|
||||
<div id='startTopProgressBar'>
|
||||
<div id='startTopProgress'></div>
|
||||
</div>
|
||||
<p id='startTopLoadTips'>资源即将开始加载</p>
|
||||
</div>
|
||||
<img id='startBackground' src='images/bg.png'>
|
||||
<!-- 标题界面;可以改style的color使标题改变颜色 -->
|
||||
<p id='startLogo' style="color: black"></p>
|
||||
<div id='startButtonGroup'>
|
||||
<div id='startButtons'>
|
||||
<span class='startButton' id='playGame'>开始游戏</span>
|
||||
<span class='startButton' id='loadGame'>载入游戏</span>
|
||||
<span class='startButton' id='aboutGame'>关于本塔</span>
|
||||
</div>
|
||||
<div id='levelChooseButtons'>
|
||||
<span class='startButton' id='easyLevel'>简单</span>
|
||||
<span class='startButton' id='normalLevel'>普通</span>
|
||||
<span class='startButton' id='hardLevel'>困难</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='floorMsgGroup'>
|
||||
<p id='logoLabel'></p>
|
||||
<p id='versionLabel'></p>
|
||||
<p id='floorNameLabel'></p>
|
||||
</div>
|
||||
<div id='statusBar' class="clearfix">
|
||||
<div class="status" id="floorCol">
|
||||
<img src='images/floor.png' id="img-floor">
|
||||
<p class='statusLabel' id='floor'></p>
|
||||
</div>
|
||||
<div class="status" id="lvCol">
|
||||
<img src='images/lv.png' id="img-lv">
|
||||
<p class='statusLabel' id='lv'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<img src='images/hp.png' id="img-hp">
|
||||
<p class='statusLabel' id='hp'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<img src='images/atk.png' id="img-atk">
|
||||
<p class='statusLabel' id='atk'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<img src='images/def.png' id="img-def">
|
||||
<p class='statusLabel' id='def'></p>
|
||||
</div>
|
||||
<div class="status" id="mdefCol">
|
||||
<img src='images/mdef.png' id="img-mdef">
|
||||
<p class='statusLabel' id='mdef'></p>
|
||||
</div>
|
||||
<div class="status" id="moneyCol">
|
||||
<img src='images/money.png' id="img-money">
|
||||
<p class='statusLabel' id='money'></p>
|
||||
</div>
|
||||
<div class="status" id="expCol">
|
||||
<img src='images/experience.png' id="img-experience">
|
||||
<p class='statusLabel' id='experience'></p>
|
||||
</div>
|
||||
<div class="status" id="upCol">
|
||||
<img src='images/up.png' id="img-up">
|
||||
<p class='statusLabel' id='up'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
||||
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
||||
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
||||
</div>
|
||||
<div class="status" id="debuffCol">
|
||||
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
||||
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
||||
<span class='statusLabel' id='curse' style="color: #C2F4E7;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toolBar" class="clearfix">
|
||||
<img src="images/book.png" class="tools" id='img-book'>
|
||||
<img src="images/fly.png" class="tools" id='img-fly'>
|
||||
<img src="images/toolbox.png" class="tools" id='img-toolbox'>
|
||||
<img src="images/shop.png" class="tools" id='img-shop'>
|
||||
<img src="images/save.png" class="tools" id='img-save'>
|
||||
<img src="images/load.png" class="tools" id='img-load'>
|
||||
<img src="images/settings.png" class="tools" id='img-settings'>
|
||||
<p class="statusLabel tools" id="hard"></p>
|
||||
</div>
|
||||
<div id="curtain"></div>
|
||||
<!-- <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
|
||||
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas> -->
|
||||
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
||||
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
||||
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
|
||||
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
||||
</div>
|
||||
<!-- */</script> -->
|
||||
<script>
|
||||
// 生成定位编号
|
||||
(function(){
|
||||
@ -102,109 +200,41 @@
|
||||
<script src='_server/vendor/vue.min.js'></script>
|
||||
<!-- <script src="https://cdn.bootcss.com/vue/2.5.13/vue.js"></script> -->
|
||||
<script src='_server/fs.js'></script>
|
||||
<script src='_server/editor_file.js'></script>
|
||||
<script src='_server/vm.js'></script>
|
||||
<script id='mainScript' src='main.js'></script>
|
||||
<script>
|
||||
|
||||
//所有全局量
|
||||
__all__=['Vue','fs','printf','editor','main','core'];
|
||||
__id__=['printOut','arrRowMark','mapRowMark','data','bg','dataSelection'];
|
||||
__Vue__=['exportM','editArea','editTip','clear','tip','selectBox'];
|
||||
//var event = document.getElementById('event');
|
||||
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
function hasOwnProp (obj, key) {
|
||||
return hasOwnProperty.call(obj, key)
|
||||
}
|
||||
|
||||
var main={'instance':{}};
|
||||
var core={};
|
||||
|
||||
|
||||
function editor() {
|
||||
this.version = "1.2";
|
||||
this.material = {};
|
||||
}
|
||||
// 重构这一堆回调
|
||||
editor.prototype.init = function(){
|
||||
var mapsjsUrl = 'libs/maps.js';
|
||||
var iconsjsUrl = 'libs/icons.js';
|
||||
|
||||
var p1 = editor.loadjs(mapsjsUrl).then(function(){ // 加载maps.js
|
||||
return new maps(); //实例化maps
|
||||
});
|
||||
var p2 = editor.loadjs(iconsjsUrl) // 加载icons.js
|
||||
.then(function(){ // 实例化并获取icons
|
||||
var ic = new icons();
|
||||
ic.init();
|
||||
return ic.getIcons();
|
||||
});
|
||||
var p3 = p2.then(function(icons){ // 加载所有图片
|
||||
return editor.loadAllImgs(icons);
|
||||
})
|
||||
.catch(function(err){
|
||||
console.log('发生错误!', err);
|
||||
});
|
||||
|
||||
Promise.all([p1, p2, p3])
|
||||
.then(function([maps, icons, img]){
|
||||
editor.idsInit(maps, icons); // 初始化图片素材信息
|
||||
editor.drawInitData(icons); // 初始化绘图
|
||||
editor.listen(); // 开始监听事件
|
||||
})
|
||||
editor.prototype.init = function(callback){
|
||||
editor.main=main;
|
||||
editor.core=core;
|
||||
editor.fs=fs;
|
||||
editor.file=editor_file;
|
||||
editor.material.images=core.material.images;
|
||||
editor.idsInit(core.maps, core.icons.icons); // 初始化图片素材信息
|
||||
editor.drawInitData(core.icons.icons); // 初始化绘图
|
||||
editor.listen(); // 开始监听事件
|
||||
if(Boolean(callback))callback();
|
||||
}
|
||||
|
||||
editor.prototype.loadjs = function(url){
|
||||
return new Promise(function(resolve, reject){
|
||||
var script = document.createElement('script');
|
||||
script.src = url + '?' + editor.version;
|
||||
document.body.appendChild(script);
|
||||
script.onload = function () {
|
||||
resolve( console.log(url+"加载完成"));
|
||||
}
|
||||
script.onerror = function(){
|
||||
reject(new Error('Load js error at '+url))
|
||||
}
|
||||
});
|
||||
}
|
||||
editor.prototype.loadImg = function(url){
|
||||
return new Promise(function(resolve, reject){
|
||||
var img = new Image();
|
||||
img.src = url;
|
||||
img.onload = function(){
|
||||
resolve(img);
|
||||
}
|
||||
img.onerror = function(){
|
||||
reject(new Error('Load image error at '+url));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
editor.prototype.loadAllImgs = function(icons){
|
||||
editor.material.images = {};
|
||||
var imgs = Object.keys(icons);
|
||||
var autotiles = null;
|
||||
if(hasOwnProp(icons, 'hero')){ // hero 图片不加载
|
||||
var index = imgs.indexOf('hero');
|
||||
imgs.splice(index, 1);
|
||||
}
|
||||
if(hasOwnProp(icons, 'autotile')){
|
||||
editor.material.images['autotile'] = {};
|
||||
var index = imgs.indexOf('autotile');
|
||||
imgs.splice(index, 1);
|
||||
autotiles = Object.keys(icons.autotile);
|
||||
imgs = imgs.concat(autotiles);
|
||||
}
|
||||
var p = imgs.map(function(im){
|
||||
var url = 'images/'+im+'.png'
|
||||
return editor.loadImg(url).then(function(image){
|
||||
if(autotiles.indexOf(im) >= 0){
|
||||
editor.material.images['autotile'][im] = image;
|
||||
}else editor.material.images[im] = image;
|
||||
}).catch(function(err){
|
||||
console.log('发生错误!', err);
|
||||
});
|
||||
});
|
||||
|
||||
return Promise.all(p);
|
||||
}
|
||||
editor.prototype.idsInit = function(maps, icons){
|
||||
editor.ids = [0];
|
||||
editor.indexs = [];
|
||||
@ -267,9 +297,9 @@ editor.prototype.drawInitData = function (icons) {
|
||||
var fullWidth=~~(sumWidth*ratio);
|
||||
var fullHeight=~~(maxHeight*ratio);
|
||||
|
||||
if (fullWidth > data.width) data.style.width = (data.width = fullWidth)/ratio + 'px';
|
||||
data.style.height = (data.height = fullHeight)/ratio + 'px';
|
||||
var dc = data.getContext('2d');
|
||||
if (fullWidth > edata.width) edata.style.width = (edata.width = fullWidth)/ratio + 'px';
|
||||
edata.style.height = (edata.height = fullHeight)/ratio + 'px';
|
||||
var dc = edata.getContext('2d');
|
||||
var nowx = 0;
|
||||
var nowy = 0;
|
||||
for(var ii=0; ii<imgNames.length; ii++){
|
||||
@ -295,7 +325,7 @@ editor.prototype.drawInitData = function (icons) {
|
||||
editor.mapInit();
|
||||
}
|
||||
editor.prototype.mapInit = function(){
|
||||
var ec = eventLayer.getContext('2d');
|
||||
var ec = document.getElementById('event').getContext('2d');
|
||||
ec.clearRect(0, 0, 416, 416);
|
||||
editor.map = [];
|
||||
for(var y=0; y<13; y++){
|
||||
@ -307,6 +337,10 @@ editor.prototype.mapInit = function(){
|
||||
}
|
||||
editor.prototype.drawMapBg = function(img){
|
||||
var bgc = bg.getContext('2d');
|
||||
if (editor.bgY == 0){
|
||||
editor.main.editor.drawMapBg();
|
||||
return;
|
||||
}
|
||||
|
||||
for (var ii = 0; ii < 13; ii++)
|
||||
for (var jj = 0; jj < 13; jj++) {
|
||||
@ -319,10 +353,13 @@ editor.prototype.drawMapBg = function(img){
|
||||
}
|
||||
|
||||
editor.prototype.updateMap = function(){
|
||||
var blocks = main.editor.mapIntoBlocks(editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})}),{'events':{},'changeFloor':{}});
|
||||
core.status.thisMap.blocks = blocks;
|
||||
main.editor.updateMap();
|
||||
|
||||
var drawTile = function(ctx, x, y, tileInfo){ // 绘制一个普通块
|
||||
|
||||
ctx.clearRect(x*32, y*32, 32, 32);
|
||||
//ctx.clearRect(x*32, y*32, 32, 32);
|
||||
if(tileInfo == 0) return;
|
||||
|
||||
if(typeof(tileInfo) == typeof([][0]) || !hasOwnProp(tileInfo, 'idnum')) {//未定义块画红块
|
||||
@ -339,9 +376,9 @@ editor.prototype.updateMap = function(){
|
||||
ctx.fillText("?", x*32+16, y*32+27);
|
||||
return;
|
||||
}
|
||||
ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
||||
//ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
||||
}
|
||||
|
||||
/*
|
||||
// autotile的相关处理
|
||||
var indexArrs = [ //16种组合的图块索引数组; // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块
|
||||
// +----+----+----+----+----+----+
|
||||
@ -426,13 +463,13 @@ editor.prototype.updateMap = function(){
|
||||
drawBlockByIndex(ctx, dx, dy, editor.material.images[info.images][info.id], index);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
// 绘制地图 start
|
||||
var eventCtx = eventLayer.getContext("2d");
|
||||
var eventCtx = document.getElementById('event').getContext("2d");
|
||||
for(var y=0; y<13; y++)
|
||||
for(var x=0; x<13; x++){
|
||||
var tileInfo = editor.map[y][x];
|
||||
if(isAutotile(tileInfo)){
|
||||
if(false && isAutotile(tileInfo)){
|
||||
addIndexToAutotileInfo(x, y);
|
||||
drawAutotile(eventCtx, x, y, tileInfo);
|
||||
}else drawTile(eventCtx, x, y, tileInfo);
|
||||
@ -442,7 +479,7 @@ editor.prototype.updateMap = function(){
|
||||
|
||||
editor.prototype.listen = function() {
|
||||
|
||||
var uc = ui.getContext('2d');
|
||||
var uc = eui.getContext('2d');
|
||||
|
||||
function fillPos(pos) {
|
||||
uc.fillStyle = '#' + ~~(Math.random() * 8) + ~~(Math.random() * 8) + ~~(Math.random() * 8);
|
||||
@ -477,7 +514,7 @@ editor.prototype.listen = function() {
|
||||
uc.clearRect(0, 0, 416, 416);
|
||||
}//用于鼠标移出canvas时的自动清除状态
|
||||
|
||||
ui.onmousedown = function (e) {
|
||||
eui.onmousedown = function (e) {
|
||||
if(!selectBox.isSelected) {
|
||||
tip.whichShow = 1;
|
||||
return;
|
||||
@ -495,7 +532,7 @@ editor.prototype.listen = function() {
|
||||
fillPos(pos);
|
||||
}
|
||||
|
||||
ui.onmousemove = function (e) {
|
||||
eui.onmousemove = function (e) {
|
||||
if(!selectBox.isSelected) {
|
||||
// tip.whichShow = 1;
|
||||
return;
|
||||
@ -524,7 +561,7 @@ editor.prototype.listen = function() {
|
||||
}
|
||||
}
|
||||
|
||||
ui.onmouseup = function (e) {
|
||||
eui.onmouseup = function (e) {
|
||||
if(!selectBox.isSelected) {
|
||||
tip.whichShow = 1;
|
||||
return;
|
||||
@ -578,7 +615,7 @@ editor.prototype.listen = function() {
|
||||
}
|
||||
}
|
||||
|
||||
data.onmousedown = function (e) {
|
||||
edata.onmousedown = function (e) {
|
||||
e.stopPropagation();
|
||||
var loc = {
|
||||
'x': document.documentElement.scrollLeft + e.clientX + iconLib.scrollLeft - right.offsetLeft-iconLib.offsetLeft,
|
||||
@ -647,16 +684,27 @@ editor.info
|
||||
始终是最后一次点击的结果
|
||||
注意editor.info可能因为点击其他地方而被清空
|
||||
*/
|
||||
var editor = new editor();
|
||||
editor.init();
|
||||
editor = new editor();
|
||||
main.init('editor');
|
||||
//main.listen();
|
||||
var afterMainInit = function(){
|
||||
|
||||
main.editor.disableGlobalAnimate=false;
|
||||
//core.status.maps = core.clone(core.maps.initMaps(floorIds));
|
||||
editor.init(editor.updateMap);
|
||||
}
|
||||
var startgame = function(){
|
||||
var hard = 'Hard';
|
||||
core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, core.initStatus.maps);
|
||||
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
|
||||
/* core.setHeroMoveTriggerInterval(); */
|
||||
afterMainInit();
|
||||
});
|
||||
core.events.setInitData(hard);
|
||||
}
|
||||
setTimeout(startgame, 300);
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
//Vue
|
||||
//var listenByVue = function() {
|
||||
|
||||
//}
|
||||
//listenByVue()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -113,6 +113,7 @@
|
||||
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
||||
</div>
|
||||
<script id='mainScript' src='main.js'></script>
|
||||
<script>main.init();main.listen();</script>
|
||||
<script src='libs/thirdparty/mid.js'></script>
|
||||
</body>
|
||||
</html>
|
||||
101
libs/core.js
101
libs/core.js
@ -2001,47 +2001,70 @@ core.prototype.setFillStyle = function (map, style) {
|
||||
|
||||
////// 绘制某张地图 //////
|
||||
core.prototype.drawMap = function (mapName, callback) {
|
||||
var mapData = core.status.maps[mapName];
|
||||
var mapBlocks = mapData.blocks;
|
||||
core.status.floorId = mapName;
|
||||
core.status.thisMap = mapData;
|
||||
core.clearMap('all');
|
||||
core.removeGlobalAnimate(null, null, true);
|
||||
var groundId = core.floors[mapName].defaultGround || "ground";
|
||||
var blockIcon = core.material.icons.terrains[groundId];
|
||||
var blockImage = core.material.images.terrains;
|
||||
for (var x = 0; x < 13; x++) {
|
||||
for (var y = 0; y < 13; y++) {
|
||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果存在png
|
||||
if (core.isset(core.floors[mapName].png)) {
|
||||
var png = core.floors[mapName].png;
|
||||
if (core.isset(core.material.images.pngs[png])) {
|
||||
core.canvas.bg.drawImage(core.material.images.pngs[png], 0, 0, 416, 416);
|
||||
}
|
||||
}
|
||||
|
||||
var mapArray = core.maps.getMapArray(core.status.maps, mapName);
|
||||
for (var b = 0; b < mapBlocks.length; b++) {
|
||||
// 事件启用
|
||||
var block = mapBlocks[b];
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) {
|
||||
if (block.event.cls == 'autotile') {
|
||||
core.drawAutotile(core.canvas.event, mapArray, block, 32, 0, 0);
|
||||
var drawBg = function(){
|
||||
var groundId = core.floors[mapName].defaultGround || "ground";
|
||||
var blockIcon = core.material.icons.terrains[groundId];
|
||||
var blockImage = core.material.images.terrains;
|
||||
for (var x = 0; x < 13; x++) {
|
||||
for (var y = 0; y < 13; y++) {
|
||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||
}
|
||||
else {
|
||||
if (block.event.id!='none') {
|
||||
blockIcon = core.material.icons[block.event.cls][block.event.id];
|
||||
blockImage = core.material.images[block.event.cls];
|
||||
core.canvas.event.drawImage(core.material.images[block.event.cls], 0, blockIcon * 32, 32, 32, block.x * 32, block.y * 32, 32, 32);
|
||||
core.addGlobalAnimate(block.event.animate, block.x * 32, block.y * 32, blockIcon, blockImage);
|
||||
}
|
||||
// 如果存在png
|
||||
if (core.isset(core.floors[mapName].png)) {
|
||||
var png = core.floors[mapName].png;
|
||||
if (core.isset(core.material.images.pngs[png])) {
|
||||
core.canvas.bg.drawImage(core.material.images.pngs[png], 0, 0, 416, 416);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (main.mode=='editor'){
|
||||
main.editor.drawMapBg = function(){
|
||||
core.clearMap('bg', 0, 0, 416, 416);
|
||||
drawBg();
|
||||
}
|
||||
} else {
|
||||
drawBg();
|
||||
}
|
||||
|
||||
core.status.floorId = mapName;
|
||||
core.status.thisMap = core.status.maps[mapName];
|
||||
var drawEvent = function(){
|
||||
var mapData = core.status.maps[core.status.floorId];
|
||||
var mapBlocks = mapData.blocks;
|
||||
|
||||
var mapArray = core.maps.getMapArray(core.status.maps, core.status.floorId);
|
||||
for (var b = 0; b < mapBlocks.length; b++) {
|
||||
// 事件启用
|
||||
var block = mapBlocks[b];
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) {
|
||||
if (block.event.cls == 'autotile') {
|
||||
core.drawAutotile(core.canvas.event, mapArray, block, 32, 0, 0);
|
||||
}
|
||||
else {
|
||||
if (block.event.id!='none') {
|
||||
var blockIcon = core.material.icons[block.event.cls][block.event.id];
|
||||
var blockImage = core.material.images[block.event.cls];
|
||||
core.canvas.event.drawImage(core.material.images[block.event.cls], 0, blockIcon * 32, 32, 32, block.x * 32, block.y * 32, 32, 32);
|
||||
core.addGlobalAnimate(block.event.animate, block.x * 32, block.y * 32, blockIcon, blockImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (main.mode=='editor'){
|
||||
main.editor.updateMap = function(){
|
||||
core.removeGlobalAnimate(null, null, true);
|
||||
core.clearMap('event', 0, 0, 416, 416);
|
||||
drawEvent();
|
||||
core.setGlobalAnimate(core.values.animateSpeed);
|
||||
}
|
||||
} else {
|
||||
drawEvent();
|
||||
}
|
||||
core.setGlobalAnimate(core.values.animateSpeed);
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
@ -2210,8 +2233,8 @@ core.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) {
|
||||
core.setAlpha('ui', 1.0);
|
||||
|
||||
block=block.block;
|
||||
blockIcon = core.material.icons[block.event.cls][block.event.id];
|
||||
blockImage = core.material.images[block.event.cls];
|
||||
var blockIcon = core.material.icons[block.event.cls][block.event.id];
|
||||
var blockImage = core.material.images[block.event.cls];
|
||||
|
||||
// 绘制data层
|
||||
var opacityVal = 1;
|
||||
@ -2400,6 +2423,7 @@ core.prototype.removeBlockByIds = function (floorId, ids) {
|
||||
|
||||
////// 添加一个全局动画 //////
|
||||
core.prototype.addGlobalAnimate = function (animateMore, x, y, loc, image) {
|
||||
if (main.mode=='editor' && main.editor.disableGlobalAnimate) return;
|
||||
if (animateMore == 2) {
|
||||
core.status.twoAnimateObjs.push({
|
||||
'x': x,
|
||||
@ -2426,6 +2450,9 @@ core.prototype.removeGlobalAnimate = function (x, y, all) {
|
||||
core.status.twoAnimateObjs = [];
|
||||
core.status.fourAnimateObjs = [];
|
||||
}
|
||||
|
||||
if (main.mode=='editor' && main.editor.disableGlobalAnimate) return;
|
||||
|
||||
for (var t = 0; t < core.status.twoAnimateObjs.length; t++) {
|
||||
if (core.status.twoAnimateObjs[t].x == x * 32 && core.status.twoAnimateObjs[t].y == y * 32) {
|
||||
core.status.twoAnimateObjs.splice(t, 1);
|
||||
@ -2442,6 +2469,7 @@ core.prototype.removeGlobalAnimate = function (x, y, all) {
|
||||
|
||||
////// 设置全局动画的显示效果 //////
|
||||
core.prototype.setGlobalAnimate = function (speed) {
|
||||
if (main.mode=='editor' && main.editor.disableGlobalAnimate) return;
|
||||
clearInterval(core.interval.twoAnimate);
|
||||
clearInterval(core.interval.fourAnimate);
|
||||
var animateClose = false;
|
||||
@ -3803,6 +3831,7 @@ core.prototype.updateStatusBar = function () {
|
||||
|
||||
////// 屏幕分辨率改变后重新自适应 //////
|
||||
core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
if (main.mode=='editor')return;
|
||||
|
||||
// 默认画布大小
|
||||
var DEFAULT_CANVAS_WIDTH = 422;
|
||||
|
||||
168
libs/data.js
168
libs/data.js
@ -3,170 +3,10 @@ function data() {
|
||||
}
|
||||
|
||||
data.prototype.init = function() {
|
||||
this.firstData = {
|
||||
"title": "魔塔样板", // 游戏名,将显示在标题页面以及切换楼层的界面中
|
||||
"name": "template", // 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。
|
||||
"version": "Ver 1.0.0 (Beta)", // 当前游戏版本;版本不一致的存档不能通用。
|
||||
"floorId": "sample0", // 初始楼层ID
|
||||
"hero": { // 勇士初始数据
|
||||
"name": "阳光", // 勇士名;可以改成喜欢的
|
||||
'lv': 1, // 初始等级,该项必须为正整数
|
||||
"hp": 1000, // 初始生命值
|
||||
"atk": 100, // 初始攻击
|
||||
"def": 100, // 初始防御
|
||||
"mdef": 100, // 初始魔防
|
||||
"money": 100, // 初始金币
|
||||
"experience": 0, // 初始经验
|
||||
"items": { // 初始道具个数
|
||||
"keys": {
|
||||
"yellowKey": 0,
|
||||
"blueKey": 0,
|
||||
"redKey": 0
|
||||
},
|
||||
"constants": {},
|
||||
"tools": {}
|
||||
},
|
||||
"flyRange": [], // 初始可飞的楼层;一般留空数组即可
|
||||
"loc": {"direction": "up", "x": 6, "y": 10}, // 勇士初始位置
|
||||
"flags": { // 游戏过程中的变量或flags
|
||||
"poison": false, // 毒
|
||||
"weak": false, // 衰
|
||||
"curse": false, // 咒
|
||||
}
|
||||
},
|
||||
"startText": [ // 游戏开始前剧情。如果无剧情直接留一个空数组即可。
|
||||
"Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!",
|
||||
"这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。",
|
||||
"赶快来试一试吧!"
|
||||
],
|
||||
"shops": { // 定义全局商店(即快捷商店)
|
||||
"moneyShop1": { // 商店唯一ID
|
||||
"name": "贪婪之神", // 商店名称(标题)
|
||||
"icon": "blueShop", // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店
|
||||
"textInList": "1F金币商店", // 在快捷商店栏中显示的名称
|
||||
"use": "money", // 商店所要使用的。只能是"money"或"experience"。
|
||||
"need": "20+10*times*(times+1)", // 商店需要的金币/经验数值;可以是一个表达式,以times作为参数计算。
|
||||
// 这里用到的times为该商店的已经的访问次数。首次访问该商店时times的值为0。
|
||||
// 上面的例子是50层商店的计算公式。你也可以写任意其他的计算公式,只要以times作为参数即可。
|
||||
// 例如: "need": "25" 就是恒定需要25金币的商店; "need": "20+2*times" 就是第一次访问要20金币,以后每次递增2金币的商店。
|
||||
// 如果是对于每个选项有不同的计算公式,写 "need": "-1" 即可。可参见下面的经验商店。
|
||||
"text": "勇敢的武士啊,给我${need}金币就可以:", // 显示的文字,需手动加换行符。可以使用${need}表示上面的need值。
|
||||
"choices": [ // 商店的选项
|
||||
{"text": "生命+800", "effect": "status:hp+=800"},
|
||||
// 如果有多个effect以分号分开,参见下面的经验商店
|
||||
{"text": "攻击+4", "effect": "status:atk+=4"},
|
||||
{"text": "防御+4", "effect": "status:def+=4"},
|
||||
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
||||
// effect只能对status和item进行操作,不能修改flag值。
|
||||
// 必须是X+=Y的形式,其中Y可以是一个表达式,以status:xxx或item:xxx为参数
|
||||
// 其他effect样例:
|
||||
// "item:yellowKey+=1" 黄钥匙+1
|
||||
// "item:pickaxe+=3" 破墙镐+3
|
||||
// "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍
|
||||
]
|
||||
},
|
||||
"expShop1": { // 商店唯一ID
|
||||
"name": "经验之神",
|
||||
"icon": "pinkShop",
|
||||
"textInList": "1F经验商店",
|
||||
"use": "experience", // 该商店使用的是经验进行计算
|
||||
"need": "-1", // 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值
|
||||
"text": "勇敢的武士啊,给我若干经验就可以:",
|
||||
"choices": [
|
||||
// 在choices中写need,可以针对每个选项都有不同的需求。
|
||||
// 这里的need同样可以以times作为参数,比如 "need": "100+20*times"
|
||||
{"text": "等级+1", "need": "100", "effect": "status:lv+=1;status:hp+=1000;status:atk+=7;status:def+=7"},
|
||||
// 多个effect直接以分号分开即可。如上面的意思是生命+1000,攻击+7,防御+7。
|
||||
{"text": "攻击+5", "need": "30", "effect": "status:atk+=5"},
|
||||
{"text": "防御+5", "need": "30", "effect": "status:def+=5"},
|
||||
]
|
||||
},
|
||||
},
|
||||
"levelUp": [ // 经验升级所需要的数值,是一个数组
|
||||
{}, // 第一项为初始等级,可以简单留空,也可以写name
|
||||
|
||||
// 每一个里面可以含有三个参数 need, name, effect
|
||||
// need为所需要的经验数值,是一个正整数。请确保need所需的依次递增
|
||||
// name为该等级的名称,也可以省略代表使用系统默认值;本项将显示在状态栏中
|
||||
// effect为本次升级所执行的操作,可由若干项组成,由分号分开
|
||||
// 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数
|
||||
{"need": 20, "name": "第二级", "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"}, // 先将生命提升攻防和的2倍;再将攻击+10,防御+10
|
||||
|
||||
// effect也允许写一个function,代表本次升级将会执行的操作
|
||||
{"need": 40, "effect": function () {
|
||||
core.drawText("恭喜升级!");
|
||||
core.status.hero.hp *= 2;
|
||||
core.status.hero.atk += 100;
|
||||
core.status.hero.def += 100;
|
||||
}},
|
||||
|
||||
// 依次往下写需要的数值即可
|
||||
]
|
||||
}
|
||||
// 各种数值;一些数值可以在这里设置
|
||||
this.values = {
|
||||
/****** 角色相关 ******/
|
||||
"HPMAX": 999999, // HP上限;-1则无上限
|
||||
"lavaDamage": 100, // 经过血网受到的伤害
|
||||
"poisonDamage": 10, // 中毒后每步受到的伤害
|
||||
"weakValue": 20, // 衰弱状态下攻防减少的数值
|
||||
/****** 道具相关 ******/
|
||||
"redJewel": 3, // 红宝石加攻击的数值
|
||||
"blueJewel": 3, // 蓝宝石加防御的数值
|
||||
"greenJewel": 5, // 绿宝石加魔防的数值
|
||||
"redPotion": 100, // 红血瓶加血数值
|
||||
"bluePotion": 250, // 蓝血瓶加血数值
|
||||
"yellowPotion": 500, // 黄血瓶加血数值
|
||||
"greenPotion": 800, // 绿血瓶加血数值
|
||||
"sword1": 10, // 铁剑加攻数值
|
||||
"shield1": 10, // 铁盾加防数值
|
||||
"sword2": 20, // 银剑加攻数值
|
||||
"shield2": 20, // 银盾加防数值
|
||||
"sword3": 40, // 骑士剑加攻数值
|
||||
"shield3": 40, // 骑士盾加防数值
|
||||
"sword4": 80, // 圣剑加攻数值
|
||||
"shield4": 80, // 圣盾加防数值
|
||||
"sword5": 160, // 神圣剑加攻数值
|
||||
"shield5": 160, // 神圣盾加防数值
|
||||
"moneyPocket": 500, // 金钱袋加金币的数值
|
||||
/****** 怪物相关 ******/
|
||||
'breakArmor': 0.9, // 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害)
|
||||
'counterAttack': 0.1, // 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御)
|
||||
'purify': 3, // 净化的比例(战斗前,怪物附加勇士魔防的x倍作为伤害)
|
||||
'hatred': 2, // 仇恨属性中,每杀死一个怪物获得的仇恨值
|
||||
/****** 系统相关 ******/
|
||||
'animateSpeed': 500, // 动画时间
|
||||
}
|
||||
// 系统FLAG,在游戏运行中中请不要修改它。
|
||||
this.flags = {
|
||||
/****** 状态栏相关 ******/
|
||||
"enableFloor": true, // 是否在状态栏显示当前楼层
|
||||
"enableLv": true, // 是否在状态栏显示当前等级
|
||||
"enableMDef": true, // 是否在状态栏及战斗界面显示魔防(护盾)
|
||||
"enableMoney": true, // 是否在状态栏、怪物手册及战斗界面显示金币
|
||||
"enableExperience": true, // 是否在状态栏、怪物手册及战斗界面显示经验
|
||||
"enableLevelUp": true, // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false
|
||||
"enableDebuff": true, // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff
|
||||
////// 上述的几个开关将直接影响状态栏的显示效果 //////
|
||||
/****** 道具相关 ******/
|
||||
"flyNearStair": true, // 是否需要在楼梯边使用传送器
|
||||
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁
|
||||
"bombFourDirections": true, // 使用炸弹是否四个方向都会炸;如果false则只炸面前的怪物(即和圣锤等价)
|
||||
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||
/****** 怪物相关 ******/
|
||||
"enableNegativeDamage": true, // 是否支持负伤害(回血)
|
||||
"zoneSquare": false, // 领域类型。如果此项为true则为九宫格伤害,为false则为十字伤害
|
||||
/****** 系统相关 ******/
|
||||
"startDirectly": false, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面
|
||||
"canOpenBattleAnimate": true, // 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false
|
||||
"showBattleAnimateConfirm": true, // 是否在游戏开始时提供“是否开启战斗动画”的选项
|
||||
"battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关
|
||||
"displayEnemyDamage": true, // 是否地图怪物显伤;用户可以手动在菜单栏中开关
|
||||
"displayExtraDamage": false, // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关
|
||||
"enableGentleClick": true, // 是否允许轻触(获得面前物品)
|
||||
"portalWithoutTrigger": true, // 经过楼梯、传送门时是否能“穿透”。穿透的意思是,自动寻路得到的的路径中间经过了楼梯,行走时是否触发楼层转换事件
|
||||
"potionWhileRouting": false, // 寻路算法是否经过血瓶;如果该项为false,则寻路算法会自动尽量绕过血瓶
|
||||
}
|
||||
this.firstData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData;
|
||||
this.values = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.values;
|
||||
this.flags = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags;
|
||||
delete(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d);
|
||||
}
|
||||
|
||||
data.prototype.getFirstData = function() {
|
||||
|
||||
@ -5,68 +5,8 @@ function enemys() {
|
||||
////// 初始化 //////
|
||||
enemys.prototype.init = function () {
|
||||
// 怪物属性初始化定义:
|
||||
this.enemys = {
|
||||
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': [1,5,7,8]},
|
||||
'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': [1,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, 'point': 1}, // 'point'可以在打败怪物后进行加点,详见文档说明。
|
||||
'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, 'zoneSquare': true}, // 领域怪需要加value表示领域伤害的数值;zoneSquare代表是否九宫格伤害
|
||||
'redWizard': {'name': '高级巫师', 'hp': 1000, 'atk': 1200, 'def': 0, 'money': 160, 'experience': 0, 'special': 15, 'value': 200, 'range': 2}, // range可选,代表领域伤害的范围;不加默认为1
|
||||
'yellowGuard': {'name': '初级卫兵', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, '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': 1000, 'atk': 500, 'def': 0, 'money': 1000, 'experience': 1000, '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': 100, 'atk': 100, 'def': 0, 'money': 0, 'experience': 0, 'special': 18, 'value': 20},
|
||||
'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, 'bomb': false}, // 吸血怪需要在后面添加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, 'n': 8}, // 多连击需要在后面指定n代表是几连击
|
||||
'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},
|
||||
'darkFairy': {'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},
|
||||
}
|
||||
this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
|
||||
delete(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80);
|
||||
}
|
||||
|
||||
////// 获得一个或所有怪物数据 //////
|
||||
|
||||
216
libs/icons.js
216
libs/icons.js
@ -3,220 +3,8 @@ function icons() {
|
||||
}
|
||||
|
||||
icons.prototype.init = function () {
|
||||
this.icons = {
|
||||
'hero': {
|
||||
'down': {'loc': 0, 'stop': 0, 'leftFoot': 1, 'rightFoot': 3},
|
||||
'left': {'loc': 1, 'stop': 0, 'leftFoot': 1, 'rightFoot': 3},
|
||||
'right': {'loc': 2, 'stop': 0, 'leftFoot': 1, 'rightFoot': 3},
|
||||
'up': {'loc': 3, 'stop': 0, 'leftFoot': 1, 'rightFoot': 3}
|
||||
},
|
||||
'terrains': {
|
||||
'ground': 0,
|
||||
'grass': 1,
|
||||
'grass2': 2,
|
||||
'snowGround': 3,
|
||||
'ground2': 4,
|
||||
'ground3': 5,
|
||||
'ground4': 6,
|
||||
'sand': 7,
|
||||
'ground5': 8,
|
||||
'yellowWall2': 9,
|
||||
'whiteWall2': 10,
|
||||
'blueWall2': 11,
|
||||
'blockWall': 12,
|
||||
'grayWall': 13,
|
||||
'white': 14,
|
||||
'ground6': 15,
|
||||
'soil': 16,
|
||||
'yellowWall': 17,
|
||||
'whiteWall': 18,
|
||||
'blueWall': 19,
|
||||
'star': 20,
|
||||
'lava': 21,
|
||||
'ice': 22,
|
||||
'downFloor': 23,
|
||||
'upFloor': 24,
|
||||
'yellowDoor': 25,
|
||||
'blueDoor': 26,
|
||||
'redDoor': 27,
|
||||
'greenDoor': 28,
|
||||
'specialDoor': 29,
|
||||
'steelDoor': 30,
|
||||
'blueShop-left': 31,
|
||||
'blueShop-right': 32,
|
||||
'pinkShop-left': 33,
|
||||
'pinkShop-right': 34,
|
||||
'arrowUp': 35,
|
||||
'arrowDown': 36,
|
||||
'arrowLeft': 37,
|
||||
'arrowRight': 38,
|
||||
'light': 39,
|
||||
'darkLight': 40
|
||||
},
|
||||
'animates': {
|
||||
'star': 0,
|
||||
'lava': 1,
|
||||
'waterWall': 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,
|
||||
'water': 31,
|
||||
},
|
||||
'npcs': {
|
||||
'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': 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,
|
||||
'darkFairy': 58,
|
||||
'greenKnight': 59,
|
||||
},
|
||||
'items': {
|
||||
'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
|
||||
},
|
||||
'autotile': { // 所有的Autotile列表;后面的index简单取0即可
|
||||
'autotile': 0,
|
||||
'autotile1': 0,
|
||||
'autotile2': 0,
|
||||
'autotile3': 0,
|
||||
}
|
||||
}
|
||||
this.icons = icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1;
|
||||
delete(icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1);
|
||||
}
|
||||
|
||||
icons.prototype.getIcons = function () {
|
||||
|
||||
111
libs/items.js
111
libs/items.js
@ -4,60 +4,10 @@ function items() {
|
||||
|
||||
////// 初始化 //////
|
||||
items.prototype.init = function () {
|
||||
this.items = {
|
||||
// 钥匙
|
||||
'yellowKey': {'cls': 'keys', 'name': '黄钥匙'},
|
||||
'blueKey': {'cls': 'keys', 'name': '蓝钥匙'},
|
||||
'redKey': {'cls': 'keys', 'name': '红钥匙'},
|
||||
|
||||
// 宝石、血瓶
|
||||
'redJewel': {'cls': 'items', 'name': '红宝石'},
|
||||
'blueJewel': {'cls': 'items', 'name': '蓝宝石'},
|
||||
'greenJewel': {'cls': 'items', 'name': '绿宝石'},
|
||||
'yellowJewel': {'cls': 'items', 'name': '黄宝石'},
|
||||
'redPotion': {'cls': 'items', 'name': '红血瓶'},
|
||||
'bluePotion': {'cls': 'items', 'name': '蓝血瓶'},
|
||||
'yellowPotion': {'cls': 'items', 'name': '黄血瓶'},
|
||||
'greenPotion': {'cls': 'items', 'name': '绿血瓶'},
|
||||
'sword1': {'cls': 'items', 'name': '铁剑'},
|
||||
'sword2': {'cls': 'items', 'name': '银剑'},
|
||||
'sword3': {'cls': 'items', 'name': '骑士剑'},
|
||||
'sword4': {'cls': 'items', 'name': '圣剑'},
|
||||
'sword5': {'cls': 'items', 'name': '神圣剑'},
|
||||
'shield1': {'cls': 'items', 'name': '铁盾'},
|
||||
'shield2': {'cls': 'items', 'name': '银盾'},
|
||||
'shield3': {'cls': 'items', 'name': '骑士盾'},
|
||||
'shield4': {'cls': 'items', 'name': '圣盾'},
|
||||
'shield5': {'cls': 'items', 'name': '神圣盾'},
|
||||
'superPotion': {'cls': 'items', 'name': '圣水'},
|
||||
'moneyPocket': {'cls': 'items', 'name': '金钱袋'},
|
||||
|
||||
// 物品
|
||||
'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': '持有后无视怪物的无敌属性'},
|
||||
'knife': {'cls': 'constants', 'name': '屠龙匕首', 'text': '该道具尚未被定义'},
|
||||
'shoes': {'cls': 'constants', 'name': '绿鞋', 'text': '持有时无视负面地形'},
|
||||
|
||||
// 道具
|
||||
'bigKey': {'cls': 'tools', 'name': '大黄门钥匙', 'text': '可以开启当前层所有黄门'},
|
||||
'greenKey': {'cls': 'tools', 'name': '绿钥匙', 'text': '可以打开一扇绿门'},
|
||||
'steelKey': {'cls': 'tools', 'name': '铁门钥匙', 'text': '可以打开一扇铁门'},
|
||||
'pickaxe': {'cls': 'tools', 'name': '破墙镐', 'text': '可以破坏勇士面前的墙'},
|
||||
'icePickaxe': {'cls': 'tools', 'name': '破冰镐', 'text': '可以破坏勇士面前的一堵冰墙'},
|
||||
'bomb': {'cls': 'tools', 'name': '炸弹', 'text': '可以炸掉勇士面前的怪物'},
|
||||
'centerFly': {'cls': 'tools', 'name': '中心对称飞行器', 'text': '可以飞向当前楼层中心对称的位置'},
|
||||
'upFly': {'cls': 'tools', 'name': '上楼器', 'text': '可以飞往楼上的相同位置'},
|
||||
'downFly': {'cls': 'tools', 'name': '下楼器', 'text': '可以飞往楼下的相同位置'},
|
||||
'earthquake': {'cls': 'tools', 'name': '地震卷轴', 'text': '可以破坏当前层的所有墙'},
|
||||
'poisonWine': {'cls': 'tools', 'name': '解毒药水', 'text': '可以解除中毒状态'},
|
||||
'weakWine': {'cls': 'tools', 'name': '解衰药水', 'text': '可以解除衰弱状态'},
|
||||
'curseWine': {'cls': 'tools', 'name': '解咒药水', 'text': '可以解除诅咒状态'},
|
||||
'superWine': {'cls': 'tools', 'name': '万能药水', 'text': '可以解除所有不良状态'},
|
||||
'hammer': {'cls': 'tools', 'name': '圣锤', 'text': '可以炸掉勇士面前的怪物'}
|
||||
}
|
||||
this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items;
|
||||
this.itemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect;
|
||||
this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;
|
||||
delete(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a);
|
||||
}
|
||||
|
||||
////// 获得所有道具 //////
|
||||
@ -80,36 +30,7 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
// 消耗品
|
||||
if (itemCls === 'items') {
|
||||
if (itemId === 'redJewel') core.status.hero.atk += core.values.redJewel;
|
||||
if (itemId === 'blueJewel') core.status.hero.def += core.values.blueJewel;
|
||||
if (itemId === 'greenJewel') core.status.hero.mdef += core.values.greenJewel;
|
||||
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 += core.values.redPotion;
|
||||
if (itemId === 'bluePotion') core.status.hero.hp += core.values.bluePotion;
|
||||
if (itemId === 'yellowPotion') core.status.hero.hp += core.values.yellowPotion;
|
||||
if (itemId === 'greenPotion') core.status.hero.hp += core.values.greenPotion;
|
||||
if (itemId === 'sword1') core.status.hero.atk += core.values.sword1;
|
||||
if (itemId === 'sword2') core.status.hero.atk += core.values.sword2;
|
||||
if (itemId == 'sword3') core.status.hero.atk += core.values.sword3;
|
||||
if (itemId == 'sword4') core.status.hero.atk += core.values.sword4;
|
||||
if (itemId === 'sword5') core.status.hero.atk += core.values.sword5;
|
||||
if (itemId === 'shield1') core.status.hero.def += core.values.shield1;
|
||||
if (itemId === 'shield2') core.status.hero.def += core.values.shield2;
|
||||
if (itemId === 'shield3') core.status.hero.def += core.values.shield3;
|
||||
if (itemId === 'shield4') core.status.hero.def += core.values.shield4;
|
||||
if (itemId === 'shield5') core.status.hero.def += core.values.shield5;
|
||||
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 += core.values.moneyPocket;
|
||||
if (itemId in this.itemEffect)eval(this.itemEffect[itemId]);
|
||||
}
|
||||
else {
|
||||
core.addItem(itemId, itemNum);
|
||||
@ -118,27 +39,7 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
|
||||
|
||||
////// “即捡即用类”道具的文字提示 //////
|
||||
items.prototype.getItemEffectTip = function(itemId) {
|
||||
if (itemId === 'redJewel') return ",攻击+"+core.values.redJewel;
|
||||
if (itemId === 'blueJewel') return ",防御+"+core.values.blueJewel;
|
||||
if (itemId === 'greenJewel') return ",魔防+"+core.values.greenJewel;
|
||||
if (itemId == 'yellowJewel') return ",全属性提升";
|
||||
if (itemId === 'redPotion') return ",生命+"+core.values.redPotion;
|
||||
if (itemId === 'bluePotion') return ",生命+"+core.values.bluePotion;
|
||||
if (itemId === 'yellowPotion') return ",生命+"+core.values.yellowPotion;
|
||||
if (itemId === 'greenPotion') return ",生命+"+core.values.greenPotion;
|
||||
if (itemId === 'sword1') return ",攻击+"+core.values.sword1;
|
||||
if (itemId === 'sword2') return ",攻击+"+core.values.sword2;
|
||||
if (itemId === 'sword3') return ",攻击+"+core.values.sword3;
|
||||
if (itemId === 'sword4') return ",攻击+"+core.values.sword4;
|
||||
if (itemId === 'sword5') return ",攻击+"+core.values.sword5;
|
||||
if (itemId === 'shield1') return ",防御+"+core.values.shield1;
|
||||
if (itemId === 'shield2') return ",防御+"+core.values.shield2;
|
||||
if (itemId === 'shield3') return ",防御+"+core.values.shield3;
|
||||
if (itemId === 'shield4') return ",防御+"+core.values.shield4;
|
||||
if (itemId === 'shield5') return ",防御+"+core.values.shield5;
|
||||
if (itemId === 'bigKey') return ",全钥匙+1";
|
||||
if (itemId === 'superPotion') return ",生命值翻倍";
|
||||
if (itemId == 'moneyPocket') return ",金币+"+core.values.moneyPocket;
|
||||
if (itemId in this.itemEffectTip)return eval(this.itemEffectTip[itemId]);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
256
libs/maps.js
256
libs/maps.js
@ -1,5 +1,8 @@
|
||||
function maps() {}
|
||||
maps.prototype.init = function() {}
|
||||
maps.prototype.init = function() {
|
||||
this.blocksInfo = maps_90f36752_8815_4be8_b32b_d7fad1d0542e;
|
||||
delete(maps_90f36752_8815_4be8_b32b_d7fad1d0542e);
|
||||
}
|
||||
|
||||
////// 加载某个楼层(从剧本或存档中) //////
|
||||
maps.prototype.loadFloor = function (floorId, map) {
|
||||
@ -10,38 +13,46 @@ maps.prototype.loadFloor = function (floorId, map) {
|
||||
content['title'] = floor.title;
|
||||
content['canFlyTo'] = floor.canFlyTo;
|
||||
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]);
|
||||
if (core.isset(block.event)) {
|
||||
if (block.event.cls == 'enemys' && block.event.trigger==undefined) {
|
||||
block.event.trigger = 'battle';
|
||||
}
|
||||
if (block.event.cls == 'items' && block.event.trigger==undefined) {
|
||||
block.event.trigger = 'getItem';
|
||||
}
|
||||
if (block.event.noPass == undefined) {
|
||||
if (block.event.cls=='enemys' || block.event.cls=='terrains' || block.event.cls=='npcs') {
|
||||
block.event.noPass = true;
|
||||
}
|
||||
}
|
||||
if (block.event.animate == undefined) {
|
||||
if (block.event.cls=='enemys' || block.event.cls=='npcs') {
|
||||
block.event.animate = 2;
|
||||
}
|
||||
if (block.event.cls == 'animates') {
|
||||
block.event.animate = 4;
|
||||
var mapIntoBlocks = function(map,maps,floor){
|
||||
var blocks = [];
|
||||
for (var i = 0; i < 13; i++) {
|
||||
for (var j = 0; j < 13; j++) {
|
||||
var block = maps.getBlock(j, i, map[i][j]);
|
||||
if (core.isset(block.event)) {
|
||||
if (block.event.cls == 'enemys' && block.event.trigger==undefined) {
|
||||
block.event.trigger = 'battle';
|
||||
}
|
||||
if (block.event.cls == 'items' && block.event.trigger==undefined) {
|
||||
block.event.trigger = 'getItem';
|
||||
}
|
||||
if (block.event.noPass == undefined) {
|
||||
if (block.event.cls=='enemys' || block.event.cls=='terrains' || block.event.cls=='npcs') {
|
||||
block.event.noPass = true;
|
||||
}
|
||||
}
|
||||
if (block.event.animate == undefined) {
|
||||
if (block.event.cls=='enemys' || block.event.cls=='npcs') {
|
||||
block.event.animate = 2;
|
||||
}
|
||||
if (block.event.cls == 'animates') {
|
||||
block.event.animate = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
maps.addEvent(block,j,i,floor.events[j+","+i]);
|
||||
maps.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
||||
if (core.isset(block.event)) blocks.push(block);
|
||||
}
|
||||
this.addEvent(block,j,i,floor.events[j+","+i])
|
||||
this.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
||||
if (core.isset(block.event)) blocks.push(block);
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
if (main.mode=='editor'){
|
||||
main.editor.mapIntoBlocks = function(map,floor){
|
||||
return mapIntoBlocks(map,core.maps,floor);
|
||||
}
|
||||
}
|
||||
// 事件处理
|
||||
content['blocks'] = blocks;
|
||||
content['blocks'] = mapIntoBlocks(map,this,floor);
|
||||
return content;
|
||||
}
|
||||
|
||||
@ -63,196 +74,7 @@ maps.prototype.getBlock = function (x, y, id) {
|
||||
var tmp = {'x': x, 'y': y, 'id': id};
|
||||
if (enable!=null) tmp.enable = enable;
|
||||
|
||||
////////////////////////// 地形部分 //////////////////////////
|
||||
|
||||
// 0-20 地形
|
||||
if (id == 1) tmp.event = {'cls': 'terrains', 'id': 'yellowWall'}; // 黄墙
|
||||
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'}; // 咒网
|
||||
if (id == 15) tmp.event = {'cls': 'animates', 'id': 'water', 'noPass': true}; // 水
|
||||
// 在这里添加更多地形
|
||||
// 如果空位不足,可以从180以后开始继续放,只要不和现有的数字冲突即可
|
||||
|
||||
// Autotile
|
||||
if (id == 20) tmp.event = {'cls': 'autotile', 'id': 'autotile', 'noPass': true}; // autotile
|
||||
// 更多的autotile从151到160等,只要不和现有的数字冲突即可
|
||||
if (id == 151) tmp.event = {'cls': 'autotile', 'id': 'autotile1', 'noPass': true};
|
||||
if (id == 152) tmp.event = {'cls': 'autotile', 'id': 'autotile2', 'noPass': true};
|
||||
if (id == 153) tmp.event = {'cls': 'autotile', 'id': 'autotile3', 'noPass': true};
|
||||
|
||||
////////////////////////// 物品部分 //////////////////////////
|
||||
|
||||
// 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) 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}; // 右箭头
|
||||
|
||||
|
||||
////////////////////////// NPC部分 //////////////////////////
|
||||
|
||||
// 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'};
|
||||
|
||||
////////////////////////// 其他部分 //////////////////////////
|
||||
|
||||
// 161-200 其他(单向箭头、灯、箱子等等)
|
||||
if (id == 161) tmp.event = {'cls': 'terrains', 'id': 'arrowUp', 'noPass': false}; // 单向上箭头
|
||||
if (id == 162) tmp.event = {'cls': 'terrains', 'id': 'arrowDown', 'noPass': false}; // 单向下箭头
|
||||
if (id == 163) tmp.event = {'cls': 'terrains', 'id': 'arrowLeft', 'noPass': false}; // 单向左箭头
|
||||
if (id == 164) tmp.event = {'cls': 'terrains', 'id': 'arrowRight', 'noPass': false}; // 单向右箭头
|
||||
if (id == 165) tmp.event = {'cls': 'terrains', 'id': 'light', 'trigger': 'changeLight', 'noPass': false}; // 灯
|
||||
if (id == 166) tmp.event = {'cls': 'terrains', 'id': 'darkLight', 'noPass': true}; // 暗灯
|
||||
|
||||
|
||||
////////////////////////// 怪物部分 //////////////////////////
|
||||
|
||||
// 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': 'darkFairy'};
|
||||
if (id == 260) tmp.event = {'cls': 'enemys', 'id': 'greenKnight'};
|
||||
|
||||
////////////////////////// 待定... //////////////////////////
|
||||
// 目前ID暂时不要超过400
|
||||
if (id in this.blocksInfo) tmp.event = JSON.parse(JSON.stringify(this.blocksInfo[id]));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
190
libs/project/data.js
Normal file
190
libs/project/data.js
Normal file
@ -0,0 +1,190 @@
|
||||
data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
{
|
||||
"main" : {
|
||||
"useCompress" : false, // 是否使用压缩文件
|
||||
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
||||
// 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。
|
||||
// 如果要进行剧本的修改请务必将其改成false。
|
||||
|
||||
"floorIds" : [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序
|
||||
"sample0", "sample1", "sample2"
|
||||
],
|
||||
"pngs" : [ // 在此存放所有可能的背景图片;背景图片最好是416*416像素,其他分辨率会被强制缩放成416*416
|
||||
// 建议对于较大的图片,在网上使用在线的“图片压缩工具”来进行压缩,以节省流量
|
||||
// 有关使用自定义背景图,请参见文档的“自定义素材”说明
|
||||
"bg.png", "yewai.png", // 依次向后添加
|
||||
],
|
||||
"bgms" : [ // 在此存放所有的bgm,和文件名一致。第一项为默认播放项
|
||||
// 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好
|
||||
'058-Slow01.mid', 'bgm.mp3', 'qianjin.mid', 'star.mid',
|
||||
],
|
||||
"sounds" : [ // 在此存放所有的SE,和文件名一致
|
||||
// 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好
|
||||
'floor.mp3', 'attack.ogg', 'door.ogg', 'item.ogg',
|
||||
],
|
||||
},
|
||||
"firstData" : {
|
||||
"title": "魔塔样板", // 游戏名,将显示在标题页面以及切换楼层的界面中
|
||||
"name": "template", // 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。
|
||||
"version": "Ver 1.0.0 (Beta)", // 当前游戏版本;版本不一致的存档不能通用。
|
||||
"floorId": "sample0", // 初始楼层ID
|
||||
"hero": { // 勇士初始数据
|
||||
"name": "阳光", // 勇士名;可以改成喜欢的
|
||||
'lv': 1, // 初始等级,该项必须为正整数
|
||||
"hp": 1000, // 初始生命值
|
||||
"atk": 100, // 初始攻击
|
||||
"def": 100, // 初始防御
|
||||
"mdef": 100, // 初始魔防
|
||||
"money": 100, // 初始金币
|
||||
"experience": 0, // 初始经验
|
||||
"items": { // 初始道具个数
|
||||
"keys": {
|
||||
"yellowKey": 0,
|
||||
"blueKey": 0,
|
||||
"redKey": 0
|
||||
},
|
||||
"constants": {},
|
||||
"tools": {}
|
||||
},
|
||||
"flyRange": [], // 初始可飞的楼层;一般留空数组即可
|
||||
"loc": {"direction": "up", "x": 6, "y": 10}, // 勇士初始位置
|
||||
"flags": { // 游戏过程中的变量或flags
|
||||
"poison": false, // 毒
|
||||
"weak": false, // 衰
|
||||
"curse": false, // 咒
|
||||
}
|
||||
},
|
||||
"startText": [ // 游戏开始前剧情。如果无剧情直接留一个空数组即可。
|
||||
"Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!",
|
||||
"这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。",
|
||||
"赶快来试一试吧!"
|
||||
],
|
||||
"shops": { // 定义全局商店(即快捷商店)
|
||||
"moneyShop1": { // 商店唯一ID
|
||||
"name": "贪婪之神", // 商店名称(标题)
|
||||
"icon": "blueShop", // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店
|
||||
"textInList": "1F金币商店", // 在快捷商店栏中显示的名称
|
||||
"use": "money", // 商店所要使用的。只能是"money"或"experience"。
|
||||
"need": "20+10*times*(times+1)", // 商店需要的金币/经验数值;可以是一个表达式,以times作为参数计算。
|
||||
// 这里用到的times为该商店的已经的访问次数。首次访问该商店时times的值为0。
|
||||
// 上面的例子是50层商店的计算公式。你也可以写任意其他的计算公式,只要以times作为参数即可。
|
||||
// 例如: "need": "25" 就是恒定需要25金币的商店; "need": "20+2*times" 就是第一次访问要20金币,以后每次递增2金币的商店。
|
||||
// 如果是对于每个选项有不同的计算公式,写 "need": "-1" 即可。可参见下面的经验商店。
|
||||
"text": "勇敢的武士啊,给我${need}金币就可以:", // 显示的文字,需手动加换行符。可以使用${need}表示上面的need值。
|
||||
"choices": [ // 商店的选项
|
||||
{"text": "生命+800", "effect": "status:hp+=800"},
|
||||
// 如果有多个effect以分号分开,参见下面的经验商店
|
||||
{"text": "攻击+4", "effect": "status:atk+=4"},
|
||||
{"text": "防御+4", "effect": "status:def+=4"},
|
||||
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
||||
// effect只能对status和item进行操作,不能修改flag值。
|
||||
// 必须是X+=Y的形式,其中Y可以是一个表达式,以status:xxx或item:xxx为参数
|
||||
// 其他effect样例:
|
||||
// "item:yellowKey+=1" 黄钥匙+1
|
||||
// "item:pickaxe+=3" 破墙镐+3
|
||||
// "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍
|
||||
]
|
||||
},
|
||||
"expShop1": { // 商店唯一ID
|
||||
"name": "经验之神",
|
||||
"icon": "pinkShop",
|
||||
"textInList": "1F经验商店",
|
||||
"use": "experience", // 该商店使用的是经验进行计算
|
||||
"need": "-1", // 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值
|
||||
"text": "勇敢的武士啊,给我若干经验就可以:",
|
||||
"choices": [
|
||||
// 在choices中写need,可以针对每个选项都有不同的需求。
|
||||
// 这里的need同样可以以times作为参数,比如 "need": "100+20*times"
|
||||
{"text": "等级+1", "need": "100", "effect": "status:lv+=1;status:hp+=1000;status:atk+=7;status:def+=7"},
|
||||
// 多个effect直接以分号分开即可。如上面的意思是生命+1000,攻击+7,防御+7。
|
||||
{"text": "攻击+5", "need": "30", "effect": "status:atk+=5"},
|
||||
{"text": "防御+5", "need": "30", "effect": "status:def+=5"},
|
||||
]
|
||||
},
|
||||
},
|
||||
"levelUp": [ // 经验升级所需要的数值,是一个数组
|
||||
{}, // 第一项为初始等级,可以简单留空,也可以写name
|
||||
|
||||
// 每一个里面可以含有三个参数 need, name, effect
|
||||
// need为所需要的经验数值,是一个正整数。请确保need所需的依次递增
|
||||
// name为该等级的名称,也可以省略代表使用系统默认值;本项将显示在状态栏中
|
||||
// effect为本次升级所执行的操作,可由若干项组成,由分号分开
|
||||
// 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数
|
||||
{"need": 20, "name": "第二级", "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"}, // 先将生命提升攻防和的2倍;再将攻击+10,防御+10
|
||||
|
||||
// effect也允许写一个function,代表本次升级将会执行的操作
|
||||
{"need": 40, "effect": function () {
|
||||
core.drawText("恭喜升级!");
|
||||
core.status.hero.hp *= 2;
|
||||
core.status.hero.atk += 100;
|
||||
core.status.hero.def += 100;
|
||||
}},
|
||||
|
||||
// 依次往下写需要的数值即可
|
||||
]
|
||||
},
|
||||
// 各种数值;一些数值可以在这里设置
|
||||
"values" : {
|
||||
/****** 角色相关 ******/
|
||||
"HPMAX": 999999, // HP上限;-1则无上限
|
||||
"lavaDamage": 100, // 经过血网受到的伤害
|
||||
"poisonDamage": 10, // 中毒后每步受到的伤害
|
||||
"weakValue": 20, // 衰弱状态下攻防减少的数值
|
||||
/****** 道具相关 ******/
|
||||
"redJewel": 3, // 红宝石加攻击的数值
|
||||
"blueJewel": 3, // 蓝宝石加防御的数值
|
||||
"greenJewel": 5, // 绿宝石加魔防的数值
|
||||
"redPotion": 100, // 红血瓶加血数值
|
||||
"bluePotion": 250, // 蓝血瓶加血数值
|
||||
"yellowPotion": 500, // 黄血瓶加血数值
|
||||
"greenPotion": 800, // 绿血瓶加血数值
|
||||
"sword1": 10, // 铁剑加攻数值
|
||||
"shield1": 10, // 铁盾加防数值
|
||||
"sword2": 20, // 银剑加攻数值
|
||||
"shield2": 20, // 银盾加防数值
|
||||
"sword3": 40, // 骑士剑加攻数值
|
||||
"shield3": 40, // 骑士盾加防数值
|
||||
"sword4": 80, // 圣剑加攻数值
|
||||
"shield4": 80, // 圣盾加防数值
|
||||
"sword5": 160, // 神圣剑加攻数值
|
||||
"shield5": 160, // 神圣盾加防数值
|
||||
"moneyPocket": 500, // 金钱袋加金币的数值
|
||||
/****** 怪物相关 ******/
|
||||
'breakArmor': 0.9, // 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害)
|
||||
'counterAttack': 0.1, // 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御)
|
||||
'purify': 3, // 净化的比例(战斗前,怪物附加勇士魔防的x倍作为伤害)
|
||||
'hatred': 2, // 仇恨属性中,每杀死一个怪物获得的仇恨值
|
||||
/****** 系统相关 ******/
|
||||
'animateSpeed': 500, // 动画时间
|
||||
},
|
||||
// 系统FLAG,在游戏运行中中请不要修改它。
|
||||
"flags" : {
|
||||
/****** 状态栏相关 ******/
|
||||
"enableFloor": true, // 是否在状态栏显示当前楼层
|
||||
"enableLv": true, // 是否在状态栏显示当前等级
|
||||
"enableMDef": true, // 是否在状态栏及战斗界面显示魔防(护盾)
|
||||
"enableMoney": true, // 是否在状态栏、怪物手册及战斗界面显示金币
|
||||
"enableExperience": true, // 是否在状态栏、怪物手册及战斗界面显示经验
|
||||
"enableLevelUp": true, // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false
|
||||
"enableDebuff": true, // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff
|
||||
////// 上述的几个开关将直接影响状态栏的显示效果 //////
|
||||
/****** 道具相关 ******/
|
||||
"flyNearStair": true, // 是否需要在楼梯边使用传送器
|
||||
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁
|
||||
"bombFourDirections": true, // 使用炸弹是否四个方向都会炸;如果false则只炸面前的怪物(即和圣锤等价)
|
||||
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||
/****** 怪物相关 ******/
|
||||
"enableNegativeDamage": true, // 是否支持负伤害(回血)
|
||||
"zoneSquare": false, // 领域类型。如果此项为true则为九宫格伤害,为false则为十字伤害
|
||||
/****** 系统相关 ******/
|
||||
"startDirectly": false, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面
|
||||
"canOpenBattleAnimate": true, // 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false
|
||||
"showBattleAnimateConfirm": true, // 是否在游戏开始时提供“是否开启战斗动画”的选项
|
||||
"battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关
|
||||
"displayEnemyDamage": true, // 是否地图怪物显伤;用户可以手动在菜单栏中开关
|
||||
"displayExtraDamage": false, // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关
|
||||
"enableGentleClick": true, // 是否允许轻触(获得面前物品)
|
||||
"portalWithoutTrigger": true, // 经过楼梯、传送门时是否能“穿透”。穿透的意思是,自动寻路得到的的路径中间经过了楼梯,行走时是否触发楼层转换事件
|
||||
"potionWhileRouting": false, // 寻路算法是否经过血瓶;如果该项为false,则寻路算法会自动尽量绕过血瓶
|
||||
}
|
||||
}
|
||||
63
libs/project/enemys.js
Normal file
63
libs/project/enemys.js
Normal file
@ -0,0 +1,63 @@
|
||||
enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = //1:先攻,2:魔攻,3:坚固,4:2连击,5:3连击,6:4连击,7:破甲,8:反击,9:净化,10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,15:领域,16:夹击,17:仇恨
|
||||
{
|
||||
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': [1,5,7,8]},
|
||||
'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': [1,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, 'point': 1}, // 'point'可以在打败怪物后进行加点,详见文档说明。
|
||||
'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, 'zoneSquare': true}, // 领域怪需要加value表示领域伤害的数值;zoneSquare代表是否九宫格伤害
|
||||
'redWizard': {'name': '高级巫师', 'hp': 1000, 'atk': 1200, 'def': 0, 'money': 160, 'experience': 0, 'special': 15, 'value': 200, 'range': 2}, // range可选,代表领域伤害的范围;不加默认为1
|
||||
'yellowGuard': {'name': '初级卫兵', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, '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': 1000, 'atk': 500, 'def': 0, 'money': 1000, 'experience': 1000, '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': 100, 'atk': 100, 'def': 0, 'money': 0, 'experience': 0, 'special': 18, 'value': 20},
|
||||
'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, 'bomb': false}, // 吸血怪需要在后面添加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, 'n': 8}, // 多连击需要在后面指定n代表是几连击
|
||||
'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},
|
||||
'darkFairy': {'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},
|
||||
}
|
||||
@ -44,7 +44,7 @@ main.floors.sample0 = {
|
||||
"10,11": [ // 守着门的老人
|
||||
"\t[老人,woman]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。",
|
||||
"\t[老人,woman]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
|
||||
{'type': 'hide', "time": 500}
|
||||
{"type": "hide", "time": 500}
|
||||
],
|
||||
"2,10": [ // 守着楼梯、传送门、路障的老人
|
||||
"\t[老人,womanMagician]这些是路障、楼梯、传送门。",
|
||||
@ -65,9 +65,9 @@ main.floors.sample1 = {
|
||||
{"type": "hide", "loc": [1,8]},
|
||||
{"type": "hide", "loc": [1,5], "time": 500}, // 隐藏红衣魔王,动画500ms
|
||||
{"type": "hide"}, // 隐藏本事件
|
||||
{"type": "setFg", "color": [0,0,0], 'time': 1250}, // 渐变为白色
|
||||
{"type": "setFg", "color": [0,0,0], "time": 1250}, // 渐变为白色
|
||||
{"type": "sleep", "time": 700},
|
||||
{"type": "changeFloor", "floorId": "sample1", "loc": [1,11], 'direction': 'right', 'time': 1000}, // 楼层切换。changeFloor必须指定floorId和loc。
|
||||
{"type": "changeFloor", "floorId": "sample1", "loc": [1,11], "direction": "right", "time": 1000}, // 楼层切换。changeFloor必须指定floorId和loc。
|
||||
// 备注:这里也可以下面的这种写法:
|
||||
// {"type": "changePos", "loc": [1,11]}
|
||||
// 使用这种写法将不会有“楼层切换动画”,而是直接让勇士到达本层的loc位置。
|
||||
45
libs/project/floors/test.js
Normal file
45
libs/project/floors/test.js
Normal file
@ -0,0 +1,45 @@
|
||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||
main.floors.test = {
|
||||
"floorId": "test", // 楼层唯一标识符,需要和名字完全一致
|
||||
"title": "test", // 楼层中文名
|
||||
"name": "", // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "ground", // 默认地面的图块ID(terrains中)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201, 45,201,201,201,201,201,201],
|
||||
[201,201,201,201,201,201, 0,201,201,201,201,201,201]
|
||||
],
|
||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||
|
||||
],
|
||||
"events": { // 该楼的所有可能事件列表
|
||||
|
||||
},
|
||||
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
||||
|
||||
},
|
||||
"afterBattle": { // 战斗后可能触发的事件列表
|
||||
|
||||
},
|
||||
"afterGetItem": { // 获得道具后可能触发的事件列表
|
||||
|
||||
},
|
||||
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
215
libs/project/icons.js
Normal file
215
libs/project/icons.js
Normal file
@ -0,0 +1,215 @@
|
||||
icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
|
||||
{
|
||||
"hero": {
|
||||
"down": {"loc": 0, "stop": 0, "leftFoot": 1, "rightFoot": 3},
|
||||
"left": {"loc": 1, "stop": 0, "leftFoot": 1, "rightFoot": 3},
|
||||
"right": {"loc": 2, "stop": 0, "leftFoot": 1, "rightFoot": 3},
|
||||
"up": {"loc": 3, "stop": 0, "leftFoot": 1, "rightFoot": 3}
|
||||
},
|
||||
"terrains": {
|
||||
"ground": 0,
|
||||
"grass": 1,
|
||||
"grass2": 2,
|
||||
"snowGround": 3,
|
||||
"ground2": 4,
|
||||
"ground3": 5,
|
||||
"ground4": 6,
|
||||
"sand": 7,
|
||||
"ground5": 8,
|
||||
"yellowWall2": 9,
|
||||
"whiteWall2": 10,
|
||||
"blueWall2": 11,
|
||||
"blockWall": 12,
|
||||
"grayWall": 13,
|
||||
"white": 14,
|
||||
"ground6": 15,
|
||||
"soil": 16,
|
||||
"yellowWall": 17,
|
||||
"whiteWall": 18,
|
||||
"blueWall": 19,
|
||||
"star": 20,
|
||||
"lava": 21,
|
||||
"ice": 22,
|
||||
"downFloor": 23,
|
||||
"upFloor": 24,
|
||||
"yellowDoor": 25,
|
||||
"blueDoor": 26,
|
||||
"redDoor": 27,
|
||||
"greenDoor": 28,
|
||||
"specialDoor": 29,
|
||||
"steelDoor": 30,
|
||||
"blueShop-left": 31,
|
||||
"blueShop-right": 32,
|
||||
"pinkShop-left": 33,
|
||||
"pinkShop-right": 34,
|
||||
"arrowUp": 35,
|
||||
"arrowDown": 36,
|
||||
"arrowLeft": 37,
|
||||
"arrowRight": 38,
|
||||
"light": 39,
|
||||
"darkLight": 40
|
||||
},
|
||||
"animates": {
|
||||
"star": 0,
|
||||
"lava": 1,
|
||||
"waterWall": 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,
|
||||
"water": 31,
|
||||
},
|
||||
"npcs": {
|
||||
"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": 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,
|
||||
"darkFairy": 58,
|
||||
"greenKnight": 59,
|
||||
},
|
||||
"items": {
|
||||
"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
|
||||
},
|
||||
"autotile": { // 所有的Autotile列表;后面的index简单取0即可
|
||||
"autotile": 0,
|
||||
"autotile1": 0,
|
||||
"autotile2": 0,
|
||||
"autotile3": 0,
|
||||
}
|
||||
}
|
||||
113
libs/project/items.js
Normal file
113
libs/project/items.js
Normal file
@ -0,0 +1,113 @@
|
||||
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
{
|
||||
|
||||
"items" : {
|
||||
// 钥匙
|
||||
'yellowKey': {'cls': 'keys', 'name': '黄钥匙'},
|
||||
'blueKey': {'cls': 'keys', 'name': '蓝钥匙'},
|
||||
'redKey': {'cls': 'keys', 'name': '红钥匙'},
|
||||
|
||||
// 宝石、血瓶
|
||||
'redJewel': {'cls': 'items', 'name': '红宝石'},
|
||||
'blueJewel': {'cls': 'items', 'name': '蓝宝石'},
|
||||
'greenJewel': {'cls': 'items', 'name': '绿宝石'},
|
||||
'yellowJewel': {'cls': 'items', 'name': '黄宝石'},
|
||||
'redPotion': {'cls': 'items', 'name': '红血瓶'},
|
||||
'bluePotion': {'cls': 'items', 'name': '蓝血瓶'},
|
||||
'yellowPotion': {'cls': 'items', 'name': '黄血瓶'},
|
||||
'greenPotion': {'cls': 'items', 'name': '绿血瓶'},
|
||||
'sword1': {'cls': 'items', 'name': '铁剑'},
|
||||
'sword2': {'cls': 'items', 'name': '银剑'},
|
||||
'sword3': {'cls': 'items', 'name': '骑士剑'},
|
||||
'sword4': {'cls': 'items', 'name': '圣剑'},
|
||||
'sword5': {'cls': 'items', 'name': '神圣剑'},
|
||||
'shield1': {'cls': 'items', 'name': '铁盾'},
|
||||
'shield2': {'cls': 'items', 'name': '银盾'},
|
||||
'shield3': {'cls': 'items', 'name': '骑士盾'},
|
||||
'shield4': {'cls': 'items', 'name': '圣盾'},
|
||||
'shield5': {'cls': 'items', 'name': '神圣盾'},
|
||||
'superPotion': {'cls': 'items', 'name': '圣水'},
|
||||
'moneyPocket': {'cls': 'items', 'name': '金钱袋'},
|
||||
|
||||
// 物品
|
||||
'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': '持有后无视怪物的无敌属性'},
|
||||
'knife': {'cls': 'constants', 'name': '屠龙匕首', 'text': '该道具尚未被定义'},
|
||||
'shoes': {'cls': 'constants', 'name': '绿鞋', 'text': '持有时无视负面地形'},
|
||||
|
||||
// 道具
|
||||
'bigKey': {'cls': 'tools', 'name': '大黄门钥匙', 'text': '可以开启当前层所有黄门'},
|
||||
'greenKey': {'cls': 'tools', 'name': '绿钥匙', 'text': '可以打开一扇绿门'},
|
||||
'steelKey': {'cls': 'tools', 'name': '铁门钥匙', 'text': '可以打开一扇铁门'},
|
||||
'pickaxe': {'cls': 'tools', 'name': '破墙镐', 'text': '可以破坏勇士面前的墙'},
|
||||
'icePickaxe': {'cls': 'tools', 'name': '破冰镐', 'text': '可以破坏勇士面前的一堵冰墙'},
|
||||
'bomb': {'cls': 'tools', 'name': '炸弹', 'text': '可以炸掉勇士面前的怪物'},
|
||||
'centerFly': {'cls': 'tools', 'name': '中心对称飞行器', 'text': '可以飞向当前楼层中心对称的位置'},
|
||||
'upFly': {'cls': 'tools', 'name': '上楼器', 'text': '可以飞往楼上的相同位置'},
|
||||
'downFly': {'cls': 'tools', 'name': '下楼器', 'text': '可以飞往楼下的相同位置'},
|
||||
'earthquake': {'cls': 'tools', 'name': '地震卷轴', 'text': '可以破坏当前层的所有墙'},
|
||||
'poisonWine': {'cls': 'tools', 'name': '解毒药水', 'text': '可以解除中毒状态'},
|
||||
'weakWine': {'cls': 'tools', 'name': '解衰药水', 'text': '可以解除衰弱状态'},
|
||||
'curseWine': {'cls': 'tools', 'name': '解咒药水', 'text': '可以解除诅咒状态'},
|
||||
'superWine': {'cls': 'tools', 'name': '万能药水', 'text': '可以解除所有不良状态'},
|
||||
'hammer': {'cls': 'tools', 'name': '圣锤', 'text': '可以炸掉勇士面前的怪物'}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
"itemEffect" : {
|
||||
"redJewel":"core.status.hero.atk += core.values.redJewel",
|
||||
"blueJewel":"core.status.hero.def += core.values.blueJewel",
|
||||
"greenJewel":"core.status.hero.mdef += core.values.greenJewel",
|
||||
// 黄宝石属性:需自己定义
|
||||
"yellowJewel":"core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
|
||||
"redPotion":"core.status.hero.hp += core.values.redPotion",
|
||||
"bluePotion":"core.status.hero.hp += core.values.bluePotion",
|
||||
"yellowPotion":"core.status.hero.hp += core.values.yellowPotion",
|
||||
"greenPotion":"core.status.hero.hp += core.values.greenPotion",
|
||||
"sword1":"core.status.hero.atk += core.values.sword1",
|
||||
"sword2":"core.status.hero.atk += core.values.sword2",
|
||||
"sword3":"core.status.hero.atk += core.values.sword3",
|
||||
"sword4":"core.status.hero.atk += core.values.sword4",
|
||||
"sword5":"core.status.hero.atk += core.values.sword5",
|
||||
"shield1":"core.status.hero.def += core.values.shield1",
|
||||
"shield2":"core.status.hero.def += core.values.shield2",
|
||||
"shield3":"core.status.hero.def += core.values.shield3",
|
||||
"shield4":"core.status.hero.def += core.values.shield4",
|
||||
"shield5":"core.status.hero.def += core.values.shield5",
|
||||
// 只有是钥匙盒才会执行这一步
|
||||
"bigKey":"core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
|
||||
"superPotion":"core.status.hero.hp *= 2",
|
||||
"moneyPocket":"core.status.hero.money += core.values.moneyPocket",
|
||||
},
|
||||
|
||||
|
||||
"itemEffectTip" : {
|
||||
"redJewel":"',攻击+'+core.values.redJewel",
|
||||
"blueJewel":"',防御+'+core.values.blueJewel",
|
||||
"greenJewel":"',魔防+'+core.values.greenJewel",
|
||||
"yellowJewel":"',全属性提升'",
|
||||
"redPotion":"',生命+'+core.values.redPotion",
|
||||
"bluePotion":"',生命+'+core.values.bluePotion",
|
||||
"yellowPotion":"',生命+'+core.values.yellowPotion",
|
||||
"greenPotion":"',生命+'+core.values.greenPotion",
|
||||
"sword1":"',攻击+'+core.values.sword1",
|
||||
"sword2":"',攻击+'+core.values.sword2",
|
||||
"sword3":"',攻击+'+core.values.sword3",
|
||||
"sword4":"',攻击+'+core.values.sword4",
|
||||
"sword5":"',攻击+'+core.values.sword5",
|
||||
"shield1":"',防御+'+core.values.shield1",
|
||||
"shield2":"',防御+'+core.values.shield2",
|
||||
"shield3":"',防御+'+core.values.shield3",
|
||||
"shield4":"',防御+'+core.values.shield4",
|
||||
"shield5":"',防御+'+core.values.shield5",
|
||||
"bigKey":"',全钥匙+1'",
|
||||
"superPotion":"',生命值翻倍'",
|
||||
"moneyPocket":"',金币+'+core.values.moneyPocket",
|
||||
}
|
||||
|
||||
}
|
||||
193
libs/project/maps.js
Normal file
193
libs/project/maps.js
Normal file
@ -0,0 +1,193 @@
|
||||
maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
{
|
||||
////////////////////////// 地形部分 //////////////////////////
|
||||
|
||||
// 0-20 地形
|
||||
'1':{'cls': 'terrains', 'id': 'yellowWall'}, // 黄墙
|
||||
'2':{'cls': 'terrains', 'id': 'whiteWall'}, // 白墙
|
||||
'3':{'cls': 'terrains', 'id': 'blueWall'}, // 白墙
|
||||
'4':{'cls': 'animates', 'id': 'star', 'noPass': true}, // 星空
|
||||
'5':{'cls': 'animates', 'id': 'lava', 'noPass': true}, // 岩浆
|
||||
'6':{'cls': 'terrains', 'id': 'ice'}, // 岩浆
|
||||
'7':{'cls': 'terrains', 'id': 'blueShop-left'}, // 蓝色商店左
|
||||
'8':{'cls': 'terrains', 'id': 'blueShop-right'}, // 蓝色商店右
|
||||
'9':{'cls': 'terrains', 'id': 'pinkShop-left'}, // 粉色商店左
|
||||
'10':{'cls': 'terrains', 'id': 'pinkShop-right'}, // 粉色商店左
|
||||
'11':{'cls': 'animates', 'id': 'lavaNet', 'noPass': false, 'trigger': 'passNet'}, // 血网
|
||||
'12':{'cls': 'animates', 'id': 'poisonNet', 'noPass': false, 'trigger': 'passNet'}, // 毒网
|
||||
'13':{'cls': 'animates', 'id': 'weakNet', 'noPass': false, 'trigger': 'passNet'}, // 衰网
|
||||
'14':{'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}, // 咒网
|
||||
'15':{'cls': 'animates', 'id': 'water', 'noPass': true}, // 水
|
||||
// 在这里添加更多地形
|
||||
// 如果空位不足,可以从180以后开始继续放,只要不和现有的数字冲突即可
|
||||
|
||||
// Autotile
|
||||
'20':{'cls': 'autotile', 'id': 'autotile', 'noPass': true}, // autotile
|
||||
// 更多的autotile从151到160等,只要不和现有的数字冲突即可
|
||||
'151':{'cls': 'autotile', 'id': 'autotile1', 'noPass': true},
|
||||
'152':{'cls': 'autotile', 'id': 'autotile2', 'noPass': true},
|
||||
'153':{'cls': 'autotile', 'id': 'autotile3', 'noPass': true},
|
||||
|
||||
////////////////////////// 物品部分 //////////////////////////
|
||||
|
||||
// 21-80 物品
|
||||
'21':{'cls': 'items', 'id': 'yellowKey'}, // 黄钥匙
|
||||
'22':{'cls': 'items', 'id': 'blueKey'}, // 蓝钥匙
|
||||
'23':{'cls': 'items', 'id': 'redKey'}, // 红钥匙
|
||||
'24':{'cls': 'items', 'id': 'greenKey'}, // 绿钥匙
|
||||
'25':{'cls': 'items', 'id': 'steelKey'}, // 铁门钥匙
|
||||
'26':{'cls': 'items', 'id': 'bigKey'}, // 大黄门钥匙(钥匙盒)
|
||||
'27':{'cls': 'items', 'id': 'redJewel'}, // 红宝石
|
||||
'28':{'cls': 'items', 'id': 'blueJewel'}, // 蓝宝石
|
||||
'29':{'cls': 'items', 'id': 'greenJewel'}, // 绿宝石
|
||||
'30':{'cls': 'items', 'id': 'yellowJewel'}, // 黄宝石
|
||||
'31':{'cls': 'items', 'id': 'redPotion'}, // 红血瓶
|
||||
'32':{'cls': 'items', 'id': 'bluePotion'}, // 蓝血瓶
|
||||
'33':{'cls': 'items', 'id': 'greenPotion'}, // 绿血瓶
|
||||
'34':{'cls': 'items', 'id': 'yellowPotion'}, // 黄血瓶
|
||||
'35':{'cls': 'items', 'id': 'sword1'}, // 铁剑
|
||||
'36':{'cls': 'items', 'id': 'shield1'}, // 铁盾
|
||||
'37':{'cls': 'items', 'id': 'sword2'}, // 银剑
|
||||
'38':{'cls': 'items', 'id': 'shield2'}, // 银盾
|
||||
'39':{'cls': 'items', 'id': 'sword3'}, // 骑士剑
|
||||
'40':{'cls': 'items', 'id': 'shield3'}, // 骑士盾
|
||||
'41':{'cls': 'items', 'id': 'sword4'}, // 圣剑
|
||||
'42':{'cls': 'items', 'id': 'shield4'}, // 圣盾
|
||||
'43':{'cls': 'items', 'id': 'sword5'}, // 神圣剑
|
||||
'44':{'cls': 'items', 'id': 'shield5'}, // 神圣盾
|
||||
'45':{'cls': 'items', 'id': 'book'}, // 怪物手册
|
||||
'46':{'cls': 'items', 'id': 'fly'}, // 楼层传送器
|
||||
'47':{'cls': 'items', 'id': 'pickaxe'}, // 破墙镐
|
||||
'48':{'cls': 'items', 'id': 'icePickaxe'}, // 破冰镐
|
||||
'49':{'cls': 'items', 'id': 'bomb'}, // 炸弹
|
||||
'50':{'cls': 'items', 'id': 'centerFly'}, // 中心对称
|
||||
'51':{'cls': 'items', 'id': 'upFly'}, // 上楼器
|
||||
'52':{'cls': 'items', 'id': 'downFly'}, // 下楼器
|
||||
'53':{'cls': 'items', 'id': 'coin'}, // 幸运金币
|
||||
'54':{'cls': 'items', 'id': 'snow'}, // 冰冻徽章
|
||||
'55':{'cls': 'items', 'id': 'cross'}, // 十字架
|
||||
'56':{'cls': 'items', 'id': 'superPotion'}, // 圣水
|
||||
'57':{'cls': 'items', 'id': 'earthquake'}, // 地震卷轴
|
||||
'58':{'cls': 'items', 'id': 'poisonWine'}, // 解毒药水
|
||||
'59':{'cls': 'items', 'id': 'weakWine'}, // 解衰药水
|
||||
'60':{'cls': 'items', 'id': 'curseWine'}, // 解咒药水
|
||||
'61':{'cls': 'items', 'id': 'superWine'}, // 万能药水
|
||||
'62':{'cls': 'items', 'id': 'knife'}, // 屠龙匕首
|
||||
'63':{'cls': 'items', 'id': 'moneyPocket'}, // 金钱袋
|
||||
'64':{'cls': 'items', 'id': 'shoes'}, // 绿鞋
|
||||
'65':{'cls': 'items', 'id': 'hammer'}, // 圣锤
|
||||
|
||||
|
||||
////////////////////////// 门、楼梯、传送点部分 //////////////////////////
|
||||
|
||||
// 81-100 门
|
||||
'81':{'cls': 'terrains', 'id': 'yellowDoor', 'trigger': 'openDoor'}, // 黄门
|
||||
'82':{'cls': 'terrains', 'id': 'blueDoor', 'trigger': 'openDoor'}, // 蓝门
|
||||
'83':{'cls': 'terrains', 'id': 'redDoor', 'trigger': 'openDoor'}, // 红门
|
||||
'84':{'cls': 'terrains', 'id': 'greenDoor', 'trigger': 'openDoor'}, // 绿门
|
||||
'85':{'cls': 'terrains', 'id': 'specialDoor', 'trigger': 'openDoor'}, // 机关门左
|
||||
'86':{'cls': 'terrains', 'id': 'steelDoor', 'trigger': 'openDoor'}, // 铁门
|
||||
'87':{'cls': 'terrains', 'id': 'upFloor', 'noPass': false}, // 上楼梯
|
||||
'88':{'cls': 'terrains', 'id': 'downFloor', 'noPass': false}, // 下楼梯
|
||||
'89':{'cls': 'animates', 'id': 'portal', 'noPass': false}, // 传送门
|
||||
'90':{'cls': 'animates', 'id': 'starPortal', 'noPass': false}, // 星空传送门
|
||||
'91':{'cls': 'animates', 'id': 'upPortal', 'noPass': false}, // 上箭头
|
||||
'92':{'cls': 'animates', 'id': 'leftPortal', 'noPass': false}, // 左箭头
|
||||
'93':{'cls': 'animates', 'id': 'downPortal', 'noPass': false}, // 下箭头
|
||||
'94':{'cls': 'animates', 'id': 'rightPortal', 'noPass': false}, // 右箭头
|
||||
|
||||
|
||||
////////////////////////// NPC部分 //////////////////////////
|
||||
|
||||
// 121-150 NPC
|
||||
'121':{'cls': 'npcs', 'id': 'man'},
|
||||
'122':{'cls': 'npcs', 'id': 'woman'},
|
||||
'123':{'cls': 'npcs', 'id': 'thief'},
|
||||
'124':{'cls': 'npcs', 'id': 'fairy'},
|
||||
'125':{'cls': 'npcs', 'id': 'magician'},
|
||||
'126':{'cls': 'npcs', 'id': 'womanMagician'},
|
||||
'127':{'cls': 'npcs', 'id': 'oldMan'},
|
||||
'128':{'cls': 'npcs', 'id': 'child'},
|
||||
'129':{'cls': 'npcs', 'id': 'wood'},
|
||||
'130':{'cls': 'npcs', 'id': 'pinkShop'},
|
||||
'131':{'cls': 'npcs', 'id': 'blueShop'},
|
||||
'132':{'cls': 'npcs', 'id': 'princess'},
|
||||
|
||||
////////////////////////// 其他部分 //////////////////////////
|
||||
|
||||
// 161-200 其他(单向箭头、灯、箱子等等)
|
||||
'161':{'cls': 'terrains', 'id': 'arrowUp', 'noPass': false}, // 单向上箭头
|
||||
'162':{'cls': 'terrains', 'id': 'arrowDown', 'noPass': false}, // 单向下箭头
|
||||
'163':{'cls': 'terrains', 'id': 'arrowLeft', 'noPass': false}, // 单向左箭头
|
||||
'164':{'cls': 'terrains', 'id': 'arrowRight', 'noPass': false}, // 单向右箭头
|
||||
'165':{'cls': 'terrains', 'id': 'light', 'trigger': 'changeLight', 'noPass': false}, // 灯
|
||||
'166':{'cls': 'terrains', 'id': 'darkLight', 'noPass': true}, // 暗灯
|
||||
|
||||
|
||||
////////////////////////// 怪物部分 //////////////////////////
|
||||
|
||||
// 201-300 怪物
|
||||
'201':{'cls': 'enemys', 'id': 'greenSlime'},
|
||||
'202':{'cls': 'enemys', 'id': 'redSlime'},
|
||||
'203':{'cls': 'enemys', 'id': 'blackSlime'},
|
||||
'204':{'cls': 'enemys', 'id': 'slimelord'},
|
||||
'205':{'cls': 'enemys', 'id': 'bat'},
|
||||
'206':{'cls': 'enemys', 'id': 'bigBat'},
|
||||
'207':{'cls': 'enemys', 'id': 'redBat'},
|
||||
'208':{'cls': 'enemys', 'id': 'vampire'},
|
||||
'209':{'cls': 'enemys', 'id': 'skeleton'},
|
||||
'210':{'cls': 'enemys', 'id': 'skeletonSoilder'},
|
||||
'211':{'cls': 'enemys', 'id': 'skeletonCaptain'},
|
||||
'212':{'cls': 'enemys', 'id': 'ghostSkeleton'},
|
||||
'213':{'cls': 'enemys', 'id': 'zombie'},
|
||||
'214':{'cls': 'enemys', 'id': 'zombieKnight'},
|
||||
'215':{'cls': 'enemys', 'id': 'rock'},
|
||||
'216':{'cls': 'enemys', 'id': 'slimeMan'},
|
||||
'217':{'cls': 'enemys', 'id': 'bluePriest'},
|
||||
'218':{'cls': 'enemys', 'id': 'redPriest'},
|
||||
'219':{'cls': 'enemys', 'id': 'brownWizard'},
|
||||
'220':{'cls': 'enemys', 'id': 'redWizard'},
|
||||
'221':{'cls': 'enemys', 'id': 'yellowGuard'},
|
||||
'222':{'cls': 'enemys', 'id': 'blueGuard'},
|
||||
'223':{'cls': 'enemys', 'id': 'redGuard'},
|
||||
'224':{'cls': 'enemys', 'id': 'swordsman'},
|
||||
'225':{'cls': 'enemys', 'id': 'soldier'},
|
||||
'226':{'cls': 'enemys', 'id': 'yellowKnight'},
|
||||
'227':{'cls': 'enemys', 'id': 'redKnight'},
|
||||
'228':{'cls': 'enemys', 'id': 'darkKnight'},
|
||||
'229':{'cls': 'enemys', 'id': 'blackKing'},
|
||||
'230':{'cls': 'enemys', 'id': 'yellowKing'},
|
||||
'231':{'cls': 'enemys', 'id': 'greenKing'},
|
||||
'232':{'cls': 'enemys', 'id': 'blueKnight'},
|
||||
'233':{'cls': 'enemys', 'id': 'goldSlime'},
|
||||
'234':{'cls': 'enemys', 'id': 'poisonSkeleton'},
|
||||
'235':{'cls': 'enemys', 'id': 'poisonBat'},
|
||||
'236':{'cls': 'enemys', 'id': 'steelRock'},
|
||||
'237':{'cls': 'enemys', 'id': 'skeletonPriest'},
|
||||
'238':{'cls': 'enemys', 'id': 'skeletonKing'},
|
||||
'239':{'cls': 'enemys', 'id': 'skeletonWizard'},
|
||||
'240':{'cls': 'enemys', 'id': 'redSkeletonCaption'},
|
||||
'241':{'cls': 'enemys', 'id': 'badHero'},
|
||||
'242':{'cls': 'enemys', 'id': 'demon'},
|
||||
'243':{'cls': 'enemys', 'id': 'demonPriest'},
|
||||
'244':{'cls': 'enemys', 'id': 'goldHornSlime'},
|
||||
'245':{'cls': 'enemys', 'id': 'redKing'},
|
||||
'246':{'cls': 'enemys', 'id': 'whiteKing'},
|
||||
'247':{'cls': 'enemys', 'id': 'blackMagician'},
|
||||
'248':{'cls': 'enemys', 'id': 'silverSlime'},
|
||||
'249':{'cls': 'enemys', 'id': 'swordEmperor'},
|
||||
'250':{'cls': 'enemys', 'id': 'whiteHornSlime'},
|
||||
'251':{'cls': 'enemys', 'id': 'badPrincess'},
|
||||
'252':{'cls': 'enemys', 'id': 'badFairy'},
|
||||
'253':{'cls': 'enemys', 'id': 'grayPriest'},
|
||||
'254':{'cls': 'enemys', 'id': 'redSwordsman'},
|
||||
'255':{'cls': 'enemys', 'id': 'whiteGhost'},
|
||||
'256':{'cls': 'enemys', 'id': 'poisonZombie'},
|
||||
'257':{'cls': 'enemys', 'id': 'magicDragon'},
|
||||
'258':{'cls': 'enemys', 'id': 'octopus'},
|
||||
'259':{'cls': 'enemys', 'id': 'darkFairy'},
|
||||
'260':{'cls': 'enemys', 'id': 'greenKnight'},
|
||||
|
||||
////////////////////////// 待定... //////////////////////////
|
||||
// 目前ID暂时不要超过400
|
||||
}
|
||||
88
main.js
88
main.js
@ -4,28 +4,6 @@ function main() {
|
||||
|
||||
this.version = "0.1"; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
|
||||
|
||||
this.useCompress = false; // 是否使用压缩文件
|
||||
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
||||
// 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。
|
||||
// 如果要进行剧本的修改请务必将其改成false。
|
||||
|
||||
this.floorIds = [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序
|
||||
"sample0", "sample1", "sample2"
|
||||
];
|
||||
this.pngs = [ // 在此存放所有可能的背景图片;背景图片最好是416*416像素,其他分辨率会被强制缩放成416*416
|
||||
// 建议对于较大的图片,在网上使用在线的“图片压缩工具”来进行压缩,以节省流量
|
||||
// 有关使用自定义背景图,请参见文档的“自定义素材”说明
|
||||
"bg.png", "yewai.png", // 依次向后添加
|
||||
];
|
||||
this.bgms = [ // 在此存放所有的bgm,和文件名一致。第一项为默认播放项
|
||||
// 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好
|
||||
'058-Slow01.mid', 'bgm.mp3', 'qianjin.mid', 'star.mid',
|
||||
];
|
||||
this.sounds = [ // 在此存放所有的SE,和文件名一致
|
||||
// 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好
|
||||
'floor.mp3', 'attack.ogg', 'door.ogg', 'item.ogg',
|
||||
];
|
||||
|
||||
//------------------------ 用户修改内容 END ------------------------//
|
||||
|
||||
this.dom = {
|
||||
@ -69,9 +47,13 @@ function main() {
|
||||
'debuffCol': document.getElementById('debuffCol'),
|
||||
'hard': document.getElementById('hard'),
|
||||
};
|
||||
this.mode = 'play';
|
||||
this.loadList = [
|
||||
'items', 'icons', 'maps', 'enemys', 'events', 'data', 'ui', 'core'
|
||||
];
|
||||
this.pureData = [
|
||||
"data","enemys","icons","maps","items"
|
||||
];
|
||||
this.images = [
|
||||
'animates', 'enemys', 'hero', 'items', 'npcs', 'terrains'
|
||||
];
|
||||
@ -117,23 +99,30 @@ function main() {
|
||||
this.canvas = {};
|
||||
}
|
||||
|
||||
////// 初始化 //////
|
||||
main.prototype.init = function () {
|
||||
main.prototype.init = function (mode) {
|
||||
for (var i = 0; i < main.dom.gameCanvas.length; i++) {
|
||||
main.canvas[main.dom.gameCanvas[i].id] = main.dom.gameCanvas[i].getContext('2d');
|
||||
}
|
||||
main.loaderJs(function () {
|
||||
var coreData = {};
|
||||
for (i = 0; i < main.loadList.length; i++) {
|
||||
var name = main.loadList[i];
|
||||
if (name === 'core') continue;
|
||||
main[name].init(main.dom);
|
||||
coreData[name] = main[name];
|
||||
}
|
||||
main.loaderFloors(function() {
|
||||
main.core.init(main.dom, main.statusBar, main.canvas, main.images, main.pngs, main.bgms, main.sounds, main.floorIds, main.floors, coreData);
|
||||
main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
|
||||
})
|
||||
if (({"editor":0,"replay":0}).hasOwnProperty(mode)) {
|
||||
main.mode = mode;
|
||||
if (mode === 'editor')main.editor = {'disableGlobalAnimate':true};
|
||||
}
|
||||
main.loadPureData(function(){
|
||||
var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
|
||||
for(var ii in mainData)main[ii]=mainData[ii];
|
||||
main.loaderJs(function () {
|
||||
var coreData = {};
|
||||
for (i = 0; i < main.loadList.length; i++) {
|
||||
var name = main.loadList[i];
|
||||
if (name === 'core') continue;
|
||||
main[name].init(main.dom);
|
||||
coreData[name] = main[name];
|
||||
}
|
||||
main.loaderFloors(function() {
|
||||
main.core.init(main.dom, main.statusBar, main.canvas, main.images, main.pngs, main.bgms, main.sounds, main.floorIds, main.floors, coreData);
|
||||
main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -165,7 +154,7 @@ main.prototype.loaderFloors = function (callback) {
|
||||
main.setMainTipsText('正在加载楼层文件...')
|
||||
if (this.useCompress) { // 读取压缩文件
|
||||
var script = document.createElement('script');
|
||||
script.src = 'libs/floors.min.js?v=' + this.version;
|
||||
script.src = 'libs/project/floors.min.js?v=' + this.version;
|
||||
main.dom.body.appendChild(script);
|
||||
script.onload = function () {
|
||||
main.dom.mainTips.style.display = 'none';
|
||||
@ -200,20 +189,35 @@ main.prototype.loadMod = function (modName, callback) {
|
||||
////// 加载某一个楼层 //////
|
||||
main.prototype.loadFloor = function(floorId, callback) {
|
||||
var script = document.createElement('script');
|
||||
script.src = 'libs/floors/' + floorId +'.js?v=' + this.version;
|
||||
script.src = 'libs/project/floors/' + floorId +'.js?v=' + this.version;
|
||||
main.dom.body.appendChild(script);
|
||||
script.onload = function () {
|
||||
callback(floorId);
|
||||
}
|
||||
}
|
||||
|
||||
main.prototype.loadPureData = function(callback) {
|
||||
var loadedNum = 0;
|
||||
main.pureData.forEach(function(name){
|
||||
var script = document.createElement('script');
|
||||
script.src = 'libs/project/' + name +'.js?v=' + this.version;
|
||||
main.dom.body.appendChild(script);
|
||||
script.onload = function () {
|
||||
loadedNum++;
|
||||
if (loadedNum == main.pureData.length)callback();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
////// 加载过程提示 //////
|
||||
main.prototype.setMainTipsText = function (text) {
|
||||
main.dom.mainTips.innerHTML = text;
|
||||
}
|
||||
|
||||
var main = new main();
|
||||
main.init();
|
||||
|
||||
|
||||
main.prototype.listen = function () {
|
||||
|
||||
////// 窗口大小变化时 //////
|
||||
window.onresize = function () {
|
||||
@ -395,3 +399,7 @@ main.dom.normalLevel.onclick = function () {
|
||||
main.dom.hardLevel.onclick = function () {
|
||||
core.events.startGame('Hard');
|
||||
}
|
||||
|
||||
}//listen end
|
||||
|
||||
var main = new main();
|
||||
150
test_main_init_mode.html
Normal file
150
test_main_init_mode.html
Normal file
@ -0,0 +1,150 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv='content-type' content='text/html' charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=Edge, chrome=1'>
|
||||
<meta name='author' content='ckcz123'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=yes'>
|
||||
<title></title>
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
|
||||
<meta name="screen-orientation" content="portrait">
|
||||
<meta name="full-screen" content="yes">
|
||||
<meta name="browsermode" content="application">
|
||||
<meta name="x5-orientation" content="portrait">
|
||||
<meta name="x5-fullscreen" content="true">
|
||||
<meta name="x5-page-mode" content="app">
|
||||
<link type='text/css' href='styles.css' rel='stylesheet'>
|
||||
</head>
|
||||
<body>
|
||||
<div id='gameGroup'>
|
||||
<p id='mainTips'>请稍后...</p>
|
||||
<div id='startPanel'>
|
||||
<div id='startTop'>
|
||||
<div id='startTopProgressBar'>
|
||||
<div id='startTopProgress'></div>
|
||||
</div>
|
||||
<p id='startTopLoadTips'>资源即将开始加载</p>
|
||||
</div>
|
||||
<img id='startBackground' src='images/bg.png'>
|
||||
<!-- 标题界面;可以改style的color使标题改变颜色 -->
|
||||
<p id='startLogo' style="color: black"></p>
|
||||
<div id='startButtonGroup'>
|
||||
<div id='startButtons'>
|
||||
<span class='startButton' id='playGame'>开始游戏</span>
|
||||
<span class='startButton' id='loadGame'>载入游戏</span>
|
||||
<span class='startButton' id='aboutGame'>关于本塔</span>
|
||||
</div>
|
||||
<div id='levelChooseButtons'>
|
||||
<span class='startButton' id='easyLevel'>简单</span>
|
||||
<span class='startButton' id='normalLevel'>普通</span>
|
||||
<span class='startButton' id='hardLevel'>困难</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='floorMsgGroup'>
|
||||
<p id='logoLabel'></p>
|
||||
<p id='versionLabel'></p>
|
||||
<p id='floorNameLabel'></p>
|
||||
</div>
|
||||
<div id='statusBar' class="clearfix">
|
||||
<div class="status" id="floorCol">
|
||||
<img src='images/floor.png' id="img-floor">
|
||||
<p class='statusLabel' id='floor'></p>
|
||||
</div>
|
||||
<div class="status" id="lvCol">
|
||||
<img src='images/lv.png' id="img-lv">
|
||||
<p class='statusLabel' id='lv'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<img src='images/hp.png' id="img-hp">
|
||||
<p class='statusLabel' id='hp'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<img src='images/atk.png' id="img-atk">
|
||||
<p class='statusLabel' id='atk'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<img src='images/def.png' id="img-def">
|
||||
<p class='statusLabel' id='def'></p>
|
||||
</div>
|
||||
<div class="status" id="mdefCol">
|
||||
<img src='images/mdef.png' id="img-mdef">
|
||||
<p class='statusLabel' id='mdef'></p>
|
||||
</div>
|
||||
<div class="status" id="moneyCol">
|
||||
<img src='images/money.png' id="img-money">
|
||||
<p class='statusLabel' id='money'></p>
|
||||
</div>
|
||||
<div class="status" id="expCol">
|
||||
<img src='images/experience.png' id="img-experience">
|
||||
<p class='statusLabel' id='experience'></p>
|
||||
</div>
|
||||
<div class="status" id="upCol">
|
||||
<img src='images/up.png' id="img-up">
|
||||
<p class='statusLabel' id='up'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
||||
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
||||
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
||||
</div>
|
||||
<div class="status" id="debuffCol">
|
||||
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
||||
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
||||
<span class='statusLabel' id='curse' style="color: #C2F4E7;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toolBar" class="clearfix">
|
||||
<img src="images/book.png" class="tools" id='img-book'>
|
||||
<img src="images/fly.png" class="tools" id='img-fly'>
|
||||
<img src="images/toolbox.png" class="tools" id='img-toolbox'>
|
||||
<img src="images/shop.png" class="tools" id='img-shop'>
|
||||
<img src="images/save.png" class="tools" id='img-save'>
|
||||
<img src="images/load.png" class="tools" id='img-load'>
|
||||
<img src="images/settings.png" class="tools" id='img-settings'>
|
||||
<p class="statusLabel tools" id="hard"></p>
|
||||
</div>
|
||||
<div id="curtain"></div>
|
||||
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
|
||||
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
|
||||
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
||||
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
||||
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
|
||||
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
||||
</div>
|
||||
<script id='mainScript' src='main.js'></script>
|
||||
<script>
|
||||
main.init('editor');
|
||||
//main.init('replay');
|
||||
main.listen();
|
||||
|
||||
var replayActions = function(){
|
||||
//core.onclick(7,7,[]);
|
||||
}
|
||||
|
||||
var replay = function(){
|
||||
core.events.startGame('');
|
||||
//setTimeout(function(){Array.from(Array(200)).forEach(function(){core.onclick(7,7,[]);});console.log(1);},1000);//关开场剧情
|
||||
//setTimeout(function(){try {Array.from(Array(200)).forEach(function(){core.drawText();})} catch (error){}},3000);//关firstArrive
|
||||
//console.log(1);
|
||||
|
||||
}
|
||||
|
||||
var afterInit = function(){
|
||||
main.editor.drawMapBg();
|
||||
main.editor.updateMap();
|
||||
}
|
||||
var start = function(){
|
||||
var hard = 'Hard';
|
||||
core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, core.initStatus.maps);
|
||||
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
|
||||
/* core.setHeroMoveTriggerInterval(); */
|
||||
//afterInit();
|
||||
});
|
||||
core.events.setInitData(hard);
|
||||
}
|
||||
setTimeout(start, 300);
|
||||
//setTimeout(replay, 300);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user