修复图片加载bug

This commit is contained in:
unanmed 2023-06-30 21:24:14 +08:00
parent 3bdb668c5f
commit c25f0d7c15
7 changed files with 39 additions and 9 deletions

6
.gitignore vendored
View File

@ -36,4 +36,8 @@ index.cjs
_bundle
out
dist-resource
_temp
_temp
dam1.png
dam2.png
dam3.png
dam4.png

View File

@ -58,3 +58,10 @@
- 满腹经纶:把所有能学的怪物技能都学一遍
- 冰与火之舞:通过第二章特殊战的困难难度
- 你是怎么做到的?!:山路地图与勇气之路地图中与若干个神秘的木牌对话
### 伤害对应
dam1.png ---- 存档 404
dam2.png ---- 存档 285
dam3.png ---- 存档 243
dam4.png ---- 存档 59

View File

@ -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);
};
////// 检查并执行领域、夹击、阻击事件 //////

View File

@ -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);
};
////// 获得在某个勇士属性下怪物伤害 //////

View File

@ -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__') {

View File

@ -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
};

View File

@ -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),