mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
Previously CastAtUnit only handled ground-target spells (placement at the unit's feet); a non-ground spell fired with no implicit target (fell to current selection). Now it resolves the unit once to its object, reads position AND GUID, and dispatches the cast WITH that GUID -- the engine's FUN_SPELL_CAST_DISPATCH substitutes it exactly where it would the current selection (verified: passing 0 substitutes VAR_CURRENT_SELECTION_GUID), so a unit-target/normal spell fires straight at that unit regardless of current target. Branch on placement state after dispatch: no placement -> cast went out (unit-target); ground placement -> commit at the unit's feet (existing); other placement -> unit not accepted as target, cancel + false. AtCursor gains an optional targetGuid on DispatchSpellCast[ByName] (0 = prior behavior, so CastAtCursor is unchanged) and IsPlacementActive(). Verified in-game: ground spells still land at the unit's feet; Frostbolt/ Renew/PW:Fortitude cast on the named unit while another unit stays targeted.