Example #1
0
 void HandleDummyTick(AuraEffect const* /*aurEff*/)
 {
     Unit* caster = GetCaster();
     Unit* target = GetTarget();
     if (caster && target)
     {
         if (target->HasUnitState(UNIT_STATE_CASTING))
         {
             caster->CastSpell(target, SPELL_MISTRESS_KISS_DAMAGE_SILENCE, true);
             target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
         }
     }
 }
bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32& time_diff)
{
    if (!owner.isAlive())
        return false;

    if (owner.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED))
    {
        owner.ClearUnitState(UNIT_STATE_FLEEING_MOVE);
        return true;
    }

    i_totalFleeTime.Update(time_diff);
    if (i_totalFleeTime.Passed())
        return false;

    // This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, const uint32 &) version
    // This is done instead of casting Unit& to Creature& and call parent method, then we can use Unit directly
    return MovementGeneratorMedium< Creature, FleeingMovementGenerator<Creature> >::Update(owner, time_diff);
}