Data/Validators/Enumerate Area

## Enumerate Area

### Description

A validator capable of two functions. Firstly can count the number of valid targets in an area and compare them against a constant. Secondly it can compare the sum of vitals a group of units have against a constant.

### Hint

* Good for abilities/behaviours that require several specific units
* Think of this validator as a Search effect from which the purpose is lock/unlock an effect.

## Example Usage

### Negater tool

In some rare cases where Combine cannot Negate a validator, this one will work. See Unit In Weapon Range to learn how to negate with this type of validator.

### A special all in 1 formulae for Unit type location.

Who said you always need to use this validator to search the point location? You can, if needed, use this validator with 0 range, located at target unit, simply to validate THAT target.

For example: You are making a Create Persistent and setting the Periodic Validator. You notice that you can only put one validator there, but you absolutely need it to be an enemy Carrier, because you know you could mind control it and it's gonna screw your idea. Also, it must not be invulnerable. At first sight, you would usually make a combine validator, then, include in it a Target is Enemy validator, Is Carrier unit type validator and Not Invulnerable unit filter validator. You've just built 4 validators for this. What if... you could have just used a single Enum Area, set the target filters in it and put the Unit Type in the area validator? You can even use more arrays for more validators. So far, this validator can work as a combine, if well set. The radius used in each array is only necessary for point location search.

* Add to all of this a vital check as well if needed. Just remember to set it to "None", as even target in this case doesn't seem to be able to refer to that target unit location, unless an effect is there to specify which.

### Summary

This validator is a Combine, a Negater, a Unit Filter, a Unit Compare Vital all in one.

### A double edged blade Validator

As this validator seems amazing, there is a HUGE downside about using it: the lag. It is best used on single shot validation, rather than constant one and by that, we mean Buff Behaviors Validator (Disable) field. Assuming you want to put a buff behavior on a unit that constantly scans around if the required condition is met, this will cause a monstruous end game lag. To test it, you can put 10-20 of the unit carrying a buff behavior with the enumerate area validator. Then, make 300 of these units in your test (use "makeunit adept 300" for example). You will notice how laggy this can lead to. The idea for making around 10-20 versus 300 is to teach how underestimated the source of lag can be when running simple tests, as the real deal is proven bigger with larger games (ex: more players).

## Fields Description

### Search - Areas

Main field where you get to set the area to look for. The location here is always where the **Target - Location** **- Value** is. Take note that even if the location should be "Caster Unit" for example, it never means that the search will get stucked only on the caster despite the radius. Instead, this means that the search area will originate from it, and will account it in the result (if required).

* It is also recommanded to tune the **Search - Count** value to -1 if using multiple arrays here that will use their own Count field.

**Area:** Index of the search array. Each array works for itself and will compare with the main "Count" and "Compare" fields of this validator. All area arrays must each return true to the filters (or/and life comparaison) to have this validator work. Logically, if each array concerns the same seach filters, we can deduct that they all work in a "And" sort of way. We can however eliminate some arrays for validation by setting a validator will make sense to the circumstance. See the validator explanation below.

**Arc:** The angle around the **Target - Location - Value** in degrees that is used to seach for valid targets. 90 is 45 degrees to either side. This field also requires a logical use of **Target - Launch Location** for optimal use.

**Compare:** Compares the Count field of the array only. By default, this field returns null since the Count field is at -1, but may be used otherwise if setting a valid count number.

**Count:** Constant representing the required amount to have (or not to have) according to the Compare field of this array.

**Radius:** The radius inside which the count must return true.

**Radius Bonus:** If this validator should be effectuated inside an effect tree that repeats itself (ex: Create Persistent Effect), amount of extra radius to add each time the effect is validated.

**Validator:** External validator that will evaluate the enumerated unit(s) in the area array. Usually, any validators there must adress the validated enumerated unit as "Target". If the validator must compare the target from a specific effect (and not the search unit of that Enumerate Area), it is possible to do so by inserting an effect scope along with the Location value of this validator entry. It is also possible to evaluate the Caster there (or any other location for that matter) that can relate to the searched units. It is also possible to eliminate the array by putting a validator that justifies it. For example: if you put a bigger radius in an array, you can put a validator of type Player Requirement that will indicate that this array is true only if X requirement is met (which could be an upgrade for example). Therefore, if the validator returns false, the array will be ignored.

### Search - Count

The constant that is compared, according to the **Validator - Compare** field for the whole validator. If the validator remains simple, such as evaluating only 1 type of unit/variable or what so ever, this field paired up with the Compare field is fine enough. Although, if it is required to compare multiple area arrays, or units with life lower than X amount, it is recommanded to set -1 in this field, in order to search for more specifics details in other fields. This is mainly true because the area fields holds a count of -1 by default for each array, which leaves the count/compare role to this field in general. In fact, if this field is set to -1, the **Compare** field becomes useless and can be left to anything.

### Search - Exclude

**Value / Effect**

What units are excluded from the search area, despite of what is specified in the filters.

* Value represents which location (ex: caster) and the effect represents the scope (ex: the target of the X Create Persistent effect).

### Search - Include

**Value / Effect**

What units are integrated in the search area , despite of what is specified in the filters.

* Value represents which location (ex: caster) and the effect represents the scope (ex: the target of the X Create Persistent effect).

### Search - Search Filters

* The unit attributes and ownerships used for determining valid targets in the search areas

### Search - Search Flags

* Call For Help: (Unknown or illogical how this can affect this validator)
* Center At Launch: Sets the epicenter of the Search to the Launch Location value. Doing so is mainly useful when the Impact Location must only be used to determine an angle and not the epicenter.
* Extend By Unit Radius: Increases the Search - Areas - Radius by that of the unit at the **Target - Location** **- Value**
* Offset By Unit Radius: Shifts the limits of the search to the **Target - Location** **- Value** unit's radius
* Offset Area By Angle: For angles of less than 360 this flag allows them to follow the direction the using unit/effect is facing
* Same Cliff Level: Only includes targets on the same cliff level in the search
* Multishot: (New Feature, still untested as what this is used for)

### Target - Launch Location

**Value / Effect**

In case this validator should effectuate an angle search, determines a relative location to launch the search in order to set the angle.

* Value represents which location (ex: caster) and the effect represents the scope (ex: the target of the X Create Persistent effect).

### Validator - Combined Vital - Compare

* Operator for the Vital fields, evulating the **Combine Vital Value** for all units found in all **Search - Area** arrays.

### Validator - Combined Vital Unit

**Value / Effect**

Which location has its vital verified by this validator.

* **Successful use:** As it seems, this field must be set to **None** to work. By default, Target location returns no valid location. By default, even caster location has weird outcomes and doesn't work properly. It always works (even when false) if the Operator is set to "Less than", but never works (even if true) if "Equal to" or "Greater then".

### Validator - Combined Vital Value

* The constant against which the sum of the **Validator - Combined Vital** type is evaluated. Since Target location doesn't work on these fields, this field only seems to relate to units found by search arrays.

### Validator - Compare

* Compares the Count Value, globaly. Along with the **Search - Count** field, this field basically takes the main role of calculating the main number of match to be found (or not found), calculated toward each **Area Array's** Compare/Count entries. Be careful as this field interacts with the quantities compared in every search arrays, it may lead to mistakes when attempting to make it work properly. To make things easier, using a Count of -1 allows **Area Arrays** to take over their own results, instead of this field commanding them all.

### Validator - Ingore While Channeling

* Makes this validator be ignored if the ability/effect tree using it is being channeled

### Validator - Result - Failure

* The alert from the Alerts data type that is played if this validator returns false