Skip to content

Commit

Permalink
Fixed invalid summon coordinates generated for party members
Browse files Browse the repository at this point in the history
  • Loading branch information
nitoygo committed Dec 4, 2024
1 parent 60003ed commit 186a12e
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 186a12e

Please sign in to comment.