You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AdLike2048/assets/script/battle/mechanism/MechanismConfigClone.ts

23 lines
725 B

3 weeks ago
import type {
ICharmProperty,
IParatroopsProperty,
} from '../../game/ChapterPlayTypes';
/** 机制 init 时深拷贝配表,避免旧 Schedule 组件 shift 共享数组导致只触发一次 */
export function cloneParatroopsConfig(src: IParatroopsProperty): IParatroopsProperty {
return {
...src,
timeArr: src.timeArr?.slice() ?? [],
numArr: src.numArr?.slice() ?? [],
monsterOptions: src.monsterOptions?.map(o => ({ ...o })) ?? [],
};
}
export function cloneCharmConfig(src: ICharmProperty): ICharmProperty {
return {
timeArr: src.timeArr?.slice() ?? [],
numArr: src.numArr?.slice() ?? [],
durationArr: src.durationArr?.slice() ?? [],
};
}