Skip to content

Commit

Permalink
Merge pull request #544 from nitoygo/bugfix/party-summon-invalid-coor…
Browse files Browse the repository at this point in the history
…dinates
  • Loading branch information
sven-n authored Dec 4, 2024
2 parents 60003ed + 186a12e commit 10f0433
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/GameLogic/PlayerActions/Skills/SummonPartySkillPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public override async ValueTask PerformSkillAsync(Player player, IAttackable tar
private async ValueTask RunSummonPartyAsync(Player player, CancellationTokenSource cancellationTokenSource)
{
var cancellationToken = cancellationTokenSource.Token;
var targets = player.Party!.PartyList;
var targetPlayers = targets.OfType<Player>().Where(p => p != player).ToList();
var partyList = player.Party!.PartyList;
var targetPlayers = partyList.OfType<Player>().Where(p => p != player).ToList();

try
{
Expand Down Expand Up @@ -109,12 +109,12 @@ private async ValueTask SummonTargetsAsync(Player player, IEnumerable<Player> ta

var offsetX = Rand.NextInt(-2, 3);
var offsetY = Rand.NextInt(-2, 3);
Point validPoint = new((byte)(player.Position.X + offsetX), (byte)(player.Position.Y + offsetY));
Point testPoint = new((byte)(player.Position.X + offsetX), (byte)(player.Position.Y + offsetY));

if (player.CurrentMap!.Terrain.WalkMap[targetPoint.X, targetPoint.Y]
if (player.CurrentMap!.Terrain.WalkMap[testPoint.X, testPoint.Y]
&& player.Position.EuclideanDistanceTo(targetPoint) < 6)
{
targetPoint = validPoint;
targetPoint = testPoint;
foundValidPoint = true;
}
}
Expand Down

0 comments on commit 10f0433

Please sign in to comment.