diff --git a/src/CotMG/ActiveFragment.ts b/src/CotMG/ActiveFragment.ts index 0a7d7e44b..b09483c55 100644 --- a/src/CotMG/ActiveFragment.ts +++ b/src/CotMG/ActiveFragment.ts @@ -68,13 +68,7 @@ export class ActiveFragment { } copy(): ActiveFragment { - // We have to do a round trip because the constructor. - const fragment = FragmentById(this.id); - if (fragment === null) throw new Error("ActiveFragment id refers to unknown Fragment."); - const c = new ActiveFragment({ x: this.x, y: this.y, rotation: this.rotation, fragment: fragment }); - c.highestCharge = this.highestCharge; - c.numCharge = this.numCharge; - return c; + return Object.assign({}, this); } /** diff --git a/src/CotMG/Fragment.ts b/src/CotMG/Fragment.ts index a066b4dbb..9e6c54648 100644 --- a/src/CotMG/Fragment.ts +++ b/src/CotMG/Fragment.ts @@ -76,13 +76,7 @@ export class Fragment { } copy(): Fragment { - return new Fragment( - this.id, - this.shape.map((a) => a.slice()), - this.type, - this.power, - this.limit, - ); + return Object.assign({}, this); } }