void HandleBanish(SpellMissInfo missInfo) { if (missInfo != SpellMissInfo.Immune) { return; } Unit target = GetHitUnit(); if (target) { // Casting Banish on a banished target will Remove applied aura Aura banishAura = target.GetAura(GetSpellInfo().Id, GetCaster().GetGUID()); if (banishAura != null) { banishAura.Remove(); } } }
void HandleBeforeHit(SpellMissInfo missInfo) { if (missInfo != SpellMissInfo.None) { return; } Unit target = GetHitUnit(); if (target != null) { // Deadly Poison AuraEffect aurEff = target.GetAuraEffect(AuraType.PeriodicDummy, SpellFamilyNames.Rogue, new FlagArray128(0x10000, 0x80000, 0), GetCaster().GetGUID()); if (aurEff != null) { _stackAmount = aurEff.GetBase().GetStackAmount(); } } }
void PreventHitByLoS(SpellMissInfo missInfo) { if (missInfo != SpellMissInfo.None) { return; } Unit target = GetHitUnit(); if (target) { Unit caster = GetCaster(); //Temporary Line of Sight Check List <GameObject> blockList = new List <GameObject>(); caster.GetGameObjectListWithEntryInGrid(blockList, GameObjectIds.SaroniteRock, 100.0f); if (!blockList.Empty()) { foreach (var obj in blockList) { if (!obj.IsInvisibleDueToDespawn()) { if (obj.IsInBetween(caster, target, 4.0f)) { prevented = true; target.ApplySpellImmune(GetSpellInfo().Id, SpellImmunity.Id, GetSpellInfo().Id, true); PreventHitDefaultEffect(0); PreventHitDefaultEffect(1); PreventHitDefaultEffect(2); PreventHitDamage(); break; } } } } } }
private void DoAllEffectsOnTarget(TargetInfo target) { if (target == null || target.Processed) { return; } target.Processed = true; // Target checked in apply effects procedure // Get mask of effects for target int mask = target.EffectMask; Unit unit = Caster.Character.Id == target.TargetId ? Caster : ArenaManager.FindUnit(target.TargetId); if (!unit) { return; } if (unit.IsAlive() != target.Alive) { return; } // Get original caster (if exist) and calculate damage/healing from him data Unit caster = OriginalCaster != null ? OriginalCaster : Caster; // Skip if m_originalCaster not avaiable if (caster == null) { return; } SpellMissInfo missInfo = target.MissCondition; // Need init unitTarget by default unit (can changed in code on reflect) // Or on missInfo != SPELL_MISS_NONE unitTarget undefined (but need in trigger subsystem) UnitTarget = unit; // Reset damage/healing counter Damage = target.Damage; Healing = -target.Damage; SpellAura = null; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied Unit spellHitTarget = null; if (missInfo == SpellMissInfo.NONE) // In case spell hit target, do all effect on that target { spellHitTarget = unit; } else if (missInfo == SpellMissInfo.REFLECT) // In case spell reflect from target, do all effect on caster (if hit) { if (target.ReflectResult == SpellMissInfo.NONE) // If reflected spell hit caster -> do all effect on him { spellHitTarget = Caster; } } if (spellHitTarget) { SpellMissInfo missInfo2 = DoSpellHitOnUnit(spellHitTarget, mask); if (missInfo2 != SpellMissInfo.NONE) { Damage = 0; spellHitTarget = null; } } // All calculated do it! // Do healing and triggers if (Healing > 0) { bool crit = target.Crit; int addhealth = Healing; //if (crit) // addhealth = caster->SpellCriticalHealingBonus(SpellInfo, addhealth, NULL); //int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth, crit); //Healing = gain; } // Do damage and triggers else if (Damage > 0) { // Fill base damage struct (unitTarget - is real spell target) SpellDamage damageInfo = new SpellDamage(caster, UnitTarget, SpellInfo.Id, SpellSchoolMask, CastId); // Add bonuses and fill damageInfo struct caster.CalculateSpellDamageTaken(damageInfo, Damage, SpellInfo, target.Crit); //caster.DealDamageMods(damageInfo.Target, damageInfo.damage, &damageInfo.absorb); Damage = damageInfo.Damage; caster.DealSpellDamage(damageInfo); } // Passive spell hits/misses or active spells only misses (only triggers) else { // Fill base damage struct (unitTarget - is real spell target) /*SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask); * procEx |= createProcExtendMask(&damageInfo, missInfo); * // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) * if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) * caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo, m_triggeredByAuraSpell);*/ } if (spellHitTarget) { // Needs to be called after dealing damage/healing to not remove breaking on damage auras //DoTriggersOnSpellHit(spellHitTarget, mask); //CallScriptAfterHitHandlers(); } }