diff --git a/src/data/map/index.ts b/src/data/map/index.ts index 1443dd6..9c3fa65 100644 --- a/src/data/map/index.ts +++ b/src/data/map/index.ts @@ -14,8 +14,8 @@ export interface ComputedLayer { y: number; cx: number; cy: number; - r: number; - r2: number; + right: number; + bottom: number; } export interface Config { @@ -68,8 +68,8 @@ export class Map { y, cx: x + layer.width / 2, cy: y + layer.height / 2, - r, - r2: r * r, + right: x + layer.width, + bottom: y + layer.height, }; }); diff --git a/src/data/network/manager.ts b/src/data/network/manager.ts index 5ac0962..64a5ea4 100644 --- a/src/data/network/manager.ts +++ b/src/data/network/manager.ts @@ -6,7 +6,6 @@ import { KeyboardController } from "../controller/keyboardController"; import { DisplayObject } from "pixi.js"; import { Spell } from "../spells"; import { Cursor } from "../../graphics/cursor/types"; -import { getSquareDistance } from "../../util/math"; import { Element } from "../spells/types"; const TURN_GRACE_PERIOD = 3000; @@ -85,7 +84,12 @@ export abstract class Manager { for (let character of this._self.characters) { const [x, y] = character.body.precisePosition; - if (getSquareDistance(x + 4.5, y + 8, layer.cx, layer.cy) < layer.r2) { + if ( + x + 6 >= layer.x && + x <= layer.right && + y + 16 >= layer.y && + y <= layer.bottom + ) { revealed = true; break; }