diff --git a/.gitignore b/.gitignore index 4d12667..ee99aeb 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,8 @@ index.cjs _bundle out dist-resource -_temp \ No newline at end of file +_temp +dam1.png +dam2.png +dam3.png +dam4.png \ No newline at end of file diff --git a/idea.md b/idea.md index 9a41816..6251004 100644 --- a/idea.md +++ b/idea.md @@ -58,3 +58,10 @@ - 满腹经纶:把所有能学的怪物技能都学一遍 - 冰与火之舞:通过第二章特殊战的困难难度 - 你是怎么做到的?!:山路地图与勇气之路地图中与若干个神秘的木牌对话 + +### 伤害对应 + +dam1.png ---- 存档 404 +dam2.png ---- 存档 285 +dam3.png ---- 存档 243 +dam4.png ---- 存档 59 diff --git a/public/libs/control.js b/public/libs/control.js index 77d198e..cf25044 100644 --- a/public/libs/control.js +++ b/public/libs/control.js @@ -1450,7 +1450,8 @@ control.prototype._moveDirectyFollowers = function (x, y) { ////// 更新领域、夹击、阻击的伤害地图 ////// control.prototype.updateCheckBlock = function (floorId) { - throw new Error(`This function has been deprecated.`); + // throw new Error(`This function has been deprecated.`); + return this.controldata.updateCheckBlock(floorId); }; ////// 检查并执行领域、夹击、阻击事件 ////// diff --git a/public/libs/enemys.js b/public/libs/enemys.js index 0763d62..e0450a1 100644 --- a/public/libs/enemys.js +++ b/public/libs/enemys.js @@ -414,12 +414,19 @@ enemys.prototype.getDefDamage = function (enemy, k, x, y, floorId, hero) { }; enemys.prototype.getEnemyInfo = function (enemy, hero, x, y, floorId) { - throw new Error(`This function has been deprecated.`); + // throw new Error(`This function has been deprecated.`); + if (enemy == null) return null; + if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; + return this.enemydata.getEnemyInfo(enemy, hero, x, y, floorId); }; ////// 获得战斗伤害信息(实际伤害计算函数) ////// enemys.prototype.getDamageInfo = function (enemy, hero, x, y, floorId) { - throw new Error(`This function has been deprecated.`); + // throw new Error(`This function has been deprecated.`); + if (enemy == null) return null; + // 移动到了脚本编辑 - getDamageInfo中 + if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; + return this.enemydata.getDamageInfo(enemy, hero, x, y, floorId); }; ////// 获得在某个勇士属性下怪物伤害 ////// diff --git a/src/core/loader/resource.ts b/src/core/loader/resource.ts index c8501f6..dcb8182 100644 --- a/src/core/loader/resource.ts +++ b/src/core/loader/resource.ts @@ -115,6 +115,10 @@ export class Resource< ); }); }); + } else if (this.format === 'image') { + const img = v as HTMLImageElement; + img.setAttribute('_width', img.width.toString()); + img.setAttribute('_height', img.height.toString()); } if (this.name === '__all_animates__') { diff --git a/src/plugin/game/damage.ts b/src/plugin/game/damage.ts index 5efdd4a..25a5bb9 100644 --- a/src/plugin/game/damage.ts +++ b/src/plugin/game/damage.ts @@ -672,11 +672,17 @@ export function calDamageWith( return damage; } +export function initFloorDamage(floorId: FloorIds) { + const floor = core.status.maps[floorId]; + floor.enemy = new EnemyCollection(floorId); +} + declare global { interface PluginDeclaration { damage: { Enemy: typeof DamageEnemy; Collection: typeof EnemyCollection; + initFloorDamage: typeof initFloorDamage; }; } @@ -687,5 +693,6 @@ declare global { core.plugin.damage = { Enemy: DamageEnemy, - Collection: EnemyCollection + Collection: EnemyCollection, + initFloorDamage }; diff --git a/src/plugin/game/fiveLayer.js b/src/plugin/game/fiveLayer.js index 8c95842..0fc4f04 100644 --- a/src/plugin/game/fiveLayer.js +++ b/src/plugin/game/fiveLayer.js @@ -101,7 +101,7 @@ if (main.mode == 'editor') { parent.appendChild(input2); } } -core.maps._loadFloor_doNotCopy = function () { +maps.prototype._loadFloor_doNotCopy = function () { return [ 'firstArrive', 'eachArrive', @@ -121,7 +121,7 @@ core.maps._loadFloor_doNotCopy = function () { ]; }; ////// 绘制背景和前景层 ////// -core.maps._drawBg_draw = function (floorId, toDrawCtx, cacheCtx, config) { +maps.prototype._drawBg_draw = function (floorId, toDrawCtx, cacheCtx, config) { config.ctx = cacheCtx; core.maps._drawBg_drawBackground(floorId, config); // ------ 调整这两行的顺序来控制是先绘制贴图还是先绘制背景图块;后绘制的覆盖先绘制的。 @@ -154,7 +154,7 @@ core.maps._drawBg_draw = function (floorId, toDrawCtx, cacheCtx, config) { ); config.ctx = toDrawCtx; }; -core.maps._drawFg_draw = function (floorId, toDrawCtx, cacheCtx, config) { +maps.prototype._drawFg_draw = function (floorId, toDrawCtx, cacheCtx, config) { config.ctx = cacheCtx; // ------ 调整这两行的顺序来控制是先绘制贴图还是先绘制前景图块;后绘制的覆盖先绘制的。 core.maps._drawFloorImages( @@ -187,7 +187,7 @@ core.maps._drawFg_draw = function (floorId, toDrawCtx, cacheCtx, config) { config.ctx = toDrawCtx; }; ////// 移动判定 ////// -core.maps._generateMovableArray_arrays = function (floorId) { +maps.prototype._generateMovableArray_arrays = function (floorId) { return { bgArray: this.getBgMapArray(floorId), fgArray: this.getFgMapArray(floorId),