Merge branch 'ShatteredWorld' of https://gitlab.com/Ovahlord/TrinityCore_434 into 4.3.4
This commit is contained in:
commit
b2945a5c58
1555 files changed
+3482
-3097
No files matched your search
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -4481,17 +4481,6 @@ bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, ObjectGuid guid) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Unit::HasNegativeAuraWithAttribute(uint32 flag, ObjectGuid guid) const
|
||||
{
|
||||
for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
|
||||
{
|
||||
Aura const* aura = iter->second->GetBase();
|
||||
if (!iter->second->IsPositive() && aura->GetSpellInfo()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Unit::HasAuraWithMechanic(uint32 mechanicMask) const
|
||||
{
|
||||
for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
|
||||
@@ -4509,6 +4498,26 @@ bool Unit::HasAuraWithMechanic(uint32 mechanicMask) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Unit::HasStrongerAuraWithDR(SpellInfo const* auraSpellInfo, Unit* caster, bool triggered) const
|
||||
{
|
||||
DiminishingGroup diminishGroup = auraSpellInfo->GetDiminishingReturnsGroupForSpell(triggered);
|
||||
DiminishingLevels level = GetDiminishing(diminishGroup);
|
||||
for (auto itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr)
|
||||
{
|
||||
SpellInfo const* spellInfo = itr->second->GetBase()->GetSpellInfo();
|
||||
if (spellInfo->GetDiminishingReturnsGroupForSpell(triggered) != diminishGroup)
|
||||
continue;
|
||||
|
||||
int32 existingDuration = itr->second->GetBase()->GetMaxDuration();
|
||||
int32 newDuration = auraSpellInfo->GetMaxDuration();
|
||||
ApplyDiminishingToDuration(auraSpellInfo, triggered, newDuration, caster, level);
|
||||
if (newDuration > 0 && newDuration < existingDuration)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
AuraEffect* Unit::IsScriptOverriden(SpellInfo const* spell, int32 script) const
|
||||
{
|
||||
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
@@ -8304,7 +8313,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
||||
if (enemy)
|
||||
{
|
||||
if (IsAIEnabled)
|
||||
creature->AI()->EnterCombat(enemy);
|
||||
creature->AI()->JustEngagedWith(enemy);
|
||||
|
||||
if (creature->GetFormation())
|
||||
creature->GetFormation()->MemberAttackStart(creature, enemy);
|
||||
@@ -9458,31 +9467,28 @@ void Unit::ModSpellDurationTime(SpellInfo const* spellInfo, int32 & duration, Sp
|
||||
duration = int32(float(duration) * m_modAttackSpeedPct[RANGED_ATTACK]);
|
||||
}
|
||||
|
||||
DiminishingLevels Unit::GetDiminishing(DiminishingGroup group)
|
||||
DiminishingLevels Unit::GetDiminishing(DiminishingGroup group) const
|
||||
{
|
||||
DiminishingReturn& diminish = m_Diminishing[group];
|
||||
DiminishingReturn const& diminish = m_Diminishing[group];
|
||||
if (!diminish.hitCount)
|
||||
return DIMINISHING_LEVEL_1;
|
||||
|
||||
// If last spell was cast more than 15 seconds ago - reset the count.
|
||||
// If last spell was cast more than 15 seconds ago - reset level
|
||||
if (!diminish.stack && GetMSTimeDiffToNow(diminish.hitTime) > 15000)
|
||||
{
|
||||
diminish.hitCount = DIMINISHING_LEVEL_1;
|
||||
return DIMINISHING_LEVEL_1;
|
||||
}
|
||||
|
||||
return DiminishingLevels(diminish.hitCount);
|
||||
}
|
||||
|
||||
void Unit::IncrDiminishing(SpellInfo const* auraSpellInfo, bool triggered)
|
||||
{
|
||||
DiminishingGroup const group = auraSpellInfo->GetDiminishingReturnsGroupForSpell(triggered);
|
||||
DiminishingLevels const maxLevel = auraSpellInfo->GetDiminishingReturnsMaxLevel(triggered);
|
||||
DiminishingGroup group = auraSpellInfo->GetDiminishingReturnsGroupForSpell(triggered);
|
||||
uint32 currentLevel = GetDiminishing(group);
|
||||
uint32 const maxLevel = auraSpellInfo->GetDiminishingReturnsMaxLevel(triggered);
|
||||
|
||||
// Checking for existing in the table
|
||||
DiminishingReturn& diminish = m_Diminishing[group];
|
||||
if (static_cast<int32>(diminish.hitCount) < maxLevel)
|
||||
++diminish.hitCount;
|
||||
if (currentLevel < maxLevel)
|
||||
diminish.hitCount = currentLevel + 1;
|
||||
}
|
||||
|
||||
bool Unit::ApplyDiminishingToDuration(SpellInfo const* auraSpellInfo, bool triggered, int32& duration, Unit* caster, DiminishingLevels previousLevel) const
|
||||
@@ -9503,9 +9509,7 @@ bool Unit::ApplyDiminishingToDuration(SpellInfo const* auraSpellInfo, bool trigg
|
||||
Unit const* target = targetOwner ? targetOwner : this;
|
||||
Unit const* source = casterOwner ? casterOwner : caster;
|
||||
|
||||
if ((target->GetTypeId() == TYPEID_PLAYER
|
||||
|| target->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)
|
||||
&& source->GetTypeId() == TYPEID_PLAYER)
|
||||
if (target->IsAffectedByDiminishingReturns() && source->GetTypeId() == TYPEID_PLAYER)
|
||||
duration = limitDuration;
|
||||
}
|
||||
|
||||
@@ -9527,10 +9531,9 @@ bool Unit::ApplyDiminishingToDuration(SpellInfo const* auraSpellInfo, bool trigg
|
||||
}
|
||||
}
|
||||
// Some diminishings applies to mobs too (for example, Stun)
|
||||
else if ((auraSpellInfo->GetDiminishingReturnsGroupType(triggered) == DRTYPE_PLAYER
|
||||
&& ((targetOwner ? (targetOwner->GetTypeId() == TYPEID_PLAYER) : (GetTypeId() == TYPEID_PLAYER))
|
||||
|| (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)))
|
||||
|| auraSpellInfo->GetDiminishingReturnsGroupType(triggered) == DRTYPE_ALL)
|
||||
else if (auraSpellInfo->GetDiminishingReturnsGroupType(triggered) == DRTYPE_ALL ||
|
||||
(auraSpellInfo->GetDiminishingReturnsGroupType(triggered) == DRTYPE_PLAYER &&
|
||||
(targetOwner ? targetOwner->IsAffectedByDiminishingReturns() : IsAffectedByDiminishingReturns())))
|
||||
{
|
||||
DiminishingLevels diminish = previousLevel;
|
||||
switch (diminish)
|
||||
@@ -11837,8 +11840,8 @@ void Unit::SetStunned(bool apply)
|
||||
SetTarget(ObjectGuid::Empty);
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
|
||||
// Stop movement if a player is affected by point motion master
|
||||
if (GetTypeId() == TYPEID_PLAYER && GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
|
||||
// Stop movement if unit is affected by point motion master
|
||||
if (GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
|
||||
StopMoving();
|
||||
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -11873,8 +11876,8 @@ void Unit::SetRooted(bool apply, bool packetOnly /*= false*/)
|
||||
// setting MOVEMENTFLAG_ROOT
|
||||
RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING);
|
||||
AddUnitMovementFlag(MOVEMENTFLAG_ROOT);
|
||||
// Stop movement if a player is currently affected by point motion master
|
||||
if (GetTypeId() == TYPEID_PLAYER && GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
|
||||
// Stop movement if unit is affected by point motion master
|
||||
if (GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
|
||||
StopMoving();
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user