Much better now!
-) Misspelling: Freindly
-) Misleading "friendly" in many descriptions. All variables have nothing to do with allied players.
This condition does not do anything useful: !!FU&i^dark_enabledForAI^=(FALSE):E;
The whole logics of dark_enabledForAI seems to be unclear.
Check for AI should be done via OW:I(player)/?(isAi:y);
-) ; Jump to the next hero if hero is in the same team with current player
Obvious comment. !!co is jump, the condition is trivial.
-) !!HEi:O?(owner:y);
!!OW:T(owner)/?(heroTeam:y);
Check for NO_OWNER and continue. Do not get team for heroes without owner.
-) Separate break commands from the rest code, they are flow control structures (important things):
- !!re (slot:y)/(ARMY_SLOT_FIRST)/(ARMY_SLOT_LAST);
- !!HE:C0/(slot)/?(monType:y)/?(monType:y);
-
- !!br&(monType)=(MON_DARKNESS_DRAGON);
- !!br&i^Typhon_Third_Upgrade_Mod_Active^=(TRUE)/i^dark_enabledForChasmDragon^=(TRUE)/(monType)=(MON_CHASM_DRAGON);
- !!en;
-) !!UN:U(OBJ_HERO)/i/-1/?(x)/?(y)/?(z);
That's wrong! UN:U searches for N-th object on adventure map, many heroes are not on adventure map and besides, you already have necessary hero ID.
- !!HEi:P?(x)/?(y)/?(z);
- !!UN:H(x)/(y)/(z)/(player)/i^dark_radius^;
My congratulations. Your coding skills are improving from day to day!
This script is really modular, clear and reusable.