How Stats - Targets Allowed works?

Level 5
Joined
May 10, 2024
Messages
57
Hi. I'm looking at the Stats - Targets Allowed and do not understand how it works. Is it AND or OR or something else...
Dark Ritual: Air, Ground, Invulnerable, Non-hero, Player Units, Vulnerable.

1. Is it AND? Nope. Unit cannot be Air and Ground.
2. Is it OR? Nope. Dark ritual cannot be casted on heroes. Ground is true. Non-hero is false.
3. Is it category + and? Like: Movement + Vulnerability + Hero + Alliance? (Air or Ground) and (Invulnerable or Vulnerable) and (Non-hero) and (Player Units). Looks like it is true, but what if we check Inferno? Ground, Structure, Debris, Enemy, Neutral. (Ground) and (Structure) and (Debris) and (Enemy or Neutral). Nothing will match this condition.

What would happen if I add Tree to Dark Ritual? Will I be able to cast it on trees?
What would happen if I select only tree and heroes for Dark Ritual? Will I be able to cast it on trees and heroes or will not be able to cast it at all...
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
It's setting restrictions, but some counteract one another and there can be hardcoded behavior. Not every ability is designed the same way.
What would happen if I add Tree to Dark Ritual? Will I be able to cast it on trees?
What would happen if I select only tree and heroes for Dark Ritual? Will I be able to cast it on trees and heroes or will not be able to cast it at all...
Why not just test this yourself? I would assume that you cannot target trees with it.
 
Level 5
Joined
May 10, 2024
Messages
57
Let's try to analyze it together.

Test: #1.
Subject: Dark Ritual.
Target: understand how Stats - Targets Allowed works.

We are going straight to Stats - Targets Allowed field located inside of Dark Ritual ability. It contains: Air, Ground, Invulnerable, Non-hero, Player Units, Vulnerable. After a few seconds of ... thinking, awareness appears in the brain. It means that the unit should be 1. Air or Ground 2. Invulnerable or Vulnerable 3. Non-hero. 4. Unit belongs to player.

Final condition is: (Air or Ground) and (Invulnerable or Vulnerable) and (Non-hero) and (belongs to player).

Test: #2.
Subject: Modified Dark Ritual.
Target: understand how Stats - Targets Allowed works.

Let's modify Targets Allowed to: Alive, Dead, Hero, Neutral, Non-hero, Non-ancient. I simply changing the original values in the following way:
1. Air or Ground to Alive or Dead.
2. Invulnerable or Vulnerable to Hero or Non-hero.
3. Non-hero to Non-ancient.
4. Unit belongs to player to Neutral.

Final condition is: (Alive or Dead) and (Hero or Non-hero) and (Non-ancient) and (Neutral). Based on defined targets we are looking for units which are: alive or dead (corpse), neutrals, including heroes, excluding ancients.

How it actually works:
1. Can't cast it on self, ally units, enemy units.
2. Can cast on any undead neutral units including structures.
3. Can't cast it on corpses.

Why in #2 we can not cast it on corpses?
Why in #2 we can cast it on structures while in #1 we can not do that? Because structure is ground??
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I would guess that you don't want to enable both "Hero" AND "Non-Hero" as they counteract one another so I can only imagine weird side effects. Then Non-Ancient would potentially exclude Structures (some NE structures are classified as Ancient). I don't see this ability ever being able to target Corpses though. I mean a Corpse doesn't even have any Hit Points to convert and how can you kill something that is already dead? Sounds like a good way to crash the game.

Since abilities have hardcoded behavior you'll likely need to experiment in a seemingly random way to get your desired result. For example, Carrion Swarm doesn't hit Structures and I read that the Ground option can actually be the reason why. It doesn't make any sense but that's because the hardcoded behavior is conflicting with the logic. Shockwave (which is assumedly coded the same way) uses both Ground and Structure to get around this.

I believe the "under the hood" design for this is something called bitwise operations, which allows you to store multiple targeting options as flags within a single integer. Then this integer gets checked in some kind of If Then Else to determine the targeting conditions. So I guess when experimenting with different options you'll be trying to get this integer to equal a certain value, like not equal to 0. Something like that...
 
Last edited:
Level 24
Joined
Feb 27, 2019
Messages
833
Heres how I see it so these are my subjective assumptions based on my experiences and looking at default values of spells in the world editor:
The target types all belong to a certain target type group. Alive/Dead is a target type group. Each target type group has a default setting. The default setting for the target type group Alive/Dead is Alive. Whenever any option is selected from the target type group it overrides the default setting and becomes OR in regards to any other target types in that target type group.

In the example of: Alive, Dead, Hero, Neutral, Non-hero, Non-ancient
It can target both Alive and Dead. It can target both Hero and Non-hero (This is the same as the default setting). It can only target Non-ancient. It can only target Neutral.

Why in #2 we can not cast it on corpses?
Dark Ritual is a Target ability. A Target ability normally cant target something that isnt targetable such as a Dead unit.

Why in #2 we can cast it on structures while in #1 we can not do that? Because structure is ground??
Buildings are not targeted as Ground, they are targeted as Structure. Selecting Ground will override the default setting for the target type group and becomes OR.
 
Top