aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp530
1 files changed, 153 insertions, 377 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 4cb40a05e3d..b62dc1c62ab 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -64,6 +64,8 @@
#include "AccountMgr.h"
#include "InstanceScript.h"
#include "PathGenerator.h"
+#include "Guild.h"
+#include "GuildMgr.h"
#include "ReputationMgr.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
@@ -113,14 +115,14 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectJumpDest, // 42 SPELL_EFFECT_JUMP_DEST
&Spell::EffectTeleUnitsFaceCaster, // 43 SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER
&Spell::EffectLearnSkill, // 44 SPELL_EFFECT_SKILL_STEP
- &Spell::EffectAddHonor, // 45 SPELL_EFFECT_ADD_HONOR honor/pvp related
+ &Spell::EffectPlayMovie, // 45 SPELL_EFFECT_PLAY_MOVIE
&Spell::EffectUnused, // 46 SPELL_EFFECT_SPAWN clientside, unit appears as if it was just spawned
&Spell::EffectTradeSkill, // 47 SPELL_EFFECT_TRADE_SKILL
&Spell::EffectUnused, // 48 SPELL_EFFECT_STEALTH one spell: Base Stealth
&Spell::EffectUnused, // 49 SPELL_EFFECT_DETECT one spell: Detect
&Spell::EffectTransmitted, // 50 SPELL_EFFECT_TRANS_DOOR
&Spell::EffectUnused, // 51 SPELL_EFFECT_FORCE_CRITICAL_HIT unused
- &Spell::EffectUnused, // 52 SPELL_EFFECT_GUARANTEE_HIT one spell: zzOLDCritical Shot
+ &Spell::EffectUnused, // 52 SPELL_EFFECT_GUARANTEE_HIT unused
&Spell::EffectEnchantItemPerm, // 53 SPELL_EFFECT_ENCHANT_ITEM
&Spell::EffectEnchantItemTmp, // 54 SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY
&Spell::EffectTameCreature, // 55 SPELL_EFFECT_TAMECREATURE
@@ -231,8 +233,26 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectNULL, //160 SPELL_EFFECT_160 1 spell - 45534
&Spell::EffectSpecCount, //161 SPELL_EFFECT_TALENT_SPEC_COUNT second talent spec (learn/revert)
&Spell::EffectActivateSpec, //162 SPELL_EFFECT_TALENT_SPEC_SELECT activate primary/secondary spec
- &Spell::EffectNULL, //163 unused
+ &Spell::EffectUnused, //163 SPELL_EFFECT_163 unused
&Spell::EffectRemoveAura, //164 SPELL_EFFECT_REMOVE_AURA
+ &Spell::EffectDamageFromMaxHealthPCT, //165 SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT
+ &Spell::EffectGiveCurrency, //166 SPELL_EFFECT_GIVE_CURRENCY
+ &Spell::EffectNULL, //167 SPELL_EFFECT_167
+ &Spell::EffectNULL, //168 SPELL_EFFECT_168
+ &Spell::EffectNULL, //169 SPELL_EFFECT_DESTROY_ITEM
+ &Spell::EffectNULL, //170 SPELL_EFFECT_170
+ &Spell::EffectNULL, //171 SPELL_EFFECT_171
+ &Spell::EffectResurrectWithAura, //172 SPELL_EFFECT_RESURRECT_WITH_AURA
+ &Spell::EffectNULL, //173 SPELL_EFFECT_UNLOCK_GUILD_VAULT_TAB
+ &Spell::EffectNULL, //174 SPELL_EFFECT_174
+ &Spell::EffectUnused, //175 SPELL_EFFECT_175 unused
+ &Spell::EffectNULL, //176 SPELL_EFFECT_176
+ &Spell::EffectNULL, //177 SPELL_EFFECT_177
+ &Spell::EffectUnused, //178 SPELL_EFFECT_178 unused
+ &Spell::EffectNULL, //179 SPELL_EFFECT_CREATE_AREATRIGGER
+ &Spell::EffectUnused, //180 SPELL_EFFECT_180 unused
+ &Spell::EffectUnused, //181 SPELL_EFFECT_181 unused
+ &Spell::EffectNULL, //182 SPELL_EFFECT_182
};
void Spell::EffectNULL(SpellEffIndex /*effIndex*/)
@@ -261,13 +281,13 @@ void Spell::EffectResurrectNew(SpellEffIndex effIndex)
Player* target = unitTarget->ToPlayer();
- if (target->isRessurectRequested()) // already have one active request
+ if (target->IsRessurectRequested()) // already have one active request
return;
uint32 health = damage;
uint32 mana = m_spellInfo->Effects[effIndex].MiscValue;
ExecuteLogEffectResurrect(effIndex, target);
- target->setResurrectRequestData(m_caster->GetGUID(), m_caster->GetMapId(), m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), health, mana);
+ target->SetResurrectRequestData(m_caster, health, mana, 0);
SendResurrectRequest(target);
}
@@ -370,15 +390,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
}
case SPELLFAMILY_WARRIOR:
{
- // Shield Slam
- if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category == 1209)
- {
- uint8 level = m_caster->getLevel();
- uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 24.5f), uint32(float(level) * 34.5f));
- damage += int32(m_caster->ApplyEffectModifiers(m_spellInfo, effIndex, float(block_value)));
- }
// Victory Rush
- else if (m_spellInfo->SpellFamilyFlags[1] & 0x100)
+ if (m_spellInfo->Id == 34428)
ApplyPct(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
// Shockwave
else if (m_spellInfo->Id == 46968)
@@ -395,73 +408,12 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Incinerate Rank 1 & 2
if ((m_spellInfo->SpellFamilyFlags[1] & 0x000040) && m_spellInfo->SpellIconID == 2128)
{
- // Incinerate does more dmg (dmg*0.25) if the target have Immolate debuff.
+ // Incinerate does more dmg (dmg/6) if the target have Immolate debuff.
// Check aura state for speed but aura state set not only for Immolate spell
if (unitTarget->HasAuraState(AURA_STATE_CONFLAGRATE))
{
if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x4, 0, 0))
- damage += damage/4;
- }
- }
- // Conflagrate - consumes Immolate or Shadowflame
- else if (m_spellInfo->TargetAuraState == AURA_STATE_CONFLAGRATE)
- {
- AuraEffect const* aura = NULL; // found req. aura for damage calculation
-
- Unit::AuraEffectList const &mPeriodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE);
- for (Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i)
- {
- // for caster applied auras only
- if ((*i)->GetSpellInfo()->SpellFamilyName != SPELLFAMILY_WARLOCK ||
- (*i)->GetCasterGUID() != m_caster->GetGUID())
- continue;
-
- // Immolate
- if ((*i)->GetSpellInfo()->SpellFamilyFlags[0] & 0x4)
- {
- aura = *i; // it selected always if exist
- break;
- }
-
- // Shadowflame
- if ((*i)->GetSpellInfo()->SpellFamilyFlags[2] & 0x00000002)
- aura = *i; // remember but wait possible Immolate as primary priority
- }
-
- // found Immolate or Shadowflame
- if (aura)
- {
- uint32 pdamage = uint32(std::max(aura->GetAmount(), 0));
- pdamage = m_caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount());
- pdamage = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount());
- uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1));
- uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude);
- damage += int32(CalculatePct(pdamage * baseTotalTicks, pct_dir));
-
- uint32 pct_dot = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 2)) / 3;
- m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePct(pdamage * baseTotalTicks, pct_dot)));
-
- apply_direct_bonus = false;
- // Glyph of Conflagrate
- if (!m_caster->HasAura(56235))
- unitTarget->RemoveAurasDueToSpell(aura->GetId(), m_caster->GetGUID());
-
- break;
- }
- }
- // Shadow Bite
- else if (m_spellInfo->SpellFamilyFlags[1] & 0x400000)
- {
- if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())
- {
- if (Player* owner = m_caster->GetOwner()->ToPlayer())
- {
- if (AuraEffect* aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, 214, 0))
- {
- int32 bp0 = aurEff->GetId() == 54037 ? 4 : 8;
- m_caster->CastCustomSpell(m_caster, 54425, &bp0, NULL, NULL, true);
- }
- }
+ damage += damage / 6;
}
}
break;
@@ -492,20 +444,10 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Ferocious Bite
if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[0] & 0x000800000) && m_spellInfo->SpellVisual[0] == 6587)
{
- // converts each extra point of energy into ($f1+$AP/410) additional damage
- float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
- float multiple = ap / 410 + m_spellInfo->Effects[effIndex].DamageMultiplier;
- int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -30));
- damage += int32(energy * multiple);
- damage += int32(CalculatePct(m_caster->ToPlayer()->GetComboPoints() * ap, 7));
- }
- // Wrath
- else if (m_spellInfo->SpellFamilyFlags[0] & 0x00000001)
- {
- // Improved Insect Swarm
- if (AuraEffect const* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
- if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00200000, 0, 0))
- AddPct(damage, aurEff->GetAmount());
+ // converts each extra point of energy ( up to 25 energy ) into additional damage
+ int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -25));
+ // 25 energy = 100% more damage
+ AddPct(damage, energy * 4);
}
break;
}
@@ -585,62 +527,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
if (m_caster->HasAura(57627)) // Charge 6 sec post-affect
damage *= 2;
}
- // Steady Shot
- else if (m_spellInfo->SpellFamilyFlags[1] & 0x1)
- {
- bool found = false;
- // check dazed affect
- Unit::AuraEffectList const& decSpeedList = unitTarget->GetAuraEffectsByType(SPELL_AURA_MOD_DECREASE_SPEED);
- for (Unit::AuraEffectList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter)
- {
- if ((*iter)->GetSpellInfo()->SpellIconID == 15 && (*iter)->GetSpellInfo()->Dispel == 0)
- {
- found = true;
- break;
- }
- }
-
- /// @todo should this be put on taken but not done?
- if (found)
- damage += m_spellInfo->Effects[EFFECT_1].CalcValue();
-
- if (Player* caster = m_caster->ToPlayer())
- {
- // Add Ammo and Weapon damage plus RAP * 0.1
- if (Item* item = caster->GetWeaponForAttack(RANGED_ATTACK))
- {
- ItemTemplate const* weaponTemplate = item->GetTemplate();
- float dmg_min = weaponTemplate->Damage[0].DamageMin;
- float dmg_max = weaponTemplate->Damage[0].DamageMax;
- if (dmg_max == 0.0f && dmg_min > dmg_max)
- damage += int32(dmg_min);
- else
- damage += irand(int32(dmg_min), int32(dmg_max));
- damage += int32(caster->GetAmmoDPS() * weaponTemplate->Delay * 0.001f);
- }
- }
- }
- break;
- }
- case SPELLFAMILY_PALADIN:
- {
- // Hammer of the Righteous
- if (m_spellInfo->SpellFamilyFlags[1]&0x00040000)
- {
- // Add main hand dps * effect[2] amount
- float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2;
- int32 count = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, EFFECT_2);
- damage += count * int32(average * IN_MILLISECONDS) / m_caster->GetAttackTime(BASE_ATTACK);
- break;
- }
- // Shield of Righteousness
- if (m_spellInfo->SpellFamilyFlags[EFFECT_1] & 0x100000)
- {
- uint8 level = m_caster->getLevel();
- uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 39.5f));
- damage += CalculatePct(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue());
- break;
- }
break;
}
case SPELLFAMILY_DEATHKNIGHT:
@@ -815,15 +701,6 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
// special cases
switch (triggered_spell_id)
{
- // Mirror Image
- case 58832:
- {
- // Glyph of Mirror Image
- if (m_caster->HasAura(63093))
- m_caster->CastSpell(m_caster, 65047, true); // Mirror Image
-
- break;
- }
// Vanish (not exist)
case 18461:
{
@@ -856,10 +733,6 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
unitTarget->CastSpell(unitTarget, 7870, true);
return;
}
- // just skip
- case 23770: // Sayge's Dark Fortune of *
- // not exist, common cooldown can be implemented in scripts if need.
- return;
// Brittle Armor - (need add max stack of 24575 Brittle Armor)
case 29284:
{
@@ -1330,16 +1203,11 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex)
damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
- // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
- int32 power = damage;
- if (powerType == POWER_MANA)
- power -= unitTarget->GetSpellCritDamageReduction(power);
-
- int32 newDamage = -(unitTarget->ModifyPower(powerType, -int32(power)));
+ int32 newDamage = -(unitTarget->ModifyPower(powerType, -damage));
float gainMultiplier = 0.0f;
- // Don`t restore from self drain
+ // Don't restore from self drain
if (m_caster != unitTarget)
{
gainMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this);
@@ -1413,12 +1281,7 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
damage = std::min(damage, maxDamage);
}
- int32 power = damage;
- // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
- if (powerType == POWER_MANA)
- power -= unitTarget->GetSpellCritDamageReduction(power);
-
- int32 newDamage = -(unitTarget->ModifyPower(powerType, -power));
+ int32 newDamage = -(unitTarget->ModifyPower(powerType, -damage));
// NO - Not a typo - EffectPowerBurn uses effect value multiplier - not effect damage multiplier
float dmgMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this);
@@ -1512,22 +1375,6 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
//addhealth += tickheal * tickcount;
//addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth, HEAL, unitTarget);
}
- // Nourish
- else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x2000000)
- {
- addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL);
-
- // Glyph of Nourish
- if (AuraEffect const* aurEff = m_caster->GetAuraEffect(62971, 0))
- {
- Unit::AuraEffectList const& Periodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL);
- for (Unit::AuraEffectList::const_iterator i = Periodic.begin(); i != Periodic.end(); ++i)
- {
- if (m_caster->GetGUID() == (*i)->GetCasterGUID())
- AddPct(addhealth, aurEff->GetAmount());
- }
- }
- }
// Death Pact - return pct of max health to caster
else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00080000)
addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, int32(caster->CountPctFromMaxHealth(damage)), HEAL);
@@ -1673,7 +1520,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
if (msg != EQUIP_ERR_OK)
{
// convert to possible store amount
- if (msg == EQUIP_ERR_INVENTORY_FULL || msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS)
+ if (msg == EQUIP_ERR_INV_FULL || msg == EQUIP_ERR_ITEM_MAX_COUNT)
num_to_add -= no_space;
else
{
@@ -1702,6 +1549,11 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
// send info to the client
player->SendNewItem(pItem, num_to_add, true, bgType == 0);
+ if (pProto->Quality > ITEM_QUALITY_EPIC || (pProto->Quality == ITEM_QUALITY_EPIC && pProto->ItemLevel >= MinNewsItemLevel[sWorld->getIntConfig(CONFIG_EXPANSION)]))
+ if (Guild* guild = player->GetGuild())
+ guild->AddGuildNews(GUILD_NEWS_ITEM_CRAFTED, player->GetGUID(), 0, pProto->ItemId);
+
+
// we succeeded in creating at least one item, so a levelup is possible
if (bgType == 0)
player->UpdateCraftSkill(m_spellInfo->Id);
@@ -1790,7 +1642,7 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex)
if (!caster->IsInWorld())
return;
DynamicObject* dynObj = new DynamicObject(false);
- if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
+ if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
{
delete dynObj;
return;
@@ -1842,13 +1694,10 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
level_multiplier = 4;
break;
case 31930: // Judgements of the Wise
- case 63375: // Improved Stormstrike
+ case 63375: // Primal Wisdom
case 68082: // Glyph of Seal of Command
damage = int32(CalculatePct(unitTarget->GetCreateMana(), damage));
break;
- case 48542: // Revitalize
- damage = int32(CalculatePct(unitTarget->GetMaxPower(power), damage));
- break;
case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
{
if (Player* player = m_caster->ToPlayer())
@@ -1856,9 +1705,6 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
AddPct(damage, 25);
break;
}
- case 71132: // Glyph of Shadow Word: Pain
- damage = int32(CalculatePct(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc
- break;
default:
break;
}
@@ -1866,7 +1712,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
if (level_diff > 0)
damage -= level_multiplier * level_diff;
- if (damage < 0)
+ if (damage < 0 && power != POWER_ECLIPSE)
return;
if (unitTarget->GetMaxPower(power) == 0)
@@ -2200,9 +2046,9 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
uint8 msg = player->CanEquipItem(m_CastItem->GetSlot(), dest, pNewItem, true);
- if (msg == EQUIP_ERR_OK || msg == EQUIP_ERR_CANT_DO_RIGHT_NOW)
+ if (msg == EQUIP_ERR_OK || msg == EQUIP_ERR_CLIENT_LOCKED_OUT)
{
- if (msg == EQUIP_ERR_CANT_DO_RIGHT_NOW) dest = EQUIPMENT_SLOT_MAINHAND;
+ if (msg == EQUIP_ERR_CLIENT_LOCKED_OUT) dest = EQUIPMENT_SLOT_MAINHAND;
// prevent crash at access and unexpected charges counting with item update queue corrupt
if (m_CastItem == m_targets.GetItemTarget())
@@ -2543,7 +2389,7 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
// Devour Magic
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == SPELLCATEGORY_DEVOUR_MAGIC)
{
- int32 heal_amount = m_spellInfo->Effects[EFFECT_1].CalcValue();
+ int32 heal_amount = m_spellInfo->Effects[EFFECT_1].CalcValue(m_caster);
m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, NULL, NULL, true);
// Glyph of Felhunter
if (Unit* owner = m_caster->GetOwner())
@@ -2620,7 +2466,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
return;
DynamicObject* dynObj = new DynamicObject(true);
- if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
+ if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
{
delete dynObj;
return;
@@ -2677,7 +2523,7 @@ void Spell::EffectLearnSkill(SpellEffIndex effIndex)
unitTarget->ToPlayer()->SetSkill(skillid, m_spellInfo->Effects[effIndex].CalcValue(), skillval?skillval:1, damage*75);
}
-void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)
+void Spell::EffectPlayMovie(SpellEffIndex effIndex)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -2685,27 +2531,11 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- // not scale value for item based reward (/10 value expected)
- if (m_CastItem)
- {
- unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage/10);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUIDLow());
+ uint32 movieId = GetSpellInfo()->Effects[effIndex].MiscValue;
+ if (!sMovieStore.LookupEntry(movieId))
return;
- }
- // do not allow to add too many honor for player (50 * 21) = 1040 at level 70, or (50 * 31) = 1550 at level 80
- if (damage <= 50)
- {
- uint32 honor_reward = Trinity::Honor::hk_honor_at_level(unitTarget->getLevel(), float(damage));
- unitTarget->ToPlayer()->RewardHonor(NULL, 1, honor_reward);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow());
- }
- else
- {
- //maybe we have correct honor_gain in damage already
- unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage);
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow());
- }
+ unitTarget->ToPlayer()->SendMovieStart(movieId);
}
void Spell::EffectTradeSkill(SpellEffIndex /*effIndex*/)
@@ -2733,7 +2563,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
Player* p_caster = (Player*)m_caster;
// Handle vellums
- if (itemTarget->IsWeaponVellum() || itemTarget->IsArmorVellum())
+ if (itemTarget->IsVellum())
{
// destroy one vellum from stack
uint32 count = 1;
@@ -2858,58 +2688,6 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
Player* p_caster = (Player*)m_caster;
- // Rockbiter Weapon apply to both weapon
- if (!itemTarget)
- return;
- if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & 0x400000)
- {
- uint32 spell_id = 0;
-
- // enchanting spell selected by calculated damage-per-sec stored in Effect[1] base value
- // Note: damage calculated (correctly) with rounding int32(float(v)) but
- // RW enchantments applied damage int32(float(v)+0.5), this create 0..1 difference sometime
- switch (damage)
- {
- // Rank 1
- case 2: spell_id = 36744; break; // 0% [ 7% == 2, 14% == 2, 20% == 2]
- // Rank 2
- case 4: spell_id = 36753; break; // 0% [ 7% == 4, 14% == 4]
- case 5: spell_id = 36751; break; // 20%
- // Rank 3
- case 6: spell_id = 36754; break; // 0% [ 7% == 6, 14% == 6]
- case 7: spell_id = 36755; break; // 20%
- // Rank 4
- case 9: spell_id = 36761; break; // 0% [ 7% == 6]
- case 10: spell_id = 36758; break; // 14%
- case 11: spell_id = 36760; break; // 20%
- default:
- sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage);
- return;
- }
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
- if (!spellInfo)
- {
- sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id);
- return;
-
- }
-
- for (int j = BASE_ATTACK; j <= OFF_ATTACK; ++j)
- {
- if (Item* item = p_caster->GetWeaponForAttack(WeaponAttackType(j)))
- {
- if (item->IsFitToSpellRequirements(m_spellInfo))
- {
- Spell* spell = new Spell(m_caster, spellInfo, TRIGGERED_FULL_MASK);
- SpellCastTargets targets;
- targets.SetItemTarget(item);
- spell->prepare(&targets);
- }
- }
- }
- return;
- }
if (!itemTarget)
return;
@@ -3160,9 +2938,6 @@ void Spell::EffectTaunt(SpellEffIndex /*effIndex*/)
return;
}
- if (m_spellInfo->Id == 62124)
- m_caster->CastSpell(unitTarget, 67485, true);
-
// Also use this effect to set the taunter's threat to the taunted creature's highest value
if (unitTarget->getThreatManager().getCurrentVictim())
{
@@ -3224,74 +2999,26 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
if (Aura* aur = unitTarget->GetAura(58567, m_caster->GetGUID()))
{
- // 58388 - Glyph of Devastate dummy aura.
- if (int32 num = (needCast ? 0 : 1) + (m_caster->HasAura(58388) ? 1 : 0))
+ if (int32 num = (needCast ? 0 : 1))
aur->ModStackAmount(num);
fixed_bonus += (aur->GetStackAmount() - 1) * CalculateDamage(2, unitTarget);
}
}
- if (m_spellInfo->SpellFamilyFlags[0] & 0x8000000) // Mocking Blow
- {
- if (unitTarget->IsImmunedToSpellEffect(m_spellInfo, EFFECT_1) || unitTarget->GetTypeId() == TYPEID_PLAYER)
- {
- m_damage = 0;
- return;
- }
- }
break;
}
case SPELLFAMILY_ROGUE:
{
- // Fan of Knives, Hemorrhage, Ghostly Strike
- if ((m_spellInfo->SpellFamilyFlags[1] & 0x40000)
- || (m_spellInfo->SpellFamilyFlags[0] & 0x6000000))
+ // Hemorrhage
+ if (m_spellInfo->SpellFamilyFlags[0] & 0x2000000)
{
- // Hemorrhage
- if (m_spellInfo->SpellFamilyFlags[0] & 0x2000000)
- {
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
- m_caster->ToPlayer()->AddComboPoints(unitTarget, 1, this);
- }
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ m_caster->ToPlayer()->AddComboPoints(unitTarget, 1, this);
// 50% more damage with daggers
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (Item* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true))
if (item->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER)
totalDamagePercentMod *= 1.5f;
}
- // Mutilate (for each hand)
- else if (m_spellInfo->SpellFamilyFlags[1] & 0x6)
- {
- bool found = false;
- // fast check
- if (unitTarget->HasAuraState(AURA_STATE_DEADLY_POISON, m_spellInfo, m_caster))
- found = true;
- // full aura scan
- else
- {
- Unit::AuraApplicationMap const& auras = unitTarget->GetAppliedAuras();
- for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
- {
- if (itr->second->GetBase()->GetSpellInfo()->Dispel == DISPEL_POISON)
- {
- found = true;
- break;
- }
- }
- }
-
- if (found)
- totalDamagePercentMod *= 1.2f; // 120% if poisoned
- }
- break;
- }
- case SPELLFAMILY_PALADIN:
- {
- // Seal of Command Unleashed
- if (m_spellInfo->Id == 20467)
- {
- spell_bonus += int32(0.08f * m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
- spell_bonus += int32(0.13f * m_caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()));
- }
break;
}
case SPELLFAMILY_SHAMAN:
@@ -3322,54 +3049,35 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
{
// Kill Shot - bonus damage from Ranged Attack Power
if (m_spellInfo->SpellFamilyFlags[1] & 0x800000)
- spell_bonus += int32(0.4f * m_caster->GetTotalAttackPowerValue(RANGED_ATTACK));
+ spell_bonus += int32(0.45f * m_caster->GetTotalAttackPowerValue(RANGED_ATTACK));
break;
}
case SPELLFAMILY_DEATHKNIGHT:
{
- // Plague Strike
- if (m_spellInfo->SpellFamilyFlags[0] & 0x1)
- {
- // Glyph of Plague Strike
- if (AuraEffect const* aurEff = m_caster->GetAuraEffect(58657, EFFECT_0))
- AddPct(totalDamagePercentMod, aurEff->GetAmount());
- break;
- }
// Blood Strike
if (m_spellInfo->SpellFamilyFlags[0] & 0x400000)
{
- float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f;
+ float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue(m_caster) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
AddPct(bonusPct, aurEff->GetAmount());
AddPct(totalDamagePercentMod, bonusPct);
-
- // Glyph of Blood Strike
- if (m_caster->GetAuraEffect(59332, EFFECT_0))
- if (unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
- AddPct(totalDamagePercentMod, 20);
break;
}
// Death Strike
if (m_spellInfo->SpellFamilyFlags[0] & 0x10)
{
// Glyph of Death Strike
+ // 2% more damage per 5 runic power, up to a maximum of 40%
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(59336, EFFECT_0))
- if (uint32 runic = std::min<uint32>(m_caster->GetPower(POWER_RUNIC_POWER), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
+ if (uint32 runic = std::min<uint32>(uint32(m_caster->GetPower(POWER_RUNIC_POWER) / 2.5f), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(m_caster)))
AddPct(totalDamagePercentMod, runic);
break;
}
// Obliterate (12.5% more damage per disease)
if (m_spellInfo->SpellFamilyFlags[1] & 0x20000)
{
- bool consumeDiseases = true;
- // Annihilation
- if (AuraEffect const* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 2710, EFFECT_0))
- // Do not consume diseases if roll sucesses
- if (roll_chance_i(aurEff->GetAmount()))
- consumeDiseases = false;
-
- float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f;
+ float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue(m_caster) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), false) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
AddPct(bonusPct, aurEff->GetAmount());
@@ -3385,7 +3093,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
// Heart Strike
if (m_spellInfo->SpellFamilyFlags[0] & 0x1000000)
{
- float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
+ float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue(m_caster) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
AddPct(bonusPct, aurEff->GetAmount());
@@ -3529,7 +3237,7 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
// check if we can interrupt spell
if ((spell->getState() == SPELL_STATE_CASTING
|| (spell->getState() == SPELL_STATE_PREPARING && spell->GetCastTime() > 0.0f))
- && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE
+ && (curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE || curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_UNK)
&& ((i == CURRENT_GENERIC_SPELL && curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT)
|| (i == CURRENT_CHANNELED_SPELL && curSpellInfo->ChannelInterruptFlags & CHANNEL_INTERRUPT_FLAG_INTERRUPT)))
{
@@ -4472,12 +4180,16 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex)
switch (m_glyphIndex)
{
case 0:
- case 1: minLevel = 15; break;
- case 2: minLevel = 50; break;
- case 3: minLevel = 30; break;
- case 4: minLevel = 70; break;
- case 5: minLevel = 80; break;
+ case 1:
+ case 6: minLevel = 25; break;
+ case 2:
+ case 3:
+ case 7: minLevel = 50; break;
+ case 4:
+ case 5:
+ case 8: minLevel = 75; break;
}
+
if (minLevel && m_caster->getLevel() < minLevel)
{
SendCastResult(SPELL_FAILED_GLYPH_SOCKET_LOCKED);
@@ -4485,13 +4197,13 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex)
}
// apply new one
- if (uint32 glyph = m_spellInfo->Effects[effIndex].MiscValue)
+ if (uint32 newGlyph = m_spellInfo->Effects[effIndex].MiscValue)
{
- if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyph))
+ if (GlyphPropertiesEntry const* newGlyphProperties = sGlyphPropertiesStore.LookupEntry(newGlyph))
{
- if (GlyphSlotEntry const* gs = sGlyphSlotStore.LookupEntry(player->GetGlyphSlot(m_glyphIndex)))
+ if (GlyphSlotEntry const* newGlyphSlot = sGlyphSlotStore.LookupEntry(player->GetGlyphSlot(m_glyphIndex)))
{
- if (gp->TypeFlags != gs->TypeFlags)
+ if (newGlyphProperties->TypeFlags != newGlyphSlot->TypeFlags)
{
SendCastResult(SPELL_FAILED_INVALID_GLYPH);
return; // glyph slot mismatch
@@ -4499,17 +4211,26 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex)
}
// remove old glyph
- if (uint32 oldglyph = player->GetGlyph(m_glyphIndex))
+ if (uint32 oldGlyph = player->GetGlyph(player->GetActiveSpec(), m_glyphIndex))
{
- if (GlyphPropertiesEntry const* old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph))
+ if (GlyphPropertiesEntry const* oldGlyphProperties = sGlyphPropertiesStore.LookupEntry(oldGlyph))
{
- player->RemoveAurasDueToSpell(old_gp->SpellId);
+ player->RemoveAurasDueToSpell(oldGlyphProperties->SpellId);
player->SetGlyph(m_glyphIndex, 0);
}
}
- player->CastSpell(m_caster, gp->SpellId, true);
- player->SetGlyph(m_glyphIndex, glyph);
+ player->CastSpell(m_caster, newGlyphProperties->SpellId, true);
+ player->SetGlyph(m_glyphIndex, newGlyph);
+ player->SendTalentsInfoData(false);
+ }
+ }
+ else if (uint32 oldGlyph = player->GetGlyph(player->GetActiveSpec(), m_glyphIndex)) // Removing the glyph, get the old one
+ {
+ if (GlyphPropertiesEntry const* oldGlyphProperties = sGlyphPropertiesStore.LookupEntry(oldGlyph))
+ {
+ player->RemoveAurasDueToSpell(oldGlyphProperties->SpellId);
+ player->SetGlyph(m_glyphIndex, 0);
player->SendTalentsInfoData(false);
}
}
@@ -4725,7 +4446,7 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
Player* target = unitTarget->ToPlayer();
- if (target->isRessurectRequested()) // already have one active request
+ if (target->IsRessurectRequested()) // already have one active request
return;
uint32 health = target->CountPctFromMaxHealth(damage);
@@ -4733,7 +4454,7 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
ExecuteLogEffectResurrect(effIndex, target);
- target->setResurrectRequestData(m_caster->GetGUID(), m_caster->GetMapId(), m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), health, mana);
+ target->SetResurrectRequestData(m_caster, health, mana, 0);
SendResurrectRequest(target);
}
@@ -4881,6 +4602,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
player->SetPower(POWER_MANA, mana);
player->SetPower(POWER_RAGE, 0);
player->SetPower(POWER_ENERGY, player->GetMaxPower(POWER_ENERGY));
+ player->SetPower(POWER_FOCUS, 0);
player->SpawnCorpseBones();
}
@@ -5921,6 +5643,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex)
WorldPacket data(SMSG_PLAY_MUSIC, 4);
data << uint32(soundid);
+ data << uint64(unitTarget->GetGUID());
unitTarget->ToPlayer()->GetSession()->SendPacket(&data);
}
@@ -5956,8 +5679,7 @@ void Spell::EffectPlaySound(SpellEffIndex effIndex)
switch (m_spellInfo->Id)
{
- case 58730: // Restricted Flight Area
- case 58600: // Restricted Flight Area
+ case 91604: // Restricted Flight Area
unitTarget->ToPlayer()->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
break;
default:
@@ -5988,6 +5710,28 @@ void Spell::EffectRemoveAura(SpellEffIndex effIndex)
unitTarget->RemoveAurasDueToSpell(m_spellInfo->Effects[effIndex].TriggerSpell);
}
+void Spell::EffectDamageFromMaxHealthPCT(SpellEffIndex /*effIndex*/)
+{
+ if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
+ return;
+
+ if (!unitTarget)
+ return;
+
+ m_damage += unitTarget->CountPctFromMaxHealth(damage);
+}
+
+void Spell::EffectGiveCurrency(SpellEffIndex effIndex)
+{
+ if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
+ return;
+
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ unitTarget->ToPlayer()->ModifyCurrency(m_spellInfo->Effects[effIndex].MiscValue, damage);
+}
+
void Spell::EffectCastButtons(SpellEffIndex effIndex)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
@@ -6019,10 +5763,10 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
if (!p_caster->HasSpell(spell_id) || p_caster->HasSpellCooldown(spell_id))
continue;
- if (!(spellInfo->AttributesEx7 & SPELL_ATTR7_SUMMON_PLAYER_TOTEM))
+ if (!(spellInfo->AttributesEx9 & SPELL_ATTR9_SUMMON_PLAYER_TOTEM))
continue;
- uint32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
+ int32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
if (m_caster->GetPower(POWER_MANA) < cost)
continue;
@@ -6116,3 +5860,35 @@ void Spell::EffectSummonRaFFriend(SpellEffIndex effIndex)
m_caster->CastSpell(unitTarget, m_spellInfo->Effects[effIndex].TriggerSpell, true);
}
+
+void Spell::EffectResurrectWithAura(SpellEffIndex effIndex)
+{
+ if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
+ return;
+
+ if (!unitTarget || !unitTarget->IsInWorld())
+ return;
+
+ Player* target = unitTarget->ToPlayer();
+ if (!target)
+ return;
+
+ if (unitTarget->isAlive())
+ return;
+
+ if (target->IsRessurectRequested()) // already have one active request
+ return;
+
+ uint32 health = target->CountPctFromMaxHealth(damage);
+ uint32 mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage);
+ uint32 resurrectAura = 0;
+ if (sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[effIndex].TriggerSpell))
+ resurrectAura = GetSpellInfo()->Effects[effIndex].TriggerSpell;
+
+ if (resurrectAura && target->HasAura(resurrectAura))
+ return;
+
+ ExecuteLogEffectResurrect(effIndex, target);
+ target->SetResurrectRequestData(m_caster, health, mana, resurrectAura);
+ SendResurrectRequest(target);
+}