diff options
Diffstat (limited to 'src/game/SpellAuras.cpp')
-rw-r--r-- | src/game/SpellAuras.cpp | 1812 |
1 files changed, 846 insertions, 966 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 9c54bf7e27b..c303e5cdb11 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -74,7 +74,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleInvisibility, // 18 SPELL_AURA_MOD_INVISIBILITY &Aura::HandleInvisibilityDetect, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECTION &Aura::HandleAuraModTotalHealthPercentRegen, // 20 SPELL_AURA_OBS_MOD_HEALTH - &Aura::HandleAuraModTotalEnergyPercentRegen, // 21 SPELL_AURA_OBS_MOD_ENERGY + &Aura::HandleAuraModTotalEnergyPercentRegen, // 21 SPELL_AURA_OBS_MOD_ENERGY &Aura::HandleAuraModResistance, // 22 SPELL_AURA_MOD_RESISTANCE &Aura::HandlePeriodicTriggerSpell, // 23 SPELL_AURA_PERIODIC_TRIGGER_SPELL &Aura::HandlePeriodicEnergize, // 24 SPELL_AURA_PERIODIC_ENERGIZE @@ -223,7 +223,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraModRangedAttackPowerPercent, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT &Aura::HandleNoImmediateEffect, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus &Aura::HandleNoImmediateEffect, //169 SPELL_AURA_MOD_CRIT_PERCENT_VERSUS implemented in Unit::DealDamageBySchool, Unit::DoAttackDamage, Unit::SpellCriticalBonus - &Aura::HandleNULL, //170 SPELL_AURA_DETECT_AMORE different spells that ignore transformation effects + &Aura::HandleNULL, //170 SPELL_AURA_DETECT_AMORE various spells that change visual of units for aura target (clientside?) &Aura::HandleAuraModIncreaseSpeed, //171 SPELL_AURA_MOD_SPEED_NOT_STACK &Aura::HandleAuraModIncreaseMountedSpeed, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK &Aura::HandleUnused, //173 unused (3.0.8a) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell @@ -236,7 +236,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus &Aura::HandleUnused, //181 unused (3.0.8a) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS &Aura::HandleAuraModResistenceOfStatPercent, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT - &Aura::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746 + &Aura::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746 - miscvalue - spell school &Aura::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst &Aura::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst &Aura::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult @@ -247,9 +247,9 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED &Aura::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_HASTE_MELEE &Aura::HandleModCombatSpeedPct, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct) - &Aura::HandleNULL, //194 SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist + &Aura::HandleNoImmediateEffect, //194 SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist &Aura::HandleNoImmediateEffect, //195 SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist - &Aura::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN + &Aura::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN - flat mod of spell cooldowns &Aura::HandleNoImmediateEffect, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance &Aura::HandleUnused, //198 unused (3.0.8a) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS &Aura::HandleNoImmediateEffect, //199 SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT implemented in Unit::MagicSpellHitResult @@ -258,7 +258,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //202 SPELL_AURA_CANNOT_BE_DODGED implemented in Unit::RollPhysicalOutcomeAgainst &Aura::HandleNoImmediateEffect, //203 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage &Aura::HandleNoImmediateEffect, //204 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage - &Aura::HandleNULL, //205 vulnerable to school dmg? + &Aura::HandleNULL, //205 SPELL_AURA_MOD_SCHOOL_CRIT_DMG_TAKEN &Aura::HandleAuraModIncreaseFlightSpeed, //206 SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED &Aura::HandleAuraModIncreaseFlightSpeed, //207 SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &Aura::HandleAuraModIncreaseFlightSpeed, //208 SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED @@ -274,19 +274,19 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraModRangedHaste, //218 SPELL_AURA_HASTE_RANGED &Aura::HandleModManaRegen, //219 SPELL_AURA_MOD_MANA_REGEN_FROM_STAT &Aura::HandleModRatingFromStat, //220 SPELL_AURA_MOD_RATING_FROM_STAT - &Aura::HandleNULL, //221 ignored + &Aura::HandleNULL, //221 SPELL_AURA_MOD_DETAUNT &Aura::HandleUnused, //222 unused (3.0.8a) only for spell 44586 that not used in real spell cast &Aura::HandleNoImmediateEffect, //223 SPELL_AURA_RAID_PROC_FROM_CHARGE &Aura::HandleUnused, //224 unused (3.0.8a) &Aura::HandleNoImmediateEffect, //225 SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE &Aura::HandleAuraPeriodicDummy, //226 SPELL_AURA_PERIODIC_DUMMY &Aura::HandlePeriodicTriggerSpellWithValue, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE - &Aura::HandleNoImmediateEffect, //228 stealth detection - &Aura::HandleNULL, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE + &Aura::HandleNoImmediateEffect, //228 SPELL_AURA_DETECT_STEALTH stealth detection + &Aura::HandleNoImmediateEffect, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE &Aura::HandleAuraModIncreaseHealth, //230 SPELL_AURA_MOD_INCREASE_HEALTH_2 &Aura::HandleNoImmediateEffect, //231 SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE &Aura::HandleNoImmediateEffect, //232 SPELL_AURA_MECHANIC_DURATION_MOD implement in Unit::CalculateSpellDuration - &Aura::HandleNULL, //233 set model id to the one of the creature with id GetMiscValue() + &Aura::HandleUnused, //233 set model id to the one of the creature with id GetMiscValue() - clientside &Aura::HandleNoImmediateEffect, //234 SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK implement in Unit::CalculateSpellDuration &Aura::HandleNoImmediateEffect, //235 SPELL_AURA_MOD_DISPEL_RESIST implement in Unit::MagicSpellHitResult &Aura::HandleAuraControlVehicle, //236 SPELL_AURA_CONTROL_VEHICLE @@ -294,18 +294,18 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleModSpellHealingPercentFromAttackPower, //238 SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER implemented in Unit::SpellBaseHealingBonus &Aura::HandleAuraModScale, //239 SPELL_AURA_MOD_SCALE_2 only in Noggenfogger Elixir (16595) before 2.3.0 aura 61 &Aura::HandleAuraModExpertise, //240 SPELL_AURA_MOD_EXPERTISE - &Aura::HandleForceMoveForward, //241 Forces the player to move forward - &Aura::HandleUnused, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING + &Aura::HandleForceMoveForward, //241 SPELL_AURA_FORCE_MOVE_FORWARD Forces the player to move forward + &Aura::HandleUnused, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING - 2 test spells: 44183 and 44182 &Aura::HandleNULL, //243 faction reaction override spells - &Aura::HandleComprehendLanguage, //244 Comprehend language + &Aura::HandleComprehendLanguage, //244 SPELL_AURA_COMPREHEND_LANGUAGE &Aura::HandleNoImmediateEffect, //245 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL &Aura::HandleNoImmediateEffect, //246 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK implemented in Spell::EffectApplyAura - &Aura::HandleNULL, //247 target to become a clone of the caster + &Aura::HandleAuraCloneCaster, //247 SPELL_AURA_CLONE_CASTER &Aura::HandleNoImmediateEffect, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst &Aura::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE &Aura::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2 &Aura::HandleNoImmediateEffect, //251 SPELL_AURA_MOD_ENEMY_DODGE - &Aura::HandleNULL, //252 haste all? + &Aura::HandleModCombatSpeedPct, //252 SPELL_AURA_252 Is there any difference between this and SPELL_AURA_MELEE_SLOW ? maybe not stacking mod? &Aura::HandleNoImmediateEffect, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE implemented in Unit::isBlockCritical &Aura::HandleAuraModDisarm, //254 SPELL_AURA_MOD_DISARM_OFFHAND &Aura::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus @@ -325,26 +325,26 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage &Aura::HandleNoImmediateEffect, //270 SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage &Aura::HandleNoImmediateEffect, //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonus - &Aura::HandleNULL, //272 reduce spell cast time? + &Aura::HandleNULL, //272 unknown &Aura::HandleUnused, //273 clientside &Aura::HandleNoImmediateEffect, //274 SPELL_AURA_CONSUME_NO_AMMO implemented in spell::CalculateDamageDoneForAllTargets &Aura::HandleNoImmediateEffect, //275 SPELL_AURA_MOD_IGNORE_SHAPESHIFT Use SpellClassMask for spell select &Aura::HandleNULL, //276 mod damage % mechanic? &Aura::HandleNoImmediateEffect, //277 SPELL_AURA_MOD_ABILITY_AFFECTED_TARGETS implemented in spell::settargetmap &Aura::HandleAuraModDisarm, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon - &Aura::HandleNULL, //279 visual effects? 58836 and 57507 + &Aura::HandleAuraInitializeImages, //279 SPELL_AURA_INITIALIZE_IMAGES &Aura::HandleModArmorPenetrationPct, //280 SPELL_AURA_MOD_ARMOR_PENETRATION_PCT &Aura::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT &Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus - &Aura::HandleUnused, //284 not used by any spells (3.08a) + &Aura::HandleNULL, //284 SPELL_AURA_LINKED - probably not sent to client &Aura::HandleAuraModAttackPowerOfArmor, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in Player::UpdateAttackPowerAndDamage - &Aura::HandleUnused, //286 not used by any spells (3.08a) + &Aura::HandleNoImmediateEffect, //286 SPELL_AURA_ABILITY_PERIODIC_CRIT implemented in AuraEffect::PeriodicTick &Aura::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult - &Aura::HandleUnused, //288 not used by any spells (3.09) except 1 test spell. + &Aura::HandleUnused, //288 unused &Aura::HandleUnused, //289 unused - &Aura::HandleUnused, //290 unused - &Aura::HandleUnused, //291 unused + &Aura::HandleNULL, //290 mod all critical hit chances? + &Aura::HandleNULL, //291 SPELL_AURA_MOD_XP_QUEST_PCT &Aura::HandleNULL, //292 call stabled pet &Aura::HandleNULL, //293 2 test spells &Aura::HandleNULL //294 2 spells, possible prevent mana regen @@ -354,7 +354,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= Aura::Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, WorldObject *source, Unit *caster, Item* castItem) : m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target), m_timeCla(0), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), -m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_auraStateMask(0), m_updated(false), m_isRemoved(false) +m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1), m_updated(false), m_isRemoved(false) { assert(target); @@ -369,8 +369,6 @@ m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_aura m_isPassive = IsPassiveSpell(GetId()); - m_auraStateMask = 0; - m_isSingleTargetAura = IsSingleTargetSpell(m_spellProto); m_applyTime = time(NULL); @@ -400,7 +398,7 @@ m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_aura { // Glyph of Thorns if (m_target == caster && m_spellProto->SpellFamilyName==SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags[0] & 0x100) - if (AuraEffect * aurEff = m_target->GetDummyAura(57862)) + if (AuraEffect * aurEff = m_target->GetAuraEffect(57862, 0)) m_maxduration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS; modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, m_maxduration); @@ -486,6 +484,9 @@ m_target(parentAura->GetTarget()), m_tickNumber(0) else m_amount = m_currentBasePoints + 1; + if (int32 amount = CalculateCrowdControlAuraAmount(caster)) + m_amount = amount; + if (!m_amount && castItem && castItem->GetItemSuffixFactor()) { ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId())); @@ -766,7 +767,8 @@ void AreaAuraEffect::Update(uint32 diff) case AREA_AURA_PET: { if(Unit *owner = caster->GetCharmerOrOwner()) - targets.push_back(owner); + if (owner->IsWithinDistInMap(source, m_radius)) + targets.push_back(owner); break; } } @@ -836,7 +838,7 @@ void AreaAuraEffect::Update(uint32 diff) } else if (!source->IsWithinDistInMap(m_target, m_radius)) { - if (needFriendly) + if (needFriendly && source->isMoving()) { m_removeTime -= diff; if (m_removeTime < 0) @@ -940,6 +942,191 @@ void Aura::ApplyAllModifiers(bool apply, bool Real) m_partAuras[i]->ApplyModifier(apply, Real); } +void Aura::HandleAuraSpecificMods(bool apply) +{ + if (apply) + { + if(m_spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT) + { + // Icebound Fortitude + if (m_spellProto->SpellFamilyFlags[0] & 0x00100000) + { + Unit * caster = GetCaster(); + if (caster && caster->GetTypeId() == TYPEID_PLAYER) + { + if(AuraEffect *auraeff = GetPartAura(2)) + { + int32 value = int32((auraeff->GetAmount()*-1)-10); + uint32 defva = uint32(((Player*)caster)->GetSkillValue(SKILL_DEFENSE) + ((Player*)caster)->GetRatingBonusValue(CR_DEFENSE_SKILL)); + + if(defva > 400) + value += int32((defva-400)*0.15); + + // Glyph of Icebound Fortitude + if (AuraEffect *auradummy = caster->GetAuraEffect(58625,0)) + { + uint32 valmax = auradummy->GetAmount(); + if(value < valmax) + value = valmax; + } + auraeff->SetAmount(-value); + } + } + } + } + + if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE) + { + if (m_spellProto->SpellFamilyFlags[0] & 0x00000001 && m_spellProto->SpellFamilyFlags[2] & 0x00000008) + { + // Glyph of Fireball + if (Unit * caster = GetCaster()) + if (caster->HasAura(56368)) + SetAuraDuration(0); + } + else if (m_spellProto->SpellFamilyFlags[0] & 0x00000020 && m_spellProto->SpellVisual[0] == 13) + { + // Glyph of Frostbolt + if (Unit * caster = GetCaster()) + if (caster->HasAura(56370)) + SetAuraDuration(0); + } + // Todo: This should be moved to similar function in spell::hit + else if (m_spellProto->SpellFamilyFlags[0] & 0x01000000) + { + Unit * caster = GetCaster(); + if (!caster) + return; + + // Polymorph Sound - Sheep && Penguin + if (m_spellProto->SpellIconID == 82 && m_spellProto->SpellVisual[0] == 12978) + { + // Glyph of the Penguin + if (caster->HasAura(52648)) + caster->CastSpell(m_target,61635,true); + else + caster->CastSpell(m_target,61634,true); + } + } + } + } + + // Aura Mastery Triggered Spell Handler + // If apply Concentration Aura -> trigger -> apply Aura Mastery Immunity + // If remove Concentration Aura -> trigger -> remove Aura Mastery Immunity + // If remove Aura Mastery -> trigger -> remove Aura Mastery Immunity + if (m_spellProto->Id == 19746 || m_spellProto->Id == 31821) + { + if (GetCasterGUID() != m_target->GetGUID()) + return; + if (apply) + { + if ((m_spellProto->Id == 31821 && m_target->HasAura(19746, GetCasterGUID())) || (m_spellProto->Id == 19746 && m_target->HasAura(31821))) + { + m_target->CastSpell(m_target,64364,true); + return; + } + } + else + { + m_target->RemoveAurasDueToSpell(64364, GetCasterGUID()); + return; + } + } + + if (GetSpellSpecific(m_spellProto->Id) == SPELL_PRESENCE) + { + AuraEffect *bloodPresenceAura=0; // healing by damage done + AuraEffect *frostPresenceAura=0; // increased health + AuraEffect *unholyPresenceAura=0; // increased movement speed, faster rune recovery + + // Improved Presences + Unit::AuraEffectList const& vDummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraEffectList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr) + { + switch((*itr)->GetId()) + { + // Improved Blood Presence + case 50365: + case 50371: + { + bloodPresenceAura = (*itr); + break; + } + // Improved Frost Presence + case 50384: + case 50385: + { + frostPresenceAura = (*itr); + break; + } + // Improved Unholy Presence + case 50391: + case 50392: + { + unholyPresenceAura = (*itr); + break; + } + } + } + + uint32 presence=GetId(); + if (apply) + { + // Blood Presence bonus + if (presence == SPELL_ID_BLOOD_PRESENCE) + m_target->CastSpell(m_target,63611,true); + else if (bloodPresenceAura) + { + int32 basePoints1=bloodPresenceAura->GetAmount(); + m_target->CastCustomSpell(m_target,63611,NULL,&basePoints1,NULL,true,0,bloodPresenceAura); + } + // Frost Presence bonus + if (presence == SPELL_ID_FROST_PRESENCE) + m_target->CastSpell(m_target,61261,true); + else if (frostPresenceAura) + { + int32 basePoints0=frostPresenceAura->GetAmount(); + m_target->CastCustomSpell(m_target,61261,&basePoints0,NULL,NULL,true,0,frostPresenceAura); + } + // Unholy Presence bonus + if (presence == SPELL_ID_UNHOLY_PRESENCE) + { + if(unholyPresenceAura) + { + // Not listed as any effect, only base points set + int32 basePoints0 = unholyPresenceAura->GetSpellProto()->EffectBasePoints[1]; + //m_target->CastCustomSpell(m_target,63622,&basePoints0 ,NULL,NULL,true,0,unholyPresenceAura); + m_target->CastCustomSpell(m_target,65095,&basePoints0 ,NULL,NULL,true,0,unholyPresenceAura); + } + m_target->CastSpell(m_target,49772, true); + } + else if (unholyPresenceAura) + { + int32 basePoints0=unholyPresenceAura->GetAmount(); + m_target->CastCustomSpell(m_target,49772,&basePoints0,NULL,NULL,true,0,unholyPresenceAura); + } + } + else + { + // Remove passive auras + if (presence == SPELL_ID_BLOOD_PRESENCE || bloodPresenceAura) + m_target->RemoveAurasDueToSpell(63611); + if (presence == SPELL_ID_FROST_PRESENCE || frostPresenceAura) + m_target->RemoveAurasDueToSpell(61261); + if (presence == SPELL_ID_UNHOLY_PRESENCE || unholyPresenceAura) + { + if(presence == SPELL_ID_UNHOLY_PRESENCE && unholyPresenceAura) + { + //m_target->RemoveAurasDueToSpell(63622); + m_target->RemoveAurasDueToSpell(65095); + } + m_target->RemoveAurasDueToSpell(49772); + } + } + } +} + void Aura::SendAuraUpdate() { if (m_auraSlot>=MAX_AURAS) @@ -960,7 +1147,7 @@ void Aura::SendAuraUpdate() data << uint32(GetId()); data << uint8(m_auraFlags); data << uint8(m_auraLevel); - data << uint8(m_stackAmount > 1 ? m_stackAmount : m_procCharges); + data << uint8(m_stackAmount > 1 ? m_stackAmount : (m_procCharges) ? m_procCharges : 1); if(!(m_auraFlags & AFLAG_CASTER)) { @@ -1096,57 +1283,7 @@ void Aura::_AddAura() } } - //***************************************************** - // Update target aura state flag - //***************************************************** - - // Update Seals information - if (IsSealSpell(m_spellProto)) - SetAuraState(AURA_STATE_JUDGEMENT); - - // Conflagrate aura state on Immolate or Shadowflame - if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && (m_spellProto->SpellFamilyFlags[0] & 4 - || m_spellProto->SpellFamilyFlags[2] & 2)) - SetAuraState(AURA_STATE_IMMOLATE); - - // Faerie Fire (druid versions) - if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags[0] & 0x400) - SetAuraState(AURA_STATE_FAERIE_FIRE); - - // Victorious - if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags[1] & 0x00040000) - SetAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH); - - // Swiftmend state on Regrowth & Rejuvenation - if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags[0] & 0x50 ) - SetAuraState(AURA_STATE_SWIFTMEND); - - // Deadly poison aura state - if(m_spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && m_spellProto->SpellFamilyFlags[0] & 0x10000) - SetAuraState(AURA_STATE_DEADLY_POISON); - - // Enrage aura state - if(m_spellProto->Dispel == DISPEL_ENRAGE) - SetAuraState(AURA_STATE_ENRAGE); - - // Bleeding aura state - if (GetAllSpellMechanicMask(m_spellProto) & 1<<MECHANIC_BLEED) - SetAuraState(AURA_STATE_BLEEDING); - - if(GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST) - { - for (uint8 i = 0;i<MAX_SPELL_EFFECTS;++i) - { - if (m_spellProto->EffectApplyAuraName[i]==SPELL_AURA_MOD_STUN - || m_spellProto->EffectApplyAuraName[i]==SPELL_AURA_MOD_ROOT) - { - SetAuraState(AURA_STATE_FROZEN); - break; - } - } - } - - m_target->ApplyModFlag(UNIT_FIELD_AURASTATE, GetAuraStateMask(), true); + HandleAuraSpecificMods(true); } bool Aura::SetPartAura(AuraEffect* aurEff, uint8 effIndex) @@ -1192,22 +1329,6 @@ void Aura::_RemoveAura() if (getDiminishGroup() != DIMINISHING_NONE ) m_target->ApplyDiminishingAura(getDiminishGroup(),false); - // Check needed only if aura applies aurastate - if(GetAuraStateMask()) - { - uint32 foundMask = 0; - Unit::AuraMap& Auras = m_target->GetAuras(); - // Get mask of all aurastates from remaining auras - for(Unit::AuraMap::iterator i = Auras.begin(); i != Auras.end(); ++i) - { - foundMask|=(*i).second->GetAuraStateMask(); - } - // Remove only aurastates which were not found - foundMask = GetAuraStateMask() &~foundMask; - if (foundMask) - m_target->ApplyModFlag(UNIT_FIELD_AURASTATE, foundMask, false); - } - // since now aura cannot apply/remove it's modifiers m_isRemoved = true; // disable client server communication for removed aura @@ -1262,23 +1383,25 @@ void Aura::_RemoveAura() if (procEx) { uint32 ProcCaster, ProcVictim; - if (IsPositiveSpell(GetId())) + if (IsPositive()) { - ProcCaster = PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL; - ProcVictim = PROC_FLAG_TAKEN_POSITIVE_SPELL; + ProcCaster = PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT; + ProcVictim = PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL | PROC_FLAG_TAKEN_POSITIVE_SPELL; } else { - ProcCaster = PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT; - ProcVictim = PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT; + ProcCaster = PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT; + ProcVictim = PROC_FLAG_TAKEN_NEGATIVE_MAGIC_SPELL | PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT; } caster->ProcDamageAndSpell(m_target,ProcCaster, ProcVictim, procEx, m_procDamage, BASE_ATTACK, m_spellProto); } } + HandleAuraSpecificMods(false); } void Aura::SetStackAmount(uint8 stackAmount, bool applied) { + bool refresh = stackAmount >= m_stackAmount; if (stackAmount != m_stackAmount) { m_stackAmount = stackAmount; @@ -1290,7 +1413,11 @@ void Aura::SetStackAmount(uint8 stackAmount, bool applied) } } } - RefreshAura(); + + if (refresh) + RefreshAura(); + else + SendAuraUpdate(); } bool Aura::modStackAmount(int32 num) @@ -1398,6 +1525,7 @@ void AuraEffect::HandleShapeshiftBoosts(bool apply) { uint32 spellId = 0; uint32 spellId2 = 0; + uint32 spellId3 = 0; uint32 HotWSpellId = 0; switch(GetMiscValue()) @@ -1407,8 +1535,7 @@ void AuraEffect::HandleShapeshiftBoosts(bool apply) HotWSpellId = 24900; break; case FORM_TREE: - spellId = 5420; - spellId2 = 34123; + spellId = 34123; break; case FORM_TRAVEL: spellId = 5419; @@ -1456,14 +1583,15 @@ void AuraEffect::HandleShapeshiftBoosts(bool apply) spellId = 27792; spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation. break; + case FORM_SHADOW: + spellId = 49868; + break; case FORM_GHOUL: case FORM_GHOSTWOLF: case FORM_AMBIENT: - case FORM_SHADOW: case FORM_STEALTH: case FORM_CREATURECAT: case FORM_CREATUREBEAR: - spellId = 0; break; } @@ -1471,8 +1599,20 @@ void AuraEffect::HandleShapeshiftBoosts(bool apply) if(apply) { - if (spellId) m_target->CastSpell(m_target, spellId, true, NULL, this ); - if (spellId2) m_target->CastSpell(m_target, spellId2, true, NULL, this); + // Remove cooldown of spells triggered on stance change - they may share cooldown with stance spell + if (spellId) + { + if(m_target->GetTypeId() == TYPEID_PLAYER) + ((Player *)m_target)->RemoveSpellCooldown(spellId); + m_target->CastSpell(m_target, spellId, true, NULL, this ); + } + + if (spellId2) + { + if(m_target->GetTypeId() == TYPEID_PLAYER) + ((Player *)m_target)->RemoveSpellCooldown(spellId2); + m_target->CastSpell(m_target, spellId2, true, NULL, this); + } if(m_target->GetTypeId() == TYPEID_PLAYER) { @@ -1510,12 +1650,71 @@ void AuraEffect::HandleShapeshiftBoosts(bool apply) } } } + switch(GetMiscValue()) + { + case FORM_CAT: + // Nurturing Instinct + if (AuraEffect const * aurEff = m_target->GetAuraEffect(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, SPELLFAMILY_DRUID, 2254,0)) + { + uint32 spellId = 0; + switch (aurEff->GetId()) + { + case 33872: + spellId = 47179; + break; + case 33873: + spellId = 47180; + break; + } + m_target->CastSpell(m_target, spellId, true, NULL, this); + } + // Master Shapeshifter - Cat + if (AuraEffect const * aurEff = m_target->GetDummyAura(SPELLFAMILY_GENERIC, 2851, 0)) + { + int32 bp = aurEff->GetAmount(); + m_target->CastCustomSpell(m_target, 48420, &bp, NULL, NULL, true); + } + break; + case FORM_DIREBEAR: + case FORM_BEAR: + // Master Shapeshifter - Bear + if (AuraEffect const * aurEff = m_target->GetDummyAura(SPELLFAMILY_GENERIC, 2851, 0)) + { + int32 bp = aurEff->GetAmount(); + m_target->CastCustomSpell(m_target, 48418, &bp, NULL, NULL, true); + } + // Survival of the Fittest + if (AuraEffect const * aurEff = m_target->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE,SPELLFAMILY_DRUID, 961, 0)) + { + int32 bp = m_target->CalculateSpellDamage(aurEff->GetSpellProto(),2,aurEff->GetSpellProto()->EffectBasePoints[2],m_target); + m_target->CastCustomSpell(m_target, 62069,&bp, NULL, NULL, true, 0, this); + } + break; + case FORM_MOONKIN: + // Master Shapeshifter - Moonkin + if (AuraEffect const * aurEff = m_target->GetDummyAura(SPELLFAMILY_GENERIC, 2851, 0)) + { + int32 bp = aurEff->GetAmount(); + m_target->CastCustomSpell(m_target, 48421, &bp, NULL, NULL, true); + } + break; + // Master Shapeshifter - Tree of Life + case FORM_TREE: + if (AuraEffect const * aurEff = m_target->GetDummyAura(SPELLFAMILY_GENERIC, 2851, 0)) + { + int32 bp = aurEff->GetAmount(); + m_target->CastCustomSpell(m_target, 48422, &bp, NULL, NULL, true); + } + break; + } } } else { - m_target->RemoveAurasDueToSpell(spellId); - m_target->RemoveAurasDueToSpell(spellId2); + if (spellId) + m_target->RemoveAurasDueToSpell(spellId); + if (spellId2) + m_target->RemoveAurasDueToSpell(spellId2); Unit::AuraMap& tAuras = m_target->GetAuras(); for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();) @@ -1540,12 +1739,8 @@ bool AuraEffect::isAffectedOnSpell(SpellEntry const *spell) const if (spell->SpellFamilyName != m_spellProto->SpellFamilyName) return false; - // Check EffectClassMask and Spell_Affect table - flag96 const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex); - if (!spellAffect) - spellAffect = &m_spellProto->EffectSpellClassMask[m_effIndex]; - - if (*spellAffect & spell->SpellFamilyFlags) + // Check EffectClassMask + if (m_spellProto->EffectSpellClassMask[m_effIndex] & spell->SpellFamilyFlags) return true; return false; } @@ -1590,10 +1785,7 @@ void AuraEffect::HandleAddModifier(bool apply, bool Real, bool changeAmount) mod->type = SpellModType(m_auraName); // SpellModType value == spell aura types mod->spellId = GetId(); - flag96 const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex); - if (!spellAffect) - spellAffect = &m_spellProto->EffectSpellClassMask[m_effIndex]; - mod->mask = *spellAffect; + mod->mask = m_spellProto->EffectSpellClassMask[m_effIndex]; mod->charges = GetParentAura()->GetAuraCharges(); m_spellmod = mod; @@ -1707,43 +1899,13 @@ void AuraEffect::TriggerSpell() ((Player*)caster)->ApplyEnchantment(item,TEMP_ENCHANTMENT_SLOT,true); return; } -// // Periodic Mana Burn -// case 812: break; -// // Polymorphic Ray -// case 6965: break; -// // Fire Nova (1-7 ranks) -// case 8350: -// case 8508: -// case 8509: -// case 11312: -// case 11313: -// case 25540: -// case 25544: -// break; // Thaumaturgy Channel case 9712: trigger_spell_id = 21029; break; -// // Egan's Blaster -// case 17368: break; -// // Haunted -// case 18347: break; -// // Ranshalla Waiting -// case 18953: break; -// // Inferno -// case 19695: break; -// // Frostwolf Muzzle DND -// case 21794: break; -// // Alterac Ram Collar DND -// case 21866: break; -// // Celebras Waiting -// case 21916: break; - // Brood Affliction: Bronze case 23170: { m_target->CastSpell(m_target, 23171, true, 0, this); return; } -// // Mark of Frost -// case 23184: break; // Restoration case 23493: { @@ -1758,46 +1920,6 @@ void AuraEffect::TriggerSpell() } return; } -// // Stoneclaw Totem Passive TEST -// case 23792: break; -// // Axe Flurry -// case 24018: break; -// // Mark of Arlokk -// case 24210: break; -// // Restoration -// case 24379: break; -// // Happy Pet -// case 24716: break; -// // Dream Fog -// case 24780: break; -// // Cannon Prep -// case 24832: break; -// // Shadow Bolt Whirl -// case 24834: break; -// // Stink Trap -// case 24918: break; -// // Mark of Nature -// case 25041: break; -// // Agro Drones -// case 25152: break; -// // Consume -// case 25371: break; -// // Pain Spike -// case 25572: break; -// // Rotate 360 -// case 26009: break; -// // Rotate -360 -// case 26136: break; -// // Consume -// case 26196: break; -// // Berserk -// case 26615: break; -// // Defile -// case 27177: break; -// // Teleport: IF/UC -// case 27601: break; -// // Five Fat Finger Exploding Heart Technique -// case 27673: break; // Nitrous Boost case 27746: { @@ -1811,8 +1933,6 @@ void AuraEffect::TriggerSpell() return; } } break; -// // Steam Tank Passive -// case 27747: break; // Frost Blast case 27808: caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, (float)m_target->GetMaxHealth()*0.26f, m_target, true, NULL, this); @@ -1825,49 +1945,13 @@ void AuraEffect::TriggerSpell() m_target->CastCustomSpell(27820, SPELLVALUE_BASE_POINT0, -mana*4, NULL, true, NULL, this, caster->GetGUID()); } return; -// // Controller Timer -// case 28095: break; -// // Stalagg Chain -// case 28096: break; -// // Stalagg Tesla Passive -// case 28097: break; -// // Feugen Tesla Passive -// case 28109: break; -// // Feugen Chain -// case 28111: break; -// // Mark of Didier -// case 28114: break; -// // Communique Timer, camp -// case 28346: break; -// // Icebolt -// case 28522: break; -// // Silithyst -// case 29519: break; // Inoculate Nestlewood Owlkin case 29528: if(target->GetTypeId()!=TYPEID_UNIT)// prevent error reports in case ignored player target return; break; -// // Overload -// case 29768: break; -// // Return Fire -// case 29788: break; -// // Return Fire -// case 29793: break; -// // Return Fire -// case 29794: break; -// // Guardian of Icecrown Passive -// case 29897: break; // Feed Captured Animal case 29917: trigger_spell_id = 29916; break; -// // Flame Wreath -// case 29946: break; -// // Flame Wreath -// case 29947: break; -// // Mind Exhaustion Passive -// case 30025: break; -// // Nether Beam - Serenity -// case 30401: break; // Extract Gas case 30427: { @@ -1890,19 +1974,6 @@ void AuraEffect::TriggerSpell() } // Quake case 30576: trigger_spell_id = 30571; break; -// // Burning Maul -// case 30598: break; -// // Regeneration -// case 30799: -// case 30800: -// case 30801: -// break; -// // Despawn Self - Smoke cloud -// case 31269: break; -// // Time Rift Periodic -// case 31320: break; -// // Corrupt Medivh -// case 31326: break; // Doom case 31347: { @@ -1917,20 +1988,6 @@ void AuraEffect::TriggerSpell() caster->SummonCreature(17870, 0, 0, 0, caster->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0); return; } -// // Bloodmyst Tesla -// case 31611: break; -// // Doomfire -// case 31944: break; -// // Teleport Test -// case 32236: break; -// // Earthquake -// case 32686: break; -// // Possess -// case 33401: break; -// // Draw Shadows -// case 33563: break; -// // Murmur's Touch -// case 33711: break; // Flame Quills case 34229: { @@ -1941,82 +1998,8 @@ void AuraEffect::TriggerSpell() caster->CastSpell(m_target,spell_id,true, NULL, this); return; } -// // Gravity Lapse -// case 34480: break; -// // Tornado -// case 34683: break; -// // Frostbite Rotate -// case 34748: break; -// // Arcane Flurry -// case 34821: break; -// // Interrupt Shutdown -// case 35016: break; -// // Interrupt Shutdown -// case 35176: break; -// // Inferno -// case 35268: break; -// // Salaadin's Tesla -// case 35515: break; -// // Ethereal Channel (Red) -// case 35518: break; -// // Nether Vapor -// case 35879: break; -// // Dark Portal Storm -// case 36018: break; -// // Burning Maul -// case 36056: break; -// // Living Grove Defender Lifespan -// case 36061: break; -// // Professor Dabiri Talks -// case 36064: break; -// // Kael Gaining Power -// case 36091: break; -// // They Must Burn Bomb Aura -// case 36344: break; -// // They Must Burn Bomb Aura (self) -// case 36350: break; -// // Stolen Ravenous Ravager Egg -// case 36401: break; -// // Activated Cannon -// case 36410: break; -// // Stolen Ravenous Ravager Egg -// case 36418: break; -// // Enchanted Weapons -// case 36510: break; -// // Cursed Scarab Periodic -// case 36556: break; -// // Cursed Scarab Despawn Periodic -// case 36561: break; -// // Vision Guide -// case 36573: break; -// // Cannon Charging (platform) -// case 36785: break; -// // Cannon Charging (self) -// case 36860: break; // Remote Toy case 37027: trigger_spell_id = 37029; break; -// // Mark of Death -// case 37125: break; -// // Arcane Flurry -// case 37268: break; -// // Spout -// case 37429: break; -// // Spout -// case 37430: break; -// // Karazhan - Chess NPC AI, Snapshot timer -// case 37440: break; -// // Karazhan - Chess NPC AI, action timer -// case 37504: break; -// // Karazhan - Chess: Is Square OCCUPIED aura (DND) -// case 39400: break; -// // Banish -// case 37546: break; -// // Shriveling Gaze -// case 37589: break; -// // Fake Aggro Radius (2 yd) -// case 37815: break; -// // Corrupt Medivh -// case 37853: break; // Eye of Grillok case 38495: { @@ -2036,93 +2019,18 @@ void AuraEffect::TriggerSpell() creatureTarget->ForcedDespawn(); return; } -// // Magic Sucker Device timer -// case 38672: break; -// // Tomb Guarding Charging -// case 38751: break; -// // Murmur's Touch -// case 38794: break; -// // Activate Nether-wraith Beacon (31742 Nether-wraith Beacon item) -// case 39105: break; -// // Drain World Tree Visual -// case 39140: break; -// // Quest - Dustin's Undead Dragon Visual aura -// case 39259: break; -// // Hellfire - The Exorcism, Jules releases darkness, aura -// case 39306: break; -// // Inferno -// case 39346: break; -// // Enchanted Weapons -// case 39489: break; -// // Shadow Bolt Whirl -// case 39630: break; -// // Shadow Bolt Whirl -// case 39634: break; -// // Shadow Inferno -// case 39645: break; // Tear of Azzinoth Summon Channel - it's not really supposed to do anything,and this only prevents the console spam case 39857: trigger_spell_id = 39856; break; -// // Soulgrinder Ritual Visual (Smashed) -// case 39974: break; -// // Simon Game Pre-game timer -// case 40041: break; -// // Knockdown Fel Cannon: The Aggro Check Aura -// case 40113: break; -// // Spirit Lance -// case 40157: break; -// // Demon Transform 2 -// case 40398: break; -// // Demon Transform 1 -// case 40511: break; -// // Ancient Flames -// case 40657: break; -// // Ethereal Ring Cannon: Cannon Aura -// case 40734: break; -// // Cage Trap -// case 40760: break; -// // Random Periodic -// case 40867: break; -// // Prismatic Shield -// case 40879: break; // Aura of Desire case 41350: { - Unit::AuraEffectList const& mMod = m_target->GetAurasByType(SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT); - for(Unit::AuraEffectList::const_iterator i = mMod.begin(); i != mMod.end(); ++i) - { - if ((*i)->GetId() == 41350) - { - (*i)->ApplyModifier(false); - (*i)->SetAmount((*i)->GetAmount()-5); - (*i)->ApplyModifier(true); - break; - } - } - }break; -// // Dementia -// case 41404: break; -// // Chaos Form -// case 41629: break; -// // Alert Drums -// case 42177: break; -// // Spout -// case 42581: break; -// // Spout -// case 42582: break; -// // Return to the Spirit Realm -// case 44035: break; -// // Curse of Boundless Agony -// case 45050: break; -// // Earthquake -// case 46240: break; - // Personalized Weather + AuraEffect * aurEff = GetParentAura()->GetPartAura(1); + aurEff->ApplyModifier(false, false, true); + aurEff->SetAmount(aurEff->GetAmount()-5); + aurEff->ApplyModifier(true, false, true); + break; + } case 46736: trigger_spell_id = 46737; break; -// // Stay Submerged -// case 46981: break; -// // Dragonblight Ram -// case 47015: break; -// // Party G.R.E.N.A.D.E. -// case 51510: break; default: break; } @@ -2141,32 +2049,6 @@ void AuraEffect::TriggerSpell() } break; } -// case SPELLFAMILY_WARRIOR: -// { -// switch(auraId) -// { -// // Wild Magic -// case 23410: break; -// // Corrupted Totems -// case 23425: break; -// default: -// break; -// } -// break; -// } -// case SPELLFAMILY_PRIEST: -// { -// switch(auraId) -// { -// // Blue Beam -// case 32930: break; -// // Fury of the Dreghood Elders -// case 35460: break; -// default: -// break; -// } - // break; - // } case SPELLFAMILY_DRUID: { switch(auraId) @@ -2177,8 +2059,6 @@ void AuraEffect::TriggerSpell() return; // Frenzied Regeneration case 22842: - case 22895: - case 22896: case 26999: { int32 LifePerRage = GetAmount(); @@ -2196,42 +2076,42 @@ void AuraEffect::TriggerSpell() } break; } + case SPELLFAMILY_HUNTER: + { + switch (auraId) + { + // Sniper training + case 53302: + case 53303: + case 53304: + if (m_target->GetTypeId() != TYPEID_PLAYER) + return; + + if (((Player*)m_target)->isMoving()) + { + m_amount = m_target->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,m_target); + return; + } + + // We are standing at the moment + if (m_amount > 0) + { + --m_amount; + return; + } -// case SPELLFAMILY_HUNTER: -// { -// switch(auraId) -// { -// //Frost Trap Aura -// case 13810: -// return; -// //Rizzle's Frost Trap -// case 39900: -// return; -// // Tame spells -// case 19597: // Tame Ice Claw Bear -// case 19676: // Tame Snow Leopard -// case 19677: // Tame Large Crag Boar -// case 19678: // Tame Adult Plainstrider -// case 19679: // Tame Prairie Stalker -// case 19680: // Tame Swoop -// case 19681: // Tame Dire Mottled Boar -// case 19682: // Tame Surf Crawler -// case 19683: // Tame Armored Scorpid -// case 19684: // Tame Webwood Lurker -// case 19685: // Tame Nightsaber Stalker -// case 19686: // Tame Strigid Screecher -// case 30100: // Tame Crazed Dragonhawk -// case 30103: // Tame Elder Springpaw -// case 30104: // Tame Mistbat -// case 30647: // Tame Barbed Crawler -// case 30648: // Tame Greater Timberstrider -// case 30652: // Tame Nightstalker -// return; -// default: -// break; -// } -// break; -// } + trigger_spell_id = 64418 + auraId - 53302; + + // If aura is active - no need to continue + if (target->HasAura(trigger_spell_id)) + return; + + break; + default: + break; + } + break; + } case SPELLFAMILY_SHAMAN: { switch(auraId) @@ -2240,15 +2120,8 @@ void AuraEffect::TriggerSpell() case 28820: { // Need remove self if Lightning Shield not active - Unit::AuraMap const& auras = target->GetAuras(); - for(Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - { - SpellEntry const* spell = itr->second->GetSpellProto(); - if( spell->SpellFamilyName == SPELLFAMILY_SHAMAN && - spell->SpellFamilyFlags[0] & 0x400) - return; - } - target->RemoveAurasDueToSpell(28820); + if (!target->GetAura(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN,0x400)) + target->RemoveAurasDueToSpell(28820); return; } // Totemic Mastery (Skyshatter Regalia (Shaman Tier 6) - bonus) @@ -2287,43 +2160,6 @@ void AuraEffect::TriggerSpell() // Spell exist but require custom code switch(auraId) { - // Curse of Idiocy - case 1010: - { - // TODO: spell casted by result in correct way mostly - // BUT: - // 1) target show casting at each triggered cast: target don't must show casting animation for any triggered spell - // but must show affect apply like item casting - // 2) maybe aura must be replace by new with accumulative stat mods instead stacking - - // prevent cast by triggered auras - if(GetCasterGUID() == m_target->GetGUID()) - return; - - // stop triggering after each affected stats lost > 90 - int32 intellectLoss = 0; - int32 spiritLoss = 0; - - Unit::AuraEffectList const& mModStat = m_target->GetAurasByType(SPELL_AURA_MOD_STAT); - for(Unit::AuraEffectList::const_iterator i = mModStat.begin(); i != mModStat.end(); ++i) - { - if ((*i)->GetId() == 1010) - { - switch((*i)->GetMiscValue()) - { - case STAT_INTELLECT: intellectLoss += (*i)->GetAmount(); break; - case STAT_SPIRIT: spiritLoss += (*i)->GetAmount(); break; - default: break; - } - } - } - - if(intellectLoss <= -90 && spiritLoss <= -90) - return; - - caster = target; - break; - } // Mana Tide case 16191: { @@ -2347,6 +2183,10 @@ void AuraEffect::TriggerSpell() case 54835: caster->CastSpell(m_target, trigger_spell_id, true, NULL, this); return; + // Ground Slam + case 33525: + target->CastSpell(target, trigger_spell_id, true); + return; } } @@ -2395,6 +2235,29 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount) // AT APPLY if(apply) { + // Overpower + if (caster && m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && + m_spellProto->SpellFamilyFlags[0] & 0x4) + { + // Must be casting target + if (!m_target->IsNonMeleeSpellCasted(false, false, true)) + return; + if (AuraEffect * aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARRIOR, 2775, 0)) + { + switch (aurEff->GetId()) + { + // Unrelenting Assault, rank 1 + case 46859: + m_target->CastSpell(m_target,64849,true,NULL,aurEff); + break; + // Unrelenting Assault, rank 2 + case 46860: + m_target->CastSpell(m_target,64850,true,NULL,aurEff); + break; + } + } + return; + } switch(GetId()) { // Haunting Spirits - perdiodic trigger demon @@ -2435,6 +2298,24 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount) } return; } + case 37096: // Blood Elf Illusion + { + if(caster) + { + switch(caster->getGender()) + { + case GENDER_FEMALE: + caster->CastSpell(m_target,37095,true,NULL,this); // Blood Elf Disguise + break; + case GENDER_MALE: + caster->CastSpell(m_target,37093,true,NULL,this); + break; + default: + break; + } + } + return; + } case 55198: // Tidal Force { m_target->CastSpell(m_target,55166,true,NULL,this); @@ -2479,8 +2360,9 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount) ((Player*)m_target)->RemoveAmmo(); // not use ammo and not allow use return; case 52916: // Honor Among Thieves - if (Unit * target = ObjectAccessor::GetUnit(*m_target, m_target->GetUInt64Value(UNIT_FIELD_TARGET))) - m_target->CastSpell(target, 51699, true); + if(m_target->GetTypeId()==TYPEID_PLAYER) + if (Unit * target = ObjectAccessor::GetUnit(*m_target,((Player*)m_target)->GetComboTarget())) + m_target->CastSpell(target, 51699, true); return; } @@ -2551,7 +2433,11 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount) return; case 46308: // Burning Winds casted only at creatures at spawn m_target->CastSpell(m_target,47287,true,NULL,this); - return; + return; + case 52173: // Coyote Spirit Despawn Aura + case 60244: // Blood Parrot Despawn Aura + m_target->CastSpell((Unit*)NULL, GetAmount(), true, NULL, this); + return; } break; case SPELLFAMILY_WARLOCK: @@ -2581,6 +2467,14 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount) return; } break; + case SPELLFAMILY_DEATHKNIGHT: + // Summon Gargoyle ( will start feeding gargoyle ) + if(GetId()==61777) + { + m_target->CastSpell(m_target,m_spellProto->EffectTriggerSpell[m_effIndex],true); + return; + } + break; default: break; } @@ -2597,6 +2491,10 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount) break; switch(GetId()) { + // Recently Bandaged + case 11196: + m_target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, GetMiscValue(), apply); + return; // Unstable Power case 24658: { @@ -2763,6 +2661,14 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount) return; } } + // Predatory Strikes + if(m_target->GetTypeId()==TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563) + { + ((Player*)m_target)->UpdateAttackPowerAndDamage(); + return; + } + if (!Real) + break; // Lifebloom if ( GetSpellProto()->SpellFamilyFlags[1] & 0x10 ) { @@ -2783,85 +2689,19 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount) if(m_target->IsInWorld()) m_target->CastCustomSpell(m_target,33778,&m_amount,NULL,NULL,true,NULL,this,GetCasterGUID()); - /*// have a look if there is still some other Lifebloom dummy aura - Unit::AuraList auras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::iterator itr = auras.begin(); itr!=auras.end(); ++itr) - if((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && - (*itr)->GetSpellProto()->SpellFamilyFlags & 0x1000000000LL) - return; - - // final heal - if(m_target->IsInWorld() && m_stackAmount > 0) + // restore mana + if (caster) { - int32 amount = m_amount / m_stackAmount; - m_target->CastCustomSpell(m_target,33778,&amount,NULL,NULL,true,NULL,this,GetCasterGUID()); - }*/ - } - return; - } - - // Predatory Strikes - if(m_target->GetTypeId()==TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563) - { - ((Player*)m_target)->UpdateAttackPowerAndDamage(); - return; - } - break; - } - case SPELLFAMILY_HUNTER: - { - if (!Real) - break; - // Glyph of Aspect of the Monkey - if(m_spellProto->Id==56833) - { - if(apply) - { - SpellModifier *mod = new SpellModifier; - mod->op = SPELLMOD_CHANCE_OF_SUCCESS; - mod->value = 100; - mod->type = SPELLMOD_FLAT; - mod->spellId = GetId(); - mod->mask[2] = 8192; - mod->mask[1] = 0x00000000; - mod->mask[0] = 524288; - m_spellmod = mod; + int32 returnmana = (GetSpellProto()->ManaCostPercentage * caster->GetCreateMana() / 100) * GetParentAura()->GetStackAmount() / 2; + caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID()); + } } - ((Player*)m_target)->AddSpellMod(m_spellmod, apply); return; } break; } case SPELLFAMILY_SHAMAN: { - if (!Real && !changeAmount) - break; - // Improved Weapon Totems - if( GetSpellProto()->SpellIconID == 57 && m_target->GetTypeId()==TYPEID_PLAYER ) - { - if(apply) - { - SpellModifier *mod = new SpellModifier; - mod->op = SPELLMOD_EFFECT1; - mod->value = m_amount; - mod->type = SPELLMOD_PCT; - mod->spellId = GetId(); - switch (m_effIndex) - { - case 0: - mod->mask[1] = 0x002; // Windfury Totem - break; - case 1: - mod->mask[1] = 0x004; // Flametongue Totem - break; - } - - m_spellmod = mod; - } - - ((Player*)m_target)->AddSpellMod(m_spellmod, apply); - return; - } if (!Real) break; // Sentry Totem @@ -2888,7 +2728,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount) if (Real) { // pet auras - if(PetAura const* petSpell = spellmgr.GetPetAura(GetId())) + if(PetAura const* petSpell = spellmgr.GetPetAura(GetId(), m_effIndex)) { if(apply) m_target->AddPetAura(petSpell); @@ -3088,6 +2928,8 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun case FORM_AMBIENT: case FORM_SHADOW: case FORM_STEALTH: + case FORM_UNDEAD: + case FORM_SHADOW_DANCE: break; case FORM_TREE: modelid = 864; @@ -3116,13 +2958,37 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun case FORM_FLIGHT_EPIC: case FORM_FLIGHT: case FORM_MOONKIN: + { // remove movement affects m_target->RemoveMovementImpairingAuras(); +/* + m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); + Unit::AuraList const& slowingAuras = m_target->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); + for (Unit::AuraList::const_iterator iter = slowingAuras.begin(); iter != slowingAuras.end();) + { + SpellEntry const* aurSpellInfo = (*iter)->GetSpellProto(); + + // If spell that caused this aura has Croud Control or Daze effect + if((GetAllSpellMechanicMask(aurSpellInfo) & MECHANIC_NOT_REMOVED_BY_SHAPESHIFT) || + // some Daze spells have these parameters instead of MECHANIC_DAZE + (aurSpellInfo->SpellIconID == 15 && aurSpellInfo->Dispel == 0)) + { + ++iter; + continue; + } + + // All OK, remove aura now + m_target->RemoveAurasDueToSpellByCancel(aurSpellInfo->Id); + iter = slowingAuras.begin(); + } +*/ // and polymorphic affects if(m_target->IsPolymorphed()) m_target->RemoveAurasDueToSpell(m_target->getTransForm()); + break; + } default: break; } @@ -3176,28 +3042,6 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun } break; } - case FORM_BATTLESTANCE: - case FORM_DEFENSIVESTANCE: - case FORM_BERSERKERSTANCE: - { - uint32 Rage_val = 0; - // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch) - if(m_target->GetTypeId() == TYPEID_PLAYER) - { - PlayerSpellMap const& sp_list = ((Player *)m_target)->GetSpellMap(); - for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) - { - if(itr->second->state == PLAYERSPELL_REMOVED) continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); - if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) - Rage_val += m_target->CalculateSpellDamage(spellInfo,0,spellInfo->EffectBasePoints[0],m_target) * 10; - } - } - - if (m_target->GetPower(POWER_RAGE) > Rage_val) - m_target->SetPower(POWER_RAGE,Rage_val); - break; - } default: break; } @@ -3222,14 +3066,41 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun case FORM_BEAR: case FORM_DIREBEAR: case FORM_CAT: - if(AuraEffect* dummy = m_target->GetDummyAura(37315) ) + if(AuraEffect* dummy = m_target->GetAuraEffect(37315, 0) ) m_target->CastSpell(m_target,37316,true,NULL,dummy); break; // Nordrassil Regalia - bonus case FORM_MOONKIN: - if(AuraEffect* dummy = m_target->GetDummyAura(37324) ) + if(AuraEffect* dummy = m_target->GetAuraEffect(37324, 0) ) m_target->CastSpell(m_target,37325,true,NULL,dummy); break; + case FORM_BATTLESTANCE: + case FORM_DEFENSIVESTANCE: + case FORM_BERSERKERSTANCE: + { + uint32 Rage_val = 0; + // Defensive Tactics + if (form == FORM_DEFENSIVESTANCE) + { + if (AuraEffect const * aurEff = m_target->IsScriptOverriden(m_spellProto,831)) + Rage_val += aurEff->GetAmount() * 10; + } + // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch) + if(m_target->GetTypeId() == TYPEID_PLAYER) + { + PlayerSpellMap const& sp_list = ((Player *)m_target)->GetSpellMap(); + for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) + { + if(itr->second->state == PLAYERSPELL_REMOVED) continue; + SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) + Rage_val += m_target->CalculateSpellDamage(spellInfo,0,spellInfo->EffectBasePoints[0],m_target) * 10; + } + } + if (m_target->GetPower(POWER_RAGE) > Rage_val) + m_target->SetPower(POWER_RAGE,Rage_val); + break; + } default: break; } @@ -3244,8 +3115,9 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun if(m_target->getClass() == CLASS_DRUID) { - if(form == FORM_CAT && apply) // add dash if in cat-from + if(form == FORM_CAT && apply) { + // add dash if in cat-from Unit::AuraMap & auras = m_target->GetAuras(); for (Unit::AuraMap::iterator iter = auras.begin(); iter != auras.end();++iter) { @@ -3364,6 +3236,13 @@ void AuraEffect::HandleAuraTransform(bool apply, bool Real, bool /*changeAmount* // Dragonmaw Illusion (set mount model also) if(GetId()==42016 && m_target->GetMountID() && !m_target->GetAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty()) m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); + + // Polymorph (sheep) + if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellProto()->SpellIconID == 82 && GetSpellProto()->SpellVisual[0] == 12978) + if (Unit * caster = GetCaster()) + // Glyph of the Penguin + if (caster->HasAura(52648)) + m_target->SetDisplayId(26452); } } @@ -4055,12 +3934,12 @@ void AuraEffect::HandleModThreat(bool apply, bool Real, bool changeAmount) if(!Real && !changeAmount) return; - if(!m_target->isAlive()) + if (!m_target->isAlive()) return; Unit* caster = GetCaster(); - if(!caster || !caster->isAlive()) + if (!caster || !caster->isAlive()) return; int level_diff = 0; @@ -4078,17 +3957,14 @@ void AuraEffect::HandleModThreat(bool apply, bool Real, bool changeAmount) multiplier = 1; break; } + if (level_diff > 0) m_amount += multiplier * level_diff; - for(int8 x=0;x < MAX_SPELL_SCHOOL;x++) - { - if(GetMiscValue() & int32(1<<x)) - { - if(m_target->GetTypeId() == TYPEID_PLAYER) + if (m_target->GetTypeId() == TYPEID_PLAYER) + for(int8 x=0;x < MAX_SPELL_SCHOOL;x++) + if (GetMiscValue() & int32(1<<x)) ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_amount, apply); - } - } } void AuraEffect::HandleAuraModTotalThreat(bool apply, bool Real, bool changeAmount) @@ -4097,19 +3973,15 @@ void AuraEffect::HandleAuraModTotalThreat(bool apply, bool Real, bool changeAmou if(!Real && !changeAmount) return; - if(!m_target->isAlive() || m_target->GetTypeId()!= TYPEID_PLAYER) + if (!m_target->isAlive() || m_target->GetTypeId() != TYPEID_PLAYER) return; Unit* caster = GetCaster(); - if(!caster || !caster->isAlive()) + if (!caster || !caster->isAlive()) return; - float threatMod = 0.0f; - if(apply) - threatMod = float(m_amount); - else - threatMod = float(-m_amount); + float threatMod = apply ? float(m_amount) : float(-m_amount); m_target->getHostilRefManager().threatAssist(caster, threatMod); } @@ -4117,18 +3989,18 @@ void AuraEffect::HandleAuraModTotalThreat(bool apply, bool Real, bool changeAmou void AuraEffect::HandleModTaunt(bool apply, bool Real, bool /*changeAmount*/) { // only at real add/remove aura - if(!Real) + if (!Real) return; - if(!m_target->isAlive() || !m_target->CanHaveThreatList()) + if (!m_target->isAlive() || !m_target->CanHaveThreatList()) return; Unit* caster = GetCaster(); - if(!caster || !caster->isAlive() || caster->GetTypeId() != TYPEID_PLAYER) + if (!caster || !caster->isAlive()) return; - if(apply) + if (apply) m_target->TauntApply(caster); else { @@ -4204,15 +4076,28 @@ void AuraEffect::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real, bool m_target->UpdateSpeed(MOVE_SWIM, true); } -void AuraEffect::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real, bool changeAmount) +void AuraEffect::HandleAuraModDecreaseSpeed(bool apply, bool Real, bool changeAmount) { // all applied/removed only at real aura add/remove if(!Real && !changeAmount) return; + if (apply) + { + // Gronn Lord's Grasp, becomes stoned + if (GetId() == 33572) + { + if (GetParentAura()->GetStackAmount() >= 5 && !m_target->HasAura(33652)) + m_target->CastSpell(m_target, 33652, true); + } + } + m_target->UpdateSpeed(MOVE_RUN, true); m_target->UpdateSpeed(MOVE_SWIM, true); m_target->UpdateSpeed(MOVE_FLIGHT, true); + m_target->UpdateSpeed(MOVE_RUN_BACK, true); + m_target->UpdateSpeed(MOVE_SWIM_BACK, true); + m_target->UpdateSpeed(MOVE_FLIGHT_BACK, true); } void AuraEffect::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real, bool changeAmount) @@ -4240,7 +4125,7 @@ void AuraEffect::HandleModStateImmunityMask(bool apply, bool Real, bool /*change if (GetMiscValue() & (1<<7)) immunity_list.push_back(SPELL_AURA_MOD_DISARM); if (GetMiscValue() & (1<<1)) - immunity_list.push_back(SPELL_AURA_MOD_TAUNT); + immunity_list.push_back(SPELL_AURA_TRANSFORM); // These flag can be recognized wrong: if (GetMiscValue() & (1<<6)) @@ -4283,6 +4168,11 @@ void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real, bool /*changeA //immune movement impairment and loss of control if(GetId()==42292 || GetId()==59752) mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; + // Forbearance + // in DBC wrong mechanic immune since 3.0.x + else if (GetId() == 25771) + mechanic = 1 << MECHANIC_IMMUNE_SHIELD; + if (!mechanic) return; @@ -4310,23 +4200,18 @@ void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real, bool /*changeA m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,GetMiscValue(),apply); // Bestial Wrath - if ( GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->Id == 19574) + if (GetSpellProto()->Id == 19574) { // The Beast Within cast on owner if talent present if ( Unit* owner = m_target->GetOwner() ) { // Search talent - Unit::AuraEffectList const& m_dummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraEffectList::const_iterator i = m_dummyAuras.begin(); i != m_dummyAuras.end(); ++i) + if (owner->GetAuraEffect(34692, 0)) { - if ( (*i)->GetSpellProto()->SpellIconID == 2229 ) - { - if (apply) - owner->CastSpell(owner, 34471, true, 0, this); - else - owner->RemoveAurasDueToSpell(34471); - break; - } + if (apply) + owner->CastSpell(owner, 34471, true, 0, this); + else + owner->RemoveAurasDueToSpell(34471); } } } @@ -4365,7 +4250,7 @@ void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real, bool /*changeA m_target->ApplySpellImmune(GetId(),IMMUNITY_STATE,SPELL_AURA_MOD_DECREASE_SPEED,apply); } // Demonic Circle - else if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellProto->SpellIconID == 3221) + else if (GetId() == 48020) { if (m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -4378,7 +4263,6 @@ void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real, bool /*changeA } } -//this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect void AuraEffect::HandleAuraModEffectImmunity(bool apply, bool Real, bool /*changeAmount*/) { // when removing flag aura, handle flag drop @@ -4518,15 +4402,20 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValue(bool apply, bool Real, bool void AuraEffect::HandlePeriodicEnergize(bool apply, bool Real, bool changeAmount) { - if(!Real && !changeAmount) + if(!Real) return; m_isPeriodic = apply; - // Replenishment (0.25% from max) - // Infinite Replenishment - if (m_spellProto->SpellIconID == 3184 && m_spellProto->SpellVisual[0] == 12495) - m_amount = m_target->GetMaxPower(POWER_MANA) * 25 / 10000; + if (apply) + { + // Replenishment (0.25% from max) + // Infinite Replenishment + if (m_spellProto->SpellIconID == 3184 && m_spellProto->SpellVisual[0] == 12495) + m_amount = m_target->GetMaxPower(POWER_MANA) * 25 / 10000; + else if (m_spellProto->Id == 29166) // Innervate + m_amount = m_target->GetCreatePowers(POWER_MANA) * m_amount / (GetTotalTicks() * 100.0f); + } } void AuraEffect::HandleAuraPowerBurn(bool apply, bool Real, bool /*changeAmount*/) @@ -4572,10 +4461,19 @@ void AuraEffect::HandleAuraPeriodicDummy(bool apply, bool Real, bool changeAmoun case SPELLFAMILY_HUNTER: { // Explosive Shot - if (apply && !loading && caster) + if (apply && !loading && caster && spell->SpellFamilyFlags[1] & 0x80000000) m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 14 / 100); break; } + case SPELLFAMILY_DEATHKNIGHT: + { + // Reaping + // Blood of the North + // Death Rune Mastery + if (spell->SpellIconID == 3041 || spell->SpellIconID == 22 || spell->SpellIconID == 2622) + m_amount = 0; + break; + } } m_isPeriodic = apply; @@ -4599,7 +4497,7 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount) // Curse of Doom // This is a hack - this aura should be handled by passive aura and proc doomguard spawn on kill, however there is no such aura in dbcs - if(m_spellProto->SpellFamilyName==SPELLFAMILY_WARLOCK && m_spellProto->SpellFamilyFlags.IsEqual(0,0x02,0)) + if(m_spellProto->SpellFamilyName==SPELLFAMILY_WARLOCK && m_spellProto->SpellFamilyFlags[1] & 0x02) { if (Real && !apply && GetParentAura()->GetRemoveMode()==AURA_REMOVE_BY_DEATH) { @@ -4621,17 +4519,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount) switch (m_spellProto->SpellFamilyName) { - case SPELLFAMILY_GENERIC: - { - // Pounce Bleed - if ( m_spellProto->SpellIconID == 147 && m_spellProto->SpellVisual[0] == 0 ) - { - // $AP*0.18/6 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 / 100); - return; - } - break; - } case SPELLFAMILY_WARRIOR: { // Rend @@ -4643,28 +4530,32 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount) float mwb_min = caster->GetWeaponDamageRange(BASE_ATTACK,MINDAMAGE); float mwb_max = caster->GetWeaponDamageRange(BASE_ATTACK,MAXDAMAGE); m_amount+=int32(((mwb_min+mwb_max)/2+ap*mws/14000)*0.2f); + // "If used while your target is above 75% health, Rend does 35% more damage." + // as for 3.1.3 only ranks above 9 (wrong tooltip?) + if (spellmgr.GetSpellRank(m_spellProto->Id) >= 9) + { + if (m_target->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, m_spellProto, caster)) + m_amount += int32(m_amount*0.35); + } return; } break; } - case SPELLFAMILY_DRUID: + // Drain Soul - If the target is at or below 25% health, Drain Soul causes four times the normal damage + case SPELLFAMILY_WARLOCK: { - // Rake - if (m_spellProto->SpellFamilyFlags[0] & 0x1000) - { - // $AP*0.06 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 6 / 100); - return; - } - // Lacerate - if (m_spellProto->SpellFamilyFlags[1] & 0x0000000100) + if (m_spellProto->SpellFamilyFlags[0] & 0x00004000) { - // $AP*0.05/5 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); - return; + // if victim is below 25% of hp + if (m_target->GetMaxHealth() / 4 > m_target->GetHealth()) + m_amount *= 4; } + break; + } + case SPELLFAMILY_DRUID: + { // Rip - if (m_spellProto->SpellVisual[0] == 3941) + if (m_spellProto->SpellFamilyFlags[0] & 0x00800000) { // 0.01*$AP*cp if (caster->GetTypeId() != TYPEID_PLAYER) @@ -4673,25 +4564,12 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount) uint8 cp = ((Player*)caster)->GetComboPoints(); // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs - Unit::AuraEffectList const& dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) - { - if((*itr)->GetId()==34241) - { - m_amount += cp * (*itr)->GetAmount(); - break; - } - } + if (AuraEffect const * aurEff = caster->GetAuraEffect(34241,0)) + m_amount += cp * aurEff->GetAmount(); + m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100); return; } - // Lock Jaw - if (m_spellProto->SpellFamilyFlags[1] & 0x10000000) - { - // 0.15*$AP - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 15 / 100); - return; - } break; } case SPELLFAMILY_ROGUE: @@ -4712,38 +4590,6 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real, bool changeAmount) m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]); return; } - // Garrote - if (m_spellProto->SpellFamilyFlags[0] & 0x100) - { - // $AP*0.07 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 7 / 100); - return; - } - // Deadly Poison - if (m_spellProto->SpellFamilyFlags[0] & 0x10000) - { - // 0.08*$AP / 4 * amount of stack - m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 2 * GetParentAura()->GetStackAmount() / 100); - return; - } - break; - } - case SPELLFAMILY_HUNTER: - { - // Serpent Sting - if (m_spellProto->SpellFamilyFlags[0] & 0x4000) - { - // $RAP*0.1/5 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); - return; - } - // Immolation Trap - if (m_spellProto->SpellFamilyFlags[0] & 0x4 && m_spellProto->SpellIconID == 678) - { - // $RAP*0.1/5 bonus per tick - m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); - return; - } break; } default: @@ -4913,7 +4759,7 @@ void AuraEffect::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool Real, ((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); } -void AuraEffect::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool Real, bool /*changeAmount*/) +void AuraEffect::HandleModSpellHealingPercentFromStat(bool apply, bool Real, bool /*changeAmount*/) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -5663,6 +5509,7 @@ void AuraEffect::HandleAuraModPacify(bool apply, bool Real, bool /*changeAmount* void AuraEffect::HandleAuraModPacifyAndSilence(bool apply, bool Real, bool changeAmount) { + // Vengeance of the Blue Flight if(m_spellProto->Id == 45839) { if(apply) @@ -5855,7 +5702,7 @@ void AuraEffect::HandleSchoolAbsorb(bool apply, bool Real, bool changeAmount) { case SPELLFAMILY_PRIEST: // Power Word: Shield - if(m_spellProto->SpellFamilyFlags.IsEqual(0x1, 0, 0x400)) + if(m_spellProto->SpellFamilyFlags[0] & 0x1 && m_spellProto->SpellFamilyFlags[2] & 0x400) { // +80.68% from sp bonus DoneActualBenefit = caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * 0.8068f; @@ -5863,7 +5710,7 @@ void AuraEffect::HandleSchoolAbsorb(bool apply, bool Real, bool changeAmount) break; case SPELLFAMILY_MAGE: // ice barrier - if(m_spellProto->SpellFamilyFlags.IsEqual(0, 0x1, 0x8)) + if(m_spellProto->SpellFamilyFlags[1] & 0x1 && m_spellProto->SpellFamilyFlags[2] & 0x8) { // +80.67% from sp bonus DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8067f; @@ -5880,7 +5727,7 @@ void AuraEffect::HandleSchoolAbsorb(bool apply, bool Real, bool changeAmount) break; case SPELLFAMILY_WARLOCK: // shadow ward - if(m_spellProto->SpellFamilyFlags.IsEqual(0, 0, 0x40)) + if(m_spellProto->SpellFamilyFlags[2]& 0x40) { // +30% from sp bonus DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.3f; @@ -5891,7 +5738,7 @@ void AuraEffect::HandleSchoolAbsorb(bool apply, bool Real, bool changeAmount) if (m_spellProto->SpellFamilyFlags[1] & 0x80000) { // 0.75 from sp bonus - DoneActualBenefit = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.75f; + DoneActualBenefit = caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * 0.75f; } break; default: @@ -5903,6 +5750,38 @@ void AuraEffect::HandleSchoolAbsorb(bool apply, bool Real, bool changeAmount) m_amount += (int32)DoneActualBenefit; } } + + // Guardian Spirit + if(m_spellProto->Id == 47788 && Real && !apply) + { + Unit *caster = GetCaster(); + if(!caster) + return; + + if(caster->GetTypeId() != TYPEID_PLAYER) + return; + + Player *player = ((Player*)caster); + // Glyph of Guardian Spirit + if(AuraEffect * aurEff = player->GetAuraEffect(63231, 0)) + { + if (GetParentAura()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) + { + if (!player->HasSpellCooldown(47788)) + return; + + player->RemoveSpellCooldown(m_spellProto->Id, true); + player->AddSpellCooldown(m_spellProto->Id, 0, uint32(time(NULL) + aurEff->GetAmount())); + + WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4+4); + data << uint64(player->GetGUID()); + data << uint8(0x0); // flags (0x1, 0x2) + data << uint32(m_spellProto->Id); + data << uint32(aurEff->GetAmount()*IN_MILISECONDS); + player->SendDirectMessage(&data); + } + } + } } void AuraEffect::PeriodicTick() @@ -5933,15 +5812,15 @@ void AuraEffect::PeriodicTick() { switch(GetId()) { - case 43093: case 31956: case 38801: - case 35321: case 38363: case 39215: + case 43093: case 31956: case 38801: // Grievous Wound + case 35321: case 38363: case 39215: // Gushing Wound if(m_target->GetHealth() == m_target->GetMaxHealth() ) { m_target->RemoveAurasDueToSpell(GetId()); return; } break; - case 38772: + case 38772: // Grievous Wound { uint32 percent = GetEffIndex() < 2 && GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_DUMMY ? @@ -5954,18 +5833,13 @@ void AuraEffect::PeriodicTick() } break; } - case 41337:// aura of anger + case 41337:// Aura of Anger { - Unit::AuraEffectList const& mMod = m_target->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for(Unit::AuraEffectList::const_iterator i = mMod.begin(); i != mMod.end(); ++i) + if (AuraEffect * aurEff = GetParentAura()->GetPartAura(1)) { - if ((*i)->GetId() == 41337) - { - (*i)->ApplyModifier(false); - (*i)->SetAmount((*i)->GetAmount()+5); - (*i)->ApplyModifier(true); - break; - } + aurEff->ApplyModifier(false, false, true); + aurEff->SetAmount(aurEff->GetAmount()+5); + aurEff->ApplyModifier(true, false, true); } m_amount = 100 * m_tickNumber; break; @@ -5977,7 +5851,7 @@ void AuraEffect::PeriodicTick() uint32 absorb=0; uint32 resist=0; - CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL ); + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL ); // ignore non positive values (can be result apply spellmods to aura damage //uint32 amount = GetModifierValuePerStack() > 0 ? GetModifierValuePerStack() : 0; @@ -5993,7 +5867,7 @@ void AuraEffect::PeriodicTick() GetEffectMechanic(GetSpellProto(), m_effIndex) != MECHANIC_BLEED) { uint32 pdamageReductedArmor = pCaster->CalcArmorReducedDamage(m_target, pdamage, GetSpellProto()); - cleanDamage.damage += pdamage - pdamageReductedArmor; + cleanDamage.mitigated_damage += pdamage - pdamageReductedArmor; pdamage = pdamageReductedArmor; } @@ -6013,6 +5887,21 @@ void AuraEffect::PeriodicTick() else pdamage = uint32(m_target->GetMaxHealth()*pdamage/100); + bool crit = false; + Unit::AuraEffectList const& mPeriodicCritAuras= pCaster->GetAurasByType(SPELL_AURA_ABILITY_PERIODIC_CRIT); + for(Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr) + { + if (!(*itr)->isAffectedOnSpell(m_spellProto)) + continue; + + if (pCaster->isSpellCrit(m_target, m_spellProto, GetSpellSchoolMask(m_spellProto))) + { + crit = true; + pdamage = pCaster->SpellCriticalDamageBonus(m_spellProto, pdamage, m_target); + } + break; + } + //As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit // Reduce dot damage from resilience for players if (m_target->GetTypeId()==TYPEID_PLAYER) @@ -6025,7 +5914,7 @@ void AuraEffect::PeriodicTick() pCaster->DealDamageMods(m_target,pdamage,&absorb); - SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, absorb, resist, 0.0f); + SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, absorb, resist, 0.0f, crit); m_target->SendPeriodicAuraLog(&pInfo); Unit* target = m_target; // aura can be deleted in DealDamage @@ -6062,7 +5951,7 @@ void AuraEffect::PeriodicTick() uint32 absorb=0; uint32 resist=0; - CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL ); + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL ); //uint32 pdamage = GetModifierValuePerStack() > 0 ? GetModifierValuePerStack() : 0; uint32 pdamage = GetAmount() > 0 ? GetAmount() : 0; @@ -6072,7 +5961,7 @@ void AuraEffect::PeriodicTick() if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) { uint32 pdamageReductedArmor = pCaster->CalcArmorReducedDamage(m_target, pdamage, GetSpellProto()); - cleanDamage.damage += pdamage - pdamageReductedArmor; + cleanDamage.mitigated_damage += pdamage - pdamageReductedArmor; pdamage = pdamageReductedArmor; } @@ -6156,7 +6045,7 @@ void AuraEffect::PeriodicTick() return; // heal for caster damage (must be alive) - if(m_target != pCaster && GetSpellProto()->SpellVisual[0]==163 && !pCaster->isAlive()) + if(m_target != pCaster && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_HEALTH_FUNNEL && !pCaster->isAlive()) return; if(GetParentAura()->GetAuraDuration() ==-1 && m_target->GetHealth()==m_target->GetMaxHealth()) @@ -6169,14 +6058,39 @@ void AuraEffect::PeriodicTick() if(m_auraName==SPELL_AURA_OBS_MOD_HEALTH) pdamage = uint32(m_target->GetMaxHealth() * pdamage * GetParentAura()->GetStackAmount() / 100); else + { + // Wild Growth (1/7 - 6 + 2*ramainTicks) % + if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellIconID == 2864) + { + int32 ticks = GetParentAura()->GetAuraMaxDuration()/m_amplitude; + int32 remainingTicks = int32(float(GetParentAura()->GetAuraDuration()) / m_amplitude + 0.5); + pdamage = int32(pdamage) + int32(pdamage)*ticks*(-6+2*remainingTicks)/100; + } + pdamage = pCaster->SpellHealingBonus(m_target, GetSpellProto(), pdamage, DOT, GetParentAura()->GetStackAmount()); + } + + bool crit = false; + Unit::AuraEffectList const& mPeriodicCritAuras= pCaster->GetAurasByType(SPELL_AURA_ABILITY_PERIODIC_CRIT); + for(Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr) + { + if (!(*itr)->isAffectedOnSpell(m_spellProto)) + continue; + + if (pCaster->isSpellCrit(m_target, m_spellProto, GetSpellSchoolMask(m_spellProto))) + { + crit = true; + pdamage = pCaster->SpellCriticalHealingBonus(m_spellProto, pdamage, m_target); + } + break; + } sLog.outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); int32 gain = m_target->ModifyHealth(pdamage); - SpellPeriodicAuraLogInfo pInfo(this, pdamage, pdamage - gain, 0, 0, 0.0f); + SpellPeriodicAuraLogInfo pInfo(this, pdamage, pdamage - gain, 0, 0, 0.0f, crit); m_target->SendPeriodicAuraLog(&pInfo); // add HoTs to amount healed in bgs @@ -6192,7 +6106,7 @@ void AuraEffect::PeriodicTick() // Health Funnel // heal for caster damage - if(m_target!=pCaster && spellProto->SpellVisual[0]==163) + if(m_target!=pCaster && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_HEALTH_FUNNEL) { uint32 dmg = spellProto->manaPerSecond; if(pCaster->GetHealth() <= dmg && pCaster->GetTypeId()==TYPEID_PLAYER) @@ -6217,7 +6131,7 @@ void AuraEffect::PeriodicTick() pCaster->DealDamageMods(pCaster,damage,&absorb); pCaster->SendSpellNonMeleeDamageLog(pCaster, GetId(), damage, GetSpellSchoolMask(GetSpellProto()), absorb, 0, false, 0, false); - CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL ); + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL ); pCaster->DealDamage(pCaster, damage, &cleanDamage, NODAMAGE, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true); } } @@ -6291,7 +6205,7 @@ void AuraEffect::PeriodicTick() modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, gain_multiplier); } - SpellPeriodicAuraLogInfo pInfo(this, drain_amount, 0, 0, 0, gain_multiplier); + SpellPeriodicAuraLogInfo pInfo(this, drain_amount, 0, 0, 0, gain_multiplier, false); m_target->SendPeriodicAuraLog(&pInfo); int32 gain_amount = int32(drain_amount*gain_multiplier); @@ -6323,6 +6237,20 @@ void AuraEffect::PeriodicTick() GetParentAura()->SetAuraDuration(0); } } + // Mana Feed - Drain Mana + if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK + && m_spellProto->SpellFamilyFlags[0] & 0x00000010) + { + int32 manaFeedVal = 0; + if (AuraEffect const * aurEff = GetParentAura()->GetPartAura(1)) + manaFeedVal = aurEff->GetAmount(); + + if(manaFeedVal > 0) + { + manaFeedVal = manaFeedVal * gain_amount / 100; + pCaster->CastCustomSpell(pCaster, 32554, &manaFeedVal, NULL, NULL, true, NULL, this); + } + } break; } case SPELL_AURA_OBS_MOD_ENERGY: @@ -6346,7 +6274,7 @@ void AuraEffect::PeriodicTick() sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), amount, GetId()); - SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f); + SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); m_target->SendPeriodicAuraLog(&pInfo); int32 gain = m_target->ModifyPower(power,amount); @@ -6371,7 +6299,7 @@ void AuraEffect::PeriodicTick() uint32 amount = m_amount; - SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f); + SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); m_target->SendPeriodicAuraLog(&pInfo); sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", @@ -6523,6 +6451,7 @@ void AuraEffect::PeriodicDummyTick() case 34291: case 43182: case 43183: + case 43706: case 46755: case 49472: // Drink Coffee case 57073: @@ -6602,165 +6531,10 @@ void AuraEffect::PeriodicDummyTick() // 7053 Forsaken Skill: Shadow return; } -// // Panda -// case 19230: break; -// // Gossip NPC Periodic - Talk -// case 33208: break; -// // Gossip NPC Periodic - Despawn -// case 33209: break; -// // Steal Weapon -// case 36207: break; -// // Simon Game START timer, (DND) -// case 39993: break; -// // Knockdown Fel Cannon: break; The Aggro Burst -// case 40119: break; -// // Old Mount Spell -// case 40154: break; -// // Magnetic Pull -// case 40581: break; -// // Ethereal Ring: break; The Bolt Burst -// case 40801: break; -// // Crystal Prison -// case 40846: break; -// // Copy Weapon -// case 41054: break; -// // Dementia -// case 41404: break; -// // Ethereal Ring Visual, Lightning Aura -// case 41477: break; -// // Ethereal Ring Visual, Lightning Aura (Fork) -// case 41525: break; -// // Ethereal Ring Visual, Lightning Jumper Aura -// case 41567: break; -// // No Man's Land -// case 41955: break; -// // Headless Horseman - Fire -// case 42074: break; -// // Headless Horseman - Visual - Large Fire -// case 42075: break; -// // Headless Horseman - Start Fire, Periodic Aura -// case 42140: break; -// // Ram Speed Boost -// case 42152: break; -// // Headless Horseman - Fires Out Victory Aura -// case 42235: break; -// // Pumpkin Life Cycle -// case 42280: break; -// // Brewfest Request Chick Chuck Mug Aura -// case 42537: break; -// // Squashling -// case 42596: break; -// // Headless Horseman Climax, Head: Periodic -// case 42603: break; -// // Fire Bomb -// case 42621: break; -// // Headless Horseman - Conflagrate, Periodic Aura -// case 42637: break; -// // Headless Horseman - Create Pumpkin Treats Aura -// case 42774: break; -// // Headless Horseman Climax - Summoning Rhyme Aura -// case 42879: break; -// // Tricky Treat -// case 42919: break; -// // Giddyup! -// case 42924: break; -// // Ram - Trot -// case 42992: break; -// // Ram - Canter -// case 42993: break; -// // Ram - Gallop -// case 42994: break; -// // Ram Level - Neutral -// case 43310: break; -// // Headless Horseman - Maniacal Laugh, Maniacal, Delayed 17 -// case 43884: break; -// // Wretched! -// case 43963: break; -// // Headless Horseman - Maniacal Laugh, Maniacal, other, Delayed 17 -// case 44000: break; -// // Energy Feedback -// case 44328: break; -// // Romantic Picnic -// case 45102: break; -// // Romantic Picnic -// case 45123: break; -// // Looking for Love -// case 45124: break; -// // Kite - Lightning Strike Kite Aura -// case 45197: break; -// // Rocket Chicken -// case 45202: break; -// // Copy Offhand Weapon -// case 45205: break; -// // Upper Deck - Kite - Lightning Periodic Aura -// case 45207: break; -// // Kite -Sky Lightning Strike Kite Aura -// case 45251: break; -// // Ribbon Pole Dancer Check Aura -// case 45390: break; -// // Holiday - Midsummer, Ribbon Pole Periodic Visual -// case 45406: break; -// // Parachute -// case 45472: break; -// // Alliance Flag, Extra Damage Debuff -// case 45898: break; -// // Horde Flag, Extra Damage Debuff -// case 45899: break; -// // Ahune - Summoning Rhyme Aura -// case 45926: break; -// // Ahune - Slippery Floor -// case 45945: break; -// // Ahune's Shield -// case 45954: break; -// // Nether Vapor Lightning -// case 45960: break; -// // Darkness -// case 45996: break; -// // Summon Blood Elves Periodic -// case 46041: break; -// // Transform Visual Missile Periodic -// case 46205: break; -// // Find Opening Beam End -// case 46333: break; -// // Ice Spear Control Aura -// case 46371: break; -// // Hailstone Chill -// case 46458: break; -// // Hailstone Chill, Internal -// case 46465: break; -// // Chill, Internal Shifter -// case 46549: break; -// // Summon Ice Spear Knockback Delayer -// case 46878: break; -// // Burninate Effect -// case 47214: break; -// // Fizzcrank Practice Parachute -// case 47228: break; -// // Send Mug Control Aura -// case 47369: break; -// // Direbrew's Disarm (precast) -// case 47407: break; -// // Mole Machine Port Schedule -// case 47489: break; -// case 47941: break; // Crystal Spike -// case 48200: break; // Healer Aura -// case 48630: break; // Summon Gauntlet Mobs Periodic -// case 49313: break; // Proximity Mine Area Aura -// // Mole Machine Portal Schedule -// case 49466: break; -// case 49555: break; // Corpse Explode -// case 49592: break; // Temporal Rift -// case 49957: break; // Cutting Laser -// case 50085: break; // Slow Fall -// // Listening to Music -// case 50493: break; -// // Love Rocket Barrage -// case 50530: break; case 58549: // Tenacity case 59911: // Tenacity (vehicle) GetParentAura()->RefreshAura(); break; -// Exist more after, need add later default: break; } @@ -6768,8 +6542,12 @@ void AuraEffect::PeriodicDummyTick() case SPELLFAMILY_MAGE: { // Mirror Image -// if (spell->Id == 55342) -// return; + if (spell->Id == 55342) + { + // Set name of summons to name of caster + m_target->CastSpell((Unit *)NULL, m_spellProto->EffectTriggerSpell[m_effIndex], true); + m_isPeriodic = false; + } break; } case SPELLFAMILY_WARLOCK: @@ -6881,9 +6659,6 @@ void AuraEffect::PeriodicDummyTick() } switch (spell->Id) { - // Harpooner's Mark - // case 40084: - // return; // Feeding Frenzy Rank 1 case 53511: if ( m_target->GetHealth() * 100 < m_target->GetMaxHealth() * 35 ) @@ -6935,26 +6710,46 @@ void AuraEffect::PeriodicDummyTick() return; } // Summon Gargoyle -// if (spell->SpellFamilyFlags & 0x0000008000000000LL) -// return; + // Being pursuaded by Gargoyle - AI related? + // if (spell->SpellFamilyFlags[1] & 0x00000080) + // break; + // Blood of the North + // Reaping // Death Rune Mastery -// if (spell->SpellFamilyFlags & 0x0000000000004000LL) -// return; - // Bladed Armor - if (spell->SpellIconID == 2653) + if (spell->SpellIconID == 3041 || spell->SpellIconID == 22 || spell->SpellIconID == 2622) { - // Increases your attack power by $s1 for every $s2 armor value you have. - // Calculate AP bonus (from 1 efect of this spell) - int32 apBonus = m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[1], m_target); - m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, 0, true, 0, this); + if (m_target->GetTypeId() != TYPEID_PLAYER) + return; + // Aura not used - prevent removing death runes from other effects + if (!GetAmount()) + return; + if(((Player*)m_target)->getClass() != CLASS_DEATH_KNIGHT) + return; + + // Remove death rune added on proc + for (uint8 i=0;i<MAX_RUNES && m_amount;++i) + { + if (m_spellProto->SpellIconID == 2622) + { + if (((Player*)m_target)->GetCurrentRune(i) != RUNE_DEATH || + ((Player*)m_target)->GetBaseRune(i) == RUNE_BLOOD ) + continue; + } + else + { + if (((Player*)m_target)->GetCurrentRune(i) != RUNE_DEATH || + ((Player*)m_target)->GetBaseRune(i) != RUNE_BLOOD ) + continue; + } + + if (!(m_amount & (1<<i))) + continue; + + ((Player*)m_target)->ConvertRune(i,((Player*)m_target)->GetBaseRune(i)); + } + m_amount = 0; return; } - // Reaping -// if (spell->SpellIconID == 22) -// return; - // Blood of the North -// if (spell->SpellIconID == 30412) -// return; break; } default: @@ -6992,7 +6787,7 @@ void AuraEffect::HandleManaShield(bool apply, bool Real, bool changeAmount) switch(m_spellProto->SpellFamilyName) { case SPELLFAMILY_MAGE: - if(m_spellProto->SpellFamilyFlags[0] & 0x8000) + if(m_spellProto->SpellFamilyFlags[0] & 0x8000 && m_spellProto->SpellFamilyFlags[2] & 0x8) { // Mana Shield // +50% from +spd bonus @@ -7075,26 +6870,32 @@ void AuraEffect::HandleAuraConvertRune(bool apply, bool Real, bool /*changeAmoun if(plr->getClass() != CLASS_DEATH_KNIGHT) return; - // how to determine what rune need to be converted? - for(uint32 i = 0; i < MAX_RUNES; ++i) + uint32 runes = 0; + // convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb + for(uint32 i = 0; i < MAX_RUNES && m_amount; ++i) { if(apply) { + if (GetMiscValue() != plr->GetCurrentRune(i)) + continue; if(!plr->GetRuneCooldown(i)) { plr->ConvertRune(i, GetSpellProto()->EffectMiscValueB[m_effIndex]); - break; + runes |= 1<<i; + --m_amount; } } else { if(plr->GetCurrentRune(i) == GetSpellProto()->EffectMiscValueB[m_effIndex]) { - plr->ConvertRune(i, plr->GetBaseRune(i)); - break; + if (m_amount & (1<<i)) + plr->ConvertRune(i, plr->GetBaseRune(i)); } } } + if (apply) + m_amount = runes; } // Control Auras @@ -7130,12 +6931,7 @@ void AuraEffect::HandleModPossess(bool apply, bool Real, bool /*changeAmount*/) } if(apply) - { - if(m_target->getLevel() > m_amount) - return; - m_target->SetCharmedBy(caster, CHARM_TYPE_POSSESS); - } else m_target->RemoveCharmedBy(caster); } @@ -7153,7 +6949,6 @@ void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount* { if(caster->GetGuardianPet() != m_target) return; - m_target->SetCharmedBy(caster, CHARM_TYPE_POSSESS); } else @@ -7164,7 +6959,7 @@ void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount* ((Player*)caster)->PetSpellInitialize(); if(!m_target->getVictim()) { - m_target->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + m_target->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, m_target->GetFollowAngle()); m_target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW); } } @@ -7178,12 +6973,7 @@ void AuraEffect::HandleModCharm(bool apply, bool Real, bool /*changeAmount*/) Unit* caster = GetCaster(); if(apply) - { - if(m_amount && int32(m_target->getLevel()) > m_amount) - return; - m_target->SetCharmedBy(caster, CHARM_TYPE_CHARM); - } else m_target->RemoveCharmedBy(caster); } @@ -7196,12 +6986,7 @@ void AuraEffect::HandleCharmConvert(bool apply, bool Real, bool /*changeAmount*/ Unit* caster = GetCaster(); if(apply) - { - if(m_amount && int32(m_target->getLevel()) > m_amount) - return; - m_target->SetCharmedBy(caster, CHARM_TYPE_CONVERT); - } else m_target->RemoveCharmedBy(caster); } @@ -7268,7 +7053,7 @@ void AuraEffect::HandleAuraSafeFall( bool Apply, bool Real , bool /*changeAmount { // implemented in WorldSession::HandleMovementOpcodes - // only special case + // Buffeting Winds of Susurrus - only special case if(Apply && Real && GetId()==32474 && m_target->GetTypeId()==TYPEID_PLAYER) ((Player*)m_target)->ActivateTaxiPathTo(506,GetId()); } @@ -7286,12 +7071,13 @@ void AuraEffect::HandleReflectSpells( bool Apply, bool Real , bool /*changeAmoun // implemented in Unit::SpellHitResult // only special case - if(!Apply && Real && m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags[1] & 0x2) + if(!Apply && Real && GetParentAura()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT + && m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags[1] & 0x2) { if (Unit * caster = GetCaster()) { // Improved Spell Reflection - if (caster->GetDummyAura(SPELLFAMILY_WARRIOR,1935)) + if (caster->GetDummyAura(SPELLFAMILY_WARRIOR,1935, 1)) { // aura remove - remove auras from all party members std::list<Unit*> PartyMembers; @@ -7305,4 +7091,98 @@ void AuraEffect::HandleReflectSpells( bool Apply, bool Real , bool /*changeAmoun } } } +void AuraEffect::HandleAuraInitializeImages( bool Apply, bool Real , bool /*changeAmount*/) +{ + if (!Real) + return; + if (Apply) + { + Unit * caster = GetCaster(); + if (!caster) + return; + // Set item visual + if (caster->GetTypeId()== TYPEID_PLAYER) + { + if (Item const * item = ((Player *)caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND)) + m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, item->GetProto()->ItemId); + if (Item const * item = ((Player *)caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) + m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, item->GetProto()->ItemId); + } + else // TYPEID_UNIT + { + m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID)); + m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1)); + m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2)); + } + } + else + { + // Remove equipment visual + if (m_target->GetTypeId() == TYPEID_PLAYER) + { + for (uint8 i = 0; i < 3; ++i) + m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, 0); + } + else // TYPEID_UNIT + { + ((Creature*)m_target)->LoadEquipment(((Creature*)m_target)->GetEquipmentId()); + } + } +} + +void AuraEffect::HandleAuraCloneCaster( bool Apply, bool Real , bool /*changeAmount*/) +{ + if (!Real) + return; + + if (Apply) + { + Unit * caster = GetCaster(); + if (!caster) + return; + // Set display id (probably for portrait?) + m_target->SetDisplayId(caster->GetDisplayId()); + m_target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_MIRROR_IMAGE); + } + else + { + m_target->SetDisplayId(m_target->GetNativeDisplayId()); + m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_MIRROR_IMAGE); + } +} + +int32 AuraEffect::CalculateCrowdControlAuraAmount(Unit * caster) +{ + // Damage cap for CC effects + if (!m_spellProto->procFlags) + return 0; + + if (m_auraName !=SPELL_AURA_MOD_CONFUSE && + m_auraName !=SPELL_AURA_MOD_FEAR && + m_auraName !=SPELL_AURA_MOD_STUN && + m_auraName !=SPELL_AURA_MOD_ROOT && + m_auraName !=SPELL_AURA_TRANSFORM) + return 0; + + int32 damageCap = (int32)(m_target->GetMaxHealth()*0.10f); + + if (!caster) + return damageCap; + + // Glyphs increasing damage cap + Unit::AuraEffectList const& overrideClassScripts = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for(Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin();itr != overrideClassScripts.end(); ++itr) + { + if((*itr)->isAffectedOnSpell(m_spellProto)) + { + // Glyph of Fear, Glyph of Frost nova and similar auras + if ((*itr)->GetMiscValue() == 7801) + { + damageCap += (int32)(damageCap*(*itr)->GetAmount()/100.0f); + break; + } + } + } + return damageCap; +} |