import type { Skill } from '../skill/Skill'; import type { SkillPresentationContext } from '../skill/SkillPresentationTypes'; import type { ISkillPresenter } from './SkillPresenter'; import { SkillPresenterRouter } from './SkillPresenterRouter'; 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; /** 枪攻效:委托 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); } } /** 弓拉弦抛物线:委托 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); } } 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.registerExtraSkill(1, new NezhaChargePresenter()); router.registerExtraSkill(2, new ArrowRainPresenter()); router.registerExtraSkill(7, new SpearTossPresenter()); }