[Solved] Temporary Damage Boost

Status
Not open for further replies.
Level 4
Joined
May 24, 2017
Messages
93
I have an Item called Mutant blood that has a dummy spell on it. The idea is when it is used, it causes the user to do 10 more damage for 60 seconds. What is the best way to do this?

The way I have it now is this trigger.
  • Disable Mutant Blood
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in Players and do (Actions)
        • Loop - Actions
          • Player - Disable Acid Damage Spellbook for (Picked player)
and this trigger.
  • Mutant Blood
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Mutant Blood
    • Actions
      • Unit - Add Acid Damage Spellbook to (Triggering unit)
      • Wait 60.00 seconds
      • Unit - Remove Acid Damage Spellbook from (Triggering unit)
It adds a spell book to the user with the item damage +10 ability in it and removes it after 60 seconds.
I see so many problems with this(Like when many units use it or a unit dies and still has the ability).
I want it to be a buff and have the green damage number next to your damage when this is active.
I will not be able to respond until Sunday so just solutions until then please.
Thank you all and +rep to anybody who answers.
 
Level 27
Joined
Sep 26, 2009
Messages
2,474
When unit dies you can still manipulate its abilities - including removing said abilities.
You can use a persistent unit group variable where you add units which use the item and remove them when the effect ends. Then add a trigger that fires when unit dies, check if the unit is in the unit group and if so, remove the ability.

  • Mutant Blood
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Mutant Blood
    • Actions
      • Unit - Add Acid Damage Spellbook to (Triggering unit)
      • Unit Group - Add (Triggering unit) to MutantBloodGroup
      • Wait 60.00 seconds
      • Unit - Remove Acid Damage Spellbook from (Triggering unit)
      • Unit Group - Remove (Triggering unit) from MutantBloodGroup.
  • Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in MutantBloodGroup.) Equal to True
    • Actions
      • Unit - Remove Acid Damage Spellbook from (Triggering unit)
      • Unit Group - Remove (Triggering unit) from MutantBloodGroup.
As for green + damage, you can use the item ability "Item Damage Bonus". Nice thing about this is it adds the green damage as you want, but also will not display in unit's ability list in the UI, so you don't actually need spell book for that.

This, however, does not take care of things like the buff being dispelled. An easy way for this would be a periodic trigger that checks every so often if all units in the unit group still have the buff, like in the example below
  • Periodic
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in MutantBloodGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Mutant Blood) Equal to False
            • Then - Actions
              • Unit Group - Remove (Triggering unit) from MutantBloodGroup.
              • Unit - Remove Acid Damage Spellbook from (Triggering unit)
            • Else - Actions
Another option would be to detect when any unit casts any dispell ability (be it AoE or single target) and check if any of the targets is in the unit group.
 
Last edited:

Uncle

Warcraft Moderator
Level 68
Joined
Aug 10, 2018
Messages
7,165
I would just use a Dummy and have it cast Inner Fire on your Hero that lasts 60 seconds.

Edit: Oh, Inner Fire doesn't add flat damage. There must be a blizzard ability (that uses a buff) that does this.

Also, you could just add the +10 Attack Damage ability to the unit unless I'm missing something. I don't see the need for a Spellbook.
 
Last edited:
I would just use a Dummy and have it cast Inner Fire on your Hero that lasts 60 seconds.

Edit: Oh, Inner Fire doesn't add flat damage. There must be a blizzard ability (that uses a buff) that does this.

Also, you could just add the +10 Attack Damage ability to the unit unless I'm missing something. I don't see the need for a Spellbook. But I wouldn't use this method regardless.

Dummy unit casting flat damage roar +10 with an aoe of the minimum unit radius would probably work so like 28 or 24 at the position of the caster.
 

Uncle

Warcraft Moderator
Level 68
Joined
Aug 10, 2018
Messages
7,165
Dummy unit casting flat damage roar +10 with an aoe of the minimum unit radius would probably work so like 28 or 24 at the position of the caster.
Roar only has % damage.

I went through all of the abilities and can't find any with flat damage besides Auras (which defeats the purpose).

I guess Nichilus' method is required. I wish we had a "buff" ability that was similar to how Channel works.
 
Wurst:
package Demo
import ClosureTimers
import DamageEvent

constant BONUS_GROUP = CreateGroup()

public function tempDamageBonus(unit u)
    BONUS_GROUP.addUnit(u)
    doAfter(60.) () ->
        if u != null and u.isAlive() and BONUS_GROUP.contains(u)
            BONUS_GROUP.removeUnit(u)

init
    DamageEvent.addListener() () ->
        let dS = DamageEvent.getSource()
        let tU = DamageEvent.getTarget()

        if BONUS_GROUP.contains(dS)
            DamageEvent.setNextDamageFromCode()
            dS.damageTarget(tU, 10.)

I don't understand why you bother fiddling with the object interface over 20 lines of code
 
Level 4
Joined
May 24, 2017
Messages
93
Thank you all for replying, I think you have collectively answered my problem and I will explain why:

I thought I was using the spellbook to hide the Item Damage Boost ability but, you said that adding it would not leave an icon.

I would prefer to not use Jass or any coding language because I am not experienced in coding languages so if problem happens I can not fix it. I plan to learn more about Jass after I finish the project I am working on now, which I want to make all GUI.

Because the Item Damage Boost ability does not leave an icon, I will just change my trigger to add the ability and remove it after a 60 wait time. I believe the trigger can run many instances of the trigger so the wait time should not be a problem.

Ah I checked just there the spell is in the Neutral Hostile Heroes section and is called "Battle Roar".
I will also look into Battle Roar which sounds interesting.
 

Uncle

Warcraft Moderator
Level 68
Joined
Aug 10, 2018
Messages
7,165
You can hide the icon for ANY ability by setting it's Art - Button Positions to 0,-11. So never worry about "leaving an icon" it's not an issue. You can also hide Icons via triggers.

And yes, Triggering Unit is treated like a local variable unlike EVERY single other Event Response, so it's safe to use between Waits.

Battle Roar could be used if you wanted a dispellable buff. The only issue is restricting it so that it only hits your specific Hero, which could be a pain.

Then again what Footman16 said "Dummy unit casting flat damage roar +10 with an aoe of the minimum unit radius would probably work so like 28 or 24 at the position of the caster." would probably work.

There might be an extremely rare case where an unwanted unit gets the buff as well, which would probably depend on how your map works (if you mess around with collision/knockback effects/anything that could cause two units to overlap).
 
Status
Not open for further replies.
Top