mirror of
https://github.com/motajs/template.git
synced 2026-11-18 02:04:30 +08:00
refactor: 怪物系统与勇士属性系统联动
This commit is contained in:
1 parent
92ff489811
commit
eaa725553b
23 files changed
+473
-381
No files matched your search
@@ -149,4 +149,8 @@ export class HeroAttribute<THero> implements IHeroAttribute<THero> {
|
||||
}
|
||||
return cloned;
|
||||
}
|
||||
|
||||
getModifiableClone(): IHeroAttribute<THero> {
|
||||
return this.clone();
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,6 @@ export class HeroState<THero> implements IHeroState<THero> {
|
||||
}
|
||||
|
||||
getIsolatedAttribute(): IHeroAttribute<THero> {
|
||||
return this.attribute.clone();
|
||||
return this.attribute.getModifiableClone();
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,12 @@ export interface IReadonlyHeroAttribute<THero> {
|
||||
* 深拷贝此勇士属性对象
|
||||
* @param cloneModifier 是否同时复制修饰器,默认复制
|
||||
*/
|
||||
clone(cloneModifier?: boolean): IHeroAttribute<THero>;
|
||||
clone(cloneModifier?: boolean): IReadonlyHeroAttribute<THero>;
|
||||
|
||||
/**
|
||||
* 获取此勇士属性对象的可修改副本
|
||||
*/
|
||||
getModifiableClone(): IHeroAttribute<THero>;
|
||||
}
|
||||
|
||||
export interface IHeroAttribute<THero> extends IReadonlyHeroAttribute<THero> {
|
||||
@@ -101,6 +106,12 @@ export interface IHeroAttribute<THero> extends IReadonlyHeroAttribute<THero> {
|
||||
name: K,
|
||||
modifier: IHeroModifier<THero[K], unknown>
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 深拷贝此勇士属性对象
|
||||
* @param cloneModifier 是否同时复制修饰器,默认复制
|
||||
*/
|
||||
clone(cloneModifier?: boolean): IHeroAttribute<THero>;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
Reference in new issue
Block a user