var appliedDamage = new DamageSpecifier();
- foreach (var entity in targets)
+ for (var i = targets.Count - 1; i >= 0; i--)
{
+ var entity = targets[i];
// We raise an attack attempt here as well,
// primarily because this was an untargeted wideswing: if a subscriber to that event cared about
// the potential target (such as for pacifism), they need to be made aware of the target here.
// In that case, just continue.
if (!Blocker.CanAttack(user, entity, (weapon, component)))
+ {
+ targets.RemoveAt(i);
continue;
+ }
var attackedEvent = new AttackedEvent(meleeUid, user, GetCoordinates(ev.Coordinates));
RaiseLocalEvent(entity, attackedEvent);