public List <Fighter> GetAffectedActors(short[] shape, List <string> targets) { List <Fighter> results = new List <Fighter>(); List <Fighter> authorized = new List <Fighter>(); foreach (var target in targets) { authorized.AddRange(TargetMaskProvider.Handle(this, target)); } foreach (var target in targets) { authorized = TargetMaskValidator.Valid(this, target, authorized); } foreach (var cell in shape) { var fighter = Fight.GetFighter(cell); if (fighter != null && authorized.Contains(fighter)) { results.Add(fighter); } } if (targets.Contains("C") && !results.Contains(this)) { results.Add(this); } var t = results.Distinct().ToList(); return(t); }
public Fighter[] GetAffectedFighters(Fighter fighter, Zone zone, MapPoint castPoint, string targetMask) { short[] cells = zone.GetCells(castPoint.CellId, fighter.Fight.Map); List <Fighter> targets = new List <Fighter>(); List <Fighter> filtreds = new List <Fighter>(); foreach (var mask in targetMask.Split(TargetMaskSelector.TARGET_MASK_SPLITTER)) { filtreds.AddRange(TargetMaskProvider.Handle(fighter, mask)); } foreach (var cell in cells) { Fighter target = fighter.Fight.GetFighter(cell); if (target != null && filtreds.Contains(target)) { targets.Add(target); } } return(TargetMaskSelector.Custom(fighter, targetMask, TargetMaskSelector.Select(fighter, targets, targetMask), castPoint).ToArray()); }