[Spell] Adaptable Physique

Status
Not open for further replies.

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
Hi again!

I posted a spell here that I wanted created nearly 6 months ago now, and the guy who tried making it work didn't answer. So I am reposting it here then.

Spellname: Adaptable Physique
Description: The materials which compose the Ooze adapts to any physical blow, making each successive
strike from the same target deal less damage. This adaptation lasts for 4 seconds after each strike,
and is unique for every unit attacking the Ooze.

What it does should be easy to understand, but from what I gather hard to execute. :eek: Will explain in detail anyway;
- Unit A attacks the Ooze each 3rd second. The damage gets lower and lower.
- Unit B attacks the Ooze each 5th second. The damage remains the same.
- Unit C attacks the Ooze each 3rd second for 9 seconds, then waits 5 seconds before starting over again. The damage gets lower for the 3 first strikes, then gets back to normal after 4 seconds.
- Unit D rapidly attacks the Ooze, 3 strikes per second for 10 seconds. The damage is minimal.

The thought is 2.5% less damage taken at level 1, up to 5% at level 5.
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
Bumping this, as it is the final spell I am missing (for 1 specific character). Anyone got a clue where I could start?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You could start with getting a damage detection system.
I don't know whether you use GUI or JASS, but there are good systems for both here on the hive.


- If the unit has not attacked yet:
Then you need to store the attacking unit inside a unit group and save a timer and the attack count in a hashtable.
The timer should probably be set to 4.00 (as you said that's the time before the effect wears off).
The attack count should be 1 (it's the first time he attacked).

- If the unit has attacked already (and is thus inside the unit group you put him in before):
Reset the timer to 4.00.
Then you need to increase attackCount by 1 and heal the target for the amount of damage reduced (NOTE: if the unit can easily die before he can be healed, then it is quite buggy).


Now you need to run a timed trigger (every 0.1 seconds is enough for what you're trying to accomplish).
Pick all units inside the unit group and set their timer to timer -0.10.
Once the timer reaches 0.00, remove the unit from the group and clear the hashtable (thus no damage will be reduced anymore).
 
  • Like
Reactions: Esa

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
Ah, thanks. Will try it!

Just a minor detail; Won't it be able to kill the unit, if the effect is that it does normal damage first, then heals up the reduction?
and another thing: will the damage detection system separate magic from physical damage? Will a spell count as an attack, or will only auto-attacks, either ranged or melee go for physical?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Oh, yes, sorry.

To solve that, you need to make a dummy ability based on Item Life Bonus and add it to the unit.
Now you can heal the unit without him dying.
Then start a timer that will end in 0. seconds (seems pointless, but a small wait is required and with regular waits you can see the weird HP increment) and then add the HP and remove the ability.

I've added a demo-map for you to see (don't forget to look at the map's script).

You'll have to change the life given to whatever it is you want.

Edit: magic damage will count as well. I think someone (perhaps Nestharus?) was creating some kind of system to differentiate magic from physical damage, but I wouldn't know about that.
 

Attachments

  • HealUnits.w3x
    17.5 KB · Views: 64
Status
Not open for further replies.
Top