[3.3.5] CastSpell unclusterfucking (that's a word now) (#21123)

Core/Spell: The giant CastSpell unclusterfucking (that's a word now) of this generation.

- CastSpell now always takes three arguments - target, spellId, and a struct containing extra arguments
- This struct (CastSpellExtraArgs, see SpellDefines.h) serves as a conglomerate of every previous combination of the 20 billion different CastSpell overloads, all merged into one
  - It has some great utility constructors - check them out! All of these can be used to implicitly construct the ExtraArgs object.
- A gajillion refactors to make everything behave the way it always has
This commit is contained in:
Treeston
2017-12-30 20:28:41 +01:00
committed by GitHub
parent 671a34a966
commit d507a7e338
130 changed files with 1665 additions and 1241 deletions
+5 -1
View File
@@ -99,7 +99,11 @@ int32 CritterAI::Permissible(Creature const* creature)
void TriggerAI::IsSummonedBy(Unit* summoner) void TriggerAI::IsSummonedBy(Unit* summoner)
{ {
if (me->m_spells[0]) if (me->m_spells[0])
me->CastSpell(me, me->m_spells[0], false, nullptr, nullptr, summoner->GetGUID()); {
CastSpellExtraArgs extra;
extra.OriginalCaster = summoner->GetGUID();
me->CastSpell(me, me->m_spells[0], extra);
}
} }
int32 TriggerAI::Permissible(Creature const* creature) int32 TriggerAI::Permissible(Creature const* creature)
+1 -1
View File
@@ -243,7 +243,7 @@ void PetAI::UpdateAI(uint32 diff)
SpellCastTargets targets; SpellCastTargets targets;
targets.SetUnitTarget(target); targets.SetUnitTarget(target);
spell->prepare(&targets); spell->prepare(targets);
} }
// deleted cached Spell objects // deleted cached Spell objects
+6 -16
View File
@@ -169,28 +169,18 @@ void UnitAI::DoCast(uint32 spellId)
me->CastSpell(target, spellId, false); me->CastSpell(target, spellId, false);
} }
void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered) void UnitAI::DoCast(Unit* victim, uint32 spellId, CastSpellExtraArgs const& args)
{ {
if (!victim || (me->HasUnitState(UNIT_STATE_CASTING) && !triggered)) if (me->HasUnitState(UNIT_STATE_CASTING) && !(args.TriggerFlags & TRIGGERED_IGNORE_CAST_IN_PROGRESS))
return; return;
me->CastSpell(victim, spellId, triggered); me->CastSpell(victim, spellId, args);
} }
void UnitAI::DoCastVictim(uint32 spellId, bool triggered) void UnitAI::DoCastVictim(uint32 spellId, CastSpellExtraArgs const& args)
{ {
if (!me->GetVictim() || (me->HasUnitState(UNIT_STATE_CASTING) && !triggered)) if (Unit* victim = me->GetVictim())
return; DoCast(victim, spellId, args);
me->CastSpell(me->GetVictim(), spellId, triggered);
}
void UnitAI::DoCastAOE(uint32 spellId, bool triggered)
{
if (!triggered && me->HasUnitState(UNIT_STATE_CASTING))
return;
me->CastSpell(nullptr, spellId, triggered);
} }
uint32 UnitAI::GetDialogStatus(Player* /*player*/) uint32 UnitAI::GetDialogStatus(Player* /*player*/)
+5 -4
View File
@@ -22,6 +22,7 @@
#include "Containers.h" #include "Containers.h"
#include "EventMap.h" #include "EventMap.h"
#include "ObjectGuid.h" #include "ObjectGuid.h"
#include "SpellDefines.h"
#include "ThreatManager.h" #include "ThreatManager.h"
#define CAST_AI(a, b) (dynamic_cast<a*>(b)) #define CAST_AI(a, b) (dynamic_cast<a*>(b))
@@ -294,10 +295,10 @@ class TC_GAME_API UnitAI
void AttackStartCaster(Unit* victim, float dist); void AttackStartCaster(Unit* victim, float dist);
void DoCast(uint32 spellId); void DoCast(uint32 spellId);
void DoCast(Unit* victim, uint32 spellId, bool triggered = false); void DoCast(Unit* victim, uint32 spellId, CastSpellExtraArgs const& args = {});
void DoCastSelf(uint32 spellId, bool triggered = false) { DoCast(me, spellId, triggered); } void DoCastSelf(uint32 spellId, CastSpellExtraArgs const& args = {}) { DoCast(me, spellId, args); }
void DoCastVictim(uint32 spellId, bool triggered = false); void DoCastVictim(uint32 spellId, CastSpellExtraArgs const& args = {});
void DoCastAOE(uint32 spellId, bool triggered = false); void DoCastAOE(uint32 spellId, CastSpellExtraArgs const& args = {}) { DoCast(nullptr, spellId, args); }
float DoGetSpellMaxRange(uint32 spellId, bool positive = false); float DoGetSpellMaxRange(uint32 spellId, bool positive = false);
+1 -1
View File
@@ -690,7 +690,7 @@ void PlayerAI::DoCastAtTarget(TargetedSpell spell)
{ {
SpellCastTargets targets; SpellCastTargets targets;
targets.SetUnitTarget(spell.second); targets.SetUnitTarget(spell.second);
spell.first->prepare(&targets); spell.first->prepare(targets);
} }
void PlayerAI::DoRangedAttackIfReady() void PlayerAI::DoRangedAttackIfReady()
@@ -183,7 +183,7 @@ void ScriptedAI::DoCastSpell(Unit* target, SpellInfo const* spellInfo, bool trig
return; return;
me->StopMoving(); me->StopMoving();
me->CastSpell(target, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE); me->CastSpell(target, spellInfo->Id, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE);
} }
void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId) void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId)
@@ -1908,8 +1908,7 @@ void GameObject::Use(Unit* user)
if (!spellId) if (!spellId)
return; return;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!sSpellMgr->GetSpellInfo(spellId))
if (!spellInfo)
{ {
if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this)) if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this))
TC_LOG_ERROR("misc", "WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType()); TC_LOG_ERROR("misc", "WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType());
@@ -1922,7 +1921,7 @@ void GameObject::Use(Unit* user)
sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this); sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this);
if (spellCaster) if (spellCaster)
spellCaster->CastSpell(user, spellInfo, triggered); spellCaster->CastSpell(user, spellId, triggered);
else else
CastSpell(user, spellId); CastSpell(user, spellId);
} }
@@ -1951,7 +1950,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, TriggerCastFlags trigge
if (self) if (self)
{ {
if (target) if (target)
target->CastSpell(target, spellInfo, triggered); target->CastSpell(target, spellInfo->Id, triggered);
return; return;
} }
@@ -1963,6 +1962,8 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, TriggerCastFlags trigge
// remove immunity flags, to allow spell to target anything // remove immunity flags, to allow spell to target anything
trigger->SetImmuneToAll(false); trigger->SetImmuneToAll(false);
CastSpellExtraArgs args;
args.TriggerFlags = triggered;
if (Unit* owner = GetOwner()) if (Unit* owner = GetOwner())
{ {
trigger->SetFaction(owner->GetFaction()); trigger->SetFaction(owner->GetFaction());
@@ -1972,14 +1973,17 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, TriggerCastFlags trigge
trigger->SetByteValue(UNIT_FIELD_BYTES_2, 1, owner->GetByteValue(UNIT_FIELD_BYTES_2, 1)); trigger->SetByteValue(UNIT_FIELD_BYTES_2, 1, owner->GetByteValue(UNIT_FIELD_BYTES_2, 1));
// needed for GO casts for proper target validation checks // needed for GO casts for proper target validation checks
trigger->SetOwnerGUID(owner->GetGUID()); trigger->SetOwnerGUID(owner->GetGUID());
trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, owner->GetGUID());
args.OriginalCaster = owner->GetGUID();
trigger->CastSpell(target ? target : trigger, spellInfo->Id, args);
} }
else else
{ {
trigger->SetFaction(spellInfo->IsPositive() ? FACTION_FRIENDLY : FACTION_MONSTER); trigger->SetFaction(spellInfo->IsPositive() ? FACTION_FRIENDLY : FACTION_MONSTER);
// Set owner guid for target if no owner available - needed by trigger auras // Set owner guid for target if no owner available - needed by trigger auras
// - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell()) // - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell())
trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : ObjectGuid::Empty); args.OriginalCaster = target ? target->GetGUID() : ObjectGuid::Empty;
trigger->CastSpell(target ? target : trigger, spellInfo->Id, args);
} }
} }
+6 -6
View File
@@ -1870,13 +1870,13 @@ void Pet::CastPetAura(PetAura const* aura)
if (!auraId) if (!auraId)
return; return;
CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
if (auraId == 35696) // Demonic Knowledge if (auraId == 35696) // Demonic Knowledge
{ args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, CalculatePct(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT)));
int32 basePoints = CalculatePct(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT));
CastCustomSpell(this, auraId, &basePoints, nullptr, nullptr, true); CastSpell(this, auraId, args);
}
else
CastSpell(this, auraId, true);
} }
bool Pet::IsPetAura(Aura const* aura) bool Pet::IsPetAura(Aura const* aura)
+20 -18
View File
@@ -7679,7 +7679,7 @@ void Player::ApplyItemObtainSpells(Item* item, bool apply)
if (apply) if (apply)
{ {
if (!HasAura(spellId)) if (!HasAura(spellId))
CastSpell(this, spellId, true, item); CastSpell(this, spellId, item);
} }
else else
RemoveAurasDueToSpell(spellId); RemoveAurasDueToSpell(spellId);
@@ -7813,7 +7813,7 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply,
TC_LOG_DEBUG("entities.player", "Player::ApplyEquipSpell: Player '%s' (%s) cast %s equip spell (ID: %i)", TC_LOG_DEBUG("entities.player", "Player::ApplyEquipSpell: Player '%s' (%s) cast %s equip spell (ID: %i)",
GetName().c_str(), GetGUID().ToString().c_str(), (item ? "item" : "itemset"), spellInfo->Id); GetName().c_str(), GetGUID().ToString().c_str(), (item ? "item" : "itemset"), spellInfo->Id);
CastSpell(this, spellInfo, true, item); CastSpell(this, spellInfo->Id, item);
} }
else else
{ {
@@ -7953,7 +7953,7 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
chance = GetWeaponProcChance(); chance = GetWeaponProcChance();
if (roll_chance_f(chance) && sScriptMgr->OnCastItemCombatSpell(this, damageInfo.GetVictim(), spellInfo, item)) if (roll_chance_f(chance) && sScriptMgr->OnCastItemCombatSpell(this, damageInfo.GetVictim(), spellInfo, item))
CastSpell(damageInfo.GetVictim(), spellInfo->Id, true, item); CastSpell(damageInfo.GetVictim(), spellInfo->Id, item);
} }
} }
@@ -8017,8 +8017,8 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
{ {
Unit* target = spellInfo->IsPositive() ? this : damageInfo.GetVictim(); Unit* target = spellInfo->IsPositive() ? this : damageInfo.GetVictim();
CastSpellExtraArgs args(item);
// reduce effect values if enchant is limited // reduce effect values if enchant is limited
CustomSpellValues values;
if (entry && (entry->AttributesMask & ENCHANT_PROC_ATTR_LIMIT_60) && target->getLevel() > 60) if (entry && (entry->AttributesMask & ENCHANT_PROC_ATTR_LIMIT_60) && target->getLevel() > 60)
{ {
int32 const lvlDifference = target->getLevel() - 60; int32 const lvlDifference = target->getLevel() - 60;
@@ -8029,11 +8029,10 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{ {
if (spellInfo->Effects[i].IsEffect()) if (spellInfo->Effects[i].IsEffect())
values.AddSpellMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + i), CalculatePct(spellInfo->Effects[i].CalcValue(this), effectPct)); args.SpellValueOverrides.AddMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + i), CalculatePct(spellInfo->Effects[i].CalcValue(this), effectPct));
} }
} }
CastSpell(target, spellInfo->Id, args);
CastCustomSpell(spellInfo->Id, values, target, TRIGGERED_FULL_MASK, item);
} }
} }
} }
@@ -8060,7 +8059,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
spell->m_CastItem = item; spell->m_CastItem = item;
spell->m_cast_count = cast_count; //set count of casts spell->m_cast_count = cast_count; //set count of casts
spell->SetSpellValue(SPELLVALUE_BASE_POINT0, learning_spell_id); spell->SetSpellValue(SPELLVALUE_BASE_POINT0, learning_spell_id);
spell->prepare(&targets); spell->prepare(targets);
return; return;
} }
@@ -8088,7 +8087,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
spell->m_CastItem = item; spell->m_CastItem = item;
spell->m_cast_count = cast_count; // set count of casts spell->m_cast_count = cast_count; // set count of casts
spell->m_glyphIndex = glyphIndex; // glyph index spell->m_glyphIndex = glyphIndex; // glyph index
spell->prepare(&targets); spell->prepare(targets);
return; return;
} }
@@ -8115,7 +8114,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
spell->m_CastItem = item; spell->m_CastItem = item;
spell->m_cast_count = cast_count; // set count of casts spell->m_cast_count = cast_count; // set count of casts
spell->m_glyphIndex = glyphIndex; // glyph index spell->m_glyphIndex = glyphIndex; // glyph index
spell->prepare(&targets); spell->prepare(targets);
return; return;
} }
} }
@@ -13664,11 +13663,14 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
} }
} }
} }
CastSpellExtraArgs args(item);
// Cast custom spell vs all equal basepoints got from enchant_amount // Cast custom spell vs all equal basepoints got from enchant_amount
if (basepoints) if (basepoints)
CastCustomSpell(this, enchant_spell_id, &basepoints, &basepoints, &basepoints, true, item); for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
else args.SpellValueOverrides.AddMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), basepoints);
CastSpell(this, enchant_spell_id, true, item);
CastSpell(this, enchant_spell_id, args);
} }
else else
RemoveAurasDueToItemSpell(enchant_spell_id, item->GetGUID()); RemoveAurasDueToItemSpell(enchant_spell_id, item->GetGUID());
@@ -14291,7 +14293,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
break; break;
case GOSSIP_OPTION_SPIRITHEALER: case GOSSIP_OPTION_SPIRITHEALER:
if (isDead()) if (isDead())
source->ToCreature()->CastSpell(source->ToCreature(), 17251, true, nullptr, nullptr, GetGUID()); source->ToCreature()->CastSpell(source->ToCreature(), 17251, GetGUID());
break; break;
case GOSSIP_OPTION_QUESTGIVER: case GOSSIP_OPTION_QUESTGIVER:
PrepareQuestMenu(guid); PrepareQuestMenu(guid);
@@ -14312,8 +14314,8 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
{ {
// Cast spells that teach dual spec // Cast spells that teach dual spec
// Both are also ImplicitTarget self and must be cast by player // Both are also ImplicitTarget self and must be cast by player
CastSpell(this, 63680, true, nullptr, nullptr, GetGUID()); CastSpell(this, 63680, GetGUID());
CastSpell(this, 63624, true, nullptr, nullptr, GetGUID()); CastSpell(this, 63624, GetGUID());
PrepareGossipMenu(source, menuItemData->GossipActionMenuId); PrepareGossipMenu(source, menuItemData->GossipActionMenuId);
SendPreparedGossip(source); SendPreparedGossip(source);
@@ -23744,11 +23746,11 @@ void Player::ResurrectUsingRequestData()
if (uint32 aura = _resurrectionData->Aura) if (uint32 aura = _resurrectionData->Aura)
{ {
CastSpell(this, aura, true, nullptr, nullptr, _resurrectionData->GUID); CastSpell(this, aura, _resurrectionData->GUID);
return; return;
} }
/// Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse // Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse
TeleportTo(_resurrectionData->Location); TeleportTo(_resurrectionData->Location);
if (IsBeingTeleported()) if (IsBeingTeleported())
+40 -120
View File
@@ -958,133 +958,46 @@ void Unit::CastStop(uint32 except_spellid)
InterruptSpell(CurrentSpellTypes(i), false); InterruptSpell(CurrentSpellTypes(i), false);
} }
void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) void Unit::CastSpell(SpellCastTargets const& targets, uint32 spellId, CastSpellExtraArgs const& args)
{ {
if (!spellInfo) SpellInfo const* info = sSpellMgr->GetSpellInfo(spellId);
if (!info)
{ {
TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUID().GetCounter() : GetEntry())); TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell %u by caster %s", spellId, GetGUID().ToString().c_str());
return; return;
} }
Spell* spell = new Spell(this, spellInfo, triggerFlags, originalCaster); Spell* spell = new Spell(this, info, args.TriggerFlags, args.OriginalCaster);
for (auto const& pair : args.SpellValueOverrides)
spell->SetSpellValue(pair.first, pair.second);
if (value) spell->m_CastItem = args.CastItem;
for (CustomSpellValues::const_iterator itr = value->begin(); itr != value->end(); ++itr) spell->prepare(targets, args.TriggeringAura);
spell->SetSpellValue(itr->first, itr->second);
spell->m_CastItem = castItem;
spell->prepare(&targets, triggeredByAura);
} }
void Unit::CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) void Unit::CastSpell(WorldObject* target, uint32 spellId, CastSpellExtraArgs const& args)
{
CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags /*= TRIGGER_NONE*/, Item* castItem /*= nullptr*/, AuraEffect const* triggeredByAura /*= nullptr*/, ObjectGuid originalCaster /*= ObjectGuid::Empty*/)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUID().GetCounter() : GetEntry()));
return;
}
CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem/*= nullptr*/, AuraEffect const* triggeredByAura /*= nullptr*/, ObjectGuid originalCaster /*= ObjectGuid::Empty*/)
{
CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{ {
SpellCastTargets targets; SpellCastTargets targets;
targets.SetUnitTarget(victim); if (target)
CastSpell(targets, spellInfo, nullptr, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CustomSpellValues values;
if (bp0)
values.AddSpellMod(SPELLVALUE_BASE_POINT0, *bp0);
if (bp1)
values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1);
if (bp2)
values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2);
CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{ {
TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUID().GetCounter() : GetEntry())); if (Unit* unitTarget = target->ToUnit())
return; targets.SetUnitTarget(unitTarget);
else if (GameObject* goTarget = target->ToGameObject())
targets.SetGOTarget(goTarget);
else
{
TC_LOG_ERROR("entities.unit", "CastSpell: Invalid target %s passed to spell cast by %s", target->GetGUID().ToString().c_str(), GetGUID().ToString().c_str());
return;
}
} }
SpellCastTargets targets; CastSpell(targets, spellId, args);
targets.SetUnitTarget(victim);
CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
} }
void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) void Unit::CastSpell(Position const& dest, uint32 spellId, CastSpellExtraArgs const& args)
{ {
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUID().GetCounter() : GetEntry()));
return;
}
SpellCastTargets targets; SpellCastTargets targets;
targets.SetDst(x, y, z, GetOrientation()); targets.SetDst(dest);
CastSpell(targets, spellId, args);
CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(float x, float y, float z, uint32 spellId, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUID().GetCounter() : GetEntry()));
return;
}
SpellCastTargets targets;
targets.SetDst(x, y, z, GetOrientation());
CastSpell(targets, spellInfo, nullptr, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem, AuraEffect* triggeredByAura, ObjectGuid originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUID().GetCounter() : GetEntry()));
return;
}
SpellCastTargets targets;
targets.SetGOTarget(go);
CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
} }
void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType, bool crit) void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType, bool crit)
@@ -3133,7 +3046,7 @@ void Unit::_UpdateAutoRepeatSpell()
// we want to shoot // we want to shoot
Spell* spell = new Spell(this, autoRepeatSpellInfo, TRIGGERED_FULL_MASK); Spell* spell = new Spell(this, autoRepeatSpellInfo, TRIGGERED_FULL_MASK);
spell->prepare(&(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets)); spell->prepare(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets);
// all went good, reset attack // all went good, reset attack
resetAttackTimer(RANGED_ATTACK); resetAttackTimer(RANGED_ATTACK);
@@ -6033,7 +5946,7 @@ void Unit::ModifyAuraState(AuraStateType flag, bool apply)
if (!spellInfo || !spellInfo->IsPassive()) if (!spellInfo || !spellInfo->IsPassive())
continue; continue;
if (spellInfo->CasterAuraState == uint32(flag)) if (spellInfo->CasterAuraState == uint32(flag))
CastSpell(this, itr->first, true, nullptr); CastSpell(this, itr->first, true);
} }
} }
else if (Pet* pet = ToCreature()->ToPet()) else if (Pet* pet = ToCreature()->ToPet())
@@ -6046,7 +5959,7 @@ void Unit::ModifyAuraState(AuraStateType flag, bool apply)
if (!spellInfo || !spellInfo->IsPassive()) if (!spellInfo || !spellInfo->IsPassive())
continue; continue;
if (spellInfo->CasterAuraState == uint32(flag)) if (spellInfo->CasterAuraState == uint32(flag))
CastSpell(this, itr->first, true, nullptr); CastSpell(this, itr->first, true);
} }
} }
} }
@@ -10861,7 +10774,7 @@ void CharmInfo::InitPossessCreateSpells()
if (spellInfo) if (spellInfo)
{ {
if (spellInfo->IsPassive()) if (spellInfo->IsPassive())
_unit->CastSpell(_unit, spellInfo, true); _unit->CastSpell(_unit, spellInfo->Id, true);
else else
AddSpellToActionBar(spellInfo, ACT_PASSIVE, i % MAX_UNIT_ACTION_BAR_INDEX); AddSpellToActionBar(spellInfo, ACT_PASSIVE, i % MAX_UNIT_ACTION_BAR_INDEX);
} }
@@ -10894,7 +10807,7 @@ void CharmInfo::InitCharmCreateSpells()
if (spellInfo->IsPassive()) if (spellInfo->IsPassive())
{ {
_unit->CastSpell(_unit, spellInfo, true); _unit->CastSpell(_unit, spellInfo->Id, true);
_charmspells[x].SetActionAndType(spellId, ACT_PASSIVE); _charmspells[x].SetActionAndType(spellId, ACT_PASSIVE);
} }
else else
@@ -12125,7 +12038,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
victim->SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId); victim->SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId);
// FORM_SPIRITOFREDEMPTION and related auras // FORM_SPIRITOFREDEMPTION and related auras
victim->CastSpell(victim, 27827, true, nullptr, aurEff); victim->CastSpell(victim, 27827, aurEff);
spiritOfRedemption = true; spiritOfRedemption = true;
break; break;
} }
@@ -13656,7 +13569,12 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
} }
if (IsInMap(caster)) if (IsInMap(caster))
caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId + 1, target, flags, nullptr, nullptr, origCasterGUID); {
CastSpellExtraArgs args(flags);
args.OriginalCaster = origCasterGUID;
args.SpellValueOverrides.AddMod(SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1);
caster->CastSpell(target, itr->second.spellId, args);
}
else // This can happen during Player::_LoadAuras else // This can happen during Player::_LoadAuras
{ {
int32 bp0[MAX_SPELL_EFFECTS]; int32 bp0[MAX_SPELL_EFFECTS];
@@ -13670,7 +13588,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
else else
{ {
if (IsInMap(caster)) if (IsInMap(caster))
caster->CastSpell(target, spellEntry, flags, nullptr, nullptr, origCasterGUID); caster->CastSpell(target, spellEntry->Id, CastSpellExtraArgs().SetOriginalCaster(origCasterGUID));
else else
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID); Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID);
} }
@@ -13687,7 +13605,9 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
void Unit::EnterVehicle(Unit* base, int8 seatId) void Unit::EnterVehicle(Unit* base, int8 seatId)
{ {
CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId + 1, base, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE); CastSpellExtraArgs args(TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
args.SpellValueOverrides.AddBP0(seatId + 1);
CastSpell(base, VEHICLE_SPELL_RIDE_HARDCODED, args);
} }
void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp) void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp)
+5 -209
View File
@@ -26,6 +26,7 @@
#include "HostileRefManager.h" #include "HostileRefManager.h"
#include "OptionalFwd.h" #include "OptionalFwd.h"
#include "SpellAuraDefines.h" #include "SpellAuraDefines.h"
#include "SpellDefines.h"
#include "ThreatManager.h" #include "ThreatManager.h"
#include "Timer.h" #include "Timer.h"
#include "UnitDefines.h" #include "UnitDefines.h"
@@ -34,172 +35,6 @@
#define WORLD_TRIGGER 12999 #define WORLD_TRIGGER 12999
enum SpellInterruptFlags
{
SPELL_INTERRUPT_FLAG_MOVEMENT = 0x01, // why need this for instant?
SPELL_INTERRUPT_FLAG_PUSH_BACK = 0x02, // push back
SPELL_INTERRUPT_FLAG_UNK3 = 0x04, // any info?
SPELL_INTERRUPT_FLAG_INTERRUPT = 0x08, // interrupt
SPELL_INTERRUPT_FLAG_ABORT_ON_DMG = 0x10 // _complete_ interrupt on direct damage
//SPELL_INTERRUPT_UNK = 0x20 // unk, 564 of 727 spells having this spell start with "Glyph"
};
// See SpellAuraInterruptFlags for other values definitions
enum SpellChannelInterruptFlags
{
CHANNEL_INTERRUPT_FLAG_INTERRUPT = 0x08, // interrupt
CHANNEL_FLAG_DELAY = 0x4000
};
enum SpellAuraInterruptFlags
{
AURA_INTERRUPT_FLAG_HITBYSPELL = 0x00000001, // 0 removed when getting hit by a negative spell?
AURA_INTERRUPT_FLAG_TAKE_DAMAGE = 0x00000002, // 1 removed by any damage
AURA_INTERRUPT_FLAG_CAST = 0x00000004, // 2 cast any spells
AURA_INTERRUPT_FLAG_MOVE = 0x00000008, // 3 removed by any movement
AURA_INTERRUPT_FLAG_TURNING = 0x00000010, // 4 removed by any turning
AURA_INTERRUPT_FLAG_JUMP = 0x00000020, // 5 removed by entering combat
AURA_INTERRUPT_FLAG_NOT_MOUNTED = 0x00000040, // 6 removed by dismounting
AURA_INTERRUPT_FLAG_NOT_ABOVEWATER = 0x00000080, // 7 removed by entering water
AURA_INTERRUPT_FLAG_NOT_UNDERWATER = 0x00000100, // 8 removed by leaving water
AURA_INTERRUPT_FLAG_NOT_SHEATHED = 0x00000200, // 9 removed by unsheathing
AURA_INTERRUPT_FLAG_TALK = 0x00000400, // 10 talk to npc / loot? action on creature
AURA_INTERRUPT_FLAG_USE = 0x00000800, // 11 mine/use/open action on gameobject
AURA_INTERRUPT_FLAG_MELEE_ATTACK = 0x00001000, // 12 removed by attacking
AURA_INTERRUPT_FLAG_SPELL_ATTACK = 0x00002000, // 13 ???
AURA_INTERRUPT_FLAG_UNK14 = 0x00004000, // 14
AURA_INTERRUPT_FLAG_TRANSFORM = 0x00008000, // 15 removed by transform?
AURA_INTERRUPT_FLAG_UNK16 = 0x00010000, // 16
AURA_INTERRUPT_FLAG_MOUNT = 0x00020000, // 17 misdirect, aspect, swim speed
AURA_INTERRUPT_FLAG_NOT_SEATED = 0x00040000, // 18 removed by standing up (used by food and drink mostly and sleep/Fake Death like)
AURA_INTERRUPT_FLAG_CHANGE_MAP = 0x00080000, // 19 leaving map/getting teleported
AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION = 0x00100000, // 20 removed by auras that make you invulnerable, or make other to lose selection on you
AURA_INTERRUPT_FLAG_UNK21 = 0x00200000, // 21
AURA_INTERRUPT_FLAG_TELEPORTED = 0x00400000, // 22
AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT = 0x00800000, // 23 removed by entering pvp combat
AURA_INTERRUPT_FLAG_DIRECT_DAMAGE = 0x01000000, // 24 removed by any direct damage
AURA_INTERRUPT_FLAG_LANDING = 0x02000000, // 25 removed by hitting the ground
AURA_INTERRUPT_FLAG_LEAVE_COMBAT = 0x80000000, // 31 removed by leaving combat
AURA_INTERRUPT_FLAG_NOT_VICTIM = (AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE | AURA_INTERRUPT_FLAG_DIRECT_DAMAGE)
};
enum SpellModOp : uint8
{
SPELLMOD_DAMAGE = 0,
SPELLMOD_DURATION = 1,
SPELLMOD_THREAT = 2,
SPELLMOD_EFFECT1 = 3,
SPELLMOD_CHARGES = 4,
SPELLMOD_RANGE = 5,
SPELLMOD_RADIUS = 6,
SPELLMOD_CRITICAL_CHANCE = 7,
SPELLMOD_ALL_EFFECTS = 8,
SPELLMOD_NOT_LOSE_CASTING_TIME = 9,
SPELLMOD_CASTING_TIME = 10,
SPELLMOD_COOLDOWN = 11,
SPELLMOD_EFFECT2 = 12,
SPELLMOD_IGNORE_ARMOR = 13,
SPELLMOD_COST = 14,
SPELLMOD_CRIT_DAMAGE_BONUS = 15,
SPELLMOD_RESIST_MISS_CHANCE = 16,
SPELLMOD_JUMP_TARGETS = 17,
SPELLMOD_CHANCE_OF_SUCCESS = 18,
SPELLMOD_ACTIVATION_TIME = 19,
SPELLMOD_DAMAGE_MULTIPLIER = 20,
SPELLMOD_GLOBAL_COOLDOWN = 21,
SPELLMOD_DOT = 22,
SPELLMOD_EFFECT3 = 23,
SPELLMOD_BONUS_MULTIPLIER = 24,
// spellmod 25
SPELLMOD_PROC_PER_MINUTE = 26,
SPELLMOD_VALUE_MULTIPLIER = 27,
SPELLMOD_RESIST_DISPEL_CHANCE = 28,
SPELLMOD_CRIT_DAMAGE_BONUS_2 = 29, //one not used spell
SPELLMOD_SPELL_COST_REFUND_ON_FAIL = 30,
MAX_SPELLMOD
};
enum SpellValueMod : uint8
{
SPELLVALUE_BASE_POINT0,
SPELLVALUE_BASE_POINT1,
SPELLVALUE_BASE_POINT2,
SPELLVALUE_RADIUS_MOD,
SPELLVALUE_MAX_TARGETS,
SPELLVALUE_AURA_STACK
};
class CustomSpellValues
{
typedef std::pair<SpellValueMod, int32> CustomSpellValueMod;
typedef std::vector<CustomSpellValueMod> StorageType;
public:
typedef StorageType::const_iterator const_iterator;
public:
void AddSpellMod(SpellValueMod mod, int32 value)
{
storage_.push_back(CustomSpellValueMod(mod, value));
}
const_iterator begin() const
{
return storage_.begin();
}
const_iterator end() const
{
return storage_.end();
}
private:
StorageType storage_;
};
enum SpellFacingFlags
{
SPELL_FACING_FLAG_INFRONT = 0x0001
};
// high byte (3 from 0..3) of UNIT_FIELD_BYTES_2
enum ShapeshiftForm
{
FORM_NONE = 0x00,
FORM_CAT = 0x01,
FORM_TREE = 0x02,
FORM_TRAVEL = 0x03,
FORM_AQUA = 0x04,
FORM_BEAR = 0x05,
FORM_AMBIENT = 0x06,
FORM_GHOUL = 0x07,
FORM_DIREBEAR = 0x08,
FORM_STEVES_GHOUL = 0x09,
FORM_THARONJA_SKELETON = 0x0A,
FORM_TEST_OF_STRENGTH = 0x0B,
FORM_BLB_PLAYER = 0x0C,
FORM_SHADOW_DANCE = 0x0D,
FORM_CREATUREBEAR = 0x0E,
FORM_CREATURECAT = 0x0F,
FORM_GHOSTWOLF = 0x10,
FORM_BATTLESTANCE = 0x11,
FORM_DEFENSIVESTANCE = 0x12,
FORM_BERSERKERSTANCE = 0x13,
FORM_TEST = 0x14,
FORM_ZOMBIE = 0x15,
FORM_METAMORPHOSIS = 0x16,
FORM_UNDEAD = 0x19,
FORM_MASTER_ANGLER = 0x1A,
FORM_FLIGHT_EPIC = 0x1B,
FORM_SHADOW = 0x1C,
FORM_FLIGHT = 0x1D,
FORM_STEALTH = 0x1E,
FORM_MOONKIN = 0x1F,
FORM_SPIRITOFREDEMPTION = 0x20
};
#define MAX_SPELL_CHARM 4 #define MAX_SPELL_CHARM 4
#define MAX_SPELL_VEHICLE 6 #define MAX_SPELL_VEHICLE 6
#define MAX_SPELL_POSSESS 8 #define MAX_SPELL_POSSESS 8
@@ -310,35 +145,6 @@ enum WeaponDamageRange
MAXDAMAGE MAXDAMAGE
}; };
enum TriggerCastFlags : uint32
{
TRIGGERED_NONE = 0x00000000, //! Not triggered
TRIGGERED_IGNORE_GCD = 0x00000001, //! Will ignore GCD
TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD = 0x00000002, //! Will ignore Spell and Category cooldowns
TRIGGERED_IGNORE_POWER_AND_REAGENT_COST = 0x00000004, //! Will ignore power and reagent cost
TRIGGERED_IGNORE_CAST_ITEM = 0x00000008, //! Will not take away cast item or update related achievement criteria
TRIGGERED_IGNORE_AURA_SCALING = 0x00000010, //! Will ignore aura scaling
TRIGGERED_IGNORE_CAST_IN_PROGRESS = 0x00000020, //! Will not check if a current cast is in progress
TRIGGERED_IGNORE_COMBO_POINTS = 0x00000040, //! Will ignore combo point requirement
TRIGGERED_CAST_DIRECTLY = 0x00000080, //! In Spell::prepare, will be cast directly without setting containers for executed spell
TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS = 0x00000100, //! Will ignore interruptible aura's at cast
TRIGGERED_IGNORE_SET_FACING = 0x00000200, //! Will not adjust facing to target (if any)
TRIGGERED_IGNORE_SHAPESHIFT = 0x00000400, //! Will ignore shapeshift checks
TRIGGERED_IGNORE_CASTER_AURASTATE = 0x00000800, //! Will ignore caster aura states including combat requirements and death state
TRIGGERED_DISALLOW_PROC_EVENTS = 0x00001000, //! Disallows proc events from triggered spell (default)
TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE = 0x00002000, //! Will ignore mounted/on vehicle restrictions
// reuse = 0x00004000,
// reuse = 0x00008000,
TRIGGERED_IGNORE_CASTER_AURAS = 0x00010000, //! Will ignore caster aura restrictions or requirements
TRIGGERED_DONT_RESET_PERIODIC_TIMER = 0x00020000, //! Will allow periodic aura timers to keep ticking (instead of resetting)
TRIGGERED_DONT_REPORT_CAST_ERROR = 0x00040000, //! Will return SPELL_FAILED_DONT_REPORT in CheckCast functions
TRIGGERED_FULL_MASK = 0x0007FFFF, //! Used when doing CastSpell with triggered == true
// debug flags (used with .cast triggered commands)
TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT = 0x00080000, //! Will ignore equipped item requirements
TRIGGERED_FULL_DEBUG_MASK = 0xFFFFFFFF
};
enum UnitMods enum UnitMods
{ {
UNIT_MOD_STAT_STRENGTH, // UNIT_MOD_STAT_STRENGTH..UNIT_MOD_STAT_SPIRIT must be in existed order, it's accessed by index values of Stats enum. UNIT_MOD_STAT_STRENGTH, // UNIT_MOD_STAT_STRENGTH..UNIT_MOD_STAT_SPIRIT must be in existed order, it's accessed by index values of Stats enum.
@@ -1278,20 +1084,10 @@ class TC_GAME_API Unit : public WorldObject
void EnergizeBySpell(Unit* victim, uint32 spellId, int32 damage, Powers powerType); void EnergizeBySpell(Unit* victim, uint32 spellId, int32 damage, Powers powerType);
void EnergizeBySpell(Unit* victim, SpellInfo const* spellInfo, int32 damage, Powers powerType); void EnergizeBySpell(Unit* victim, SpellInfo const* spellInfo, int32 damage, Powers powerType);
void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); // CastSpell's third arg can be a variety of things - check out CastSpellExtraArgs' constructors!
void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); void CastSpell(SpellCastTargets const& targets, uint32 spellId, CastSpellExtraArgs const& args = {});
void CastSpell(std::nullptr_t, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty) { CastSpell((Unit*)nullptr, spellId, triggered, castItem, triggeredByAura, originalCaster); } void CastSpell(WorldObject* target, uint32 spellId, CastSpellExtraArgs const& args = {});
void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); void CastSpell(Position const& dest, uint32 spellId, CastSpellExtraArgs const& args = {});
void CastSpell(std::nullptr_t, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty) { CastSpell((Unit*)nullptr, spellId, triggerFlags, castItem, triggeredByAura, originalCaster); }
void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(float x, float y, float z, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = nullptr, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim = nullptr, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
Aura* AddAura(uint32 spellId, Unit* target); Aura* AddAura(uint32 spellId, Unit* target);
Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target); Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target);
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack); void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
@@ -854,8 +854,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
{ {
// not blizz like, we must correctly save and load player instead... // not blizz like, we must correctly save and load player instead...
if (pCurrChar->getRace() == RACE_NIGHTELF) if (pCurrChar->getRace() == RACE_NIGHTELF)
pCurrChar->CastSpell(pCurrChar, 20584, true, nullptr);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form) pCurrChar->CastSpell(pCurrChar, 20584, true);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
pCurrChar->CastSpell(pCurrChar, 8326, true, nullptr); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) pCurrChar->CastSpell(pCurrChar, 8326, true); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
pCurrChar->SetMovement(MOVE_WATER_WALK); pCurrChar->SetMovement(MOVE_WATER_WALK);
} }
+2 -2
View File
@@ -382,7 +382,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
} }
} }
spell->prepare(&(spell->m_targets)); spell->prepare(spell->m_targets);
} }
else else
{ {
@@ -812,7 +812,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
} }
} }
spell->prepare(&(spell->m_targets)); spell->prepare(spell->m_targets);
} }
else else
{ {
+3 -6
View File
@@ -409,7 +409,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, ObjectGuid::Empty, false); Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, ObjectGuid::Empty, false);
spell->m_cast_count = castCount; // set count of casts spell->m_cast_count = castCount; // set count of casts
spell->prepare(&targets); spell->prepare(targets);
} }
void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket) void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket)
@@ -562,12 +562,9 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recvData*/)
if (_player->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) if (_player->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
return; // silent return, client should display error by itself and not send this opcode return; // silent return, client should display error by itself and not send this opcode
if (_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)) if (uint32 spellId = _player->GetUInt32Value(PLAYER_SELF_RES_SPELL))
{ {
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)); _player->CastSpell(_player, spellId);
if (spellInfo)
_player->CastSpell(_player, spellInfo, false, nullptr);
_player->SetUInt32Value(PLAYER_SELF_RES_SPELL, 0); _player->SetUInt32Value(PLAYER_SELF_RES_SPELL, 0);
} }
} }
+2 -2
View File
@@ -521,10 +521,10 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
trader->ModifyMoney(my_trade->GetMoney()); trader->ModifyMoney(my_trade->GetMoney());
if (my_spell) if (my_spell)
my_spell->prepare(&my_targets); my_spell->prepare(my_targets);
if (his_spell) if (his_spell)
his_spell->prepare(&his_targets); his_spell->prepare(his_targets);
// cleanup // cleanup
clearAcceptTradeMode(my_trade, his_trade); clearAcceptTradeMode(my_trade, his_trade);
@@ -398,4 +398,40 @@ enum AuraObjectType
DYNOBJ_AURA_TYPE DYNOBJ_AURA_TYPE
}; };
// high byte (3 from 0..3) of UNIT_FIELD_BYTES_2
enum ShapeshiftForm
{
FORM_NONE = 0x00,
FORM_CAT = 0x01,
FORM_TREE = 0x02,
FORM_TRAVEL = 0x03,
FORM_AQUA = 0x04,
FORM_BEAR = 0x05,
FORM_AMBIENT = 0x06,
FORM_GHOUL = 0x07,
FORM_DIREBEAR = 0x08,
FORM_STEVES_GHOUL = 0x09,
FORM_THARONJA_SKELETON = 0x0A,
FORM_TEST_OF_STRENGTH = 0x0B,
FORM_BLB_PLAYER = 0x0C,
FORM_SHADOW_DANCE = 0x0D,
FORM_CREATUREBEAR = 0x0E,
FORM_CREATURECAT = 0x0F,
FORM_GHOSTWOLF = 0x10,
FORM_BATTLESTANCE = 0x11,
FORM_DEFENSIVESTANCE = 0x12,
FORM_BERSERKERSTANCE = 0x13,
FORM_TEST = 0x14,
FORM_ZOMBIE = 0x15,
FORM_METAMORPHOSIS = 0x16,
FORM_UNDEAD = 0x19,
FORM_MASTER_ANGLER = 0x1A,
FORM_FLIGHT_EPIC = 0x1B,
FORM_SHADOW = 0x1C,
FORM_FLIGHT = 0x1D,
FORM_STEALTH = 0x1E,
FORM_MOONKIN = 0x1F,
FORM_SPIRITOFREDEMPTION = 0x20
};
#endif #endif
@@ -1100,10 +1100,10 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
if (apply) if (apply)
{ {
if (spellId) if (spellId)
target->CastSpell(target, spellId, true, nullptr, this); target->CastSpell(target, spellId, this);
if (spellId2) if (spellId2)
target->CastSpell(target, spellId2, true, nullptr, this); target->CastSpell(target, spellId2, this);
if (target->GetTypeId() == TYPEID_PLAYER) if (target->GetTypeId() == TYPEID_PLAYER)
{ {
@@ -1121,7 +1121,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
continue; continue;
if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1))) if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
target->CastSpell(target, itr->first, true, nullptr, this); target->CastSpell(target, itr->first, this);
} }
// Also do it for Glyphs // Also do it for Glyphs
@@ -1136,7 +1136,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
continue; continue;
if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1))) if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
target->CastSpell(target, glyph->SpellId, true, nullptr, this); target->CastSpell(target, glyph->SpellId, this);
} }
} }
} }
@@ -1146,7 +1146,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
{ {
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932);
if (spellInfo && spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1))) if (spellInfo && spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
target->CastSpell(target, 24932, true, nullptr, this); target->CastSpell(target, 24932, this);
} }
// Improved Barkskin - apply/remove armor bonus due to shapeshift // Improved Barkskin - apply/remove armor bonus due to shapeshift
if (target->ToPlayer()->HasSpell(63410) || target->ToPlayer()->HasSpell(63411)) if (target->ToPlayer()->HasSpell(63410) || target->ToPlayer()->HasSpell(63411))
@@ -1164,9 +1164,10 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
// Heart of the Wild // Heart of the Wild
if (aurEff->GetSpellInfo()->SpellIconID == 240 && aurEff->GetMiscValue() == 3) if (aurEff->GetSpellInfo()->SpellIconID == 240 && aurEff->GetMiscValue() == 3)
{ {
int32 HotWMod = aurEff->GetAmount() / 2; // For each 2% Intelligence, you get 1% stamina and 1% attack power. CastSpellExtraArgs args(this);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount() / 2); // For each 2% Intelligence, you get 1% stamina and 1% attack power.
target->CastCustomSpell(HotWSpellId, SPELLVALUE_BASE_POINT0, HotWMod, target, true, nullptr, this); target->CastSpell(target, HotWSpellId, args);
break; break;
} }
} }
@@ -1190,46 +1191,51 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
spellId3 = 47180; spellId3 = 47180;
break; break;
} }
target->CastSpell(target, spellId3, true, nullptr, this); target->CastSpell(target, spellId3, this);
} }
// Master Shapeshifter - Cat // Master Shapeshifter - Cat
if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
{ {
int32 bp = aurEff->GetAmount(); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
target->CastCustomSpell(48420, SPELLVALUE_BASE_POINT0, bp, target, true); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
target->CastSpell(target, 48420, args);
} }
break; break;
case FORM_DIREBEAR: case FORM_DIREBEAR:
case FORM_BEAR: case FORM_BEAR:
// Master Shapeshifter - Bear // Master Shapeshifter - Bear
if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
{ {
int32 bp = aurEff->GetAmount(); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
target->CastCustomSpell(48418, SPELLVALUE_BASE_POINT0, bp, target, true); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
target->CastSpell(target, 48418, args);
} }
// Survival of the Fittest // Survival of the Fittest
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DRUID, 961, 0)) if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DRUID, 961, 0))
{ {
int32 bp = aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue(); CastSpellExtraArgs args(this);
target->CastCustomSpell(62069, SPELLVALUE_BASE_POINT0, bp, target, true, nullptr, this); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
target->CastSpell(target, 62069, args);
} }
break; break;
case FORM_MOONKIN: case FORM_MOONKIN:
// Master Shapeshifter - Moonkin // Master Shapeshifter - Moonkin
if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
{ {
int32 bp = aurEff->GetAmount(); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
target->CastCustomSpell(48421, SPELLVALUE_BASE_POINT0, bp, target, true); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
target->CastSpell(target, 48421, args);
} }
break; break;
// Master Shapeshifter - Tree of Life
case FORM_TREE: case FORM_TREE:
// Master Shapeshifter - Tree of Life
if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
{ {
int32 bp = aurEff->GetAmount(); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
target->CastCustomSpell(48422, SPELLVALUE_BASE_POINT0, bp, target, true); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
target->CastSpell(target, 48422, args);
} }
break; break;
} }
} }
} }
@@ -1705,9 +1711,10 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
{ {
case FORM_CAT: case FORM_CAT:
{ {
int32 basePoints = int32(std::min(oldPower, FurorChance)); CastSpellExtraArgs args(this);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, std::min(oldPower, FurorChance));
target->SetPower(POWER_ENERGY, 0); target->SetPower(POWER_ENERGY, 0);
target->CastCustomSpell(target, 17099, &basePoints, nullptr, nullptr, true, nullptr, this); target->CastSpell(target, 17099, args);
break; break;
} }
case FORM_BEAR: case FORM_BEAR:
@@ -1770,12 +1777,12 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
case FORM_DIREBEAR: case FORM_DIREBEAR:
case FORM_CAT: case FORM_CAT:
if (AuraEffect* dummy = target->GetAuraEffect(37315, 0)) if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
target->CastSpell(target, 37316, true, nullptr, dummy); target->CastSpell(target, 37316, dummy);
break; break;
// Nordrassil Regalia - bonus // Nordrassil Regalia - bonus
case FORM_MOONKIN: case FORM_MOONKIN:
if (AuraEffect* dummy = target->GetAuraEffect(37324, 0)) if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
target->CastSpell(target, 37325, true, nullptr, dummy); target->CastSpell(target, 37325, dummy);
break; break;
case FORM_BATTLESTANCE: case FORM_BATTLESTANCE:
case FORM_DEFENSIVESTANCE: case FORM_DEFENSIVESTANCE:
@@ -4304,7 +4311,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
case 13139: // net-o-matic case 13139: // net-o-matic
// root to self part of (root_target->charge->root_self sequence // root to self part of (root_target->charge->root_self sequence
if (caster) if (caster)
caster->CastSpell(caster, 13138, true, nullptr, this); caster->CastSpell(caster, 13138, this);
break; break;
case 34026: // kill command case 34026: // kill command
{ {
@@ -4312,7 +4319,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (!pet) if (!pet)
break; break;
target->CastSpell(target, 34027, true, nullptr, this); target->CastSpell(target, 34027, this);
// set 3 stacks and 3 charges (to make all auras not disappear at once) // set 3 stacks and 3 charges (to make all auras not disappear at once)
Aura* owner_aura = target->GetAura(34027, GetCasterGUID()); Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
@@ -4333,15 +4340,15 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (caster) if (caster)
{ {
if (caster->getGender() == GENDER_FEMALE) if (caster->getGender() == GENDER_FEMALE)
caster->CastSpell(target, 37095, true, nullptr, this); // Blood Elf Disguise caster->CastSpell(target, 37095, this); // Blood Elf Disguise
else else
caster->CastSpell(target, 37093, true, nullptr, this); caster->CastSpell(target, 37093, this);
} }
break; break;
} }
case 55198: // Tidal Force case 55198: // Tidal Force
{ {
target->CastSpell(target, 55166, true, nullptr, this); target->CastSpell(target, 55166, this);
// set 3 stacks and 3 charges (to make all auras not disappear at once) // set 3 stacks and 3 charges (to make all auras not disappear at once)
Aura* owner_aura = target->GetAura(55166, GetCasterGUID()); Aura* owner_aura = target->GetAura(55166, GetCasterGUID());
if (owner_aura) if (owner_aura)
@@ -4357,7 +4364,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
} }
case 39850: // Rocket Blast case 39850: // Rocket Blast
if (roll_chance_i(20)) // backfire stun if (roll_chance_i(20)) // backfire stun
target->CastSpell(target, 51581, true, nullptr, this); target->CastSpell(target, 51581, this);
break; break;
case 43873: // Headless Horseman Laugh case 43873: // Headless Horseman Laugh
target->PlayDistanceSound(11965); target->PlayDistanceSound(11965);
@@ -4366,9 +4373,9 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (caster) if (caster)
{ {
if (caster->getGender() == GENDER_FEMALE) if (caster->getGender() == GENDER_FEMALE)
caster->CastSpell(target, 46356, true, nullptr, this); caster->CastSpell(target, 46356, this);
else else
caster->CastSpell(target, 46355, true, nullptr, this); caster->CastSpell(target, 46355, this);
} }
break; break;
case 46361: // Reinforced Net case 46361: // Reinforced Net
@@ -4410,7 +4417,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
} }
if (finalSpelId) if (finalSpelId)
caster->CastSpell(target, finalSpelId, true, nullptr, this); caster->CastSpell(target, finalSpelId, this);
} }
switch (m_spellInfo->SpellFamilyName) switch (m_spellInfo->SpellFamilyName)
@@ -4430,7 +4437,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break; break;
case 36730: // Flame Strike case 36730: // Flame Strike
{ {
target->CastSpell(target, 36731, true, nullptr, this); target->CastSpell(target, 36731, this);
break; break;
} }
case 44191: // Flame Strike case 44191: // Flame Strike
@@ -4439,7 +4446,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
{ {
uint32 spellId = target->GetMap()->IsHeroic() ? 46163 : 44190; uint32 spellId = target->GetMap()->IsHeroic() ? 46163 : 44190;
target->CastSpell(target, spellId, true, nullptr, this); target->CastSpell(target, spellId, this);
} }
break; break;
} }
@@ -4453,14 +4460,14 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break; break;
} }
case 42783: // Wrath of the Astromancer case 42783: // Wrath of the Astromancer
target->CastSpell(target, GetAmount(), true, nullptr, this); target->CastSpell(target, GetAmount(), this);
break; break;
case 46308: // Burning Winds cast only at creatures at spawn case 46308: // Burning Winds cast only at creatures at spawn
target->CastSpell(target, 47287, true, nullptr, this); target->CastSpell(target, 47287, this);
break; break;
case 52172: // Coyote Spirit Despawn Aura case 52172: // Coyote Spirit Despawn Aura
case 60244: // Blood Parrot Despawn Aura case 60244: // Blood Parrot Despawn Aura
target->CastSpell(nullptr, GetAmount(), true, nullptr, this); target->CastSpell(nullptr, GetAmount(), this);
break; break;
case 58600: // Restricted Flight Area case 58600: // Restricted Flight Area
case 58730: // Restricted Flight Area case 58730: // Restricted Flight Area
@@ -4503,7 +4510,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId); SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
for (uint32 i = 0; i < spell->StackAmount; ++i) for (uint32 i = 0; i < spell->StackAmount; ++i)
caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID()); caster->CastSpell(target, spell->Id, GetCasterGUID());
break; break;
} }
target->RemoveAurasDueToSpell(spellId); target->RemoveAurasDueToSpell(spellId);
@@ -4517,7 +4524,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
{ {
SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId); SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
for (uint32 i = 0; i < spell->StackAmount; ++i) for (uint32 i = 0; i < spell->StackAmount; ++i)
caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID()); caster->CastSpell(target, spell->Id, GetCasterGUID());
break; break;
} }
target->RemoveAurasDueToSpell(spellId); target->RemoveAurasDueToSpell(spellId);
@@ -4678,7 +4685,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
// Glyph of Drain Soul - chance to create an additional Soul Shard // Glyph of Drain Soul - chance to create an additional Soul Shard
if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
if (roll_chance_i(aur->GetMiscValue())) if (roll_chance_i(aur->GetMiscValue()))
caster->CastSpell(caster, 58068, true, nullptr, aur); // We _could_ simply do ++count here, but Blizz does it this way :) caster->CastSpell(caster, 58068, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
} }
} }
@@ -4848,11 +4855,13 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo
if (!caster) if (!caster)
return; return;
// If amount avalible cast with basepoints (Crypt Fever for example)
if (GetAmount()) CastSpellExtraArgs args(this);
caster->CastCustomSpell(target, triggeredSpellId, &m_amount, nullptr, nullptr, true, nullptr, this);
else if (GetAmount()) // If amount avalible cast with basepoints (Crypt Fever for example)
caster->CastSpell(target, triggeredSpellId, true, nullptr, this); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, GetAmount());
caster->CastSpell(target, triggeredSpellId, args);
} }
else else
{ {
@@ -5006,12 +5015,12 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
{ {
if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target) if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
{ {
triggerCaster->CastSpell(target, triggeredSpellInfo, true, nullptr, this); triggerCaster->CastSpell(target, triggerSpellId, this);
TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id);
} }
} }
else else
TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); TC_LOG_WARN("spells", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
} }
void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* caster) const void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* caster) const
@@ -5021,13 +5030,15 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit*
{ {
if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target) if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
{ {
int32 basepoints = GetAmount(); CastSpellExtraArgs args(this);
triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints, &basepoints, &basepoints, true, nullptr, this); for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
args.SpellValueOverrides.AddMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), GetAmount());
triggerCaster->CastSpell(target, triggerSpellId, args);
TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id);
} }
} }
else else
TC_LOG_DEBUG("spells","AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); TC_LOG_WARN("spells","AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
} }
void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
@@ -5095,11 +5106,11 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{ {
if (roll_chance_i(20)) if (roll_chance_i(20))
{ {
caster->CastSpell(caster, 43836, true, nullptr, this); caster->CastSpell(caster, 43836, this);
// Glyph of Drain Soul - chance to create an additional Soul Shard // Glyph of Drain Soul - chance to create an additional Soul Shard
if (AuraEffect* aur = caster->GetAuraEffect(58070, 0)) if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
if (roll_chance_i(aur->GetMiscValue())) if (roll_chance_i(aur->GetMiscValue()))
caster->CastSpell(caster, 58068, true, nullptr, aur); caster->CastSpell(caster, 58068, aur);
} }
} }
} }
@@ -5501,7 +5512,10 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
if (manaFeedVal > 0) if (manaFeedVal > 0)
{ {
int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal); int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
caster->CastCustomSpell(caster, 32554, &feedAmount, nullptr, nullptr, true, nullptr, this);
CastSpellExtraArgs args(this);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, feedAmount);
caster->CastSpell(caster, 32554, args);
} }
} }
} }
@@ -5655,7 +5669,7 @@ void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEve
if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId)) if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
{ {
TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId()); TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId());
triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this); triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo->Id, this);
} }
else else
TC_LOG_ERROR("spells","AuraEffect::HandleProcTriggerSpellAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); TC_LOG_ERROR("spells","AuraEffect::HandleProcTriggerSpellAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId());
@@ -5669,9 +5683,10 @@ void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp
uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell; uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId)) if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
{ {
int32 basepoints0 = GetAmount(); CastSpellExtraArgs args(this);
TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId()); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, GetAmount());
triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, nullptr, nullptr, true, nullptr, this); triggerCaster->CastSpell(triggerTarget, triggerSpellId, args);
TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, GetAmount(), GetId());
} }
else else
TC_LOG_ERROR("spells","AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); TC_LOG_ERROR("spells","AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId());
@@ -5737,7 +5752,7 @@ void AuraEffect::HandleRaidProcFromChargeAuraProc(AuraApplication* aurApp, ProcE
if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius)) if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
{ {
target->CastSpell(triggerTarget, GetSpellInfo(), true, nullptr, this, GetCasterGUID()); target->CastSpell(triggerTarget, GetId(), { this, GetCasterGUID() });
if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID())) if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
aura->SetCharges(jumps); aura->SetCharges(jumps);
} }
@@ -5745,7 +5760,7 @@ void AuraEffect::HandleRaidProcFromChargeAuraProc(AuraApplication* aurApp, ProcE
} }
TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId());
target->CastSpell(target, triggerSpellId, true, nullptr, this, GetCasterGUID()); target->CastSpell(target, triggerSpellId, { this, GetCasterGUID() });
} }
@@ -5761,14 +5776,16 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA
} }
uint32 triggerSpellId = 33110; uint32 triggerSpellId = 33110;
int32 value = GetAmount();
int32 jumps = GetBase()->GetCharges(); int32 jumps = GetBase()->GetCharges();
// current aura expire on proc finish // current aura expire on proc finish
GetBase()->SetCharges(0); GetBase()->SetCharges(0);
GetBase()->SetUsingCharges(true); GetBase()->SetUsingCharges(true);
CastSpellExtraArgs args(this);
args.OriginalCaster = GetCasterGUID();
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, GetAmount());
// next target selection // next target selection
if (jumps > 0) if (jumps > 0)
{ {
@@ -5778,7 +5795,7 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA
if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius)) if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
{ {
target->CastCustomSpell(triggerTarget, GetId(), &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID()); target->CastSpell(triggerTarget, GetId(), args);
if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID())) if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
aura->SetCharges(jumps); aura->SetCharges(jumps);
} }
@@ -5786,7 +5803,7 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA
} }
TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId());
target->CastCustomSpell(target, triggerSpellId, &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID()); target->CastSpell(target, triggerSpellId, args);
} }
template TC_GAME_API void AuraEffect::GetTargetList(std::list<Unit*>&) const; template TC_GAME_API void AuraEffect::GetTargetList(std::list<Unit*>&) const;
+32 -18
View File
@@ -1183,7 +1183,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (*itr < 0) if (*itr < 0)
target->RemoveAurasDueToSpell(-(*itr)); target->RemoveAurasDueToSpell(-(*itr));
else if (removeMode != AURA_REMOVE_BY_DEATH) else if (removeMode != AURA_REMOVE_BY_DEATH)
target->CastSpell(target, *itr, true, nullptr, nullptr, GetCasterGUID()); target->CastSpell(target, *itr, GetCasterGUID());
} }
} }
if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA)) if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
@@ -1245,8 +1245,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Druid T8 Restoration 4P Bonus // Druid T8 Restoration 4P Bonus
if (caster->HasAura(64760)) if (caster->HasAura(64760))
{ {
int32 heal = GetEffect(EFFECT_0)->GetAmount(); CastSpellExtraArgs args(GetEffect(EFFECT_0));
caster->CastCustomSpell(target, 64801, &heal, nullptr, nullptr, true, nullptr, GetEffect(EFFECT_0)); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, GetEffect(EFFECT_0)->GetAmount());
caster->CastSpell(target, 64801, args);
} }
} }
break; break;
@@ -1281,9 +1282,13 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
switch (GetId()) switch (GetId())
{ {
case 44544: // Fingers of Frost case 44544: // Fingers of Frost
{
// Refresh or add visual aura // Refresh or add visual aura
target->CastCustomSpell(74396, SPELLVALUE_AURA_STACK, sSpellMgr->AssertSpellInfo(74396)->StackAmount, (Unit*)nullptr, true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, sSpellMgr->AssertSpellInfo(74396)->StackAmount);
target->CastSpell(nullptr, 74396, args);
break; break;
}
default: default:
break; break;
} }
@@ -1308,10 +1313,12 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT); damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
CastSpellExtraArgs args(devouringPlague), args2(devouringPlague);
int32 basepoints0 = CalculatePct(devouringPlague->GetTotalTicks() * static_cast<int32>(damage), aurEff->GetAmount()); int32 basepoints0 = CalculatePct(devouringPlague->GetTotalTicks() * static_cast<int32>(damage), aurEff->GetAmount());
int32 heal = CalculatePct(basepoints0, 15); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, basepoints0);
caster->CastCustomSpell(63675, SPELLVALUE_BASE_POINT0, basepoints0, target, true, nullptr, devouringPlague); args2.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, CalculatePct(basepoints0, 15));
caster->CastCustomSpell(75999, SPELLVALUE_BASE_POINT0, heal, (Unit*)nullptr, true, nullptr, devouringPlague); caster->CastSpell(target, 63675, args);
caster->CastSpell(nullptr, 75999, args2);
} }
} }
// Power Word: Shield // Power Word: Shield
@@ -1322,7 +1329,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
{ {
// instantly heal m_amount% of the absorb-value // instantly heal m_amount% of the absorb-value
int32 heal = glyph->GetAmount() * GetEffect(0)->GetAmount()/100; int32 heal = glyph->GetAmount() * GetEffect(0)->GetAmount()/100;
caster->CastCustomSpell(GetUnitOwner(), 56160, &heal, nullptr, nullptr, true, nullptr, GetEffect(0)); CastSpellExtraArgs args(GetEffect(0));
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, heal);
caster->CastSpell(GetUnitOwner(), 56160, args);
} }
} }
break; break;
@@ -1372,7 +1381,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
default: default:
TC_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId()); TC_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId());
} }
caster->CastSpell(target, spellId, true, 0, GetEffect(0)); caster->CastSpell(target, spellId, GetEffect(0));
} }
} }
break; break;
@@ -1401,7 +1410,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case 66: // Invisibility case 66: // Invisibility
if (removeMode != AURA_REMOVE_BY_EXPIRE) if (removeMode != AURA_REMOVE_BY_EXPIRE)
break; break;
target->CastSpell(target, 32612, true, nullptr, GetEffect(1)); target->CastSpell(target, 32612, GetEffect(1));
target->CombatStop(); target->CombatStop();
break; break;
default: default:
@@ -1462,7 +1471,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 178, 1)) if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 178, 1))
{ {
int32 basepoints0 = aurEff->GetAmount() * caster->GetCreateMana() / 100; int32 basepoints0 = aurEff->GetAmount() * caster->GetCreateMana() / 100;
caster->CastCustomSpell(caster, 64103, &basepoints0, nullptr, nullptr, true, nullptr, GetEffect(0)); CastSpellExtraArgs args(GetEffect(0));
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, basepoints0);
caster->CastSpell(caster, 64103, args);
} }
} }
// Power word: shield // Power word: shield
@@ -1494,8 +1505,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
else if (aurEff->GetId() == 47537) else if (aurEff->GetId() == 47537)
multiplier += 0.5f; multiplier += 0.5f;
int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier)); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
caster->CastCustomSpell(caster, 47755, &basepoints0, nullptr, nullptr, true); args.SpellValueOverrides.AddBP0(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
caster->CastSpell(caster, 47755, args);
} }
// effect on aura target // effect on aura target
if (AuraEffect const* aurEff = aura->GetEffect(1)) if (AuraEffect const* aurEff = aura->GetEffect(1))
@@ -1508,8 +1520,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
{ {
case POWER_MANA: case POWER_MANA:
{ {
int32 basepoints0 = int32(CalculatePct(target->GetMaxPower(POWER_MANA), 2)); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
caster->CastCustomSpell(target, 63654, &basepoints0, nullptr, nullptr, true); args.SpellValueOverrides.AddBP0(CalculatePct(target->GetMaxPower(POWER_MANA), 2));
caster->CastSpell(target, 63654, args);
break; break;
} }
case POWER_RAGE: triggeredSpellId = 63653; break; case POWER_RAGE: triggeredSpellId = 63653; break;
@@ -1601,8 +1614,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Remove counter aura // Remove counter aura
target->RemoveAurasDueToSpell(31666); target->RemoveAurasDueToSpell(31666);
int32 basepoints0 = aurEff->GetAmount(); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
target->CastCustomSpell(target, 31665, &basepoints0, nullptr, nullptr, true); args.SpellValueOverrides.AddBP0(aurEff->GetAmount());
target->CastSpell(target, 31665, args);
} }
} }
// Overkill // Overkill
@@ -1632,7 +1646,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (owner->HasAura(34692)) if (owner->HasAura(34692))
{ {
if (apply) if (apply)
owner->CastSpell(owner, 34471, true, 0, GetEffect(0)); owner->CastSpell(owner, 34471, GetEffect(0));
else else
owner->RemoveAurasDueToSpell(34471); owner->RemoveAurasDueToSpell(34471);
} }
+5 -5
View File
@@ -2740,7 +2740,7 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask)
{ {
if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance)) if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance))
{ {
m_caster->CastSpell(unit, i->triggeredSpell, true); m_caster->CastSpell(unit, i->triggeredSpell->Id, true);
TC_LOG_DEBUG("spells", "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id); TC_LOG_DEBUG("spells", "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id);
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
@@ -2771,7 +2771,7 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask)
if (*i < 0) if (*i < 0)
unit->RemoveAurasDueToSpell(-(*i)); unit->RemoveAurasDueToSpell(-(*i));
else else
unit->CastSpell(unit, *i, true, nullptr, nullptr, m_caster->GetGUID()); unit->CastSpell(unit, *i, m_caster->GetGUID());
} }
} }
} }
@@ -2882,7 +2882,7 @@ bool Spell::UpdateChanneledTargetList()
return channelTargetEffectMask == 0; return channelTargetEffectMask == 0;
} }
void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura) void Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggeredByAura)
{ {
if (m_CastItem) if (m_CastItem)
{ {
@@ -2895,7 +2895,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
m_castItemEntry = 0; m_castItemEntry = 0;
} }
InitExplicitTargets(*targets); InitExplicitTargets(targets);
// Fill aura scaling information // Fill aura scaling information
if (m_caster->IsControlledByPlayer() && !m_spellInfo->IsPassive() && m_spellInfo->SpellLevel && !m_spellInfo->IsChanneled() && !(_triggeredCastFlags & TRIGGERED_IGNORE_AURA_SCALING)) if (m_caster->IsControlledByPlayer() && !m_spellInfo->IsPassive() && m_spellInfo->SpellLevel && !m_spellInfo->IsChanneled() && !(_triggeredCastFlags & TRIGGERED_IGNORE_AURA_SCALING))
@@ -5495,7 +5495,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
{ {
if (strict) //starting cast, trigger pet stun (cast by pet so it doesn't attack player) if (strict) //starting cast, trigger pet stun (cast by pet so it doesn't attack player)
if (Pet* pet = m_caster->ToPlayer()->GetPet()) if (Pet* pet = m_caster->ToPlayer()->GetPet())
pet->CastSpell(pet, 32752, true, nullptr, nullptr, pet->GetGUID()); pet->CastSpell(pet, 32752, pet->GetGUID());
} }
else if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET)) else if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET))
return SPELL_FAILED_ALREADY_HAVE_SUMMON; return SPELL_FAILED_ALREADY_HAVE_SUMMON;
+1 -1
View File
@@ -405,7 +405,7 @@ class TC_GAME_API Spell
GameObject* SearchSpellFocus(); GameObject* SearchSpellFocus();
void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = nullptr); void prepare(SpellCastTargets const& targets, AuraEffect const* triggeredByAura = nullptr);
void cancel(); void cancel();
void update(uint32 difftime); void update(uint32 difftime);
void cast(bool skipCheck = false); void cast(bool skipCheck = false);
+196
View File
@@ -0,0 +1,196 @@
/*
* Copyright (C) 2008-2018 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_SPELLDEFINES_H
#define TRINITY_SPELLDEFINES_H
#include "Define.h"
#include "ObjectGuid.h"
#include <vector>
class Item;
class AuraEffect;
enum SpellInterruptFlags
{
SPELL_INTERRUPT_FLAG_MOVEMENT = 0x01, // why need this for instant?
SPELL_INTERRUPT_FLAG_PUSH_BACK = 0x02, // push back
SPELL_INTERRUPT_FLAG_UNK3 = 0x04, // any info?
SPELL_INTERRUPT_FLAG_INTERRUPT = 0x08, // interrupt
SPELL_INTERRUPT_FLAG_ABORT_ON_DMG = 0x10 // _complete_ interrupt on direct damage
//SPELL_INTERRUPT_UNK = 0x20 // unk, 564 of 727 spells having this spell start with "Glyph"
};
// See SpellAuraInterruptFlags for other values definitions
enum SpellChannelInterruptFlags
{
CHANNEL_INTERRUPT_FLAG_INTERRUPT = 0x0008, // interrupt
CHANNEL_FLAG_DELAY = 0x4000
};
enum SpellAuraInterruptFlags
{
AURA_INTERRUPT_FLAG_HITBYSPELL = 0x00000001, // 0 removed when getting hit by a negative spell?
AURA_INTERRUPT_FLAG_TAKE_DAMAGE = 0x00000002, // 1 removed by any damage
AURA_INTERRUPT_FLAG_CAST = 0x00000004, // 2 cast any spells
AURA_INTERRUPT_FLAG_MOVE = 0x00000008, // 3 removed by any movement
AURA_INTERRUPT_FLAG_TURNING = 0x00000010, // 4 removed by any turning
AURA_INTERRUPT_FLAG_JUMP = 0x00000020, // 5 removed by entering combat
AURA_INTERRUPT_FLAG_NOT_MOUNTED = 0x00000040, // 6 removed by dismounting
AURA_INTERRUPT_FLAG_NOT_ABOVEWATER = 0x00000080, // 7 removed by entering water
AURA_INTERRUPT_FLAG_NOT_UNDERWATER = 0x00000100, // 8 removed by leaving water
AURA_INTERRUPT_FLAG_NOT_SHEATHED = 0x00000200, // 9 removed by unsheathing
AURA_INTERRUPT_FLAG_TALK = 0x00000400, // 10 talk to npc / loot? action on creature
AURA_INTERRUPT_FLAG_USE = 0x00000800, // 11 mine/use/open action on gameobject
AURA_INTERRUPT_FLAG_MELEE_ATTACK = 0x00001000, // 12 removed by attacking
AURA_INTERRUPT_FLAG_SPELL_ATTACK = 0x00002000, // 13 ???
AURA_INTERRUPT_FLAG_UNK14 = 0x00004000, // 14
AURA_INTERRUPT_FLAG_TRANSFORM = 0x00008000, // 15 removed by transform?
AURA_INTERRUPT_FLAG_UNK16 = 0x00010000, // 16
AURA_INTERRUPT_FLAG_MOUNT = 0x00020000, // 17 misdirect, aspect, swim speed
AURA_INTERRUPT_FLAG_NOT_SEATED = 0x00040000, // 18 removed by standing up (used by food and drink mostly and sleep/Fake Death like)
AURA_INTERRUPT_FLAG_CHANGE_MAP = 0x00080000, // 19 leaving map/getting teleported
AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION = 0x00100000, // 20 removed by auras that make you invulnerable, or make other to lose selection on you
AURA_INTERRUPT_FLAG_UNK21 = 0x00200000, // 21
AURA_INTERRUPT_FLAG_TELEPORTED = 0x00400000, // 22
AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT = 0x00800000, // 23 removed by entering pvp combat
AURA_INTERRUPT_FLAG_DIRECT_DAMAGE = 0x01000000, // 24 removed by any direct damage
AURA_INTERRUPT_FLAG_LANDING = 0x02000000, // 25 removed by hitting the ground
AURA_INTERRUPT_FLAG_LEAVE_COMBAT = 0x80000000, // 31 removed by leaving combat
AURA_INTERRUPT_FLAG_NOT_VICTIM = (AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE | AURA_INTERRUPT_FLAG_DIRECT_DAMAGE)
};
enum SpellModOp : uint8
{
SPELLMOD_DAMAGE = 0,
SPELLMOD_DURATION = 1,
SPELLMOD_THREAT = 2,
SPELLMOD_EFFECT1 = 3,
SPELLMOD_CHARGES = 4,
SPELLMOD_RANGE = 5,
SPELLMOD_RADIUS = 6,
SPELLMOD_CRITICAL_CHANCE = 7,
SPELLMOD_ALL_EFFECTS = 8,
SPELLMOD_NOT_LOSE_CASTING_TIME = 9,
SPELLMOD_CASTING_TIME = 10,
SPELLMOD_COOLDOWN = 11,
SPELLMOD_EFFECT2 = 12,
SPELLMOD_IGNORE_ARMOR = 13,
SPELLMOD_COST = 14,
SPELLMOD_CRIT_DAMAGE_BONUS = 15,
SPELLMOD_RESIST_MISS_CHANCE = 16,
SPELLMOD_JUMP_TARGETS = 17,
SPELLMOD_CHANCE_OF_SUCCESS = 18,
SPELLMOD_ACTIVATION_TIME = 19,
SPELLMOD_DAMAGE_MULTIPLIER = 20,
SPELLMOD_GLOBAL_COOLDOWN = 21,
SPELLMOD_DOT = 22,
SPELLMOD_EFFECT3 = 23,
SPELLMOD_BONUS_MULTIPLIER = 24,
// spellmod 25
SPELLMOD_PROC_PER_MINUTE = 26,
SPELLMOD_VALUE_MULTIPLIER = 27,
SPELLMOD_RESIST_DISPEL_CHANCE = 28,
SPELLMOD_CRIT_DAMAGE_BONUS_2 = 29, //one not used spell
SPELLMOD_SPELL_COST_REFUND_ON_FAIL = 30,
MAX_SPELLMOD
};
enum SpellValueMod : uint8
{
SPELLVALUE_BASE_POINT0,
SPELLVALUE_BASE_POINT1,
SPELLVALUE_BASE_POINT2,
SPELLVALUE_RADIUS_MOD,
SPELLVALUE_MAX_TARGETS,
SPELLVALUE_AURA_STACK
};
enum SpellFacingFlags
{
SPELL_FACING_FLAG_INFRONT = 0x0001
};
enum TriggerCastFlags : uint32
{
TRIGGERED_NONE = 0x00000000, //! Not triggered
TRIGGERED_IGNORE_GCD = 0x00000001, //! Will ignore GCD
TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD = 0x00000002, //! Will ignore Spell and Category cooldowns
TRIGGERED_IGNORE_POWER_AND_REAGENT_COST = 0x00000004, //! Will ignore power and reagent cost
TRIGGERED_IGNORE_CAST_ITEM = 0x00000008, //! Will not take away cast item or update related achievement criteria
TRIGGERED_IGNORE_AURA_SCALING = 0x00000010, //! Will ignore aura scaling
TRIGGERED_IGNORE_CAST_IN_PROGRESS = 0x00000020, //! Will not check if a current cast is in progress
TRIGGERED_IGNORE_COMBO_POINTS = 0x00000040, //! Will ignore combo point requirement
TRIGGERED_CAST_DIRECTLY = 0x00000080, //! In Spell::prepare, will be cast directly without setting containers for executed spell
TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS = 0x00000100, //! Will ignore interruptible aura's at cast
TRIGGERED_IGNORE_SET_FACING = 0x00000200, //! Will not adjust facing to target (if any)
TRIGGERED_IGNORE_SHAPESHIFT = 0x00000400, //! Will ignore shapeshift checks
TRIGGERED_IGNORE_CASTER_AURASTATE = 0x00000800, //! Will ignore caster aura states including combat requirements and death state
TRIGGERED_DISALLOW_PROC_EVENTS = 0x00001000, //! Disallows proc events from triggered spell (default)
TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE = 0x00002000, //! Will ignore mounted/on vehicle restrictions
// reuse = 0x00004000,
// reuse = 0x00008000,
TRIGGERED_IGNORE_CASTER_AURAS = 0x00010000, //! Will ignore caster aura restrictions or requirements
TRIGGERED_DONT_RESET_PERIODIC_TIMER = 0x00020000, //! Will allow periodic aura timers to keep ticking (instead of resetting)
TRIGGERED_DONT_REPORT_CAST_ERROR = 0x00040000, //! Will return SPELL_FAILED_DONT_REPORT in CheckCast functions
TRIGGERED_FULL_MASK = 0x0007FFFF, //! Used when doing CastSpell with triggered == true
// debug flags (used with .cast triggered commands)
TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT = 0x00080000, //! Will ignore equipped item requirements
TRIGGERED_FULL_DEBUG_MASK = 0xFFFFFFFF
};
struct TC_GAME_API CastSpellExtraArgs
{
CastSpellExtraArgs() {}
CastSpellExtraArgs(bool triggered) : TriggerFlags(triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE) {}
CastSpellExtraArgs(TriggerCastFlags trigger) : TriggerFlags(trigger) {}
CastSpellExtraArgs(Item* item) : TriggerFlags(TRIGGERED_FULL_MASK), CastItem(item) {}
CastSpellExtraArgs(AuraEffect const* eff) : TriggerFlags(TRIGGERED_FULL_MASK), TriggeringAura(eff) {}
CastSpellExtraArgs(ObjectGuid const& origCaster) : TriggerFlags(TRIGGERED_FULL_MASK), OriginalCaster(origCaster) {}
CastSpellExtraArgs(AuraEffect const* eff, ObjectGuid const& origCaster) : TriggerFlags(TRIGGERED_FULL_MASK), TriggeringAura(eff), OriginalCaster(origCaster) {}
CastSpellExtraArgs(SpellValueMod mod, int32 val) { SpellValueOverrides.AddMod(mod, val); }
CastSpellExtraArgs& SetTriggerFlags(TriggerCastFlags flag) { TriggerFlags = flag; return *this; }
CastSpellExtraArgs& SetCastItem(Item* item) { CastItem = item; return *this; }
CastSpellExtraArgs& SetTriggeringAura(AuraEffect const* triggeringAura) { TriggeringAura = triggeringAura; return *this; }
CastSpellExtraArgs& SetOriginalCaster(ObjectGuid const& guid) { OriginalCaster = guid; return *this; }
CastSpellExtraArgs& AddSpellMod(SpellValueMod mod, int32 val) { SpellValueOverrides.AddMod(mod, val); return *this; }
CastSpellExtraArgs& AddSpellBP0(int32 val) { SpellValueOverrides.AddBP0(val); return *this; }
TriggerCastFlags TriggerFlags = TRIGGERED_NONE;
Item* CastItem = nullptr;
AuraEffect const* TriggeringAura = nullptr;
ObjectGuid OriginalCaster = ObjectGuid::Empty;
struct
{
public:
void AddMod(SpellValueMod mod, int32 val) { data.push_back({ mod, val }); }
void AddBP0(int32 bp0) { AddMod(SPELLVALUE_BASE_POINT0, bp0); } // because i don't want to type SPELLVALUE_BASE_POINT0 300 times
private:
auto begin() const { return data.cbegin(); }
auto end() const { return data.cend(); }
std::vector<std::pair<SpellValueMod, int32>> data;
friend class Unit;
} SpellValueOverrides;
};
#endif
+51 -49
View File
@@ -466,7 +466,9 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
if (AuraEffect* aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, 214, 0)) if (AuraEffect* aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, 214, 0))
{ {
int32 bp0 = aurEff->GetId() == 54037 ? 4 : 8; int32 bp0 = aurEff->GetId() == 54037 ? 4 : 8;
m_caster->CastCustomSpell(m_caster, 54425, &bp0, nullptr, nullptr, true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, bp0);
m_caster->CastSpell(m_caster, 54425, args);
} }
} }
} }
@@ -487,7 +489,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
int chance = (*i)->GetSpellInfo()->Effects[EFFECT_1].CalcValue(m_caster); int chance = (*i)->GetSpellInfo()->Effects[EFFECT_1].CalcValue(m_caster);
if (roll_chance_i(chance)) if (roll_chance_i(chance))
// Mind Trauma // Mind Trauma
m_caster->CastSpell(unitTarget, 48301, true, nullptr); m_caster->CastSpell(unitTarget, 48301, true);
break; break;
} }
} }
@@ -855,17 +857,14 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
targets.SetUnitTarget(m_caster); targets.SetUnitTarget(m_caster);
} }
CustomSpellValues values; CastSpellExtraArgs args(m_originalCasterGUID);
// set basepoints for trigger with value effect // set basepoints for trigger with value effect
if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE) if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE)
{ for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage); args.SpellValueOverrides.AddMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), damage);
values.AddSpellMod(SPELLVALUE_BASE_POINT1, damage);
values.AddSpellMod(SPELLVALUE_BASE_POINT2, damage);
}
// original caster guid only for GO cast // original caster guid only for GO cast
m_caster->CastSpell(targets, spellInfo, &values, TRIGGERED_FULL_MASK, nullptr, nullptr, m_originalCasterGUID); m_caster->CastSpell(targets, spellInfo->Id, args);
} }
void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex)
@@ -902,18 +901,14 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex)
targets.SetUnitTarget(m_caster); targets.SetUnitTarget(m_caster);
} }
CustomSpellValues values; CastSpellExtraArgs args(m_originalCasterGUID);
// set basepoints for trigger with value effect // set basepoints for trigger with value effect
if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE) if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE)
{ for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
// maybe need to set value only when basepoints == 0? args.SpellValueOverrides.AddMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), damage);
values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage);
values.AddSpellMod(SPELLVALUE_BASE_POINT1, damage);
values.AddSpellMod(SPELLVALUE_BASE_POINT2, damage);
}
// original caster guid only for GO cast // original caster guid only for GO cast
m_caster->CastSpell(targets, spellInfo, &values, TRIGGERED_FULL_MASK, nullptr, nullptr, m_originalCasterGUID); m_caster->CastSpell(targets, spellInfo->Id, args);
} }
void Spell::EffectForceCast(SpellEffIndex effIndex) void Spell::EffectForceCast(SpellEffIndex effIndex)
@@ -945,32 +940,28 @@ void Spell::EffectForceCast(SpellEffIndex effIndex)
break; break;
case 52463: // Hide In Mine Car case 52463: // Hide In Mine Car
case 52349: // Overtake case 52349: // Overtake
unitTarget->CastCustomSpell(unitTarget, spellInfo->Id, &damage, nullptr, nullptr, true, nullptr, nullptr, m_originalCasterGUID); {
CastSpellExtraArgs args(m_originalCasterGUID);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, damage);
unitTarget->CastSpell(unitTarget, spellInfo->Id, args);
return; return;
}
} }
} }
switch (spellInfo->Id) switch (spellInfo->Id)
{ {
case 72298: // Malleable Goo Summon case 72298: // Malleable Goo Summon
unitTarget->CastSpell(unitTarget, spellInfo->Id, true, nullptr, nullptr, m_originalCasterGUID); unitTarget->CastSpell(unitTarget, spellInfo->Id, m_originalCasterGUID);
return; return;
} }
CustomSpellValues values; CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
// set basepoints for trigger with value effect
if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_FORCE_CAST_WITH_VALUE) if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_FORCE_CAST_WITH_VALUE)
{ for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
// maybe need to set value only when basepoints == 0? args.SpellValueOverrides.AddMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), damage);
values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage);
values.AddSpellMod(SPELLVALUE_BASE_POINT1, damage);
values.AddSpellMod(SPELLVALUE_BASE_POINT2, damage);
}
SpellCastTargets targets; unitTarget->CastSpell(m_caster, spellInfo->Id, args);
targets.SetUnitTarget(m_caster);
unitTarget->CastSpell(targets, spellInfo, &values, TRIGGERED_FULL_MASK);
} }
void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex) void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex)
@@ -989,7 +980,7 @@ void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex)
finish(); finish();
m_caster->CastSpell(nullptr, spellInfo, false); m_caster->CastSpell(nullptr, spellInfo->Id, false);
} }
void Spell::EffectJump(SpellEffIndex effIndex) void Spell::EffectJump(SpellEffIndex effIndex)
@@ -2292,11 +2283,13 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
spellId = spellInfo->Id; spellId = spellInfo->Id;
} }
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
// if we have small value, it indicates seat position // if we have small value, it indicates seat position
if (basePoints > 0 && basePoints < MAX_VEHICLE_SEATS) if (basePoints > 0 && basePoints < MAX_VEHICLE_SEATS)
m_originalCaster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, basePoints, summon, true); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, basePoints);
else
m_originalCaster->CastSpell(summon, spellId, true); m_originalCaster->CastSpell(summon, spellId, args);
uint32 faction = properties->Faction; uint32 faction = properties->Faction;
if (!faction) if (!faction)
@@ -2430,12 +2423,13 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
// Devour Magic // Devour Magic
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->GetCategory() == SPELLCATEGORY_DEVOUR_MAGIC) if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->GetCategory() == SPELLCATEGORY_DEVOUR_MAGIC)
{ {
int32 heal_amount = m_spellInfo->Effects[EFFECT_1].CalcValue(); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, nullptr, nullptr, true); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, m_spellInfo->Effects[EFFECT_1].CalcValue());
m_caster->CastSpell(m_caster, 19658, args);
// Glyph of Felhunter // Glyph of Felhunter
if (Unit* owner = m_caster->GetOwner()) if (Unit* owner = m_caster->GetOwner())
if (owner->GetAura(56249)) if (owner->GetAura(56249))
owner->CastCustomSpell(owner, 19658, &heal_amount, nullptr, nullptr, true); owner->CastSpell(owner, 19658, args);
} }
} }
@@ -2796,7 +2790,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
Spell* spell = new Spell(m_caster, spellInfo, TRIGGERED_FULL_MASK); Spell* spell = new Spell(m_caster, spellInfo, TRIGGERED_FULL_MASK);
SpellCastTargets targets; SpellCastTargets targets;
targets.SetItemTarget(item); targets.SetItemTarget(item);
spell->prepare(&targets); spell->prepare(targets);
} }
} }
} }
@@ -3183,7 +3177,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
// Skyshatter Harness item set bonus // Skyshatter Harness item set bonus
// Stormstrike // Stormstrike
if (AuraEffect* aurEff = m_caster->IsScriptOverriden(m_spellInfo, 5634)) if (AuraEffect* aurEff = m_caster->IsScriptOverriden(m_spellInfo, 5634))
m_caster->CastSpell(m_caster, 38430, true, nullptr, aurEff); m_caster->CastSpell(m_caster, 38430, aurEff);
break; break;
} }
case SPELLFAMILY_DRUID: case SPELLFAMILY_DRUID:
@@ -3532,7 +3526,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
uint32 spell_id = roll_chance_i(20) ? 8854 : 8855; uint32 spell_id = roll_chance_i(20) ? 8854 : 8855;
m_caster->CastSpell(m_caster, spell_id, true, nullptr); m_caster->CastSpell(m_caster, spell_id, true);
return; return;
} }
// Brittle Armor - need remove one 24575 Brittle Armor aura // Brittle Armor - need remove one 24575 Brittle Armor aura
@@ -3737,7 +3731,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
for (uint8 i = 0; i < 15; ++i) for (uint8 i = 0; i < 15; ++i)
{ {
m_caster->GetRandomPoint(*destTarget, radius, x, y, z); m_caster->GetRandomPoint(*destTarget, radius, x, y, z);
m_caster->CastSpell(x, y, z, 54522, true); m_caster->CastSpell({x, y, z}, 54522, true);
} }
break; break;
} }
@@ -3841,7 +3835,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
// proc a spellcast // proc a spellcast
if (Aura* chargesAura = m_caster->GetAura(59907)) if (Aura* chargesAura = m_caster->GetAura(59907))
{ {
m_caster->CastSpell(unitTarget, spell_heal, true, nullptr, nullptr, m_caster->ToTempSummon()->GetSummonerGUID()); m_caster->CastSpell(unitTarget, spell_heal, m_caster->ToTempSummon()->GetSummonerGUID());
if (chargesAura->ModCharges(-1)) if (chargesAura->ModCharges(-1))
m_caster->ToTempSummon()->UnSummon(); m_caster->ToTempSummon()->UnSummon();
} }
@@ -3860,7 +3854,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 58590: // Rank 9 case 58590: // Rank 9
case 58591: // Rank 10 case 58591: // Rank 10
{ {
int32 basepoints0 = damage;
// Cast Absorb on totems // Cast Absorb on totems
for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot) for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot)
{ {
@@ -3870,14 +3863,17 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
Creature* totem = unitTarget->GetMap()->GetCreature(unitTarget->m_SummonSlot[slot]); Creature* totem = unitTarget->GetMap()->GetCreature(unitTarget->m_SummonSlot[slot]);
if (totem && totem->IsTotem()) if (totem && totem->IsTotem())
{ {
m_caster->CastCustomSpell(totem, 55277, &basepoints0, nullptr, nullptr, true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, damage);
m_caster->CastSpell(totem, 55277, args);
} }
} }
// Glyph of Stoneclaw Totem // Glyph of Stoneclaw Totem
if (AuraEffect* aur = unitTarget->GetAuraEffect(63298, 0)) if (AuraEffect* aur = unitTarget->GetAuraEffect(63298, 0))
{ {
basepoints0 *= aur->GetAmount(); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
m_caster->CastCustomSpell(unitTarget, 55277, &basepoints0, nullptr, nullptr, true); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, damage * aur->GetAmount());
m_caster->CastSpell(unitTarget, 55277, args);
} }
break; break;
} }
@@ -4305,7 +4301,9 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex)
player->DestroyItemCount(foodItem, count, true); player->DestroyItemCount(foodItem, count, true);
/// @todo fix crash when a spell has two effects, both pointed at the same item target /// @todo fix crash when a spell has two effects, both pointed at the same item target
m_caster->CastCustomSpell(pet, m_spellInfo->Effects[effIndex].TriggerSpell, &benefit, nullptr, nullptr, true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, benefit);
m_caster->CastSpell(pet, m_spellInfo->Effects[effIndex].TriggerSpell, args);
} }
void Spell::EffectDismissPet(SpellEffIndex effIndex) void Spell::EffectDismissPet(SpellEffIndex effIndex)
@@ -4899,7 +4897,11 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/)
} }
ApplyPct(mana, damage); ApplyPct(mana, damage);
if (mana) if (mana)
m_caster->CastCustomSpell(m_caster, 39104, &mana, nullptr, nullptr, true); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, mana);
m_caster->CastSpell(m_caster, 39104, args);
}
} }
void Spell::EffectDurabilityDamage(SpellEffIndex effIndex) void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
+43 -40
View File
@@ -3205,14 +3205,16 @@ void SpellMgr::LoadSpellInfoCorrections()
52438, // Summon Skittering Swarmer (Force Cast) 52438, // Summon Skittering Swarmer (Force Cast)
52449, // Summon Skittering Infector (Force Cast) 52449, // Summon Skittering Infector (Force Cast)
53609, // Summon Anub'ar Assassin (Force Cast) 53609, // Summon Anub'ar Assassin (Force Cast)
53457 // Summon Impale Trigger (AoE) 53457, // Summon Impale Trigger (AoE)
45907 // Torch Target Picker
}, [](SpellInfo* spellInfo) }, [](SpellInfo* spellInfo)
{ {
spellInfo->MaxAffectedTargets = 1; spellInfo->MaxAffectedTargets = 1;
}); });
// Skartax Purple Beam ApplySpellFix({
ApplySpellFix({ 36384 }, [](SpellInfo* spellInfo) 36384 // Skartax Purple Beam
}, [](SpellInfo* spellInfo)
{ {
spellInfo->MaxAffectedTargets = 2; spellInfo->MaxAffectedTargets = 2;
}); });
@@ -3244,6 +3246,44 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->MaxAffectedTargets = 4; spellInfo->MaxAffectedTargets = 4;
}); });
ApplySpellFix({
42005, // Bloodboil
38296, // Spitfire Totem
37676, // Insidious Whisper
46008, // Negative Energy
45641, // Fire Bloom
55665, // Life Drain - Sapphiron (H)
28796 // Poison Bolt Volly - Faerlina
}, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 5;
});
ApplySpellFix({
54835 // Curse of the Plaguebringer - Noth (H)
}, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 8;
});
ApplySpellFix({
40827, // Sinful Beam
40859, // Sinister Beam
40860, // Vile Beam
40861, // Wicked Beam
54098 // Poison Bolt Volly - Faerlina (H)
}, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 10;
});
ApplySpellFix({
50312 // Unholy Frenzy
}, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 15;
});
ApplySpellFix({ ApplySpellFix({
47977, // Magic Broom 47977, // Magic Broom
48025, // Headless Horseman's Mount 48025, // Headless Horseman's Mount
@@ -3281,43 +3321,6 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Effects[EFFECT_1].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ALLY); spellInfo->Effects[EFFECT_1].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ALLY);
}); });
ApplySpellFix({
42005, // Bloodboil
38296, // Spitfire Totem
37676, // Insidious Whisper
46008, // Negative Energy
45641, // Fire Bloom
55665, // Life Drain - Sapphiron (H)
28796 // Poison Bolt Volly - Faerlina
}, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 5;
});
// Curse of the Plaguebringer - Noth (H)
ApplySpellFix({ 54835 }, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 8;
});
ApplySpellFix({
40827, // Sinful Beam
40859, // Sinister Beam
40860, // Vile Beam
40861, // Wicked Beam
54098 // Poison Bolt Volly - Faerlina (H)
}, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 10;
});
// Unholy Frenzy
ApplySpellFix({ 50312 }, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 15;
});
// Murmur's Touch // Murmur's Touch
ApplySpellFix({ 33711, 38794 }, [](SpellInfo* spellInfo) ApplySpellFix({ 33711, 38794 }, [](SpellInfo* spellInfo)
{ {
+2 -3
View File
@@ -171,8 +171,7 @@ public:
TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE; TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
float x, y, z; float x, y, z;
handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, dist); handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, dist);
handler->GetSession()->GetPlayer()->CastSpell({ x, y, z }, spellId, triggered);
handler->GetSession()->GetPlayer()->CastSpell(x, y, z, spellId, triggered);
return true; return true;
} }
@@ -274,7 +273,7 @@ public:
} }
TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE; TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
caster->CastSpell(x, y, z, spellId, triggered); caster->CastSpell({ x, y, z }, spellId, triggered);
return true; return true;
} }
@@ -259,9 +259,14 @@ struct boss_coren_direbrew : public BossAI
SummonSister(NPC_URSULA_DIREBREW); SummonSister(NPC_URSULA_DIREBREW);
break; break;
case EVENT_SUMMON_MOLE_MACHINE: case EVENT_SUMMON_MOLE_MACHINE:
me->CastCustomSpell(SPELL_MOLE_MACHINE_TARGET_PICKER, SPELLVALUE_MAX_TARGETS, 1, nullptr, true); {
CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, 1);
me->CastSpell(nullptr, SPELL_MOLE_MACHINE_TARGET_PICKER, args);
events.Repeat(Seconds(15)); events.Repeat(Seconds(15));
break; break;
}
case EVENT_DIREBREW_DISARM: case EVENT_DIREBREW_DISARM:
DoCastSelf(SPELL_DIREBREW_DISARM_PRE_CAST, true); DoCastSelf(SPELL_DIREBREW_DISARM_PRE_CAST, true);
events.Repeat(Seconds(20)); events.Repeat(Seconds(20));
@@ -137,8 +137,12 @@ class spell_baron_geddon_inferno : public SpellScriptLoader
void OnPeriodic(AuraEffect const* aurEff) void OnPeriodic(AuraEffect const* aurEff)
{ {
PreventDefaultAction(); PreventDefaultAction();
int32 damageForTick[8] = { 500, 500, 1000, 1000, 2000, 2000, 3000, 5000 }; static const int32 damageForTick[8] = { 500, 500, 1000, 1000, 2000, 2000, 3000, 5000 };
GetTarget()->CastCustomSpell(SPELL_INFERNO_DMG, SPELLVALUE_BASE_POINT0, damageForTick[aurEff->GetTickNumber() - 1], (Unit*)nullptr, TRIGGERED_FULL_MASK, nullptr, aurEff); CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
args.TriggeringAura = aurEff;
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, damageForTick[aurEff->GetTickNumber() - 1]);
GetTarget()->CastSpell(nullptr, SPELL_INFERNO_DMG, args);
} }
void Register() override void Register() override
@@ -340,7 +340,10 @@ public:
enfeeble_targets[i] = target->GetGUID(); enfeeble_targets[i] = target->GetGUID();
enfeeble_health[i] = target->GetHealth(); enfeeble_health[i] = target->GetHealth();
target->CastSpell(target, SPELL_ENFEEBLE, true, 0, 0, me->GetGUID()); CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
args.OriginalCaster = me->GetGUID();
target->CastSpell(target, SPELL_ENFEEBLE, args);
target->SetHealth(1); target->SetHealth(1);
} }
} }
@@ -460,7 +460,7 @@ public:
Unit* unit = ObjectAccessor::GetUnit(*me, FlameWreathTarget[i]); Unit* unit = ObjectAccessor::GetUnit(*me, FlameWreathTarget[i]);
if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
{ {
unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID()); unit->CastSpell(unit, 20476, me->GetGUID());
unit->CastSpell(unit, 11027, true); unit->CastSpell(unit, 11027, true);
FlameWreathTarget[i].Clear(); FlameWreathTarget[i].Clear();
} }
@@ -236,8 +236,13 @@ public:
{ {
Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
// Knockback into the air // Knockback into the air
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID()); CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
args.OriginalCaster = me->GetGUID();
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_DOT, args);
}
} }
} }
@@ -251,7 +256,10 @@ public:
if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{ {
// Also needs an exception in spell system. // Also needs an exception in spell system.
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID()); CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
args.OriginalCaster = me->GetGUID();
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, args);
unit->SetCanFly(true); unit->SetCanFly(true);
} }
} }
@@ -171,7 +171,13 @@ class boss_akilzon : public CreatureScript
if (Unit* target = (*i)) if (Unit* target = (*i))
{ {
if (Cloud && !Cloud->IsWithinDist(target, 6, false)) if (Cloud && !Cloud->IsWithinDist(target, 6, false))
Cloud->CastCustomSpell(target, SPELL_ZAP, &bp0, nullptr, nullptr, true, 0, 0, me->GetGUID()); {
CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
args.OriginalCaster = me->GetGUID();
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, bp0);
Cloud->CastSpell(target, SPELL_ZAP, args);
}
} }
} }
@@ -190,7 +196,13 @@ class boss_akilzon : public CreatureScript
trigger->SetHealth(100000); trigger->SetHealth(100000);
trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if (Cloud) if (Cloud)
Cloud->CastCustomSpell(trigger, /*43661*/SPELL_ZAP, &bp0, nullptr, nullptr, true, 0, 0, Cloud->GetGUID()); {
CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
args.OriginalCaster = Cloud->GetGUID();
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, bp0);
Cloud->CastSpell(trigger, SPELL_ZAP, args);
}
} }
} }
} }
@@ -1024,7 +1024,7 @@ class spell_hexlord_unstable_affliction : public SpellScriptLoader
void HandleDispel(DispelInfo* dispelInfo) void HandleDispel(DispelInfo* dispelInfo)
{ {
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WL_UNSTABLE_AFFL_DISPEL, true, nullptr, GetEffect(EFFECT_0)); caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WL_UNSTABLE_AFFL_DISPEL, GetEffect(EFFECT_0));
} }
void Register() override void Register() override
@@ -284,8 +284,10 @@ class spell_anetheron_vampiric_aura : public SpellScriptLoader
if (!damageInfo || !damageInfo->GetDamage()) if (!damageInfo || !damageInfo->GetDamage())
return; return;
int32 bp = damageInfo->GetDamage() * 3; Unit* actor = eventInfo.GetActor();
eventInfo.GetActor()->CastCustomSpell(SPELL_VAMPIRIC_AURA_HEAL, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetActor(), true, nullptr, aurEff); CastSpellExtraArgs args(aurEff);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, damageInfo->GetDamage() * 3);
actor->CastSpell(actor, SPELL_VAMPIRIC_AURA_HEAL, args);
} }
void Register() override void Register() override
@@ -474,8 +474,10 @@ public:
DoomfireSpiritGUID = summoned->GetGUID(); DoomfireSpiritGUID = summoned->GetGUID();
break; break;
case NPC_DOOMFIRE: case NPC_DOOMFIRE:
{
summoned->CastSpell(summoned, SPELL_DOOMFIRE_SPAWN, false); summoned->CastSpell(summoned, SPELL_DOOMFIRE_SPAWN, false);
summoned->CastSpell(summoned, SPELL_DOOMFIRE, true, 0, 0, me->GetGUID());
summoned->CastSpell(summoned, SPELL_DOOMFIRE, me->GetGUID());
if (Unit* DoomfireSpirit = ObjectAccessor::GetUnit(*me, DoomfireSpiritGUID)) if (Unit* DoomfireSpirit = ObjectAccessor::GetUnit(*me, DoomfireSpiritGUID))
{ {
@@ -483,6 +485,7 @@ public:
DoomfireSpiritGUID.Clear(); DoomfireSpiritGUID.Clear();
} }
break; break;
}
default: default:
break; break;
} }
@@ -216,7 +216,7 @@ class spell_mark_of_kazrogal : public SpellScriptLoader
if (target->GetPower(POWER_MANA) == 0) if (target->GetPower(POWER_MANA) == 0)
{ {
target->CastSpell(target, SPELL_MARK_DAMAGE, true, nullptr, aurEff); target->CastSpell(target, SPELL_MARK_DAMAGE, aurEff);
// Remove aura // Remove aura
SetDuration(0); SetDuration(0);
} }
@@ -1339,7 +1339,7 @@ public:
{ {
if (StrikeTimer <= diff) if (StrikeTimer <= diff)
{ {
me->CastSpell(DummyTarget[0], DummyTarget[1], DummyTarget[2], SPELL_GARGOYLE_STRIKE, false); me->CastSpell({ DummyTarget[0], DummyTarget[1], DummyTarget[2] }, SPELL_GARGOYLE_STRIKE, false);
StrikeTimer = 2000 + rand32() % 1000; StrikeTimer = 2000 + rand32() % 1000;
} else StrikeTimer -= diff; } else StrikeTimer -= diff;
} }
@@ -1452,8 +1452,9 @@ public:
EnterEvadeMode(); EnterEvadeMode();
return; return;
} }
int dmg = 500 + rand32() % 700; CastSpellExtraArgs args;
me->CastCustomSpell(me->GetVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, 500 + rand32() % 700);
me->CastSpell(me->GetVictim(), SPELL_EXPLODING_SHOT, args);
ExplodeTimer = 5000 + rand32() % 5000; ExplodeTimer = 5000 + rand32() % 5000;
} else ExplodeTimer -= diff; } else ExplodeTimer -= diff;
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
@@ -758,7 +758,7 @@ public:
//Set target in stomach //Set target in stomach
Stomach_Map[target->GetGUID()] = true; Stomach_Map[target->GetGUID()] = true;
target->InterruptNonMeleeSpells(false); target->InterruptNonMeleeSpells(false);
target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, nullptr, nullptr, me->GetGUID()); target->CastSpell(target, SPELL_MOUTH_TENTACLE, me->GetGUID());
StomachEnterTarget = target->GetGUID(); StomachEnterTarget = target->GetGUID();
StomachEnterVisTimer = 3800; StomachEnterVisTimer = 3800;
} }
@@ -504,7 +504,7 @@ public:
DoCast(player, SPELL_ARCANE_CHANNELING, true);//Arcane Channeling DoCast(player, SPELL_ARCANE_CHANNELING, true);//Arcane Channeling
break; break;
case 35: case 35:
me->CastSpell(-8088, 1520.43f, 2.67f, SPELL_TIME_STOP, true); me->CastSpell({ -8088, 1520.43f, 2.67f }, SPELL_TIME_STOP, true);
break; break;
case 36: case 36:
DoCast(player, SPELL_CALL_PRISMATIC_BARRIER, true); DoCast(player, SPELL_CALL_PRISMATIC_BARRIER, true);
@@ -554,7 +554,7 @@ public:
break; break;
case 50: case 50:
Fandral->AI()->Talk(FANDRAL_EMOTE_2); Fandral->AI()->Talk(FANDRAL_EMOTE_2);
Fandral->CastSpell(-8127, 1525, 17.5f, SPELL_THROW_HAMMER, true); Fandral->CastSpell({ -8127, 1525, 17.5f }, SPELL_THROW_HAMMER, true);
break; break;
case 51: case 51:
{ {
@@ -1420,7 +1420,7 @@ class spell_silithus_summon_cultist_periodic : public AuraScript
// All these spells trigger a spell that requires reagents; if the // All these spells trigger a spell that requires reagents; if the
// triggered spell is cast as "triggered", reagents are not consumed // triggered spell is cast as "triggered", reagents are not consumed
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST), nullptr, aurEff); caster->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, CastSpellExtraArgs(TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)).SetTriggeringAura(aurEff));
} }
void Register() override void Register() override
@@ -258,7 +258,12 @@ class spell_ahn_kahet_swarm : public SpellScriptLoader
aura->RefreshDuration(); aura->RefreshDuration();
} }
else else
GetCaster()->CastCustomSpell(SPELL_SWARM_BUFF, SPELLVALUE_AURA_STACK, _targetCount, GetCaster(), TRIGGERED_FULL_MASK); {
CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, _targetCount);
GetCaster()->CastSpell(GetCaster(), SPELL_SWARM_BUFF, args);
}
} }
else else
GetCaster()->RemoveAurasDueToSpell(SPELL_SWARM_BUFF); GetCaster()->RemoveAurasDueToSpell(SPELL_SWARM_BUFF);
@@ -348,7 +348,7 @@ class boss_halion : public CreatureScript
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, true, -SPELL_TWILIGHT_REALM)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, true, -SPELL_TWILIGHT_REALM))
{ {
_meteorStrikePos = target->GetPosition(); _meteorStrikePos = target->GetPosition();
me->CastSpell(_meteorStrikePos.GetPositionX(), _meteorStrikePos.GetPositionY(), _meteorStrikePos.GetPositionZ(), SPELL_METEOR_STRIKE, true, nullptr, nullptr, me->GetGUID()); me->CastSpell(_meteorStrikePos, SPELL_METEOR_STRIKE, me->GetGUID());
Talk(SAY_METEOR_STRIKE); Talk(SAY_METEOR_STRIKE);
} }
events.ScheduleEvent(EVENT_METEOR_STRIKE, Seconds(38)); events.ScheduleEvent(EVENT_METEOR_STRIKE, Seconds(38));
@@ -1241,11 +1241,15 @@ class npc_combustion_consumption : public CreatureScript
if (type != DATA_STACKS_DISPELLED || !_damageSpell || !_explosionSpell || !summoner) if (type != DATA_STACKS_DISPELLED || !_damageSpell || !_explosionSpell || !summoner)
return; return;
me->CastCustomSpell(SPELL_SCALE_AURA, SPELLVALUE_AURA_STACK, stackAmount + 1, me); CastSpellExtraArgs args;
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, stackAmount + 1);
me->CastSpell(me, SPELL_SCALE_AURA, args);
DoCastSelf(_damageSpell); DoCastSelf(_damageSpell);
int32 damage = 1200 + (stackAmount * 1290); // Needs more research. int32 damage = 1200 + (stackAmount * 1290); // Needs more research.
summoner->CastCustomSpell(_explosionSpell, SPELLVALUE_BASE_POINT0, damage, summoner); CastSpellExtraArgs args2;
args2.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, damage);
summoner->CastSpell(summoner, _explosionSpell, args2);
} }
void UpdateAI(uint32 /*diff*/) override { } void UpdateAI(uint32 /*diff*/) override { }
@@ -1511,7 +1515,10 @@ class spell_halion_combustion_consumption_periodic : public SpellScriptLoader
uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
int32 radius = caster->GetObjectScale() * M_PI * 10000 / 3; int32 radius = caster->GetObjectScale() * M_PI * 10000 / 3;
caster->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, radius, (Unit*)nullptr, TRIGGERED_FULL_MASK, nullptr, aurEff, caster->GetGUID()); CastSpellExtraArgs args(aurEff);
args.OriginalCaster = caster->GetGUID();
args.SpellValueOverrides.AddMod(SPELLVALUE_RADIUS_MOD, radius);
caster->CastSpell(nullptr, triggerSpell, args);
} }
void Register() override void Register() override
@@ -1563,7 +1570,9 @@ class spell_halion_marks : public SpellScriptLoader
return; return;
// Stacks marker // Stacks marker
GetTarget()->CastCustomSpell(_summonSpellId, SPELLVALUE_BASE_POINT1, aurEff->GetBase()->GetStackAmount(), GetTarget(), TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID()); CastSpellExtraArgs args(GetCasterGUID());
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT1, aurEff->GetBase()->GetStackAmount());
GetTarget()->CastSpell(GetTarget(), _summonSpellId, args);
} }
void Register() override void Register() override
@@ -1787,7 +1796,7 @@ class spell_halion_twilight_phasing : public SpellScriptLoader
void Phase() void Phase()
{ {
Unit* caster = GetCaster(); Unit* caster = GetCaster();
caster->CastSpell(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), SPELL_SUMMON_TWILIGHT_PORTAL, true); caster->CastSpell(caster->GetPosition(), SPELL_SUMMON_TWILIGHT_PORTAL, true);
caster->GetMap()->SummonCreature(NPC_TWILIGHT_HALION, HalionSpawnPos); caster->GetMap()->SummonCreature(NPC_TWILIGHT_HALION, HalionSpawnPos);
} }
@@ -196,7 +196,11 @@ class spell_ruby_sanctum_rallying_shout : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/) void HandleDummy(SpellEffIndex /*effIndex*/)
{ {
if (_targetCount && !GetCaster()->HasAura(SPELL_RALLY)) if (_targetCount && !GetCaster()->HasAura(SPELL_RALLY))
GetCaster()->CastCustomSpell(SPELL_RALLY, SPELLVALUE_AURA_STACK, _targetCount, GetCaster(), TRIGGERED_FULL_MASK); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, _targetCount);
GetCaster()->CastSpell(GetCaster(), SPELL_RALLY, args);
}
} }
void Register() override void Register() override
@@ -668,7 +668,7 @@ class spell_paletress_summon_memory : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{ {
GetHitUnit()->CastSpell(GetHitUnit(), memorySpellId[urand(0, 24)], true, nullptr, nullptr, GetCaster()->GetGUID()); GetHitUnit()->CastSpell(GetHitUnit(), memorySpellId[urand(0, 24)], GetCaster()->GetGUID());
} }
void Register() override void Register() override
@@ -310,12 +310,20 @@ class boss_anubarak_trial : public CreatureScript
events.ScheduleEvent(EVENT_FREEZE_SLASH, 15*IN_MILLISECONDS, 0, PHASE_MELEE); events.ScheduleEvent(EVENT_FREEZE_SLASH, 15*IN_MILLISECONDS, 0, PHASE_MELEE);
return; return;
case EVENT_PENETRATING_COLD: case EVENT_PENETRATING_COLD:
me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 5)); {
events.ScheduleEvent(EVENT_PENETRATING_COLD, 20*IN_MILLISECONDS, 0, PHASE_MELEE); CastSpellExtraArgs args;
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 5));
me->CastSpell(nullptr, SPELL_PENETRATING_COLD, args);
events.ScheduleEvent(EVENT_PENETRATING_COLD, 20 * IN_MILLISECONDS, 0, PHASE_MELEE);
return; return;
}
case EVENT_SUMMON_NERUBIAN: case EVENT_SUMMON_NERUBIAN:
if (IsHeroic() || !_reachedPhase3) if (IsHeroic() || !_reachedPhase3)
me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 2, 4)); {
CastSpellExtraArgs args;
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 2, 4));
me->CastSpell(nullptr, SPELL_SUMMON_BURROWER, args);
}
events.ScheduleEvent(EVENT_SUMMON_NERUBIAN, 45*IN_MILLISECONDS, 0, PHASE_MELEE); events.ScheduleEvent(EVENT_SUMMON_NERUBIAN, 45*IN_MILLISECONDS, 0, PHASE_MELEE);
return; return;
case EVENT_NERUBIAN_SHADOW_STRIKE: case EVENT_NERUBIAN_SHADOW_STRIKE:
@@ -928,10 +936,12 @@ class spell_anubarak_leeching_swarm : public SpellScriptLoader
int32 lifeLeeched = target->CountPctFromCurHealth(aurEff->GetAmount()); int32 lifeLeeched = target->CountPctFromCurHealth(aurEff->GetAmount());
if (lifeLeeched < 250) if (lifeLeeched < 250)
lifeLeeched = 250; lifeLeeched = 250;
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, lifeLeeched);
// Damage // Damage
caster->CastCustomSpell(target, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, true); caster->CastSpell(target, SPELL_LEECHING_SWARM_DMG, args);
// Heal // Heal
caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, true); caster->CastSpell(caster, SPELL_LEECHING_SWARM_HEAL, args);
} }
} }
@@ -2265,7 +2265,7 @@ class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader
void HandleDispel(DispelInfo* dispelInfo) void HandleDispel(DispelInfo* dispelInfo)
{ {
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, nullptr, GetEffect(EFFECT_0)); caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, GetEffect(EFFECT_0));
} }
void Register() override void Register() override
@@ -221,9 +221,13 @@ class boss_jaraxxus : public CreatureScript
events.ScheduleEvent(EVENT_INCINERATE_FLESH, urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS)); events.ScheduleEvent(EVENT_INCINERATE_FLESH, urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS));
break; break;
case EVENT_NETHER_POWER: case EVENT_NETHER_POWER:
me->CastCustomSpell(SPELL_NETHER_POWER, SPELLVALUE_AURA_STACK, RAID_MODE<uint32>(5, 10, 5, 10), me, true); {
events.ScheduleEvent(EVENT_NETHER_POWER, 40*IN_MILLISECONDS); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, RAID_MODE(5, 10, 5, 10));
me->CastSpell(me, SPELL_NETHER_POWER, args);
events.ScheduleEvent(EVENT_NETHER_POWER, 40 * IN_MILLISECONDS);
break; break;
}
case EVENT_LEGION_FLAME: case EVENT_LEGION_FLAME:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, true, -SPELL_LORD_HITTIN)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, true, -SPELL_LORD_HITTIN))
{ {
@@ -1152,7 +1152,7 @@ class spell_jormungars_paralytic_toxin : public AuraScript
slowEff->ChangeAmount(newAmount); slowEff->ChangeAmount(newAmount);
if (newAmount == -100 && !GetTarget()->HasAura(SPELL_PARALYSIS)) if (newAmount == -100 && !GetTarget()->HasAura(SPELL_PARALYSIS))
GetTarget()->CastSpell(GetTarget(), SPELL_PARALYSIS, true, nullptr, slowEff, GetCasterGUID()); GetTarget()->CastSpell(GetTarget(), SPELL_PARALYSIS, CastSpellExtraArgs(slowEff).SetOriginalCaster(GetCasterGUID()));
} }
} }
@@ -1197,7 +1197,9 @@ class spell_jormungars_slime_pool : public AuraScript
PreventDefaultAction(); PreventDefaultAction();
int32 const radius = static_cast<int32>(((aurEff->GetTickNumber() / 60.f) * 0.9f + 0.1f) * 10000.f * 2.f / 3.f); int32 const radius = static_cast<int32>(((aurEff->GetTickNumber() / 60.f) * 0.9f + 0.1f) * 10000.f * 2.f / 3.f);
GetTarget()->CastCustomSpell(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, SPELLVALUE_RADIUS_MOD, radius, nullptr, true, nullptr, aurEff); CastSpellExtraArgs args(aurEff);
args.SpellValueOverrides.AddMod(SPELLVALUE_RADIUS_MOD, radius);
GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, args);
} }
void Register() override void Register() override
@@ -321,7 +321,11 @@ struct boss_twin_baseAI : public BossAI
break; break;
case EVENT_TOUCH: case EVENT_TOUCH:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true, true, OtherEssenceSpellId)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true, true, OtherEssenceSpellId))
me->CastCustomSpell(TouchSpellId, SPELLVALUE_MAX_TARGETS, 1, target, false); {
CastSpellExtraArgs args;
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, 1); // @todo spellmgr correction instead?
me->CastSpell(target, TouchSpellId, args);
}
events.ScheduleEvent(EVENT_TOUCH, urand(10 * IN_MILLISECONDS, 15 * IN_MILLISECONDS)); events.ScheduleEvent(EVENT_TOUCH, urand(10 * IN_MILLISECONDS, 15 * IN_MILLISECONDS));
break; break;
case EVENT_BERSERK: case EVENT_BERSERK:
@@ -726,8 +730,11 @@ class spell_bullet_controller : public AuraScript
if (!caster) if (!caster)
return; return;
caster->CastCustomSpell(SPELL_SUMMON_PERIODIC_LIGHT, SPELLVALUE_MAX_TARGETS, urand(1, 6), GetTarget(), true); CastSpellExtraArgs args1(TRIGGERED_FULL_MASK), args2(TRIGGERED_FULL_MASK);
caster->CastCustomSpell(SPELL_SUMMON_PERIODIC_DARK, SPELLVALUE_MAX_TARGETS, urand(1, 6), GetTarget(), true); args1.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, urand(1, 6));
args2.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, urand(1, 6));
caster->CastSpell(GetTarget(), SPELL_SUMMON_PERIODIC_LIGHT, args1);
caster->CastSpell(GetTarget(), SPELL_SUMMON_PERIODIC_DARK, args2);
} }
void Register() override void Register() override
@@ -139,7 +139,7 @@ class boss_trollgore : public CreatureScript
case EVENT_SPAWN: case EVENT_SPAWN:
for (uint8 i = 0; i < 3; ++i) for (uint8 i = 0; i < 3; ++i)
if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TROLLGORE_INVADER_SUMMONER_1 + i))) if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TROLLGORE_INVADER_SUMMONER_1 + i)))
trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), true, nullptr, nullptr, me->GetGUID()); trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), me->GetGUID());
events.ScheduleEvent(EVENT_SPAWN, urand(30000, 40000)); events.ScheduleEvent(EVENT_SPAWN, urand(30000, 40000));
break; break;
@@ -277,7 +277,7 @@ class spell_trollgore_corpse_explode : public SpellScriptLoader
{ {
if (aurEff->GetTickNumber() == 2) if (aurEff->GetTickNumber() == 2)
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, true, nullptr, aurEff); caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, aurEff);
} }
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -198,7 +198,7 @@ class boss_bronjahm : public CreatureScript
me->CastSpell(me, SPELL_SOULSTORM, false); me->CastSpell(me, SPELL_SOULSTORM, false);
break; break;
case EVENT_FEAR: case EVENT_FEAR:
me->CastCustomSpell(SPELL_FEAR, SPELLVALUE_MAX_TARGETS, 1, nullptr, false); me->CastSpell(nullptr, SPELL_FEAR, { SPELLVALUE_MAX_TARGETS, 1 });
events.ScheduleEvent(EVENT_FEAR, urand(8000, 12000), 0, PHASE_2); events.ScheduleEvent(EVENT_FEAR, urand(8000, 12000), 0, PHASE_2);
break; break;
default: default:
@@ -410,8 +410,9 @@ class spell_devourer_of_souls_mirrored_soul_proc : public SpellScriptLoader
if (!damageInfo || !damageInfo->GetDamage()) if (!damageInfo || !damageInfo->GetDamage())
return; return;
int32 damage = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), 45); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
GetTarget()->CastCustomSpell(SPELL_MIRRORED_SOUL_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetCaster(), true); args.SpellValueOverrides.AddBP0(CalculatePct(damageInfo->GetDamage(), 45));
GetTarget()->CastSpell(GetCaster(), SPELL_MIRRORED_SOUL_DAMAGE, args);
} }
void Register() override void Register() override
@@ -151,7 +151,11 @@ class spell_marwyn_shared_suffering : public SpellScriptLoader
{ {
int32 remainingDamage = aurEff->GetAmount() * aurEff->GetRemainingTicks(); int32 remainingDamage = aurEff->GetAmount() * aurEff->GetRemainingTicks();
if (remainingDamage > 0) if (remainingDamage > 0)
caster->CastCustomSpell(SPELL_SHARED_SUFFERING_DISPEL, SPELLVALUE_BASE_POINT1, remainingDamage, GetTarget(), TRIGGERED_FULL_MASK); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT1, remainingDamage);
caster->CastSpell(GetTarget(), SPELL_SHARED_SUFFERING_DISPEL, args);
}
} }
} }
@@ -266,7 +266,7 @@ class boss_ick : public CreatureScript
krick->AI()->Talk(SAY_KRICK_BARRAGE_1); krick->AI()->Talk(SAY_KRICK_BARRAGE_1);
krick->AI()->Talk(SAY_KRICK_BARRAGE_2); krick->AI()->Talk(SAY_KRICK_BARRAGE_2);
krick->CastSpell(krick, SPELL_EXPLOSIVE_BARRAGE_KRICK, true); krick->CastSpell(krick, SPELL_EXPLOSIVE_BARRAGE_KRICK, true);
DoCast(me, SPELL_EXPLOSIVE_BARRAGE_ICK); DoCastAOE(SPELL_EXPLOSIVE_BARRAGE_ICK);
} }
events.DelayEvents(20000); events.DelayEvents(20000);
break; break;
@@ -275,12 +275,12 @@ class boss_ick : public CreatureScript
krick->AI()->Talk(SAY_KRICK_POISON_NOVA); krick->AI()->Talk(SAY_KRICK_POISON_NOVA);
Talk(SAY_ICK_POISON_NOVA); Talk(SAY_ICK_POISON_NOVA);
DoCast(me, SPELL_POISON_NOVA); DoCastAOE(SPELL_POISON_NOVA);
break; break;
case EVENT_PURSUIT: case EVENT_PURSUIT:
if (Creature* krick = GetKrick()) if (Creature* krick = GetKrick())
krick->AI()->Talk(SAY_KRICK_CHASE); krick->AI()->Talk(SAY_KRICK_CHASE);
me->CastCustomSpell(SPELL_PURSUIT, SPELLVALUE_MAX_TARGETS, 1, me); DoCastSelf(SPELL_PURSUIT, { SPELLVALUE_MAX_TARGETS, 1 });
break; break;
default: default:
break; break;
@@ -404,13 +404,21 @@ class player_overlord_brandAI : public PlayerAI
{ {
if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID)) if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
if (Unit* victim = tyrannus->GetVictim()) if (Unit* victim = tyrannus->GetVictim())
me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, victim, true, nullptr, nullptr, tyrannus->GetGUID()); {
CastSpellExtraArgs args(tyrannus->GetGUID());
args.SpellValueOverrides.AddBP0(damage);
me->CastSpell(victim, SPELL_OVERLORD_BRAND_DAMAGE, args);
}
} }
void HealDone(Unit* /*target*/, uint32& addHealth) override void HealDone(Unit* /*target*/, uint32& addHealth) override
{ {
if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID)) if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth * 5.5f), tyrannus, true, nullptr, nullptr, tyrannus->GetGUID()); {
CastSpellExtraArgs args(tyrannus->GetGUID());
args.SpellValueOverrides.AddBP0(addHealth * 5.5f);
me->CastSpell(tyrannus, SPELL_OVERLORD_BRAND_HEAL, args);
}
} }
void UpdateAI(uint32 /*diff*/) override { } void UpdateAI(uint32 /*diff*/) override { }
@@ -234,7 +234,9 @@ class spell_moorabi_mojo_frenzy : public SpellScriptLoader
Unit* owner = GetUnitOwner(); Unit* owner = GetUnitOwner();
int32 castSpeedBonus = (100.0f - owner->GetHealthPct()) * 4; // between 0% and 400% cast speed bonus int32 castSpeedBonus = (100.0f - owner->GetHealthPct()) * 4; // between 0% and 400% cast speed bonus
owner->CastCustomSpell(SPELL_MOJO_FRENZY_CAST_SPEED, SPELLVALUE_BASE_POINT0, castSpeedBonus, owner, true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(castSpeedBonus);
owner->CastSpell(owner, SPELL_MOJO_FRENZY_CAST_SPEED, args);
} }
void Register() override void Register() override
@@ -807,7 +807,7 @@ class boss_prince_valanar_icc : public CreatureScript
{ {
case NPC_KINETIC_BOMB_TARGET: case NPC_KINETIC_BOMB_TARGET:
summon->SetReactState(REACT_PASSIVE); summon->SetReactState(REACT_PASSIVE);
summon->CastSpell(summon, SPELL_KINETIC_BOMB, true, nullptr, nullptr, me->GetGUID()); summon->CastSpell(summon, SPELL_KINETIC_BOMB, me->GetGUID());
break; break;
case NPC_KINETIC_BOMB: case NPC_KINETIC_BOMB:
{ {
@@ -1471,7 +1471,7 @@ class spell_blood_council_shadow_prison : public SpellScriptLoader
void HandleDummyTick(AuraEffect const* aurEff) void HandleDummyTick(AuraEffect const* aurEff)
{ {
if (GetTarget()->isMoving()) if (GetTarget()->isMoving())
GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, nullptr, aurEff); GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, aurEff);
} }
void Register() override void Register() override
@@ -728,8 +728,9 @@ class spell_blood_queen_essence_of_the_blood_queen : public SpellScriptLoader
if (!damageInfo || !damageInfo->GetDamage()) if (!damageInfo || !damageInfo->GetDamage())
return; return;
int32 heal = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); CastSpellExtraArgs args(aurEff);
GetTarget()->CastCustomSpell(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), TRIGGERED_FULL_MASK, nullptr, aurEff); args.SpellValueOverrides.AddBP0(CalculatePct(damageInfo->GetDamage(), aurEff->GetAmount()));
GetTarget()->CastSpell(GetTarget(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL, args);
} }
void Register() override void Register() override
@@ -813,7 +814,10 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg : public SpellScriptLoader
int32 damage = damageSpell->Effects[EFFECT_0].CalcValue(); int32 damage = damageSpell->Effects[EFFECT_0].CalcValue();
float multiplier = 0.3375f + 0.1f * uint32(aurEff->GetTickNumber()/10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks) float multiplier = 0.3375f + 0.1f * uint32(aurEff->GetTickNumber()/10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks)
damage = int32(damage * multiplier); damage = int32(damage * multiplier);
GetTarget()->CastCustomSpell(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true);
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(damage);
GetTarget()->CastSpell(GetTarget(), SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, args);
} }
void Register() override void Register() override
@@ -434,7 +434,11 @@ class boss_deathbringer_saurfang : public CreatureScript
case 72445: case 72445:
case 72446: case 72446:
if (me->GetPower(POWER_ENERGY) != me->GetMaxPower(POWER_ENERGY)) if (me->GetPower(POWER_ENERGY) != me->GetMaxPower(POWER_ENERGY))
target->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, 1, (Unit*)nullptr, true); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(1);
target->CastSpell(nullptr, SPELL_BLOOD_LINK_DUMMY, args);
}
break; break;
default: default:
break; break;
@@ -1016,7 +1020,9 @@ class spell_deathbringer_blood_link : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/) void HandleDummy(SpellEffIndex /*effIndex*/)
{ {
GetHitUnit()->CastCustomSpell(SPELL_BLOOD_LINK_POWER, SPELLVALUE_BASE_POINT0, GetEffectValue(), GetHitUnit(), true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(GetEffectValue());
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_BLOOD_LINK_POWER, args);
PreventHitDefaultEffect(EFFECT_0); PreventHitDefaultEffect(EFFECT_0);
} }
@@ -1132,7 +1138,7 @@ class spell_deathbringer_rune_of_blood : public SpellScriptLoader
void HandleScript(SpellEffIndex effIndex) void HandleScript(SpellEffIndex effIndex)
{ {
PreventHitDefaultEffect(effIndex); // make this the default handler PreventHitDefaultEffect(effIndex); // make this the default handler
GetHitUnit()->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, 1, (Unit*)nullptr, true); GetHitUnit()->CastSpell(nullptr, SPELL_BLOOD_LINK_DUMMY, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(1));
} }
void Register() override void Register() override
@@ -1165,7 +1171,7 @@ class spell_deathbringer_blood_beast_blood_link : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{ {
PreventDefaultAction(); PreventDefaultAction();
eventInfo.GetProcTarget()->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, 3, (Unit*)nullptr, true, nullptr, aurEff); eventInfo.GetProcTarget()->CastSpell(nullptr, SPELL_BLOOD_LINK_DUMMY, CastSpellExtraArgs(aurEff).AddSpellBP0(3));
} }
void Register() override void Register() override
@@ -1197,7 +1203,7 @@ class spell_deathbringer_blood_nova : public SpellScriptLoader
void HandleScript(SpellEffIndex effIndex) void HandleScript(SpellEffIndex effIndex)
{ {
PreventHitDefaultEffect(effIndex); // make this the default handler PreventHitDefaultEffect(effIndex); // make this the default handler
GetHitUnit()->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, 2, (Unit*)nullptr, true); GetHitUnit()->CastSpell(nullptr, SPELL_BLOOD_LINK_DUMMY, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(2));
} }
void Register() override void Register() override
@@ -201,7 +201,7 @@ class boss_festergut : public CreatureScript
// just cast and dont bother with target, conditions will handle it // just cast and dont bother with target, conditions will handle it
++_inhaleCounter; ++_inhaleCounter;
if (_inhaleCounter < 3) if (_inhaleCounter < 3)
me->CastSpell(me, gaseousBlight[_inhaleCounter], true, nullptr, nullptr, me->GetGUID()); me->CastSpell(me, gaseousBlight[_inhaleCounter], me->GetGUID());
} }
events.ScheduleEvent(EVENT_INHALE_BLIGHT, urand(33500, 35000)); events.ScheduleEvent(EVENT_INHALE_BLIGHT, urand(33500, 35000));
@@ -236,7 +236,7 @@ class boss_festergut : public CreatureScript
case EVENT_GAS_SPORE: case EVENT_GAS_SPORE:
Talk(EMOTE_WARN_GAS_SPORE); Talk(EMOTE_WARN_GAS_SPORE);
Talk(EMOTE_GAS_SPORE); Talk(EMOTE_GAS_SPORE);
me->CastCustomSpell(SPELL_GAS_SPORE, SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 3, 2, 3), me); me->CastSpell(me, SPELL_GAS_SPORE, CastSpellExtraArgs().AddSpellMod(SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 3, 2, 3)));
events.ScheduleEvent(EVENT_GAS_SPORE, urand(40000, 45000)); events.ScheduleEvent(EVENT_GAS_SPORE, urand(40000, 45000));
events.RescheduleEvent(EVENT_VILE_GAS, urand(28000, 35000)); events.RescheduleEvent(EVENT_VILE_GAS, urand(28000, 35000));
break; break;
@@ -1847,7 +1847,9 @@ class spell_igb_rocket_pack : public SpellScriptLoader
void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{ {
SpellInfo const* damageInfo = sSpellMgr->AssertSpellInfo(SPELL_ROCKET_PACK_DAMAGE); SpellInfo const* damageInfo = sSpellMgr->AssertSpellInfo(SPELL_ROCKET_PACK_DAMAGE);
GetTarget()->CastCustomSpell(SPELL_ROCKET_PACK_DAMAGE, SPELLVALUE_BASE_POINT0, 2 * (damageInfo->Effects[EFFECT_0].CalcValue() + aurEff->GetTickNumber() * aurEff->GetAmplitude()), nullptr, TRIGGERED_FULL_MASK); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(2 * (damageInfo->Effects[EFFECT_0].CalcValue() + aurEff->GetTickNumber() * aurEff->GetAmplitude()));
GetTarget()->CastSpell(nullptr, SPELL_ROCKET_PACK_DAMAGE, args);
GetTarget()->CastSpell(nullptr, SPELL_ROCKET_BURST, TRIGGERED_FULL_MASK); GetTarget()->CastSpell(nullptr, SPELL_ROCKET_BURST, TRIGGERED_FULL_MASK);
} }
@@ -2253,7 +2255,9 @@ class spell_igb_burning_pitch : public SpellScriptLoader
void HandleDummy(SpellEffIndex effIndex) void HandleDummy(SpellEffIndex effIndex)
{ {
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
GetCaster()->CastCustomSpell(uint32(GetEffectValue()), SPELLVALUE_BASE_POINT0, 8000, nullptr, TRIGGERED_FULL_MASK); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(8000);
GetCaster()->CastSpell(nullptr, GetEffectValue(), args);
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_BURNING_PITCH, TRIGGERED_FULL_MASK); GetHitUnit()->CastSpell(GetHitUnit(), SPELL_BURNING_PITCH, TRIGGERED_FULL_MASK);
} }
@@ -2319,7 +2323,11 @@ class spell_igb_rocket_artillery_explosion : public SpellScriptLoader
void DamageGunship(SpellEffIndex /*effIndex*/) void DamageGunship(SpellEffIndex /*effIndex*/)
{ {
if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (InstanceScript* instance = GetCaster()->GetInstanceScript())
GetCaster()->CastCustomSpell(instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE ? SPELL_BURNING_PITCH_DAMAGE_A : SPELL_BURNING_PITCH_DAMAGE_H, SPELLVALUE_BASE_POINT0, 5000, nullptr, TRIGGERED_FULL_MASK); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(5000);
GetCaster()->CastSpell(nullptr, instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE ? SPELL_BURNING_PITCH_DAMAGE_A : SPELL_BURNING_PITCH_DAMAGE_H, args);
}
} }
void Register() override void Register() override
@@ -436,7 +436,9 @@ class boss_lady_deathwhisper : public CreatureScript
}) })
.Schedule(Seconds(12), GROUP_TWO, [this](TaskContext summonShade) .Schedule(Seconds(12), GROUP_TWO, [this](TaskContext summonShade)
{ {
me->CastCustomSpell(SPELL_SUMMON_SPIRITS, SPELLVALUE_MAX_TARGETS, Is25ManRaid() ? 2 : 1); CastSpellExtraArgs args;
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, Is25ManRaid() ? 2 : 1);
me->CastSpell(nullptr, SPELL_SUMMON_SPIRITS, args);
summonShade.Repeat(); summonShade.Repeat();
}); });
@@ -383,7 +383,7 @@ class boss_professor_putricide : public CreatureScript
me->SetSpeedRate(MOVE_RUN, _baseSpeed); me->SetSpeedRate(MOVE_RUN, _baseSpeed);
DoAction(ACTION_FESTERGUT_GAS); DoAction(ACTION_FESTERGUT_GAS);
if (Creature* festergut = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FESTERGUT))) if (Creature* festergut = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FESTERGUT)))
festergut->CastSpell(festergut, SPELL_GASEOUS_BLIGHT_LARGE, false, nullptr, nullptr, festergut->GetGUID()); festergut->CastSpell(festergut, SPELL_GASEOUS_BLIGHT_LARGE, CastSpellExtraArgs().SetOriginalCaster(festergut->GetGUID()));
break; break;
case POINT_ROTFACE: case POINT_ROTFACE:
instance->SetBossState(DATA_ROTFACE, IN_PROGRESS); // needed here for delayed gate close instance->SetBossState(DATA_ROTFACE, IN_PROGRESS); // needed here for delayed gate close
@@ -480,7 +480,7 @@ class boss_professor_putricide : public CreatureScript
case ACTION_ROTFACE_OOZE: case ACTION_ROTFACE_OOZE:
Talk(SAY_ROTFACE_OOZE_FLOOD); Talk(SAY_ROTFACE_OOZE_FLOOD);
if (Creature* dummy = ObjectAccessor::GetCreature(*me, _oozeFloodDummyGUIDs[_oozeFloodStage])) if (Creature* dummy = ObjectAccessor::GetCreature(*me, _oozeFloodDummyGUIDs[_oozeFloodStage]))
dummy->CastSpell(dummy, oozeFloodSpells[_oozeFloodStage], true, nullptr, nullptr, me->GetGUID()); // cast from self for LoS (with prof's GUID for logs) dummy->CastSpell(dummy, oozeFloodSpells[_oozeFloodStage], me->GetGUID()); // cast from self for LoS (with prof's GUID for logs)
if (++_oozeFloodStage == 4) if (++_oozeFloodStage == 4)
_oozeFloodStage = 0; _oozeFloodStage = 0;
break; break;
@@ -589,7 +589,7 @@ class boss_professor_putricide : public CreatureScript
EnterEvadeMode(); EnterEvadeMode();
break; break;
case EVENT_FESTERGUT_GOO: case EVENT_FESTERGUT_GOO:
me->CastCustomSpell(SPELL_MALLEABLE_GOO_SUMMON, SPELLVALUE_MAX_TARGETS, 1, nullptr, true); DoCastAOE(SPELL_MALLEABLE_GOO_SUMMON, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_MAX_TARGETS, 1));
events.ScheduleEvent(EVENT_FESTERGUT_GOO, (Is25ManRaid() ? 10000 : 30000) + urand(0, 5000), 0, PHASE_FESTERGUT); events.ScheduleEvent(EVENT_FESTERGUT_GOO, (Is25ManRaid() ? 10000 : 30000) + urand(0, 5000), 0, PHASE_FESTERGUT);
break; break;
case EVENT_ROTFACE_DIES: case EVENT_ROTFACE_DIES:
@@ -822,7 +822,9 @@ class npc_gas_cloud : public CreatureScript
void CastMainSpell() override void CastMainSpell() override
{ {
me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false); CastSpellExtraArgs args;
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, 10);
me->CastSpell(me, SPELL_GASEOUS_BLOAT, args);
} }
private: private:
@@ -851,7 +853,11 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader
{ {
target->RemoveAuraFromStack(GetSpellInfo()->Id, GetCasterGUID()); target->RemoveAuraFromStack(GetSpellInfo()->Id, GetCasterGUID());
if (!target->HasAura(GetId())) if (!target->HasAura(GetId()))
caster->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, caster, false); {
CastSpellExtraArgs args;
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, 10);
caster->CastSpell(caster, SPELL_GASEOUS_BLOAT, args);
}
} }
} }
@@ -865,7 +871,9 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader
for (uint8 i = 1; i <= stack; ++i) for (uint8 i = 1; i <= stack; ++i)
dmg += mod * i; dmg += mod * i;
caster->CastCustomSpell(SPELL_EXPUNGED_GAS, SPELLVALUE_BASE_POINT0, dmg); CastSpellExtraArgs args;
args.SpellValueOverrides.AddBP0(dmg);
caster->CastSpell(nullptr, SPELL_EXPUNGED_GAS, args);
} }
void Register() override void Register() override
@@ -1118,7 +1126,7 @@ class spell_putricide_ooze_tank_protection : public SpellScriptLoader
PreventDefaultAction(); PreventDefaultAction();
Unit* actionTarget = eventInfo.GetActionTarget(); Unit* actionTarget = eventInfo.GetActionTarget();
actionTarget->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, nullptr, aurEff); actionTarget->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, aurEff);
} }
void Register() override void Register() override
@@ -1152,7 +1160,7 @@ class spell_putricide_choking_gas_bomb : public SpellScriptLoader
continue; continue;
uint32 spellId = uint32(GetSpellInfo()->Effects[i].CalcValue()); uint32 spellId = uint32(GetSpellInfo()->Effects[i].CalcValue());
GetCaster()->CastSpell(GetCaster(), spellId, true, nullptr, nullptr, GetCaster()->GetGUID()); GetCaster()->CastSpell(GetCaster(), spellId, GetCaster()->GetGUID());
} }
} }
@@ -1323,7 +1331,10 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
damage *= int32(pow(multiplier, GetStackAmount())); damage *= int32(pow(multiplier, GetStackAmount()));
damage = int32(damage * 1.5f); damage = int32(damage * 1.5f);
GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, nullptr, aurEff, GetCasterGUID()); CastSpellExtraArgs args(aurEff);
args.OriginalCaster = GetCasterGUID();
args.SpellValueOverrides.AddBP0(damage);
GetTarget()->CastSpell(GetTarget(), triggerSpell, args);
} }
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1335,7 +1346,9 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
return; return;
int32 heal = healSpellInfo->Effects[0].CalcValue() * GetStackAmount(); int32 heal = healSpellInfo->Effects[0].CalcValue() * GetStackAmount();
GetTarget()->CastCustomSpell(healSpell, SPELLVALUE_BASE_POINT0, heal, GetTarget(), true, nullptr, nullptr, GetCasterGUID()); CastSpellExtraArgs args(GetCasterGUID());
args.SpellValueOverrides.AddBP0(heal);
GetTarget()->CastSpell(GetTarget(), healSpell, args);
} }
void Register() override void Register() override
@@ -473,7 +473,7 @@ class spell_rotface_ooze_flood : public SpellScriptLoader
return; return;
triggers.sort(Trinity::ObjectDistanceOrderPred(GetHitUnit())); triggers.sort(Trinity::ObjectDistanceOrderPred(GetHitUnit()));
GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, nullptr, nullptr, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : ObjectGuid::Empty); GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : ObjectGuid::Empty);
} }
void FilterTargets(std::list<WorldObject*>& targets) void FilterTargets(std::list<WorldObject*>& targets)
@@ -550,7 +550,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader
void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{ {
Unit* target = GetTarget(); Unit* target = GetTarget();
target->CastSpell(target, uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue()), true, nullptr, aurEff, GetCasterGUID()); target->CastSpell(target, uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue()), { aurEff, GetCasterGUID() });
} }
void Register() override void Register() override
@@ -678,7 +678,7 @@ class spell_rotface_large_ooze_buff_combine : public SpellScriptLoader
if (Creature* cre = GetCaster()->ToCreature()) if (Creature* cre = GetCaster()->ToCreature())
cre->AI()->DoAction(EVENT_STICKY_OOZE); cre->AI()->DoAction(EVENT_STICKY_OOZE);
GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, nullptr, nullptr, GetCaster()->GetGUID()); GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, CastSpellExtraArgs().SetOriginalCaster(GetCaster()->GetGUID()));
if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (InstanceScript* instance = GetCaster()->GetInstanceScript())
instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false)); instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false));
} }
@@ -759,7 +759,7 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader
// let Rotface handle the cast - caster dies before this executes // let Rotface handle the cast - caster dies before this executes
if (InstanceScript* script = GetCaster()->GetInstanceScript()) if (InstanceScript* script = GetCaster()->GetInstanceScript())
if (Creature* rotface = script->instance->GetCreature(script->GetGuidData(DATA_ROTFACE))) if (Creature* rotface = script->instance->GetCreature(script->GetGuidData(DATA_ROTFACE)))
rotface->CastSpell(x, y, z, triggered_spell_id, true, nullptr, nullptr, GetCaster()->GetGUID()); rotface->CastSpell({x, y, z}, triggered_spell_id, GetCaster()->GetGUID());
} }
void Register() override void Register() override
@@ -194,7 +194,7 @@ class FrostBombExplosion : public BasicEvent
bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override
{ {
_owner->CastSpell(nullptr, SPELL_FROST_BOMB, false, nullptr, nullptr, _sindragosaGUID); _owner->CastSpell(nullptr, SPELL_FROST_BOMB, CastSpellExtraArgs().SetOriginalCaster(_sindragosaGUID));
_owner->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL); _owner->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL);
return true; return true;
} }
@@ -368,11 +368,15 @@ class boss_sindragosa : public CreatureScript
events.ScheduleEvent(EVENT_AIR_MOVEMENT, 1); events.ScheduleEvent(EVENT_AIR_MOVEMENT, 1);
break; break;
case POINT_AIR_PHASE: case POINT_AIR_PHASE:
me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 5, 2, 6), nullptr, TRIGGERED_FULL_MASK); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 5, 2, 6));
me->CastSpell(nullptr, SPELL_ICE_TOMB_TARGET, args);
me->SetFacingTo(float(M_PI), true); me->SetFacingTo(float(M_PI), true);
events.ScheduleEvent(EVENT_AIR_MOVEMENT_FAR, 1); events.ScheduleEvent(EVENT_AIR_MOVEMENT_FAR, 1);
events.ScheduleEvent(EVENT_FROST_BOMB, 9000); events.ScheduleEvent(EVENT_FROST_BOMB, 9000);
break; break;
}
case POINT_AIR_PHASE_FAR: case POINT_AIR_PHASE_FAR:
me->SetFacingTo(float(M_PI), true); me->SetFacingTo(float(M_PI), true);
events.ScheduleEvent(EVENT_LAND, 30000); events.ScheduleEvent(EVENT_LAND, 30000);
@@ -507,9 +511,13 @@ class boss_sindragosa : public CreatureScript
me->GetMotionMaster()->MovePoint(POINT_AIR_PHASE_FAR, SindragosaAirPosFar); me->GetMotionMaster()->MovePoint(POINT_AIR_PHASE_FAR, SindragosaAirPosFar);
break; break;
case EVENT_ICE_TOMB: case EVENT_ICE_TOMB:
me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, 1, nullptr, TRIGGERED_FULL_MASK); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, 1);
me->CastSpell(nullptr, SPELL_ICE_TOMB_TARGET, args);
events.ScheduleEvent(EVENT_ICE_TOMB, urand(16000, 23000)); events.ScheduleEvent(EVENT_ICE_TOMB, urand(16000, 23000));
break; break;
}
case EVENT_FROST_BOMB: case EVENT_FROST_BOMB:
{ {
float destX, destY, destZ; float destX, destY, destZ;
@@ -517,7 +525,7 @@ class boss_sindragosa : public CreatureScript
destY = float(rand_norm()) * 75.0f + 2450.0f; destY = float(rand_norm()) * 75.0f + 2450.0f;
destZ = 205.0f; // random number close to ground, get exact in next call destZ = 205.0f; // random number close to ground, get exact in next call
me->UpdateGroundPositionZ(destX, destY, destZ); me->UpdateGroundPositionZ(destX, destY, destZ);
me->CastSpell(destX, destY, destZ, SPELL_FROST_BOMB_TRIGGER, false); me->CastSpell({ destX, destY, destZ }, SPELL_FROST_BOMB_TRIGGER, false);
events.ScheduleEvent(EVENT_FROST_BOMB, urand(6000, 8000)); events.ScheduleEvent(EVENT_FROST_BOMB, urand(6000, 8000));
break; break;
} }
@@ -1242,7 +1250,12 @@ class spell_sindragosa_instability : public SpellScriptLoader
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{ {
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
GetTarget()->CastCustomSpell(SPELL_BACKLASH, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, nullptr, aurEff, GetCasterGUID()); {
CastSpellExtraArgs args(aurEff);
args.OriginalCaster = GetCasterGUID();
args.SpellValueOverrides.AddBP0(aurEff->GetAmount());
GetTarget()->CastSpell(GetTarget(), SPELL_BACKLASH, args);
}
} }
void Register() override void Register() override
@@ -493,7 +493,7 @@ class TriggerWickedSpirit : public BasicEvent
bool Execute(uint64 /*time*/, uint32 /*diff*/) override bool Execute(uint64 /*time*/, uint32 /*diff*/) override
{ {
_owner->CastCustomSpell(SPELL_TRIGGER_VILE_SPIRIT_HEROIC, SPELLVALUE_MAX_TARGETS, 1, nullptr, true); _owner->CastSpell(nullptr, SPELL_TRIGGER_VILE_SPIRIT_HEROIC, { SPELLVALUE_MAX_TARGETS, 1 });
if (--_counter) if (--_counter)
{ {
@@ -2140,10 +2140,9 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader
return; return;
} }
CustomSpellValues values; CastSpellExtraArgs args(GetCasterGUID());
//values.AddSpellMod(SPELLVALUE_AURA_STACK, 2); args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, 1);
values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1); GetTarget()->CastSpell(nullptr, SPELL_NECROTIC_PLAGUE_JUMP, args);
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, nullptr, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID());
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
} }
@@ -2237,9 +2236,9 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
return; return;
} }
CustomSpellValues values; CastSpellExtraArgs args(GetCasterGUID());
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, GetStackAmount());
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, nullptr, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID()); GetTarget()->CastSpell(nullptr, SPELL_NECROTIC_PLAGUE_JUMP, args);
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
} }
@@ -2255,10 +2254,10 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
if (aurEff->GetAmount() > _lastAmount) if (aurEff->GetAmount() > _lastAmount)
return; return;
CustomSpellValues values; CastSpellExtraArgs args(GetCasterGUID());
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, GetStackAmount());
values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1) args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1)
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, nullptr, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID()); GetTarget()->CastSpell(nullptr, SPELL_NECROTIC_PLAGUE_JUMP, args);
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
@@ -2671,7 +2670,9 @@ class spell_the_lich_king_life_siphon : public SpellScriptLoader
void TriggerHeal() void TriggerHeal()
{ {
GetHitUnit()->CastCustomSpell(SPELL_LIFE_SIPHON_HEAL, SPELLVALUE_BASE_POINT0, GetHitDamage() * 10, GetCaster(), true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(GetHitDamage() * 10);
GetHitUnit()->CastSpell(GetCaster(), SPELL_LIFE_SIPHON_HEAL, args);
} }
void Register() override void Register() override
@@ -2711,7 +2712,7 @@ class spell_the_lich_king_vile_spirits : public SpellScriptLoader
void OnPeriodic(AuraEffect const* aurEff) void OnPeriodic(AuraEffect const* aurEff)
{ {
if (_is25Man || ((aurEff->GetTickNumber() - 1) % 5)) if (_is25Man || ((aurEff->GetTickNumber() - 1) % 5))
GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, nullptr, aurEff, GetCasterGUID()); GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, { aurEff, GetCasterGUID() });
} }
void Register() override void Register() override
@@ -2869,7 +2870,7 @@ class spell_the_lich_king_harvest_soul : public SpellScriptLoader
{ {
// m_originalCaster to allow stacking from different casters, meh // m_originalCaster to allow stacking from different casters, meh
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
GetTarget()->CastSpell(nullptr, SPELL_HARVESTED_SOUL, true, nullptr, nullptr, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING)); GetTarget()->CastSpell(nullptr, SPELL_HARVESTED_SOUL, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
} }
void Register() override void Register() override
@@ -2935,7 +2936,12 @@ class spell_the_lich_king_soul_rip : public SpellScriptLoader
PreventDefaultAction(); PreventDefaultAction();
// shouldn't be needed, this is channeled // shouldn't be needed, this is channeled
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastCustomSpell(SPELL_SOUL_RIP_DAMAGE, SPELLVALUE_BASE_POINT0, 5000 * aurEff->GetTickNumber(), GetTarget(), true, nullptr, aurEff, GetCasterGUID()); {
CastSpellExtraArgs args(aurEff);
args.OriginalCaster = GetCasterGUID();
args.SpellValueOverrides.AddBP0(5000 * aurEff->GetTickNumber());
caster->CastSpell(GetTarget(), SPELL_SOUL_RIP_DAMAGE, args);
}
} }
void Register() override void Register() override
@@ -3031,8 +3037,9 @@ class spell_the_lich_king_dark_hunger : public SpellScriptLoader
if (!damageInfo || !damageInfo->GetDamage()) if (!damageInfo || !damageInfo->GetDamage())
return; return;
int32 heal = static_cast<int32>(damageInfo->GetDamage()) / 2; CastSpellExtraArgs args(aurEff);
GetTarget()->CastCustomSpell(SPELL_DARK_HUNGER_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), true, nullptr, aurEff); args.SpellValueOverrides.AddBP0(damageInfo->GetDamage() / 2);
GetTarget()->CastSpell(GetTarget(), SPELL_DARK_HUNGER_HEAL, args);
} }
void Register() override void Register() override
@@ -3065,7 +3072,7 @@ class spell_the_lich_king_in_frostmourne_room : public SpellScriptLoader
{ {
// m_originalCaster to allow stacking from different casters, meh // m_originalCaster to allow stacking from different casters, meh
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
GetTarget()->CastSpell(nullptr, SPELL_HARVESTED_SOUL, true, nullptr, nullptr, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING)); GetTarget()->CastSpell(nullptr, SPELL_HARVESTED_SOUL, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
} }
void Register() override void Register() override
@@ -184,7 +184,7 @@ class DelayedCastEvent : public BasicEvent
bool Execute(uint64 /*time*/, uint32 /*diff*/) override bool Execute(uint64 /*time*/, uint32 /*diff*/) override
{ {
_trigger->CastSpell(_trigger, _spellId, false, nullptr, nullptr, _originalCaster); _trigger->CastSpell(_trigger, _spellId, _originalCaster);
if (_despawnTime) if (_despawnTime)
_trigger->DespawnOrUnsummon(_despawnTime); _trigger->DespawnOrUnsummon(_despawnTime);
return true; return true;
@@ -1112,7 +1112,7 @@ class npc_dream_cloud : public CreatureScript
case EVENT_EXPLODE: case EVENT_EXPLODE:
me->GetMotionMaster()->MoveIdle(); me->GetMotionMaster()->MoveIdle();
// must use originalCaster the same for all clouds to allow stacking // must use originalCaster the same for all clouds to allow stacking
me->CastSpell(me, EMERALD_VIGOR, false, nullptr, nullptr, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); me->CastSpell(me, EMERALD_VIGOR, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER));
me->DespawnOrUnsummon(100); me->DespawnOrUnsummon(100);
break; break;
default: default:
@@ -1240,7 +1240,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader
if (!GetHitUnit()) if (!GetHitUnit())
return; return;
GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING));
} }
void Register() override void Register() override
@@ -1331,7 +1331,7 @@ class spell_dreamwalker_summon_suppresser_effect : public SpellScriptLoader
if (!GetHitUnit()) if (!GetHitUnit())
return; return;
GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING));
} }
void Register() override void Register() override
@@ -1467,7 +1467,7 @@ class spell_dreamwalker_twisted_nightmares : public SpellScriptLoader
// return; // return;
if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) if (InstanceScript* instance = GetHitUnit()->GetInstanceScript())
GetHitUnit()->CastSpell(nullptr, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); GetHitUnit()->CastSpell(nullptr, GetSpellInfo()->Effects[effIndex].TriggerSpell, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER));
} }
void Register() override void Register() override
@@ -832,7 +832,7 @@ class boss_sister_svalna : public CreatureScript
switch (action) switch (action)
{ {
case ACTION_KILL_CAPTAIN: case ACTION_KILL_CAPTAIN:
me->CastCustomSpell(SPELL_CARESS_OF_DEATH, SPELLVALUE_MAX_TARGETS, 1, me, true); DoCastSelf(SPELL_CARESS_OF_DEATH, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellMod(SPELLVALUE_MAX_TARGETS, 1));
break; break;
case ACTION_START_GAUNTLET: case ACTION_START_GAUNTLET:
me->setActive(true); me->setActive(true);
@@ -887,7 +887,9 @@ class boss_sister_svalna : public CreatureScript
if (TempSummon* summon = target->SummonCreature(NPC_IMPALING_SPEAR, *target)) if (TempSummon* summon = target->SummonCreature(NPC_IMPALING_SPEAR, *target))
{ {
Talk(EMOTE_SVALNA_IMPALE, target); Talk(EMOTE_SVALNA_IMPALE, target);
summon->CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, 1, target, false); CastSpellExtraArgs args;
args.SpellValueOverrides.AddBP0(1);
summon->CastSpell(target, VEHICLE_SPELL_RIDE_HARDCODED, args);
summon->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_UNK1 | UNIT_FLAG2_ALLOW_ENEMY_INTERACT); summon->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_UNK1 | UNIT_FLAG2_ALLOW_ENEMY_INTERACT);
} }
break; break;
@@ -66,7 +66,7 @@ class icecrown_citadel_teleport : public GameObjectScript
return true; return true;
} }
player->CastSpell(player, spell, true); player->CastSpell(player, spell->Id, true);
return true; return true;
} }
}; };
@@ -143,7 +143,7 @@ public:
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->GetTypeId() == TYPEID_PLAYER)
victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCARABS_PLR, true, nullptr, nullptr, me->GetGUID()); victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCARABS_PLR, me->GetGUID());
Talk(SAY_SLAY); Talk(SAY_SLAY);
} }
@@ -199,7 +199,7 @@ public:
if (ObjectGuid target = Trinity::Containers::SelectRandomContainerElement(guardCorpses)) if (ObjectGuid target = Trinity::Containers::SelectRandomContainerElement(guardCorpses))
if (Creature* creatureTarget = ObjectAccessor::GetCreature(*me, target)) if (Creature* creatureTarget = ObjectAccessor::GetCreature(*me, target))
{ {
creatureTarget->CastSpell(creatureTarget, SPELL_SUMMON_CORPSE_SCARABS_MOB, true, nullptr, nullptr, me->GetGUID()); creatureTarget->CastSpell(creatureTarget, SPELL_SUMMON_CORPSE_SCARABS_MOB, me->GetGUID());
creatureTarget->AI()->Talk(EMOTE_SCARAB); creatureTarget->AI()->Talk(EMOTE_SCARAB);
creatureTarget->DespawnOrUnsummon(); creatureTarget->DespawnOrUnsummon();
} }
@@ -728,7 +728,11 @@ class spell_four_horsemen_mark : public SpellScriptLoader
break; break;
} }
if (damage) if (damage)
caster->CastCustomSpell(SPELL_MARK_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget()); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(damage);
caster->CastSpell(GetTarget(), SPELL_MARK_DAMAGE, args);
}
} }
} }
@@ -316,7 +316,11 @@ public:
{ {
int32 damage = int32(unit->GetHealth()) - int32(unit->CountPctFromMaxHealth(5)); int32 damage = int32(unit->GetHealth()) - int32(unit->CountPctFromMaxHealth(5));
if (damage > 0) if (damage > 0)
GetCaster()->CastCustomSpell(SPELL_DECIMATE_DMG, SPELLVALUE_BASE_POINT0, damage, unit); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(damage);
GetCaster()->CastSpell(unit, SPELL_DECIMATE_DMG, args);
}
} }
} }
@@ -163,7 +163,7 @@ class spell_grobbulus_mutating_injection : public SpellScriptLoader
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
{ {
caster->CastSpell(GetTarget(), SPELL_MUTATING_EXPLOSION, true); caster->CastSpell(GetTarget(), SPELL_MUTATING_EXPLOSION, true);
GetTarget()->CastSpell(GetTarget(), SPELL_POISON_CLOUD, true, nullptr, aurEff, GetCasterGUID()); GetTarget()->CastSpell(GetTarget(), SPELL_POISON_CLOUD, { aurEff, GetCasterGUID() });
} }
} }
@@ -202,7 +202,10 @@ class spell_grobbulus_poison_cloud : public SpellScriptLoader
uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3); int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3);
GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, mod, (Unit*)nullptr, TRIGGERED_FULL_MASK, nullptr, aurEff);
CastSpellExtraArgs args(aurEff);
args.SpellValueOverrides.AddMod(SPELLVALUE_RADIUS_MOD, mod);
GetTarget()->CastSpell(nullptr, triggerSpell, args);
} }
void Register() override void Register() override
@@ -928,7 +928,9 @@ public:
if (int32 mana = int32(target->GetMaxPower(POWER_MANA) / 10)) if (int32 mana = int32(target->GetMaxPower(POWER_MANA) / 10))
{ {
mana = target->ModifyPower(POWER_MANA, -mana); mana = target->ModifyPower(POWER_MANA, -mana);
target->CastCustomSpell(SPELL_MANA_DETONATION_DAMAGE, SPELLVALUE_BASE_POINT0, -mana * 10, target, true, nullptr, aurEff); CastSpellExtraArgs args(aurEff);
args.SpellValueOverrides.AddBP0(-mana * 10);
target->CastSpell(target, SPELL_MANA_DETONATION_DAMAGE, args);
} }
} }
@@ -960,7 +962,11 @@ class spell_kelthuzad_frost_blast : public AuraScript
// Stuns the target, dealing 26% of the target's maximum health in Frost damage every second for 4 sec. // Stuns the target, dealing 26% of the target's maximum health in Frost damage every second for 4 sec.
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastCustomSpell(SPELL_FROST_BLAST_DMG, SPELLVALUE_BASE_POINT0, int32(GetTarget()->CountPctFromMaxHealth(26)), GetTarget(), true, nullptr, aurEff); {
CastSpellExtraArgs args(aurEff);
args.SpellValueOverrides.AddBP0(GetTarget()->CountPctFromMaxHealth(26));
caster->CastSpell(GetTarget(), SPELL_FROST_BLAST_DMG, args);
}
} }
void Register() override void Register() override
@@ -181,7 +181,7 @@ class spell_loatheb_deathbloom : public SpellScriptLoader
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return; return;
GetTarget()->CastSpell(nullptr, SPELL_DEATHBLOOM_FINAL_DAMAGE, true, nullptr, eff, GetCasterGUID()); GetTarget()->CastSpell(nullptr, SPELL_DEATHBLOOM_FINAL_DAMAGE, CastSpellExtraArgs(eff).SetOriginalCaster(GetCasterGUID()));
} }
void Register() override void Register() override
@@ -221,7 +221,7 @@ public:
if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID)) if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID))
{ {
visibleTimer = (me->GetDistance2d(victim)/WEB_WRAP_MOVE_SPEED + 0.5f) * IN_MILLISECONDS; visibleTimer = (me->GetDistance2d(victim)/WEB_WRAP_MOVE_SPEED + 0.5f) * IN_MILLISECONDS;
victim->CastSpell(victim, SPELL_WEB_WRAP, true, nullptr, nullptr, me->GetGUID()); victim->CastSpell(victim, SPELL_WEB_WRAP, me->GetGUID());
} }
} }
@@ -778,14 +778,12 @@ public:
switch (eventId) switch (eventId)
{ {
case EVENT_START_FIRST_RANDOM_PORTAL: case EVENT_START_FIRST_RANDOM_PORTAL:
me->CastCustomSpell(SPELL_RANDOM_PORTAL, SPELLVALUE_MAX_TARGETS, 1); case EVENT_RANDOM_PORTAL:
DoCastAOE(SPELL_RANDOM_PORTAL, { SPELLVALUE_MAX_TARGETS,1 });
break; break;
case EVENT_STOP_PORTAL_BEAM: case EVENT_STOP_PORTAL_BEAM:
me->InterruptNonMeleeSpells(true); me->InterruptNonMeleeSpells(true);
break; break;
case EVENT_RANDOM_PORTAL:
me->CastCustomSpell(SPELL_RANDOM_PORTAL, SPELLVALUE_MAX_TARGETS, 1);
break;
case EVENT_LAND_START_ENCOUNTER: case EVENT_LAND_START_ENCOUNTER:
if (GameObject* iris = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_FOCUSING_IRIS_GUID))) if (GameObject* iris = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_FOCUSING_IRIS_GUID)))
{ {
@@ -2026,7 +2024,7 @@ class spell_scion_of_eternity_arcane_barrage : public SpellScriptLoader
void TriggerDamageSpellFromPlayer() void TriggerDamageSpellFromPlayer()
{ {
if (Player* hitTarget = GetHitPlayer()) if (Player* hitTarget = GetHitPlayer())
hitTarget->CastSpell(hitTarget, SPELL_ARCANE_BARRAGE_DAMAGE, true, nullptr, nullptr, GetCaster()->GetGUID()); hitTarget->CastSpell(hitTarget, SPELL_ARCANE_BARRAGE_DAMAGE, GetCaster()->GetGUID());
} }
void Register() override void Register() override
@@ -202,7 +202,7 @@ public:
summoned->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f); summoned->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f);
// Why healing when just summoned? // Why healing when just summoned?
summoned->CastSpell(summoned, SPELL_HEAT, false, nullptr, nullptr, me->GetGUID()); summoned->CastSpell(summoned, SPELL_HEAT, CastSpellExtraArgs().SetOriginalCaster(me->GetGUID()));
} }
} }
@@ -736,7 +736,7 @@ class spell_assembly_rune_of_summoning : public SpellScriptLoader
void HandlePeriodic(AuraEffect const* aurEff) void HandlePeriodic(AuraEffect const* aurEff)
{ {
PreventDefaultAction(); PreventDefaultAction();
GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, nullptr, aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : ObjectGuid::Empty); GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, { aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : ObjectGuid::Empty });
} }
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1008,7 +1008,7 @@ public:
{ {
if (Creature* trigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) if (Creature* trigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN))
{ {
trigger->CastSpell(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), SPELL_MIMIRON_S_INFERNO, true); trigger->CastSpell(me->GetPosition(), SPELL_MIMIRON_S_INFERNO, true);
infernoTimer = 2000; infernoTimer = 2000;
} }
} }
@@ -379,7 +379,9 @@ class boss_freya : public CreatureScript
else else
Talk(SAY_AGGRO_WITH_ELDER); Talk(SAY_AGGRO_WITH_ELDER);
me->CastCustomSpell(SPELL_ATTUNED_TO_NATURE, SPELLVALUE_AURA_STACK, 150, me, true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, 150);
me->CastSpell(me, SPELL_ATTUNED_TO_NATURE, args);
events.ScheduleEvent(EVENT_WAVE, 10000); events.ScheduleEvent(EVENT_WAVE, 10000);
events.ScheduleEvent(EVENT_EONAR_GIFT, 25000); events.ScheduleEvent(EVENT_EONAR_GIFT, 25000);
@@ -754,7 +756,9 @@ class boss_elder_brightleaf : public CreatureScript
uint8 stackAmount = 0; uint8 stackAmount = 0;
if (Aura* aura = me->GetAura(SPELL_FLUX_AURA)) if (Aura* aura = me->GetAura(SPELL_FLUX_AURA))
stackAmount = aura->GetStackAmount(); stackAmount = aura->GetStackAmount();
me->CastCustomSpell(SPELL_SOLAR_FLARE, SPELLVALUE_MAX_TARGETS, stackAmount, me, false); CastSpellExtraArgs args;
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, stackAmount);
me->CastSpell(me, SPELL_SOLAR_FLARE, args);
events.ScheduleEvent(EVENT_SOLAR_FLARE, urand(5000, 10000)); events.ScheduleEvent(EVENT_SOLAR_FLARE, urand(5000, 10000));
break; break;
} }
@@ -839,8 +843,9 @@ class boss_elder_stonebark : public CreatureScript
if (me->HasAura(SPELL_PETRIFIED_BARK)) if (me->HasAura(SPELL_PETRIFIED_BARK))
{ {
int32 reflect = damage; CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
who->CastCustomSpell(who, SPELL_PETRIFIED_BARK_DMG, &reflect, nullptr, nullptr, true); args.SpellValueOverrides.AddBP0(damage);
who->CastSpell(who, SPELL_PETRIFIED_BARK_DMG, args);
damage = 0; damage = 0;
} }
} }
@@ -465,7 +465,11 @@ class spell_general_vezax_mark_of_the_faceless : public SpellScriptLoader
void HandleEffectPeriodic(AuraEffect const* aurEff) void HandleEffectPeriodic(AuraEffect const* aurEff)
{ {
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
caster->CastCustomSpell(SPELL_MARK_OF_THE_FACELESS_DAMAGE, SPELLVALUE_BASE_POINT1, aurEff->GetAmount(), GetTarget(), true); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT1, aurEff->GetAmount());
caster->CastSpell(GetTarget(), SPELL_MARK_OF_THE_FACELESS_DAMAGE, args);
}
} }
void Register() override void Register() override
@@ -528,9 +532,11 @@ class spell_general_vezax_saronite_vapors : public SpellScriptLoader
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
{ {
int32 mana = int32(aurEff->GetAmount() * std::pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount int32 mana = int32(aurEff->GetAmount() * std::pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount
int32 damage = mana * 2; CastSpellExtraArgs args1(TRIGGERED_FULL_MASK), args2(TRIGGERED_FULL_MASK);
caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_ENERGIZE, &mana, nullptr, nullptr, true); args1.SpellValueOverrides.AddBP0(mana);
caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DAMAGE, &damage, nullptr, nullptr, true); args2.SpellValueOverrides.AddBP0(mana * 2);
caster->CastSpell(GetTarget(), SPELL_SARONITE_VAPORS_ENERGIZE, args1);
caster->CastSpell(GetTarget(), SPELL_SARONITE_VAPORS_DAMAGE, args2);
} }
} }
@@ -1049,7 +1049,9 @@ public:
return; return;
int32 damage = int32(200 * std::pow(2.0f, GetStackAmount())); int32 damage = int32(200 * std::pow(2.0f, GetStackAmount()));
caster->CastCustomSpell(caster, SPELL_BITING_COLD_DAMAGE, &damage, nullptr, nullptr, true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(damage);
caster->CastSpell(caster, SPELL_BITING_COLD_DAMAGE, args);
if (caster->isMoving()) if (caster->isMoving())
caster->RemoveAuraFromStack(SPELL_BITING_COLD_TRIGGERED); caster->RemoveAuraFromStack(SPELL_BITING_COLD_TRIGGERED);
@@ -344,7 +344,7 @@ class spell_ulduar_rubble_summon : public SpellScriptLoader
ObjectGuid originalCaster = caster->GetInstanceScript() ? caster->GetInstanceScript()->GetGuidData(BOSS_KOLOGARN) : ObjectGuid::Empty; ObjectGuid originalCaster = caster->GetInstanceScript() ? caster->GetInstanceScript()->GetGuidData(BOSS_KOLOGARN) : ObjectGuid::Empty;
uint32 spellId = GetEffectValue(); uint32 spellId = GetEffectValue();
for (uint8 i = 0; i < 5; ++i) for (uint8 i = 0; i < 5; ++i)
caster->CastSpell(caster, spellId, true, nullptr, nullptr, originalCaster); caster->CastSpell(caster, spellId, originalCaster);
} }
void Register() override void Register() override
@@ -495,7 +495,7 @@ class boss_mimiron : public CreatureScript
{ {
case EVENT_SUMMON_FLAMES: case EVENT_SUMMON_FLAMES:
if (Creature* worldtrigger = instance->GetCreature(DATA_MIMIRON_WORLD_TRIGGER)) if (Creature* worldtrigger = instance->GetCreature(DATA_MIMIRON_WORLD_TRIGGER))
worldtrigger->CastCustomSpell(SPELL_SCRIPT_EFFECT_SUMMON_FLAMES_INITIAL, SPELLVALUE_MAX_TARGETS, 3, nullptr, true, nullptr, nullptr, me->GetGUID()); worldtrigger->CastSpell(nullptr, SPELL_SCRIPT_EFFECT_SUMMON_FLAMES_INITIAL, CastSpellExtraArgs(me->GetGUID()).AddSpellMod(SPELLVALUE_MAX_TARGETS, 3));
events.RescheduleEvent(EVENT_SUMMON_FLAMES, 28000); events.RescheduleEvent(EVENT_SUMMON_FLAMES, 28000);
break; break;
case EVENT_INTRO_1: case EVENT_INTRO_1:
@@ -1233,15 +1233,15 @@ class boss_aerial_command_unit : public CreatureScript
switch (eventId) switch (eventId)
{ {
case EVENT_SUMMON_FIRE_BOTS: case EVENT_SUMMON_FIRE_BOTS:
me->CastCustomSpell(SPELL_SUMMON_FIRE_BOT_TRIGGER, SPELLVALUE_MAX_TARGETS, 3, nullptr, true); DoCastAOE(SPELL_SUMMON_FIRE_BOT_TRIGGER, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellMod(SPELLVALUE_MAX_TARGETS, 3));
events.RescheduleEvent(EVENT_SUMMON_FIRE_BOTS, 45000, 0, PHASE_AERIAL_COMMAND_UNIT); events.RescheduleEvent(EVENT_SUMMON_FIRE_BOTS, 45000, 0, PHASE_AERIAL_COMMAND_UNIT);
break; break;
case EVENT_SUMMON_JUNK_BOT: case EVENT_SUMMON_JUNK_BOT:
me->CastCustomSpell(SPELL_SUMMON_JUNK_BOT_TRIGGER, SPELLVALUE_MAX_TARGETS, 1, nullptr, true); DoCastAOE(SPELL_SUMMON_JUNK_BOT_TRIGGER, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellMod(SPELLVALUE_MAX_TARGETS, 1));
events.RescheduleEvent(EVENT_SUMMON_JUNK_BOT, urand(11000, 12000), 0, PHASE_AERIAL_COMMAND_UNIT); events.RescheduleEvent(EVENT_SUMMON_JUNK_BOT, urand(11000, 12000), 0, PHASE_AERIAL_COMMAND_UNIT);
break; break;
case EVENT_SUMMON_ASSAULT_BOT: case EVENT_SUMMON_ASSAULT_BOT:
me->CastCustomSpell(SPELL_SUMMON_ASSAULT_BOT_TRIGGER, SPELLVALUE_MAX_TARGETS, 1, nullptr, true); DoCastAOE(SPELL_SUMMON_ASSAULT_BOT_TRIGGER, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellMod(SPELLVALUE_MAX_TARGETS, 1));
events.RescheduleEvent(EVENT_SUMMON_ASSAULT_BOT, 30000, 0, PHASE_AERIAL_COMMAND_UNIT); events.RescheduleEvent(EVENT_SUMMON_ASSAULT_BOT, 30000, 0, PHASE_AERIAL_COMMAND_UNIT);
break; break;
case EVENT_SUMMON_BOMB_BOT: case EVENT_SUMMON_BOMB_BOT:
@@ -2169,7 +2169,7 @@ class spell_mimiron_rapid_burst : public SpellScriptLoader
void HandleDummyTick(AuraEffect const* aurEff) void HandleDummyTick(AuraEffect const* aurEff)
{ {
if (GetCaster()) if (GetCaster())
GetCaster()->CastSpell(GetTarget(), aurEff->GetTickNumber() % 2 == 0 ? SPELL_RAPID_BURST_RIGHT : SPELL_RAPID_BURST_LEFT, true, nullptr, aurEff); GetCaster()->CastSpell(GetTarget(), aurEff->GetTickNumber() % 2 == 0 ? SPELL_RAPID_BURST_RIGHT : SPELL_RAPID_BURST_LEFT, aurEff);
} }
void Register() override void Register() override
@@ -2215,7 +2215,7 @@ class spell_mimiron_rocket_strike : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/) void HandleDummy(SpellEffIndex /*effIndex*/)
{ {
GetHitUnit()->CastSpell(nullptr, SPELL_SCRIPT_EFFECT_ROCKET_STRIKE, true, nullptr, nullptr, GetCaster()->GetGUID()); GetHitUnit()->CastSpell(nullptr, SPELL_SCRIPT_EFFECT_ROCKET_STRIKE, GetCaster()->GetGUID());
} }
void Register() override void Register() override
@@ -2313,7 +2313,7 @@ class spell_mimiron_rocket_strike_target_select : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{ {
if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (InstanceScript* instance = GetCaster()->GetInstanceScript())
GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_ROCKET_STRIKE, true, nullptr, nullptr, instance->GetGuidData(DATA_VX_001)); GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_ROCKET_STRIKE, instance->GetGuidData(DATA_VX_001));
GetCaster()->SetDisplayId(11686); GetCaster()->SetDisplayId(11686);
} }
@@ -2407,7 +2407,7 @@ class spell_mimiron_summon_assault_bot : public SpellScriptLoader
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
if (InstanceScript* instance = caster->GetInstanceScript()) if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS) if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS)
caster->CastSpell(caster, SPELL_SUMMON_ASSAULT_BOT, false, nullptr, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)); caster->CastSpell(caster, SPELL_SUMMON_ASSAULT_BOT, { aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT) });
} }
void Register() override void Register() override
@@ -2474,7 +2474,7 @@ class spell_mimiron_summon_fire_bot : public SpellScriptLoader
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
if (InstanceScript* instance = caster->GetInstanceScript()) if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS) if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS)
caster->CastSpell(caster, SPELL_SUMMON_FIRE_BOT, false, nullptr, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)); caster->CastSpell(caster, SPELL_SUMMON_FIRE_BOT, { aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT) });
} }
void Register() override void Register() override
@@ -2662,7 +2662,7 @@ class spell_mimiron_summon_junk_bot : public SpellScriptLoader
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
if (InstanceScript* instance = caster->GetInstanceScript()) if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS) if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS)
caster->CastSpell(caster, SPELL_SUMMON_JUNK_BOT, false, nullptr, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT)); caster->CastSpell(caster, SPELL_SUMMON_JUNK_BOT, { aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT) });
} }
void Register() override void Register() override
@@ -964,7 +964,7 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader
{ {
uint8 a = urand(0, 4); uint8 a = urand(0, 4);
uint32 spellId = spells[a]; uint32 spellId = spells[a];
toyPile->CastSpell(toyPile, spellId, true, nullptr, nullptr, instance->GetGuidData(BOSS_XT002)); toyPile->CastSpell(toyPile, spellId, instance->GetGuidData(BOSS_XT002));
} }
} }
} }
@@ -519,7 +519,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
me->CastCustomSpell(SPELL_SUMMON_GUARDIAN_2, SPELLVALUE_MAX_TARGETS, 1); DoCastAOE(SPELL_SUMMON_GUARDIAN_2, { SPELLVALUE_MAX_TARGETS, 1 });
DoCast(me, SPELL_SANITY_PERIODIC); DoCast(me, SPELL_SANITY_PERIODIC);
events.ScheduleEvent(EVENT_LOCK_DOOR, 15000); events.ScheduleEvent(EVENT_LOCK_DOOR, 15000);
@@ -563,7 +563,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
events.ScheduleEvent(EVENT_EXTINGUISH_ALL_LIFE, 10000); // cast it again after a short while, players can survive events.ScheduleEvent(EVENT_EXTINGUISH_ALL_LIFE, 10000); // cast it again after a short while, players can survive
break; break;
case EVENT_SUMMON_GUARDIAN_OF_YOGG_SARON: case EVENT_SUMMON_GUARDIAN_OF_YOGG_SARON:
me->CastCustomSpell(SPELL_SUMMON_GUARDIAN_2, SPELLVALUE_MAX_TARGETS, 1); DoCastAOE(SPELL_SUMMON_GUARDIAN_2, { SPELLVALUE_MAX_TARGETS, 1 });
++_guardiansCount; ++_guardiansCount;
if (_guardiansCount <= 6 && _guardiansCount % 3 == 0) if (_guardiansCount <= 6 && _guardiansCount % 3 == 0)
_guardianTimer -= 5000; _guardianTimer -= 5000;
@@ -574,7 +574,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
events.ScheduleEvent(EVENT_SUMMON_CORRUPTOR_TENTACLE, 30000, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); events.ScheduleEvent(EVENT_SUMMON_CORRUPTOR_TENTACLE, 30000, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO);
break; break;
case EVENT_SUMMON_CONSTRICTOR_TENTACLE: case EVENT_SUMMON_CONSTRICTOR_TENTACLE:
me->CastCustomSpell(SPELL_CONSTRICTOR_TENTACLE, SPELLVALUE_MAX_TARGETS, 1); DoCastAOE(SPELL_CONSTRICTOR_TENTACLE, { SPELLVALUE_MAX_TARGETS, 1 });
events.ScheduleEvent(EVENT_SUMMON_CONSTRICTOR_TENTACLE, 25000, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO); events.ScheduleEvent(EVENT_SUMMON_CONSTRICTOR_TENTACLE, 25000, EVENT_GROUP_SUMMON_TENTACLES, PHASE_TWO);
break; break;
case EVENT_SUMMON_CRUSHER_TENTACLE: case EVENT_SUMMON_CRUSHER_TENTACLE:
@@ -796,15 +796,15 @@ class boss_sara : public CreatureScript
switch (eventId) switch (eventId)
{ {
case EVENT_SARAS_FERVOR: case EVENT_SARAS_FERVOR:
me->CastCustomSpell(SPELL_SARAS_FERVOR_TARGET_SELECTOR, SPELLVALUE_MAX_TARGETS, 1); DoCastAOE(SPELL_SARAS_FERVOR_TARGET_SELECTOR, { SPELLVALUE_MAX_TARGETS, 1 });
_events.ScheduleEvent(EVENT_SARAS_FERVOR, 6000, 0, PHASE_ONE); _events.ScheduleEvent(EVENT_SARAS_FERVOR, 6000, 0, PHASE_ONE);
break; break;
case EVENT_SARAS_ANGER: case EVENT_SARAS_ANGER:
me->CastCustomSpell(SPELL_SARAS_ANGER_TARGET_SELECTOR, SPELLVALUE_MAX_TARGETS, 1); DoCastAOE(SPELL_SARAS_ANGER_TARGET_SELECTOR, { SPELLVALUE_MAX_TARGETS, 1 });
_events.ScheduleEvent(EVENT_SARAS_ANGER, urand(6000, 8000), 0, PHASE_ONE); _events.ScheduleEvent(EVENT_SARAS_ANGER, urand(6000, 8000), 0, PHASE_ONE);
break; break;
case EVENT_SARAS_BLESSING: case EVENT_SARAS_BLESSING:
me->CastCustomSpell(SPELL_SARAS_BLESSING_TARGET_SELECTOR, SPELLVALUE_MAX_TARGETS, 1); DoCastAOE(SPELL_SARAS_BLESSING_TARGET_SELECTOR, { SPELLVALUE_MAX_TARGETS, 1 });
_events.ScheduleEvent(EVENT_SARAS_BLESSING, urand(6000, 30000), 0, PHASE_ONE); _events.ScheduleEvent(EVENT_SARAS_BLESSING, urand(6000, 30000), 0, PHASE_ONE);
break; break;
case EVENT_TRANSFORM_1: case EVENT_TRANSFORM_1:
@@ -838,15 +838,15 @@ class boss_sara : public CreatureScript
_events.ScheduleEvent(EVENT_DEATH_RAY, 21000, 0, PHASE_TWO); _events.ScheduleEvent(EVENT_DEATH_RAY, 21000, 0, PHASE_TWO);
break; break;
case EVENT_MALADY_OF_THE_MIND: case EVENT_MALADY_OF_THE_MIND:
me->CastCustomSpell(SPELL_MALADY_OF_THE_MIND, SPELLVALUE_MAX_TARGETS, 1); DoCastAOE(SPELL_MALADY_OF_THE_MIND, { SPELLVALUE_MAX_TARGETS, 1 });
_events.ScheduleEvent(EVENT_MALADY_OF_THE_MIND, urand(18000, 25000), 0, PHASE_TWO); _events.ScheduleEvent(EVENT_MALADY_OF_THE_MIND, urand(18000, 25000), 0, PHASE_TWO);
break; break;
case EVENT_PSYCHOSIS: case EVENT_PSYCHOSIS:
me->CastCustomSpell(SPELL_PSYCHOSIS, SPELLVALUE_MAX_TARGETS, 1); DoCastAOE(SPELL_PSYCHOSIS, { SPELLVALUE_MAX_TARGETS, 1 });
_events.ScheduleEvent(EVENT_PSYCHOSIS, 4000, 0, PHASE_TWO); _events.ScheduleEvent(EVENT_PSYCHOSIS, 4000, 0, PHASE_TWO);
break; break;
case EVENT_BRAIN_LINK: case EVENT_BRAIN_LINK:
me->CastCustomSpell(SPELL_BRAIN_LINK, SPELLVALUE_MAX_TARGETS, 2); DoCastAOE(SPELL_BRAIN_LINK, { SPELLVALUE_MAX_TARGETS, 2 });
_events.ScheduleEvent(EVENT_BRAIN_LINK, urand(23000, 26000), 0, PHASE_TWO); _events.ScheduleEvent(EVENT_BRAIN_LINK, urand(23000, 26000), 0, PHASE_TWO);
break; break;
default: default:
@@ -1642,7 +1642,7 @@ class npc_yogg_saron_keeper : public CreatureScript
switch (eventId) switch (eventId)
{ {
case EVENT_DESTABILIZATION_MATRIX: case EVENT_DESTABILIZATION_MATRIX:
me->CastCustomSpell(SPELL_DESTABILIZATION_MATRIX, SPELLVALUE_MAX_TARGETS, 1); DoCastAOE(SPELL_DESTABILIZATION_MATRIX, { SPELLVALUE_MAX_TARGETS, 1 });
_events.ScheduleEvent(EVENT_DESTABILIZATION_MATRIX, urand(15000, 25000), 0, PHASE_TWO); _events.ScheduleEvent(EVENT_DESTABILIZATION_MATRIX, urand(15000, 25000), 0, PHASE_TWO);
break; break;
case EVENT_HODIRS_PROTECTIVE_GAZE: case EVENT_HODIRS_PROTECTIVE_GAZE:
@@ -2496,7 +2496,9 @@ class spell_yogg_saron_empowered : public SpellScriptLoader // 64161
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
GetTarget()->CastCustomSpell(SPELL_EMPOWERED_BUFF, SPELLVALUE_AURA_STACK, 9, GetTarget(), TRIGGERED_FULL_MASK); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, 9);
GetTarget()->CastSpell(GetTarget(), SPELL_EMPOWERED_BUFF, args);
} }
void OnPeriodic(AuraEffect const* /*aurEff*/) void OnPeriodic(AuraEffect const* /*aurEff*/)
@@ -2508,7 +2510,9 @@ class spell_yogg_saron_empowered : public SpellScriptLoader // 64161
if (stack) if (stack)
{ {
target->RemoveAurasDueToSpell(SPELL_WEAKENED); target->RemoveAurasDueToSpell(SPELL_WEAKENED);
target->CastCustomSpell(SPELL_EMPOWERED_BUFF, SPELLVALUE_AURA_STACK, stack, target, TRIGGERED_FULL_MASK); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, stack);
target->CastSpell(target, SPELL_EMPOWERED_BUFF, args);
} }
else if (!target->HealthAbovePct(1) && !target->HasAura(SPELL_WEAKENED)) else if (!target->HealthAbovePct(1) && !target->HasAura(SPELL_WEAKENED))
target->CastSpell(target, SPELL_WEAKENED, true); target->CastSpell(target, SPELL_WEAKENED, true);
@@ -2736,8 +2740,9 @@ class spell_yogg_saron_grim_reprisal : public SpellScriptLoader // 63305
if (!damageInfo || !damageInfo->GetDamage()) if (!damageInfo || !damageInfo->GetDamage())
return; return;
int32 damage = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), 60); CastSpellExtraArgs args(aurEff);
GetTarget()->CastCustomSpell(SPELL_GRIM_REPRISAL_DAMAGE, SPELLVALUE_BASE_POINT0, damage, damageInfo->GetAttacker(), true, nullptr, aurEff); args.SpellValueOverrides.AddBP0(CalculatePct(damageInfo->GetDamage(), 60));
GetTarget()->CastSpell(damageInfo->GetAttacker(), SPELL_GRIM_REPRISAL_DAMAGE, args);
} }
void Register() override void Register() override
@@ -470,7 +470,7 @@ class spell_ingvar_woe_strike : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{ {
PreventDefaultAction(); PreventDefaultAction();
GetTarget()->CastSpell(eventInfo.GetActor(), SPELL_WOE_STRIKE_EFFECT, true, nullptr, aurEff); GetTarget()->CastSpell(eventInfo.GetActor(), SPELL_WOE_STRIKE_EFFECT, aurEff);
} }
void Register() override void Register() override
@@ -223,7 +223,7 @@ class spell_uk_second_wind : public SpellScriptLoader
{ {
PreventDefaultAction(); PreventDefaultAction();
Unit* caster = eventInfo.GetActionTarget(); Unit* caster = eventInfo.GetActionTarget();
caster->CastSpell(caster, SPELL_SECOND_WIND_TRIGGER, true, nullptr, aurEff); caster->CastSpell(caster, SPELL_SECOND_WIND_TRIGGER, aurEff);
} }
void Register() override void Register() override
@@ -132,7 +132,7 @@ public:
bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) override bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) override
{ {
_owner->CastCustomSpell(SPELL_AWAKEN_SUBBOSS, SPELLVALUE_MAX_TARGETS, 1, _owner); _owner->CastSpell(_owner, SPELL_AWAKEN_SUBBOSS, { SPELLVALUE_MAX_TARGETS, 1 });
return true; return true;
} }
@@ -287,7 +287,7 @@ public:
if (_encountersCount == _dungeonMode) if (_encountersCount == _dungeonMode)
orb->CastSpell(orb, SPELL_AWAKEN_GORTOK, true); orb->CastSpell(orb, SPELL_AWAKEN_GORTOK, true);
else else
orb->CastCustomSpell(SPELL_AWAKEN_SUBBOSS, SPELLVALUE_MAX_TARGETS, 1, orb, true); orb->CastSpell(orb, SPELL_AWAKEN_SUBBOSS, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellMod(SPELLVALUE_MAX_TARGETS, 1));
break; break;
} }
case ACTION_START_FIGHT: case ACTION_START_FIGHT:
@@ -201,7 +201,7 @@ class spell_koralon_meteor_fists : public SpellScriptLoader
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo) void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{ {
PreventDefaultAction(); PreventDefaultAction();
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_METEOR_FISTS_DAMAGE, true, nullptr, aurEff); GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_METEOR_FISTS_DAMAGE, aurEff);
} }
void Register() override void Register() override
@@ -276,7 +276,7 @@ class spell_flame_warder_meteor_fists : public SpellScriptLoader
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo) void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{ {
PreventDefaultAction(); PreventDefaultAction();
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, true, nullptr, aurEff); GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, aurEff);
} }
void Register() override void Register() override
@@ -78,9 +78,11 @@ struct boss_toravon : public BossAI
switch (eventId) switch (eventId)
{ {
case EVENT_FROZEN_ORB: case EVENT_FROZEN_ORB:
me->CastCustomSpell(SPELL_FROZEN_ORB, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 3), me); {
me->CastSpell(me, SPELL_FROZEN_ORB, CastSpellExtraArgs().AddSpellMod(SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 3)));
events.Repeat(Seconds(32)); events.Repeat(Seconds(32));
break; break;
}
case EVENT_WHITEOUT: case EVENT_WHITEOUT:
DoCastSelf(SPELL_WHITEOUT); DoCastSelf(SPELL_WHITEOUT);
events.Repeat(Seconds(38)); events.Repeat(Seconds(38));
@@ -122,7 +122,7 @@ class spell_moragg_ray : public SpellScriptLoader
if (Unit* target = GetTarget()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) if (Unit* target = GetTarget()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true))
{ {
uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
GetTarget()->CastSpell(target, triggerSpell, TRIGGERED_FULL_MASK, nullptr, aurEff); GetTarget()->CastSpell(target, triggerSpell, aurEff);
} }
} }
@@ -152,12 +152,12 @@ public:
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
{ {
if (aurEff->GetTickNumber() >= 8) if (aurEff->GetTickNumber() >= 8)
caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_3, TRIGGERED_FULL_MASK, nullptr, aurEff); caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_3, aurEff);
if (aurEff->GetTickNumber() >= 4) if (aurEff->GetTickNumber() >= 4)
caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_2, TRIGGERED_FULL_MASK, nullptr, aurEff); caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_2, aurEff);
caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_1, TRIGGERED_FULL_MASK, nullptr, aurEff); caster->CastSpell(GetTarget(), SPELL_OPTIC_LINK_LEVEL_1, aurEff);
} }
} }
@@ -97,7 +97,7 @@ public:
break; break;
case 1: case 1:
Talk(SAY_WP_3); Talk(SAY_WP_3);
me->CastSpell(5918.33f, 5372.91f, -98.770f, SPELL_EXPLODE_CRYSTAL, true); me->CastSpell({ 5918.33f, 5372.91f, -98.770f }, SPELL_EXPLODE_CRYSTAL, true);
me->SummonGameObject(184743, 5918.33f, 5372.91f, -98.770f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds me->SummonGameObject(184743, 5918.33f, 5372.91f, -98.770f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
break; break;
@@ -108,7 +108,7 @@ public:
Talk(SAY_WP_5); Talk(SAY_WP_5);
break; break;
case 8: case 8:
me->CastSpell(5887.37f, 5379.39f, -91.289f, SPELL_EXPLODE_CRYSTAL, true); me->CastSpell({ 5887.37f, 5379.39f, -91.289f }, SPELL_EXPLODE_CRYSTAL, true);
me->SummonGameObject(184743, 5887.37f, 5379.39f, -91.289f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds me->SummonGameObject(184743, 5887.37f, 5379.39f, -91.289f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
break; break;
@@ -828,7 +828,7 @@ class npc_wild_wyrm : public CreatureScript
if (seatId != SEAT_INITIAL) if (seatId != SEAT_INITIAL)
return; return;
me->CastCustomSpell(SPELL_GRIP, SPELLVALUE_AURA_STACK, 50); me->CastSpell(nullptr, SPELL_GRIP, CastSpellExtraArgs().AddSpellMod(SPELLVALUE_AURA_STACK, 50));
DoCastAOE(SPELL_CLAW_SWIPE_PERIODIC); DoCastAOE(SPELL_CLAW_SWIPE_PERIODIC);
_scheduler.Async([this] _scheduler.Async([this]
@@ -746,7 +746,7 @@ class spell_random_ingredient : public SpellScriptLoader
if (Creature* finklestein = GetClosestCreatureWithEntry(player, NPC_FINKLESTEIN, 25.0f)) if (Creature* finklestein = GetClosestCreatureWithEntry(player, NPC_FINKLESTEIN, 25.0f))
{ {
finklestein->CastSpell(player, FetchIngredients[ingredient][0], true, nullptr); finklestein->CastSpell(player, FetchIngredients[ingredient][0], true);
finklestein->AI()->Talk(FetchIngredients[ingredient][3], player); finklestein->AI()->Talk(FetchIngredients[ingredient][3], player);
} }
} }
@@ -46,7 +46,7 @@ class spell_mark_of_malice : public SpellScriptLoader
if (aurEff->GetBase()->GetCharges() > 1) if (aurEff->GetBase()->GetCharges() > 1)
return; return;
GetTarget()->CastSpell(GetTarget(), SPELL_MARK_OF_MALICE_TRIGGERED, true, nullptr, aurEff); GetTarget()->CastSpell(GetTarget(), SPELL_MARK_OF_MALICE_TRIGGERED, aurEff);
} }
void Register() override void Register() override
@@ -264,7 +264,7 @@ class spell_illidari_nightlord_shadow_inferno : public AuraScript
{ {
PreventDefaultAction(); PreventDefaultAction();
int32 bp = aurEffect->GetTickNumber() * aurEffect->GetAmount(); int32 bp = aurEffect->GetTickNumber() * aurEffect->GetAmount();
GetUnitOwner()->CastCustomSpell(SPELL_SHADOW_INFERNO_DAMAGE, SPELLVALUE_BASE_POINT0, bp, GetUnitOwner(), true); GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SHADOW_INFERNO_DAMAGE, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(bp));
} }
void Register() override void Register() override
@@ -460,8 +460,7 @@ struct boss_lady_malande : public IllidariCouncilBossAI
void HealReceived(Unit* /*who*/, uint32& addhealth) override void HealReceived(Unit* /*who*/, uint32& addhealth) override
{ {
// Need be negative to heal trigger // Need be negative to heal trigger
int32 bp = addhealth * (-1); me->CastSpell(nullptr, SPELL_SHARED_RULE, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(-int32(addhealth)));
me->CastCustomSpell(SPELL_SHARED_RULE, SPELLVALUE_BASE_POINT0, bp, (Unit*) nullptr, true);
} }
void ExecuteEvent(uint32 eventId) override void ExecuteEvent(uint32 eventId) override
@@ -607,8 +606,7 @@ class spell_illidari_council_balance_of_power : public AuraScript
void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& /*absorbAmount*/) void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& /*absorbAmount*/)
{ {
PreventDefaultAction(); PreventDefaultAction();
int32 bp = dmgInfo.GetDamage(); GetTarget()->CastSpell(nullptr, SPELL_SHARED_RULE, CastSpellExtraArgs(aurEff).AddSpellBP0(dmgInfo.GetDamage()));
GetTarget()->CastCustomSpell(SPELL_SHARED_RULE, SPELLVALUE_BASE_POINT0, bp, (Unit*) nullptr, true, nullptr, aurEff);
} }
void Register() override void Register() override
@@ -632,7 +630,7 @@ class spell_illidari_council_deadly_strike : public AuraScript
PreventDefaultAction(); PreventDefaultAction();
if (Unit* victim = GetTarget()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0)) if (Unit* victim = GetTarget()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0))
GetTarget()->CastSpell(victim, SPELL_DEADLY_POISON, true, nullptr, aurEff); GetTarget()->CastSpell(victim, SPELL_DEADLY_POISON, aurEff);
} }
void Register() override void Register() override
@@ -679,8 +677,7 @@ class spell_illidari_council_reflective_shield : public AuraScript
if (dmgInfo.GetAttacker() == target) if (dmgInfo.GetAttacker() == target)
return; return;
int32 bp = absorbAmount / 2; target->CastSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_DAMAGE, CastSpellExtraArgs(aurEff).AddSpellBP0(absorbAmount/2));
target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_DAMAGE, &bp, nullptr, nullptr, true, nullptr, aurEff);
} }
void Register() override void Register() override
@@ -40,7 +40,7 @@ enum Spells
SPELL_FATAL_ATTRACTION_DAMAGE = 40871, SPELL_FATAL_ATTRACTION_DAMAGE = 40871,
SPELL_SILENCING_SHRIEK = 40823, SPELL_SILENCING_SHRIEK = 40823,
SPELL_SABER_LASH_IMMUNITY = 43690, SPELL_SABER_LASH_IMMUNITY = 43690,
SPELL_FATAL_ATTACTION_TELEPORT = 40869, SPELL_FATAL_ATTRACTION_TELEPORT = 40869,
SPELL_BERSERK = 45078, SPELL_BERSERK = 45078,
SPELL_FATAL_ATTRACTION = 41001, SPELL_FATAL_ATTRACTION = 41001,
SPELL_SINISTER_PERIODIC = 40863, SPELL_SINISTER_PERIODIC = 40863,
@@ -171,7 +171,7 @@ struct boss_mother_shahraz : public BossAI
break; break;
case EVENT_FATAL_ATTRACTION: case EVENT_FATAL_ATTRACTION:
Talk(SAY_SPELL); Talk(SAY_SPELL);
me->CastCustomSpell(SPELL_FATAL_ATTACTION_TELEPORT, SPELLVALUE_MAX_TARGETS, 3, me); DoCastSelf(SPELL_FATAL_ATTRACTION_TELEPORT, { SPELLVALUE_MAX_TARGETS, 3 });
events.Repeat(Seconds(30)); events.Repeat(Seconds(30));
break; break;
case EVENT_SILENCING_SHRIEK: case EVENT_SILENCING_SHRIEK:
@@ -377,7 +377,7 @@ struct boss_essence_of_suffering : public BossAI
switch (eventId) switch (eventId)
{ {
case EVENT_SOUL_DRAIN: case EVENT_SOUL_DRAIN:
me->CastCustomSpell(SPELL_SOUL_DRAIN, SPELLVALUE_MAX_TARGETS, 5, me); DoCastSelf(SPELL_SOUL_DRAIN, { SPELLVALUE_MAX_TARGETS, 5 });
events.Repeat(Seconds(30), Seconds(35)); events.Repeat(Seconds(30), Seconds(35));
break; break;
case EVENT_FRENZY: case EVENT_FRENZY:
@@ -581,7 +581,7 @@ struct boss_essence_of_anger : public BossAI
break; break;
case EVENT_SPITE: case EVENT_SPITE:
Talk(ANGER_SAY_SPITE); Talk(ANGER_SAY_SPITE);
me->CastCustomSpell(SPELL_SPITE, SPELLVALUE_MAX_TARGETS, 3, me); DoCastSelf(SPELL_SPITE, { SPELLVALUE_MAX_TARGETS, 3 });
events.Repeat(Seconds(20)); events.Repeat(Seconds(20));
break; break;
case EVENT_START_CHECK_TANKER: case EVENT_START_CHECK_TANKER:
@@ -680,8 +680,7 @@ class spell_reliquary_of_souls_aura_of_desire : public AuraScript
return; return;
Unit* caster = eventInfo.GetActor(); Unit* caster = eventInfo.GetActor();
int32 bp = damageInfo->GetDamage() / 2; caster->CastSpell(caster, SPELL_AURA_OF_DESIRE_DAMAGE, CastSpellExtraArgs(aurEff).AddSpellBP0(damageInfo->GetDamage() / 2));
caster->CastCustomSpell(SPELL_AURA_OF_DESIRE_DAMAGE, SPELLVALUE_BASE_POINT0, bp, caster, true, nullptr, aurEff);
} }
void UpdateAmount(AuraEffect* /*aurEff*/) void UpdateAmount(AuraEffect* /*aurEff*/)
@@ -198,7 +198,7 @@ struct boss_teron_gorefiend : public BossAI
events.Repeat(Seconds(30), Seconds(35)); events.Repeat(Seconds(30), Seconds(35));
break; break;
case EVENT_CRUSHING_SHADOWS: case EVENT_CRUSHING_SHADOWS:
me->CastCustomSpell(SPELL_CRUSHING_SHADOWS, SPELLVALUE_MAX_TARGETS, 5, me); DoCastSelf(SPELL_CRUSHING_SHADOWS, { SPELLVALUE_MAX_TARGETS, 5 });
Talk(SAY_CRUSHING); Talk(SAY_CRUSHING);
events.Repeat(Seconds(18), Seconds(30)); events.Repeat(Seconds(18), Seconds(30));
break; break;
@@ -516,8 +516,7 @@ public:
if (me->IsWithinDist(me->GetVictim(), 30)) if (me->IsWithinDist(me->GetVictim(), 30))
{ {
//DoCastVictim(SPELL_CHAOS_BLAST, true); //DoCastVictim(SPELL_CHAOS_BLAST, true);
int damage = 100; me->CastSpell(me->GetVictim(), SPELL_CHAOS_BLAST, CastSpellExtraArgs().SetOriginalCaster(me->GetGUID()).AddSpellBP0(100));
me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, nullptr, nullptr, false, nullptr, nullptr, me->GetGUID());
} }
ChaosBlast_Timer = 3000; ChaosBlast_Timer = 3000;
} else ChaosBlast_Timer -= diff; } else ChaosBlast_Timer -= diff;
@@ -673,8 +672,7 @@ public:
if (me->IsWithinDist(me->GetVictim(), 30)) if (me->IsWithinDist(me->GetVictim(), 30))
{ {
//DoCastVictim(SPELL_CHAOS_BLAST, true); //DoCastVictim(SPELL_CHAOS_BLAST, true);
int damage = 100; me->CastSpell(me->GetVictim(), SPELL_CHAOS_BLAST, CastSpellExtraArgs().SetOriginalCaster(me->GetGUID()).AddSpellBP0(100));
me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, nullptr, nullptr, false, nullptr, nullptr, me->GetGUID());
ChaosBlast_Timer = 3000; ChaosBlast_Timer = 3000;
} }
} else ChaosBlast_Timer -= diff; } else ChaosBlast_Timer -= diff;

Some files were not shown because too many files have changed in this diff Show More