|
|
|
|
import type { Skill } from '../skill/Skill';
|
|
|
|
|
import type { SkillPresentationContext } from '../skill/SkillPresentationTypes';
|
|
|
|
|
import type { ISkillPresenter } from './SkillPresenter';
|
|
|
|
|
import { SkillPresenterRouter } from './SkillPresenterRouter';
|
|
|
|
|
import { LineMultiHitAtkPresenter, ScatterPierceAtkPresenter } from './AtkTypePresenters';
|
|
|
|
|
import { NezhaChargePresenter } from './NezhaChargePresenter';
|
|
|
|
|
import { ArrowRainPresenter } from './ArrowRainPresenter';
|
|
|
|
|
import { SpearTossPresenter } from './SpearTossPresenter';
|
|
|
|
|
import { PagodaSmashPresenter } from './PagodaSmashPresenter';
|
|
|
|
|
import { Gong } from '../heros/Gong';
|
|
|
|
|
import { Gun } from '../heros/Gun';
|
|
|
|
|
import { Qiang } from '../heros/Qiang';
|
|
|
|
|
|
|
|
|
|
/** 枪普攻 Skill.id(Hero.atk_id) */
|
|
|
|
|
const QIANG_ATK_SKILL_IDS: readonly number[] = [10021, 10022, 10023, 10024, 10025];
|
|
|
|
|
/** 棍普攻 Skill.id */
|
|
|
|
|
const GUN_ATK_SKILL_IDS: readonly number[] = [10031, 10032, 10033, 10034, 10035];
|
|
|
|
|
/** 弓普攻 Skill.id */
|
|
|
|
|
const GONG_ATK_SKILL_IDS: readonly number[] = [10041, 10042, 10043, 10044, 10045];
|
|
|
|
|
/** 玲珑宝塔武器技能 */
|
|
|
|
|
const PAGODA_SKILL_ID = 20509;
|
|
|
|
|
/** 棍 200005 环形刀光(龙影) */
|
|
|
|
|
const GUN_RING_SKILL_ID = 200005;
|
|
|
|
|
|
|
|
|
|
/** 枪攻效:委托 Qiang(英雄枪-攻击 / 攻击2 + 瞄准) */
|
|
|
|
|
export class QiangThrustPresenter implements ISkillPresenter {
|
|
|
|
|
present(ctx: SkillPresentationContext, host: Skill): void {
|
|
|
|
|
if (host instanceof Qiang) {
|
|
|
|
|
host.presentNormAttack(ctx);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.log('[QiangThrustPresenter] 宿主非 Qiang,逻辑结算', ctx.params.skillId);
|
|
|
|
|
host.drainLogicPresentation(ctx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 棍攻效:委托 Gun(英雄棍-攻击 / 攻击2) */
|
|
|
|
|
export class GunAtkPresenter implements ISkillPresenter {
|
|
|
|
|
present(ctx: SkillPresentationContext, host: Skill): void {
|
|
|
|
|
if (host instanceof Gun) {
|
|
|
|
|
host.presentNormAttack(ctx);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.log('[GunAtkPresenter] 宿主非 Gun,逻辑结算', ctx.params.skillId);
|
|
|
|
|
host.drainLogicPresentation(ctx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* atk_type=16 扇形多段:棍宿主播「英雄棍-攻击」攻效(技能 id 不再固定,无法按 skillId 注册);
|
|
|
|
|
* 其余宿主走通用多段表现(字形攻击 + 按段间隔 hit)。
|
|
|
|
|
*/
|
|
|
|
|
export class FanMultiHitAtkPresenter implements ISkillPresenter {
|
|
|
|
|
private readonly _generic = new LineMultiHitAtkPresenter();
|
|
|
|
|
|
|
|
|
|
present(ctx: SkillPresentationContext, host: Skill): void {
|
|
|
|
|
if (host instanceof Gun) {
|
|
|
|
|
host.presentFanMultiHit(ctx);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this._generic.present(ctx, host);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* atk_type 12/17 散射:弓宿主委托 Gong(自身「英雄弓-攻击」投掷物扇出;
|
|
|
|
|
* 弓字形塔未挂武器通道,通用散射箭模板缺失);其余宿主走通用散射。
|
|
|
|
|
*/
|
|
|
|
|
export class BowScatterAtkPresenter implements ISkillPresenter {
|
|
|
|
|
private readonly _generic = new ScatterPierceAtkPresenter();
|
|
|
|
|
|
|
|
|
|
present(ctx: SkillPresentationContext, host: Skill): void {
|
|
|
|
|
if (host instanceof Gong) {
|
|
|
|
|
host.presentScatterAttack(ctx);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this._generic.present(ctx, host);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 弓拉弦抛物线:委托 Gong */
|
|
|
|
|
export class GongBowPresenter implements ISkillPresenter {
|
|
|
|
|
present(ctx: SkillPresentationContext, host: Skill): void {
|
|
|
|
|
if (host instanceof Gong) {
|
|
|
|
|
host.presentNormAttack(ctx);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.log('[GongBowPresenter] 宿主非 Gong,逻辑结算', ctx.params.skillId);
|
|
|
|
|
host.drainLogicPresentation(ctx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 棍 200005 环形刀光:委托 Gun(播完攻效后从字位置环形发出龙影) */
|
|
|
|
|
export class GunRingAtkPresenter implements ISkillPresenter {
|
|
|
|
|
present(ctx: SkillPresentationContext, host: Skill): void {
|
|
|
|
|
if (host instanceof Gun) {
|
|
|
|
|
host.presentRingAttack(ctx);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.log('[GunRingAtkPresenter] 宿主非 Gun,逻辑结算', ctx.params.skillId);
|
|
|
|
|
host.drainLogicPresentation(ctx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let _specialsReady = false;
|
|
|
|
|
|
|
|
|
|
/** 注册 skillId 特殊表现与 Skill.skill 额外效果(可重复调用) */
|
|
|
|
|
export function ensureSpecialSkillPresenters(): void {
|
|
|
|
|
if (_specialsReady) return;
|
|
|
|
|
_specialsReady = true;
|
|
|
|
|
const router = SkillPresenterRouter.instance;
|
|
|
|
|
const qiang = new QiangThrustPresenter();
|
|
|
|
|
for (let i = 0; i < QIANG_ATK_SKILL_IDS.length; i++) {
|
|
|
|
|
router.registerSkillId(QIANG_ATK_SKILL_IDS[i], qiang);
|
|
|
|
|
}
|
|
|
|
|
const gun = new GunAtkPresenter();
|
|
|
|
|
for (let i = 0; i < GUN_ATK_SKILL_IDS.length; i++) {
|
|
|
|
|
router.registerSkillId(GUN_ATK_SKILL_IDS[i], gun);
|
|
|
|
|
}
|
|
|
|
|
const gong = new GongBowPresenter();
|
|
|
|
|
for (let i = 0; i < GONG_ATK_SKILL_IDS.length; i++) {
|
|
|
|
|
router.registerSkillId(GONG_ATK_SKILL_IDS[i], gong);
|
|
|
|
|
}
|
|
|
|
|
router.registerSkillId(PAGODA_SKILL_ID, new PagodaSmashPresenter());
|
|
|
|
|
router.registerSkillId(GUN_RING_SKILL_ID, new GunRingAtkPresenter());
|
|
|
|
|
// 覆盖内置 atk_type=16:棍宿主播攻效,其余走通用多段
|
|
|
|
|
router.registerAtkType(16, new FanMultiHitAtkPresenter());
|
|
|
|
|
// 覆盖内置 atk_type 12/17:弓宿主散射走 Gong 自身投掷物,其余通用
|
|
|
|
|
router.registerAtkType(12, new BowScatterAtkPresenter());
|
|
|
|
|
router.registerAtkType(17, new BowScatterAtkPresenter());
|
|
|
|
|
router.registerExtraSkill(1, new NezhaChargePresenter());
|
|
|
|
|
router.registerExtraSkill(2, new ArrowRainPresenter());
|
|
|
|
|
router.registerExtraSkill(7, new SpearTossPresenter());
|
|
|
|
|
}
|