Data/Effects/Set

## Description

An effect that is used to group and execute other effects in a specific order. Effects are executed in order except when the random flag is set.

## Hints

* Use this to execute multiple effects at the same time in the effect chain or to start multiple other effects.
* This effect can be used to do random effects, by specifying the effects and then setting the random flag, as well as limiting the number of effects that are selected to run to 1.

## Example Usage

### Marauder - Punisher Grenades (Set)

A set effect used by the Marauder weapon to use a Damage effect and if the enabling upgrade is researched to apply a slowing Buff behaviour to the target unit

### Pass Chance Creator

Combining **Recycle Count** and **Maximum Count**, one can set Maximum Count to 100, thus creating a random number to come out between 0 and 100. If the Set creates something like a User Data amount, then we can use this amount for validation in further effect tree.

## Field Descriptions

### (None): Recycle Count

Allows their child effects to be executed repeatedly until they meet the **minimum** count field value or/and until, if lucky, reaching the **maximum** **count** field value. The outcome really depends of the logic of the count fields, determining the margins.

* While the list of effect in this set are repeated, one can also choose to alter their order of execution with the **random** field.
* Without Max/Min count fields, this field is useless.

### (None): Set Source

Set the source unit/point of its child effects to be the target point/unit of the current target unit/point.

* To be clear, this does not changes the target of the set effect, it rather gives it an additional status, it becomes a source location as well.
* See effects, in the location section for "Source". A Create Unit effect bug may nullify this field's function, be careful to set the effects right. It is also explained how to be fixed in the "Target: Origin" field from the Create Unit effect field.

### Effect - Effects

* List of effects that are executed when the set effect is executed

* These are the effects that will run when this set effect is run. You can have up to 8 effects defined here. By default, the effects will run in the order listed here.

### Effect - Maximum Count

The maximum number of child Effects that will be run. Used in combination with the Minimum Count.

* If the minimum value is below this value, you may expect some effects to fail at executing. What is untold about this field is the fact that it also comes with a chance to fail the requested amount of effects, For example, if you have 8 childs effects in your set and a maximum count of 8, minimum count of 0, then you will get a random amount of effects that will succeed between 0 and 8. Take this same example, but rather put a maximum count of 100: this will not matter, because you have not used **Recycle count** field, which would re-run the 92 attempts missing on 100 (the 8 effects have been tried, and there it ended). Now then if you had used the **Recycle count** field, there's a strong chance that every effects repeat more than 8 times, until the count of 100 tries has been reached, but then again, with the worst luck ever, it is possible that not all of the 8 effects have passed. Odd chance of running effects aren't tested per effect attempt, but rather based on choosing a single random number between the min count and maximum count. As in the previous example of 0 minimum count vs 8 maximum count, there was 1 number of the 9 possibilities of numbers that had to be chosen randomly (0 was also accounted). Do not confuse these odds with the **Chance** field of this set effect, that is rather the chance of running this whole package of gambling.
* The interaction with **minimum count** field goes as: using a mimimum count will garantee that among the maximum count attempts of running effects, this X minimum of effects will be garanteed success at running (from the scope of this effect only; Because they may still fail from their proper validator/chance field).
* This number also limits how many of the effects out of the set effects will be run at maximum. So if you have 4 effects defined, but a maximum count of 2, probably 2 effects will run. This is normally used in conjunction with the **Effect: Random** flag. By default it makes little sense to define a list of effects and then specify a maximum that is less then the total number of effects. However, this can be applicable because upgrades can change the maximum count as well as the effects in the set itself. So you could define a set with Effect A,B and C, with a max count of 1, and then use upgrades to "unlock" the other effects in the set.
* Leaving this field at 0 will simply let the set effect run its effect normaly without any odds of failing. Presuming that you use the **Recycle Count** field with this field at 0, the child effect will simply run once, or more if there is a **mimimum count**, until it is reached upon repetition.

### Effect - Minimum Count

Forces a specific amount of effects to succeed at executing from this set, if a **maximum count** should be set. Otherwise, without a **Maximum Count**, this field can specify how many times the effects should be repeated if using the **recycle count** field.

* **Maximum count** becomes irrelevant if this field is greater.
* A minimum count to succeed does not mean that the childs effects will be forced over their own validators or chance field (so it does not create overflow either). What it rather means, is that the end of the day, this X amount of effects will be run with 100% chance versus the **maximum count** odds of failling OR in accordance with the recycle count, this X amount of effects will be created.

### Effect - Random

Specifies that the child effects are shuffled in a random order before being executed.

* If enabled, this causes the effects to be run in a random order. This can be used in conjunction with the minimum and maximum count fields to create sets of effects that are chosen from randomly. So, one could define a set with Effect A, B, C with a Minimum and Maximum Count of 2. This would lead to 2 out of the 3 effects being executed each time, chosen randomly.

* Note: If you need to randomize a larger pool of effects (greater than 8, which is the maximum capacity of a Set Effect), you may want to use a Create Persistent with periodic effects instead, since you can have up to 31 effects there and with Random Effect flag, achieve the same result. Sets are in general, cleaner.

### Effect: Validators

* Validators from the Validators data type that need to return true for the effect to execute.

### Target - Target Location Type

* Specifies the targeting requirement this effect has when used with an ability. If set to Unknown (the default), then it will try to determine that requirement from the child effects.

* This field controls how an ability should decide what kind of targeting should be used when this effect is part of an ability. If set to Unit, it would cause the ability to only be permitted to target units, and not target ground points, regardless of what the child effects are attempting to target. So if this effect is set to Point, but the child effects specify a Unit as their target location, the child effects will have no effect (since they will have no unit to hit for their effects). Unit or Point is used in the case of a mixture, where some effects are meant to hit a unit, but others hitting a point. This permits a unit to be targeted, and have that unit's location be used as the point for point targeted effects. If set to Unknown, the requirement is simply deferred to the child effects, so in the mixed case, it will become Unit or Point.