* This allow prevent move home/to caster at apply
* Also replace AI and reset movegens at control time
* Also stop combat and clear threat/hostile list at lost control for prevent combat with freindly units.
* Re-number enums by function groups and use where possible new defined masks in code instead raw enum |-lists.
* Avoid use movement generator generic state markers like UNIT_STAT_CONFUSED for mark movement stoped.
Add special shadow UNIT_STAT_CONFUSED_MOVE/etc states for like use.
UNIT_STAT_CONFUSED in like case will be safe expect use for normal checks confused state presence
And UNIT_STAT_CONFUSED_MOVE for check real move in this state
Function will return a cast result, with fail reasons if spell can not be casted (can be used to take alternative action). Please note this is not a full list of cast fail errors/reasons, but will cover a few basic errors that may occur.
The virtual function CanCastSpell() may be adjusted for custom needs from script library if not the default is sufficient.
Signed-off-by: NoFantasy <nofantasy@nf.no>
* Use AI::AttackStart calls only in case explicit request creature attack from core or AI code "attack it if can".
Like taunt, pet handler attack command.
* Use AI::AttackedBy for reaction at hostile action "do something at hostile action"
Like non-dot damage, swing, negative spell landing, or fade fear/etc.
And provided by default call AttackStart if no current target.
This fix some problems, like:
* Civilian will react propertly at attack by another creature (not pet or player).
* Will not cases (at least triggred by core) when attack target start run to attacker before any real hostile action apply.