• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Chaos Morph - Applying it to a system

Status
Not open for further replies.
Since the discovery of Leandrotp about a chaos morph without an alternate unit defined, I have been trying to figure out the rules in which chaos alters the stats of a unit.

Just to get you guys on the same page, this is the "no alternate" chaos morph trick I am talking about:
Now when you add this blank chaos to a hero, or an heroic unit, it will copy the green stats to the base stats, without morphing! You can use that trick to adjust your creeps stats at any time, without the need to call MakeUnitHeroic again.

Regarding your previous question, there's no direct way to retrieve the HeroicUnit's level, or any of the hidden Hero attributes. None of the JASS natives for heroes work with heroic units. However, if you morph the heroic unit into a real hero, that hero will keep all the current attributes of the heroic unit, and you'll be able to read them. (Of course you'll need to unmorph and make the unit heroic again)

So I played around with that and made some screenshots of how heroes get modified by such a chaos morph.


Now here are some things I found out about this:

1) Applying such a chaos ability to a hero does not interrupt any orders

2) It seems that hero stats are not affected by this. Which is a good thing, since we could always manipulate these via tomes directly and this means one less thing to worry about

3) It seems that the formula for the new attack value is:
Base attack (including damage bonus from primary stat) * 2
... one would assume that it just adds the damage bonus from primary stat plus bonuses, but it actually increases quadratic with every application of Chaos, so it actually does double the base attack here. For some odd reason, the green/red bonus value does not even matter here. Only base damage does.

4) It seems that the formula for the new armor value is:
White value (Agility agility stat armor bonus) * 2 + "green/red" bonus
... same as above. It actually increases exponentially instead of linear. Interesting to note: armor bonuses from items do matter here.

5) Attack increase does not take dices into account. Only the base attack matters, so if you have 7 base attack and a 1d3 on top, it will increase the attack to 15-17 (7*2+1d3) on the first use and 29-31 (14*2+1d3) on the second.

6) It seems that attack speed and move speed granted from items will remain the same after the attempted chaos morph. Not exactly sure about speeds granted from AGI, though. Still one less thing to worry about.

7) This is not visible from the screenshots, but it seems that health applied *above the base health* specified in the hero object data is also doubled every time the chaos ability get applied.
So the formula is:
New health = (Current health - Base Health) * 2
... and yes, we need to subtract the base health before multiplying. It seems that the game saves the base health seperate from the current health.

8) The same formula applies to Mana.

9) The unit does not actually morph, so everything else remains the same and making abilities permanent is not necessary.


-----------------------------------------

So how do we tame these formulas to get SetHeroBaseArmor and SetHeroBaseAttack?
This is where I'm currently stuck.

The problem is the exponential nature of the bonus granted by Chaos. So in order to handle that, the easiest way would be to reduce the attack back to 0 every time we apply a new chaos. That way we can apply green bonuses freely and will always get the right damage/armor value out of it.

But how do we do that?
I tried using a modified "Roar" ability with a damage modifier set to -1.00. And this works; the amount of red malus applied perfectly matches the base attack of the unit. However, when applying a chaos with roar active, the base attack still doubles. It seems that temporary bonuses granted by buffs are not considered by chaos.

So in the end the only way we can do that is by applying the primary stat via tomes. If the primary stat does not grant any damage (depends on gameplay constants), we are screwed.


EDIT: Screw what I wrote. The green +damage bonus doesn't even matter for attack. It is never applied to the attack damage. Only the base damage gets doubled on every use, so the only thing we can do is modifying the primary stat.

EDIT2: Interesting... this only applies to damage, not armor. It seems that the green or red values on armor are considered, but not on attack damage. This means we can use chaos to reset armor back to 0, but we can not set damage back.
 

Attachments

  • test1.jpg
    test1.jpg
    112.1 KB · Views: 179
  • test2.jpg
    test2.jpg
    110.8 KB · Views: 139
Last edited:
So here is a system that applies all this practical knowledge in pseudo-code:


SetHeroArmorAndAttack
- Apply tomes with -1 on the primary stat until the base damage is 0
- Apply negative armor to the hero so that the total resulting armor is 0
- Apply chaos
- Add tomes with +1 on the primary stat until half of the desired damage amount
- Apply positive armor to the hero in the desired amount
- Apply chaos
- repair any health/mana changes via the SetUnitMaxState() snippet


EDIT: Well... this will permanently alter the primary stat amount. Fuck it. I give up.
 
Status
Not open for further replies.
Top