Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Entities/Unit/Unit.cpp src/server/game/Handlers/MovementHandler.cpp src/server/game/Spells/Auras/SpellAuraEffects.cpp src/server/scripts/Spells/spell_hunter.cpp src/server/scripts/Spells/spell_warlock.cpp
This commit is contained in:
commit
18b6a6450b
19 files changed
+563
-236
No files matched your search
@@ -3158,6 +3158,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
|
||||
return;
|
||||
|
||||
aura->HandleAuraSpecificMods(aurApp, caster, true, false);
|
||||
aura->HandleAuraSpecificPeriodics(aurApp, caster);
|
||||
|
||||
// apply effects of the aura
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
@@ -6922,23 +6923,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
if (GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
float averageDmg = 0;
|
||||
// now compute approximate weapon damage by formula from wowwiki.com
|
||||
Item* item = NULL;
|
||||
if (procFlags & PROC_FLAG_DONE_OFFHAND_ATTACK)
|
||||
item = ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
averageDmg = (GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE) + GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE)) / 2;
|
||||
else
|
||||
item = ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
averageDmg = (GetFloatValue(UNIT_FIELD_MINDAMAGE) + GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2;
|
||||
|
||||
// dunno if it's really needed but will prevent any possible crashes
|
||||
if (!item)
|
||||
return false;
|
||||
|
||||
ItemTemplate const* weapon = item->GetTemplate();
|
||||
|
||||
float weaponDPS = weapon->DPS;
|
||||
float attackPower = GetTotalAttackPowerValue(BASE_ATTACK) / 14.0f;
|
||||
float weaponSpeed = float(weapon->Delay) / 1000.0f;
|
||||
basepoints0 = int32((weaponDPS + attackPower) * weaponSpeed);
|
||||
basepoints0 = int32(averageDmg);
|
||||
break;
|
||||
}
|
||||
// Persistent Shield (Scarab Brooch trinket)
|
||||
@@ -8420,39 +8412,162 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
if (Unit* owner = GetOwner())
|
||||
return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype);
|
||||
|
||||
// Done total percent damage auras
|
||||
float DoneTotalMod = 1.0f;
|
||||
float ApCoeffMod = 1.0f;
|
||||
int32 DoneTotal = 0;
|
||||
|
||||
// done scripted mod (take it from owner)
|
||||
Unit const* owner = GetOwner() ? GetOwner() : this;
|
||||
AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
|
||||
{
|
||||
if (!(*i)->IsAffectingSpell(spellProto))
|
||||
continue;
|
||||
|
||||
switch ((*i)->GetMiscValue())
|
||||
{
|
||||
case 4418: // Increased Shock Damage
|
||||
case 4554: // Increased Lightning Damage
|
||||
case 4555: // Improved Moonfire
|
||||
case 5142: // Increased Lightning Damage
|
||||
case 5147: // Improved Consecration / Libram of Resurgence
|
||||
case 5148: // Idol of the Shooting Star
|
||||
case 6008: // Increased Lightning Damage
|
||||
case 8627: // Totem of Hex
|
||||
{
|
||||
DoneTotal += (*i)->GetAmount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Custom scripted damage
|
||||
switch (spellProto->SpellFamilyName)
|
||||
{
|
||||
case SPELLFAMILY_DEATHKNIGHT:
|
||||
// Impurity (dummy effect)
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
PlayerSpellMap playerSpells = ToPlayer()->GetSpellMap();
|
||||
for (PlayerSpellMap::const_iterator itr = playerSpells.begin(); itr != playerSpells.end(); ++itr)
|
||||
{
|
||||
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
|
||||
continue;
|
||||
switch (itr->first)
|
||||
{
|
||||
case 49220:
|
||||
case 49633:
|
||||
case 49635:
|
||||
case 49636:
|
||||
case 49638:
|
||||
if (SpellInfo const* proto = sSpellMgr->GetSpellInfo(itr->first))
|
||||
AddPct(ApCoeffMod, proto->Effects[0].CalcValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Done fixed damage bonus auras
|
||||
int32 DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
|
||||
// Pets just add their bonus damage to their spell damage
|
||||
// note that their spell damage is just gain of their own auras
|
||||
if (HasUnitTypeMask(UNIT_MASK_GUARDIAN))
|
||||
DoneAdvertisedBenefit += ((Guardian*)this)->GetBonusDamage();
|
||||
|
||||
// Check for table values
|
||||
float coeff = 0;
|
||||
SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
|
||||
if (bonus)
|
||||
{
|
||||
if (damagetype == DOT)
|
||||
{
|
||||
coeff = bonus->dot_damage;
|
||||
if (bonus->ap_dot_bonus > 0)
|
||||
{
|
||||
WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
|
||||
float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
|
||||
APbonus += GetTotalAttackPowerValue(attType);
|
||||
DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
coeff = bonus->direct_damage;
|
||||
if (bonus->ap_bonus > 0)
|
||||
{
|
||||
WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
|
||||
float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
|
||||
APbonus += GetTotalAttackPowerValue(attType);
|
||||
DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Default calculation
|
||||
if (DoneAdvertisedBenefit)
|
||||
{
|
||||
if (!bonus || coeff < 0)
|
||||
coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
|
||||
|
||||
float factorMod = CalculateLevelPenalty(spellProto) * stack;
|
||||
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
{
|
||||
coeff *= 100.0f;
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
|
||||
coeff /= 100.0f;
|
||||
}
|
||||
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
|
||||
}
|
||||
|
||||
// Done Percentage for DOT is already calculated, no need to do it again. The percentage mod is applied in Aura::HandleAuraSpecificMods.
|
||||
float tmpDamage = (int32(pdamage) + DoneTotal) * (damagetype == DOT ? 1.0f : SpellDamagePctDone(victim, spellProto, damagetype));
|
||||
// apply spellmod to Done damage (flat and pct)
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
|
||||
|
||||
return uint32(std::max(tmpDamage, 0.0f));
|
||||
}
|
||||
|
||||
float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, DamageEffectType damagetype) const
|
||||
{
|
||||
if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
|
||||
return 1.0f;
|
||||
|
||||
// Some spells don't benefit from pct done mods
|
||||
if (spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)
|
||||
return 1.0f;
|
||||
|
||||
// For totems pct done mods are calculated when its calculation is run on the player in SpellDamageBonusDone.
|
||||
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem())
|
||||
return 1.0f;
|
||||
|
||||
// Done total percent damage auras
|
||||
float DoneTotalMod = 1.0f;
|
||||
|
||||
// Pet damage?
|
||||
if (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet())
|
||||
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
|
||||
|
||||
// Some spells don't benefit from pct done mods
|
||||
if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS))
|
||||
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
{
|
||||
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
{
|
||||
if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
|
||||
continue;
|
||||
if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
|
||||
continue;
|
||||
|
||||
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
|
||||
{
|
||||
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
|
||||
{
|
||||
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
}
|
||||
|
||||
uint32 creatureTypeMask = victim->GetCreatureTypeMask();
|
||||
// Add flat bonus from spell damage versus
|
||||
DoneTotal += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask);
|
||||
|
||||
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
|
||||
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
|
||||
if (creatureTypeMask & uint32((*i)->GetMiscValue()))
|
||||
@@ -8469,7 +8584,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
|
||||
// done scripted mod (take it from owner)
|
||||
Unit const* owner = GetOwner() ? GetOwner() : this;
|
||||
AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
|
||||
{
|
||||
if (!(*i)->IsAffectingSpell(spellProto))
|
||||
@@ -8531,18 +8646,6 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
break;
|
||||
}
|
||||
case 4418: // Increased Shock Damage
|
||||
case 4554: // Increased Lightning Damage
|
||||
case 4555: // Improved Moonfire
|
||||
case 5142: // Increased Lightning Damage
|
||||
case 5147: // Improved Consecration / Libram of Resurgence
|
||||
case 5148: // Idol of the Shooting Star
|
||||
case 6008: // Increased Lightning Damage
|
||||
case 8627: // Totem of Hex
|
||||
{
|
||||
DoneTotal += (*i)->GetAmount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8595,81 +8698,26 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Drain Soul - increased damage for targets under 25 % HP
|
||||
if (spellProto->SpellFamilyFlags[0] & 0x00004000)
|
||||
if (HasAura(100001))
|
||||
DoneTotalMod *= 2;
|
||||
|
||||
// Shadow Bite (30% increase from each dot)
|
||||
if (spellProto->SpellFamilyFlags[1] & 0x00400000 && IsPet())
|
||||
if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
|
||||
AddPct(DoneTotalMod, 30 * count);
|
||||
|
||||
// Drain Soul - increased damage for targets under 25 % HP
|
||||
if (spellProto->SpellFamilyFlags[0] & 0x00004000)
|
||||
if (HasAura(100001))
|
||||
DoneTotalMod *= 2;
|
||||
break;
|
||||
case SPELLFAMILY_DEATHKNIGHT:
|
||||
// Sigil of the Vengeful Heart
|
||||
if (spellProto->SpellFamilyFlags[0] & 0x2000)
|
||||
if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1))
|
||||
DoneTotal += aurEff->GetAmount();
|
||||
DoneTotalMod += aurEff->GetAmount();
|
||||
break;
|
||||
}
|
||||
|
||||
// Done fixed damage bonus auras
|
||||
int32 DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
|
||||
// Pets just add their bonus damage to their spell damage
|
||||
// note that their spell damage is just gain of their own auras
|
||||
if (HasUnitTypeMask(UNIT_MASK_GUARDIAN))
|
||||
DoneAdvertisedBenefit += ((Guardian*)this)->GetBonusDamage();
|
||||
|
||||
// Check for table values
|
||||
float coeff = 0;
|
||||
SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
|
||||
if (bonus)
|
||||
{
|
||||
if (damagetype == DOT)
|
||||
{
|
||||
coeff = bonus->dot_damage;
|
||||
if (bonus->ap_dot_bonus > 0)
|
||||
{
|
||||
WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
|
||||
float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
|
||||
APbonus += GetTotalAttackPowerValue(attType);
|
||||
DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
coeff = bonus->direct_damage;
|
||||
if (bonus->ap_bonus > 0)
|
||||
{
|
||||
WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
|
||||
float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
|
||||
APbonus += GetTotalAttackPowerValue(attType);
|
||||
DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Default calculation
|
||||
if (DoneAdvertisedBenefit)
|
||||
{
|
||||
if (!bonus || coeff < 0)
|
||||
coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
|
||||
|
||||
float factorMod = CalculateLevelPenalty(spellProto) * stack;
|
||||
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
{
|
||||
coeff *= 100.0f;
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
|
||||
coeff /= 100.0f;
|
||||
}
|
||||
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
|
||||
}
|
||||
|
||||
float tmpDamage = (int32(pdamage) + DoneTotal) * DoneTotalMod;
|
||||
// apply spellmod to Done damage (flat and pct)
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
|
||||
|
||||
return uint32(std::max(tmpDamage, 0.0f));
|
||||
return DoneTotalMod;
|
||||
}
|
||||
|
||||
uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack) const
|
||||
@@ -8699,11 +8747,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
|
||||
// Cheat Death
|
||||
case 2109:
|
||||
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
|
||||
{
|
||||
if (GetTypeId() != TYPEID_PLAYER)
|
||||
continue;
|
||||
AddPct(TakenTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -8825,16 +8869,21 @@ int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) const
|
||||
return TakenAdvertisedBenefit;
|
||||
}
|
||||
|
||||
bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
|
||||
bool Unit::IsSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
|
||||
{
|
||||
return roll_chance_f(GetUnitSpellCriticalChance(victim, spellProto, schoolMask, attackType));
|
||||
}
|
||||
|
||||
float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
|
||||
{
|
||||
//! Mobs can't crit with spells. Player Totems can
|
||||
//! Fire Elemental (from totem) can too - but this part is a hack and needs more research
|
||||
if (IS_CREATURE_GUID(GetGUID()) && !(IsTotem() && IS_PLAYER_GUID(GetOwnerGUID())) && GetEntry() != 15438)
|
||||
return false;
|
||||
if (IS_CRE_OR_VEH_GUID(GetGUID()) && !(IsTotem() && IS_PLAYER_GUID(GetOwnerGUID())) && GetEntry() != 15438)
|
||||
return 0.0f;
|
||||
|
||||
// not critting spell
|
||||
if ((spellProto->AttributesEx2 & SPELL_ATTR2_CANT_CRIT))
|
||||
return false;
|
||||
return 0.0f;
|
||||
|
||||
float crit_chance = 0.0f;
|
||||
switch (spellProto->DmgClass)
|
||||
@@ -8850,7 +8899,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
|
||||
case 71646: // Item - Bauble of True Blood 25m
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
return 0.0f;
|
||||
}
|
||||
// Do not add a break here, case fallthrough is intentional! Adding a break will make above spells unable to crit.
|
||||
case SPELL_DAMAGE_CLASS_MAGIC:
|
||||
@@ -8949,7 +8998,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
|
||||
else if (spellProto->GetCategory() == 19)
|
||||
{
|
||||
if (victim->GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD)
|
||||
return true;
|
||||
return 100.0f;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -8959,7 +9008,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
|
||||
{
|
||||
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, GetGUID()))
|
||||
if (victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE) > -100)
|
||||
return true;
|
||||
return 100.0f;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -8997,7 +9046,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
return 0.0f;
|
||||
}
|
||||
// percent done
|
||||
// only players use intelligence for critical chance computations
|
||||
@@ -9009,10 +9058,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
|
||||
if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectingSpell(spellProto))
|
||||
crit_chance += (*i)->GetAmount();
|
||||
|
||||
crit_chance = crit_chance > 0.0f ? crit_chance : 0.0f;
|
||||
if (roll_chance_f(crit_chance))
|
||||
return true;
|
||||
return false;
|
||||
return crit_chance > 0.0f ? crit_chance : 0.0f;
|
||||
}
|
||||
|
||||
uint32 Unit::SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage, Unit* /*victim*/)
|
||||
@@ -9075,14 +9121,8 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
|
||||
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
|
||||
return healamount;
|
||||
|
||||
float DoneTotalMod = 1.0f;
|
||||
int32 DoneTotal = 0;
|
||||
|
||||
// Healing done percent
|
||||
AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
|
||||
// done scripted mod (take it from owner)
|
||||
Unit const* owner = GetOwner() ? GetOwner() : this;
|
||||
AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
@@ -9101,7 +9141,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
|
||||
case 6935:
|
||||
case 6918:
|
||||
if (victim->HealthBelowPct(50))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
AddPct(DoneTotal, (*i)->GetAmount());
|
||||
break;
|
||||
case 8477: // Nourish Heal Boost
|
||||
{
|
||||
@@ -9119,7 +9159,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
|
||||
continue;
|
||||
modPercent += stepPercent * aura->GetStackAmount();
|
||||
}
|
||||
AddPct(DoneTotalMod, modPercent);
|
||||
AddPct(DoneTotal, modPercent);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -9190,8 +9230,8 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
|
||||
DoneTotal = 0;
|
||||
}
|
||||
|
||||
// use float as more appropriate for negative values and percent applying
|
||||
float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod;
|
||||
// Done Percentage for DOT is already calculated, no need to do it again. The percentage mod is applied in Aura::HandleAuraSpecificMods.
|
||||
float heal = float(int32(healamount) + DoneTotal) * (damagetype == DOT ? 1.0f : SpellHealingPctDone(victim, spellProto));
|
||||
// apply spellmod to Done amount
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
|
||||
@@ -9199,6 +9239,78 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
|
||||
return uint32(std::max(heal, 0.0f));
|
||||
}
|
||||
|
||||
float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const
|
||||
{
|
||||
// For totems pct done mods are calculated when its calculation is run on the player in SpellHealingBonusDone.
|
||||
if (GetTypeId() == TYPEID_UNIT && IsTotem())
|
||||
return 1.0f;
|
||||
|
||||
// No bonus healing for potion spells
|
||||
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
|
||||
return 1.0f;
|
||||
|
||||
float DoneTotalMod = 1.0f;
|
||||
|
||||
// Healing done percent
|
||||
AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
|
||||
// done scripted mod (take it from owner)
|
||||
Unit const* owner = GetOwner() ? GetOwner() : this;
|
||||
AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
|
||||
{
|
||||
if (!(*i)->IsAffectingSpell(spellProto))
|
||||
continue;
|
||||
|
||||
switch ((*i)->GetMiscValue())
|
||||
{
|
||||
case 21: // Test of Faith
|
||||
case 6935:
|
||||
case 6918:
|
||||
if (victim->HealthBelowPct(50))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
break;
|
||||
case 7798: // Glyph of Regrowth
|
||||
{
|
||||
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x40, 0, 0))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
break;
|
||||
}
|
||||
case 8477: // Nourish Heal Boost
|
||||
{
|
||||
int32 stepPercent = (*i)->GetAmount();
|
||||
int32 modPercent = 0;
|
||||
AuraApplicationMap const& victimAuras = victim->GetAppliedAuras();
|
||||
for (AuraApplicationMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
|
||||
{
|
||||
Aura const* aura = itr->second->GetBase();
|
||||
if (aura->GetCasterGUID() != GetGUID())
|
||||
continue;
|
||||
SpellInfo const* m_spell = aura->GetSpellInfo();
|
||||
if (m_spell->SpellFamilyName != SPELLFAMILY_DRUID ||
|
||||
!(m_spell->SpellFamilyFlags[1] & 0x00000010 || m_spell->SpellFamilyFlags[0] & 0x50))
|
||||
continue;
|
||||
modPercent += stepPercent * aura->GetStackAmount();
|
||||
}
|
||||
AddPct(DoneTotalMod, modPercent);
|
||||
break;
|
||||
}
|
||||
case 7871: // Glyph of Lesser Healing Wave
|
||||
{
|
||||
if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0, GetGUID()))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return DoneTotalMod;
|
||||
}
|
||||
|
||||
uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) const
|
||||
{
|
||||
float TakenTotalMod = 1.0f;
|
||||
@@ -9542,7 +9654,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
|
||||
|
||||
// Some spells don't benefit from pct done mods
|
||||
if (spellProto)
|
||||
if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162)))
|
||||
if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS))
|
||||
{
|
||||
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
@@ -9658,10 +9770,11 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
|
||||
case 2109:
|
||||
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
|
||||
{
|
||||
if (GetTypeId() != TYPEID_PLAYER)
|
||||
continue;
|
||||
float mod = ToPlayer()->GetRatingBonusValue(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN) * (-8.0f);
|
||||
AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
float mod = player->GetRatingBonusValue(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN) * (-8.0f);
|
||||
AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user