Skip to content

Commit

Permalink
fix null exception
Browse files Browse the repository at this point in the history
  • Loading branch information
CarnifexOptimus committed Oct 6, 2024
1 parent 07a1318 commit 7df4e78
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme

var shape = ActiveAOEs(slot, actor).FirstOrDefault();
var clippedSeeds = GetClippedSeeds(shape);
var closestSeed = clippedSeeds?.Closest(actor.Position);
var closestSeed = clippedSeeds.Closest(actor.Position);

if (!IsTransporting(actor) && clippedSeeds != null && closestSeed != null)
if (!IsTransporting(actor) && closestSeed != null)
HandleNonTransportingActor(actor, hints, clippedSeeds, closestSeed);
else if (!shape.Shape.Check(actor.Position, shape.Origin, default))
HandleTransportingActor(actor, hints);
Expand Down Expand Up @@ -152,11 +152,12 @@ private void HandleTransportingActor(Actor actor, AIHints hints)

public override void AddHints(int slot, Actor actor, TextHints hints)
{
var aoes = ActiveAOEs(slot, actor).FirstOrDefault();
if (IsTransporting(actor) && ActiveAOEs(slot, actor).Any(c => c.Check(actor.Position)))
hints.Add("Drop seed outside of vulnerable area!");
else if (IsTransporting(actor) && ActiveAOEs(slot, actor).Any(c => !c.Check(actor.Position)))
hints.Add("Drop your seed!");
else if (!IsTransporting(actor) && GetClippedSeeds(ActiveAOEs(slot, actor).FirstOrDefault()).Any())
else if (!IsTransporting(actor) && aoes.Shape != null && GetClippedSeeds(aoes).Any())
hints.Add("Pick up seeds in vulnerable squares!");
}
}
Expand Down

0 comments on commit 7df4e78

Please sign in to comment.