diff --git a/src/data/battle-anims.ts b/src/data/battle-anims.ts index cec80190cb2..81a8da36c99 100644 --- a/src/data/battle-anims.ts +++ b/src/data/battle-anims.ts @@ -769,6 +769,7 @@ export abstract class BattleAnim { let sprite: Phaser.GameObjects.Sprite; sprite = scene.addPokemonSprite(isUser ? user : target, 0, 0, spriteSource.texture, spriteSource.frame.name, true); [ 'spriteColors', 'fusionSpriteColors' ].map(k => sprite.pipelineData[k] = (isUser ? user : target).getSprite().pipelineData[k]); + sprite.pipelineData['ignoreFieldPos'] = true; spriteSource.on('animationupdate', (_anim, frame) => sprite.setFrame(frame.textureFrame)); scene.field.add(sprite); sprites.push(sprite); diff --git a/src/pipelines/sprite.ts b/src/pipelines/sprite.ts index f51d7541284..819efd0d8f5 100644 --- a/src/pipelines/sprite.ts +++ b/src/pipelines/sprite.ts @@ -335,6 +335,7 @@ export default class SpritePipeline extends FieldSpritePipeline { const tone = data['tone'] as number[]; const teraColor = data['teraColor'] as integer[] ?? [ 0, 0, 0 ]; const hasShadow = data['hasShadow'] as boolean; + const ignoreFieldPos = data['ignoreFieldPos'] as boolean; const ignoreOverride = data['ignoreOverride'] as boolean; const isEntityObj = sprite.parentContainer instanceof Pokemon || sprite.parentContainer instanceof Trainer; @@ -346,9 +347,9 @@ export default class SpritePipeline extends FieldSpritePipeline { position[0] += field.x / field.scale; position[1] += field.y / field.scale; } - position[0] += -(sprite.width - (sprite.frame.width)) / 2 + sprite.frame.x + (sprite.x - field.x); + position[0] += -(sprite.width - (sprite.frame.width)) / 2 + sprite.frame.x + (!ignoreFieldPos ? (sprite.x - field.x) : 0); if (sprite.originY === 0.5) - position[1] += (sprite.height / 2) * ((isEntityObj ? sprite.parentContainer : sprite).scale - 1) + (sprite.y - field.y); + position[1] += (sprite.height / 2) * ((isEntityObj ? sprite.parentContainer : sprite).scale - 1) + (!ignoreFieldPos ? (sprite.y - field.y) : 0); this.set1f('teraTime', (this.game.getTime() % 500000) / 500000); this.set3fv('teraColor', teraColor.map(c => c / 255)); this.set1i('hasShadow', hasShadow ? 1 : 0);