Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions Source/TMagic/TMagic/Verb_ShatterSentinel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public class Verb_ShatterSentinel : Verb_UseAbility
{
protected override bool TryCastShot()
{
Pawn caster = base.CasterPawn;
Pawn pawn = this.currentTarget.Thing as Pawn;

CompAbilityUserMagic comp = pawn.GetComp<CompAbilityUserMagic>();
if(comp.IsMagicUser)
if (comp.IsMagicUser)
{
if(comp.summonedSentinels.Count > 0)
if (comp.summonedSentinels.Count > 0)
{
for(int i =0; i < comp.summonedSentinels.Count; i++)
var toRemove = new HashSet<Thing>();
for (int i = 0; i < comp.summonedSentinels.Count; i++)
{
Thing sentinel = comp.summonedSentinels[i];
if (!sentinel.DestroyedOrNull())
Expand All @@ -33,15 +33,11 @@ protected override bool TryCastShot()
sentinel.Destroy(DestroyMode.Vanish);
}
}
else
{
comp.summonedSentinels.Remove(comp.summonedSentinels[i]);
}

toRemove.Add(sentinel);
}
}
else
{

comp.summonedSentinels.RemoveAll(toRemove.Contains);
}
}
return true;
Expand Down