void SpellHit(Unit* /*caster*/, const SpellEntry* Spell) { for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { SpellEffectEntry const* spellEffect = Spell->GetSpellEffect(SpellEffIndex(i)); if (spellEffect->Effect == 38) me->DisappearAndDie(); } }
bool SpellScript::UnitTargetHandler::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex) { SpellEffectEntry const* spellEffect = spellEntry->GetSpellEffect(SpellEffIndex(effIndex)); if (!spellEffect) return false; if (!targetType) return false; return (effIndex == SPELL_EFFECT_ANY) || (spellEffect->EffectImplicitTargetA == targetType || spellEffect->EffectImplicitTargetB == targetType); }
bool _SpellScript::EffectAuraNameCheck::Check(SpellEntry const* spellEntry, uint8 effIndex) { SpellEffectEntry const* spellEffect = spellEntry->GetSpellEffect(SpellEffIndex(effIndex)); if (!spellEffect) return false; if (!spellEffect->EffectApplyAuraName && !effAurName) return true; if (!spellEffect->EffectApplyAuraName) return false; return (effAurName == SPELL_EFFECT_ANY) || (spellEffect->EffectApplyAuraName == effAurName); }
void SmartAIMgr::LoadHelperStores() { uint32 oldMSTime = getMSTime(); SpellInfo const* spellInfo = NULL; for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) { spellInfo = sSpellMgr->GetSpellInfo(i); if (!spellInfo) continue; for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) { if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_SUMMON)) SummonCreatureSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j)))); else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_SUMMON_OBJECT_WILD)) SummonGameObjectSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j)))); else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT) || spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT2)) KillCreditSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j)))); } } IC_LOG_INFO("server.loading", ">> Loaded SmartAIMgr Helpers in %u ms", GetMSTimeDiffToNow(oldMSTime)); }
void ScriptMgr::FillSpellSummary() { SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()]; SpellEntry const* pTempSpell; for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) { SpellSummary[i].Effects = 0; SpellSummary[i].Targets = 0; pTempSpell = GetSpellStore()->LookupEntry(i); //This spell doesn't exist if (!pTempSpell) continue; for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) { SpellEffectEntry const* spellEffect = pTempSpell->GetSpellEffect(SpellEffIndex(j)); if (!spellEffect) continue; //Spell targets self if (spellEffect->EffectImplicitTargetA == TARGET_UNIT_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1); //Spell targets a single enemy if (spellEffect->EffectImplicitTargetA == TARGET_UNIT_TARGET_ENEMY || spellEffect->EffectImplicitTargetA == TARGET_DST_TARGET_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1); //Spell targets AoE at enemy if (spellEffect->EffectImplicitTargetA == TARGET_UNIT_AREA_ENEMY_SRC || spellEffect->EffectImplicitTargetA == TARGET_UNIT_AREA_ENEMY_DST || spellEffect->EffectImplicitTargetA == TARGET_SRC_CASTER || spellEffect->EffectImplicitTargetA == TARGET_DEST_DYNOBJ_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1); //Spell targets an enemy if (spellEffect->EffectImplicitTargetA == TARGET_UNIT_TARGET_ENEMY || spellEffect->EffectImplicitTargetA == TARGET_DST_TARGET_ENEMY || spellEffect->EffectImplicitTargetA == TARGET_UNIT_AREA_ENEMY_SRC || spellEffect->EffectImplicitTargetA == TARGET_UNIT_AREA_ENEMY_DST || spellEffect->EffectImplicitTargetA == TARGET_SRC_CASTER || spellEffect->EffectImplicitTargetA == TARGET_DEST_DYNOBJ_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1); //Spell targets a single friend(or self) if (spellEffect->EffectImplicitTargetA == TARGET_UNIT_CASTER || spellEffect->EffectImplicitTargetA == TARGET_UNIT_TARGET_ALLY || spellEffect->EffectImplicitTargetA == TARGET_UNIT_TARGET_PARTY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1); //Spell targets aoe friends if (spellEffect->EffectImplicitTargetA == TARGET_UNIT_PARTY_CASTER || spellEffect->EffectImplicitTargetA == TARGET_UNIT_PARTY_TARGET || spellEffect->EffectImplicitTargetA == TARGET_SRC_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1); //Spell targets any friend(or self) if (spellEffect->EffectImplicitTargetA == TARGET_UNIT_CASTER || spellEffect->EffectImplicitTargetA == TARGET_UNIT_TARGET_ALLY || spellEffect->EffectImplicitTargetA == TARGET_UNIT_TARGET_PARTY || spellEffect->EffectImplicitTargetA == TARGET_UNIT_PARTY_CASTER || spellEffect->EffectImplicitTargetA == TARGET_UNIT_PARTY_TARGET || spellEffect->EffectImplicitTargetA == TARGET_SRC_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1); //Make sure that this spell includes a damage effect if (spellEffect->Effect == SPELL_EFFECT_SCHOOL_DAMAGE || spellEffect->Effect == SPELL_EFFECT_INSTAKILL || spellEffect->Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE || spellEffect->Effect == SPELL_EFFECT_HEALTH_LEECH) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE-1); //Make sure that this spell includes a healing effect (or an apply aura with a periodic heal) if (spellEffect->Effect == SPELL_EFFECT_HEAL || spellEffect->Effect == SPELL_EFFECT_HEAL_MAX_HEALTH || spellEffect->Effect == SPELL_EFFECT_HEAL_MECHANICAL || (spellEffect->Effect == SPELL_EFFECT_APPLY_AURA && spellEffect->EffectApplyAuraName == 8)) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1); //Make sure that this spell applies an aura if (spellEffect->Effect == SPELL_EFFECT_APPLY_AURA) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1); } } }