From 76c68f4050f282db8b59abc4319e823764fe82e0 Mon Sep 17 00:00:00 2001 From: sven-n Date: Fri, 21 Jun 2024 17:29:21 +0200 Subject: [PATCH] Fixed the attack range issue of #411. When monster and player skills have the same range, they should hit each other. If we add 1 to the monster, they don't. --- .../NPC/AttackAreaTargetInDirectionTrapIntelligence.cs | 2 +- src/GameLogic/NPC/BasicMonsterIntelligence.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GameLogic/NPC/AttackAreaTargetInDirectionTrapIntelligence.cs b/src/GameLogic/NPC/AttackAreaTargetInDirectionTrapIntelligence.cs index c8f17c36f..1225a7cc9 100644 --- a/src/GameLogic/NPC/AttackAreaTargetInDirectionTrapIntelligence.cs +++ b/src/GameLogic/NPC/AttackAreaTargetInDirectionTrapIntelligence.cs @@ -29,7 +29,7 @@ protected override async ValueTask TickAsync() } var targetsInRange = this.PossibleTargets.Where(target => this.Trap.GetDirectionTo(target) == this.Trap.Rotation) - .Where(target => this.Trap.IsInRange(target.Position, this.Trap.Definition.AttackRange + 1)) + .Where(target => this.Trap.IsInRange(target.Position, this.Trap.Definition.AttackRange)) .Where(target => !this.Map.Terrain.SafezoneMap[target.Position.X, target.Position.Y]); bool hasAttacked = false; diff --git a/src/GameLogic/NPC/BasicMonsterIntelligence.cs b/src/GameLogic/NPC/BasicMonsterIntelligence.cs index 113c17220..9d070353b 100644 --- a/src/GameLogic/NPC/BasicMonsterIntelligence.cs +++ b/src/GameLogic/NPC/BasicMonsterIntelligence.cs @@ -239,7 +239,7 @@ private async ValueTask TickAsync() } // Target in Attack Range? - if (target.IsInRange(this.Monster.Position, this.Monster.Definition.AttackRange + 1) && !this.Monster.IsAtSafezone()) + if (target.IsInRange(this.Monster.Position, this.Monster.Definition.AttackRange) && !this.Monster.IsAtSafezone()) { await this.Monster.AttackAsync(target).ConfigureAwait(false); // yes, attack return;