destroyer moves upwards

This commit is contained in:
Evan
2024-11-15 20:43:15 -08:00
parent c7951d77c0
commit 975750b294
5 changed files with 64 additions and 44 deletions
+8 -2
View File
@@ -1,7 +1,7 @@
import { Colord } from "colord";
import { Theme } from "../../../core/configuration/Config";
import { Unit, UnitEvent, Cell, Game, Tile, UnitType } from "../../../core/game/Game";
import { bfs, dist } from "../../../core/Util";
import { bfs, dist, euclDist } from "../../../core/Util";
import { Layer } from "./Layer";
import { EventBus } from "../../../core/EventBus";
@@ -72,7 +72,13 @@ export class UnitLayer implements Layer {
}
private handleDestroyerEvent(event: UnitEvent) {
bfs(event.oldTile, euclDist(event.oldTile, 3)).forEach(t => {
this.clearCell(t.cell())
})
bfs(event.unit.tile(), euclDist(event.unit.tile(), 3))
.forEach(t => this.paintCell(t.cell(), this.theme.borderColor(event.unit.owner().info()), 255))
bfs(event.unit.tile(), euclDist(event.unit.tile(), 2))
.forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.unit.owner().info()), 180))
}
private handleBoatEvent(event: UnitEvent) {