mirror of
https://github.com/motajs/template.git
synced 2026-11-12 14:04:31 +08:00
feat: 内置最终效果
This commit is contained in:
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;
|
||||
|
||||
/**
|
||||
* 深拷贝此怪物对象
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user