fix: preserve pursuit target through finisher
This commit is contained in:
@@ -4121,6 +4121,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
private miniMapObjectiveMarkers: Phaser.GameObjects.Rectangle[] = [];
|
||||
private miniMapViewport?: Phaser.GameObjects.Rectangle;
|
||||
private miniMapVisible = true;
|
||||
private pendingDefeatPresentationUnitIds = new Set<string>();
|
||||
private recentActionLogLayout?: RecentActionLogLayout;
|
||||
private cameraTileX = 0;
|
||||
private cameraTileY = 0;
|
||||
@@ -4299,6 +4300,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
this.miniMapObjectiveMarkers = [];
|
||||
this.miniMapViewport = undefined;
|
||||
this.miniMapVisible = true;
|
||||
this.pendingDefeatPresentationUnitIds.clear();
|
||||
this.recentActionLogLayout = undefined;
|
||||
this.edgeScrollElapsed = 0;
|
||||
this.pointerFeedbackMarker = undefined;
|
||||
@@ -4428,6 +4430,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
this.mapResultPopupObjects.forEach((object) => object.active && object.destroy());
|
||||
this.mapResultPopupObjects = [];
|
||||
this.hideBattleSoundCaption();
|
||||
this.pendingDefeatPresentationUnitIds.clear();
|
||||
this.battleAutosaveReady = false;
|
||||
this.uninstallBattleAutosaveHandlers();
|
||||
});
|
||||
@@ -8377,14 +8380,16 @@ export class BattleScene extends Phaser.Scene {
|
||||
if (!unit) {
|
||||
return;
|
||||
}
|
||||
const presentationVisible =
|
||||
this.unitPresentationVisible(unit);
|
||||
const selected = this.selectedUnit?.id === unit.id;
|
||||
const objective = unit.id === leaderUnitId;
|
||||
const baseSize = Math.max(this.battleUiLength(3), cellSize);
|
||||
const markerSize = baseSize + (objective ? this.battleUiLength(2) : 0) + (selected ? this.battleUiLength(2) : 0);
|
||||
dot.setPosition(x + unit.x * cellSize + cellSize / 2, y + unit.y * cellSize + cellSize / 2);
|
||||
dot.setDisplaySize(markerSize, markerSize);
|
||||
dot.setVisible(unit.hp > 0);
|
||||
dot.setFillStyle(unit.faction === 'ally' ? 0x4aa9ff : 0xff715f, unit.hp > 0 ? 0.96 : 0.18);
|
||||
dot.setVisible(presentationVisible);
|
||||
dot.setFillStyle(unit.faction === 'ally' ? 0x4aa9ff : 0xff715f, presentationVisible ? 0.96 : 0.18);
|
||||
if (selected) {
|
||||
dot.setStrokeStyle(this.battleUiLength(2), 0xffffff, 1);
|
||||
} else if (objective) {
|
||||
@@ -8607,7 +8612,11 @@ export class BattleScene extends Phaser.Scene {
|
||||
this.setUnitBasePosition(view, this.tileCenterX(unit.x), this.tileCenterY(unit.y));
|
||||
view.label.setPosition(view.baseX, view.baseY + this.layout.tileSize * 0.52);
|
||||
this.setUnitRoleSealPosition(view, view.baseX, view.baseY);
|
||||
const visible = unit.hp > 0 && this.isTileVisible(unit.x, unit.y);
|
||||
const presentationVisible =
|
||||
this.unitPresentationVisible(unit);
|
||||
const visible =
|
||||
presentationVisible &&
|
||||
this.isTileVisible(unit.x, unit.y);
|
||||
view.sprite.setVisible(visible);
|
||||
this.setUnitHitZoneEnabled(view, visible);
|
||||
view.label.setVisible(visible);
|
||||
@@ -8701,10 +8710,19 @@ export class BattleScene extends Phaser.Scene {
|
||||
});
|
||||
|
||||
this.setUnitStatusBadgePositions(view, view.baseX, view.baseY);
|
||||
const visible = unit.hp > 0 && this.isTileVisible(unit.x, unit.y);
|
||||
const visible =
|
||||
this.unitPresentationVisible(unit) &&
|
||||
this.isTileVisible(unit.x, unit.y);
|
||||
view.statusBadges.forEach((badge) => badge.container.setVisible(visible));
|
||||
}
|
||||
|
||||
private unitPresentationVisible(unit: UnitData) {
|
||||
return (
|
||||
unit.hp > 0 ||
|
||||
this.pendingDefeatPresentationUnitIds.has(unit.id)
|
||||
);
|
||||
}
|
||||
|
||||
private refreshUnitLegibilityStyles() {
|
||||
battleUnits.forEach((unit) => this.applyUnitLegibilityStyle(unit));
|
||||
}
|
||||
@@ -8714,7 +8732,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
return;
|
||||
}
|
||||
|
||||
if (unit.hp <= 0) {
|
||||
if (!this.unitPresentationVisible(unit)) {
|
||||
this.applyDefeatedStyle(unit, view);
|
||||
return;
|
||||
}
|
||||
@@ -14333,14 +14351,34 @@ export class BattleScene extends Phaser.Scene {
|
||||
this.triggerFirstEngagementEvent(attacker, target);
|
||||
this.phase = 'animating';
|
||||
const result = this.resolveCombatAction(attacker, target, action, false, usable);
|
||||
this.clearMarkers();
|
||||
await this.showBondMapEffect(result);
|
||||
await this.presentCombatResult(result);
|
||||
if (result.bondChain?.defeated) {
|
||||
this.applyDefeatedStyle(result.defender);
|
||||
this.updateMiniMap();
|
||||
const pendingDefeatPresentationUnitId =
|
||||
result.bondChain?.defeated
|
||||
? result.defender.id
|
||||
: undefined;
|
||||
if (pendingDefeatPresentationUnitId) {
|
||||
this.pendingDefeatPresentationUnitIds.add(
|
||||
pendingDefeatPresentationUnitId
|
||||
);
|
||||
}
|
||||
result.counter = this.resolveCounterAttack(result);
|
||||
this.clearMarkers();
|
||||
try {
|
||||
await this.showBondMapEffect(result);
|
||||
await this.presentCombatResult(result);
|
||||
} finally {
|
||||
if (pendingDefeatPresentationUnitId) {
|
||||
this.pendingDefeatPresentationUnitIds.delete(
|
||||
pendingDefeatPresentationUnitId
|
||||
);
|
||||
if (this.scene.isActive()) {
|
||||
this.applyDefeatedStyle(result.defender);
|
||||
this.updateMiniMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
result.counter =
|
||||
result.defender.hp > 0
|
||||
? this.resolveCounterAttack(result)
|
||||
: undefined;
|
||||
if (result.counter) {
|
||||
await this.delay(180);
|
||||
await this.presentCombatResult(result.counter);
|
||||
@@ -23332,6 +23370,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
}
|
||||
|
||||
private applyBattleSaveState(state: BattleSaveState) {
|
||||
this.pendingDefeatPresentationUnitIds.clear();
|
||||
this.clearBattleEvents();
|
||||
this.battleEventPresentationCount = 0;
|
||||
this.tacticalEventReactionHistory = [];
|
||||
@@ -29626,6 +29665,9 @@ export class BattleScene extends Phaser.Scene {
|
||||
}
|
||||
|
||||
private applyDefeatedStyle(unit: UnitData, view = this.unitViews.get(unit.id)) {
|
||||
if (this.pendingDefeatPresentationUnitIds.has(unit.id)) {
|
||||
return;
|
||||
}
|
||||
this.losePendingTacticalInitiativeEffect(unit);
|
||||
this.battleBuffs.delete(unit.id);
|
||||
this.battleStatuses.delete(unit.id);
|
||||
|
||||
Reference in New Issue
Block a user