Core/Unit: Cleanup; mostly purging a ton of dead code.
TODO: Move packet stuff out of Unit into packet handlers... --HG-- branch : trunk
This commit is contained in:
@@ -226,13 +226,6 @@ Unit::~Unit()
|
|||||||
|
|
||||||
void Unit::Update(uint32 p_time)
|
void Unit::Update(uint32 p_time)
|
||||||
{
|
{
|
||||||
/*if (p_time > m_AurasCheck)
|
|
||||||
{
|
|
||||||
m_AurasCheck = 2000;
|
|
||||||
_UpdateAura();
|
|
||||||
} else
|
|
||||||
m_AurasCheck -= p_time;*/
|
|
||||||
|
|
||||||
// WARNING! Order of execution here is important, do not change.
|
// WARNING! Order of execution here is important, do not change.
|
||||||
// Spells must be processed with event system BEFORE they go to _UpdateSpells.
|
// Spells must be processed with event system BEFORE they go to _UpdateSpells.
|
||||||
// Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
|
// Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
|
||||||
@@ -399,53 +392,6 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 M
|
|||||||
SendMessageToSet(&data, true);
|
SendMessageToSet(&data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player)
|
|
||||||
{
|
|
||||||
float moveTime = Time;
|
|
||||||
|
|
||||||
WorldPacket data(SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()));
|
|
||||||
data.append(GetPackGUID());
|
|
||||||
data << uint8(0); // new in 3.1
|
|
||||||
data << GetPositionX() << GetPositionY() << GetPositionZ();
|
|
||||||
data << uint32(getMSTime());
|
|
||||||
|
|
||||||
data << uint8(type); // unknown
|
|
||||||
switch(type)
|
|
||||||
{
|
|
||||||
case 0: // normal packet
|
|
||||||
break;
|
|
||||||
case 1: // stop packet (raw pos?)
|
|
||||||
SendMessageToSet(&data, true);
|
|
||||||
return;
|
|
||||||
case 2: // facing spot, not used currently
|
|
||||||
data << float(0);
|
|
||||||
data << float(0);
|
|
||||||
data << float(0);
|
|
||||||
break;
|
|
||||||
case 3: // not used currently
|
|
||||||
data << uint64(0); // probably target guid (facing target?)
|
|
||||||
break;
|
|
||||||
case 4: // not used currently
|
|
||||||
data << float(0); // facing angle
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
data << uint32(MovementFlags);
|
|
||||||
|
|
||||||
//enable me if things goes wrong or looks ugly, it is however an old hack
|
|
||||||
//if (MovementFlags & MONSTER_MOVE_WALK)
|
|
||||||
//moveTime *= 1.05f;
|
|
||||||
|
|
||||||
data << uint32(moveTime); // Time in between points
|
|
||||||
data << uint32(1); // 1 single waypoint
|
|
||||||
data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
|
|
||||||
|
|
||||||
if (player)
|
|
||||||
player->GetSession()->SendPacket(&data);
|
|
||||||
else
|
|
||||||
SendMessageToSet(&data, true);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void Unit::SendMonsterMoveTransport(Unit *vehicleOwner)
|
void Unit::SendMonsterMoveTransport(Unit *vehicleOwner)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicleOwner->GetPackGUID().size());
|
WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicleOwner->GetPackGUID().size());
|
||||||
@@ -575,8 +521,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||||||
{
|
{
|
||||||
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsAIEnabled)
|
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsAIEnabled)
|
||||||
pVictim->ToCreature()->AI()->DamageTaken(this, damage);
|
pVictim->ToCreature()->AI()->DamageTaken(this, damage);
|
||||||
else if (pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->IsAIEnabled)
|
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->IsAIEnabled)
|
||||||
this->ToCreature()->AI()->DamageDealt(pVictim, damage);
|
this->ToCreature()->AI()->DamageDealt(pVictim, damage);
|
||||||
@@ -600,7 +544,8 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||||||
SpellEntry const * spell = (*i)->GetSpellProto();
|
SpellEntry const * spell = (*i)->GetSpellProto();
|
||||||
|
|
||||||
uint32 share = uint32(damage * (float((*i)->GetAmount()) / 100.0f));
|
uint32 share = uint32(damage * (float((*i)->GetAmount()) / 100.0f));
|
||||||
// TODO: check packets if damage is done by pVictim, or by attacker of pVicitm
|
|
||||||
|
// TODO: check packets if damage is done by pVictim, or by attacker of pVictim
|
||||||
DealDamageMods(shareDamageTarget, share, NULL);
|
DealDamageMods(shareDamageTarget, share, NULL);
|
||||||
DealDamage(shareDamageTarget, share, NULL, NODAMAGE, GetSpellSchoolMask(spell), spell, false);
|
DealDamage(shareDamageTarget, share, NULL, NODAMAGE, GetSpellSchoolMask(spell), spell, false);
|
||||||
}
|
}
|
||||||
@@ -616,10 +561,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||||||
{
|
{
|
||||||
case BASE_ATTACK:
|
case BASE_ATTACK:
|
||||||
{
|
{
|
||||||
if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
|
|
||||||
weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType)/1000.0f * 7);
|
|
||||||
else
|
|
||||||
weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType) / 1000.0f * 3.5f);
|
weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType) / 1000.0f * 3.5f);
|
||||||
|
if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
|
||||||
|
weaponSpeedHitFactor *= 2;
|
||||||
|
|
||||||
RewardRage(rage_damage, weaponSpeedHitFactor, true);
|
RewardRage(rage_damage, weaponSpeedHitFactor, true);
|
||||||
|
|
||||||
@@ -627,10 +571,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||||||
}
|
}
|
||||||
case OFF_ATTACK:
|
case OFF_ATTACK:
|
||||||
{
|
{
|
||||||
if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
|
|
||||||
weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType)/1000.0f * 3.5f);
|
|
||||||
else
|
|
||||||
weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType) / 1000.0f * 1.75f);
|
weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType) / 1000.0f * 1.75f);
|
||||||
|
if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
|
||||||
|
weaponSpeedHitFactor *= 2;
|
||||||
|
|
||||||
RewardRage(rage_damage, weaponSpeedHitFactor, true);
|
RewardRage(rage_damage, weaponSpeedHitFactor, true);
|
||||||
|
|
||||||
@@ -674,13 +617,8 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||||||
|
|
||||||
// in bg, count dmg if victim is also a player
|
// in bg, count dmg if victim is also a player
|
||||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
|
||||||
if (Battleground *bg = killer->GetBattleground())
|
if (Battleground *bg = killer->GetBattleground())
|
||||||
{
|
|
||||||
// FIXME: kept by compatibility. don't know in BG if the restriction apply.
|
|
||||||
bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
|
bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, pVictim);
|
killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, pVictim);
|
||||||
killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage);
|
killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage);
|
||||||
@@ -690,7 +628,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||||||
pVictim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage);
|
pVictim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage);
|
||||||
else if (!pVictim->IsControlledByPlayer())
|
else if (!pVictim->IsControlledByPlayer())
|
||||||
{
|
{
|
||||||
//!pVictim->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER)
|
|
||||||
if (!pVictim->ToCreature()->hasLootRecipient())
|
if (!pVictim->ToCreature()->hasLootRecipient())
|
||||||
pVictim->ToCreature()->SetLootRecipient(this);
|
pVictim->ToCreature()->SetLootRecipient(this);
|
||||||
|
|
||||||
@@ -705,14 +642,15 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
pVictim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health);
|
pVictim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health);
|
||||||
|
|
||||||
// call before auras are removed
|
// call before auras are removed
|
||||||
if (Player* killer = ToPlayer())
|
if (Player* killer = this->ToPlayer()) // keep the this-> for clarity
|
||||||
killer->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 0, 0, pVictim);
|
killer->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 0, 0, pVictim);
|
||||||
}
|
}
|
||||||
|
|
||||||
Kill(pVictim, durabilityLoss);
|
Kill(pVictim, durabilityLoss);
|
||||||
}
|
}
|
||||||
else // if (health > damage)
|
else
|
||||||
{
|
{
|
||||||
sLog.outStaticDebug("DealDamageAlive");
|
sLog.outStaticDebug("DealDamageAlive");
|
||||||
|
|
||||||
@@ -758,7 +696,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damagetype != NODAMAGE && damage)// && pVictim->GetTypeId() == TYPEID_PLAYER)
|
if (damagetype != NODAMAGE && damage)
|
||||||
{
|
{
|
||||||
if (pVictim != this && pVictim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back
|
if (pVictim != this && pVictim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back
|
||||||
{
|
{
|
||||||
@@ -793,7 +731,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||||||
if (duel_hasEnded)
|
if (duel_hasEnded)
|
||||||
{
|
{
|
||||||
ASSERT(pVictim->GetTypeId() == TYPEID_PLAYER);
|
ASSERT(pVictim->GetTypeId() == TYPEID_PLAYER);
|
||||||
Player *he = (Player*)pVictim;
|
Player *he = pVictim->ToPlayer();
|
||||||
|
|
||||||
ASSERT(he->duel);
|
ASSERT(he->duel);
|
||||||
|
|
||||||
@@ -1080,20 +1018,17 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
|
|||||||
|
|
||||||
// Calculate absorb resist
|
// Calculate absorb resist
|
||||||
if (damage > 0)
|
if (damage > 0)
|
||||||
{
|
|
||||||
switch (spellInfo->SpellIconID)
|
|
||||||
{
|
{
|
||||||
// Chaos Bolt - "Chaos Bolt cannot be resisted, and pierces through all absorption effects."
|
// Chaos Bolt - "Chaos Bolt cannot be resisted, and pierces through all absorption effects."
|
||||||
case 3178:
|
if (spellInfo->SpellIconID != 3178)
|
||||||
break;
|
{
|
||||||
default:
|
|
||||||
CalcAbsorbResist(pVictim, damageSchoolMask, SPELL_DIRECT_DAMAGE, damage, &damageInfo->absorb, &damageInfo->resist, spellInfo);
|
CalcAbsorbResist(pVictim, damageSchoolMask, SPELL_DIRECT_DAMAGE, damage, &damageInfo->absorb, &damageInfo->resist, spellInfo);
|
||||||
damage -= damageInfo->absorb + damageInfo->resist;
|
damage -= damageInfo->absorb + damageInfo->resist;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
damage = 0;
|
damage = 0;
|
||||||
|
|
||||||
damageInfo->damage = damage;
|
damageInfo->damage = damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1122,6 +1057,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
|
|||||||
if (pVictim != this && IsControlledByPlayer() && pVictim->IsControlledByPlayer())
|
if (pVictim != this && IsControlledByPlayer() && pVictim->IsControlledByPlayer())
|
||||||
{
|
{
|
||||||
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
|
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
|
||||||
|
|
||||||
if (area && area->IsSanctuary()) // sanctuary
|
if (area && area->IsSanctuary()) // sanctuary
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1184,6 +1120,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||||||
damageInfo->cleanDamage = 0;
|
damageInfo->cleanDamage = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
damage += CalculateDamage(damageInfo->attackType, false, true);
|
damage += CalculateDamage(damageInfo->attackType, false, true);
|
||||||
// Add melee damage bonus
|
// Add melee damage bonus
|
||||||
MeleeDamageBonus(damageInfo->target, &damage, damageInfo->attackType);
|
MeleeDamageBonus(damageInfo->target, &damage, damageInfo->attackType);
|
||||||
@@ -1209,8 +1146,8 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||||||
damageInfo->procEx|=PROC_EX_EVADE;
|
damageInfo->procEx|=PROC_EX_EVADE;
|
||||||
damageInfo->damage = 0;
|
damageInfo->damage = 0;
|
||||||
damageInfo->cleanDamage = 0;
|
damageInfo->cleanDamage = 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
case MELEE_HIT_MISS:
|
case MELEE_HIT_MISS:
|
||||||
{
|
{
|
||||||
damageInfo->HitInfo |= HITINFO_MISS;
|
damageInfo->HitInfo |= HITINFO_MISS;
|
||||||
@@ -1219,8 +1156,8 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||||||
damageInfo->procEx |= PROC_EX_MISS;
|
damageInfo->procEx |= PROC_EX_MISS;
|
||||||
damageInfo->damage = 0;
|
damageInfo->damage = 0;
|
||||||
damageInfo->cleanDamage = 0;
|
damageInfo->cleanDamage = 0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case MELEE_HIT_NORMAL:
|
case MELEE_HIT_NORMAL:
|
||||||
damageInfo->TargetState = VICTIMSTATE_HIT;
|
damageInfo->TargetState = VICTIMSTATE_HIT;
|
||||||
damageInfo->procEx|=PROC_EX_NORMAL_HIT;
|
damageInfo->procEx|=PROC_EX_NORMAL_HIT;
|
||||||
@@ -1249,15 +1186,14 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||||||
mod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
|
mod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
|
||||||
if (mod != 0)
|
if (mod != 0)
|
||||||
damageInfo->damage = int32((damageInfo->damage) * float((100.0f + mod)/100.0f));
|
damageInfo->damage = int32((damageInfo->damage) * float((100.0f + mod)/100.0f));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case MELEE_HIT_PARRY:
|
case MELEE_HIT_PARRY:
|
||||||
damageInfo->TargetState = VICTIMSTATE_PARRY;
|
damageInfo->TargetState = VICTIMSTATE_PARRY;
|
||||||
damageInfo->procEx |= PROC_EX_PARRY;
|
damageInfo->procEx |= PROC_EX_PARRY;
|
||||||
damageInfo->cleanDamage += damageInfo->damage;
|
damageInfo->cleanDamage += damageInfo->damage;
|
||||||
damageInfo->damage = 0;
|
damageInfo->damage = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MELEE_HIT_DODGE:
|
case MELEE_HIT_DODGE:
|
||||||
damageInfo->TargetState = VICTIMSTATE_DODGE;
|
damageInfo->TargetState = VICTIMSTATE_DODGE;
|
||||||
damageInfo->procEx |= PROC_EX_DODGE;
|
damageInfo->procEx |= PROC_EX_DODGE;
|
||||||
@@ -1283,20 +1219,21 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||||||
damageInfo->procEx |= PROC_EX_NORMAL_HIT;
|
damageInfo->procEx |= PROC_EX_NORMAL_HIT;
|
||||||
damageInfo->damage -= damageInfo->blocked_amount;
|
damageInfo->damage -= damageInfo->blocked_amount;
|
||||||
damageInfo->cleanDamage += damageInfo->blocked_amount;
|
damageInfo->cleanDamage += damageInfo->blocked_amount;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case MELEE_HIT_GLANCING:
|
case MELEE_HIT_GLANCING:
|
||||||
{
|
{
|
||||||
damageInfo->HitInfo |= HITINFO_GLANCING;
|
damageInfo->HitInfo |= HITINFO_GLANCING;
|
||||||
damageInfo->TargetState = VICTIMSTATE_HIT;
|
damageInfo->TargetState = VICTIMSTATE_HIT;
|
||||||
damageInfo->procEx |= PROC_EX_NORMAL_HIT;
|
damageInfo->procEx |= PROC_EX_NORMAL_HIT;
|
||||||
int32 leveldif = int32(pVictim->getLevel()) - int32(getLevel());
|
int32 leveldif = int32(pVictim->getLevel()) - int32(getLevel());
|
||||||
if (leveldif > 3) leveldif = 3;
|
if (leveldif > 3)
|
||||||
|
leveldif = 3;
|
||||||
float reducePercent = 1 - leveldif * 0.1f;
|
float reducePercent = 1 - leveldif * 0.1f;
|
||||||
damageInfo->cleanDamage += damageInfo->damage-uint32(reducePercent * damageInfo->damage);
|
damageInfo->cleanDamage += damageInfo->damage-uint32(reducePercent * damageInfo->damage);
|
||||||
damageInfo->damage = uint32(reducePercent * damageInfo->damage);
|
damageInfo->damage = uint32(reducePercent * damageInfo->damage);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case MELEE_HIT_CRUSHING:
|
case MELEE_HIT_CRUSHING:
|
||||||
{
|
{
|
||||||
damageInfo->HitInfo |= HITINFO_CRUSHING;
|
damageInfo->HitInfo |= HITINFO_CRUSHING;
|
||||||
@@ -1304,8 +1241,8 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||||||
damageInfo->procEx |= PROC_EX_NORMAL_HIT;
|
damageInfo->procEx |= PROC_EX_NORMAL_HIT;
|
||||||
// 150% normal damage
|
// 150% normal damage
|
||||||
damageInfo->damage += (damageInfo->damage / 2);
|
damageInfo->damage += (damageInfo->damage / 2);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1437,6 +1374,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||||||
pVictim->SendSpellMiss(this, i_spellProto->Id, missInfo);
|
pVictim->SendSpellMiss(this, i_spellProto->Id, missInfo);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...or immuned
|
// ...or immuned
|
||||||
if (IsImmunedToDamage(i_spellProto))
|
if (IsImmunedToDamage(i_spellProto))
|
||||||
{
|
{
|
||||||
@@ -1449,6 +1387,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||||||
// No Unit::CalcAbsorbResist here - opcode doesn't send that data - this damage is probably not affected by that
|
// No Unit::CalcAbsorbResist here - opcode doesn't send that data - this damage is probably not affected by that
|
||||||
pVictim->DealDamageMods(this,damage,NULL);
|
pVictim->DealDamageMods(this,damage,NULL);
|
||||||
|
|
||||||
|
// TODO: Move this to a packet handler
|
||||||
WorldPacket data(SMSG_SPELLDAMAGESHIELD,(8+8+4+4+4+4));
|
WorldPacket data(SMSG_SPELLDAMAGESHIELD,(8+8+4+4+4+4));
|
||||||
data << uint64(pVictim->GetGUID());
|
data << uint64(pVictim->GetGUID());
|
||||||
data << uint64(GetGUID());
|
data << uint64(GetGUID());
|
||||||
@@ -1549,7 +1488,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt
|
|||||||
{
|
{
|
||||||
float maxArmorPen=0;
|
float maxArmorPen=0;
|
||||||
if (getLevel() < 60)
|
if (getLevel() < 60)
|
||||||
maxArmorPen=(float)(400+85*pVictim->getLevel());
|
maxArmorPen = float(400 + 85 * pVictim->getLevel());
|
||||||
else
|
else
|
||||||
maxArmorPen = 400 + 85 * pVictim->getLevel() + 4.5f * 85 * (pVictim->getLevel() - 59);
|
maxArmorPen = 400 + 85 * pVictim->getLevel() + 4.5f * 85 * (pVictim->getLevel() - 59);
|
||||||
// Cap armor penetration to this number
|
// Cap armor penetration to this number
|
||||||
@@ -1559,8 +1498,6 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt
|
|||||||
// Got the value, apply it
|
// Got the value, apply it
|
||||||
armor -= armorPen;
|
armor -= armorPen;
|
||||||
}
|
}
|
||||||
// Ignore enemy armor by SPELL_AURA_MOD_TARGET_ARMOR_PCT
|
|
||||||
//armor *= 1.0f - GetTotalAuraModifier(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT) / 100.0f;
|
|
||||||
|
|
||||||
if (armor < 0.0f)
|
if (armor < 0.0f)
|
||||||
armor = 0.0f;
|
armor = 0.0f;
|
||||||
@@ -1600,13 +1537,9 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
|||||||
float resistanceConstant = 0.0f;
|
float resistanceConstant = 0.0f;
|
||||||
|
|
||||||
if (level == BOSS_LEVEL)
|
if (level == BOSS_LEVEL)
|
||||||
{
|
|
||||||
resistanceConstant = BOSS_RESISTANCE_CONSTANT;
|
resistanceConstant = BOSS_RESISTANCE_CONSTANT;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
resistanceConstant = level * 5.0f;
|
resistanceConstant = level * 5.0f;
|
||||||
}
|
|
||||||
|
|
||||||
float averageResist = victimResistance / (victimResistance + resistanceConstant);
|
float averageResist = victimResistance / (victimResistance + resistanceConstant);
|
||||||
float discreteResistProbability[11];
|
float discreteResistProbability[11];
|
||||||
@@ -1614,10 +1547,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
|||||||
{
|
{
|
||||||
discreteResistProbability[i] = 0.5f - 2.5f * fabs(0.1f * i - averageResist);
|
discreteResistProbability[i] = 0.5f - 2.5f * fabs(0.1f * i - averageResist);
|
||||||
if (discreteResistProbability[i] < 0.0f)
|
if (discreteResistProbability[i] < 0.0f)
|
||||||
{
|
|
||||||
discreteResistProbability[i] = 0.0f;
|
discreteResistProbability[i] = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (averageResist <= 0.1f)
|
if (averageResist <= 0.1f)
|
||||||
{
|
{
|
||||||
@@ -1629,11 +1560,13 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
|||||||
float r = (float)rand_norm();
|
float r = (float)rand_norm();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
float probabilitySum = discreteResistProbability[0];
|
float probabilitySum = discreteResistProbability[0];
|
||||||
|
|
||||||
while (r >= probabilitySum && i < 10)
|
while (r >= probabilitySum && i < 10)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
probabilitySum += discreteResistProbability[i];
|
probabilitySum += discreteResistProbability[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 damageResisted = damage * i / 10;
|
uint32 damageResisted = damage * i / 10;
|
||||||
|
|
||||||
*resist += damageResisted;
|
*resist += damageResisted;
|
||||||
@@ -2065,7 +1998,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
|||||||
AuraEffectList const& vSplitDamagePct = pVictim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
|
AuraEffectList const& vSplitDamagePct = pVictim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
|
||||||
for (AuraEffectList::const_iterator i = vSplitDamagePct.begin(), next; i != vSplitDamagePct.end() && RemainingDamage >= 0; i = next)
|
for (AuraEffectList::const_iterator i = vSplitDamagePct.begin(), next; i != vSplitDamagePct.end() && RemainingDamage >= 0; i = next)
|
||||||
{
|
{
|
||||||
next = i; ++next;
|
next = i;
|
||||||
|
++next;
|
||||||
|
|
||||||
// check damage school mask
|
// check damage school mask
|
||||||
if (((*i)->GetMiscValue() & schoolMask) == 0)
|
if (((*i)->GetMiscValue() & schoolMask) == 0)
|
||||||
@@ -2116,6 +2050,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
|||||||
{
|
{
|
||||||
pVictim->CastSpell(pVictim, 31231, true);
|
pVictim->CastSpell(pVictim, 31231, true);
|
||||||
pVictim->ToPlayer()->AddSpellCooldown(31231, 0, time(NULL) + 60);
|
pVictim->ToPlayer()->AddSpellCooldown(31231, 0, time(NULL) + 60);
|
||||||
|
|
||||||
// with health > 10% lost health until health == 10%, in other case no losses
|
// with health > 10% lost health until health == 10%, in other case no losses
|
||||||
uint32 health10 = pVictim->CountPctFromMaxHealth(10);
|
uint32 health10 = pVictim->CountPctFromMaxHealth(10);
|
||||||
RemainingDamage = pVictim->GetHealth() > health10 ? pVictim->GetHealth() - health10 : 0;
|
RemainingDamage = pVictim->GetHealth() > health10 ? pVictim->GetHealth() - health10 : 0;
|
||||||
@@ -2166,8 +2101,7 @@ void Unit::CalcHealAbsorb(Unit *pVictim, const SpellEntry *healSpell, uint32 &he
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int32 RemainingHeal = healAmount;
|
int32 RemainingHeal = healAmount;
|
||||||
// Get unit state (need for some absorb check)
|
|
||||||
//uint32 unitflag = pVictim->GetUInt32Value(UNIT_FIELD_FLAGS);
|
|
||||||
// Need remove expired auras after
|
// Need remove expired auras after
|
||||||
bool existExpired = false;
|
bool existExpired = false;
|
||||||
|
|
||||||
@@ -2178,8 +2112,6 @@ void Unit::CalcHealAbsorb(Unit *pVictim, const SpellEntry *healSpell, uint32 &he
|
|||||||
if (!((*i)->GetMiscValue() & healSpell->SchoolMask))
|
if (!((*i)->GetMiscValue() & healSpell->SchoolMask))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//SpellEntry const* spellProto = (*i)->GetSpellProto();
|
|
||||||
|
|
||||||
// Max Amount can be absorbed by this aura
|
// Max Amount can be absorbed by this aura
|
||||||
int32 currentAbsorb = (*i)->GetAmount();
|
int32 currentAbsorb = (*i)->GetAmount();
|
||||||
|
|
||||||
@@ -2249,9 +2181,7 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
|
|||||||
|
|
||||||
// melee attack spell casted at main hand attack only - no normal melee dmg dealt
|
// melee attack spell casted at main hand attack only - no normal melee dmg dealt
|
||||||
if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL])
|
if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL])
|
||||||
{
|
|
||||||
m_currentSpells[CURRENT_MELEE_SPELL]->cast();
|
m_currentSpells[CURRENT_MELEE_SPELL]->cast();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// attack can be redirected to another target
|
// attack can be redirected to another target
|
||||||
@@ -2272,10 +2202,6 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
|
|||||||
else
|
else
|
||||||
sLog.outStaticDebug("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
|
sLog.outStaticDebug("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
|
||||||
GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
|
GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
|
||||||
|
|
||||||
// if damage pVictim call AI reaction
|
|
||||||
//if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->AI())
|
|
||||||
// pVictim->ToCreature()->AI()->AttackedBy(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!extra && m_extraAttacks)
|
if(!extra && m_extraAttacks)
|
||||||
@@ -2379,9 +2305,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
|||||||
|
|
||||||
// check if attack comes from behind, nobody can parry or block if attacker is behind
|
// check if attack comes from behind, nobody can parry or block if attacker is behind
|
||||||
if (!pVictim->HasInArc(M_PI, this) && !pVictim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
if (!pVictim->HasInArc(M_PI, this) && !pVictim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
||||||
{
|
|
||||||
sLog.outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind.");
|
sLog.outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind.");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Reduce parry chance by attacker expertise rating
|
// Reduce parry chance by attacker expertise rating
|
||||||
@@ -2507,9 +2431,7 @@ uint32 Unit::CalculateDamage(WeaponAttackType attType, bool normalized, bool add
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (min_damage > max_damage)
|
if (min_damage > max_damage)
|
||||||
{
|
|
||||||
std::swap(min_damage,max_damage);
|
std::swap(min_damage,max_damage);
|
||||||
}
|
|
||||||
|
|
||||||
if (max_damage == 0.0f)
|
if (max_damage == 0.0f)
|
||||||
max_damage = 5.0f;
|
max_damage = 5.0f;
|
||||||
@@ -2554,27 +2476,12 @@ void Unit::SendMeleeAttackStop(Unit* victim)
|
|||||||
data << uint32(0); // can be 0x1
|
data << uint32(0); // can be 0x1
|
||||||
SendMessageToSet(&data, true);
|
SendMessageToSet(&data, true);
|
||||||
sLog.outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"),victim->GetGUIDLow());
|
sLog.outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"),victim->GetGUIDLow());
|
||||||
|
|
||||||
/*if (victim->GetTypeId() == TYPEID_UNIT)
|
|
||||||
victim->ToCreature()->AI().EnterEvadeMode(this);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const * /*spellProto*/, WeaponAttackType attackType)
|
bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const * /*spellProto*/, WeaponAttackType attackType)
|
||||||
{
|
{
|
||||||
if (pVictim->HasInArc(M_PI,this) || pVictim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
if (pVictim->HasInArc(M_PI,this) || pVictim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
||||||
{
|
{
|
||||||
/* Currently not exist spells with ignore block
|
|
||||||
// Ignore combat result aura (parry/dodge check on prepare)
|
|
||||||
AuraList const& ignore = GetAuraEffectsByType(SPELL_AURA_IGNORE_COMBAT_RESULT);
|
|
||||||
for (AuraList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
|
|
||||||
{
|
|
||||||
if (!(*i)->IsAffectedOnSpell(spellProto))
|
|
||||||
continue;
|
|
||||||
if ((*i)->GetMiscValue() == )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Check creatures flags_extra for disable block
|
// Check creatures flags_extra for disable block
|
||||||
if (pVictim->GetTypeId() == TYPEID_UNIT &&
|
if (pVictim->GetTypeId() == TYPEID_UNIT &&
|
||||||
pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
|
pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
|
||||||
@@ -2595,51 +2502,6 @@ bool Unit::isBlockCritical()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Melee based spells can be miss, parry or dodge on this step
|
|
||||||
// Crit or block - determined on damage calculation phase! (and can be both in some time)
|
|
||||||
/*float Unit::MeleeSpellMissChance(Unit *pVictim, WeaponAttackType attType, int32 skillDiff, SpellEntry const *spell)
|
|
||||||
{
|
|
||||||
// Calculate hit chance (more correct for chance mod)
|
|
||||||
int32 HitChance;
|
|
||||||
|
|
||||||
// PvP - PvE melee chances
|
|
||||||
int32 lchance = pVictim->GetTypeId() == TYPEID_PLAYER ? 5 : 7;
|
|
||||||
int32 leveldif = pVictim->getLevelForTarget(this) - getLevelForTarget(pVictim);
|
|
||||||
if (leveldif < 3)
|
|
||||||
HitChance = 95 - leveldif;
|
|
||||||
else
|
|
||||||
HitChance = 93 - (leveldif - 2) * lchance;
|
|
||||||
|
|
||||||
// Hit chance depends from victim auras
|
|
||||||
if (attType == RANGED_ATTACK)
|
|
||||||
HitChance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE);
|
|
||||||
else
|
|
||||||
HitChance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);
|
|
||||||
|
|
||||||
// Spellmod from SPELLMOD_RESIST_MISS_CHANCE
|
|
||||||
if (Player *modOwner = GetSpellModOwner())
|
|
||||||
modOwner->ApplySpellMod(spell->Id, SPELLMOD_RESIST_MISS_CHANCE, HitChance);
|
|
||||||
|
|
||||||
// Miss = 100 - hit
|
|
||||||
float miss_chance= 100.0f - HitChance;
|
|
||||||
|
|
||||||
// Bonuses from attacker aura and ratings
|
|
||||||
if (attType == RANGED_ATTACK)
|
|
||||||
miss_chance -= m_modRangedHitChance;
|
|
||||||
else
|
|
||||||
miss_chance -= m_modMeleeHitChance;
|
|
||||||
|
|
||||||
// bonus from skills is 0.04%
|
|
||||||
miss_chance -= skillDiff * 0.04f;
|
|
||||||
|
|
||||||
// Limit miss chance from 0 to 60%
|
|
||||||
if (miss_chance < 0.0f)
|
|
||||||
return 0.0f;
|
|
||||||
if (miss_chance > 60.0f)
|
|
||||||
return 60.0f;
|
|
||||||
return miss_chance;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
int32 Unit::GetMechanicResistChance(const SpellEntry *spell)
|
int32 Unit::GetMechanicResistChance(const SpellEntry *spell)
|
||||||
{
|
{
|
||||||
if (!spell)
|
if (!spell)
|
||||||
@@ -2971,79 +2833,6 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
|
|||||||
return SPELL_MISS_NONE;
|
return SPELL_MISS_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*float Unit::MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) const
|
|
||||||
{
|
|
||||||
if (!pVictim)
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
// Base misschance 5%
|
|
||||||
float misschance = 5.0f;
|
|
||||||
|
|
||||||
// DualWield - Melee spells and physical dmg spells - 5% , white damage 24%
|
|
||||||
if (haveOffhandWeapon() && attType != RANGED_ATTACK)
|
|
||||||
{
|
|
||||||
bool isNormal = false;
|
|
||||||
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
|
|
||||||
{
|
|
||||||
if (m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL))
|
|
||||||
{
|
|
||||||
isNormal = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isNormal || m_currentSpells[CURRENT_MELEE_SPELL])
|
|
||||||
misschance = 5.0f;
|
|
||||||
else
|
|
||||||
misschance = 24.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// PvP : PvE melee misschances per leveldif > 2
|
|
||||||
int32 chance = pVictim->GetTypeId() == TYPEID_PLAYER ? 5 : 7;
|
|
||||||
|
|
||||||
int32 leveldif = int32(pVictim->getLevelForTarget(this)) - int32(getLevelForTarget(pVictim));
|
|
||||||
if (leveldif < 0)
|
|
||||||
leveldif = 0;
|
|
||||||
|
|
||||||
// Hit chance from attacker based on ratings and auras
|
|
||||||
float m_modHitChance;
|
|
||||||
if (attType == RANGED_ATTACK)
|
|
||||||
m_modHitChance = m_modRangedHitChance;
|
|
||||||
else
|
|
||||||
m_modHitChance = m_modMeleeHitChance;
|
|
||||||
|
|
||||||
if (leveldif < 3)
|
|
||||||
misschance += (leveldif - m_modHitChance);
|
|
||||||
else
|
|
||||||
misschance += ((leveldif - 2) * chance - m_modHitChance);
|
|
||||||
|
|
||||||
// Hit chance for victim based on ratings
|
|
||||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
{
|
|
||||||
if (attType == RANGED_ATTACK)
|
|
||||||
misschance += pVictim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_RANGED);
|
|
||||||
else
|
|
||||||
misschance += pVictim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_MELEE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modify miss chance by victim auras
|
|
||||||
if (attType == RANGED_ATTACK)
|
|
||||||
misschance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE);
|
|
||||||
else
|
|
||||||
misschance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);
|
|
||||||
|
|
||||||
// Modify miss chance from skill difference (bonus from skills is 0.04%)
|
|
||||||
int32 skillBonus = int32(GetWeaponSkillValue(attType,pVictim)) - int32(pVictim->GetDefenseSkillValue(this));
|
|
||||||
misschance -= skillBonus * 0.04f;
|
|
||||||
|
|
||||||
// Limit miss chance from 0 to 60%
|
|
||||||
if (misschance < 0.0f)
|
|
||||||
return 0.0f;
|
|
||||||
if (misschance > 60.0f)
|
|
||||||
return 60.0f;
|
|
||||||
|
|
||||||
return misschance;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
uint32 Unit::GetDefenseSkillValue(Unit const* target) const
|
uint32 Unit::GetDefenseSkillValue(Unit const* target) const
|
||||||
{
|
{
|
||||||
if (GetTypeId() == TYPEID_PLAYER)
|
if (GetTypeId() == TYPEID_PLAYER)
|
||||||
@@ -4941,9 +4730,7 @@ void Unit::RemoveDynObject(uint32 spellid)
|
|||||||
{
|
{
|
||||||
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
|
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
|
||||||
if (!dynObj) // may happen if a dynobj is removed when grid unload
|
if (!dynObj) // may happen if a dynobj is removed when grid unload
|
||||||
{
|
|
||||||
i = m_dynObjGUIDs.erase(i);
|
i = m_dynObjGUIDs.erase(i);
|
||||||
}
|
|
||||||
else if (spellid == 0 || dynObj->GetSpellId() == spellid)
|
else if (spellid == 0 || dynObj->GetSpellId() == spellid)
|
||||||
{
|
{
|
||||||
dynObj->Delete();
|
dynObj->Delete();
|
||||||
@@ -5627,10 +5414,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
|
|||||||
this->ToPlayer()->Say("This is Madness!", LANG_UNIVERSAL);
|
this->ToPlayer()->Say("This is Madness!", LANG_UNIVERSAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// Sunwell Exalted Caster Neck (??? neck)
|
// Sunwell Exalted Caster Neck (??? neck)
|
||||||
// cast ??? Light's Wrath if Exalted by Aldor
|
// cast ??? Light's Wrath if Exalted by Aldor
|
||||||
// cast ??? Arcane Bolt if Exalted by Scryers*/
|
// cast ??? Arcane Bolt if Exalted by Scryers
|
||||||
case 46569:
|
case 46569:
|
||||||
return false; // old unused version
|
return false; // old unused version
|
||||||
// Sunwell Exalted Caster Neck (Shattered Sun Pendant of Acumen neck)
|
// Sunwell Exalted Caster Neck (Shattered Sun Pendant of Acumen neck)
|
||||||
@@ -10169,19 +9955,8 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
|
|||||||
return nearMembers[randTarget];
|
return nearMembers[randTarget];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Player * Unit::GetMoverSource() const
|
|
||||||
{
|
|
||||||
if (GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->m_mover == this)
|
|
||||||
return (Player*)this;
|
|
||||||
if (Unit *charmer = GetCharmer())
|
|
||||||
if (charmer->GetTypeId() == TYPEID_PLAYER && charmer->ToPlayer()->m_mover == this)
|
|
||||||
return (Player*)charmer;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//only called in Player::SetSeer
|
//only called in Player::SetSeer
|
||||||
|
// so move it to Player?
|
||||||
void Unit::AddPlayerToVision(Player* plr)
|
void Unit::AddPlayerToVision(Player* plr)
|
||||||
{
|
{
|
||||||
if (m_sharedVision.empty())
|
if (m_sharedVision.empty())
|
||||||
@@ -11037,7 +10812,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
|
|||||||
return owner->SpellHealingBonus(pVictim, spellProto, healamount, damagetype, stack);
|
return owner->SpellHealingBonus(pVictim, spellProto, healamount, damagetype, stack);
|
||||||
|
|
||||||
// no bonus for heal potions/bandages
|
// no bonus for heal potions/bandages
|
||||||
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION /*|| spellProto->Mechanic == MECHANIC_BANDAGE*/ )
|
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
|
||||||
return healamount;
|
return healamount;
|
||||||
|
|
||||||
// Healing Done
|
// Healing Done
|
||||||
@@ -11949,7 +11724,7 @@ void Unit::CombatStart(Unit* target, bool initialAggro)
|
|||||||
{
|
{
|
||||||
if (initialAggro)
|
if (initialAggro)
|
||||||
{
|
{
|
||||||
if (!target->IsStandState()/* && !target->hasUnitState(UNIT_STAT_STUNNED)*/)
|
if (!target->IsStandState())
|
||||||
target->SetStandState(UNIT_STAND_STATE_STAND);
|
target->SetStandState(UNIT_STAND_STATE_STAND);
|
||||||
|
|
||||||
if (!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER
|
if (!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER
|
||||||
@@ -15142,7 +14917,6 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/*-----------------------TRINITY-----------------------------*/
|
|
||||||
|
|
||||||
void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||||
{
|
{
|
||||||
@@ -15785,13 +15559,6 @@ void Unit::RemoveCharmedBy(Unit *charmer)
|
|||||||
|
|
||||||
if (this->ToCreature()->AI() && charmer && charmer->isAlive())
|
if (this->ToCreature()->AI() && charmer && charmer->isAlive())
|
||||||
this->ToCreature()->AI()->AttackStart(charmer);
|
this->ToCreature()->AI()->AttackStart(charmer);
|
||||||
/*if (isAlive() && this->ToCreature()->IsAIEnabled)
|
|
||||||
{
|
|
||||||
if (charmer && !IsFriendlyTo(charmer))
|
|
||||||
this->ToCreature()->AI()->AttackStart(charmer);
|
|
||||||
else
|
|
||||||
this->ToCreature()->AI()->EnterEvadeMode();
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -16186,12 +15953,6 @@ float Unit::MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType,
|
|||||||
int32 HitChance;
|
int32 HitChance;
|
||||||
|
|
||||||
// PvP - PvE melee chances
|
// PvP - PvE melee chances
|
||||||
/*int32 lchance = pVictim->GetTypeId() == TYPEID_PLAYER ? 5 : 7;
|
|
||||||
int32 leveldif = pVictim->getLevelForTarget(this) - getLevelForTarget(pVictim);
|
|
||||||
if (leveldif < 3)
|
|
||||||
HitChance = 95 - leveldif;
|
|
||||||
else
|
|
||||||
HitChance = 93 - (leveldif - 2) * lchance;*/
|
|
||||||
if (spellId || attType == RANGED_ATTACK || !haveOffhandWeapon())
|
if (spellId || attType == RANGED_ATTACK || !haveOffhandWeapon())
|
||||||
HitChance = 95;
|
HitChance = 95;
|
||||||
else
|
else
|
||||||
@@ -16855,12 +16616,6 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
|
|||||||
// 0x04000000
|
// 0x04000000
|
||||||
if (GetUnitMovementFlags() & MOVEMENTFLAG_SPLINE_ELEVATION)
|
if (GetUnitMovementFlags() & MOVEMENTFLAG_SPLINE_ELEVATION)
|
||||||
*data << (float)m_movementInfo.splineElevation;
|
*data << (float)m_movementInfo.splineElevation;
|
||||||
|
|
||||||
/*if (GetTypeId() == TYPEID_PLAYER)
|
|
||||||
{
|
|
||||||
sLog.outString("Send MovementInfo:");
|
|
||||||
OutMovementInfo();
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::SetFlying(bool apply)
|
void Unit::SetFlying(bool apply)
|
||||||
|
|||||||
Reference in New Issue
Block a user