Conditions are used to determine whether or not an action may execute.
Conditions can be used in [1]:
Conditions can be used in \[1\]:
-[Skill Mechanics](/skills/mechanics/skill)
-[Drop Tables](/drops/Drops#drop-tables)
-[Spawners](/Spawners)
...
...
@@ -14,7 +15,6 @@ When applying multiple conditions, all of them must be met in order for the skil
To see how to use in-line conditions, [click here!](/skills/Inline-Conditions)
## Types
Conditions can be broken into four types:
...
...
@@ -22,53 +22,67 @@ Conditions can be broken into four types:
1. Entity Conditions: These check the conditions of an entity.
2. Location Conditions: These check the conditions at a location. If a location condition is used while an entity is targeted, it will check the conditions at the entity's location.
3. Compare conditions: These check for certain conditions between two different "things". For example, "Cuboid" will return true if a target is within a cube where the corners are two coordinates
4. Meta conditions: they will not necessarily check against any inherent property of either the caster or a target. For instance, "StringEquals" will return true or false depending on whether two strings match. Those strings *can* be placeholders that fetch the value from either the caster or a target, but that is just one possible application.
4. Meta conditions: they will not necessarily check against any inherent property of either the caster or a target. For instance, "StringEquals" will return true or false depending on whether two strings match. Those strings _can_ be placeholders that fetch the value from either the caster or a target, but that is just one possible application.
## Usage
Conditions can also be used in three different places within a metaskill:
#### Conditions
Conditions in this section check against the caster or its location.
```yaml
Conditions:
-health{h=>10}
```
> Checks if the caster has more than 10 health points
```yaml
Conditions:
-globalscore{objective=Test;v=>10}
```
> In the example above, the globalscore condition will check the caster's global score.
---
#### TargetConditions
Conditions in this section check against the [inherited target](/Skills/Metaskills#inheritance) of the metaskill
```yaml
TargetConditions:
-health{h=>10}
```
> Checks if the inherited targeted entities have more than 10 health points, and only those that do will be inherited as an inherited target by the metaskill. If none do then the metaskill, by default, will not execute.
```yaml
TargetConditions:
-globalscore{objective=Test;v=>10}
```
> The example above the globalscore condition will check the inherited target's global score. Since globalscore is an entity condition, it will only work if an entity is targeted.
---
#### TriggerConditions
Conditions in this section check against the trigger of the metaskill
```yaml
TriggerConditions:
-health{h=>10}
```
> Checks if the trigger of the metaskill has more than 10 health points
## Ranged Values
Ranged values use either the format **#to#** or **#-#**. You must use "to" instead of "-" if you want to use negative numbers in the range. For:
```yaml
YourMagnificentSkill:
Conditions:
...
...
@@ -84,17 +98,15 @@ YourMagnificentSkill:
Condition Actions allow you to do additional things based off of conditions. The default condition action is **true**
| `true` | The skill will run if this condition is met |
| `false`| The skill will *not* run if this condition is met |
| `power` [multiplier] | Multiplies the skill's power by the value of `multiplier` (e.i. power 2.0 would double the skill's power) |
| `cast` [skill] | Casts an additional skill if the condition is met, without having effect on the execution of original skill |
| `castinstead` [skill] | Casts a different skill instead if the condition is met |
| `orElseCast` [skill] | Casts a different skill instead if the condition is not met |
| `false` | The skill will _not_ run if this condition is met |
| `power`\[multiplier\] | Multiplies the skill's power by the value of `multiplier` (e.i. power 2.0 would double the skill's power) |
| `cast`\[skill\] | Casts an additional skill if the condition is met, without having effect on the execution of original skill |
| `castinstead`\[skill\] | Casts a different skill instead if the condition is met |
| `orElseCast`\[skill\] | Casts a different skill instead if the condition is not met |
<!--
| `level` | |
-->
<!--| `level` | |-->
```yaml
Conditions:
...
...
@@ -102,6 +114,7 @@ Condition Actions allow you to do additional things based off of conditions. The
Skills:
-message{m="It's day!"} @self
```
> Will run only if it's day in the caster's world
```yaml
...
...
@@ -110,7 +123,8 @@ Condition Actions allow you to do additional things based off of conditions. The
Skills:
-message{m="It's *not* day!"} @self
```
> Will run only if it's *not* day in the caster's world
> Will run only if it's _not_ day in the caster's world\
> The opposite behavior of `true`
```yaml
...
...
@@ -125,10 +139,11 @@ OtherSkill:
Skills:
-message{m="It's day and not sunny!"} @self
```
> If a condition line is not met *(the condition is met and the condition action if false or vice versa)* [no more conditions will be checked](https://en.wikipedia.org/wiki/Short-circuit_evaluation)
> So even if OtherSkill is executed because of the `sunny` condition we can be sure that the `day` condition is also met, or else no skill would have run at all because
> `day true`
> is checked before
> If a condition line is not met _(the condition is met and the condition action if false or vice versa)_ [no more conditions will be checked](https://en.wikipedia.org/wiki/Short-circuit_evaluation)\
> So even if OtherSkill is executed because of the `sunny` condition we can be sure that the `day` condition is also met, or else no skill would have run at all because\
Conditions can also be grouped by parenthesis and evaluated via the **AND** (`&&`) and **OR** (`||`) boolean operators.
Conditions used this way can still have a condition action.
Conditions can also be grouped by parenthesis and evaluated via the **AND** (`&&`) and **OR** (`||`) boolean operators. Conditions used this way can still have a condition action.