Core/Spells: ported CastSpell unclusterfucking from 3.3.5 branch

This commit is contained in:
Ovahlord committed 2020-11-04 22:37:11 +01:00
1 parent 7e637971ee
commit 754c138f89
157 files changed
+1195 -1223

No files matched your search

+5 -1
View File
@@ -105,7 +105,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
@@ -244,7 +244,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
@@ -168,28 +168,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((Unit*)nullptr, spellId, triggered);
} }
#define UPDATE_TARGET(a) {if (AIInfo->target<a) AIInfo->target=a;} #define UPDATE_TARGET(a) {if (AIInfo->target<a) AIInfo->target=a;}
+5 -4
View File
@@ -22,6 +22,7 @@
#include "Errors.h" #include "Errors.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))
@@ -305,10 +306,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
@@ -620,7 +620,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()
@@ -182,7 +182,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)
@@ -436,7 +436,11 @@ void BattlefieldTB::OnPlayerJoinWar(Player* player)
// Bonus damage buff for attackers // Bonus damage buff for attackers
if (player->GetTeam() == GetAttackerTeam() && GetData(BATTLEFIELD_TB_DATA_TOWERS_DESTROYED) > 0) if (player->GetTeam() == GetAttackerTeam() && GetData(BATTLEFIELD_TB_DATA_TOWERS_DESTROYED) > 0)
player->CastCustomSpell(SPELL_TOWER_ATTACK_BONUS, SPELLVALUE_AURA_STACK, GetData(BATTLEFIELD_TB_DATA_TOWERS_DESTROYED), player, TRIGGERED_FULL_MASK); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, GetData(BATTLEFIELD_TB_DATA_TOWERS_DESTROYED));
player->CastSpell(player, SPELL_TOWER_ATTACK_BONUS, args);
}
} }
@@ -982,8 +986,14 @@ void BattlefieldTB::TowerDestroyed(TBTowerId tbTowerId)
// Attack bonus buff // Attack bonus buff
for (auto itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) for (auto itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
{
if (Player* player = ObjectAccessor::FindPlayer(*itr)) if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->CastCustomSpell(SPELL_TOWER_ATTACK_BONUS, SPELLVALUE_AURA_STACK, GetData(BATTLEFIELD_TB_DATA_TOWERS_DESTROYED), player, TRIGGERED_FULL_MASK); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddMod(SPELLVALUE_AURA_STACK, GetData(BATTLEFIELD_TB_DATA_TOWERS_DESTROYED));
player->CastSpell(player, SPELL_TOWER_ATTACK_BONUS, args);
}
}
// Honor reward // Honor reward
TeamCastSpell(GetAttackerTeam(), SPELL_REWARD_TOWER_DESTROYED); TeamCastSpell(GetAttackerTeam(), SPELL_REWARD_TOWER_DESTROYED);
@@ -2017,8 +2017,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());
@@ -2031,7 +2030,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);
} }
@@ -2060,7 +2059,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;
} }
@@ -2073,6 +2072,8 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, TriggerCastFlags trigge
trigger->SetImmuneToAll(false); trigger->SetImmuneToAll(false);
PhasingHandler::InheritPhaseShift(trigger, this); PhasingHandler::InheritPhaseShift(trigger, this);
CastSpellExtraArgs args;
args.TriggerFlags = triggered;
if (Unit* owner = GetOwner()) if (Unit* owner = GetOwner())
{ {
trigger->SetFaction(owner->GetFaction()); trigger->SetFaction(owner->GetFaction());
@@ -2082,14 +2083,18 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, TriggerCastFlags trigge
trigger->SetByteValue(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG, owner->GetByteValue(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG)); trigger->SetByteValue(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG, owner->GetByteValue(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG));
// 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
@@ -1912,13 +1912,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)
+28 -17
View File
@@ -1692,7 +1692,11 @@ void Player::ProcessDelayedOperations()
SetPower(POWER_ECLIPSE, 0); SetPower(POWER_ECLIPSE, 0);
if (uint32 aura = _resurrectionData->Aura) if (uint32 aura = _resurrectionData->Aura)
CastSpell(this, aura, true, nullptr, nullptr, _resurrectionData->GUID); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SetOriginalCaster(_resurrectionData->GUID);
CastSpell(this, aura, args);
}
SpawnCorpseBones(); SpawnCorpseBones();
} }
@@ -7676,7 +7680,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);
@@ -7752,7 +7756,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
{ {
@@ -7890,7 +7894,7 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
chance = GetWeaponProcChance(); chance = GetWeaponProcChance();
if (roll_chance_f(chance)) if (roll_chance_f(chance))
CastSpell(damageInfo.GetVictim(), spellInfo->Id, true, item); CastSpell(damageInfo.GetVictim(), spellInfo->Id, item);
} }
} }
@@ -7952,9 +7956,9 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
if (roll_chance_f(chance)) if (roll_chance_f(chance))
{ {
if (spellInfo->IsPositive()) if (spellInfo->IsPositive())
CastSpell(this, spellInfo, true, item); CastSpell(this, spellInfo->Id, item);
else else
CastSpell(damageInfo.GetVictim(), spellInfo, true, item); CastSpell(damageInfo.GetVictim(), spellInfo->Id, item);
} }
} }
} }
@@ -7981,7 +7985,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;
} }
@@ -8006,7 +8010,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;
} }
@@ -8036,7 +8040,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;
} }
} }
@@ -13429,11 +13433,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());
@@ -14057,7 +14064,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);
@@ -14078,8 +14085,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);
@@ -24716,7 +24723,7 @@ bool Player::IsAtRecruitAFriendDistance(WorldObject const* pOther) const
void Player::ResurrectUsingRequestData() void Player::ResurrectUsingRequestData()
{ {
/// 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
float x, y, z, o; float x, y, z, o;
_resurrectionData->Location.GetPosition(x, y, z, o); _resurrectionData->Location.GetPosition(x, y, z, o);
TeleportTo(_resurrectionData->Location.GetMapId(), x, y, z, o); TeleportTo(_resurrectionData->Location.GetMapId(), x, y, z, o);
@@ -24741,7 +24748,11 @@ void Player::ResurrectUsingRequestData()
SetPower(POWER_ECLIPSE, 0); SetPower(POWER_ECLIPSE, 0);
if (uint32 aura = _resurrectionData->Aura) if (uint32 aura = _resurrectionData->Aura)
CastSpell(this, aura, true, nullptr, nullptr, _resurrectionData->GUID); {
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SetOriginalCaster(_resurrectionData->GUID);
CastSpell(this, aura, args);
}
SpawnCorpseBones(); SpawnCorpseBones();
} }
+40 -147
View File
@@ -1056,162 +1056,48 @@ 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(float x, float y, float z, float o, uint32 spellId, bool triggered, 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, o);
CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(float x, float y, float z, float o, 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, o);
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)
{ {
@@ -2171,7 +2057,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr
} }
else else
{ {
CastSpell(victim, meleeAttackSpellId, true, nullptr, meleeAttackAuraEffect); CastSpell(victim, meleeAttackSpellId, meleeAttackAuraEffect);
uint32 hitInfo = HITINFO_AFFECTS_VICTIM | HITINFO_NO_ANIMATION; uint32 hitInfo = HITINFO_AFFECTS_VICTIM | HITINFO_NO_ANIMATION;
if (attType == OFF_ATTACK) if (attType == OFF_ATTACK)
@@ -3031,7 +2917,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);
@@ -5849,7 +5735,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())
@@ -5862,7 +5748,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);
} }
} }
} }
@@ -10340,7 +10226,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);
} }
@@ -10373,7 +10259,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
@@ -13147,7 +13033,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];
@@ -13161,7 +13052,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);
} }
@@ -13178,7 +13069,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)
+6 -213
View File
@@ -23,6 +23,7 @@
#include "CombatManager.h" #include "CombatManager.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"
@@ -32,173 +33,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,
SPELLVALUE_AURA_DURATION
};
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, // Removed in 4.0.1
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
@@ -311,36 +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
TRIGGERED_IGNORE_BLOCKED_SPELL_FAMILY = 0x00004000, //! Will ignore blocked casts of SPELL_AURA_BLOCK_SPELL_FAMILY
// reuse = 0x00008000,
TRIGGERED_IGNORE_CASTER_AURAS = 0x00010000, //! Will ignore caster aura restrictions or requirements
// reuse = 0x00020000,
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_IGNORE_TARGET_CHECK = 0x00100000, //! Will ignore most target checks (mostly DBC target checks)
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.
@@ -1301,22 +1105,11 @@ 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 const* 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 const* 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(float x, float y, float z, float o, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(float x, float y, float z, float o, 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);
+2 -2
View File
@@ -393,7 +393,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
} }
} }
spell->prepare(&(spell->m_targets)); spell->prepare(spell->m_targets);
} }
else else
{ {
@@ -820,7 +820,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
} }
} }
spell->prepare(&(spell->m_targets)); spell->prepare(spell->m_targets);
} }
else else
{ {
+3 -6
View File
@@ -468,7 +468,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
Spell* spell = new Spell(caster, spellInfo, triggerFlag, ObjectGuid::Empty, false); Spell* spell = new Spell(caster, spellInfo, triggerFlag, ObjectGuid::Empty, false);
spell->m_cast_count = castCount; // set count of casts spell->m_cast_count = castCount; // set count of casts
spell->m_glyphIndex = glyphIndex; spell->m_glyphIndex = glyphIndex;
spell->prepare(&targets); spell->prepare(targets);
} }
void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket) void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket)
@@ -630,12 +630,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
@@ -603,10 +603,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);
@@ -455,4 +455,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, // Removed in 4.0.1
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
+118 -73
View File
@@ -1289,10 +1289,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)
{ {
@@ -1315,7 +1315,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
@@ -1330,7 +1330,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);
} }
} }
} }
@@ -1340,7 +1340,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);
} }
// Heart of the Wild // Heart of the Wild
@@ -1364,7 +1364,11 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
} }
if (heartOfTheWildSpellId) if (heartOfTheWildSpellId)
target->CastCustomSpell(target, heartOfTheWildSpellId, &heartOfTheWildAmount, nullptr, nullptr, true, nullptr, this); {
CastSpellExtraArgs args(this);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, heartOfTheWildAmount);
target->CastSpell(target, heartOfTheWildSpellId, args);
}
} }
switch (GetMiscValue()) switch (GetMiscValue())
@@ -1386,35 +1390,39 @@ 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->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, 2851, EFFECT_0)) if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, 2851, EFFECT_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_BEAR: case FORM_BEAR:
// Master Shapeshifter - Bear // Master Shapeshifter - Bear
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, 2851, EFFECT_0)) if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, 2851, EFFECT_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, EFFECT_0)) if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DRUID, 961, EFFECT_0))
{ {
int32 bp = aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue(GetCaster()); 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->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, 2851, EFFECT_0)) if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, 2851, EFFECT_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;
default: default:
@@ -1857,8 +1865,9 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
if (furorEffect) if (furorEffect)
{ {
// Allow to retain up to x% of the caster's energy when shape shifting into cat form // Allow to retain up to x% of the caster's energy when shape shifting into cat form
int32 basePoints = std::min<int32>(oldPower, furorEffect->GetAmount()); CastSpellExtraArgs args(this);
target->CastCustomSpell(target, 17099, &basePoints, nullptr, nullptr, true, nullptr, this); args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, std::min<int32>(oldPower, furorEffect->GetAmount()));
target->CastSpell(target, 17099, args);
} }
} }
else if (furorEffect && roll_chance_i(furorEffect->GetAmount())) // x% chance to gain 10 rage when shape shifting into bear form else if (furorEffect && roll_chance_i(furorEffect->GetAmount())) // x% chance to gain 10 rage when shape shifting into bear form
@@ -1905,12 +1914,12 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
case FORM_BEAR: case FORM_BEAR:
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:
@@ -4454,7 +4463,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
{ {
@@ -4462,7 +4471,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());
@@ -4483,15 +4492,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 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);
@@ -4500,9 +4509,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
@@ -4540,7 +4549,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)
@@ -4559,7 +4568,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 43681: // Inactive case 43681: // Inactive
{ {
@@ -4571,14 +4580,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((Unit*)nullptr, GetAmount(), true, nullptr, this); target->CastSpell(nullptr, GetAmount(), this);
break; break;
case 91604: // Restricted Flight Area case 91604: // Restricted Flight Area
if (aurApp->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired)) if (aurApp->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
@@ -4620,7 +4629,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);
@@ -4634,7 +4643,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);
@@ -4998,11 +5007,14 @@ 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 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
{ {
@@ -5183,8 +5195,11 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
if (!caster) if (!caster)
break; break;
caster->CastCustomSpell(66152, SPELLVALUE_MAX_TARGETS, urand(1, 6), target, true); CastSpellExtraArgs args;
caster->CastCustomSpell(66153, SPELLVALUE_MAX_TARGETS, urand(1, 6), target, true); args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, urand(1, 6));
caster->CastSpell(target, 66152, args);
caster->CastSpell(target, 66153, args);
break; break;
} }
case 62292: // Blaze (Pool of Tar) case 62292: // Blaze (Pool of Tar)
@@ -5202,7 +5217,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
case 64821: // Fuse Armor (Razorscale) case 64821: // Fuse Armor (Razorscale)
if (GetBase()->GetStackAmount() == GetSpellInfo()->StackAmount) if (GetBase()->GetStackAmount() == GetSpellInfo()->StackAmount)
{ {
target->CastSpell(target, 64774, true, nullptr, nullptr, GetCasterGUID()); target->CastSpell(target, 64774, GetCasterGUID());
target->RemoveAura(64821); target->RemoveAura(64821);
} }
break; break;
@@ -5214,7 +5229,12 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000) if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000)
{ {
if (caster) if (caster)
caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, nullptr, this); {
CastSpellExtraArgs args;
args.SpellValueOverrides.AddMod(SpellValueMod(SPELLVALUE_BASE_POINT0), m_amount);
args.SetTriggeringAura(this);
caster->CastSpell(target, 53352, args);
}
break; break;
} }
switch (GetSpellInfo()->Id) switch (GetSpellInfo()->Id)
@@ -5222,12 +5242,12 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
// Feeding Frenzy Rank 1 // Feeding Frenzy Rank 1
case 53511: case 53511:
if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35)) if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35))
target->CastSpell(target, 60096, true, nullptr, this); target->CastSpell(target, 60096, this);
return; return;
// Feeding Frenzy Rank 2 // Feeding Frenzy Rank 2
case 53512: case 53512:
if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35)) if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35))
target->CastSpell(target, 60097, true, nullptr, this); target->CastSpell(target, 60097, this);
return; return;
default: default:
break; break;
@@ -5326,7 +5346,11 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
// Frost Blast // Frost Blast
case 27808: case 27808:
if (caster) if (caster)
caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, nullptr, this); {
CastSpellExtraArgs args(this);
args.SpellValueOverrides.AddMod(SpellValueMod(SPELLVALUE_BASE_POINT0), int32(target->CountPctFromMaxHealth(21)));
caster->CastSpell(target, triggerSpellId, args);
}
return; return;
// Inoculate Nestlewood Owlkin // Inoculate Nestlewood Owlkin
case 29528: case 29528:
@@ -5366,7 +5390,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
// so instakill will be naturally done before trigger spell // so instakill will be naturally done before trigger spell
case 31347: case 31347:
{ {
target->CastSpell(target, 31350, true, nullptr, this); target->CastSpell(target, 31350, this);
target->KillSelf(); target->KillSelf();
return; return;
} }
@@ -5382,9 +5406,9 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
{ {
// cast 24 spells 34269-34289, 34314-34316 // cast 24 spells 34269-34289, 34314-34316
for (uint32 spell_id = 34269; spell_id != 34290; ++spell_id) for (uint32 spell_id = 34269; spell_id != 34290; ++spell_id)
target->CastSpell(target, spell_id, true, nullptr, this); target->CastSpell(target, spell_id, this);
for (uint32 spell_id = 34314; spell_id != 34317; ++spell_id) for (uint32 spell_id = 34314; spell_id != 34317; ++spell_id)
target->CastSpell(target, spell_id, true, nullptr, this); target->CastSpell(target, spell_id, this);
return; return;
} }
// Remote Toy // Remote Toy
@@ -5401,10 +5425,9 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
if (!caster || target->GetTypeId() != TYPEID_UNIT) if (!caster || target->GetTypeId() != TYPEID_UNIT)
return; return;
caster->CastSpell(caster, 38495, true, nullptr, this); caster->CastSpell(caster, 38495, this);
Creature* creatureTarget = target->ToCreature(); Creature* creatureTarget = target->ToCreature();
creatureTarget->DespawnOrUnsummon(); creatureTarget->DespawnOrUnsummon();
return; return;
} }
@@ -5474,22 +5497,37 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
} }
// Mana Tide // Mana Tide
case 16191: case 16191:
target->CastCustomSpell(target, triggerSpellId, &m_amount, nullptr, nullptr, true, nullptr, this); {
CastSpellExtraArgs args(this);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, m_amount);
args.SetTriggeringAura(this);
target->CastSpell(target, triggerSpellId, args);
return; return;
}
// Negative Energy Periodic // Negative Energy Periodic
case 46284: case 46284:
target->CastCustomSpell(triggerSpellId, SPELLVALUE_MAX_TARGETS, m_tickNumber / 10 + 1, nullptr, true, nullptr, this); {
CastSpellExtraArgs args(this);
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, int32(m_tickNumber / 10 + 1));
args.SetTriggeringAura(this);
target->CastSpell(nullptr, triggerSpellId, args);
return; return;
}
// Slime Pool (Dreadscale & Acidmaw) // Slime Pool (Dreadscale & Acidmaw)
case 66882: case 66882:
target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3), nullptr, true, nullptr, this); {
CastSpellExtraArgs args(this);
args.SpellValueOverrides.AddMod(SPELLVALUE_RADIUS_MOD, int32((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3));
args.SetTriggeringAura(this);
target->CastSpell(nullptr, triggerSpellId, args);
return; return;
}
// Slime Spray - temporary here until preventing default effect works again // Slime Spray - temporary here until preventing default effect works again
// added on 9.10.2010 // added on 9.10.2010
case 69508: case 69508:
{ {
if (caster) if (caster)
caster->CastSpell(target, triggerSpellId, true, nullptr, nullptr, caster->GetGUID()); caster->CastSpell(target, triggerSpellId, caster->GetGUID());
return; return;
} }
case 24745: // Summon Templar, Trigger case 24745: // Summon Templar, Trigger
@@ -5524,12 +5562,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, triggeredSpellInfo->Id, 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 therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
} }
void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* caster) const void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* caster) const
@@ -5539,13 +5577,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 therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
} }
void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
@@ -6012,8 +6052,11 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
if (manaFeedVal > 0) if (manaFeedVal > 0)
{ {
int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
caster->CastCustomSpell(caster, 32554, &feedAmount, nullptr, nullptr, true, nullptr, this); CastSpellExtraArgs args(this);
args.SpellValueOverrides.AddMod(SPELLVALUE_BASE_POINT0, int32(CalculatePct(gainedAmount, manaFeedVal)));
args.SetTriggeringAura(this);
caster->CastSpell(caster, 32554, args);
} }
} }
} }
@@ -6154,7 +6197,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());
@@ -6169,7 +6212,7 @@ void AuraEffect::HandleProcTriggerSpellCopyAuraProc(AuraApplication* aurApp, Pro
return; return;
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);
} }
void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo)
@@ -6180,9 +6223,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());
@@ -6248,7 +6292,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);
} }
@@ -6256,10 +6300,9 @@ 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() });
} }
void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurApp, ProcEventInfo& /*eventInfo*/) void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurApp, ProcEventInfo& /*eventInfo*/)
{ {
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
@@ -6272,14 +6315,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)
{ {
@@ -6289,7 +6334,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);
} }
@@ -6297,7 +6342,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);
} }
void AuraEffect::HandleProcOnPowerAmountAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) void AuraEffect::HandleProcOnPowerAmountAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo)
@@ -6321,7 +6366,7 @@ void AuraEffect::HandleProcOnPowerAmountAuraProc(AuraApplication* aurApp, ProcEv
if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId)) if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
{ {
TC_LOG_DEBUG("spells", "AuraEffect::HandleProcOnPowerAmountAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId()); TC_LOG_DEBUG("spells", "AuraEffect::HandleProcOnPowerAmountAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId());
triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this); triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo->Id, true);
} }
else else
TC_LOG_ERROR("spells", "AuraEffect::HandleProcOnPowerAmountAuraProc: 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::HandleProcOnPowerAmountAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId());
+21 -11
View File
@@ -1218,7 +1218,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.HasFlag(AuraRemoveFlags::ByDeath)) else if (!removeMode.HasFlag(AuraRemoveFlags::ByDeath))
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))
@@ -1280,8 +1280,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;
@@ -1323,10 +1324,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
@@ -1337,7 +1340,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;
@@ -1371,11 +1376,14 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
switch (GetId()) switch (GetId())
{ {
case 66: // Invisibility case 66: // Invisibility
{
if (!removeMode.HasFlag(AuraRemoveFlags::Expired)) if (!removeMode.HasFlag(AuraRemoveFlags::Expired))
break; break;
target->CastSpell(target, 32612, true, nullptr, GetEffect(1));
target->CastSpell(target, 32612, GetEffect(EFFECT_1));
target->CombatStop(); target->CombatStop();
break; break;
}
default: default:
break; break;
} }
@@ -1428,8 +1436,10 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (AuraEffect const* aurEff = aura->GetEffect(0)) if (AuraEffect const* aurEff = aura->GetEffect(0))
{ {
float multiplier = float(aurEff->GetAmount()); float multiplier = float(aurEff->GetAmount());
int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
caster->CastCustomSpell(caster, 47755, &basepoints0, nullptr, nullptr, true); CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.SpellValueOverrides.AddBP0(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
caster->CastSpell(caster, 47755, args);
} }
} }
} }
@@ -1484,7 +1494,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(EFFECT_0));
else else
owner->RemoveAurasDueToSpell(34471); owner->RemoveAurasDueToSpell(34471);
} }
+5 -5
View File
@@ -2965,7 +2965,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, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_TARGET_CHECK)); m_caster->CastSpell(unit, i->triggeredSpell->Id, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_TARGET_CHECK));
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
@@ -2996,7 +2996,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());
} }
} }
} }
@@ -3132,7 +3132,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)
{ {
@@ -3145,7 +3145,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))
@@ -6009,7 +6009,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
@@ -434,7 +434,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(Spell* interruptingSpell = nullptr); void cancel(Spell* interruptingSpell = nullptr);
void update(uint32 difftime); void update(uint32 difftime);
void cast(bool skipCheck = false); void cast(bool skipCheck = false);
+199
View File
@@ -0,0 +1,199 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* 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 = 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,
SPELLVALUE_AURA_DURATION
};
enum SpellFacingFlags
{
SPELL_FACING_FLAG_INFRONT = 0x1
};
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
TRIGGERED_IGNORE_BLOCKED_SPELL_FAMILY = 0x00004000, //! Will ignore blocked casts of SPELL_AURA_BLOCK_SPELL_FAMILY
// reuse = 0x00008000,
TRIGGERED_IGNORE_CASTER_AURAS = 0x00010000, //! Will ignore caster aura restrictions or requirements
// reuse = 0x00020000,
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_IGNORE_TARGET_CHECK = 0x00100000, //! Will ignore most target checks (mostly DBC target checks)
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 // TRINITY_SPELLDEFINES_H
+46 -48
View File
@@ -562,17 +562,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)
@@ -612,18 +609,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)
@@ -655,32 +648,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, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD));
} }
void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex) void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex)
@@ -699,7 +688,7 @@ void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex)
finish(); finish();
m_caster->CastSpell((Unit*)nullptr, spellInfo, false); m_caster->CastSpell(nullptr, spellInfo->Id, false);
} }
void Spell::EffectJump(SpellEffIndex effIndex) void Spell::EffectJump(SpellEffIndex effIndex)
@@ -1912,11 +1901,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);
} }
ExecuteLogEffectSummonObject(effIndex, summon); ExecuteLogEffectSummonObject(effIndex, summon);
} }
@@ -2053,12 +2044,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(m_caster); 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);
} }
} }
@@ -2710,7 +2702,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:
@@ -3043,8 +3035,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
return; return;
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);
m_caster->CastSpell(m_caster, spell_id, true, nullptr);
return; return;
} }
// Brittle Armor - need remove one 24575 Brittle Armor aura // Brittle Armor - need remove one 24575 Brittle Armor aura
@@ -3252,7 +3243,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;
} }
@@ -3370,7 +3361,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();
} }
@@ -3389,7 +3380,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_FIRE; slot < MAX_TOTEM_SLOT; ++slot) for (uint8 slot = SUMMON_SLOT_TOTEM_FIRE; slot < MAX_TOTEM_SLOT; ++slot)
{ {
@@ -3399,14 +3389,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;
} }
@@ -3940,8 +3933,9 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex)
uint32 count = 1; uint32 count = 1;
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
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
m_caster->CastCustomSpell(pet, m_spellInfo->Effects[effIndex].TriggerSpell, &benefit, nullptr, nullptr, true); 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)
@@ -4665,7 +4659,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)
+2 -1
View File
@@ -3018,7 +3018,8 @@ 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;
+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;
} }
@@ -356,7 +356,7 @@ class spell_occuthar_occuthars_destruction : public SpellScriptLoader
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
{ {
if (IsExpired()) if (IsExpired())
caster->CastSpell((Unit*)nullptr, SPELL_OCCUTHARS_DESTUCTION, true, nullptr, aurEff); caster->CastSpell(nullptr, SPELL_OCCUTHARS_DESTUCTION, aurEff);
caster->ToCreature()->DespawnOrUnsummon(500); caster->ToCreature()->DespawnOrUnsummon(500);
} }
@@ -806,7 +806,7 @@ class npc_ignacious : public CreatureScript
float y = pos.GetPositionY() + sin(angle) * i; float y = pos.GetPositionY() + sin(angle) * i;
float z = pos.GetPositionZ(); float z = pos.GetPositionZ();
float floor = me->GetMapHeight(x, y, z); float floor = me->GetMapHeight(x, y, z);
me->CastSpell(x, y, floor, SPELL_INFERNO_RUSH_SUMMON, true); me->CastSpell({ x, y, floor }, SPELL_INFERNO_RUSH_SUMMON, true);
} }
} }
@@ -1989,7 +1989,7 @@ class spell_feludius_heart_of_ice : public AuraScript
void HandlePeriodic(AuraEffect const* aurEff) void HandlePeriodic(AuraEffect const* aurEff)
{ {
GetTarget()->CastSpell(GetTarget(), SPELL_FROST_IMBUED, true, nullptr, aurEff); GetTarget()->CastSpell(GetTarget(), SPELL_FROST_IMBUED, aurEff);
if (AuraEffect* aurEff = GetEffect(EFFECT_0)) if (AuraEffect* aurEff = GetEffect(EFFECT_0))
{ {
@@ -2069,7 +2069,7 @@ class spell_ignacious_rising_flames : public AuraScript
void HandlePeriodic(AuraEffect const* aurEff) void HandlePeriodic(AuraEffect const* aurEff)
{ {
GetTarget()->CastSpell(GetTarget(), SPELL_RISING_FLAMES_BUFF, true, nullptr, aurEff); GetTarget()->CastSpell(GetTarget(), SPELL_RISING_FLAMES_BUFF, aurEff);
} }
void HandleAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2108,7 +2108,7 @@ class spell_ignacious_burning_blood : public AuraScript
void HandlePeriodic(AuraEffect const* aurEff) void HandlePeriodic(AuraEffect const* aurEff)
{ {
GetTarget()->CastSpell(GetTarget(), SPELL_FLAME_IMBUED, true, nullptr, aurEff); GetTarget()->CastSpell(GetTarget(), SPELL_FLAME_IMBUED, aurEff);
if (AuraEffect* aurEff = GetEffect(EFFECT_0)) if (AuraEffect* aurEff = GetEffect(EFFECT_0))
{ {
@@ -2491,7 +2491,7 @@ class spell_terrastra_harden_skin : public AuraScript
{ {
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell)) if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
if (Unit* target = GetTarget()) if (Unit* target = GetTarget())
target->CastCustomSpell(SPELL_SHATTER, SPELLVALUE_BASE_POINT0, _absorbedDamage, nullptr, true, nullptr, aurEff); target->CastSpell(nullptr, SPELL_SHATTER, CastSpellExtraArgs(aurEff).AddSpellBP0(_absorbedDamage));
} }
private: private:
uint32 _absorbedDamage; uint32 _absorbedDamage;
@@ -2544,7 +2544,7 @@ class spell_terrastra_eruption : public SpellScript
float x = caster->GetPositionX() + cos(angle + (i * steps)) * dist; float x = caster->GetPositionX() + cos(angle + (i * steps)) * dist;
float y = caster->GetPositionY() + sin(angle + (i * steps)) * dist; float y = caster->GetPositionY() + sin(angle + (i * steps)) * dist;
float floor = caster->GetMap()->GetHeight(caster->GetPhaseShift(), x, y, z, true); float floor = caster->GetMap()->GetHeight(caster->GetPhaseShift(), x, y, z, true);
caster->CastSpell(x, y, floor, SPELL_ERUPTION_SUMMON, true); caster->CastSpell({ x, y, floor }, SPELL_ERUPTION_SUMMON, true);
} }
} }
} }
@@ -2666,7 +2666,7 @@ class spell_elementium_monstrosity_liquid_ice : public AuraScript
{ {
uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell; uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell;
int32 radius = target->GetObjectScale() * 500; int32 radius = target->GetObjectScale() * 500;
target->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, radius, nullptr, true, nullptr, aurEff, target->GetGUID()); target->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).SetOriginalCaster(target->GetGUID()).AddSpellMod(SPELLVALUE_RADIUS_MOD, radius));
} }
} }
@@ -243,7 +243,7 @@ namespace CorruptionHandler
// Add power to target // Add power to target
power += corruptionAmount; power += corruptionAmount;
target->SetPower(POWER_ALTERNATE_POWER, std::min(power, uint8(MAX_CORRUPTION))); target->SetPower(POWER_ALTERNATE_POWER, std::min(power, uint8(MAX_CORRUPTION)));
target->CastCustomSpell(SPELL_CORRUPTED_BLOOD_DAMAGE_INCREASE, SPELLVALUE_AURA_STACK, corruptionAmount, target, true); target->CastSpell(target, SPELL_CORRUPTED_BLOOD_DAMAGE_INCREASE, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_AURA_STACK, corruptionAmount));
// Achievement check // Achievement check
if (power > CORRUPTION_ACHIEVEMENT_CAP) if (power > CORRUPTION_ACHIEVEMENT_CAP)
@@ -769,10 +769,8 @@ struct npc_chogall_elemental : public PassiveAI
if (Creature* chogall = _instance->GetCreature(DATA_CHOGALL)) if (Creature* chogall = _instance->GetCreature(DATA_CHOGALL))
chogall->AI()->JustSummoned(me); chogall->AI()->JustSummoned(me);
if (me->GetEntry() == NPC_FIRE_ELEMENTAL) uint32 spellId = me->GetEntry() == NPC_FIRE_ELEMENTAL ? SPELL_FIRE_POWER : SPELL_SHADOW_POWER;
me->CastCustomSpell(SPELL_FIRE_POWER, SPELLVALUE_AURA_STACK, 10, me, true); me->CastSpell(me, spellId, { SPELLVALUE_AURA_STACK, 10 });
else
me->CastCustomSpell(SPELL_SHADOW_POWER, SPELLVALUE_AURA_STACK, 10, me, true);
_events.ScheduleEvent(EVENT_ABSORB_ELEMENTAL, 10s + 500ms); _events.ScheduleEvent(EVENT_ABSORB_ELEMENTAL, 10s + 500ms);
} }
@@ -1011,7 +1009,7 @@ class spell_chogall_absorb_elemental_heroic_AuraScript : public AuraScript
if (Creature* chogall = instance->GetCreature(DATA_CHOGALL)) if (Creature* chogall = instance->GetCreature(DATA_CHOGALL))
if (uint8 stacks = chogall->AI()->GetData(DATA_ELEMENTAL_POWER_STACKS)) if (uint8 stacks = chogall->AI()->GetData(DATA_ELEMENTAL_POWER_STACKS))
target->CastCustomSpell(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, SPELLVALUE_AURA_STACK, stacks, target, true); target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_AURA_STACK, stacks));
} }
void Register() override void Register() override
@@ -1053,7 +1051,7 @@ class spell_chogall_flaming_destruction_heroic : public AuraScript
uint8 stacks = GetStackAmount(); uint8 stacks = GetStackAmount();
int32 bp = spell->Effects[EFFECT_0].CalcValue(); int32 bp = spell->Effects[EFFECT_0].CalcValue();
bp += CalculatePct(bp, stacks * 10); bp += CalculatePct(bp, stacks * 10);
caster->CastCustomSpell(spell->Id, SPELLVALUE_BASE_POINT0, bp, target, true, nullptr, aurEff); caster->CastSpell(target, spell->Id, CastSpellExtraArgs(aurEff).AddSpellBP0(bp));
} }
void Register() override void Register() override
@@ -1076,7 +1074,7 @@ class spell_chogall_empowered_shadows_heroic : public AuraScript
uint8 stacks = GetStackAmount(); uint8 stacks = GetStackAmount();
int32 bp = spell->Effects[EFFECT_0].CalcValue(); int32 bp = spell->Effects[EFFECT_0].CalcValue();
bp += CalculatePct(bp, stacks * 5); bp += CalculatePct(bp, stacks * 5);
caster->CastCustomSpell(spell->Id, SPELLVALUE_BASE_POINT0, bp, caster, true, nullptr, aurEff); caster->CastSpell(caster, spell->Id, CastSpellExtraArgs(aurEff).AddSpellBP0(bp));
} }
void Register() override void Register() override
@@ -1194,7 +1194,7 @@ class spell_theralion_engulfing_magic : public SpellScriptLoader
bp += dmgInfo->GetDamage(); bp += dmgInfo->GetDamage();
if (bp) if (bp)
GetCaster()->CastCustomSpell(GetCaster(), SPELL_ENGULFING_MAGIC_TRIGGERED, &bp, nullptr, nullptr, true, nullptr, aurEff); GetCaster()->CastSpell(GetCaster(), SPELL_ENGULFING_MAGIC_TRIGGERED, CastSpellExtraArgs(aurEff).AddSpellBP0(bp));
} }
void Register() override void Register() override
@@ -218,7 +218,7 @@ class spell_karsh_superheated_quicksilver_armor : public SpellScript
SpellInfo const* spell = sSpellMgr->AssertSpellInfo(SPELL_HEAT_WAVE); SpellInfo const* spell = sSpellMgr->AssertSpellInfo(SPELL_HEAT_WAVE);
uint8 stacks = superheatedArmor->GetStackAmount(); uint8 stacks = superheatedArmor->GetStackAmount();
int32 bp = spell->Effects[EFFECT_0].CalcValue() * stacks; int32 bp = spell->Effects[EFFECT_0].CalcValue() * stacks;
target->CastCustomSpell(SPELL_HEAT_WAVE, SPELLVALUE_BASE_POINT0, bp, target, true, nullptr); target->CastSpell(target, SPELL_HEAT_WAVE, CastSpellExtraArgs(true).AddSpellBP0(bp));
} }
} }
@@ -291,7 +291,7 @@ class spell_karsh_superheated_quicksilver_armor_proc : public AuraScript
return; return;
int32 bp = spell->Effects[EFFECT_0].CalcValue() * stacks; int32 bp = spell->Effects[EFFECT_0].CalcValue() * stacks;
target->CastCustomSpell(spell->Id, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, nullptr, aurEff); target->CastSpell(eventInfo.GetProcTarget(), spell->Id, CastSpellExtraArgs(aurEff).AddSpellBP0(bp));
} }
} }
@@ -537,7 +537,7 @@ struct npc_atramedes_ancient_dwarven_shield : public NullCreatureAI
return; return;
if (atramedes->AI()->GetData(DATA_IS_IN_AIR)) if (atramedes->AI()->GetData(DATA_IS_IN_AIR))
clicker->CastSpell(clicker, SPELL_RESONATING_CLASH_AIR, true, nullptr, nullptr, me->GetGUID()); clicker->CastSpell(clicker, SPELL_RESONATING_CLASH_AIR, me->GetGUID());
else else
DoCastSelf(SPELL_RESONATING_CLASH_GROUND); DoCastSelf(SPELL_RESONATING_CLASH_GROUND);
@@ -731,7 +731,7 @@ class spell_atramedes_roaring_flame_breath : public AuraScript
void HandleTick(AuraEffect const* aurEff) void HandleTick(AuraEffect const* aurEff)
{ {
PreventDefaultAction(); PreventDefaultAction();
GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true, nullptr, aurEff); GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, aurEff);
} }
void Register() override void Register() override
@@ -839,7 +839,7 @@ class spell_atramedes_sound_bar : public AuraScript
if (Creature* atramedes = instance->GetCreature(DATA_ATRAMEDES)) if (Creature* atramedes = instance->GetCreature(DATA_ATRAMEDES))
atramedes->AI()->SetGUID(target->GetGUID(), DATA_ADD_NOISY_PLAYER); atramedes->AI()->SetGUID(target->GetGUID(), DATA_ADD_NOISY_PLAYER);
target->CastSpell(target, SPELL_NOISY, true, nullptr, aurEff); target->CastSpell(target, SPELL_NOISY, aurEff);
} }
else if (target->GetPower(POWER_ALTERNATE_POWER) >= 50) else if (target->GetPower(POWER_ALTERNATE_POWER) >= 50)
if (Creature* atramedes = instance->GetCreature(DATA_ATRAMEDES)) if (Creature* atramedes = instance->GetCreature(DATA_ATRAMEDES))
@@ -922,7 +922,7 @@ class spell_atramedes_sonic_flames_AuraScript : public AuraScript
return; return;
PreventDefaultAction(); PreventDefaultAction();
caster->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true, nullptr, aurEff); caster->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, aurEff);
} }
void Register() override void Register() override
@@ -589,7 +589,7 @@ class spell_chimaeron_double_attack : public AuraScript
{ {
PreventDefaultAction(); PreventDefaultAction();
if (Unit* target = eventInfo.GetProcTarget()) if (Unit* target = eventInfo.GetProcTarget())
GetTarget()->CastSpell(target, SPELL_DOUBLE_ATTACK_TRIGGERED, true, nullptr, aurEff); GetTarget()->CastSpell(target, SPELL_DOUBLE_ATTACK_TRIGGERED, aurEff);
} }
void Register() override void Register() override
@@ -770,7 +770,7 @@ struct npc_magmaw_blazing_bone_construct : public ScriptedAI
for (uint8 i = 0; i < 20; i++) for (uint8 i = 0; i < 20; i++)
{ {
Position const pos = me->GetRandomNearPosition(10.0f); Position const pos = me->GetRandomNearPosition(10.0f);
me->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_IGNITION, true); me->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() }, SPELL_IGNITION, true);
} }
_events.ScheduleEvent(EVENT_ENGAGE_PLAYERS, 1s); _events.ScheduleEvent(EVENT_ENGAGE_PLAYERS, 1s);
} }
@@ -1134,7 +1134,7 @@ class spell_maloriak_magma_jets_periodic : public AuraScript
float y = target->GetPositionY() + sin(target->GetOrientation()) * dist; float y = target->GetPositionY() + sin(target->GetOrientation()) * dist;
float z = target->GetMapHeight(x, y, target->GetPositionZ() + 5.0f); float z = target->GetMapHeight(x, y, target->GetPositionZ() + 5.0f);
if (target->IsWithinLOS(x, y, z)) if (target->IsWithinLOS(x, y, z))
target->CastSpell(x, y, z, SPELL_MAGMA_JETS_SUMMON_FIRE, true); target->CastSpell({ x, y, z }, SPELL_MAGMA_JETS_SUMMON_FIRE, true);
else else
Remove(); Remove();
} }
@@ -1182,7 +1182,7 @@ class spell_maloriak_vile_swill: public AuraScript
PreventDefaultAction(); PreventDefaultAction();
Unit* target = GetTarget(); Unit* target = GetTarget();
Position const destination = target->GetRandomPoint(target->GetPosition(), 11.0f); Position const destination = target->GetRandomPoint(target->GetPosition(), 11.0f);
target->CastSpell(destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ(), SPELL_VILE_SWILL_SUMMON, true); target->CastSpell({ destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ() }, SPELL_VILE_SWILL_SUMMON, true);
} }
void Register() override void Register() override
@@ -1346,14 +1346,14 @@ struct npc_nefarians_end_shadowblaze : public NullCreatureAI
} }
} }
me->CastSpell(summonPos.GetPositionX(), summonPos.GetPositionY(), z, 0.f, SPELL_BRUSHFIRE_SUMMON, true); me->CastSpell({ summonPos.GetPositionX(), summonPos.GetPositionY(), z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
} }
else else
{ {
if (me->GetEntry() == NPC_SHADOWBLAZE_FLASHPOINT) if (me->GetEntry() == NPC_SHADOWBLAZE_FLASHPOINT)
{ {
me->CastSpell(me->GetPositionX() - 5.f, me->GetPositionY(), z, 0.f, SPELL_BRUSHFIRE_SUMMON, true); me->CastSpell({ me->GetPositionX() - 5.f, me->GetPositionY(), z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
me->CastSpell(me->GetPositionX(), me->GetPositionY() + 5.f, z, 0.f, SPELL_BRUSHFIRE_SUMMON, true); me->CastSpell({ me->GetPositionX(), me->GetPositionY() + 5.f, z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
} }
else if (_summonedByController) else if (_summonedByController)
{ {
@@ -1361,7 +1361,7 @@ struct npc_nefarians_end_shadowblaze : public NullCreatureAI
{ {
float x = me->GetPositionX() + 5.f; float x = me->GetPositionX() + 5.f;
float y = me->GetPositionY() + 5.f; float y = me->GetPositionY() + 5.f;
me->CastSpell(x, y, z, 0.f, SPELL_BRUSHFIRE_SUMMON, true); me->CastSpell({ x, y, z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
} }
} }
} }
@@ -1843,7 +1843,7 @@ class spell_nefarians_end_dominion_dummy : public SpellScript
Unit* caster = GetCaster(); Unit* caster = GetCaster();
uint8 size = caster->GetMap()->Is25ManRaid() ? 2 : 5; uint8 size = caster->GetMap()->Is25ManRaid() ? 2 : 5;
if (!targets.empty()) if (!targets.empty())
caster->CastCustomSpell(SPELL_DOMINION_OVERRIDE_ACTION_BAR, SPELLVALUE_MAX_TARGETS, size, caster, true); caster->CastSpell(caster, SPELL_DOMINION_OVERRIDE_ACTION_BAR, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_MAX_TARGETS, size));
} }
void Register() override void Register() override
@@ -1412,7 +1412,7 @@ class spell_omnotron_unstable_shield : public AuraScript
if (!target) if (!target)
return; return;
caster->CastSpell(target, SPELL_STATIC_SHOCK, true, nullptr, aurEff); caster->CastSpell(target, SPELL_STATIC_SHOCK, aurEff);
if (InstanceScript* instance = caster->GetInstanceScript()) if (InstanceScript* instance = caster->GetInstanceScript())
if (Creature* magmatron = instance->GetCreature(DATA_MAGMATRON)) if (Creature* magmatron = instance->GetCreature(DATA_MAGMATRON))
@@ -1576,7 +1576,7 @@ class spell_omnotron_overcharged_power_generator : public AuraScript
{ {
uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell; uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell;
int32 radius = target->GetObjectScale() * 10000; int32 radius = target->GetObjectScale() * 10000;
target->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, radius, nullptr, true, nullptr, aurEff, target->GetGUID()); target->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).SetOriginalCaster(target->GetGUID()).AddSpellMod(SPELLVALUE_RADIUS_MOD, radius));
} }
} }
@@ -135,7 +135,7 @@ class spell_baron_geddon_inferno : public SpellScriptLoader
{ {
PreventDefaultAction(); PreventDefaultAction();
int32 damageForTick[8] = { 500, 500, 1000, 1000, 2000, 2000, 3000, 5000 }; 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); GetTarget()->CastSpell(nullptr, SPELL_INFERNO_DMG, CastSpellExtraArgs(aurEff).AddSpellBP0(damageForTick[aurEff->GetTickNumber() - 1]));
} }
void Register() override void Register() override
@@ -327,7 +327,7 @@ class boss_vanessa_van_cleef : public CreatureScript
float y = defiasReinforcementPositions[_currentReinforcement].m_positionY; float y = defiasReinforcementPositions[_currentReinforcement].m_positionY;
float z = defiasReinforcementPositions[_currentReinforcement].m_positionZ; float z = defiasReinforcementPositions[_currentReinforcement].m_positionZ;
me->CastSpell(x, y, z, defiasReinforcementSpells[_currentReinforcement], true); me->CastSpell({ x, y, z }, defiasReinforcementSpells[_currentReinforcement], true);
_currentReinforcement++; _currentReinforcement++;
if (_currentReinforcement == REINFORCEMENT_BLOOD_WIZARD) if (_currentReinforcement == REINFORCEMENT_BLOOD_WIZARD)
@@ -516,7 +516,7 @@ class spell_erudax_twilight_corruption_AuraScript : public AuraScript
if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId)) if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId))
{ {
int32 damage = CalculatePct(target->GetMaxHealth(), spell->Effects[EFFECT_0].BasePoints); int32 damage = CalculatePct(target->GetMaxHealth(), spell->Effects[EFFECT_0].BasePoints);
target->CastCustomSpell(target, spellId, &damage, 0, 0, true); target->CastSpell(target, spellId, CastSpellExtraArgs(true).AddSpellBP0(damage));
} }
} }
} }
@@ -334,7 +334,7 @@ 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()); target->CastSpell(target, SPELL_ENFEEBLE, me->GetGUID());
target->SetHealth(1); target->SetHealth(1);
} }
} }
@@ -454,7 +454,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();
} }
@@ -242,7 +242,7 @@ class spell_ashbury_asphyxiate : public AuraScript
if (!target->HasAura(SPELL_ASPHYXIATE_ROOT)) if (!target->HasAura(SPELL_ASPHYXIATE_ROOT))
target->CastSpell(target, SPELL_ASPHYXIATE_ROOT, true); target->CastSpell(target, SPELL_ASPHYXIATE_ROOT, true);
target->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, target, true, nullptr, aurEff, caster->GetGUID()); target->CastSpell(target, triggerSpell, CastSpellExtraArgs(aurEff).SetOriginalCaster(caster->GetGUID()).AddSpellBP0(damage));
} }
} }
} }
@@ -308,7 +308,7 @@ class spell_godfrey_pistol_barrage : public AuraScript
float posX = target->GetPositionX() + cos(ori) * 60; float posX = target->GetPositionX() + cos(ori) * 60;
float posY = target->GetPositionY() + sin(ori) * 60; float posY = target->GetPositionY() + sin(ori) * 60;
float posZ = target->GetPositionZ(); float posZ = target->GetPositionZ();
target->CastSpell(posX, posY, posZ, spellId, true); target->CastSpell({ posX, posY, posZ }, spellId, true);
_useLeftGun = _useLeftGun ? false : true; _useLeftGun = _useLeftGun ? false : true;
} }
@@ -207,7 +207,7 @@ class spell_ulthok_dark_fissure : public AuraScript
{ {
uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell; uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell;
int32 radius = target->GetObjectScale() * 300; int32 radius = target->GetObjectScale() * 300;
target->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, radius, nullptr, true, nullptr, aurEff, target->GetGUID()); target->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).SetOriginalCaster(target->GetGUID()).AddSpellMod(SPELLVALUE_RADIUS_MOD, radius));
} }
} }
@@ -458,7 +458,7 @@ class spell_janalai_flame_breath_AuraScript : public AuraScript
float x = 0.f, y = 0.f, z = 0.f; float x = 0.f, y = 0.f, z = 0.f;
_castDestinations[tickNumber - 1].GetPosition(x, y, z); _castDestinations[tickNumber - 1].GetPosition(x, y, z);
GetTarget()->CastSpell(x, y, z, SPELL_FLAME_BREATH_AREA_EFFECT); GetTarget()->CastSpell({ x, y, z }, SPELL_FLAME_BREATH_AREA_EFFECT);
} }
void Register() override void Register() override
@@ -186,7 +186,7 @@ struct boss_bloodlord_mandokir : public BossAI
float y = me->GetPositionY() + sin(angle + angleOffset) * (i * 6.0f); float y = me->GetPositionY() + sin(angle + angleOffset) * (i * 6.0f);
float z = me->GetPositionZ(); float z = me->GetPositionZ();
angleOffset += 0.3f; angleOffset += 0.3f;
me->CastSpell(x, y, z, SPELL_DEVASTATING_SLAM_DAMAGE, true); me->CastSpell({ x, y, z }, SPELL_DEVASTATING_SLAM_DAMAGE, true);
} }
} }
} }
@@ -530,8 +530,8 @@ class spell_mandokir_bloodletting : public AuraScript
int32 damage = std::max<int32>(7500, target->CountPctFromCurHealth(aurEff->GetAmount())); int32 damage = std::max<int32>(7500, target->CountPctFromCurHealth(aurEff->GetAmount()));
caster->CastCustomSpell(target, SPELL_BLOODLETTING_DAMAGE, &damage, 0, 0, true); caster->CastSpell(target, SPELL_BLOODLETTING_DAMAGE, CastSpellExtraArgs(true).AddSpellBP0(damage));
target->CastCustomSpell(caster, SPELL_BLOODLETTING_HEAL, &damage, 0, 0, true); target->CastSpell(caster, SPELL_BLOODLETTING_HEAL, CastSpellExtraArgs(true).AddSpellBP0(damage));
} }
void Register() override void Register() override
@@ -533,7 +533,7 @@ class spell_venoxis_pool_of_acrid_tears : public AuraScript
{ {
uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell; uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell;
int32 radius = target->GetObjectScale() * 75; int32 radius = target->GetObjectScale() * 75;
target->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, radius, nullptr, true, nullptr, aurEff, target->GetGUID()); target->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).SetOriginalCaster(target->GetGUID()).AddSpellMod(SPELLVALUE_RADIUS_MOD, radius));
} }
} }
@@ -245,7 +245,7 @@ struct boss_zanzil : public BossAI
float z = _zanzilPosition.GetPositionZ(); float z = _zanzilPosition.GetPositionZ();
if (_zanzilPosition.GetExactDist2d(x, y) <= 30.0f) if (_zanzilPosition.GetExactDist2d(x, y) <= 30.0f)
me->CastSpell(x, y, z, SPELL_ZANZILI_FIRE_TRIGGERED, true); me->CastSpell({ x, y, z }, SPELL_ZANZILI_FIRE_TRIGGERED, true);
else else
me->RemoveAurasDueToSpell(SPELL_ZANZILI_FIRE); me->RemoveAurasDueToSpell(SPELL_ZANZILI_FIRE);
break; break;
@@ -321,7 +321,7 @@ struct boss_zanzil : public BossAI
Talk(SAY_ANNOUNCE_ZANZILI_BERSEKER); Talk(SAY_ANNOUNCE_ZANZILI_BERSEKER);
Talk(SAY_ZANZILI_BERSEKER); Talk(SAY_ZANZILI_BERSEKER);
me->CastSpell(nearestPos.GetPositionX(), nearestPos.GetPositionY(), nearestPos.GetPositionZ(), SPELL_ZANZILS_RESURRECTION_ELIXIR_BLUE); me->CastSpell({ nearestPos.GetPositionX(), nearestPos.GetPositionY(), nearestPos.GetPositionZ() }, SPELL_ZANZILS_RESURRECTION_ELIXIR_BLUE);
events.ScheduleEvent(EVENT_RESPAWN_BERSERKER, 13s); events.ScheduleEvent(EVENT_RESPAWN_BERSERKER, 13s);
break; break;
} }
@@ -340,7 +340,7 @@ struct boss_zanzil : public BossAI
Talk(SAY_ANNOUNCE_ZANZIL_ZOMBIES); Talk(SAY_ANNOUNCE_ZANZIL_ZOMBIES);
Talk(SAY_ZANZILI_ZOMBIES); Talk(SAY_ZANZILI_ZOMBIES);
me->CastSpell(nearestPos.GetPositionX(), nearestPos.GetPositionY(), nearestPos.GetPositionZ(), SPELL_ZANZILS_RESURRECTION_ELIXIR_RED); me->CastSpell({ nearestPos.GetPositionX(), nearestPos.GetPositionY(), nearestPos.GetPositionZ() }, SPELL_ZANZILS_RESURRECTION_ELIXIR_RED);
events.ScheduleEvent(EVENT_RESPAWN_ZOMBIE_GROUP, 13s); events.ScheduleEvent(EVENT_RESPAWN_ZOMBIE_GROUP, 13s);
break; break;
} }
@@ -514,7 +514,7 @@ class spell_zanzil_zanzils_resurrection_elixir : public AuraScript
if (!object) if (!object)
return; return;
GetTarget()->CastSpell(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), GetSpellInfo()->Effects[EFFECT_1].TriggerSpell, true); GetTarget()->CastSpell({ object->GetPositionX(), object->GetPositionY(), object->GetPositionZ() }, GetSpellInfo()->Effects[EFFECT_1].TriggerSpell, true);
} }
void Register() override void Register() override
@@ -545,7 +545,7 @@ class spell_zulgurub_ancient_guardian : public AuraScript
{ {
absorbAmount = dmgInfo.GetDamage(); absorbAmount = dmgInfo.GetDamage();
int32 health = target->CountPctFromMaxHealth(50) - absorbAmount; int32 health = target->CountPctFromMaxHealth(50) - absorbAmount;
target->CastCustomSpell(SPELL_ANCIENT_GUARDIAN_HEAL, SPELLVALUE_BASE_POINT0, health, target, true, nullptr, aurEff); target->CastSpell(target, SPELL_ANCIENT_GUARDIAN_HEAL, CastSpellExtraArgs(aurEff).AddSpellBP0(health));
Remove(); Remove();
} }
} }
@@ -467,7 +467,7 @@ struct npc_brazie_the_bonatist_vehicle : public VehicleAI
float x = pos.GetPositionX() + cos(angle) * 3; float x = pos.GetPositionX() + cos(angle) * 3;
float y = pos.GetPositionY() + sin(angle) * 3; float y = pos.GetPositionY() + sin(angle) * 3;
GetPlayer()->CastSpell(x, y, pos.GetPositionZ() + 50.0f, SPELL_CREATE_RANDOM_SUN_POWER, true); GetPlayer()->CastSpell({ x, y, pos.GetPositionZ() + 50.0f }, SPELL_CREATE_RANDOM_SUN_POWER, true);
switch (_currentLevel) switch (_currentLevel)
{ {
@@ -508,7 +508,7 @@ struct npc_brazie_the_bonatist_vehicle : public VehicleAI
} }
if (Player* player = GetPlayer()) if (Player* player = GetPlayer())
player->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), angle, spellId, true); player->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), angle }, spellId, true);
break; break;
} }
case EVENT_ANNOUNCE_GOOD_JOB: case EVENT_ANNOUNCE_GOOD_JOB:
@@ -592,19 +592,19 @@ private:
for (uint8 i = 0; i < MAX_TARGET_POSITIONS; i++) for (uint8 i = 0; i < MAX_TARGET_POSITIONS; i++)
{ {
Position pos = LawnMowerPositions[i]; Position pos = LawnMowerPositions[i];
charmer->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), LawnmowerOrientation, SPELL_CREATE_LAWMOWER, true); charmer->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), LawnmowerOrientation }, SPELL_CREATE_LAWMOWER, true);
pos = GoalStalkerPositions[i]; pos = GoalStalkerPositions[i];
charmer->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), GoalStalkerOrientation, SPELL_CREATE_GOAL_STALKER, true); charmer->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), GoalStalkerOrientation }, SPELL_CREATE_GOAL_STALKER, true);
pos = SpitterTargetPositions[i]; pos = SpitterTargetPositions[i];
charmer->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SpitterTargetOrientation, SPELL_CREATE_SPITTER_TARGET, true); charmer->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SpitterTargetOrientation }, SPELL_CREATE_SPITTER_TARGET, true);
} }
for (uint8 i = 0; i < MAX_EMPTY_SPOT_POSITIONS; i++) for (uint8 i = 0; i < MAX_EMPTY_SPOT_POSITIONS; i++)
{ {
Position pos = EmptySpotPositions[i]; Position pos = EmptySpotPositions[i];
charmer->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), EmptySpotOrientation, SPELL_CREATE_EMPTY_SPOT, true); charmer->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), EmptySpotOrientation }, SPELL_CREATE_EMPTY_SPOT, true);
} }
} }
@@ -917,7 +917,7 @@ struct npc_brazie_spot : public ScriptedAI
float x = pos.GetPositionX() + cos(angle) * 3; float x = pos.GetPositionX() + cos(angle) * 3;
float y = pos.GetPositionY() + sin(angle) * 3; float y = pos.GetPositionY() + sin(angle) * 3;
summoner->CastSpell(x, y, pos.GetPositionZ() + 50.0f, SPELL_CREATE_RANDOM_SUN_POWER, true); summoner->CastSpell({ x, y, pos.GetPositionZ() + 50.0f }, SPELL_CREATE_RANDOM_SUN_POWER, true);
} }
} }
_events.Repeat(17s); _events.Repeat(17s);
@@ -389,7 +389,7 @@ class spell_th_poison : public AuraScript
{ {
uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell; uint32 triggerSpell = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell;
int32 radius = int32(166.66f * aurEff->GetTickNumber()); int32 radius = int32(166.66f * aurEff->GetTickNumber());
target->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, radius, nullptr, true, nullptr, aurEff, target->GetGUID()); target->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).SetOriginalCaster(target->GetGUID()).AddSpellMod(SPELLVALUE_RADIUS_MOD, radius));
} }
} }
@@ -281,7 +281,7 @@ class spell_anetheron_vampiric_aura : public SpellScriptLoader
return; return;
int32 bp = damageInfo->GetDamage() * 3; int32 bp = damageInfo->GetDamage() * 3;
eventInfo.GetActor()->CastCustomSpell(SPELL_VAMPIRIC_AURA_HEAL, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetActor(), true, nullptr, aurEff); eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_VAMPIRIC_AURA_HEAL, CastSpellExtraArgs(aurEff).AddSpellBP0(bp));
} }
void Register() override void Register() override
@@ -474,7 +474,7 @@ public:
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))
{ {
@@ -211,7 +211,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);
} }
@@ -1323,7 +1323,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);
StrikeTimer = 2000 + rand32() % 1000; StrikeTimer = 2000 + rand32() % 1000;
} else StrikeTimer -= diff; } else StrikeTimer -= diff;
} }
@@ -1430,8 +1430,9 @@ public:
EnterEvadeMode(); EnterEvadeMode();
return; return;
} }
int dmg = 500 + rand32() % 700; int32 dmg = 500 + rand32() % 700;
me->CastCustomSpell(me->GetVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false);
me->CastSpell(me->GetVictim(), SPELL_EXPLODING_SHOT, { SPELLVALUE_BASE_POINT0, dmg });
ExplodeTimer = 5000 + rand32() % 5000; ExplodeTimer = 5000 + rand32() % 5000;
} else ExplodeTimer -= diff; } else ExplodeTimer -= diff;
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
@@ -708,7 +708,7 @@ struct boss_madness_of_deathwing : public BossAI
break; break;
} }
me->CastCustomSpell(SPELL_FACE_TRIGGER, SPELLVALUE_BASE_POINT0, facingSpellID); me->CastSpell(me, SPELL_FACE_TRIGGER, { SPELLVALUE_BASE_POINT0, facingSpellID });
// Nozdormu creates a time zone at the same moment when Deathwing faces a platform // Nozdormu creates a time zone at the same moment when Deathwing faces a platform
if (!_limbData[DRAGON_ASPECT_NOZDORMU].TentacleKilled) if (!_limbData[DRAGON_ASPECT_NOZDORMU].TentacleKilled)
@@ -1930,7 +1930,7 @@ class spell_madness_of_deathwing_regenerative_blood_periodic : public AuraScript
} }
int32 bp = _basePoints * 10; int32 bp = _basePoints * 10;
target->CastCustomSpell(SPELL_REGENERATIVE_BLOOD_SCRIPT, SPELLVALUE_BASE_POINT0, bp, target); target->CastSpell(target, SPELL_REGENERATIVE_BLOOD_SCRIPT, { SPELLVALUE_BASE_POINT0, bp });
if (aurEff->GetTickNumber() >= 20) if (aurEff->GetTickNumber() >= 20)
Remove(); Remove();
@@ -2016,11 +2016,11 @@ class spell_madness_of_deathwing_burning_blood : public AuraScript
uint8 stackDiff = std::max<int8>(0, uint8(lostHealthPct) - GetStackAmount()); uint8 stackDiff = std::max<int8>(0, uint8(lostHealthPct) - GetStackAmount());
if (stackDiff) if (stackDiff)
target->CastCustomSpell(GetSpellInfo()->Id, SPELLVALUE_AURA_STACK, stackDiff, target); target->CastSpell(target, GetSpellInfo()->Id, { SPELLVALUE_AURA_STACK, stackDiff });
uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, target); uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, target);
int32 bp = sSpellMgr->AssertSpellInfo(spellId)->Effects[EFFECT_0].CalcValue() * GetStackAmount(); int32 bp = sSpellMgr->AssertSpellInfo(spellId)->Effects[EFFECT_0].CalcValue() * GetStackAmount();
target->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, bp, target, true); target->CastSpell(target, spellId, CastSpellExtraArgs(true).AddSpellBP0(bp));
} }
void Register() override void Register() override
@@ -2600,7 +2600,7 @@ public:
if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId)) if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId))
if (uint32 triggerSpellId = spell->Effects[EFFECT_0].TriggerSpell) if (uint32 triggerSpellId = spell->Effects[EFFECT_0].TriggerSpell)
player->CastCustomSpell(triggerSpellId, SPELLVALUE_BASE_POINT1, spellId, player, true); player->CastSpell(player, triggerSpellId, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_BASE_POINT1, spellId));
return true; return true;
} }
@@ -631,7 +631,7 @@ public:
return; return;
int32 damage = CalculatePct(absorbAmount, reflectPct); int32 damage = CalculatePct(absorbAmount, reflectPct);
GetCaster()->CastCustomSpell(SPELL_VEIL_OF_SKY_DAMAGE, SPELLVALUE_BASE_POINT0, damage, dmgInfo.GetAttacker(), true); GetCaster()->CastSpell(dmgInfo.GetAttacker(), SPELL_VEIL_OF_SKY_DAMAGE, CastSpellExtraArgs(true).AddSpellBP0(damage));
} }
void Register() override void Register() override
@@ -339,14 +339,8 @@ class spell_anhuur_divine_reckoning : public AuraScript
void OnPeriodic(AuraEffect const* aurEff) void OnPeriodic(AuraEffect const* aurEff)
{ {
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
{
if (!caster->isDead()) if (!caster->isDead())
{ caster->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, { SPELLVALUE_BASE_POINT0, aurEff->GetAmount() });
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
caster->CastCustomSpell(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, values, GetTarget());
}
}
} }
void Register() override void Register() override
@@ -743,7 +743,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;
} }
@@ -193,7 +193,7 @@ class RelentlessStormTeleportEvent : public BasicEvent
float y = RelentlessStormTeleportReferencePos.GetPositionY() + frand(-15.0f, 15.0f); float y = RelentlessStormTeleportReferencePos.GetPositionY() + frand(-15.0f, 15.0f);
float z = RelentlessStormTeleportReferencePos.GetPositionZ() + frand(-15.0f, 15.0f); float z = RelentlessStormTeleportReferencePos.GetPositionZ() + frand(-15.0f, 15.0f);
_owner->CastSpell(x, y, z, SPELL_RELENTLESS_STORM_INITIAL_VEHICLE_RIDE_TELEPORT, true); _owner->CastSpell({ x, y, z }, SPELL_RELENTLESS_STORM_INITIAL_VEHICLE_RIDE_TELEPORT, true);
return true; return true;
} }
private: private:
@@ -444,8 +444,8 @@ struct boss_alakir : public BossAI
if (Creature* cloud = DoSummon(NPC_LIGHTNING_CLOUDS_BOTTOM, LightningCloudBottomPos, 0, TEMPSUMMON_MANUAL_DESPAWN)) if (Creature* cloud = DoSummon(NPC_LIGHTNING_CLOUDS_BOTTOM, LightningCloudBottomPos, 0, TEMPSUMMON_MANUAL_DESPAWN))
for (uint8 i = 0; i < 48; i++) for (uint8 i = 0; i < 48; i++)
cloud->CastSpell(LightningCloudsExtraVisualsBottomPositions[i].GetPositionX(), LightningCloudsExtraVisualsBottomPositions[i].GetPositionY(), cloud->CastSpell({ LightningCloudsExtraVisualsBottomPositions[i].GetPositionX(), LightningCloudsExtraVisualsBottomPositions[i].GetPositionY(),
LightningCloudsExtraVisualsBottomPositions[i].GetPositionZ(), SPELL_LIGHTNING_CLOUDS_SUMMON_EXTRA_VISUALS_BOTTOM); LightningCloudsExtraVisualsBottomPositions[i].GetPositionZ() }, SPELL_LIGHTNING_CLOUDS_SUMMON_EXTRA_VISUALS_BOTTOM);
} }
} }
@@ -512,8 +512,8 @@ struct boss_alakir : public BossAI
}, 5s); }, 5s);
for (uint8 i = 0; i < 24; i++) for (uint8 i = 0; i < 24; i++)
summon->CastSpell(LightningCloudsExtraVisualsPositions[i].GetPositionX(), LightningCloudsExtraVisualsPositions[i].GetPositionY(), summon->CastSpell({ LightningCloudsExtraVisualsPositions[i].GetPositionX(), LightningCloudsExtraVisualsPositions[i].GetPositionY(),
summon->GetPositionZ(), SPELL_LIGHTNING_CLOUDS_SUMMON_EXTRA_VISUALS); summon->GetPositionZ() }, SPELL_LIGHTNING_CLOUDS_SUMMON_EXTRA_VISUALS);
break; break;
default: default:
break; break;
@@ -666,7 +666,7 @@ struct npc_alakir_ice_storm : public ScriptedAI
if (!possibleDestinations.empty()) if (!possibleDestinations.empty())
{ {
Position dest = Trinity::Containers::SelectRandomContainerElement(possibleDestinations); Position dest = Trinity::Containers::SelectRandomContainerElement(possibleDestinations);
me->CastSpell(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), SPELL_ICE_STORM_CHARGE, true); me->CastSpell({ dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ() }, SPELL_ICE_STORM_CHARGE, true);
} }
break; break;
} }
@@ -811,7 +811,7 @@ class spell_alakir_lightning_strike_periodic : public SpellScript
float x = caster->GetPositionX() + cos(angle) * 75.0f; float x = caster->GetPositionX() + cos(angle) * 75.0f;
float y = caster->GetPositionY() + sin(angle) * 75.0f; float y = caster->GetPositionY() + sin(angle) * 75.0f;
float z = caster->GetPositionZ(); float z = caster->GetPositionZ();
caster->CastSpell(x, y, z, SPELL_LIGHTNING_STRIKE_VISUAL, true); caster->CastSpell({ x, y, z }, SPELL_LIGHTNING_STRIKE_VISUAL, true);
} }
} }
@@ -995,7 +995,7 @@ class spell_alakir_lightning_clouds_periodic : public AuraScript
Unit* target = GetTarget(); Unit* target = GetTarget();
Position pos = target->GetRandomPoint(target->GetPosition(), 80.0f); Position pos = target->GetRandomPoint(target->GetPosition(), 80.0f);
pos.m_positionZ = target->GetPositionZ() + frand(-10.0f, 10.0f); pos.m_positionZ = target->GetPositionZ() + frand(-10.0f, 10.0f);
target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_LIGHTNING_CLOUDS_VISUAL_DEST); target->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() }, SPELL_LIGHTNING_CLOUDS_VISUAL_DEST);
} }
void Register() override void Register() override
@@ -1048,7 +1048,7 @@ class spell_alakir_lightning_clouds_targeting : public SpellScript
float y = caster->GetPositionY(); float y = caster->GetPositionY();
float z = GetHitUnit()->GetPositionZ(); float z = GetHitUnit()->GetPositionZ();
float o = GetHitUnit()->GetOrientation(); float o = GetHitUnit()->GetOrientation();
caster->CastSpell(x, y, z, o, SPELL_SUMMON_LIGHTNING_CLOUDS_SUMMON); caster->CastSpell({ x, y, z, o }, SPELL_SUMMON_LIGHTNING_CLOUDS_SUMMON);
} }
} }
@@ -1137,7 +1137,7 @@ class spell_conclave_of_wind_winds : public AuraScript
} }
if (spellId) if (spellId)
owner->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, damage, owner, true); owner->CastSpell(owner, spellId, CastSpellExtraArgs(true).AddSpellBP0(damage));
} }
void Register() override void Register() override
@@ -460,7 +460,7 @@ struct npc_asaad_unstable_grounding_field : public ScriptedAI
DoCast(me, SPELL_STORM_SUMMON_GROUNDING_FIELD); DoCast(me, SPELL_STORM_SUMMON_GROUNDING_FIELD);
Position pos = ENSURE_AI(AsaadAI, asaad->AI())->GetTriangleCenterPosition(); Position pos = ENSURE_AI(AsaadAI, asaad->AI())->GetTriangleCenterPosition();
me->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_STORM_SUMMON_GROUNDING_FIELD, true); me->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() }, SPELL_STORM_SUMMON_GROUNDING_FIELD, true);
_events.ScheduleEvent(EVENT_STORM_ASAAD_TELEPORT, 500); _events.ScheduleEvent(EVENT_STORM_ASAAD_TELEPORT, 500);
break; break;
} }
@@ -693,7 +693,7 @@ class spell_mh_inferno : public AuraScript
bp += CalculatePct(bp, 10) * ticks; bp += CalculatePct(bp, 10) * ticks;
bp = std::min(bp, basePoints); bp = std::min(bp, basePoints);
caster->CastCustomSpell(SPELL_INFERNO_TRIGGERED, SPELLVALUE_BASE_POINT0, bp, caster, true); caster->CastSpell(caster, SPELL_INFERNO_TRIGGERED, CastSpellExtraArgs(true).AddSpellBP0(bp));
} }
void Register() override void Register() override
@@ -494,7 +494,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);
@@ -544,7 +544,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:
{ {
@@ -364,14 +364,14 @@ class boss_high_priestess_azil : public CreatureScript
if (events.IsInPhase(PHASE_ONE)) if (events.IsInPhase(PHASE_ONE))
{ {
if (Creature* worldtrigger = me->FindNearestCreature(NPC_WORLDTRIGGER, 150.0f)) if (Creature* worldtrigger = me->FindNearestCreature(NPC_WORLDTRIGGER, 150.0f))
worldtrigger->CastCustomSpell(SPELL_SUMMON_WAVE_SOUTH, SPELLVALUE_BASE_POINT0, 3, worldtrigger, true); worldtrigger->CastSpell(worldtrigger, SPELL_SUMMON_WAVE_SOUTH, { SPELLVALUE_BASE_POINT0, 3});
} }
else else
{ {
if (Creature* worldtrigger = me->FindNearestCreature(NPC_WORLDTRIGGER, 150.0f)) if (Creature* worldtrigger = me->FindNearestCreature(NPC_WORLDTRIGGER, 150.0f))
{ {
worldtrigger->CastCustomSpell(SPELL_SUMMON_WAVE_SOUTH, SPELLVALUE_BASE_POINT0, 10, worldtrigger, true); worldtrigger->CastSpell(worldtrigger, SPELL_SUMMON_WAVE_SOUTH, { SPELLVALUE_BASE_POINT0, 10 });
worldtrigger->CastCustomSpell(SPELL_SUMMON_WAVE_WEST, SPELLVALUE_BASE_POINT0, 10, worldtrigger, true); worldtrigger->CastSpell(worldtrigger, SPELL_SUMMON_WAVE_WEST, { SPELLVALUE_BASE_POINT0, 10 });
events.Repeat(10s, 13s); events.Repeat(10s, 13s);
} }
} }
@@ -720,7 +720,7 @@ class spell_azil_seismic_shard : public SpellScript
target->ExitVehicle(); target->ExitVehicle();
if (DynamicObject* dynamicObject = GetCaster()->GetDynObject(SPELL_SEISMIC_SHARD_TARGETING)) if (DynamicObject* dynamicObject = GetCaster()->GetDynObject(SPELL_SEISMIC_SHARD_TARGETING))
target->CastSpell(dynamicObject->GetPositionX(), dynamicObject->GetPositionY(), dynamicObject->GetPositionZ(), SPELL_SEISMIC_SHARD_MISSLE, true); target->CastSpell({ dynamicObject->GetPositionX(), dynamicObject->GetPositionY(), dynamicObject->GetPositionZ() }, SPELL_SEISMIC_SHARD_MISSLE, true);
} }
void Register() override void Register() override
@@ -203,7 +203,7 @@ class spell_ozruk_rupture : public AuraScript
float y = caster->GetPositionY() + sin(angle) * dist; float y = caster->GetPositionY() + sin(angle) * dist;
float z = caster->GetMap()->GetStaticHeight(caster->GetPhaseShift(), x, y, caster->GetPositionZ() + 3.0f); float z = caster->GetMap()->GetStaticHeight(caster->GetPhaseShift(), x, y, caster->GetPositionZ() + 3.0f);
if (std::abs(z) < caster->GetPositionZ() + 5.0f) if (std::abs(z) < caster->GetPositionZ() + 5.0f)
caster->CastSpell(x, y, z, SPELL_RUPTURE_SUMMON, true); caster->CastSpell({ x, y, z }, SPELL_RUPTURE_SUMMON, true);
angle += 0.2f; angle += 0.2f;
} }
} }
@@ -256,7 +256,7 @@ 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); GetCaster()->CastSpell(GetCaster(), SPELL_SWARM_BUFF, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_AURA_STACK, _targetCount));
} }
else else
GetCaster()->RemoveAurasDueToSpell(SPELL_SWARM_BUFF); GetCaster()->RemoveAurasDueToSpell(SPELL_SWARM_BUFF);
@@ -355,7 +355,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.GetPositionX(), _meteorStrikePos.GetPositionY(), _meteorStrikePos.GetPositionZ() }, 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));
@@ -1240,11 +1240,11 @@ 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); me->CastSpell(me, SPELL_SCALE_AURA, { SPELLVALUE_AURA_STACK, int32(stackAmount + 1) });
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); summoner->CastSpell(summoner, _explosionSpell, { SPELLVALUE_BASE_POINT0, damage });
} }
void UpdateAI(uint32 /*diff*/) override { } void UpdateAI(uint32 /*diff*/) override { }
@@ -1502,8 +1502,7 @@ 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->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).AddSpellMod(SPELLVALUE_RADIUS_MOD, radius).SetOriginalCaster(caster->GetGUID()));
caster->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, radius, (Unit*)nullptr, TRIGGERED_FULL_MASK, nullptr, aurEff, caster->GetGUID());
} }
void Register() override void Register() override
@@ -1552,7 +1551,7 @@ 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()); GetTarget()->CastSpell(GetTarget(), _summonSpellId, CastSpellExtraArgs(GetCasterGUID()).AddSpellMod(SPELLVALUE_BASE_POINT1, aurEff->GetBase()->GetStackAmount()));
} }
void Register() override void Register() override
@@ -1765,7 +1764,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->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ() }, SPELL_SUMMON_TWILIGHT_PORTAL, true);
caster->GetMap()->SummonCreature(NPC_TWILIGHT_HALION, HalionSpawnPos); caster->GetMap()->SummonCreature(NPC_TWILIGHT_HALION, HalionSpawnPos);
} }
@@ -196,7 +196,7 @@ 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); GetCaster()->CastSpell(GetCaster(), SPELL_RALLY, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_AURA_STACK, _targetCount));
} }
void Register() override void Register() override
@@ -664,7 +664,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
@@ -309,12 +309,12 @@ 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)); DoCastAOE(SPELL_PENETRATING_COLD, { SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 5) });
events.ScheduleEvent(EVENT_PENETRATING_COLD, 20*IN_MILLISECONDS, 0, PHASE_MELEE); 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)); DoCastAOE(SPELL_SUMMON_BURROWER, { SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 2, 4) });
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:
@@ -881,10 +881,11 @@ 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;
// Damage // Damage
caster->CastCustomSpell(target, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, true); caster->CastSpell(target, SPELL_LEECHING_SWARM_DMG, CastSpellExtraArgs(true).AddSpellBP0(lifeLeeched));
// Heal // Heal
caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, true); caster->CastSpell(caster, SPELL_LEECHING_SWARM_HEAL, CastSpellExtraArgs(true).AddSpellBP0(lifeLeeched));
} }
} }
@@ -2271,7 +2271,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
@@ -175,7 +175,7 @@ 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));
return; return;
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); me->CastSpell(me, SPELL_NETHER_POWER, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_AURA_STACK, RAID_MODE<uint32>(5, 10, 5, 10)));
events.ScheduleEvent(EVENT_NETHER_POWER, 40*IN_MILLISECONDS); events.ScheduleEvent(EVENT_NETHER_POWER, 40*IN_MILLISECONDS);
return; return;
case EVENT_LEGION_FLAME: case EVENT_LEGION_FLAME:
@@ -1332,7 +1332,7 @@ public:
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, { slowEff, GetCasterGUID() });
} }
} }
@@ -318,7 +318,7 @@ 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); me->CastSpell(target, TouchSpellId, { SPELLVALUE_MAX_TARGETS, 1 });
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:
@@ -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;
@@ -273,7 +273,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:
@@ -408,7 +408,7 @@ class spell_devourer_of_souls_mirrored_soul_proc : public SpellScriptLoader
return; return;
int32 damage = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), 45); int32 damage = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), 45);
GetTarget()->CastCustomSpell(SPELL_MIRRORED_SOUL_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetCaster(), true); GetTarget()->CastSpell(GetCaster(), SPELL_MIRRORED_SOUL_DAMAGE, CastSpellExtraArgs(true).AddSpellBP0(damage));
} }
void Register() override void Register() override
@@ -149,7 +149,7 @@ class spell_marwyn_shared_suffering : public SpellScriptLoader
{ {
int32 remainingDamage = aurEff->GetAmount() * (aurEff->GetTotalTicks() - aurEff->GetTickNumber()); int32 remainingDamage = aurEff->GetAmount() * (aurEff->GetTotalTicks() - aurEff->GetTickNumber());
if (remainingDamage > 0) if (remainingDamage > 0)
caster->CastCustomSpell(SPELL_SHARED_SUFFERING_DISPEL, SPELLVALUE_BASE_POINT1, remainingDamage, GetTarget(), TRIGGERED_FULL_MASK); caster->CastSpell(GetTarget(), SPELL_SHARED_SUFFERING_DISPEL, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_BASE_POINT1, remainingDamage));
} }
} }
@@ -280,7 +280,7 @@ class boss_ick : public CreatureScript
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); me->CastSpell(me, SPELL_PURSUIT, { SPELLVALUE_MAX_TARGETS, 1 });
break; break;
default: default:
break; break;
@@ -403,13 +403,13 @@ 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()); me->CastSpell(victim, SPELL_OVERLORD_BRAND_DAMAGE, CastSpellExtraArgs(tyrannus->GetGUID()).AddSpellBP0(damage));
} }
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()); me->CastSpell(tyrannus, SPELL_OVERLORD_BRAND_HEAL, CastSpellExtraArgs(tyrannus->GetGUID()).AddSpellBP0(int32(addHealth * 5.5f)));
} }
void UpdateAI(uint32 /*diff*/) override { } void UpdateAI(uint32 /*diff*/) override { }
@@ -232,7 +232,7 @@ 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); owner->CastSpell(owner, SPELL_MOJO_FRENZY_CAST_SPEED, CastSpellExtraArgs(true).AddSpellBP0(castSpeedBonus));
} }
void Register() override void Register() override
@@ -806,7 +806,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:
{ {
@@ -1450,7 +1450,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
@@ -663,7 +663,7 @@ class spell_blood_queen_essence_of_the_blood_queen : public SpellScriptLoader
return; return;
int32 heal = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); int32 heal = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
GetTarget()->CastCustomSpell(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), TRIGGERED_FULL_MASK, nullptr, aurEff); GetTarget()->CastSpell(GetTarget(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL, CastSpellExtraArgs(aurEff).AddSpellBP0(heal));
} }
void Register() override void Register() override
@@ -743,7 +743,7 @@ 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); GetTarget()->CastSpell(GetTarget(), SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, CastSpellExtraArgs(true).AddSpellBP0(damage));
} }
void Register() override void Register() override
@@ -435,7 +435,7 @@ 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); target->CastSpell(nullptr, SPELL_BLOOD_LINK_DUMMY, CastSpellExtraArgs(true).AddSpellBP0(1));
break; break;
default: default:
break; break;
@@ -1044,7 +1044,7 @@ 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); GetHitUnit()->CastSpell(GetHitUnit(), SPELL_BLOOD_LINK_POWER, CastSpellExtraArgs(true).AddSpellBP0(GetEffectValue()));
PreventHitDefaultEffect(EFFECT_0); PreventHitDefaultEffect(EFFECT_0);
} }
@@ -1152,7 +1152,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(true).AddSpellBP0(1));
} }
void Register() override void Register() override
@@ -1183,7 +1183,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
@@ -1213,7 +1213,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(true).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, { 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;
@@ -1823,7 +1823,8 @@ 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->GetPeriodic()), nullptr, TRIGGERED_FULL_MASK); int32 bp = 2 * (damageInfo->Effects[EFFECT_0].CalcValue() + aurEff->GetTickNumber() * aurEff->GetPeriodic());
GetTarget()->CastSpell(nullptr, SPELL_ROCKET_PACK_DAMAGE, CastSpellExtraArgs(true).AddSpellBP0(bp));
GetTarget()->CastSpell(nullptr, SPELL_ROCKET_BURST, TRIGGERED_FULL_MASK); GetTarget()->CastSpell(nullptr, SPELL_ROCKET_BURST, TRIGGERED_FULL_MASK);
} }
@@ -2195,7 +2196,7 @@ 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); GetCaster()->CastSpell(nullptr, uint32(GetEffectValue()), CastSpellExtraArgs(true).AddSpellBP0(8000));
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_BURNING_PITCH, TRIGGERED_FULL_MASK); GetHitUnit()->CastSpell(GetHitUnit(), SPELL_BURNING_PITCH, TRIGGERED_FULL_MASK);
} }
@@ -2257,7 +2258,7 @@ 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); GetCaster()->CastSpell(nullptr, instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE ? SPELL_BURNING_PITCH_DAMAGE_A : SPELL_BURNING_PITCH_DAMAGE_H, CastSpellExtraArgs(true).AddSpellBP0(5000));
} }
void Register() override void Register() override
@@ -368,7 +368,7 @@ 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); me->CastSpell(nullptr, SPELL_SUMMON_SPIRITS, { SPELLVALUE_MAX_TARGETS, Is25ManRaid() ? 2 : 1 });
summonShade.Repeat(); summonShade.Repeat();
}); });
@@ -382,7 +382,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
@@ -479,7 +479,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;
@@ -588,7 +588,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); me->CastSpell(nullptr, 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,7 @@ class npc_gas_cloud : public CreatureScript
void CastMainSpell() override void CastMainSpell() override
{ {
me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false); me->CastSpell(me, SPELL_GASEOUS_BLOAT, { SPELLVALUE_AURA_STACK, 10 });
} }
private: private:
@@ -849,7 +849,7 @@ 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); caster->CastSpell(caster, SPELL_GASEOUS_BLOAT, { SPELLVALUE_AURA_STACK, 10 });
} }
} }
@@ -863,7 +863,7 @@ 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); caster->CastSpell(nullptr, SPELL_EXPUNGED_GAS, { SPELLVALUE_BASE_POINT0, dmg });
} }
void Register() override void Register() override
@@ -1104,7 +1104,7 @@ class spell_putricide_ooze_tank_protection : public SpellScriptLoader
PreventDefaultAction(); PreventDefaultAction();
Unit* actionTarget = eventInfo.GetActionTarget(); Unit* actionTarget = eventInfo.GetActionTarget();
actionTarget->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, nullptr, aurEff); actionTarget->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, aurEff);
} }
void Register() override void Register() override
@@ -1136,7 +1136,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());
} }
} }
@@ -1298,8 +1298,7 @@ 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()->CastSpell(GetTarget(), triggerSpell, CastSpellExtraArgs(aurEff).SetOriginalCaster(GetCasterGUID()).AddSpellBP0(damage));
GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, nullptr, aurEff, GetCasterGUID());
} }
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1311,7 +1310,7 @@ 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()); GetTarget()->CastSpell(GetTarget(), healSpell, CastSpellExtraArgs(GetCasterGUID()).AddSpellBP0(heal));
} }
void Register() override void Register() override
@@ -472,7 +472,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)
@@ -545,7 +545,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
@@ -667,7 +667,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(false).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));
} }
@@ -744,7 +744,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((Unit*)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;
} }
@@ -370,7 +370,7 @@ 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); me->CastSpell(nullptr, SPELL_ICE_TOMB_TARGET, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 5, 2, 6)));
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);
@@ -507,7 +507,7 @@ 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); me->CastSpell(nullptr, SPELL_ICE_TOMB_TARGET, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_MAX_TARGETS, 1));
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:
@@ -517,7 +517,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);
events.ScheduleEvent(EVENT_FROST_BOMB, urand(6000, 8000)); events.ScheduleEvent(EVENT_FROST_BOMB, urand(6000, 8000));
break; break;
} }
@@ -1236,7 +1236,7 @@ class spell_sindragosa_instability : public SpellScriptLoader
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{ {
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired)) if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
GetTarget()->CastCustomSpell(SPELL_BACKLASH, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, nullptr, aurEff, GetCasterGUID()); GetTarget()->CastSpell(GetTarget(), SPELL_BACKLASH, CastSpellExtraArgs().SetOriginalCaster(GetCasterGUID()).AddSpellBP0(aurEff->GetAmount()).SetTriggeringAura(aurEff));
} }
void Register() override void Register() override
@@ -470,7 +470,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, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_MAX_TARGETS, 1));
if (--_counter) if (--_counter)
{ {
@@ -2105,11 +2105,8 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader
{ {
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell | AuraRemoveFlags::Expired | AuraRemoveFlags::ByDeath)) if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell | AuraRemoveFlags::Expired | AuraRemoveFlags::ByDeath))
return; return;
//args.AddSpellMod(SPELLVALUE_AURA_STACK, 2);
CustomSpellValues values; GetTarget()->CastSpell(nullptr, SPELL_NECROTIC_PLAGUE_JUMP, CastSpellExtraArgs(GetCasterGUID()).AddSpellMod(SPELLVALUE_MAX_TARGETS, 1));
//values.AddSpellMod(SPELLVALUE_AURA_STACK, 2);
values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1);
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);
} }
@@ -2193,9 +2190,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired | AuraRemoveFlags::ByDeath)) if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired | AuraRemoveFlags::ByDeath))
{ {
CustomSpellValues values; GetTarget()->CastSpell(nullptr, SPELL_NECROTIC_PLAGUE_JUMP, CastSpellExtraArgs(GetCasterGUID()).AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()));
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
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);
} }
@@ -2212,10 +2207,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.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
values.AddSpellMod(SPELLVALUE_BASE_POINT1, static_cast<uint32>(AuraRemoveFlags::ByEnemySpell)); // add as marker (spell has no effect 1) args.AddSpellMod(SPELLVALUE_BASE_POINT1, static_cast<uint32>(AuraRemoveFlags::ByEnemySpell)); // 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);
@@ -2606,7 +2601,7 @@ 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); GetHitUnit()->CastSpell(GetCaster(), SPELL_LIFE_SIPHON_HEAL, CastSpellExtraArgs(true).AddSpellBP0(GetHitDamage() * 10));
} }
void Register() override void Register() override
@@ -2644,7 +2639,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((Unit*)nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, nullptr, aurEff, GetCasterGUID()); GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, CastSpellExtraArgs(aurEff).SetOriginalCaster(GetCasterGUID()));
} }
void Register() override void Register() override
@@ -2794,7 +2789,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().HasFlag(AuraRemoveFlags::ByDeath)) if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
GetTarget()->CastSpell((Unit*)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
@@ -2856,7 +2851,7 @@ 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()); caster->CastSpell(GetTarget(), SPELL_SOUL_RIP_DAMAGE, CastSpellExtraArgs(aurEff).SetOriginalCaster(GetCasterGUID()).AddSpellBP0(5000 * aurEff->GetTickNumber()));
} }
void Register() override void Register() override
@@ -2949,7 +2944,7 @@ class spell_the_lich_king_dark_hunger : public SpellScriptLoader
return; return;
int32 heal = static_cast<int32>(damageInfo->GetDamage()) / 2; int32 heal = static_cast<int32>(damageInfo->GetDamage()) / 2;
GetTarget()->CastCustomSpell(SPELL_DARK_HUNGER_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), true, nullptr, aurEff); GetTarget()->CastSpell(GetTarget(), SPELL_DARK_HUNGER_HEAL, CastSpellExtraArgs(aurEff).AddSpellBP0(heal));
} }
void Register() override void Register() override
@@ -2980,7 +2975,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().HasFlag(AuraRemoveFlags::ByDeath)) if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
GetTarget()->CastSpell((Unit*)nullptr, SPELL_HARVESTED_SOUL, true, nullptr, nullptr, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING)); GetTarget()->CastSpell((Unit*)nullptr, SPELL_HARVESTED_SOUL, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
} }
void Register() override void Register() override
@@ -720,7 +720,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); me->CastSpell(me, SPELL_CARESS_OF_DEATH, CastSpellExtraArgs(true).AddSpellMod(SPELLVALUE_MAX_TARGETS, 1));
break; break;
case ACTION_START_GAUNTLET: case ACTION_START_GAUNTLET:
me->setActive(true); me->setActive(true);
@@ -777,7 +777,7 @@ 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); summon->CastSpell(target, VEHICLE_SPELL_RIDE_HARDCODED, { SPELLVALUE_BASE_POINT0, 1 });
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;
@@ -23,6 +23,7 @@
#include "Player.h" #include "Player.h"
#include "ScriptedGossip.h" #include "ScriptedGossip.h"
#include "Spell.h" #include "Spell.h"
#include "SpellInfo.h"
#include "SpellMgr.h" #include "SpellMgr.h"
static std::vector<uint32> const TeleportSpells = static std::vector<uint32> const TeleportSpells =
@@ -64,7 +65,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;
} }
}; };
@@ -138,7 +138,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);
} }
@@ -194,7 +194,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();
} }
@@ -727,7 +727,7 @@ class spell_four_horsemen_mark : public SpellScriptLoader
break; break;
} }
if (damage) if (damage)
caster->CastCustomSpell(SPELL_MARK_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget()); caster->CastSpell(GetTarget(), SPELL_MARK_DAMAGE, { SPELLVALUE_BASE_POINT0, damage });
} }
} }
@@ -311,7 +311,7 @@ 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); GetCaster()->CastSpell(unit, SPELL_DECIMATE_DMG, { SPELLVALUE_BASE_POINT0, damage });
} }
} }
@@ -161,7 +161,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, CastSpellExtraArgs(aurEff).SetOriginalCaster(GetCasterGUID()));
} }
} }
@@ -196,7 +196,7 @@ 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); GetTarget()->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).AddSpellMod(SPELLVALUE_RADIUS_MOD, mod));
} }
void Register() override void Register() override
@@ -934,7 +934,7 @@ 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); target->CastSpell(target, SPELL_MANA_DETONATION_DAMAGE, CastSpellExtraArgs(aurEff).AddSpellBP0(int32(-mana * 10)));
} }
} }
@@ -179,7 +179,7 @@ class spell_loatheb_deathbloom : public SpellScriptLoader
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired)) if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
return; return;
GetTarget()->CastSpell(nullptr, SPELL_DEATHBLOOM_FINAL_DAMAGE, true, nullptr, eff, GetCasterGUID()); GetTarget()->CastSpell(nullptr, SPELL_DEATHBLOOM_FINAL_DAMAGE, { eff, GetCasterGUID() });
} }
void Register() override void Register() override
@@ -215,7 +215,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());
} }
} }
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff. Show more