get attacks working, adjust name placement scaling factor

This commit is contained in:
Evan
2025-02-01 12:05:11 -08:00
parent 39c8f9481d
commit 9a95fbe89e
3 changed files with 29 additions and 20 deletions
+3
View File
@@ -218,6 +218,9 @@ export class ClientGameRunner {
} else {
outer_loop: for (const t of bfs(tile, and(t => !t.hasOwner() && t.terrain().isLand(), dist(tile, 200)))) {
for (const n of t.neighbors()) {
if (n.owner().isPlayer()) {
console.log(`owner: ${(n.owner() as PlayerView).name()}`)
}
if (n.owner() == this.myPlayer) {
this.eventBus.emit(new SendAttackIntentEvent(targetID, this.myPlayer.troops() * this.renderer.uiState.attackRatio))
break outer_loop
+2 -2
View File
@@ -18,8 +18,8 @@ export interface Rectangle {
export function placeName(game: Game, player: Player): NameViewData {
const boundingBox = calculateBoundingBox(player.borderTiles());
const rawScalingFactor = (boundingBox.max.x - boundingBox.min.x) / 50
const scalingFactor = within(Math.floor(rawScalingFactor), 1, 100)
const rawScalingFactor = (boundingBox.max.x - boundingBox.min.x) / 100
const scalingFactor = within(Math.floor(rawScalingFactor), 1, 1000)
const grid = createGrid(game, player, boundingBox, scalingFactor);
const largestRectangle = findLargestInscribedRectangle(grid);