a26b29f9-1c56-42fb-a862-02ba6dff98a2.js 3.72 KB
"use strict";
cc._RF.push(module, 'a26b2n5HFZC+6hiArpt/5ii', 'BlockSkillFirework');
// scripts/kernel/battle/map/blockSkill/BlockSkillFirework.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlockSkillFirework = void 0;
var BattleConst_1 = require("../../BattleConst");
var BlockSkillBase_1 = require("./BlockSkillBase");
var BlockSkillFirework = /** @class */ (function (_super) {
    __extends(BlockSkillFirework, _super);
    function BlockSkillFirework(owner, type) {
        var _this = _super.call(this, type, owner) || this;
        if (type == BattleConst_1.BlockSkill.FIREWORK_VERTICAL) {
            _this._skillImg = 'UI_yxz_tsfk_pzjg';
        }
        else if (type == BattleConst_1.BlockSkill.FIREWORK_HORIZON) {
            _this._skillImg = 'UI_yxz_tsfk_pzjg2';
        }
        else if (type == BattleConst_1.BlockSkill.FIREWORK_DOUBLE) {
            _this._skillImg = 'UI_yxz_tsfk_pzjg3';
        }
        else {
            _this._skillImg = '';
        }
        return _this;
    }
    // onAddedToBlock(): void {
    //     this.owner.canSlide = false;
    // }
    BlockSkillFirework.prototype.onDead = function () {
        //清除对应方向的格子
        if (this.skillId == BattleConst_1.BlockSkill.FIREWORK_HORIZON || this.skillId == BattleConst_1.BlockSkill.FIREWORK_DOUBLE) {
            for (var x = 0; x < this.owner.map.mapGridSize.x; ++x) {
                if (x == this.owner.gridPos.x) {
                    continue;
                }
                var block = this.owner.map.getBlockByGridPos(x, this.owner.gridPos.y);
                var jump = (block && !block.isDead && block.skill && block.skill.skillId >= BattleConst_1.BlockSkill.FIREWORK_VERTICAL && block.skill.skillId <= BattleConst_1.BlockSkill.FIREWORK_DOUBLE);
                jump = (jump || (block && block.isProtected)); //增加被保护检测
                if (jump) {
                    continue; //不触发别的烟花
                }
                if (block && !block.isDead && block.isVisible) {
                    block.dead();
                }
            }
        }
        if (this.skillId == BattleConst_1.BlockSkill.FIREWORK_VERTICAL || this.skillId == BattleConst_1.BlockSkill.FIREWORK_DOUBLE) {
            for (var y = 0; y < this.owner.map.mapGridSize.y; ++y) {
                if (y == this.owner.gridPos.y) {
                    continue;
                }
                var block = this.owner.map.getBlockByGridPos(this.owner.gridPos.x, y);
                var jump = (block && !block.isDead && block.skill && block.skill.skillId >= BattleConst_1.BlockSkill.FIREWORK_VERTICAL && block.skill.skillId <= BattleConst_1.BlockSkill.FIREWORK_DOUBLE);
                jump = (jump || (block && block.isProtected)); //增加被保护检测
                if (jump) {
                    continue; //不触发别的烟花
                }
                if (block && !block.isDead && block.isVisible) {
                    block.dead();
                }
            }
        }
    };
    return BlockSkillFirework;
}(BlockSkillBase_1.BlockSkillBase));
exports.BlockSkillFirework = BlockSkillFirework;

cc._RF.pop();