aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorSpp- <spp@jorge.gr>2011-09-05 14:01:50 +0200
committerSpp- <spp@jorge.gr>2011-09-05 14:01:50 +0200
commit3fac9914be2893eb40a8ef9f2f343b935eef42ab (patch)
tree8663c7148beda20602f5b93847665cfe82361b88 /src/server/game/Entities
parent35680c2f1ff941d0aa6e0483e60f6e407e209025 (diff)
Core: Code cleanup (here and there)
Diffstat (limited to 'src/server/game/Entities')
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp6
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp45
2 files changed, 23 insertions, 28 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e0adb99bc37..063127c77a9 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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)
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index be46e9b1ffb..b5dbb89b2cc 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -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)