mirror of
https://github.com/motajs/template.git
synced 2026-11-01 22:24:31 +08:00
chore: 注释调整与接口微调
This commit is contained in:
1 parent
79d06c31df
commit
ebfe59b4f5
8 files changed
+64
-8
No files matched your search
@@ -22,40 +22,56 @@ import { MapLocIndexer } from './utils';
|
||||
import { IReadonlyHeroAttribute } from '../hero';
|
||||
|
||||
export class EnemyContext<TAttr, THero> implements IEnemyContext<TAttr, THero> {
|
||||
/** 坐标索引 -> 怪物视图 */
|
||||
private readonly enemyViewMap: Map<number, EnemyView<TAttr>> = new Map();
|
||||
/** 坐标索引 -> 计算前怪物对象 */
|
||||
private readonly enemyMap: Map<number, IEnemy<TAttr>> = new Map();
|
||||
/** 怪物视图 -> 坐标索引 */
|
||||
private readonly locatorViewMap: Map<IEnemyView<TAttr>, number> = new Map();
|
||||
/** 计算前怪物对象 -> 坐标索引 */
|
||||
private readonly locatorEnemyMap: Map<IEnemy<TAttr>, number> = new Map();
|
||||
/** 计算后怪物对象 -> 怪物视图 */
|
||||
private readonly computedToView: Map<
|
||||
IReadonlyEnemy<TAttr>,
|
||||
EnemyView<TAttr>
|
||||
> = new Map();
|
||||
|
||||
/** 当前已注册的光环转换器 */
|
||||
private readonly auraConverter: Set<IAuraConverter<TAttr, THero>> =
|
||||
new Set();
|
||||
/** 光环转换器是否启用 */
|
||||
private readonly converterStatus: Map<
|
||||
IAuraConverter<TAttr, THero>,
|
||||
boolean
|
||||
> = new Map();
|
||||
/** 所有已被转换的光环 */
|
||||
private readonly convertedAura: Map<ISpecial<any>, IAuraView<TAttr>> =
|
||||
new Map();
|
||||
|
||||
/** 普通查询效果注册,特殊属性 -> 此特殊属性的查询效果列表,按照优先级从高到低排序 */
|
||||
private readonly commonQueryMap: Map<
|
||||
number,
|
||||
IEnemyCommonQueryEffect<TAttr, THero>[]
|
||||
> = new Map();
|
||||
|
||||
/** 特殊查询效果注册,特殊属性 -> 此特殊属性的特殊查询效果列表,按照优先级从高到低排序 */
|
||||
private readonly specialQueryEffects: Map<
|
||||
number,
|
||||
IEnemySpecialQueryEffect<TAttr, THero>[]
|
||||
> = new Map();
|
||||
|
||||
/** 最终效果列表,按照优先级从高到低排列 */
|
||||
private readonly finalEffects: IEnemyFinalEffect<TAttr, THero>[] = [];
|
||||
/** 添加的无来源全局光环列表 */
|
||||
private readonly globalAuraList: Set<IAuraView<TAttr>> = new Set();
|
||||
/** 排序后的光环视图,视图优先级 -> 光环视图列表 */
|
||||
private readonly sortedAura: Map<number, Set<IAuraView<TAttr>>> = new Map();
|
||||
|
||||
/** 当怪物更新后,需要对上下文进行全量刷新的怪物列表 */
|
||||
private readonly needTotallyRefresh: Set<IEnemyView<TAttr>> = new Set();
|
||||
/** 所有实际查询了上下文的常规查询效果,这些怪物需要在上下文或其他怪物刷新时一并刷新 */
|
||||
private readonly requestedCommonContext: Set<IEnemyView<TAttr>> = new Set();
|
||||
/** 所有需要被标记为脏的怪物 */
|
||||
private readonly dirtyEnemy: Set<IEnemyView<TAttr>> = new Set();
|
||||
|
||||
/** 当前绑定的勇士属性对象 */
|
||||
|
||||
@@ -8,7 +8,8 @@ import {
|
||||
} from './types';
|
||||
|
||||
export class Enemy<TAttr> implements IEnemy<TAttr> {
|
||||
readonly specials: Set<ISpecial<any>> = new Set();
|
||||
/** 怪物身上的特殊属性列表 */
|
||||
private readonly specials: Set<ISpecial<any>> = new Set();
|
||||
/** code -> ISpecial 映射,用于快速查找 */
|
||||
private readonly specialMap: Map<number, ISpecial<any>> = new Map();
|
||||
|
||||
@@ -89,7 +90,8 @@ export class Enemy<TAttr> implements IEnemy<TAttr> {
|
||||
}
|
||||
|
||||
export class EnemyView<TAttr> implements IEnemyView<TAttr> {
|
||||
private computedEnemy: IEnemy<TAttr>;
|
||||
/** 计算后怪物 */
|
||||
private readonly computedEnemy: IEnemy<TAttr>;
|
||||
|
||||
constructor(
|
||||
readonly baseEnemy: IEnemy<TAttr>,
|
||||
|
||||
@@ -90,6 +90,14 @@ export class HeroAttribute<THero> implements IHeroAttribute<THero> {
|
||||
this.markDirty(name);
|
||||
}
|
||||
|
||||
addBaseAttribute<K extends keyof SelectType<THero, number>>(
|
||||
name: K,
|
||||
value: number
|
||||
): void {
|
||||
(this.attribute[name] as number) += value;
|
||||
this.markDirty(name);
|
||||
}
|
||||
|
||||
addModifier<K extends keyof THero>(
|
||||
name: K,
|
||||
modifier: IHeroModifier<THero[K], unknown>
|
||||
|
||||
@@ -87,6 +87,16 @@ export interface IHeroAttribute<THero> extends IReadonlyHeroAttribute<THero> {
|
||||
*/
|
||||
setBaseAttribute<K extends keyof THero>(name: K, value: THero[K]): void;
|
||||
|
||||
/**
|
||||
* 增减勇士属性
|
||||
* @param name 属性名称
|
||||
* @param value 属性增减值
|
||||
*/
|
||||
addBaseAttribute<K extends SelectKey<THero, number>>(
|
||||
name: K,
|
||||
value: number
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 向一个属性添加属性修饰器
|
||||
* @param name 属性名称
|
||||
|
||||
Reference in new issue
Block a user