|
|
|
|
/** Hero 行 → MX 战斗配置 ID 约定(历史名 weapon1 仍表示 Hero.id) */
|
|
|
|
|
|
|
|
|
|
/** 塔单位配置 id */
|
|
|
|
|
export function towerUnitId(heroId: number): string {
|
|
|
|
|
return `tower_w1_${heroId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 旧版普攻技能 ID(保留兼容) */
|
|
|
|
|
export function towerAbilityId(heroId: number): string {
|
|
|
|
|
return `ability_w1_${heroId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 普攻 Ability id(共享;未覆盖 atk 形态时用) */
|
|
|
|
|
export function normalAbilityId(skillId: number): string {
|
|
|
|
|
return `ability_norm_${skillId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 普攻 Ability id(按实体隔离;被动改普攻后用) */
|
|
|
|
|
export function entityNormalAbilityId(skillId: number, entityId: number): string {
|
|
|
|
|
return `ability_norm_${skillId}_e${entityId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 是否为普攻(含实体覆盖 id) */
|
|
|
|
|
export function isNormalAbilityId(abilityId: string): boolean {
|
|
|
|
|
return /^ability_norm_\d+(?:_e\d+)?$/.test(abilityId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @deprecated 使用 entityHeroAbilityId */
|
|
|
|
|
export function ultAbilityId(skillId: number): string {
|
|
|
|
|
return `ability_ult_${skillId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @deprecated 使用 entityHeroAbilityId */
|
|
|
|
|
export function entityUltAbilityId(skillId: number, entityId: number): string {
|
|
|
|
|
return entityHeroAbilityId(skillId, entityId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 英雄主动 Ability id(按实体隔离) */
|
|
|
|
|
export function entityHeroAbilityId(skillId: number, entityId: number): string {
|
|
|
|
|
return `ability_hero_${skillId}_e${entityId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 武器主动 Ability id(按实体隔离) */
|
|
|
|
|
export function entityWeaponAbilityId(skillId: number, entityId: number): string {
|
|
|
|
|
return `ability_weapon_${skillId}_e${entityId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 是否为英雄/武器主动(非普攻) */
|
|
|
|
|
export function isActiveAbilityId(abilityId: string): boolean {
|
|
|
|
|
return /^ability_(?:ult|hero|weapon)_\d+(?:_e\d+)?$/.test(abilityId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @deprecated 使用 isActiveAbilityId */
|
|
|
|
|
export function isUltAbilityId(abilityId: string): boolean {
|
|
|
|
|
return isActiveAbilityId(abilityId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 是否为武器主动 */
|
|
|
|
|
export function isWeaponAbilityId(abilityId: string): boolean {
|
|
|
|
|
return /^ability_weapon_\d+(?:_e\d+)?$/.test(abilityId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 是否为英雄主动(含旧 ability_ult_) */
|
|
|
|
|
export function isHeroAbilityId(abilityId: string): boolean {
|
|
|
|
|
return /^ability_(?:ult|hero)_\d+(?:_e\d+)?$/.test(abilityId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 怪物技能 Ability id(按实体隔离) */
|
|
|
|
|
export function entityMonsterAbilityId(skillId: number, entityId: number): string {
|
|
|
|
|
return `ability_monster_${skillId}_e${entityId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 是否为怪物技能 */
|
|
|
|
|
export function isMonsterAbilityId(abilityId: string): boolean {
|
|
|
|
|
return /^ability_monster_\d+_e\d+$/.test(abilityId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 飞剑武器主动 Skill.id(atk_type=10 走飞剑预制体,非连砸) */
|
|
|
|
|
export const FLY_SWORD_SKILL_IDS: readonly number[] = [210101, 220101, 230101, 240101, 250101];
|
|
|
|
|
|
|
|
|
|
/** 土宝石冲锋 Skill.id(skill type=1,独立飞枪,非哪吒冲锋) */
|
|
|
|
|
export const EARTH_CHARGE_SKILL_IDS: readonly number[] = [620201, 630201, 640201, 650201];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否为飞剑武器主动。
|
|
|
|
|
* @param skillId Skill.id
|
|
|
|
|
*/
|
|
|
|
|
export function isFlySwordSkillId(skillId: number): boolean {
|
|
|
|
|
for (let i = 0; i < FLY_SWORD_SKILL_IDS.length; i++) {
|
|
|
|
|
if (FLY_SWORD_SKILL_IDS[i] === skillId) return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否为土属性冲锋宝石主动。
|
|
|
|
|
* @param skillId Skill.id
|
|
|
|
|
*/
|
|
|
|
|
export function isEarthChargeSkillId(skillId: number): boolean {
|
|
|
|
|
for (let i = 0; i < EARTH_CHARGE_SKILL_IDS.length; i++) {
|
|
|
|
|
if (EARTH_CHARGE_SKILL_IDS[i] === skillId) return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 塔实体 Hero 标签 */
|
|
|
|
|
export function weapon1Tag(heroId: number): string {
|
|
|
|
|
return `weapon1_${heroId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @deprecated 使用 weapon1Tag */
|
|
|
|
|
export function heroTag(heroId: number): string {
|
|
|
|
|
return weapon1Tag(heroId);
|
|
|
|
|
}
|