void HandleBeforeHit() { if (Unit * target = GetHitUnit()) { if (target->GetTypeId() != TYPEID_PLAYER) { PreventHitEffect(EFFECT_0); PreventHitEffect(EFFECT_1); } } }
void HandleForceCast(SpellEffIndex i) { Player * plr = GetHitPlayer(); if (!plr) return; plr->CastSpell(GetTargetUnit(), GetSpellInfo()->EffectTriggerSpell[i], true); // Don't send m_originalCasterGUID param here or underlying PreventHitEffect(i); // AureEffect::HandleAuraControlVehicle will fail on caster == target }
void HandleTriggerSpell(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); PreventHitEffect(EFFECT_0); PreventHitEffect(EFFECT_1); std::list<Creature*> unitList; Unit* target = NULL; caster->GetCreaturesWithEntryInRange(unitList, 30.0f, NPC_BLUE_RACER); if (!unitList.empty()) for (std::list<Creature*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) if (caster->HasInLine((*itr), 1.0f) && (*itr)->GetGUID() != caster->GetGUID()) { target = (*itr); break; } if (!target) { unitList.clear(); caster->GetCreaturesWithEntryInRange(unitList, 30.0f, NPC_RED_RACER); if (!unitList.empty()) for (std::list<Creature*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) if (caster->HasInLine((*itr), 1.0f) && (*itr)->GetGUID() != caster->GetGUID()) { target = (*itr); break; } } if (target) { caster->CastSpell(target, SPELL_RACER_CHARGE_TO_OBJECT, true); caster->CastSpell(target, SPELL_RACER_SLAM_HIT, true); } else { Position pos; float x = caster->GetPositionX()+30*cos(caster->GetOrientation()); float y = caster->GetPositionY()+30*sin(caster->GetOrientation()); pos.Relocate(x, y, caster->GetMap()->GetHeight(x, y, MAX_HEIGHT)+0.5f); //caster->GetFirstCollisionPosition(pos, 30.0f, caster->GetOrientation()); caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_RACER_CHARGE_TO_OBJECT, true); } }
void HandleCast(SpellEffIndex effIndex) { PreventHitEffect(effIndex); if (!GetHitUnit()) return; float x, y, z; GetHitUnit()->GetPosition(x, y, z); Creature* dummy = GetCaster()->SummonCreature(NPC_UNSTABLE_EXPLOSION_STALKER, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); GetCaster()->CastSpell(dummy, SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER, true); }
void HandleSummon(SpellEffIndex effIndex) { PreventHitEffect(effIndex); uint32 entry = GetSpellInfo()->Effects[effIndex].MiscValue; SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(GetSpellInfo()->Effects[effIndex].MiscValueB); int32 duration = GetSpellInfo()->GetDuration(); if (!GetOriginalCaster() || !properties) return; if (TempSummon* summon = GetCaster()->GetMap()->SummonCreature(entry, *GetHitDest(), properties, duration, GetOriginalCaster(), GetSpellInfo()->Id)) { summon->SetCreatorGUID(GetOriginalCaster()->GetGUID()); summon->HandleSpellClick(GetCaster()); } }
void HandleScriptEffect(SpellEffIndex effIndex) { PreventHitEffect(effIndex); if (Unit* target = GetHitUnit()) GetCaster()->getThreatManager().modifyThreatPercent(target, -20); }