In addition to my previous post regarding broken random mechanics in d2, apparently this obscure behavior is way more common than I initially thought. Every skill that constantly produces missiles is spoiled by it, e.g. Hive, Path of Flames, Beacon, etc.
Here is another example: SrvDoFunc (skill) = 146 has a similar issue, i.e. it causes unit seed to be set to unexpected value. This time though this function is called from the game code that manages various unit states and if state in question has its SrvAcitveFunc set to 146, it would call the corresponding SrvDoFunc. It's not as bad as the previous case with SrvDoFunc (skill) = 43, yet it still should be taken into consideration since the whole SrvDoFunc (skill) = 146 is a good example how to not write the code.
That's how the call sequence looks like:
Code: Select all
1. CALL Skill SrvDoFunc = X with AuraState which has SrvAcitveFunc = 146
Set D2SkillStrc + 0x18 (Skill X) to Rand(0x10000), where src D2Unit Seed is used to produce random value (MWC state)
2. CALL Skill SrvDoFunc = 146 till the state expiration
Set D2Unit Seed to 0x29A as high dword and D2SkillStrc + 0x18 (Skill X) as low dword (it's technically a reset)
Set D2SkillStrc + 0x18 (Skill X) to Rand(0xF4240), where src D2Unit Seed is used to produce random value (MWC state)
All this mess is done just to randomize missile position when it's spawned. Instead of using temporary local variable for that purpose they decided to use player/monster unit seed as a temporary variable, what a sick joke! Maybe I'm nitpicking but it's about the consistency and there is no consistency there, such behavior is an exception and more like a reason for scuffed random with a poor value distribution.
Just in case here is the list of SrvDoFunc that might? cause the same issue, even though I'm not sure if these functions are even called from anywhere (I haven't tested them as well): SrvDoFunc (skill) = 37, 39, 41, 143.