mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 15:27:47 -04:00
Core: Code cleanup (here and there)
This commit is contained in:
@@ -12093,11 +12093,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update)
|
||||
|
||||
if (pProto && isInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0)
|
||||
{
|
||||
uint32 cooldownSpell = 6119;
|
||||
|
||||
if (getClass() == CLASS_ROGUE)
|
||||
cooldownSpell = 6123;
|
||||
|
||||
uint32 cooldownSpell = getClass() == CLASS_ROGUE ? 6123 : 6119;
|
||||
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell);
|
||||
|
||||
if (!spellProto)
|
||||
|
||||
@@ -791,7 +791,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
|
||||
victim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, spellProto ? spellProto->Id : 0);
|
||||
|
||||
if (victim->GetTypeId() != TYPEID_PLAYER)
|
||||
victim->AddThreat(this, (float)damage, damageSchoolMask, spellProto);
|
||||
victim->AddThreat(this, float(damage), damageSchoolMask, spellProto);
|
||||
else // victim is a player
|
||||
{
|
||||
// random durability for items (HIT TAKEN)
|
||||
@@ -892,12 +892,12 @@ void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags
|
||||
CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
|
||||
}
|
||||
|
||||
void Unit::CastSpell(Unit* victim, SpellInfo const *spellInfo, bool triggered, Item *castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/)
|
||||
void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item *castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/)
|
||||
{
|
||||
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, uint64 originalCaster)
|
||||
void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
|
||||
{
|
||||
if (!spellInfo)
|
||||
{
|
||||
@@ -910,7 +910,7 @@ void Unit::CastSpell(Unit* Victim, SpellInfo const* spellInfo, TriggerCastFlags
|
||||
originalCaster=owner->GetGUID();
|
||||
|
||||
SpellCastTargets targets;
|
||||
targets.SetUnitTarget(Victim);
|
||||
targets.SetUnitTarget(victim);
|
||||
|
||||
if (castItem)
|
||||
sLog->outStaticDebug("WORLD: cast Item spellId - %i", spellInfo->Id);
|
||||
@@ -943,7 +943,7 @@ void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit*
|
||||
CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster);
|
||||
}
|
||||
|
||||
void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* Victim, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
|
||||
void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!spellInfo)
|
||||
@@ -953,7 +953,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit*
|
||||
}
|
||||
|
||||
SpellCastTargets targets;
|
||||
targets.SetUnitTarget(Victim);
|
||||
targets.SetUnitTarget(victim);
|
||||
|
||||
if (!originalCaster && triggeredByAura)
|
||||
originalCaster = triggeredByAura->GetCasterGUID();
|
||||
@@ -2303,7 +2303,7 @@ int32 Unit::GetMechanicResistChance(const SpellInfo *spell)
|
||||
int32 resist_mech = 0;
|
||||
for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
|
||||
{
|
||||
if (spell->Effects[eff].Effect == 0)
|
||||
if (!spell->Effects[eff].IsEffect())
|
||||
break;
|
||||
int32 effect_mech = spell->GetEffectMechanic(eff);
|
||||
if (effect_mech)
|
||||
@@ -5741,20 +5741,17 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
{
|
||||
switch (dummySpell->Id)
|
||||
{
|
||||
case 11119: basepoints0 = int32(0.08f * damage); break;
|
||||
case 11120: basepoints0 = int32(0.16f * damage); break;
|
||||
case 12846: basepoints0 = int32(0.24f * damage); break;
|
||||
case 12847: basepoints0 = int32(0.32f * damage); break;
|
||||
case 12848: basepoints0 = int32(0.40f * damage); break;
|
||||
case 11119: basepoints0 = int32(0.04f * damage); break;
|
||||
case 11120: basepoints0 = int32(0.08f * damage); break;
|
||||
case 12846: basepoints0 = int32(0.12f * damage); break;
|
||||
case 12847: basepoints0 = int32(0.16f * damage); break;
|
||||
case 12848: basepoints0 = int32(0.20f * damage); break;
|
||||
default:
|
||||
sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2 damage tick
|
||||
basepoints0 /= 2;
|
||||
triggered_spell_id = 12654;
|
||||
// Add remaining ticks to damage done
|
||||
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
break;
|
||||
}
|
||||
@@ -6592,19 +6589,18 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
|
||||
switch (dummySpell->Id)
|
||||
{
|
||||
case 34477: // Misdirection
|
||||
{
|
||||
triggered_spell_id = 35079; // 4 sec buff on self
|
||||
target = this;
|
||||
return true;
|
||||
}
|
||||
case 57870: // Glyph of Mend Pet
|
||||
{
|
||||
victim->CastSpell(victim, 57894, true, NULL, NULL, GetGUID());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Misdirection
|
||||
if (dummySpell->Id == 34477)
|
||||
{
|
||||
triggered_spell_id = 35079; // 4 sec buff on self
|
||||
target = this;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPELLFAMILY_PALADIN:
|
||||
@@ -8137,7 +8133,10 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
|
||||
CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -14210,7 +14209,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
|
||||
continue;
|
||||
|
||||
// Triggered spells not triggering additional spells
|
||||
bool triggered= !(spellProto->AttributesEx3 & SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED) ?
|
||||
bool triggered = !(spellProto->AttributesEx3 & SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED) ?
|
||||
(procExtra & PROC_EX_INTERNAL_TRIGGERED && !(procFlag & PROC_FLAG_DONE_TRAP_ACTIVATION)) : false;
|
||||
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
|
||||
@@ -267,44 +267,44 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MessageDistDeliverer::Visit(CreatureMapType &m)
|
||||
void MessageDistDeliverer::Visit(CreatureMapType &m)
|
||||
{
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
if (!iter->getSource()->InSamePhase(i_phaseMask))
|
||||
Creature* target = iter->getSource();
|
||||
if (!target->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
||||
if (iter->getSource()->GetExactDist2dSq(i_source) > i_distSq)
|
||||
if (target->GetExactDist2dSq(i_source) > i_distSq)
|
||||
continue;
|
||||
|
||||
// Send packet to all who are sharing the creature's vision
|
||||
if (!iter->getSource()->GetSharedVisionList().empty())
|
||||
if (!target->GetSharedVisionList().empty())
|
||||
{
|
||||
SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
|
||||
for (; i != iter->getSource()->GetSharedVisionList().end(); ++i)
|
||||
if ((*i)->m_seer == iter->getSource())
|
||||
SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
|
||||
for (; i != target->GetSharedVisionList().end(); ++i)
|
||||
if ((*i)->m_seer == target)
|
||||
SendPacket(*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MessageDistDeliverer::Visit(DynamicObjectMapType &m)
|
||||
void MessageDistDeliverer::Visit(DynamicObjectMapType &m)
|
||||
{
|
||||
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
if (!iter->getSource()->InSamePhase(i_phaseMask))
|
||||
DynamicObject *target = iter->getSource();
|
||||
if (!target->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
||||
if (iter->getSource()->GetExactDist2dSq(i_source) > i_distSq)
|
||||
if (target->GetExactDist2dSq(i_source) > i_distSq)
|
||||
continue;
|
||||
|
||||
if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
|
||||
if (IS_PLAYER_GUID(target->GetCasterGUID()))
|
||||
{
|
||||
// Send packet back to the caster if the caster has vision of dynamic object
|
||||
Player* caster = (Player*)iter->getSource()->GetCaster();
|
||||
if (caster && caster->m_seer == iter->getSource())
|
||||
Player* caster = (Player*)target->GetCaster();
|
||||
if (caster && caster->m_seer == target)
|
||||
SendPacket(caster);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1241,7 +1241,7 @@ enum Mechanics
|
||||
(1<<MECHANIC_TURN)|(1<<MECHANIC_HORROR)|(1<<MECHANIC_DAZE)| \
|
||||
(1<<MECHANIC_SAPPED))
|
||||
|
||||
// Spell dispell type
|
||||
// Spell dispel type
|
||||
enum DispelType
|
||||
{
|
||||
DISPEL_NONE = 0,
|
||||
|
||||
@@ -373,10 +373,10 @@ void SpellCastTargets::SetDst(WorldObject const& wObj)
|
||||
|
||||
void SpellCastTargets::SetDst(SpellCastTargets const& spellTargets)
|
||||
{
|
||||
m_dstTransGUID = spellTargets.m_dstTransGUID;
|
||||
m_dstTransOffset.Relocate(spellTargets.m_dstTransOffset);
|
||||
m_dstPos.Relocate(spellTargets.m_dstPos);
|
||||
m_targetMask |= TARGET_FLAG_DEST_LOCATION;
|
||||
m_dstTransGUID = spellTargets.m_dstTransGUID;
|
||||
m_dstTransOffset.Relocate(spellTargets.m_dstTransOffset);
|
||||
m_dstPos.Relocate(spellTargets.m_dstPos);
|
||||
m_targetMask |= TARGET_FLAG_DEST_LOCATION;
|
||||
}
|
||||
|
||||
void SpellCastTargets::ModDst(Position const& pos)
|
||||
@@ -739,7 +739,7 @@ void Spell::SelectSpellTargets()
|
||||
|
||||
// add here custom effects that need default target.
|
||||
// FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
|
||||
switch(m_spellInfo->Effects[i].Effect)
|
||||
switch (m_spellInfo->Effects[i].Effect)
|
||||
{
|
||||
case SPELL_EFFECT_DUMMY:
|
||||
{
|
||||
@@ -803,7 +803,7 @@ void Spell::SelectSpellTargets()
|
||||
AddUnitTarget(pet, i);
|
||||
break;
|
||||
case SPELL_EFFECT_APPLY_AURA:
|
||||
switch(m_spellInfo->Effects[i].ApplyAuraName)
|
||||
switch (m_spellInfo->Effects[i].ApplyAuraName)
|
||||
{
|
||||
case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_UNIT_CASTER(1) (and present for other ranks for same spell for example)
|
||||
case SPELL_AURA_ADD_PCT_MODIFIER:
|
||||
@@ -949,9 +949,7 @@ void Spell::prepareDataForTriggerSystem(AuraEffect const* /*triggeredByAura*/)
|
||||
}
|
||||
// Totem casts require spellfamilymask defined in spell_proc_event to proc
|
||||
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isTotem() && m_caster->IsControlledByPlayer())
|
||||
{
|
||||
m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY;
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::CleanupTargetList()
|
||||
@@ -1852,7 +1850,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, SpellNo
|
||||
return;
|
||||
|
||||
Position const* pos;
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case PUSH_DST_CENTER:
|
||||
CheckDst();
|
||||
@@ -1913,7 +1911,7 @@ void Spell::SearchGOAreaTarget(std::list<GameObject*> &TagGOMap, float radius, S
|
||||
|
||||
WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, SpellEffIndex effIndex)
|
||||
{
|
||||
switch(TargetType)
|
||||
switch (TargetType)
|
||||
{
|
||||
case SPELL_TARGETS_ENTRY:
|
||||
{
|
||||
@@ -1936,7 +1934,7 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe
|
||||
continue;
|
||||
if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & (1 << uint32(effIndex))))
|
||||
continue;
|
||||
switch((*i_spellST)->mConditionValue1)
|
||||
switch ((*i_spellST)->mConditionValue1)
|
||||
{
|
||||
case SPELL_TARGET_TYPE_CONTROLLED:
|
||||
for (Unit::ControlList::iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr)
|
||||
@@ -2016,11 +2014,11 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
if (m_originalCaster)
|
||||
modOwner = m_originalCaster->GetSpellModOwner();
|
||||
|
||||
switch(cur.GetType())
|
||||
switch (cur.GetType())
|
||||
{
|
||||
case TARGET_TYPE_UNIT_CASTER:
|
||||
{
|
||||
switch(cur.GetTarget())
|
||||
switch (cur.GetTarget())
|
||||
{
|
||||
case TARGET_UNIT_CASTER:
|
||||
AddUnitTarget(m_caster, i, false);
|
||||
@@ -2084,7 +2082,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
break;
|
||||
}
|
||||
|
||||
switch(cur.GetTarget())
|
||||
switch (cur.GetTarget())
|
||||
{
|
||||
case TARGET_UNIT_TARGET_ENEMY:
|
||||
if (Unit *magnet = m_caster->SelectMagnetTarget(target, m_spellInfo))
|
||||
@@ -2128,7 +2126,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
WorldObject *target = NULL;
|
||||
float range;
|
||||
|
||||
switch(cur.GetTarget())
|
||||
switch (cur.GetTarget())
|
||||
{
|
||||
case TARGET_UNIT_NEARBY_ENEMY:
|
||||
range = m_spellInfo->GetMaxRange(false);
|
||||
@@ -2210,7 +2208,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
else if (cur.GetTarget() == TARGET_DEST_CASTER_RANDOM)
|
||||
dist = objSize + (dist - objSize) * (float)rand_norm();
|
||||
|
||||
switch(cur.GetTarget())
|
||||
switch (cur.GetTarget())
|
||||
{
|
||||
case TARGET_DEST_CASTER_FRONT_LEFT: angle = static_cast<float>(-M_PI/4); break;
|
||||
case TARGET_DEST_CASTER_BACK_LEFT: angle = static_cast<float>(-3*M_PI/4); break;
|
||||
@@ -2259,7 +2257,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
else if (cur.GetTarget() == TARGET_DEST_TARGET_RANDOM)
|
||||
dist = objSize + (dist - objSize) * (float)rand_norm();
|
||||
|
||||
switch(cur.GetTarget())
|
||||
switch (cur.GetTarget())
|
||||
{
|
||||
case TARGET_DEST_TARGET_FRONT: angle = 0.0f; break;
|
||||
case TARGET_DEST_TARGET_BACK: angle = static_cast<float>(M_PI); break;
|
||||
@@ -2288,7 +2286,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
}
|
||||
|
||||
float angle;
|
||||
switch(cur.GetTarget())
|
||||
switch (cur.GetTarget())
|
||||
{
|
||||
case TARGET_DEST_DYNOBJ_ENEMY:
|
||||
case TARGET_DEST_DYNOBJ_ALLY:
|
||||
@@ -2322,7 +2320,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
|
||||
case TARGET_TYPE_DEST_SPECIAL:
|
||||
{
|
||||
switch(cur.GetTarget())
|
||||
switch (cur.GetTarget())
|
||||
{
|
||||
case TARGET_DEST_DB:
|
||||
if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id))
|
||||
@@ -2478,7 +2476,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
|
||||
float radius;
|
||||
SpellTargets targetType;
|
||||
switch(cur.GetTarget())
|
||||
switch (cur.GetTarget())
|
||||
{
|
||||
case TARGET_UNIT_SRC_AREA_ENEMY:
|
||||
case TARGET_UNIT_DEST_AREA_ENEMY:
|
||||
@@ -2552,7 +2550,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
{
|
||||
if (WorldObject* result = FindCorpseUsing<Trinity::RaiseDeadObjectCheck> ())
|
||||
{
|
||||
switch(result->GetTypeId())
|
||||
switch (result->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
m_targets.SetDst(*result);
|
||||
@@ -3210,7 +3208,7 @@ void Spell::cast(bool skipCheck)
|
||||
|
||||
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
switch(m_spellInfo->Effects[i].Effect)
|
||||
switch (m_spellInfo->Effects[i].Effect)
|
||||
{
|
||||
case SPELL_EFFECT_CHARGE:
|
||||
case SPELL_EFFECT_CHARGE_DEST:
|
||||
@@ -3446,7 +3444,7 @@ void Spell::_handle_immediate_phase()
|
||||
positive = false;
|
||||
break;
|
||||
}
|
||||
switch(m_spellInfo->DmgClass)
|
||||
switch (m_spellInfo->DmgClass)
|
||||
{
|
||||
case SPELL_DAMAGE_CLASS_MAGIC:
|
||||
if (positive)
|
||||
@@ -3526,7 +3524,7 @@ void Spell::update(uint32 difftime)
|
||||
cancel();
|
||||
}
|
||||
|
||||
switch(m_spellState)
|
||||
switch (m_spellState)
|
||||
{
|
||||
case SPELL_STATE_PREPARING:
|
||||
{
|
||||
@@ -3722,7 +3720,7 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas
|
||||
break;
|
||||
case SPELL_FAILED_REQUIRES_AREA:
|
||||
// hardcode areas limitation case
|
||||
switch(spellInfo->Id)
|
||||
switch (spellInfo->Id)
|
||||
{
|
||||
case 41617: // Cenarion Mana Salve
|
||||
case 41619: // Cenarion Healing Salve
|
||||
@@ -3970,7 +3968,7 @@ void Spell::WriteAmmoToPacket(WorldPacket * data)
|
||||
{
|
||||
if (itemEntry->Class == ITEM_CLASS_WEAPON)
|
||||
{
|
||||
switch(itemEntry->SubClass)
|
||||
switch (itemEntry->SubClass)
|
||||
{
|
||||
case ITEM_SUBCLASS_WEAPON_THROWN:
|
||||
ammoDisplayID = itemEntry->DisplayId;
|
||||
@@ -4289,10 +4287,11 @@ void Spell::TakePower()
|
||||
if (m_CastItem || m_triggeredByAuraSpell)
|
||||
return;
|
||||
|
||||
Powers powerType = Powers(m_spellInfo->PowerType);
|
||||
bool hit = true;
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (m_spellInfo->PowerType == POWER_RAGE || m_spellInfo->PowerType == POWER_ENERGY || m_spellInfo->PowerType == POWER_RUNE)
|
||||
if (powerType == POWER_RAGE || powerType == POWER_ENERGY || powerType == POWER_RUNE)
|
||||
if (uint64 targetGUID = m_targets.GetUnitTargetGUID())
|
||||
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||
if (ihit->targetGUID == targetGUID)
|
||||
@@ -4309,8 +4308,6 @@ void Spell::TakePower()
|
||||
}
|
||||
}
|
||||
|
||||
Powers powerType = Powers(m_spellInfo->PowerType);
|
||||
|
||||
if (powerType == POWER_RUNE)
|
||||
{
|
||||
TakeRunePower(hit);
|
||||
@@ -4321,15 +4318,15 @@ void Spell::TakePower()
|
||||
return;
|
||||
|
||||
// health as power used
|
||||
if (m_spellInfo->PowerType == POWER_HEALTH)
|
||||
if (powerType == POWER_HEALTH)
|
||||
{
|
||||
m_caster->ModifyHealth(-(int32)m_powerCost);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_spellInfo->PowerType >= MAX_POWERS)
|
||||
if (powerType >= MAX_POWERS)
|
||||
{
|
||||
sLog->outError("Spell::TakePower: Unknown power type '%d'", m_spellInfo->PowerType);
|
||||
sLog->outError("Spell::TakePower: Unknown power type '%d'", powerType);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4489,11 +4486,15 @@ void Spell::TakeReagents()
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
ItemTemplate const* castItemTemplate = m_CastItem
|
||||
? m_CastItem->GetTemplate()
|
||||
: NULL;
|
||||
|
||||
// do not take reagents for these item casts
|
||||
if (m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
|
||||
if (castItemTemplate && castItemTemplate->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
|
||||
return;
|
||||
|
||||
Player* p_caster = (Player*)m_caster;
|
||||
Player* p_caster = m_caster->ToPlayer();
|
||||
if (p_caster->CanNoReagentCast(m_spellInfo))
|
||||
return;
|
||||
|
||||
@@ -4506,24 +4507,20 @@ void Spell::TakeReagents()
|
||||
uint32 itemcount = m_spellInfo->ReagentCount[x];
|
||||
|
||||
// if CastItem is also spell reagent
|
||||
if (m_CastItem)
|
||||
if (castItemTemplate && castItemTemplate->ItemId == itemid)
|
||||
{
|
||||
ItemTemplate const *proto = m_CastItem->GetTemplate();
|
||||
if (proto && proto->ItemId == itemid)
|
||||
for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
||||
{
|
||||
for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
||||
// CastItem will be used up and does not count as reagent
|
||||
int32 charges = m_CastItem->GetSpellCharges(s);
|
||||
if (castItemTemplate->Spells[s].SpellCharges < 0 && abs(charges) < 2)
|
||||
{
|
||||
// CastItem will be used up and does not count as reagent
|
||||
int32 charges = m_CastItem->GetSpellCharges(s);
|
||||
if (proto->Spells[s].SpellCharges < 0 && abs(charges) < 2)
|
||||
{
|
||||
++itemcount;
|
||||
break;
|
||||
}
|
||||
++itemcount;
|
||||
break;
|
||||
}
|
||||
|
||||
m_CastItem = NULL;
|
||||
}
|
||||
|
||||
m_CastItem = NULL;
|
||||
}
|
||||
|
||||
// if GetItemTarget is also spell reagent
|
||||
@@ -4884,7 +4881,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
|
||||
{
|
||||
// for effects of spells that have only one target
|
||||
switch(m_spellInfo->Effects[i].Effect)
|
||||
switch (m_spellInfo->Effects[i].Effect)
|
||||
{
|
||||
case SPELL_EFFECT_DUMMY:
|
||||
{
|
||||
@@ -5140,7 +5137,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[i].MiscValueB);
|
||||
if (!SummonProperties)
|
||||
break;
|
||||
switch(SummonProperties->Category)
|
||||
switch (SummonProperties->Category)
|
||||
{
|
||||
case SUMMON_CATEGORY_PET:
|
||||
if (m_caster->GetPetGUID())
|
||||
@@ -5277,12 +5274,12 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
|
||||
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
|
||||
{
|
||||
switch(m_spellInfo->Effects[i].ApplyAuraName)
|
||||
switch (m_spellInfo->Effects[i].ApplyAuraName)
|
||||
{
|
||||
case SPELL_AURA_DUMMY:
|
||||
{
|
||||
//custom check
|
||||
switch(m_spellInfo->Id)
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
// Tag Murloc
|
||||
case 30877:
|
||||
@@ -6166,7 +6163,7 @@ SpellCastResult Spell::CheckItems()
|
||||
if (!pItem || pItem->IsBroken())
|
||||
return SPELL_FAILED_EQUIPPED_ITEM;
|
||||
|
||||
switch(pItem->GetTemplate()->SubClass)
|
||||
switch (pItem->GetTemplate()->SubClass)
|
||||
{
|
||||
case ITEM_SUBCLASS_WEAPON_THROWN:
|
||||
{
|
||||
@@ -6196,7 +6193,7 @@ SpellCastResult Spell::CheckItems()
|
||||
return SPELL_FAILED_NO_AMMO;
|
||||
|
||||
// check ammo ws. weapon compatibility
|
||||
switch(pItem->GetTemplate()->SubClass)
|
||||
switch (pItem->GetTemplate()->SubClass)
|
||||
{
|
||||
case ITEM_SUBCLASS_WEAPON_BOW:
|
||||
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
|
||||
@@ -6393,7 +6390,7 @@ CurrentSpellTypes Spell::GetCurrentContainer() const
|
||||
|
||||
bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
|
||||
{
|
||||
switch(m_spellInfo->Effects[eff].ApplyAuraName)
|
||||
switch (m_spellInfo->Effects[eff].ApplyAuraName)
|
||||
{
|
||||
case SPELL_AURA_MOD_POSSESS:
|
||||
case SPELL_AURA_MOD_CHARM:
|
||||
@@ -6418,7 +6415,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
|
||||
|
||||
// todo: shit below shouldn't be here, but it's temporary
|
||||
//Check targets for LOS visibility (except spells without range limitations)
|
||||
switch(m_spellInfo->Effects[eff].Effect)
|
||||
switch (m_spellInfo->Effects[eff].Effect)
|
||||
{
|
||||
case SPELL_EFFECT_RESURRECT_NEW:
|
||||
// player far away, maybe his corpse near?
|
||||
@@ -6698,7 +6695,7 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float * mu
|
||||
m_damage = 0;
|
||||
damage = CalculateDamage(i, NULL);
|
||||
|
||||
switch(m_spellInfo->Effects[i].Effect)
|
||||
switch (m_spellInfo->Effects[i].Effect)
|
||||
{
|
||||
case SPELL_EFFECT_SCHOOL_DAMAGE:
|
||||
SpellDamageSchoolDmg((SpellEffIndex)i);
|
||||
@@ -6759,7 +6756,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
|
||||
|
||||
for (int j = 0; j < MAX_LOCK_CASE; ++j)
|
||||
{
|
||||
switch(lockInfo->Type[j])
|
||||
switch (lockInfo->Type[j])
|
||||
{
|
||||
// check key item (many fit cases can be)
|
||||
case LOCK_KEY_ITEM:
|
||||
|
||||
@@ -6967,7 +6967,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
|
||||
|
||||
if (!(spellInfo->AttributesEx7 & SPELL_ATTR7_SUMMON_PLAYER_TOTEM))
|
||||
continue;
|
||||
|
||||
|
||||
uint32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
|
||||
if (m_caster->GetPower(POWER_MANA) < cost)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user