• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Spell] Removing new buffs without affecting existing buffs

Status
Not open for further replies.
I'm thinking of a way to remove newly applied buffs on a unit, as I want to create a shield-that-protects-from-future-debuffs ability. If the unit has had debuffs by the time the shield is applied, the existing debuffs will be preserved.
Warcraft III has some spells to achieve these effects, but they are imperfect one way or another:
  • Anti-Magic Shell (old): It makes the unit untargetable by most spells, and immune to spell damage. It also removes existing debuffs because it gives spell immunity to the unit.
  • Amulet of Spell Shield: It protects the unit from debuffs of single target spells, but not from debuffs of AoE spells.
There are also debuffs that don't count as spell debuffs such as poison from Envenomed Spears or armor reduction from Orb of Corruption.
I thought of using triggers but Warcraft III doesn't have a way to remember the status bar of a unit at a point in time.
Does anybody have a suggestion?
 
Working with a single buff is easy, but the question is: where is the starting point to handle this dynamically? It's pretty abstract.
In GUI, there is no event that detects the application of a buff on a unit. Perhaps the application of a buff on a unit will issue an order, which will make checking the application of a buff possible with JASS, but I'm not certain. Even so, there is likely no event response for the buff being added, if the "issued order" isn't unique for each different buff.
Let's say I'm using a periodic event, then how will I get the buff state of a unit to compare with its buff state the next time the periodic event fires?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,578
For comparisons like that you would use 2 Arrays/Tables/Lists (whatever your language of choice supports). One represents Old buffs and the other represents New buffs. Old buffs gets updated to match New buffs in the Periodic Event trigger but not before you've compared the two to find any differences. Well, something like that I guess...
 
Status
Not open for further replies.
Top