mangosR2/scriptdev2 — Issue #39: CREATURE AI PROBLEMS ...
Author: Voidx
Created: 2011-10-22 22:52:19+00:00
State: open

````
CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 uiCastFlags, ObjectGuid uiOriginalCasterGUID)
{
Unit* pCaster = m_creature;

if (uiCastFlags & CAST_FORCE_TARGET_SELF)
pCaster = pTarget;

if (!pTarget)
return CAST_FAIL_OTHER;

// Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggeredçç

```
must be:

```

CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 uiCastFlags, ObjectGuid uiOriginalCasterGUID)
{
if (!pTarget)
return CAST_FAIL_OTHER;

Unit* pCaster = m_creature;

if (uiCastFlags & CAST_FORCE_TARGET_SELF)
pCaster = pTarget;

// Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered

```
ADD MORE:
pTarget=pCaster.