feat: 勇士显伤

This commit is contained in:
hunhou001 committed 2023-09-27 12:14:05 +08:00
1 parent c242018ee8
commit b3e3ae5f8e
3 files changed
+47

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
function drawHeroDetail(px: number, py: number) {
if (!core.getLocalStorage('heroDetail', false)) return;
const { hp, atk, def } = core.status.hero;
const toDraw = {
atk: {
value: atk,
color: '#FF7A7A'
},
def: {
value: def,
color: '#00E6F1'
},
hp: {
value: hp,
color: '#F9FFFF0'
}
};
let i = 0;
for (const [key, value] of Object.entries(toDraw)) {
const ctx = core.canvas['hero'].canvas;
core.fillBoldText(
ctx,
value.value.toString(),
px,
py - 10 * i,
value.color as string
);
i++;
}
}
export { drawHeroDetail };
+6
View File
@@ -13,11 +13,17 @@ import {
setShadowNodes
} from './shadow';
import { pColor } from '../utils';
import { drawHeroDetail } from '../game/fx/heroDetail';
export default function init() {
const origin4 = control.prototype.drawHero;
control.prototype.drawHero = function () {
origin4.apply(core.control, arguments);
drawHeroDetail(
core.status.heroCenter.px - 16,
core.status.heroCenter.py + 20
);
if (core.getFlag('__heroOpacity__') !== 0) {
getAllLights().forEach(v => {
if (!v.followHero) return;