mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-12-01 23:04:30 +08:00
feat: 战斗
This commit is contained in:
1 parent
c8e45f2a22
commit
6ce86501f1
15 files changed
+656
-500
No files matched your search
@@ -19,11 +19,14 @@
|
||||
class="special-text"
|
||||
v-if="has(enemy.special) && enemy.special.length > 0"
|
||||
>
|
||||
<span
|
||||
v-for="(text, i) in enemy.showSpecial"
|
||||
:style="{ color: text[2] }"
|
||||
> {{ text[0] }} </span
|
||||
>
|
||||
<template v-for="(text, i) in enemy.showSpecial">
|
||||
<span
|
||||
v-if="i < (isMobile ? 1 : 2)"
|
||||
:style="{ color: text[2] }"
|
||||
> {{ text[0] }} </span
|
||||
>
|
||||
<span v-if="i === (isMobile ? 1 : 2)">...</span>
|
||||
</template>
|
||||
</div>
|
||||
<div class="special-text" v-else>无属性</div>
|
||||
</div>
|
||||
|
||||
@@ -58,116 +58,6 @@ function init() {
|
||||
callback?.();
|
||||
};
|
||||
|
||||
core.events.afterBattle = function afterBattle(
|
||||
enemy: DamageEnemy,
|
||||
x?: number,
|
||||
y?: number
|
||||
) {
|
||||
const floorId = core.status.floorId;
|
||||
const special = enemy.info.special;
|
||||
|
||||
// 播放战斗动画
|
||||
let animate: AnimationIds = 'hand';
|
||||
// 检查当前装备是否存在攻击动画
|
||||
const equipId = core.getEquip(0);
|
||||
if (equipId && (core.material.items[equipId].equip || {}).animate)
|
||||
animate = core.material.items[equipId].equip.animate;
|
||||
|
||||
// 检查该动画是否存在SE,如果不存在则使用默认音效
|
||||
if (!core.material.animates[animate]?.se) core.playSound('attack.mp3');
|
||||
|
||||
// 战斗伤害
|
||||
const info = enemy.calDamage(core.status.hero);
|
||||
const damage = info.damage;
|
||||
// 判定是否致死
|
||||
if (damage >= core.status.hero.hp) {
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar(false, true);
|
||||
core.events.lose('战斗失败');
|
||||
return;
|
||||
}
|
||||
|
||||
// 扣减体力值并记录统计数据
|
||||
core.status.hero.hp -= damage;
|
||||
core.status.hero.statistics.battleDamage += damage;
|
||||
core.status.hero.statistics.battle++;
|
||||
|
||||
// 智慧之源
|
||||
if (special.includes(14) && flags.hard === 2) {
|
||||
core.addFlag(
|
||||
'inte_' + floorId,
|
||||
Math.ceil((core.status.hero.mdef / 10) * 0.3) * 10
|
||||
);
|
||||
core.status.hero.mdef -=
|
||||
Math.ceil((core.status.hero.mdef / 10) * 0.3) * 10;
|
||||
}
|
||||
|
||||
// 极昼永夜
|
||||
if (special.includes(22)) {
|
||||
flags[`night_${floorId}`] ??= 0;
|
||||
flags[`night_${floorId}`] -= enemy.enemy.night!;
|
||||
}
|
||||
if (special.includes(23)) {
|
||||
flags[`night_${floorId}`] ??= 0;
|
||||
flags[`night_${floorId}`] += enemy.enemy.day;
|
||||
}
|
||||
|
||||
// if (core.plugin.skillTree.getSkillLevel(11) > 0) {
|
||||
// core.plugin.study.declineStudiedSkill();
|
||||
// }
|
||||
|
||||
// 如果是融化怪,需要特殊标记一下
|
||||
if (special.includes(25) && has(x) && has(y)) {
|
||||
flags[`melt_${floorId}`] ??= {};
|
||||
flags[`melt_${floorId}`][`${x},${y}`] = enemy.enemy.melt;
|
||||
}
|
||||
|
||||
// 获得金币
|
||||
const money = enemy.enemy.money;
|
||||
core.status.hero.money += money;
|
||||
core.status.hero.statistics.money += money;
|
||||
|
||||
// 获得经验
|
||||
const exp = enemy.enemy.exp;
|
||||
core.status.hero.exp += exp;
|
||||
core.status.hero.statistics.exp += exp;
|
||||
|
||||
const hint =
|
||||
'打败 ' + enemy.enemy.name + ',金币+' + money + ',经验+' + exp;
|
||||
core.drawTip(hint, enemy.id);
|
||||
|
||||
if (core.getFlag('bladeOn') && core.getFlag('blade')) {
|
||||
core.setFlag('blade', false);
|
||||
}
|
||||
if (core.getFlag('shieldOn') && core.getFlag('shield')) {
|
||||
core.setFlag('shield', false);
|
||||
}
|
||||
|
||||
// 事件的处理
|
||||
const todo: MotaEvent = [];
|
||||
|
||||
// 战后事件
|
||||
if (has(core.status.floorId)) {
|
||||
const loc = `${x},${y}` as LocString;
|
||||
todo.push(
|
||||
...(core.floors[core.status.floorId].afterBattle[loc] ?? [])
|
||||
);
|
||||
}
|
||||
todo.push(...(enemy.enemy.afterBattle ?? []));
|
||||
|
||||
// 如果事件不为空,将其插入
|
||||
if (todo.length > 0) core.insertAction(todo, x, y);
|
||||
|
||||
if (has(x) && has(y)) {
|
||||
core.drawAnimate(animate, x, y);
|
||||
core.removeBlock(x, y);
|
||||
} else core.drawHeroAnimate(animate);
|
||||
|
||||
// 如果已有事件正在处理中
|
||||
if (core.status.event.id == null) core.continueAutomaticRoute();
|
||||
else core.clearContinueAutomaticRoute();
|
||||
};
|
||||
|
||||
core.enemys.getCurrentEnemys = function getCurrentEnemys(
|
||||
floorId = core.status.floorId
|
||||
) {
|
||||
|
||||
+57
-199
@@ -14,9 +14,14 @@ interface HaloType {
|
||||
y: number;
|
||||
d: number;
|
||||
};
|
||||
manhattan: {
|
||||
x: number;
|
||||
y: number;
|
||||
d: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface EnemyInfo {
|
||||
interface EnemyInfo extends Partial<SelectType<Enemy, number | undefined>> {
|
||||
atk: number;
|
||||
def: number;
|
||||
hp: number;
|
||||
@@ -25,6 +30,7 @@ interface EnemyInfo {
|
||||
defBuff: number;
|
||||
hpBuff: number;
|
||||
enemy: Enemy;
|
||||
guard?: DamageEnemy[];
|
||||
x?: number;
|
||||
y?: number;
|
||||
floorId?: FloorIds;
|
||||
@@ -39,7 +45,8 @@ interface DamageInfo {
|
||||
interface MapDamage {
|
||||
damage: number;
|
||||
type: Set<string>;
|
||||
mockery?: LocArr[];
|
||||
repulse?: LocArr[];
|
||||
ambush?: DamageEnemy[];
|
||||
}
|
||||
|
||||
interface HaloData<T extends keyof HaloType = keyof HaloType> {
|
||||
@@ -103,6 +110,8 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
|
||||
this.haloList = [];
|
||||
this.list.forEach(v => {
|
||||
v.reset();
|
||||
});
|
||||
this.list.forEach(v => {
|
||||
v.preProvideHalo();
|
||||
});
|
||||
this.list.forEach(v => {
|
||||
@@ -146,21 +155,22 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
|
||||
applyHalo<K extends keyof HaloType>(
|
||||
type: K,
|
||||
data: HaloType[K],
|
||||
enemy: DamageEnemy,
|
||||
halo: HaloFn | HaloFn[],
|
||||
recursion: boolean = false
|
||||
) {
|
||||
const arr = ensureArray(halo);
|
||||
const enemy = this.range.scan(type, data);
|
||||
const enemys = this.range.scan(type, data);
|
||||
if (!recursion) {
|
||||
arr.forEach(v => {
|
||||
enemy.forEach(e => {
|
||||
e.injectHalo(v, e.enemy);
|
||||
enemys.forEach(e => {
|
||||
e.injectHalo(v, enemy.enemy);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
enemy.forEach(e => {
|
||||
enemys.forEach(e => {
|
||||
arr.forEach(v => {
|
||||
e.injectHalo(v, e.enemy);
|
||||
e.injectHalo(v, enemy.enemy);
|
||||
e.preProvideHalo();
|
||||
});
|
||||
});
|
||||
@@ -260,6 +270,26 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
|
||||
alpha: 1
|
||||
});
|
||||
}
|
||||
|
||||
if (dam.ambush) {
|
||||
core.status.damage.extraData.push({
|
||||
text: '!',
|
||||
px: 32 * x + 16,
|
||||
py: 32 * y + 16,
|
||||
color: '#fa3',
|
||||
alpha: 1
|
||||
});
|
||||
}
|
||||
|
||||
if (dam.repulse) {
|
||||
core.status.damage.extraData.push({
|
||||
text: '阻',
|
||||
px: 32 * x + 16,
|
||||
py: 32 * y + 16,
|
||||
color: '#fa3',
|
||||
alpha: 1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,8 +350,15 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
|
||||
y: this.y,
|
||||
floorId: this.floorId
|
||||
};
|
||||
|
||||
for (const [key, value] of Object.entries(enemy)) {
|
||||
if (!(key in this.info) && has(value)) {
|
||||
// @ts-ignore
|
||||
this.info[key] = value;
|
||||
}
|
||||
}
|
||||
this.progress = 0;
|
||||
this.providedHalo = new Set();
|
||||
this.providedHalo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,6 +418,7 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
|
||||
if (!this.floorId) return [];
|
||||
if (!has(this.x) || !has(this.y)) return [];
|
||||
const special = this.info.special ?? this.enemy.special;
|
||||
|
||||
const filter = special.filter(v => {
|
||||
return Damage.haloSpecials.has(v) && !this.providedHalo.has(v);
|
||||
});
|
||||
@@ -397,92 +435,12 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
|
||||
/**
|
||||
* 光环预提供,用于平衡所有怪的光环属性,避免出现不同情况下光环效果不一致的现象
|
||||
*/
|
||||
preProvideHalo() {
|
||||
if (this.progress !== 0) return;
|
||||
this.progress = 1;
|
||||
const special = this.getHaloSpecials();
|
||||
|
||||
for (const halo of special) {
|
||||
switch (halo) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
preProvideHalo() {}
|
||||
|
||||
/**
|
||||
* 向其他怪提供光环
|
||||
*/
|
||||
provideHalo() {
|
||||
if (this.progress !== 2) return;
|
||||
this.progress = 3;
|
||||
if (!this.floorId) return;
|
||||
if (!has(this.x) || !has(this.y)) return;
|
||||
const col = this.col ?? core.status.maps[this.floorId].enemy;
|
||||
if (!col) return;
|
||||
const special = this.getHaloSpecials();
|
||||
|
||||
const square7: HaloFn[] = [];
|
||||
const square5: HaloFn[] = [];
|
||||
|
||||
// e 是被加成怪的属性,enemy 是施加光环的怪
|
||||
|
||||
for (const halo of special) {
|
||||
switch (halo) {
|
||||
case 8:
|
||||
square5.push((e, enemy) => {
|
||||
if (
|
||||
e.special.includes(8) &&
|
||||
(e.x !== this.x || this.y !== e.y)
|
||||
) {
|
||||
e.atkBuff += enemy.together ?? 0;
|
||||
e.defBuff += enemy.together ?? 0;
|
||||
}
|
||||
});
|
||||
this.providedHalo.add(8);
|
||||
break;
|
||||
case 21:
|
||||
square7.push(e => {
|
||||
// e.damageDecline += this.enemy.iceHalo ?? 0;
|
||||
});
|
||||
col.haloList.push({
|
||||
type: 'square',
|
||||
data: { x: this.x, y: this.y, d: 7 },
|
||||
special: 21,
|
||||
from: this
|
||||
});
|
||||
this.providedHalo.add(21);
|
||||
break;
|
||||
case 26:
|
||||
square5.push(e => {
|
||||
e.defBuff += this.enemy.iceCore ?? 0;
|
||||
});
|
||||
col.haloList.push({
|
||||
type: 'square',
|
||||
data: { x: this.x, y: this.y, d: 5 },
|
||||
special: 26,
|
||||
from: this
|
||||
});
|
||||
this.providedHalo.add(26);
|
||||
break;
|
||||
case 27:
|
||||
square5.push(e => {
|
||||
e.atkBuff += this.enemy.fireCore ?? 0;
|
||||
});
|
||||
col.haloList.push({
|
||||
type: 'square',
|
||||
data: { x: this.x, y: this.y, d: 5 },
|
||||
special: 27,
|
||||
from: this
|
||||
});
|
||||
this.providedHalo.add(27);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
col.applyHalo('square', { x: this.x, y: this.y, d: 7 }, square7);
|
||||
col.applyHalo('square', { x: this.x, y: this.y, d: 5 }, square5);
|
||||
}
|
||||
provideHalo() {}
|
||||
|
||||
/**
|
||||
* 接受其他怪的光环
|
||||
@@ -507,64 +465,6 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
|
||||
damage: Record<string, MapDamage> = {},
|
||||
hero: Partial<HeroStatus> = getHeroStatusOn(Damage.realStatus)
|
||||
) {
|
||||
if (!has(this.x) || !has(this.y) || !has(this.floorId)) return damage;
|
||||
const enemy = this.enemy;
|
||||
const floor = core.status.maps[this.floorId];
|
||||
const w = floor.width;
|
||||
const h = floor.height;
|
||||
|
||||
// 突刺
|
||||
if (this.info.special.includes(15)) {
|
||||
const range = enemy.range ?? 1;
|
||||
const startX = Math.max(0, this.x - range);
|
||||
const startY = Math.max(0, this.y - range);
|
||||
const endX = Math.min(floor.width - 1, this.x + range);
|
||||
const endY = Math.min(floor.height - 1, this.y + range);
|
||||
const dam = Math.max((enemy.value ?? 0) - hero.def!, 0);
|
||||
|
||||
for (let x = startX; x <= endX; x++) {
|
||||
for (let y = startY; y <= endY; y++) {
|
||||
if (
|
||||
!enemy.zoneSquare &&
|
||||
manhattan(x, y, this.x, this.y) > range
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
const loc = `${x},${y}`;
|
||||
this.setMapDamage(damage, loc, dam, '突刺');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 射击
|
||||
if (this.info.special.includes(24)) {
|
||||
// const dirs: Dir[] = ['left', 'down', 'up', 'right'];
|
||||
// const dam = Math.max((enemy.atk ?? 0) - hero.def!, 0);
|
||||
// const objs = core.getMapBlocksObj(this.floorId);
|
||||
// for (const dir of dirs) {
|
||||
// let x = this.x;
|
||||
// let y = this.y;
|
||||
// const { x: dx, y: dy } = core.utils.scan[dir];
|
||||
// while (x >= 0 && y >= 0 && x < w && y < h) {
|
||||
// x += dx;
|
||||
// y += dy;
|
||||
// const loc = `${x},${y}` as LocString;
|
||||
// const block = objs[loc];
|
||||
// if (
|
||||
// block &&
|
||||
// block.event.noPass &&
|
||||
// block.event.cls !== 'enemys' &&
|
||||
// block.event.cls !== 'enemy48' &&
|
||||
// block.id !== 141 &&
|
||||
// block.id !== 151
|
||||
// ) {
|
||||
// break;
|
||||
// }
|
||||
// this.setMapDamage(damage, loc, dam, '射击');
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@@ -572,11 +472,11 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
|
||||
damage: Record<string, MapDamage>,
|
||||
loc: string,
|
||||
dam: number,
|
||||
type: string
|
||||
type?: string
|
||||
) {
|
||||
damage[loc] ??= { damage: 0, type: new Set() };
|
||||
damage[loc].damage += dam;
|
||||
damage[loc].type.add(type);
|
||||
if (type) damage[loc].type.add(type);
|
||||
}
|
||||
|
||||
private calEnemyDamageOf(hero: Partial<HeroStatus>, enemy: EnemyInfo) {
|
||||
@@ -730,6 +630,12 @@ export namespace Damage {
|
||||
/** 光环属性 */
|
||||
export const haloSpecials: Set<number> = new Set();
|
||||
|
||||
/** 会被第一类光环修改的怪物特殊属性数值 */
|
||||
export const changeableHaloValue: Map<
|
||||
number,
|
||||
SelectKey<Enemy, number | undefined>[]
|
||||
> = new Map();
|
||||
|
||||
/**
|
||||
* 计算伤害时会用到的勇士属性,攻击防御,其余的不会有buff加成,直接从core.status.hero取
|
||||
*/
|
||||
@@ -744,55 +650,7 @@ export namespace Damage {
|
||||
info: EnemyInfo,
|
||||
hero: Partial<HeroStatus>
|
||||
): number | null {
|
||||
const { hp, hpmax, mana, mdef } = core.status.hero;
|
||||
let { atk, def } = hero as HeroStatus;
|
||||
let { hp: monHp, atk: monAtk, def: monDef, special, enemy } = info;
|
||||
|
||||
let damage = 0;
|
||||
|
||||
// 饥渴
|
||||
if (special.includes(7)) {
|
||||
const delta = Math.floor((atk * enemy.hungry!) / 100);
|
||||
atk -= delta;
|
||||
monAtk += delta;
|
||||
}
|
||||
|
||||
let heroPerDamage: number;
|
||||
|
||||
// 绝对防御
|
||||
if (special.includes(3)) {
|
||||
// 由于坚固的特性,只能放到这来计算了
|
||||
if (atk > enemy.def) heroPerDamage = 1 + mana;
|
||||
else return null;
|
||||
} else {
|
||||
heroPerDamage = atk - monDef;
|
||||
if (heroPerDamage > 0) heroPerDamage += mana;
|
||||
else return null;
|
||||
}
|
||||
|
||||
let enemyPerDamage: number;
|
||||
|
||||
// 魔攻
|
||||
if (special.includes(2) || special.includes(13)) {
|
||||
enemyPerDamage = monAtk;
|
||||
} else {
|
||||
enemyPerDamage = monAtk - def;
|
||||
if (enemyPerDamage < 0) enemyPerDamage = 0;
|
||||
}
|
||||
|
||||
// 先攻
|
||||
if (special.includes(17)) {
|
||||
damage += enemyPerDamage;
|
||||
}
|
||||
|
||||
// 连击
|
||||
if (special.includes(4)) enemyPerDamage *= 2;
|
||||
if (special.includes(5)) enemyPerDamage *= 3;
|
||||
if (special.includes(6)) enemyPerDamage *= enemy.n!;
|
||||
|
||||
let turn = Math.ceil(monHp / heroPerDamage);
|
||||
|
||||
return damage;
|
||||
return null;
|
||||
}
|
||||
|
||||
export function ensureFloorDamage(floorId: FloorIds) {
|
||||
|
||||
@@ -164,7 +164,6 @@ interface PluginInterface {
|
||||
heroFourFrames_g: typeof import('../plugin/game/fx/heroFourFrames');
|
||||
rewrite_g: typeof import('../plugin/game/fx/rewrite');
|
||||
itemDetail_g: typeof import('../plugin/game/fx/itemDetail');
|
||||
checkBlock_g: typeof import('../plugin/game/enemy/checkblock');
|
||||
}
|
||||
|
||||
interface PackageInterface {
|
||||
|
||||
+1
-34
@@ -24,40 +24,7 @@ const MAX_ROTATE = 0.5;
|
||||
/** 碎裂动画的速率曲线函数 */
|
||||
const FRAG_TIMING = linear();
|
||||
|
||||
export function init() {
|
||||
Mota.rewrite(core.events, 'afterBattle', 'add', (_, enemy, x, y) => {
|
||||
// 打怪特效
|
||||
const setting = Mota.require('var', 'mainSetting');
|
||||
|
||||
if (setting.getValue('fx.frag') && has(x) && has(y)) {
|
||||
const frame = core.status.globalAnimateStatus % 2;
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 32;
|
||||
canvas.height = 32;
|
||||
core.drawIcon(canvas, enemy.id, 0, 0, 32, 32, frame);
|
||||
const manager = applyFragWith(canvas);
|
||||
const frag = manager.canvas;
|
||||
frag.style.imageRendering = 'pixelated';
|
||||
frag.style.width = `${frag.width * core.domStyle.scale}px`;
|
||||
frag.style.height = `${frag.height * core.domStyle.scale}px`;
|
||||
const left =
|
||||
(x * 32 + 16 - frag.width / 2 - core.bigmap.offsetX) *
|
||||
core.domStyle.scale;
|
||||
const top =
|
||||
(y * 32 + 16 - frag.height / 2 - core.bigmap.offsetY) *
|
||||
core.domStyle.scale;
|
||||
frag.style.left = `${left}px`;
|
||||
frag.style.top = `${top}px`;
|
||||
frag.style.zIndex = '45';
|
||||
frag.style.position = 'absolute';
|
||||
frag.style.filter = 'sepia(20%)brightness(120%)';
|
||||
core.dom.gameDraw.appendChild(frag);
|
||||
manager.onEnd.then(() => {
|
||||
frag.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
export function init() {}
|
||||
|
||||
export function applyFragWith(
|
||||
canvas: HTMLCanvasElement,
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
export function init() {
|
||||
// 伤害弹出
|
||||
// 复写阻激夹域检测
|
||||
control.prototype.checkBlock = function (forceMockery: boolean = false) {
|
||||
const x = core.getHeroLoc('x'),
|
||||
y = core.getHeroLoc('y'),
|
||||
loc = x + ',' + y;
|
||||
const info = core.status.thisMap.enemy.mapDamage[loc];
|
||||
const damage = info?.damage;
|
||||
if (damage) {
|
||||
Mota.r(() => {
|
||||
Mota.Plugin.require('pop_r').addPop(
|
||||
(x - core.bigmap.offsetX / 32) * 32 + 12,
|
||||
(y - core.bigmap.offsetY / 32) * 32 + 20,
|
||||
(-damage).toString()
|
||||
);
|
||||
});
|
||||
core.status.hero.hp -= damage;
|
||||
const type = [...info.type];
|
||||
const text = type.join(',') || '伤害';
|
||||
core.drawTip('受到' + text + damage + '点');
|
||||
core.drawHeroAnimate('zone');
|
||||
this._checkBlock_disableQuickShop();
|
||||
core.status.hero.statistics.extraDamage += damage;
|
||||
if (core.status.hero.hp <= 0) {
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose();
|
||||
return;
|
||||
} else {
|
||||
core.updateStatusBar();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import * as removeMap from './removeMap';
|
||||
import * as shop from './shop';
|
||||
import * as utils from './utils';
|
||||
import * as remainEnemy from './enemy/remainEnemy';
|
||||
import * as checkBlock from './enemy/checkblock';
|
||||
|
||||
Mota.Plugin.register('utils_g', utils);
|
||||
Mota.Plugin.register('shop_g', shop);
|
||||
@@ -16,7 +15,6 @@ Mota.Plugin.register('heroFourFrames_g', heroFourFrames, heroFourFrames.init);
|
||||
Mota.Plugin.register('rewrite_g', rewrite, rewrite.init);
|
||||
Mota.Plugin.register('itemDetail_g', itemDetail, itemDetail.init);
|
||||
Mota.Plugin.register('remainEnemy_g', remainEnemy);
|
||||
Mota.Plugin.register('checkBlock_g', checkBlock, checkBlock.init);
|
||||
|
||||
// export {
|
||||
// halo,
|
||||
|
||||
@@ -96,3 +96,21 @@ Range.registerRangeType(
|
||||
);
|
||||
}
|
||||
);
|
||||
Range.registerRangeType(
|
||||
'manhattan',
|
||||
(col, { x, y, d }) => {
|
||||
const list = col.collection.list;
|
||||
return list.filter(v => {
|
||||
if (!has(v.x) || !has(v.y)) return;
|
||||
const dx = Math.abs(v.x - x);
|
||||
const dy = Math.abs(v.y - y);
|
||||
return dx + dy < d;
|
||||
});
|
||||
},
|
||||
(col, { x, y, d }, item) => {
|
||||
if (!has(item.x) || !has(item.y)) return false;
|
||||
const dx = Math.abs(item.x - x);
|
||||
const dy = Math.abs(item.y - y);
|
||||
return dx + dy < d;
|
||||
}
|
||||
);
|
||||
@@ -160,9 +160,10 @@ export function boundary(arr: any, key?: any) {
|
||||
export function findDir(from: Loc, to: Loc): Dir2 | 'none' {
|
||||
const dx = to.x - from.x;
|
||||
const dy = to.y - from.y;
|
||||
|
||||
return (
|
||||
(Object.entries(core.utils.scan2).find(v => {
|
||||
v[1].x === dx && v[1].y === dy;
|
||||
return v[1].x === dx && v[1].y === dy;
|
||||
})?.[0] as Dir2) ?? 'none'
|
||||
);
|
||||
}
|
||||
@@ -28,19 +28,17 @@ export function getDetailedEnemy(
|
||||
) => {
|
||||
return typeof func === 'string' ? func : func(enemy);
|
||||
};
|
||||
const special: [string, string, string][] = enemy.enemy.special.map(vv => {
|
||||
const special: [string, string, string][] = enemy.info.special.map(vv => {
|
||||
const s = Mota.require('var', 'enemySpecials')[vv];
|
||||
const info = { ...enemy.enemy, ...enemy.info };
|
||||
return [
|
||||
fromFunc(s.name, enemy.enemy),
|
||||
fromFunc(s.desc, enemy.enemy),
|
||||
fromFunc(s.name, info),
|
||||
fromFunc(s.desc, info),
|
||||
s.color as string
|
||||
];
|
||||
});
|
||||
const l = isMobile ? 1 : 2;
|
||||
const showSpecial =
|
||||
special.length > l
|
||||
? special.slice(0, l).concat([['...', '', '#fff']])
|
||||
: special.slice();
|
||||
const showSpecial = special;
|
||||
|
||||
const damageColor = getDamageColor(dam) as string;
|
||||
|
||||
|
||||
Vendored
+1
-15
@@ -15,21 +15,7 @@ type PartialNumbericEnemyProperty =
|
||||
| 'purify'
|
||||
| 'atkValue'
|
||||
| 'defValue'
|
||||
| 'damage'
|
||||
| 'iceDecline'
|
||||
| 'iceCore'
|
||||
| 'fireCore'
|
||||
| 'together'
|
||||
| 'hungry'
|
||||
| 'ice'
|
||||
| 'crit'
|
||||
| 'courage'
|
||||
| 'charge'
|
||||
| 'paleShield'
|
||||
| 'iceHalo'
|
||||
| 'day'
|
||||
| 'night'
|
||||
| 'melt';
|
||||
| 'damage';
|
||||
|
||||
type BooleanEnemyProperty =
|
||||
| 'zoneSquare'
|
||||
|
||||
Reference in new issue
Block a user