From b3552ebccb74c78cc904eab8dac6b1e1bdc55669 Mon Sep 17 00:00:00 2001 From: phosit Date: Fri, 20 Feb 2026 18:59:21 +0100 Subject: [PATCH] Clone the position in attackPlan --- .../data/mods/public/simulation/ai/petra/attackPlan.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/binaries/data/mods/public/simulation/ai/petra/attackPlan.js b/binaries/data/mods/public/simulation/ai/petra/attackPlan.js index 4c24ef8c46..98d5284d29 100644 --- a/binaries/data/mods/public/simulation/ai/petra/attackPlan.js +++ b/binaries/data/mods/public/simulation/ai/petra/attackPlan.js @@ -1251,7 +1251,7 @@ AttackPlan.prototype.getPathToTarget = function(gameState, fixedRallyPoint = fal this.path.push(clone(this.targetPos)); for (const p in path) this.path.push([path[p].x, path[p].y]); - this.path.push(this.rallyPoint); + this.path.push(clone(this.rallyPoint)); this.path.reverse(); // Change the rally point to something useful if (!fixedRallyPoint) @@ -1837,7 +1837,7 @@ AttackPlan.prototype.update = function(gameState, events) if (this.target && this.target.owner() === 0 && this.targetPlayer !== 0) this.target = undefined; } - this.lastPosition = this.position; + this.lastPosition = clone(this.position); Engine.ProfileStop(); return this.unitCollection.length; @@ -1935,7 +1935,7 @@ AttackPlan.prototype.UpdateWalking = function(gameState, events) farthestEnt.destroy(); } if (gameState.ai.playedTurn % 5 === 0) - this.position5TurnsAgo = this.position; + this.position5TurnsAgo = clone(this.position); if (this.lastPosition && SquareVectorDistance(this.position, this.lastPosition) < 16 && this.path.length > 0) @@ -2271,7 +2271,7 @@ AttackPlan.prototype.Serialize = function() "type": this.type, "state": this.state, "forced": this.forced, - "rallyPoint": this.rallyPoint, + "rallyPoint": clone(this.rallyPoint), "overseas": this.overseas, "paused": this.paused, "maxCompletingTime": this.maxCompletingTime, @@ -2280,7 +2280,7 @@ AttackPlan.prototype.Serialize = function() "siegeState": this.siegeState, "position5TurnsAgo": this.position5TurnsAgo, "lastPosition": this.lastPosition, - "position": this.position, + "position": clone(this.position), "isBlocked": this.isBlocked, "targetPlayer": this.targetPlayer, "target": this.target !== undefined ? this.target.id() : undefined,