checkBlock

This commit is contained in:
ckcz123 2019-03-18 18:15:27 +08:00
parent 9ac105ebff
commit 58c0b8f1ce
5 changed files with 188 additions and 233 deletions

View File

@ -182,7 +182,7 @@ control.prototype._animationFrame_heroMoving = function (timestamp) {
core.animateFrame.leftLeg = !core.animateFrame.leftLeg;
core.animateFrame.moveTime = timestamp;
}
core.drawHero(direction, x, y, core.animateFrame.leftLeg?'leftFoot':'rightFoot', 4*core.status.heroMoving);
core.drawHero(core.animateFrame.leftLeg?'leftFoot':'rightFoot', 4*core.status.heroMoving);
}
control.prototype._animationFrame_weather = function (timestamp) {
@ -315,6 +315,7 @@ control.prototype._showStartAnimate_resetDom = function () {
core.dom.musicBtn.style.display = 'block';
// 重置音量
core.events.setVolume(1, 0);
core.updateStatusBar();
}
control.prototype._showStartAnimate_finished = function (start, callback) {
@ -594,7 +595,7 @@ control.prototype._moveAction_noPass = function (canMove, callback) {
core.status.route.push(core.getHeroLoc('direction'));
core.status.automaticRoute.moveStepBeforeStop = [];
core.status.automaticRoute.lastDirection = core.getHeroLoc('direction');
if (canMove) core.trigger(core.nextX(), core.nextY());
if (canMove) core.events._trigger(core.nextX(), core.nextY());
core.drawHero();
if (core.status.automaticRoute.moveStepBeforeStop.length==0) {
@ -618,13 +619,14 @@ control.prototype._moveAction_moving = function (callback) {
if (block!=null && block.block.event.trigger=='getItem' &&
!core.floors[core.status.floorId].afterGetItem[nowx+","+nowy]) {
hasTrigger = true;
core.trigger(nowx, nowy);
core.events._trigger(nowx, nowy);
}
// 执行该点的阻激夹域事件
core.checkBlock();
// 执行该点事件
if (!hasTrigger)
core.trigger(nowx, nowy);
core.events._trigger(nowx, nowy);
core.updateStatusBar();
if (callback) callback();
});
}
@ -670,7 +672,8 @@ control.prototype._moveHero_moving = function () {
if (core.hasFlag('debug') && core.status.ctrlDown) {
if (core.status.heroMoving!=0) return;
// 检测是否穿出去
if (!core.insideMap(1)) return;
var nx = core.nextX(), ny = core.nextY();
if (nx < 0 || nx >= core.bigmap.width || ny < 0 || ny >= core.bigmap.height) return;
core.status.heroMoving=-1;
core.eventMoveHero([core.getHeroLoc('direction')], core.values.moveSpeed, function () {
core.status.heroMoving=0;
@ -752,12 +755,10 @@ control.prototype.tryMoveDirectly = function (destX, destY) {
}
////// 绘制勇士 //////
control.prototype.drawHero = function (direction, x, y, status, offset) {
control.prototype.drawHero = function (status, offset) {
if (!core.isPlaying() || !core.status.floorId) return;
if (x == null) x = core.getHeroLoc('x');
if (y == null) y = core.getHeroLoc('y');
var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), direction = core.getHeroLoc('direction');
status = status || 'stop';
direction = direction || core.getHeroLoc('direction');
offset = offset || 0;
var way = core.utils.scan[direction];
var dx = way.x, dy = way.y, offsetX = dx * offset, offsetY = dy * offset;
@ -854,7 +855,7 @@ control.prototype.setHeroLoc = function (itemName, itemVal, noGather) {
////// 获得勇士的位置 //////
control.prototype.getHeroLoc = function (itemName) {
if (!core.isset(itemName)) return core.status.hero.loc;
if (itemName == null) return core.status.hero.loc;
return core.status.hero.loc[itemName];
}
@ -873,14 +874,6 @@ control.prototype.nearHero = function (x, y) {
return Math.abs(x-core.getHeroLoc('x'))+Math.abs(y-core.getHeroLoc('y'))<=1;
}
////// 判定下一个点是否在界面外 //////
control.prototype.insideMap = function (n) {
n = n || 0;
var x = n==0?core.getHeroLoc('x'):core.nextX(n),
y = n==0?core.getHeroLoc('y'):core.nextY(n);
return x>=0 && x < core.bigmap.width && y >= 0 && y < core.bigmap.height;
}
////// 聚集跟随者 //////
control.prototype.gatherFollowers = function () {
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y'), dir=core.getHeroLoc('direction');
@ -922,74 +915,42 @@ control.prototype.updateCheckBlock = function(floorId) {
////// 检查并执行领域、夹击、阻击事件 //////
control.prototype.checkBlock = function () {
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
var damage = core.status.checkBlock.damage[x+core.bigmap.width*y];
if (damage>0) {
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y'), loc = x+","+y;
var damage = core.status.checkBlock.damage[loc];
if (damage) {
core.status.hero.hp -= damage;
// 检查阻击事件
var snipe = [];
if (!core.hasFlag("no_snipe")) {
for (var direction in core.utils.scan) {
var nx = x+core.utils.scan[direction].x, ny=y+core.utils.scan[direction].y;
if (nx<0 || nx>=core.bigmap.width || ny<0 || ny>=core.bigmap.height) continue;
var id=core.status.checkBlock.map[nx+core.bigmap.width*ny];
if (core.isset(id)) {
var enemy = core.material.enemys[id];
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 18)) {
snipe.push({'direction': direction, 'x': nx, 'y': ny});
}
}
}
}
if (core.status.checkBlock.betweenAttack[x+core.bigmap.width*y] && damage>0) {
core.drawTip('受到夹击,生命变成一半');
}
else if (core.status.checkBlock.map[x+core.bigmap.width*y]=='lavaNet') {
core.drawTip('受到血网伤害'+damage+'点');
}
// 阻击
else if (snipe.length>0 && damage>0) {
core.drawTip('受到阻击伤害'+damage+'点');
}
else if (damage>0) {
core.drawTip('受到领域或激光伤害'+damage+'点');
}
if (damage>0) {
core.playSound('zone.mp3');
core.drawAnimate("zone", x, y);
// 禁用快捷商店
if (core.flags.disableShopOnDamage) {
for (var shopId in core.status.shops) {
core.status.shops[shopId].visited = false;
}
}
}
core.status.hero.statistics.extraDamage += damage;
if (core.status.hero.hp<=0) {
core.drawTip("受到"+(core.status.checkBlock.type[loc]||"伤害")+damage+"点");
this._checkBlock_soundAndAnimate(x, y);
if (core.status.hero.hp <= 0) {
core.status.hero.hp=0;
core.updateStatusBar();
core.events.lose();
return;
}
snipe = snipe.filter(function (t) {
var x=t.x, y=t.y, direction = t.direction;
var nx = x+core.utils.scan[direction].x, ny=y+core.utils.scan[direction].y;
return nx>=0 && nx<core.bigmap.width && ny>=0 && ny<core.bigmap.height && core.getBlock(nx, ny)==null;
});
core.updateStatusBar();
if (snipe.length>0)
core.snipe(snipe);
}
// 检查捕捉
var ambush = (core.status.checkBlock.ambush||[])[x+core.bigmap.width*y];
if (core.isset(ambush)) {
this._checkBlock_snipe(core.status.checkBlock.snipe[loc]);
this._checkBlock_ambush(core.status.checkBlock.ambush[loc]);
}
control.prototype._checkBlock_soundAndAnimate = function (x,y) {
core.playSound('zone.mp3');
core.drawAnimate("zone", x, y);
}
////// 阻击 //////
control.prototype._checkBlock_snipe = function (snipe) {
if (!snipe || snipe.length == 0) return;
var actions = [];
snipe.forEach(function (t) {
actions.push({"type": "move", "loc": [t[0],t[1]], "steps": [t[3]], "time": 500, "keep": true, "async": true});
});
actions.push({"type": "waitAsync"});
core.insertAction(actions);
}
////// 捕捉 //////
control.prototype._checkBlock_ambush = function (ambush) {
if (!ambush || ambush.length == 0) return;
// 捕捉效果
var actions = [];
ambush.forEach(function (t) {
@ -999,19 +960,7 @@ control.prototype.checkBlock = function () {
// 强制战斗
ambush.forEach(function (t) {
actions.push({"type": "battle", "id": t[2]});
})
core.insertAction(actions);
}
}
////// 阻击事件(动画效果) //////
control.prototype.snipe = function (snipes) {
// 阻击改成moveBlock事件完成
var actions = [];
snipes.forEach(function (t) {
actions.push({"type": "move", "loc": [t.x, t.y], "steps": [t.direction], "time": 500, "keep": true, "async": true});
});
actions.push({"type": "waitAsync"});
core.insertAction(actions);
}
@ -1206,13 +1155,13 @@ control.prototype.updateDamage = function (floorId, canvas) {
var width = core.floors[floorId].width, height = core.floors[floorId].height;
for (var x=0;x<width;x++) {
for (var y=0;y<height;y++) {
var damage = core.status.checkBlock.damage[x+width*y];
var damage = core.status.checkBlock.damage[x+","+y];
if (damage>0) { // 该点伤害
damage = core.formatBigNumber(damage, true);
core.fillBoldText(canvas, damage, 32*x+16, 32*(y+1)-14, '#FF7F00');
}
else { // 检查捕捉
if ((core.status.checkBlock.ambush||[])[x+width*y]) {
if (core.status.checkBlock.ambush[x+","+y]) {
core.fillBoldText(canvas, '!', 32*x+16, 32*(y+1)-14, '#FF7F00');
}
}

View File

@ -250,14 +250,9 @@ events.prototype.doSystemEvent = function (type, data, callback) {
}
////// 触发(x,y)点的事件 //////
events.prototype.trigger = function (x, y) {
// 如果已经死亡,忽略
if (core.status.gameOver) return;
// 如果正在自定义事件中,则插入
if (core.status.event.id == 'action') {
core.insertAction({"type": "trigger", "loc": [x, y]});
return;
}
events.prototype._trigger = function (x, y) {
// 如果已经死亡,或正处于某事件中,则忽略
if (core.status.gameOver || core.status.event.id) return;
core.status.isSkiing = false;
var block = core.getBlock(x, y);
@ -690,7 +685,7 @@ events.prototype._sys_action = function (data, callback) {
var ev = core.clone(data.event.data), ex = data.x, ey = data.y;
// 检查是否需要改变朝向
if (ex == core.nextX() && ey == core.nextY()) {
var dir = {"up": "down", "down": "up", "left": "right", "right": "left"}[core.getHeroLoc('direction')];
var dir = core.reverseDirection();
var id = data.event.id, toId = (data.event.faceIds || {})[dir];
if (toId && id != toId) {
var number = core.icons.getNumberById(toId);
@ -1817,10 +1812,10 @@ events.prototype._eventMoveHero_moving = function (step, moveSteps) {
if (direction == 'forward' || direction == 'backward') direction = core.getHeroLoc('direction');
core.setHeroLoc('direction', direction);
if (step <= 4) {
core.drawHero(direction, x, y, 'leftFoot', 4 * o * step);
core.drawHero('leftFoot', 4 * o * step);
}
else if (step <= 8) {
core.drawHero(direction, x, y, 'rightFoot', 4 * o * step);
core.drawHero('rightFoot', 4 * o * step);
}
if (step == 8) {
core.setHeroLoc('x', x + o * core.utils.scan[direction].x, true);

View File

@ -416,7 +416,7 @@ maps.prototype._canMoveHero_checkPoint = function (x, y, direction, floorId, ext
// 3. 检查是否能进将死的领域
if (floorId == core.status.floorId
&& core.status.hero.hp <= core.status.checkBlock.damage[nx + core.bigmap.width * ny]
&& core.status.hero.hp <= (core.status.checkBlock.damage[nx + "," + ny]||0)
&& !core.flags.canGoDeadZone && extraData.eventArray[ny][nx] == 0)
return false;
@ -460,7 +460,7 @@ maps.prototype._canMoveDirectly_checkGlobal = function () {
}
maps.prototype._canMoveDirectly_checkStartPoint = function (sx, sy) {
if (core.status.checkBlock.damage[sx + core.bigmap.width * sy] > 0) return false;
if (core.status.checkBlock.damage[sx + "," + sy]) return false;
var block = core.getBlock(sx, sy);
if (block != null) {
// 只有起点是传送点才是能无视
@ -498,9 +498,9 @@ maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y) {
// 该点是否有事件
if (blocksObj[index]) return false;
// 是否存在阻激夹域伤害
if (core.status.checkBlock.damage[x + core.bigmap.width * y] > 0) return false;
if (core.status.checkBlock.damage[x + "," + y]) return false;
// 是否存在捕捉
if (core.status.checkBlock.ambush[x + core.bigmap.width * y]) return false;
if (core.status.checkBlock.ambush[x + "," + y]) return false;
return true;
}
@ -568,9 +568,9 @@ maps.prototype._automaticRoute_deepAdd = function (x, y) {
// if (nextBlock.block.event.trigger == 'changeFloor') deepAdd+=10;
}
// 绕过存在伤害的地方
deepAdd += core.status.checkBlock.damage[x+","+y] * 100;
deepAdd += (core.status.checkBlock.damage[x+","+y]||0) * 100;
// 绕过捕捉
if ((core.status.checkBlock.ambush||[])[x+","+y]) deepAdd += 1000;
if (core.status.checkBlock.ambush[x+","+y]) deepAdd += 1000;
return deepAdd;
}

View File

@ -625,6 +625,11 @@ utils.prototype.strlen = function (str) {
return count;
};
utils.prototype.reverseDirection = function (direction) {
direction = direction || core.getHeroLoc('direction');
return {"left":"right","right":"left","down":"up","up":"down"}[direction] || direction;
}
////// Base64加密 //////
utils.prototype.encodeBase64 = function (str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {

View File

@ -181,7 +181,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// ------ 支援技能 ------ //
if (x != null && y != null) {
var index = x + "," + y,
cache = (core.status.checkBlock.cache || {})[index] || {},
cache = core.status.checkBlock.cache[index] || {},
guards = cache.guards || [];
// 如果存在支援怪
if (guards.length > 0) {
@ -507,7 +507,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// ------ 支援 ------
var guards = [];
// 检查光环缓存
if (!core.status.checkBlock.cache) core.status.checkBlock.cache = {};
var index = x != null && y != null ? (x + "," + y) : "floor";
var cache = core.status.checkBlock.cache[index];
if (!cache) {
@ -1014,47 +1013,32 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
floorId = floorId || core.status.floorId;
if (!floorId || !core.status.maps) return;
var blocks = core.status.maps[floorId].blocks;
var width = core.floors[floorId].width, height = core.floors[floorId].height;
var width = core.floors[floorId].width,
height = core.floors[floorId].height;
var blocks = core.getMapBlocksObj(floorId);
core.status.checkBlock = {};
var damage = {}, // 每个点的伤害值
type = {}, // 每个点的伤害类型
snipe = {}, // 每个点的阻击怪信息
ambush = {}; // 每个点的捕捉信息
// Step1: 更新怪物地图
core.status.checkBlock.map = []; // 记录怪物地图
for (var n = 0; n < blocks.length; n++) {
var block = blocks[n];
if (!block.disable && block.event.cls.indexOf('enemy') == 0) {
var id = block.event.id,
// 计算血网和领域、阻击、激光的伤害,计算捕捉信息
for (var loc in blocks) {
var block = blocks[loc],
x = block.x,
y = block.y,
id = block.event.id,
enemy = core.material.enemys[id];
if (enemy) core.status.checkBlock.map[block.x + width * block.y] = id;
}
// 血网
if (!block.disable &&
block.event.id == 'lavaNet' && block.event.trigger == 'passNet' && !core.hasItem("shoes")) {
core.status.checkBlock.map[block.x + width * block.y] = "lavaNet";
}
if (id == 'lavaNet' && block.event.trigger == 'passNet' && !core.hasItem('shoes')) {
damage[loc] = (damage[loc] || 0) + core.values.lavaDamage;
type[loc] = "血网伤害";
}
// Step2: 更新领域、阻击伤害
core.status.checkBlock.damage = []; // 记录(x,y)点的伤害;(x,y)对应的值是 x+width*y
for (var x = 0; x < width * height; x++) core.status.checkBlock.damage[x] = 0;
core.status.checkBlock.ambush = [];
for (var x = 0; x < width; x++) {
for (var y = 0; y < height; y++) {
var id = core.status.checkBlock.map[x + width * y];
if (id) {
// 如果是血网,直接加上伤害值
if (id == "lavaNet") {
core.status.checkBlock.damage[x + 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")) {
if (enemy && core.hasSpecial(enemy.special, 15) && !core.hasFlag('no_zone')) {
// 领域范围默认为1
var range = enemy.range || 1;
// 是否是九宫格领域
@ -1065,96 +1049,118 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
for (var dy = -range; dy <= range; dy++) {
if (dx == 0 && dy == 0) continue;
var nx = x + dx,
ny = y + dy;
ny = y + dy,
currloc = nx + "," + ny;
if (nx < 0 || nx >= width || ny < 0 || ny >= height) continue;
// 如果是十字领域,则还需要满足 |dx|+|dy|<=range
if (!zoneSquare && Math.abs(dx) + Math.abs(dy) > range) continue;
core.status.checkBlock.damage[nx + ny * width] += enemy.value || 0;
damage[currloc] = (damage[currloc] || 0) + (enemy.value || 0);
type[currloc] = "领域伤害";
}
}
}
// 存在激光
// 阻击
// 如果要防止阻击伤害,可以直接简单的将 flag:no_snipe 设为true
if (enemy && core.hasSpecial(enemy.special, 18) && !core.hasFlag('no_snipe')) {
for (var dir in core.utils.scan) {
var nx = x + core.utils.scan[dir].x,
ny = y + core.utils.scan[dir].y,
currloc = nx + "," + ny;
if (nx < 0 || nx >= width || ny < 0 || ny >= height) continue;
damage[currloc] = (damage[currloc] || 0) + (enemy.value || 0);
type[currloc] = "阻击伤害";
var rdir = core.reverseDirection(dir);
// 检查下一个点是否存在事件(从而判定是否移动)
var rnx = x + core.utils.scan[rdir].x,
rny = y + core.utils.scan[rdir].y;
if (rnx >= 0 && rnx < width && rny >= 0 && rny < height && core.getBlock(rnx, rny, floorId) == null) {
snipe[currloc] = (snipe[currloc] || []).concat([
[x, y, id, rdir]
]);
}
}
}
// 激光
// 如果要防止激光伤害,可以直接简单的将 flag:no_laser 设为true
if (core.enemys.hasSpecial(enemy.special, 24) && !core.hasFlag("no_laser")) {
// 检查同行和同列,增加激光伤害值
if (enemy && core.hasSpecial(enemy.special, 24) && !core.hasFlag("no_laser")) {
for (var nx = 0; nx < width; nx++) {
if (nx != x) core.status.checkBlock.damage[nx + y * width] += enemy.value || 0;
var currloc = nx + "," + y;
if (nx != x) {
damage[currloc] = (damage[currloc] || 0) + (enemy.value || 0);
type[currloc] = "激光伤害";
}
}
for (var ny = 0; ny < height; ny++) {
if (ny != y) core.status.checkBlock.damage[x + ny * 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 >= width || ny < 0 || ny >= height || Math.abs(dx) + Math.abs(dy) > 1) continue;
core.status.checkBlock.damage[nx + ny * width] += enemy.value || 0;
var currloc = x + "," + ny;
if (ny != y) {
damage[currloc] = (damage[currloc] || 0) + (enemy.value || 0);
type[currloc] = "激光伤害";
}
}
}
// 存在捕捉
if (core.enemys.hasSpecial(enemy.special, 27)) {
// 捕捉
// 如果要防止捕捉效果,可以直接简单的将 flag:no_ambush 设为true
if (enemy && core.enemys.hasSpecial(enemy.special, 27)) {
// 给周围格子加上【捕捉】记号
for (var dir in core.utils.scan) {
var nx = x + core.utils.scan[dir].x,
ny = y + core.utils.scan[dir].y;
ny = y + core.utils.scan[dir].y,
currloc = nx + "," + ny;
if (nx < 0 || nx >= width || ny < 0 || ny >= height) continue;
if (!core.status.checkBlock.ambush[nx + ny * width])
core.status.checkBlock.ambush[nx + ny * width] = [];
core.status.checkBlock.ambush[nx + ny * width].push([x, y, id, dir]);
ambush[currloc] = (ambush[currloc] || []).concat([
[x, y, id, dir]
]);
}
}
}
// 更新夹击伤害
// 如果要防止夹击伤害,可以简单的将 flag:no_betweenAttack 设为true
if (!core.hasFlag('no_betweenAttack')) {
for (var x = 0; x < width; x++) {
for (var y = 0; y < height; y++) {
var loc = x + "," + y;
// 夹击怪物的ID
var enemyId = null;
// 检查左右夹击
var leftBlock = blocks[(x - 1) + "," + y],
rightBlock = blocks[(x + 1) + "," + y];
if (leftBlock && rightBlock && leftBlock.id == rightBlock.id) {
if (core.hasSpecial(leftBlock.event.id, 16))
enemyId = leftBlock.event.id;
}
// 检查上下夹击
var topBlock = block[x + "," + (y - 1)],
bottomBlock = blocks[x + "," + (y + 1)];
if (topBlock && bottomBlock && topBlock.id == bottomBlock.id) {
if (core.hasSpecial(topBlock.event.id, 16))
enemyId = topBlock.event.id;
}
if (enemyId != null) {
var leftHp = core.status.hero.hp - (damage[x + "," + y] || 0);
if (leftHp > 1) {
// 上整/下整
var value = Math.floor((leftHp + (core.flags.betweenAttackCeil ? 0 : 1)) / 2);
damage[loc] = (damage[loc] || 0) + value;
type[loc] = "夹击伤害";
}
}
}
}
}
// Step3: 更新夹击点坐标并将夹击伤害加入到damage中
core.status.checkBlock.betweenAttack = []; // 记录(x,y)点是否有夹击
// 如果要防止夹击伤害,可以简单的将 flag:no_betweenAttack 设为true
if (!core.hasFlag('no_betweenAttack')) {
for (var x = 0; x < width; x++) {
for (var y = 0; y < height; y++) {
// 该点是否存在夹击
var has = false;
// 检测左右是否存在相同的怪物,且拥有夹击属性
if (x > 0 && x < width - 1) {
var id1 = core.status.checkBlock.map[x - 1 +width * y],
id2 = core.status.checkBlock.map[x + 1 + width * y];
if (id1 != null && id2 != null && id1 == id2) {
var enemy = core.material.enemys[id1];
if (enemy && core.enemys.hasSpecial(enemy.special, 16)) {
has = true;
}
}
}
// 检测上下是否存在相同的怪物,且拥有夹击属性
if (y > 0 && y < height - 1) {
var id1 = core.status.checkBlock.map[x + width * (y - 1)],
id2 = core.status.checkBlock.map[x + width * (y + 1)];
if (id1 != null && id2 != null && id1 == id2) {
var enemy = core.material.enemys[id1];
if (enemy && core.enemys.hasSpecial(enemy.special, 16)) {
has = true;
}
}
}
// 计算夹击伤害
if (has) {
core.status.checkBlock.betweenAttack[x + width * y] = true;
// 先扣除该点领域/阻击/激光造成的伤害,再算夹击
var leftHp = core.status.hero.hp - core.status.checkBlock.damage[x + width * y];
// 1血不夹core.flags.betweenAttackCeil控制向上还是向下
if (leftHp > 1)
core.status.checkBlock.damage[x + width * y] += Math.floor((leftHp + (core.flags.betweenAttackCeil ? 0 : 1)) / 2);
}
}
}
}
core.status.checkBlock = {
damage: damage,
type: type,
snipe: snipe,
ambush: ambush,
cache: {}
};
},
"moveOneStep": function (x, y) {
// 勇士每走一步后执行的操作x,y为要移动到的坐标。