Fix issues with Pokemon sprites persisting after some moves
parent
7c5d7074ec
commit
e0065fca7c
|
@ -760,15 +760,18 @@ export abstract class BattleAnim {
|
||||||
for (let i of targets) {
|
for (let i of targets) {
|
||||||
const count = i === AnimFrameTarget.GRAPHIC ? g : i === AnimFrameTarget.USER ? u : t;
|
const count = i === AnimFrameTarget.GRAPHIC ? g : i === AnimFrameTarget.USER ? u : t;
|
||||||
if (count < spriteCache[i].length) {
|
if (count < spriteCache[i].length) {
|
||||||
const removedSprites = spriteCache[i].splice(count, spriteCache[i].length - count);
|
const spritesToRemove = spriteCache[i].slice(count, spriteCache[i].length);
|
||||||
|
for (let rs of spritesToRemove) {
|
||||||
|
if (!rs.getData('locked') as boolean) {
|
||||||
|
const spriteCacheIndex = spriteCache[i].indexOf(rs);
|
||||||
|
spriteCache[i].splice(spriteCacheIndex, 1);
|
||||||
if (i === AnimFrameTarget.GRAPHIC)
|
if (i === AnimFrameTarget.GRAPHIC)
|
||||||
spritePriorities.splice(count, spriteCache[i].length - count);
|
spritePriorities.splice(spriteCacheIndex, 1);
|
||||||
for (let rs of removedSprites) {
|
|
||||||
if (!rs.getData('locked') as boolean)
|
|
||||||
rs.destroy();
|
rs.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
f++;
|
f++;
|
||||||
r--;
|
r--;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue