* Add a new function: Unit::IsSecondChoiceTarget to evaluate if a target will be selected
* Cleanup a bit related code
* SelectHostileTarget
- Only call AI()->AttackStart for new targets
- Remove exception for top-most taunter
* Fix a few minor bugs related to selectNextVictim
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
Note: all spells with effect expect additional code for redirection reset.
Until code adding redirection work longer that expected.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
Patch partly rewrited with move new data into HostileRefManager
and added redirection to threatAssist. Also bug fixed with
redirection threat to unit not in hostile list yet.
ASSERT hard use in predictable way because diff. 3rd party libs code
redefine it inf different ways and hard make sure that used in end
of mangos define version. This is real detected problem make some
expected assert checks ignored and so bugs not detected as expected from code.
In addition made related changes:
* Common.h header expected to be first include in any src/game/header except most simple cases.
* Related FILE.h header expected to be first include in FILE.cpp
* Fixed some absent includes and type forwards for safe build without PCH enabled.
* Avoid using MANGOS_ASSERT in src/framework code
* Add single arg version Unit::AddThreat for just adding to threat list.
* Req. provide schollmask and crit flag for any real threat value for proper threats mod apply.
* Send crit flag in DealDamage as MELEE_HIT_CRIT for spell damage for later send to threat call.
* For not affected by modifiers threat values use SPELL_SCHOOL_MASK_NONE.
* Implement aura SPELL_AURA_MOD_CRITICAL_THREAT (used only in itemset 529 effect).
The brackets were placed wrong which caused creatures to ignore
threat from players out of melee range. Thanks to KAPATEJIb,
illusion22 and Lynx3d for researching
i used this script
for i in ls *.[ch]*; do cat $i | sed -r 's/(.*for.*iterator.*;\
*)([a-z0-9\_\*]+)\ *\+\+(.*)/\1++\2\3/' > /tmp/mangos/$i; done
for i in ls *.[ch]*; do cp /tmp/mangos/$i $i; done
and rechecked it with my eyes, if everything is right
i took only for-loops cause they can be gathered easier with a script
Signed-off-by: hunuza <hunuza@gmail.com>