feat: 苍蓝之殿上半部分完成 & fix: 缩略图显伤 & fix: 字体调整

This commit is contained in:
AncTe committed 2024-09-29 15:43:53 +08:00
1 parent d11699e06e
commit c142cfca88
20 files changed
+484 -89

No files matched your search

+9 -4
View File
@@ -150,7 +150,7 @@ export class Damage extends Sprite<EDamageEvent> {
/** 伤害渲染层 */
damageMap: MotaOffscreenCanvas2D = new MotaOffscreenCanvas2D();
/** 默认伤害字体 */
font: string = "14px 'normal'";
font: string = '300 9px Verdana';
/** 默认描边样式,当伤害文字不存在描边属性时会使用此属性 */
strokeStyle: CanvasStyle = '#000';
/** 默认描边宽度 */
@@ -347,7 +347,7 @@ export class Damage extends Sprite<EDamageEvent> {
text: real.togetherNum.toString(),
color: '#09FF5B',
x: x * this.cellSize + this.cellSize - 1,
y: y * this.cellSize - 2,
y: y * this.cellSize + 2,
strokeWidth: 3
};
block.add(dam3);
@@ -359,8 +359,9 @@ export class Damage extends Sprite<EDamageEvent> {
text: '乾',
color: '#FDCD0B',
x: x * this.cellSize + 1,
y: y * this.cellSize - 2,
strokeWidth: 2
y: y * this.cellSize + 2,
strokeWidth: 2,
font: '500 10px Verdana'
};
block.add(dam4);
}
@@ -408,6 +409,7 @@ export class Damage extends Sprite<EDamageEvent> {
// todo: 这个应当可以自定义,通过地图伤害注册实现
let text = '';
let color = '#fa3';
let font = '300 9px Verdana';
if (dam.damage > 0) {
text = core.formatBigNumber(dam.damage, true);
} else if (dam.mockery) {
@@ -418,9 +420,11 @@ export class Damage extends Sprite<EDamageEvent> {
const dir = x > tx ? '←' : x < tx ? '→' : y > ty ? '↑' : '↓';
text = '嘲' + dir;
color = '#fd4';
font = '500 11px Verdana';
} else if (dam.hunt) {
text = '猎';
color = '#fd4';
font = '500 11px Verdana';
} else {
return;
}
@@ -430,6 +434,7 @@ export class Damage extends Sprite<EDamageEvent> {
baseline: 'middle',
text,
color,
font,
x: x * this.cellSize + this.cellSize / 2,
y: y * this.cellSize + this.cellSize / 2
};
+1 -1
View File
@@ -284,7 +284,7 @@
"<br>",
"5. <span style=\"color: lightcoral\">当前勇士的攻击</span>,右方偏下为勇士的额外攻击",
"<br>",
"6. <span style=\"color: lightblue\">当前勇士的防御</span>",
"6. <span style=\"color: lightblue\">当前勇士的防御</span>,当有魔法防御时,右方偏下为勇士的魔法防御",
"<br>",
"7. <span style=\"color: lightgreen\">当前勇士的智慧</span>,可以用于智慧加点等",
"<br>",
+1
View File
@@ -139,6 +139,7 @@ export class EnemyCollection
this.list = [];
core.extractBlocks(this.floorId);
core.status.maps[this.floorId].blocks.forEach(v => {
if (v.disable) return;
if (v.event.cls !== 'enemy48' && v.event.cls !== 'enemys') return;
const enemy = core.material.enemys[v.event.id as EnemyIds];
this.list.push(
+103 -3
View File
@@ -1,7 +1,12 @@
import { ensureFloorDamage } from '@/game/enemy/damage';
import { EnemyCollection, ensureFloorDamage } from '@/game/enemy/damage';
import { checkV2, formatDamage } from '../utils';
export function init() {
core.control.updateDamage = function (floorId = core.status.floorId, ctx) {
core.control.updateDamage = function (
floorId = core.status.floorId,
ctx,
thumbnail: boolean = false
) {
if (!floorId || core.status.gameOver || main.mode !== 'play') return;
const onMap = ctx == null;
const floor = core.status.maps[floorId];
@@ -28,6 +33,101 @@ export function init() {
// floor.enemy.render(true);
// getItemDetail(floorId, onMap); // 宝石血瓶详细信息
// this.drawDamage(ctx, floorId);
if (thumbnail) {
renderThumbnailDamage(floor.enemy);
this.drawDamage(ctx, floorId);
}
};
}
function renderThumbnailDamage(col: EnemyCollection) {
core.status.damage.data = [];
core.status.damage.extraData = [];
core.status.damage.dir = [];
// 怪物伤害
col.list.forEach(v => {
const { damage } = v.calDamage();
// 伤害全部相等,绘制在怪物本身所在位置
const { damage: dam, color } = formatDamage(damage);
const critical = v.calCritical(1)[0];
core.status.damage.data.push({
text: dam,
px: 32 * v.x! + 1,
py: 32 * (v.y! + 1) - 1,
color: color
});
const setting = Mota.require('var', 'mainSetting');
const criGem = setting.getValue('screen.criticalGem', false);
const n = critical?.atkDelta ?? Infinity;
const ratio = core.status.maps[col.floorId].ratio;
const cri = criGem ? Math.ceil(n / ratio) : n;
core.status.damage.data.push({
text: isFinite(cri) ? cri.toString() : '?',
px: 32 * v.x! + 1,
py: 32 * (v.y! + 1) - 11,
color: '#fff'
});
});
// 地图伤害
const floor = core.status.maps[col.floorId];
const width = floor.width;
const height = floor.height;
const objs = core.getMapBlocksObj(col.floorId);
const startX = 0;
const endX = width;
const startY = 0;
const endY = height;
for (let x = startX; x < endX; x++) {
for (let y = startY; y < endY; y++) {
const id = `${x},${y}` as LocString;
const dam = col.mapDamage[id];
if (!dam || objs[id]?.event.noPass) continue;
// 地图伤害
if (dam.damage !== 0) {
const damage = core.formatBigNumber(dam.damage, true);
const color = dam.damage < 0 ? '#6eff6a' : '#fa3';
core.status.damage.extraData.push({
text: damage,
px: 32 * x + 16,
py: 32 * y + 16,
color,
alpha: 1
});
}
// 电摇嘲讽
if (dam.mockery) {
dam.mockery.sort((a, b) =>
a[0] === b[0] ? a[1] - b[1] : a[0] - b[0]
);
const [tx, ty] = dam.mockery[0];
const dir = x > tx ? '←' : x < tx ? '→' : y > ty ? '↑' : '↓';
core.status.damage.extraData.push({
text: '嘲' + dir,
px: 32 * x + 16,
py: 32 * (y + 1) - 14,
color: '#fd4',
alpha: 1
});
}
// 追猎
if (dam.hunt) {
core.status.damage.extraData.push({
text: '猎',
px: 32 * x + 16,
py: 32 * (y + 1) - 14,
color: '#fd4',
alpha: 1
});
}
}
}
}
+5 -4
View File
@@ -19,7 +19,7 @@ var ignoreInJump = {
]
};
export const jumpIgnoreFloor: FloorIds[] = [
export const jumpIgnoreFloor: Set<FloorIds> = new Set([
'MT31',
'snowTown',
'MT36',
@@ -45,14 +45,15 @@ export const jumpIgnoreFloor: FloorIds[] = [
'MT73',
'MT74',
'MT75',
'MT84'
];
'MT84',
'MT93'
]);
// 跳跃
export function jumpSkill() {
if (core.status.floorId.startsWith('tower')) {
return core.drawTip('当前无法使用该技能');
}
if (jumpIgnoreFloor.includes(core.status.floorId) || flags.onChase) {
if (jumpIgnoreFloor.has(core.status.floorId) || flags.onChase) {
return core.drawTip('当前楼层无法使用该技能');
}
if (!flags.skill2) return;
+1 -1
View File
@@ -157,7 +157,7 @@ export const skills: Record<Chapter, Skill[]> = {
],
loc: [4, 1],
max: 10,
effect: level => [`学习怪物技能,持续${level * 3 + 2}场战斗`]
effect: level => [`魔法防御 + ${level * 100}`]
},
{
index: 12,
+2 -2
View File
@@ -189,8 +189,8 @@ interface ItemDeclaration {
I642: 'constants';
I662: 'equips';
I663: 'equips';
I664: 'items';
I665: 'items';
I664: 'equips';
I665: 'equips';
I694: 'items';
I695: 'items';
I696: 'items';
+1 -1
View File
@@ -146,7 +146,7 @@ const effect = computed(() => {
return [0, 1].map(v => {
const prefix = v === 0 ? '当前效果:' : '下一级效果:';
const level = skillTree.getSkillLevel(skill.value.index);
const content = skill.value.effect(level);
const content = skill.value.effect(level + v);
return prefix + content.join('');
}) as [string, string];
});
+1 -3
View File
@@ -212,9 +212,7 @@ function update() {
studyOpened.value = skillTree.getSkillLevel(11) > 0;
jumpCnt.value =
flags.skill2 &&
!Mota.Plugin.require('skill_g').jumpIgnoreFloor.includes(
core.status.floorId
)
!Mota.Plugin.require('skill_g').jumpIgnoreFloor.has(core.status.floorId)
? 3 - (flags[`jump_${core.status.floorId}`] ?? 0)
: void 0;
}