Merge pull request #213 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2018-09-16 16:31:39 +08:00 committed by GitHub
commit e69eb8bbe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 484 additions and 320 deletions

View File

@ -44,28 +44,28 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"type": {
"_leaf": true,
"_type": "textarea",
"_data": "装备的类别与equipName按顺序对应"
"_data": "如果是装备其类别与equipName按顺序对应从0开始"
},
"atk": {
"_leaf": true,
"_type": "textarea",
"_data": "装备增加的攻击数值"
"_data": "如果是装备,其增加的攻击数值"
},
"def": {
"_leaf": true,
"_type": "textarea",
"_data": "装备增加的防御数值"
"_data": "如果是装备,其增加的防御数值"
},
"mdef": {
"_leaf": true,
"_type": "textarea",
"_data": "装备增加的魔防数值"
"_data": "如果是装备,其增加的魔防数值"
},
"animate": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "装备的攻击动画仅对type为0的装备有效"
"_data": "如果是装备,其攻击动画仅对type为0的装备有效"
}
}
},

View File

@ -112,7 +112,7 @@ body {
#tip {
float: right;
width: 50%;
width: 45%;
/* height: 95%; */
min-height: 9rem;
padding: 5px 10px 10px 10px;

View File

@ -50,7 +50,7 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"equipName": {
"_leaf": true,
"_type": "textarea",
"_data": "装备位名称,为不超过6个的数组此项的顺序与equiptype数值关联"
"_data": "装备位名称为不超过6个的数组此项的顺序与equiptype数值关联;例如可写[\"武器\",\"防具\",\"首饰\"]等等。"
},
"statusLeftBackground": {
"_leaf": true,
@ -152,7 +152,7 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"equipment": {
"_leaf": true,
"_type": "textarea",
"_data": "初始装备"
"_data": "初始装上的装,此处建议请直接留空数组"
},
"items": {
"_leaf": false,
@ -429,11 +429,11 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_bool": "bool",
"_data": "剑和盾是否作为装备。如果此项为true则作为装备需要在装备栏使用否则将直接加属性。"
},
"equipboxBotton": {
"equipboxButton": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮同时启用装备栏无论equipment是否为true"
"_data": "若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮"
},
/*
"enableDeleteItem": {

View File

@ -2,6 +2,7 @@ function editor() {
this.version = "2.0";
this.material = {};
this.brushMod = "line";//["line","rectangle"]
this.layerMod = "map";//["fgmap","map","bgmap"]
}
editor.prototype.init = function (callback) {
@ -12,14 +13,7 @@ editor.prototype.init = function (callback) {
editor.reset(function () {
editor.drawMapBg();
var mapArray = core.maps.save(core.status.maps, core.status.floorId);
editor.map = mapArray.map(function (v) {
return v.map(function (v) {
return editor.ids[[editor.indexs[parseInt(v)][0]]]
})
});
editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId];
editor.fetchMapFromCore();
editor.updateMap();
editor.buildMark();
editor.drawEventBlock();
@ -170,7 +164,11 @@ editor.prototype.mapInit = function () {
editor.map[y][x] = 0;
}
}
editor.fgmap=JSON.parse(JSON.stringify(editor.map));
editor.bgmap=JSON.parse(JSON.stringify(editor.map));
editor.currentFloorData.map = editor.map;
editor.currentFloorData.fgmap = editor.fgmap;
editor.currentFloorData.bgmap = editor.bgmap;
editor.currentFloorData.firstArrive = [];
editor.currentFloorData.events = {};
editor.currentFloorData.changeFloor = {};
@ -180,12 +178,15 @@ editor.prototype.mapInit = function () {
editor.currentFloorData.cannotMove = {};
}
editor.prototype.drawMapBg = function (img) {
var bgc = bg.getContext('2d');
return;
//legacy
if (!core.isset(editor.bgY) || editor.bgY == 0) {
editor.main.editor.drawMapBg();
return;
}
var bgc = bg.getContext('2d');
for (var ii = 0; ii < 13; ii++)
for (var jj = 0; jj < 13; jj++) {
bgc.clearRect(ii * 32, jj * 32, 32, 32);
@ -256,6 +257,8 @@ editor.prototype.updateMap = function () {
}
// 绘制地图 start
var eventCtx = document.getElementById('event').getContext("2d");
var fgCtx = document.getElementById('fg').getContext("2d");
var bgCtx = document.getElementById('bg').getContext("2d");
for (var y = 0; y < editor.map.length; y++)
for (var x = 0; x < editor.map[0].length; x++) {
var tileInfo = editor.map[y][x];
@ -263,6 +266,10 @@ editor.prototype.updateMap = function () {
addIndexToAutotileInfo(x, y);
drawAutotile(eventCtx, x, y, tileInfo);
} else drawTile(eventCtx, x, y, tileInfo);
tileInfo = editor.fgmap[y][x];
drawTile(fgCtx, x, y, tileInfo);
tileInfo = editor.bgmap[y][x];
drawTile(bgCtx, x, y, tileInfo);
}
// 绘制地图 end
@ -326,26 +333,45 @@ editor.prototype.buildMark = function(){
}
}
editor.prototype.changeFloor = function (floorId, callback) {
editor.currentFloorData.map = editor.map.map(function (v) {
editor.prototype.fetchMapFromCore = function(){
var mapArray = core.maps.save(core.status.maps, core.status.floorId);
editor.map = mapArray.map(function (v) {
return v.map(function (v) {
return v.idnum || v || 0
return editor.ids[[editor.indexs[parseInt(v)][0]]]
})
});
editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId];
for(var ii=0,name;name=['bgmap','fgmap'][ii];ii++){
var mapArray = editor.currentFloorData[name];
if(!mapArray || JSON.stringify(mapArray)==JSON.stringify([])){//未设置或空数组
//与editor.map同形的全0
mapArray=eval('['+Array(editor.map.length+1).join('['+Array(editor.map[0].length+1).join('0,')+'],')+']');
}
editor[name]=mapArray.map(function (v) {
return v.map(function (v) {
return editor.ids[[editor.indexs[parseInt(v)][0]]]
})
});
}
}
editor.prototype.changeFloor = function (floorId, callback) {
for(var ii=0,name;name=['map','bgmap','fgmap'][ii];ii++){
var mapArray=editor[name].map(function (v) {
return v.map(function (v) {
return v.idnum || v || 0
})
});
editor.currentFloorData[name]=mapArray;
}
core.changeFloor(floorId, null, {"x": 0, "y": 0, "direction": "up"}, null, function () {
core.bigmap.offsetX=0;
core.bigmap.offsetY=0;
editor.moveViewport(0,0);
editor.drawMapBg();
var mapArray = core.maps.save(core.status.maps, core.status.floorId);
editor.map = mapArray.map(function (v) {
return v.map(function (v) {
return editor.ids[[editor.indexs[parseInt(v)][0]]]
})
});
editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId];
editor.fetchMapFromCore();
editor.updateMap();
editor_mode.floor();
editor.drawEventBlock();
@ -486,7 +512,7 @@ editor.prototype.listen = function () {
holdingPath = 0;
e.stopPropagation();
if (stepPostfix && stepPostfix.length) {
preMapData = JSON.parse(JSON.stringify(editor.map));
preMapData = JSON.parse(JSON.stringify({map:editor.map,fgmap:editor.fgmap,bgmap:editor.bgmap}));
if(editor.brushMod==='rectangle'){
var x0=stepPostfix[0].x;
var y0=stepPostfix[0].y;
@ -505,8 +531,12 @@ editor.prototype.listen = function () {
currDrawData.info = JSON.parse(JSON.stringify(editor.info));
reDo = null;
// console.log(stepPostfix);
for (var ii = 0; ii < stepPostfix.length; ii++)
editor.map[stepPostfix[ii].y][stepPostfix[ii].x] = editor.info;
if (editor.layerMod!='map' && editor.info.images && editor.info.images.indexOf('48')!==-1){
printe('前景/背景不支持48的图块');
} else {
for (var ii = 0; ii < stepPostfix.length; ii++)
editor[editor.layerMod][stepPostfix[ii].y][stepPostfix[ii].x] = editor.info;
}
// console.log(editor.map);
editor.updateMap();
holdingPath = 0;
@ -574,7 +604,9 @@ editor.prototype.listen = function () {
e.preventDefault();
//Ctrl+z 撤销上一步undo
if (e.keyCode == 90 && e.ctrlKey && preMapData && currDrawData.pos.length && selectBox.isSelected) {
editor.map = JSON.parse(JSON.stringify(preMapData));
editor.map = JSON.parse(JSON.stringify(preMapData.map));
editor.fgmap = JSON.parse(JSON.stringify(preMapData.fgmap));
editor.bgmap = JSON.parse(JSON.stringify(preMapData.bgmap));
editor.updateMap();
reDo = JSON.parse(JSON.stringify(currDrawData));
currDrawData = {pos: [], info: {}};
@ -582,7 +614,7 @@ editor.prototype.listen = function () {
}
//Ctrl+y 重做一步redo
if (e.keyCode == 89 && e.ctrlKey && reDo && reDo.pos.length && selectBox.isSelected) {
preMapData = JSON.parse(JSON.stringify(editor.map));
preMapData = JSON.parse(JSON.stringify({map:editor.map,fgmap:editor.fgmap,bgmap:editor.bgmap}));
for (var j = 0; j < reDo.pos.length; j++)
editor.map[reDo.pos[j].y][reDo.pos[j].x] = JSON.parse(JSON.stringify(reDo.info));
@ -865,6 +897,21 @@ editor.prototype.listen = function () {
editor.brushMod=brushMod2.value;
}
var layerMod=document.getElementById('layerMod');
layerMod.onchange=function(){
editor.layerMod=layerMod.value;
}
var layerMod2=document.getElementById('layerMod2');
if(layerMod2)layerMod2.onchange=function(){
editor.layerMod=layerMod2.value;
}
var layerMod3=document.getElementById('layerMod3');
if(layerMod3)layerMod3.onchange=function(){
editor.layerMod=layerMod3.value;
}
editor.moveViewport=function(x,y){
core.bigmap.offsetX = core.clamp(core.bigmap.offsetX+32*x, 0, 32*core.bigmap.width-416);

View File

@ -98,16 +98,20 @@ editor_file = function (editor, callback) {
editor.currentFloorData.map = [];
for (var i=0;i<height;i++) editor.currentFloorData.map.push(row);
}
else
editor.currentFloorData.map = editor.map.map(function (v) {
return v.map(function (v) {
return v.idnum || v || 0
})
});
else{
for(var ii=0,name;name=['map','bgmap','fgmap'][ii];ii++){
var mapArray=editor[name].map(function (v) {
return v.map(function (v) {
return v.idnum || v || 0
})
});
editor.currentFloorData[name]=mapArray;
}
}
for (var ii in editor.currentFloorData)
if (editor.currentFloorData.hasOwnProperty(ii)) {
if (ii == 'map')
datastr = datastr.concat(['\n"', ii, '": [\n', formatMap(editor.currentFloorData[ii]), '\n],']);
if (['map','bgmap','fgmap'].indexOf(ii)!==-1)
datastr = datastr.concat(['\n"', ii, '": [\n', formatMap(editor.currentFloorData[ii],ii!='map'), '\n],']);
else
datastr = datastr.concat(['\n"', ii, '": ', JSON.stringify(editor.currentFloorData[ii], null, 4), ',']);
}
@ -704,7 +708,13 @@ editor_file = function (editor, callback) {
return true
}
var formatMap = function (mapArr) {
var formatMap = function (mapArr,trySimplify) {
if(!mapArr || JSON.stringify(mapArr)==JSON.stringify([]))return '';
if(trySimplify){
//检查是否是全0二维数组
var jsoncheck=JSON.stringify(mapArr).replace(/\D/g,'');
if(jsoncheck==Array(jsoncheck.length+1).join('0'))return '';
}
//把二维数组格式化
var formatArrStr = '';
var arr = JSON.stringify(mapArr).replace(/\s+/g, '').split('],[');

View File

@ -55,6 +55,12 @@ functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_lint": true,
"_data": "开一个门后触发的事件"
},
"afterGetItem": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "获得一个道具后触发的事件"
},
"afterChangeLight": {
"_leaf": true,
"_type": "textarea",
@ -111,6 +117,24 @@ functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
}
}
},
"control": {
"_leaf": false,
"_type": "object",
"_data": {
"updateStatusBar": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "更新状态栏"
},
"updateCheckBlock": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "阻激夹域的伤害值计算"
},
}
},
"ui": {
"_leaf": false,
"_type": "object",

View File

@ -25,7 +25,7 @@ document.body.onmousedown = function (e) {
});
var unselect=true;
for(var ii=0,thisId;thisId=['edit','tip','brushMod','brushMod2','viewportButtons'][ii];ii++){
for(var ii=0,thisId;thisId=['edit','tip','brushMod','brushMod2','layerMod','layerMod2','layerMod3','viewportButtons'][ii];ii++){
if (clickpath.indexOf(thisId) !== -1){
unselect=false;
break;

View File

@ -211,6 +211,7 @@
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='efg' width='416' height='416'></canvas>
<canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
</div>
@ -247,6 +248,7 @@
<span id='mobileview'>
<input type="button" value="数据区"/>
<input type="button" value="地图区"/>
<br />
<input type="button" value="素材库"/>
<input type="button" value="前往游戏" onclick="window.location='./index.html'"/>
</span>
@ -268,17 +270,22 @@
<option value="functions">脚本编辑</option>
<option value="appendpic">追加素材</option>
</select>
<select id="brushMod">
<select id="brushMod" style="clear:right">
<option value="line">画线</option>
<option value="rectangle">画矩形</option>
</select>
<div id="viewportButtons">
<input type="button" value="←"/>
<input type="button" value="↑"/>
<input type="button" value="↓"/>
<input type="button" value="→"/>
<select id="layerMod" style="float:left;margin-right:3px">
<option value="bgmap">背景层</option>
<option value="map" selected>事件层</option>
<option value="fgmap">前景层</option>
</select>
<div id="viewportButtons" style="float:left">
<input type="button" style="padding:1px 1px" value="←"/>
<input type="button" style="padding:1px 6px" value="↑"/>
<input type="button" style="padding:1px 6px" value="↓"/>
<input type="button" style="padding:1px 1px" value="→"/>
</div>
<select id="selectFloor"></select>
<select id="selectFloor" style="clear:left"></select>
<input type="button" value="保存地图" id='saveFloor'/>
<span id='mobileeditdata' style="display:none">
<input type="button" value="编辑"/>
@ -406,7 +413,7 @@
<!-- <canvas class='gameCanvas' id='event' width='416' height='416'></canvas> -->
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
<!-- <canvas class='gameCanvas' id='event2' width='416' height='416'></canvas> -->
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
<!-- <canvas class='gameCanvas' id='fg' width='416' height='416'></canvas> -->
<canvas class='gameCanvas' id='damage' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='animate' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>

View File

@ -210,6 +210,7 @@
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='efg' width='416' height='416'></canvas>
<canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
</div>
@ -245,6 +246,12 @@
<input type="radio" id="brushMod" name="brushMod" value="line" checked="checked" />画线
<input type="radio" id="brushMod2" name="brushMod" value="rectangle" />画矩形
</span>
<br/>
<span style="font-size: 12px">
<input type="radio" id="layerMod2" name="layerMod" value="bgmap" />背景层
<input type="radio" id="layerMod" name="layerMod" value="map" checked="checked" style="margin-left: 5px" />事件层
<input type="radio" id="layerMod3" name="layerMod" value="fgmap" style="margin-left: 5px" />前景层
</span>
<br>
<div id="viewportButtons">
<input type="button" value="←"/>
@ -391,7 +398,7 @@
<!-- <canvas class='gameCanvas' id='event' width='416' height='416'></canvas> -->
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
<!-- <canvas class='gameCanvas' id='event2' width='416' height='416'></canvas> -->
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
<!-- <canvas class='gameCanvas' id='fg' width='416' height='416'></canvas> -->
<canvas class='gameCanvas' id='damage' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='animate' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>

View File

@ -9,7 +9,7 @@ function control() {
}
control.prototype.init = function () {
this.controldata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.control;
}
////// 设置requestAnimationFrame //////
@ -1183,116 +1183,7 @@ control.prototype.updateFollowers = function () {
////// 更新领域、夹击、阻击的伤害地图 //////
control.prototype.updateCheckBlock = function() {
core.status.checkBlock = {};
if (!core.isset(core.status.thisMap)) return;
var blocks = core.status.thisMap.blocks;
// Step1: 更新怪物地图
core.status.checkBlock.map = []; // 记录怪物地图
for (var n=0;n<blocks.length;n++) {
var block = blocks[n];
if (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0) {
var id = block.event.id, enemy = core.material.enemys[id];
if (core.isset(enemy)) {
core.status.checkBlock.map[block.x+core.bigmap.width*block.y]=id;
}
}
// 血网
if (core.isset(block.event) && !block.disable &&
block.event.id=='lavaNet' && block.event.trigger=='passNet' && !core.hasItem("shoes")) {
core.status.checkBlock.map[block.x+core.bigmap.width*block.y]="lavaNet";
}
}
// Step2: 更新领域、阻击伤害
core.status.checkBlock.damage = []; // 记录(x,y)点的伤害
for (var x=0;x<core.bigmap.width*core.bigmap.height;x++) core.status.checkBlock.damage[x]=0;
for (var x=0;x<core.bigmap.width;x++) {
for (var y=0;y<core.bigmap.height;y++) {
var id = core.status.checkBlock.map[x+core.bigmap.width*y];
if (core.isset(id)) {
if (id=="lavaNet") {
core.status.checkBlock.damage[x+core.bigmap.width*y]+=core.values.lavaDamage||0;
continue;
}
var enemy = core.material.enemys[id];
// 存在领域
if (core.enemys.hasSpecial(enemy.special, 15)) {
var range = enemy.range || 1;
var zoneSquare = false;
if (core.isset(enemy.zoneSquare)) zoneSquare=enemy.zoneSquare;
for (var dx=-range;dx<=range;dx++) {
for (var dy=-range;dy<=range;dy++) {
if (dx==0 && dy==0) continue;
var nx=x+dx, ny=y+dy;
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height) continue;
if (!zoneSquare && Math.abs(dx)+Math.abs(dy)>range) continue;
core.status.checkBlock.damage[nx+ny*core.bigmap.width]+=enemy.value||0;
}
}
}
// 存在激光
if (core.enemys.hasSpecial(enemy.special, 24)) {
for (var nx=0;nx<core.bigmap.width;nx++) {
if (nx!=x) core.status.checkBlock.damage[nx+y*core.bigmap.width]+=enemy.value||0;
}
for (var ny=0;ny<core.bigmap.height;ny++) {
if (ny!=y) core.status.checkBlock.damage[x+ny*core.bigmap.width]+=enemy.value||0;
}
}
// 存在阻击
if (core.enemys.hasSpecial(enemy.special, 18)) {
for (var dx=-1;dx<=1;dx++) {
for (var dy=-1;dy<=1;dy++) {
if (dx==0 && dy==0) continue;
var nx=x+dx, ny=y+dy;
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height || Math.abs(dx)+Math.abs(dy)>1) continue;
core.status.checkBlock.damage[nx+ny*core.bigmap.width]+=enemy.value||0;
}
}
}
}
}
}
// Step3: 更新夹击点坐标并将夹击伤害加入到damage中
core.status.checkBlock.betweenAttack = []; // 记录(x,y)点是否有夹击
for (var x=0;x<core.bigmap.width;x++) {
for (var y=0;y<core.bigmap.height;y++) {
var has=false;
if (x>0 && x<core.bigmap.width-1) {
var id1=core.status.checkBlock.map[x-1+core.bigmap.width*y],
id2=core.status.checkBlock.map[x+1+core.bigmap.height*y];
if (core.isset(id1) && core.isset(id2) && id1==id2) {
var enemy = core.material.enemys[id1];
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
has = true;
}
}
}
if (y>0 && y<core.bigmap.height-1) {
var id1=core.status.checkBlock.map[x+core.bigmap.width*(y-1)],
id2=core.status.checkBlock.map[x+core.bigmap.width*(y+1)];
if (core.isset(id1) && core.isset(id2) && id1==id2) {
var enemy = core.material.enemys[id1];
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
has = true;
}
}
}
// 存在夹击
if (has) {
core.status.checkBlock.betweenAttack[x+core.bigmap.width*y]=true;
var leftHp = core.status.hero.hp - core.status.checkBlock.damage[x+core.bigmap.width*y];
if (leftHp>1)
core.status.checkBlock.damage[x+core.bigmap.width*y] += Math.floor((leftHp+(core.flags.betweenAttackCeil?0:1))/2);
}
}
}
return this.controldata.updateCheckBlock();
}
////// 检查并执行领域、夹击、阻击事件 //////
@ -1944,23 +1835,25 @@ control.prototype.replay = function () {
if (core.canUseItem(itemId)) {
var tools = Object.keys(core.status.hero.items.tools).sort();
var constants = Object.keys(core.status.hero.items.constants).sort();
var index;
var index=-1;
if ((index=tools.indexOf(itemId))>=0) {
core.status.event.data = {"toolsPage":Math.floor(index/12)+1, "constantsPage":1, "selectId":null}
core.status.event.data = {"toolsPage":Math.floor(index/12)+1, "constantsPage":1, "selectId":null};
index = index%12;
}
else if (index=constants.indexOf(itemId)>=0) {
core.status.event.data = {"toolsPage":1, "constantsPage":Math.floor(index/12)+1, "selectId":null}
core.status.event.data = {"toolsPage":1, "constantsPage":Math.floor(index/12)+1, "selectId":null};
index = index%12+12;
}
core.ui.drawToolbox(index);
if (index>=0) {
core.ui.drawToolbox(index);
setTimeout(function () {
core.ui.closePanel();
core.useItem(itemId, function () {
core.replay();
});
}, 750 / Math.max(1, core.status.replay.speed));
return;
return;
}
}
}
else if (action.indexOf("unEquip:")==0) {
@ -1979,16 +1872,18 @@ control.prototype.replay = function () {
var equipId = action.substring(6);
var ownEquipment = Object.keys(core.status.hero.items.equips).sort();
var index = ownEquipment.indexOf(equipId);
core.status.event.data = {"page":Math.floor(index/12)+1, "selectId":null}
index = index%12+12;
core.ui.drawEquipbox(index);
setTimeout(function () {
core.ui.closePanel();
core.loadEquip(equipId, function () {
core.replay();
});
}, 750 / Math.max(1, core.status.replay.speed));
return;
if (index>=0) {
core.status.event.data = {"page":Math.floor(index/12)+1, "selectId":null};
index = index%12+12;
core.ui.drawEquipbox(index);
setTimeout(function () {
core.ui.closePanel();
core.loadEquip(equipId, function () {
core.replay();
});
}, 750 / Math.max(1, core.status.replay.speed));
return;
}
}
else if (action.indexOf("fly:")==0) {
var floorId=action.substring(4);
@ -2691,7 +2586,7 @@ control.prototype.clearStatusBar = function() {
core.statusBar[e].innerHTML = "&nbsp;";
});
core.statusBar.image.book.style.opacity = 0.3;
if (!core.flags.equipboxBotton) {
if (!core.flags.equipboxButton) {
core.statusBar.image.fly.style.opacity = 0.3;
}
}
@ -2699,52 +2594,7 @@ control.prototype.clearStatusBar = function() {
////// 更新状态栏 //////
control.prototype.updateStatusBar = function () {
// 检查等级
core.events.checkLvUp();
// 检查HP上限
if (core.flags.enableHPMax) {
core.setStatus('hp', Math.min(core.getStatus('hpmax'), core.getStatus('hp')));
}
// 更新领域、阻击、显伤
core.updateCheckBlock();
var lvName = core.getLvName();
core.statusBar.lv.innerHTML = lvName;
if (/^[+-]?\d+$/.test(lvName))
core.statusBar.lv.style.fontStyle = 'italic';
else core.statusBar.lv.style.fontStyle = 'normal';
var statusList = ['hpmax', 'hp', 'atk', 'def', 'mdef', 'money', 'experience'];
statusList.forEach(function (item) {
if (core.isset(core.status.hero[item]))
core.status.hero[item] = Math.floor(core.status.hero[item]);
core.statusBar[item].innerHTML = core.formatBigNumber(core.getStatus(item));
});
// 进阶
if (core.flags.enableLevelUp && core.status.hero.lv<core.firstData.levelUp.length) {
core.statusBar.up.innerHTML = core.firstData.levelUp[core.status.hero.lv].need || "&nbsp;";
}
else core.statusBar.up.innerHTML = "&nbsp;";
var keys = ['yellowKey', 'blueKey', 'redKey'];
keys.forEach(function (key) {
core.statusBar[key].innerHTML = core.setTwoDigits(core.status.hero.items.keys[key]);
})
if(core.flags.enableDebuff){
core.statusBar.poison.innerHTML = core.hasFlag('poison')?"毒":"";
core.statusBar.weak.innerHTML = core.hasFlag('weak')?"衰":"";
core.statusBar.curse.innerHTML = core.hasFlag('curse')?"咒":"";
}
if (core.flags.enablePZF) {
core.statusBar.pickaxe.innerHTML = "破"+core.itemCount('pickaxe');
core.statusBar.bomb.innerHTML = "炸"+core.itemCount('bomb');
core.statusBar.fly.innerHTML = "飞"+core.itemCount('centerFly');
}
core.statusBar.hard.innerHTML = core.status.hard;
this.controldata.updateStatusBar();
// 回放
if (core.status.replay.replaying) {
@ -2769,7 +2619,7 @@ control.prototype.updateStatusBar = function () {
core.statusBar.image.book.src = core.statusBar.icons.book.src;
core.statusBar.image.book.style.opacity = core.hasItem('book')?1:0.3;
if (!core.flags.equipboxBotton) {
if (!core.flags.equipboxButton) {
core.statusBar.image.fly.src = core.statusBar.icons.fly.src;
core.statusBar.image.fly.style.opacity = core.hasItem('fly')?1:0.3;
}

View File

@ -988,12 +988,7 @@ events.prototype.getItem = function (itemId, itemNum, itemX, itemY, callback) {
core.canvas.event.clearRect(itemX * 32, itemY * 32, 32, 32);
core.updateStatusBar();
// 检查处理后的事件。
var event = core.floors[core.status.floorId].afterGetItem[itemX+","+itemY];
if (core.isset(event)) {
core.events.doEvents(event, itemX, itemY, callback);
}
else if (core.isset(callback)) callback();
this.eventdata.afterGetItem(itemId, itemX, itemY, callback);
}
////// 开门 //////
@ -1087,17 +1082,17 @@ events.prototype.battle = function (id, x, y, force, callback) {
}
else {
var nowEquipment = 'hand';
if (core.flags.equipment) {
var equipId = core.status.hero.equipment[0];
if (core.isset(equipId))
if (core.isset(core.material.items[equipId].equip.animate))
core.drawAnimate(core.material.items[equipId].equip.animate, x, y);
}
else {
core.playSound('attack.mp3');
core.drawAnimate('hand', x, y);
var equipId = (core.status.hero.equipment||[])[0];
if (core.isset(equipId) && core.isset(core.material.items[equipId])
&& core.isset(core.material.items[equipId].equip.animate))
nowEquipment = core.material.items[equipId].equip.animate;
}
core.playSound('attack.mp3');
core.drawAnimate(nowEquipment, x, y);
core.events.afterBattle(id, x, y, callback);
}
}

View File

@ -98,8 +98,12 @@ items.prototype.hasItem = function (itemId) {
////// 是否装备某件装备 //////
items.prototype.hasEquip = function (equipId) {
if (!core.isset(equipId)) return null;
if (!core.isset((core.material.items[equipId]||{}).equip)) return null;
var equiptype = core.material.items[equipId].equip.type;
return core.status.hero.equipment[equiptype] == equipId;
return equipId == (core.status.hero.equipment||[])[equiptype];
}
////// 设置某个物品的个数 //////
@ -149,10 +153,16 @@ items.prototype.addItem = function (itemId, itemNum) {
////// 换上 //////
items.prototype.loadEquip = function (equipId, callback) {
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
core.playSound('equip.mp3');
var loadEquip = core.material.items[equipId];
if (!core.isset(loadEquip)) {
if (core.isset(callback)) callback();
return;
}
var loadEquipType = loadEquip.equip.type;
var unloadEquipId = core.status.hero.equipment[loadEquipType];
@ -171,23 +181,29 @@ items.prototype.loadEquip = function (equipId, callback) {
core.status.route.push("equip:"+equipId);
// 装备更换完毕:删除换上的装备
core.status.hero.items["equips"][equipId]--;
if (core.status.hero.items["equips"][equipId]==0)
delete core.status.hero.items["equips"][equipId];
core.removeItem(equipId);
// 装备更换完毕:增加卸下的装备
if (core.isset(unloadEquipId))
core.addItem(unloadEquipId, 1);
core.log("已装备上"+loadEquip.name, core.material.icons.items[equipId]);
if (core.isset(callback)) callback();
}
////// 卸下 //////
items.prototype.unloadEquip = function (equipType, callback) {
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
core.playSound('equip.mp3');
var unloadEquipId = core.status.hero.equipment[equipType];
if (!core.isset(unloadEquipId)) {
if (core.isset(callback)) callback();
return;
}
var unloadEquip = core.material.items[unloadEquipId];
// 处理能力值改变
@ -206,6 +222,8 @@ items.prototype.unloadEquip = function (equipType, callback) {
// 装备更换完毕:增加卸下的装备
core.addItem(unloadEquipId, 1);
core.drawTip("已卸下"+unloadEquip.name, core.material.icons.items[unloadEquipId]);
if (core.isset(callback)) callback();
}
@ -213,15 +231,15 @@ items.prototype.compareEquipment = function (compareEquipId, beComparedEquipId)
var compareAtk = 0, compareDef = 0, compareMdef = 0;
if (core.isset(compareEquipId)) {
var compareEquip = core.material.items[compareEquipId];
compareAtk += compareEquip.equip.atk || 0;
compareDef += compareEquip.equip.def || 0;
compareMdef += compareEquip.equip.mdef || 0;
compareAtk += (compareEquip.equip||{}).atk || 0;
compareDef += (compareEquip.equip||{}).def || 0;
compareMdef += (compareEquip.equip||{}).mdef || 0;
}
if (core.isset(beComparedEquipId)) {
var beComparedEquip = core.material.items[beComparedEquipId];
compareAtk -= beComparedEquip.equip.atk || 0;
compareDef -= beComparedEquip.equip.def || 0;
compareMdef -= beComparedEquip.equip.mdef || 0;
compareAtk -= (beComparedEquip.equip||{}).atk || 0;
compareDef -= (beComparedEquip.equip||{}).def || 0;
compareMdef -= (beComparedEquip.equip||{}).mdef || 0;
}
return {"atk":compareAtk,"def":compareDef,"mdef":compareMdef};
}

View File

@ -351,11 +351,13 @@ maps.prototype.drawBgFgMap = function (floorId, canvas, name) {
var getMapArray = function (name) {
var arr = core.clone(core.floors[floorId][name+"map"] || []);
if(main.mode=='editor')arr = core.clone(editor[name+"map"])||arr;
for (var x = 0; x < width; x++) {
for (var y = 0; y < height; y++) {
arr[y] = arr[y] || [];
if (core.hasFlag(name + "_" + floorId + "_" + x + "_" + y)) arr[y][x] = 0;
else arr[y][x] = core.getFlag(name + "v_" + floorId + "_" + x + "_" + y, arr[y][x] || 0);
if(main.mode=='editor')arr[y][x]= arr[y][x].idnum || arr[y][x] || 0;
}
}
return arr;
@ -431,10 +433,14 @@ maps.prototype.drawMap = function (mapName, callback) {
}
if (main.mode=='editor'){
main.editor.drawMapBg = function(){
core.clearMap('bg');
drawBg();
}
// just do not run drawBg
// //---move to main.editor.updateMap
// main.editor.drawMapBg = function(){
// core.clearMap('bg');
// core.clearMap('fg');
// drawBg();
// }
} else {
drawBg();
}

View File

@ -397,7 +397,7 @@ main.statusBar.image.fly.onclick = function () {
}
if (main.core.isPlaying()) {
if (!main.core.flags.equipboxBotton) {
if (!main.core.flags.equipboxButton) {
main.core.useFly(true);
}
else {

@ -1 +0,0 @@
Subproject commit 45645884940c700b6121ffdd3624f9ed0ed062cb

View File

@ -72,10 +72,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"mdef": 100,
"money": 100,
"experience": 0,
"equipment": [
null,
null
],
"equipment": [],
"items": {
"keys": {
"yellowKey": 0,
@ -204,7 +201,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"snowFourDirections": false,
"bigKeyIsBox": false,
"equipment": true,
"equipboxBotton": false,
"equipboxButton": true,
"enableAddPoint": false,
"enableNegativeDamage": false,
"hatredDecrease": true,

View File

@ -212,4 +212,10 @@ main.floors.sample0=
]
},
"cannotMove": {},
"bgmap": [
],
"fgmap": [
],
}

View File

@ -1,8 +1,7 @@
functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
{
"events":{
////// 游戏开始前的一些初始化操作 //////
"initGame": function() {
"events": {
"initGame": function() {
// 游戏开始前的一些初始化操作
// 根据flag来对道具进行修改
@ -16,7 +15,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (core.flags.snowFourDirections)
core.material.items.bomb.text = "可以将四周的熔岩变成平地";
// 是否启用装备栏
if (core.flags.equipboxBotton) {
if (core.flags.equipboxButton) {
core.statusBar.image.fly.src = core.statusBar.icons.equipbox.src;
core.flags.equipment = true;
}
@ -33,8 +32,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.material.items.shield5.cls = 'equips';
}
},
////// 不同难度分别设置初始属性 //////
"setInitData":function (hard) {
"setInitData": function (hard) {
// 不同难度分别设置初始属性
if (hard=='Easy') { // 简单难度
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
@ -54,8 +52,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
core.events.afterLoadData();
},
////// 游戏获胜事件 //////
"win" : function(reason, norank) {
"win": function(reason, norank) {
// 游戏获胜事件
core.ui.closePanel();
var replaying = core.status.replay.replaying;
@ -74,8 +71,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
})
});
},
////// 游戏失败事件 //////
"lose" : function(reason) {
"lose": function(reason) {
// 游戏失败事件
core.ui.closePanel();
var replaying = core.status.replay.replaying;
@ -88,8 +84,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
});
})
},
////// 转换楼层结束的事件 //////
"afterChangeFloor" : function (floorId, fromLoad) {
"afterChangeFloor": function (floorId, fromLoad) {
// 转换楼层结束的事件
// floorId是切换到的楼层fromLoad若为true则代表是从读档行为造成的楼层切换
if (!core.hasFlag("visited_"+floorId)) {
@ -97,8 +92,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.setFlag("visited_"+floorId, true);
}
},
////// 加点事件 //////
"addPoint" : function (enemy) {
"addPoint": function (enemy) {
// 加点事件
var point = enemy.point;
if (!core.flags.enableAddPoint || !core.isset(point) || point<=0) return [];
@ -120,8 +114,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
];
},
////// 战斗结束后触发的事件 //////
"afterBattle" : function(enemyId,x,y,callback) {
"afterBattle": function(enemyId,x,y,callback) {
// 战斗结束后触发的事件
var enemy = core.material.enemys[enemyId];
@ -221,9 +214,9 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 在这里增加其他的自定义事件需求
/*
if (enemyId=='xxx') {
core.unshift(todo, [
{"type": "...", ...},
]);
core.unshift(todo, [
{"type": "...", ...},
]);
}
*/
@ -242,8 +235,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (core.isset(callback)) callback();
},
////// 开一个门后触发的事件 //////
"afterOpenDoor" : function(doorId,x,y,callback) {
"afterOpenDoor": function(doorId,x,y,callback) {
// 开一个门后触发的事件
var todo = [];
@ -266,13 +258,28 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
if (core.isset(callback)) callback();
},
////// 改变亮灯之后,可以触发的事件 //////
"afterChangeLight" : function(x,y) {
"afterGetItem": function(itemId,x,y,callback) {
// 获得一个道具后触发的事件
var todo = [];
if (core.isset(x) && core.isset(y)) {
var event = core.floors[core.status.floorId].afterGetItem[x+","+y];
if (core.isset(event)) {
core.unshift(todo, event);
}
}
if (todo.length>0) {
core.events.insertAction(todo,x,y);
}
if (core.isset(callback)) callback();
},
"afterChangeLight": function(x,y) {
// 改变亮灯之后,可以触发的事件
},
////// 推箱子后的事件 //////
"afterPushBox" : function () {
"afterPushBox": function () {
// 推箱子后的事件
var noBoxLeft = function () {
@ -295,8 +302,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
*/
}
},
////// 使用炸弹/圣锤后的事件 //////
"afterUseBomb" : function () {
"afterUseBomb": function () {
// 使用炸弹/圣锤后的事件
// 这是一个使用炸弹也能开门的例子
@ -311,21 +317,19 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
*/
},
////// 即将存档前可以执行的操作 //////
"beforeSaveData" : function(data) {
"beforeSaveData": function(data) {
// 即将存档前可以执行的操作
},
////// 读档事件后,载入事件前,可以执行的操作 //////
"afterLoadData" : function(data) {
"afterLoadData": function(data) {
// 读档事件后,载入事件前,可以执行的操作
// 怪物数据的动态修改迁移到了“脚本编辑 - updateEnemys”中详见文档说明
core.enemys.updateEnemys();
}
},
"enemys": {
"getSpecials" : function() {
},
"enemys": {
"getSpecials": function() {
// 获得怪物的特殊属性,每一行定义一个特殊属性。
// 分为三项,第一项为该特殊属性的数字,第二项为特殊属性的名字,第三项为特殊属性的描述
// 可以直接写字符串也可以写个function将怪物传进去
@ -356,7 +360,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
[24, "激光", function (enemy) {return "经过怪物同行或同列时自动减生命"+(enemy.value||0)+"点";}]
];
},
"getDamageInfo" : function (enemy, hero_hp, hero_atk, hero_def, hero_mdef) {
"getDamageInfo": function (enemy, hero_hp, hero_atk, hero_def, hero_mdef) {
// 获得战斗伤害信息(实际伤害计算函数)
// 怪物生命,怪物攻击、防御、特殊属性
@ -449,7 +453,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"damage": damage
};
},
"updateEnemys" : function () {
"updateEnemys": function () {
// 更新怪物数据,可以在这里对怪物属性和数据进行动态更新,详见文档——事件——怪物数据的动态修改
// 比如下面这个例子如果flag:xxx为真则将绿头怪的攻击设为100金币设为20
/*
@ -460,10 +464,180 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
*/
// 别忘了在事件中调用“更新怪物数据”事件!
}
},
"control": {
"updateStatusBar": function () {
// 更新状态栏
// 检查等级
core.events.checkLvUp();
// 检查HP上限
if (core.flags.enableHPMax) {
core.setStatus('hp', Math.min(core.getStatus('hpmax'), core.getStatus('hp')));
}
// 更新领域、阻击、显伤
core.updateCheckBlock();
var lvName = core.getLvName();
core.statusBar.lv.innerHTML = lvName;
if (/^[+-]?\d+$/.test(lvName))
core.statusBar.lv.style.fontStyle = 'italic';
else core.statusBar.lv.style.fontStyle = 'normal';
var statusList = ['hpmax', 'hp', 'atk', 'def', 'mdef', 'money', 'experience'];
statusList.forEach(function (item) {
if (core.isset(core.status.hero[item]))
core.status.hero[item] = Math.floor(core.status.hero[item]);
core.statusBar[item].innerHTML = core.formatBigNumber(core.getStatus(item));
});
// 进阶
if (core.flags.enableLevelUp && core.status.hero.lv<core.firstData.levelUp.length) {
core.statusBar.up.innerHTML = core.firstData.levelUp[core.status.hero.lv].need || " ";
}
else core.statusBar.up.innerHTML = " ";
var keys = ['yellowKey', 'blueKey', 'redKey'];
keys.forEach(function (key) {
core.statusBar[key].innerHTML = core.setTwoDigits(core.status.hero.items.keys[key]);
})
if(core.flags.enableDebuff){
core.statusBar.poison.innerHTML = core.hasFlag('poison')?"毒":"";
core.statusBar.weak.innerHTML = core.hasFlag('weak')?"衰":"";
core.statusBar.curse.innerHTML = core.hasFlag('curse')?"咒":"";
}
if (core.flags.enablePZF) {
core.statusBar.pickaxe.innerHTML = "破"+core.itemCount('pickaxe');
core.statusBar.bomb.innerHTML = "炸"+core.itemCount('bomb');
core.statusBar.fly.innerHTML = "飞"+core.itemCount('centerFly');
}
core.statusBar.hard.innerHTML = core.status.hard;
},
"ui":{
////// 绘制“关于”界面 //////
"drawAbout" : function() {
"updateCheckBlock": function () {
// 领域、夹击、阻击等的伤害值计算
core.status.checkBlock = {};
if (!core.isset(core.status.thisMap)) return;
var blocks = core.status.thisMap.blocks;
// Step1: 更新怪物地图
core.status.checkBlock.map = []; // 记录怪物地图
for (var n=0;n<blocks.length;n++) {
var block = blocks[n];
if (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0) {
var id = block.event.id, enemy = core.material.enemys[id];
if (core.isset(enemy)) {
core.status.checkBlock.map[block.x+core.bigmap.width*block.y]=id;
}
}
// 血网
if (core.isset(block.event) && !block.disable &&
block.event.id=='lavaNet' && block.event.trigger=='passNet' && !core.hasItem("shoes")) {
core.status.checkBlock.map[block.x+core.bigmap.width*block.y]="lavaNet";
}
}
// Step2: 更新领域、阻击伤害
core.status.checkBlock.damage = []; // 记录(x,y)点的伤害;(x,y)对应的值是 x+y*core.bigmap
for (var x=0;x<core.bigmap.width*core.bigmap.height;x++) core.status.checkBlock.damage[x]=0;
for (var x=0;x<core.bigmap.width;x++) {
for (var y=0;y<core.bigmap.height;y++) {
var id = core.status.checkBlock.map[x+core.bigmap.width*y];
if (core.isset(id)) {
if (id=="lavaNet") {
core.status.checkBlock.damage[x+core.bigmap.width*y]+=core.values.lavaDamage||0;
continue;
}
var enemy = core.material.enemys[id];
// 存在领域
// 如果要防止领域伤害,可以直接简单的将 flag:no_zone 设为true
if (core.enemys.hasSpecial(enemy.special, 15) && !core.hasFlag("no_zone")) {
var range = enemy.range || 1;
var zoneSquare = false;
if (core.isset(enemy.zoneSquare)) zoneSquare=enemy.zoneSquare;
for (var dx=-range;dx<=range;dx++) {
for (var dy=-range;dy<=range;dy++) {
if (dx==0 && dy==0) continue;
var nx=x+dx, ny=y+dy;
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height) continue;
if (!zoneSquare && Math.abs(dx)+Math.abs(dy)>range) continue;
core.status.checkBlock.damage[nx+ny*core.bigmap.width]+=enemy.value||0;
}
}
}
// 存在激光
// 如果要防止激光伤害,可以直接简单的将 flag:no_laser 设为true
if (core.enemys.hasSpecial(enemy.special, 24) && !core.hasFlag("no_laser")) {
for (var nx=0;nx<core.bigmap.width;nx++) {
if (nx!=x) core.status.checkBlock.damage[nx+y*core.bigmap.width]+=enemy.value||0;
}
for (var ny=0;ny<core.bigmap.height;ny++) {
if (ny!=y) core.status.checkBlock.damage[x+ny*core.bigmap.width]+=enemy.value||0;
}
}
// 存在阻击
// 如果要防止阻击伤害,可以直接简单的将 flag:no_snipe 设为true
if (core.enemys.hasSpecial(enemy.special, 18) && !core.hasFlag("no_snipe")) {
for (var dx=-1;dx<=1;dx++) {
for (var dy=-1;dy<=1;dy++) {
if (dx==0 && dy==0) continue;
var nx=x+dx, ny=y+dy;
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height || Math.abs(dx)+Math.abs(dy)>1) continue;
core.status.checkBlock.damage[nx+ny*core.bigmap.width]+=enemy.value||0;
}
}
}
}
}
}
// Step3: 更新夹击点坐标并将夹击伤害加入到damage中
core.status.checkBlock.betweenAttack = []; // 记录(x,y)点是否有夹击
// 如果要防止夹击伤害,可以简单的将 flag:no_betweenAttack 设为true
if (!core.hasFlag('no_betweenAttack')) {
for (var x=0;x<core.bigmap.width;x++) {
for (var y=0;y<core.bigmap.height;y++) {
var has=false;
if (x>0 && x<core.bigmap.width-1) {
var id1=core.status.checkBlock.map[x-1+core.bigmap.width*y],
id2=core.status.checkBlock.map[x+1+core.bigmap.height*y];
if (core.isset(id1) && core.isset(id2) && id1==id2) {
var enemy = core.material.enemys[id1];
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
has = true;
}
}
}
if (y>0 && y<core.bigmap.height-1) {
var id1=core.status.checkBlock.map[x+core.bigmap.width*(y-1)],
id2=core.status.checkBlock.map[x+core.bigmap.width*(y+1)];
if (core.isset(id1) && core.isset(id2) && id1==id2) {
var enemy = core.material.enemys[id1];
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
has = true;
}
}
}
// 计算夹击伤害
if (has) {
core.status.checkBlock.betweenAttack[x+core.bigmap.width*y]=true;
var leftHp = core.status.hero.hp - core.status.checkBlock.damage[x+core.bigmap.width*y];
if (leftHp>1)
core.status.checkBlock.damage[x+core.bigmap.width*y] += Math.floor((leftHp+(core.flags.betweenAttackCeil?0:1))/2);
}
}
}
}
}
},
"ui": {
"drawAbout": function() {
// 绘制“关于”界面
if (!core.isPlaying()) {
core.status.event = {'id': null, 'data': null};
@ -490,9 +664,9 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.fillText('ui', 'HTML5魔塔交流群539113091', text_start, top+112+32);
// TODO: 写自己的“关于”页面每次增加32像素即可
}
},
"plugins": {
"plugin": function () {
},
"plugins": {
"plugin": function () {
////// 插件编写,可以在这里写自己额外需要执行的脚本 //////
// 在这里写的代码,在所有模块加载完毕后,游戏开始前会被执行
@ -510,5 +684,5 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 可以在任何地方如afterXXX或自定义脚本事件调用函数方法为 core.plugin.xxx();
}
}
}
}

View File

@ -203,12 +203,13 @@ icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
'greenPotion': 22,
'yellowPotion': 23,
'lifeWand': 33,
'blank': 60,
"sword0": 60,
'sword1': 50,
'sword2': 51,
'sword3': 52,
'sword4': 53,
'sword5': 54,
"shield0": 61,
'shield1': 55,
'shield2': 56,
'shield3': 57,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -45,8 +45,18 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"cls": "items",
"name": "绿血瓶"
},
"sword0": {
"cls": "items",
"name": "破旧的剑",
"text": "一把已经生锈的剑",
"equip": {
"type": 0,
"atk": 0,
"animate": "sword"
}
},
"sword1": {
"cls": "item",
"cls": "items",
"name": "铁剑",
"text": "一把很普通的铁剑",
"equip":{
@ -95,6 +105,15 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"animate": "sword"
}
},
"shield0": {
"cls": "items",
"name": "破旧的盾",
"text": "一个很破旧的铁盾",
"equip": {
"type": 1,
"def": 0
}
},
"shield1": {
"cls": "items",
"name": "铁盾",
@ -279,11 +298,13 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"bluePotion": "core.status.hero.hp += core.values.bluePotion * ratio",
"yellowPotion": "core.status.hero.hp += core.values.yellowPotion * ratio",
"greenPotion": "core.status.hero.hp += core.values.greenPotion * ratio",
"sword0": "core.status.hero.atk += 0",
"sword1": "core.status.hero.atk += 10",
"sword2": "core.status.hero.atk += 20",
"sword3": "core.status.hero.atk += 40",
"sword4": "core.status.hero.atk += 80",
"sword5": "core.status.hero.atk += 100",
"shield0": "core.status.hero.def += 0",
"shield1": "core.status.hero.def += 10",
"shield2": "core.status.hero.def += 20",
"shield3": "core.status.hero.def += 40",
@ -302,16 +323,18 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"bluePotion": "',生命+'+core.values.bluePotion * ratio",
"yellowPotion": "',生命+'+core.values.yellowPotion * ratio",
"greenPotion": "',生命+'+core.values.greenPotion * ratio",
"sword1": ",攻击+10",
"sword2": ",攻击+20",
"sword3": ",攻击+40",
"sword4": ",攻击+80",
"sword5": ",攻击+100",
"shield1": ",防御+10",
"shield2": ",防御+20",
"shield3": ",防御+40",
"shield4": ",防御+80",
"shield5": ",防御+100魔防+100",
"sword0": "',攻击+0'",
"sword1": "',攻击+10'",
"sword2": "',攻击+20'",
"sword3": "',攻击+40'",
"sword4": "',攻击+80'",
"sword5": "',攻击+100'",
"shield0": "',防御+0'",
"shield1": "',防御+10'",
"shield2": "',防御+20'",
"shield3": "',防御+40'",
"shield4": "',防御+80'",
"shield5": "',防御+100魔防+100'",
"bigKey": "',全钥匙+1'",
"superPotion": "',生命值翻倍'",
"moneyPocket": "',金币+'+core.values.moneyPocket"