diff --git a/Server/src/main/core/game/interaction/MovementPulse.java b/Server/src/main/core/game/interaction/MovementPulse.java index 97fc86810..2cd93e3b3 100644 --- a/Server/src/main/core/game/interaction/MovementPulse.java +++ b/Server/src/main/core/game/interaction/MovementPulse.java @@ -243,6 +243,9 @@ public abstract class MovementPulse extends Pulse { if (!canInteractFromCurrentPosition && !(near && atInteractLocation) && !(hasExplicitInteractionLocation() && atInteractLocation)) { return false; } + if (canInteractFromCurrentPosition) { + near = false; + } } else if (!atInteractLocation) { return false; } diff --git a/Server/src/main/core/game/node/entity/combat/CombatMovementIntents.kt b/Server/src/main/core/game/node/entity/combat/CombatMovementIntents.kt index 4a71b95ea..98914d7d4 100644 --- a/Server/src/main/core/game/node/entity/combat/CombatMovementIntents.kt +++ b/Server/src/main/core/game/node/entity/combat/CombatMovementIntents.kt @@ -745,21 +745,28 @@ object CombatMovementIntents { targetLocation: Location, trace: IntentTrace? = null, ): Boolean { - val range = + val inRange = if (attacker is Player) { - playerAttackRange(attacker) - } else { - CombatReach.combatDistance( - attacker, + val range = playerAttackRange(attacker) + distanceSquaredToClosestOccupiedTile( target, - if (attacker.properties.combatPulse.style == CombatStyle.MAGIC) 10 else 7, - ) + targetLocation, + attackerLocation, + ) <= range * range + } else { + val range = + CombatReach.combatDistance( + attacker, + target, + if (attacker.properties.combatPulse.style == CombatStyle.MAGIC) 10 else 7, + ) + val attackerOffset = attacker.size() shr 1 + val targetOffset = target.size() shr 1 + val attackerCenter = attackerLocation.transform(attackerOffset, attackerOffset, 0) + val targetCenter = targetLocation.transform(targetOffset, targetOffset, 0) + targetCenter.withinDistance(attackerCenter, range) } - return distanceSquaredToClosestOccupiedTile( - target, - targetLocation, - attackerLocation, - ) <= range * range && + return inRange && hasProjectileLineOfSight( attackerLocation, attacker.size(), diff --git a/Server/src/main/core/game/world/map/path/DumbPathfinder.java b/Server/src/main/core/game/world/map/path/DumbPathfinder.java index fd5bd4d17..66e4eef1e 100644 --- a/Server/src/main/core/game/world/map/path/DumbPathfinder.java +++ b/Server/src/main/core/game/world/map/path/DumbPathfinder.java @@ -192,12 +192,12 @@ public final class DumbPathfinder extends Pathfinder { y++; break; case NORTH_EAST: - if ((clipMaskSupplier.getClippingFlag(z, x + 1, y + 2) & 0x12c0138) != 0 || (clipMaskSupplier.getClippingFlag(z, + if ((clipMaskSupplier.getClippingFlag(z, x + 1, y + 2) & 0x12c01f8) != 0 || (clipMaskSupplier.getClippingFlag(z, x + 2, y + 2) & 0x12c01e0) != 0 || (clipMaskSupplier.getClippingFlag( z, x + 2, - y + 1) & 0x12c0183) != 0) { + y + 1) & 0x12c01e3) != 0) { found = false; break; } @@ -216,9 +216,9 @@ public final class DumbPathfinder extends Pathfinder { x++; break; case SOUTH_EAST: - if ((clipMaskSupplier.getClippingFlag(z, x + 1, y - 1) & 0x12c010e) != 0 || (clipMaskSupplier.getClippingFlag(z, + if ((clipMaskSupplier.getClippingFlag(z, x + 1, y - 1) & 0x12c018f) != 0 || (clipMaskSupplier.getClippingFlag(z, x + 2, - y) & 0x12c01e0) != 0 || (clipMaskSupplier.getClippingFlag( + y) & 0x12c01e3) != 0 || (clipMaskSupplier.getClippingFlag( z, x + 2, y - 1) & 0x12c0183) != 0) { @@ -242,10 +242,10 @@ public final class DumbPathfinder extends Pathfinder { case SOUTH_WEST: if ((clipMaskSupplier.getClippingFlag(z, x - 1, y - 1) & 0x12c010e) != 0 || (clipMaskSupplier.getClippingFlag(z, x - 1, - y) & 0x12c0138) != 0 || (clipMaskSupplier.getClippingFlag( + y) & 0x12c013e) != 0 || (clipMaskSupplier.getClippingFlag( z, x, - y - 1) & 0x12c0183) != 0) { + y - 1) & 0x12c018f) != 0) { found = false; break; } @@ -264,12 +264,12 @@ public final class DumbPathfinder extends Pathfinder { x--; break; case NORTH_WEST: - if ((clipMaskSupplier.getClippingFlag(z, x - 1, y + 1) & 0x12c010e) != 0 || (clipMaskSupplier.getClippingFlag(z, + if ((clipMaskSupplier.getClippingFlag(z, x - 1, y + 1) & 0x12c013e) != 0 || (clipMaskSupplier.getClippingFlag(z, x - 1, y + 2) & 0x12c0138) != 0 || (clipMaskSupplier.getClippingFlag( z, x, - y + 2) & 0x12c01e0) != 0) { + y + 2) & 0x12c01f8) != 0) { found = false; break; } @@ -306,12 +306,12 @@ public final class DumbPathfinder extends Pathfinder { y++; break; case NORTH_EAST: - if ((clipMaskSupplier.getClippingFlag(z, x + 1, y + size) & 0x12c0138) != 0 || (clipMaskSupplier.getClippingFlag(z, + if ((clipMaskSupplier.getClippingFlag(z, x + 1, y + size) & 0x12c01f8) != 0 || (clipMaskSupplier.getClippingFlag(z, x + size, y + size) & 0x12c01e0) != 0 || (clipMaskSupplier.getClippingFlag( z, x + size, - y + 1) & 0x12c0183) != 0) { + y + 1) & 0x12c01e3) != 0) { found = false; break; } @@ -344,9 +344,9 @@ public final class DumbPathfinder extends Pathfinder { x++; break; case SOUTH_EAST: - if ((clipMaskSupplier.getClippingFlag(z, x + 1, y - 1) & 0x12c010e) != 0 || (clipMaskSupplier.getClippingFlag(z, + if ((clipMaskSupplier.getClippingFlag(z, x + 1, y - 1) & 0x12c018f) != 0 || (clipMaskSupplier.getClippingFlag(z, x + size, - y + (size - 2)) & 0x12c01e0) != 0 || (clipMaskSupplier.getClippingFlag( + y + (size - 2)) & 0x12c01e3) != 0 || (clipMaskSupplier.getClippingFlag( z, x + size, y - 1) & 0x12c0183) != 0) { @@ -382,12 +382,12 @@ public final class DumbPathfinder extends Pathfinder { y--; break; case SOUTH_WEST: - if ((clipMaskSupplier.getClippingFlag(z, x - 1, y + (size - 2)) & 0x12c0138) != 0 || (clipMaskSupplier.getClippingFlag(z, + if ((clipMaskSupplier.getClippingFlag(z, x - 1, y + (size - 2)) & 0x12c013e) != 0 || (clipMaskSupplier.getClippingFlag(z, x - 1, y - 1) & 0x12c010e) != 0 || (clipMaskSupplier.getClippingFlag( z, x + (size - 2), - y - 1) & 0x12c0183) != 0) { + y - 1) & 0x12c018f) != 0) { found = false; break; } @@ -420,18 +420,18 @@ public final class DumbPathfinder extends Pathfinder { x--; break; case NORTH_WEST: - if ((clipMaskSupplier.getClippingFlag(z, x - 1, y + 1) & 0x12c010e) != 0 || (clipMaskSupplier.getClippingFlag(z, + if ((clipMaskSupplier.getClippingFlag(z, x - 1, y + 1) & 0x12c013e) != 0 || (clipMaskSupplier.getClippingFlag(z, x - 1, y + size) & 0x12c0138) != 0 || (clipMaskSupplier.getClippingFlag( z, x, - y + size) & 0x12c01e0) != 0) { + y + size) & 0x12c01f8) != 0) { found = false; break; } for (int i = 1; i < size - 1; i++) { if ((clipMaskSupplier.getClippingFlag(z, x - 1, y + (i + 1)) & 0x12c013e) != 0 || (clipMaskSupplier.getClippingFlag(z, - x + (i - 1), + x + i, y + size) & 0x12c01f8) != 0) { found = false; break roar; diff --git a/Server/src/main/core/game/world/map/path/RsmodProjectilePathfinder.kt b/Server/src/main/core/game/world/map/path/RsmodProjectilePathfinder.kt index 160381b12..7cfe81d11 100644 --- a/Server/src/main/core/game/world/map/path/RsmodProjectilePathfinder.kt +++ b/Server/src/main/core/game/world/map/path/RsmodProjectilePathfinder.kt @@ -27,13 +27,13 @@ class RsmodProjectilePathfinder : Pathfinder() { destHeight = sizeY, ) val path = Path() + for (coordinate in rayCast.coordinates) { + path.points.add(Point(coordinate.x, coordinate.z)) + } if (!rayCast.success) { path.isMoveNear = rayCast.alternative return path } - for (coordinate in rayCast.coordinates) { - path.points.add(Point(coordinate.x, coordinate.z)) - } path.setSuccesful(true) return path }