Data/Validators/Combine

## Combine

### Description

This validator is used for combining other validators and performing boolean logic on them. Validator fields are logical AND by default (All must pass for the effect to run), so the Combine validator allows one to do nested AND, OR, and NOT. This validator CAN be used to negate a single validator (invert the logic), however most validators can directly negate themself, so this will only be necessary if you are negating a validator of type Combine, Function or Condition (which can contain many validators).

### Hints

* Use one of these to get effects and abilities that only can select a single validator to be validated by multiple validators

## Example Usage

### Can Have Shields Or Energy

Combines the two Unit Compare Field validators which check that the shield and energy vitals are greater or equal to 1 into one validator

#### URL

As the Can Have Shields Or Energy validator is already present in the editor no URL is needed

## Fields Description

### Validator: Combines

An array of validators that will be evaluated.

* Note: Do not place the current combine validator inside this array, this effectively leads to an infinite loop in the validation process. Need to test if this validator employs short circuit evaluation.

### Negate

Use this to invert the logic of validators. Usually, most validators have an "Enabled" or "Find" field. In other cases, such as Unit Order for example does not have any. This is simply a lack of content and the only way to get a "No Find" of this type of validator would be to build it inside a combine validator with negate checked. In other cases, if the modder is lazy, or wants to avoid creating multiple validators that work in the opposite way of their even ones, this becomes handy. Since Blizzard already supplies a lot of validators, it can be best to generate less of them for nothing, in order to keep the data clean and simple. Use it especially for negating Unit Compare Field validators; The issue with that one validator, is that a field cannot be operated with anything else than "Equal to". Even not Equal to is fussy to use, because in some situations such as fields with arrays, units that have a morph unit with different arrays will bug the Unit Compare field. And then comes the use of the Negater here: You can instead, negate it, it will work. Some validators, such as Unit In Weapon Range for example will not work; The reason being probably that the Unit location puts the Caster in the equation, thus the validator judging that even the caster is not in its own range. See the validator's wiki to learn how to negate it. In some other cases, such as Unit Filters, you cannot invert the result either since there are 3 entries per filter.

* Here's a combine of type "Or" with 2 entries:
	1. Unit Order (using attack ability)
	2. Distance is greater than 1.

If the negate is used in this very cases, it will mean that the validator will work if: The caster cannot use attack ability OR if the distance is not greater than 1.

### Validator: Result - Failure

The error message that will display when the validator fails to either return true or false

### Validator: Type

This field determines which logic is applied to the array of validators.

* OR: Validator will logically OR the combine array (At least one of the validators must be true).
* AND: Validator will logically AND the combine array (All the validators must be true).

## Related

* Effects
* Behaviors
* Validate Creation Effect
* Validate Player
* Validate Position
* Validate Unit
* Validate Unit Type