private void SelectImplicitAreaTargets(int effIndex, TargetTypes targetType, int effMask) { Unit referer = null; switch (targetType.ReferenceType()) { case TargetReferences.SRC: case TargetReferences.DEST: case TargetReferences.CASTER: referer = Caster; break; case TargetReferences.TARGET: referer = Targets.UnitTarget; break; case TargetReferences.LAST: { for (int i = UniqueTargets.Count - 1; i >= 0; i--) { if ((UniqueTargets[i].EffectMask & (1 << effIndex)) > 0) { referer = ArenaManager.ArenaUnits.Find(unit => unit.Character.Id == UniqueTargets[i].TargetId && unit.IsAlive()); break; } } break; } default: return; } if (referer == null) { return; } Vector3 center = Vector3.zero; switch (targetType.ReferenceType()) { case TargetReferences.SRC: center = Targets.Source; break; case TargetReferences.DEST: center = Targets.Dest; break; case TargetReferences.CASTER: case TargetReferences.TARGET: case TargetReferences.LAST: center = referer.transform.position; break; default: Debug.LogError("SelectImplicitAreaTargets: received not implemented target reference type!"); return; } List <Unit> targets = new List <Unit>(); TrinitySpellEffectInfo effect = GetEffect(effIndex); if (effect == null) { return; } float radius = effect.CalcRadius(Caster, this) * SpellValue.RadiusMod; ArenaManager.SearchAreaTargets(targets, radius, center, referer, targetType.CheckType()); if (targets.Count > 0) { // #TODO: Other special target selection goes here /*if (uint32 maxTargets = m_spellValue->MaxAffectedTargets) * Trinity::Containers::RandomResizeList(targets, maxTargets);*/ foreach (var unit in targets) { AddUnitTarget(unit, effMask, false, true, center); } } }