feat: 内置最终效果

This commit is contained in:
AncTe committed 2026-04-15 18:48:59 +08:00
1 parent 0517da5000
commit 63e1a01fab
6 files changed
+55 -15

No files matched your search

@@ -51,6 +51,13 @@ export class Enemy<TAttr> implements IEnemy<TAttr> {
this.attributes[key] = value;
}
addAttribute<K extends SelectKey<TAttr, number>>(
key: K,
value: number
): void {
(this.attributes[key] as number) += value;
}
getAttribute<K extends keyof TAttr>(key: K): TAttr[K] {
return this.attributes[key];
}
@@ -100,6 +100,16 @@ export interface IEnemy<TAttr> extends IReadonlyEnemy<TAttr> {
*/
setAttribute<K extends keyof TAttr>(key: K, value: TAttr[K]): void;
/**
* 对一个数字类型的属性值进行增减操作
* @param key 属性名称
* @param value 要增加的属性值,可以是负值
*/
addAttribute<K extends SelectKey<TAttr, number>>(
key: K,
value: number
): void;
/**
* 深拷贝此怪物对象
*/