*Remove auras with duration lower than 30 sec on arena start.

*Do not remove rougue poisons and dk runes on arena start.
*Apply healing bonus for healing stream totem.
*Do not duplicate damage bonus in code with the one in db for Seal of Vengenance/Corruption

--HG--
branch : trunk
This commit is contained in:
QAston
2009-05-24 22:54:13 +02:00
parent db834e7c7d
commit 1c505261bc
10 changed files with 99 additions and 45 deletions
+14 -1
View File
@@ -404,7 +404,20 @@ void BattleGround::Update(uint32 diff)
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player *plr = objmgr.GetPlayer(itr->first))
{
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
// remove auras with duration lower than 30s
Unit::AuraMap & aurMap = plr->GetAuras();
for(Unit::AuraMap::iterator iter = aurMap.begin(); iter != aurMap.end();)
{
if (iter->second->GetAuraDuration()<=30*IN_MILISECONDS)
{
plr->RemoveAura(iter);
}
else
++iter;
}
}
CheckArenaWinConditions();
}
@@ -1109,7 +1122,7 @@ void BattleGround::AddPlayer(Player *plr)
{
plr->RemoveArenaSpellCooldowns();
plr->RemoveArenaAuras();
plr->RemoveAllEnchantments(TEMP_ENCHANTMENT_SLOT);
plr->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT);
if(team == ALLIANCE) // gold
{
if (plr->GetTeam() == HORDE)
+7 -1
View File
@@ -11717,7 +11717,7 @@ void Player::RemoveEnchantmentDurations(Item *item)
}
}
void Player::RemoveAllEnchantments(EnchantmentSlot slot)
void Player::RemoveArenaEnchantments(EnchantmentSlot slot)
{
// remove enchantments from equipped items first to clean up the m_enchantDuration list
for(EnchantDurationList::iterator itr = m_enchantDuration.begin(),next;itr != m_enchantDuration.end();itr=next)
@@ -11727,6 +11727,12 @@ void Player::RemoveAllEnchantments(EnchantmentSlot slot)
{
if(itr->item && itr->item->GetEnchantmentId(slot))
{
// Poisons and DK runes are enchants which are allowed on arenas
if (spellmgr.IsArenaAllowedEnchancment(itr->item->GetEnchantmentId(slot)))
{
++next;
continue;
}
// remove from stats
ApplyEnchantment(itr->item,slot,false,false);
// remove visual
+3 -2
View File
@@ -278,7 +278,8 @@ struct Runes
struct EnchantDuration
{
EnchantDuration() : item(NULL), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {};
EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration) { assert(item); };
EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot),
leftduration(_leftduration){ assert(item); };
Item * item;
EnchantmentSlot slot;
@@ -1068,7 +1069,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void UpdateItemDuration(uint32 time, bool realtimeonly=false);
void AddEnchantmentDurations(Item *item);
void RemoveEnchantmentDurations(Item *item);
void RemoveAllEnchantments(EnchantmentSlot slot);
void RemoveArenaEnchantments(EnchantmentSlot slot);
void AddEnchantmentDuration(Item *item,EnchantmentSlot slot,uint32 duration);
void ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool apply_dur = true, bool ignore_condition = false);
void ApplyEnchantment(Item *item,bool apply);
+1 -1
View File
@@ -295,7 +295,7 @@ enum SpellCategory
#define SPELL_ATTR_EX2_UNK10 0x00000400 // 10
#define SPELL_ATTR_EX2_HEALTH_FUNNEL 0x00000800 // 11
#define SPELL_ATTR_EX2_UNK12 0x00001000 // 12
#define SPELL_ATTR_EX2_UNK13 0x00002000 // 13
#define SPELL_ATTR_EX2_UNK13 0x00002000 // 13 Items enchanted by spells with this flag preserve the enchant to arenas
#define SPELL_ATTR_EX2_UNK14 0x00004000 // 14
#define SPELL_ATTR_EX2_UNK15 0x00008000 // 15 not set in 3.0.3
#define SPELL_ATTR_EX2_TAME_BEAST 0x00010000 // 16
+1 -1
View File
@@ -1319,7 +1319,7 @@ void Spell::DoTriggersOnSpellHit(Unit *unit)
}
// spells with this flag can trigger only if not selfcast (eviscerate for example)
if (m_ChanceTriggerSpells.size() && (!(m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST | SPELL_ATTR_EX4_UNK4) || unit!=m_caster))
if (m_ChanceTriggerSpells.size() && (!((m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST | SPELL_ATTR_EX4_UNK4) && unit==m_caster)))
{
int _duration=0;
for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i)
+1 -21
View File
@@ -657,28 +657,8 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
}
case SPELLFAMILY_PALADIN:
{
// Judgement of Vengeance/Corruption ${1+0.22*$SPH+0.14*$AP} + 10% for each application of Holy Vengeance/Blood Corruption on the target
if((m_spellInfo->SpellFamilyFlags[1] & 0x400000) && m_spellInfo->SpellIconID==2292)
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
damage+=int32(ap * 0.14f) + int32(holy * 22 / 100);
// Get stack of Holy Vengeance/Blood Corruption on the target added by caster
uint32 stacks = 0;
Unit::AuraEffectList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
for(Unit::AuraEffectList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
if(((*itr)->GetId() == 31803 || (*itr)->GetId() == 53742) && (*itr)->GetCasterGUID()==m_caster->GetGUID())
{
stacks = (*itr)->GetParentAura()->GetStackAmount();
break;
}
// + 10% for each application of Holy Vengeance/Blood Corruption on the target
if(stacks)
damage += damage * stacks * 10 /100;
}
// Avenger's Shield ($m1+0.07*$SPH+0.07*$AP)
else if(m_spellInfo->SpellFamilyFlags[0] & 0x4000)
if(m_spellInfo->SpellFamilyFlags[0] & 0x4000)
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
damage += int32(ap * 0.07f);
+34 -1
View File
@@ -3432,6 +3432,40 @@ void SpellMgr::LoadSpellCustomAttr()
CreatureAI::FillAISpellInfo();
}
// Fill custom data about enchancments
void SpellMgr::LoadEnchantCustomAttr()
{
uint32 size = sSpellItemEnchantmentStore.GetNumRows();
mEnchantCustomAttr.resize(size);
for (uint32 i = 0;i<size; ++i)
mEnchantCustomAttr[i] = 0;
for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
{
SpellEntry * spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(i);
if(!spellInfo)
continue;
// TODO: find a better check
if (!(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_UNK13) || !(spellInfo->Attributes & SPELL_ATTR_NOT_SHAPESHIFT))
continue;
for(uint32 j = 0; j < 3; ++j)
{
if(spellInfo->Effect[j] == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
{
uint32 enchId = spellInfo->EffectMiscValue[j];
SpellItemEnchantmentEntry const *ench = sSpellItemEnchantmentStore.LookupEntry(enchId);
if (!enchId)
continue;
mEnchantCustomAttr[enchId] = true;
break;
}
}
}
}
bool SpellMgr::IsSkillTypeSpell(uint32 spellId, SkillType type) const
{
SkillLineAbilityMap::const_iterator lower = GetBeginSkillLineAbilityMap(spellId);
@@ -3516,4 +3550,3 @@ void SpellMgr::LoadSpellLinked()
sLog.outString();
sLog.outString( ">> Loaded %u linked spells", count );
}
+8
View File
@@ -726,6 +726,7 @@ inline bool IsProfessionSkill(uint32 skill)
typedef std::vector<uint32> SpellCustomAttribute;
typedef std::vector<bool> EnchantCustomAttribute;
typedef std::map<int32, std::vector<int32> > SpellLinkedMap;
@@ -886,6 +887,11 @@ class SpellMgr
return spell_id;
}
uint32 IsArenaAllowedEnchancment(uint32 ench_id) const
{
return mEnchantCustomAttr[ench_id];
}
uint8 IsHighRankOfSpell(uint32 spell1,uint32 spell2) const
{
SpellChainMap::const_iterator itr = mSpellChains.find(spell1);
@@ -1071,6 +1077,7 @@ class SpellMgr
void LoadSkillLineAbilityMap();
void LoadSpellPetAuras();
void LoadSpellCustomAttr();
void LoadEnchantCustomAttr();
void LoadSpellEnchantProcData();
void LoadSpellLinked();
void LoadPetLevelupSpellMap();
@@ -1094,6 +1101,7 @@ class SpellMgr
SpellCustomAttribute mSpellCustomAttr;
SpellLinkedMap mSpellLinkedMap;
SpellEnchantProcEventMap mSpellEnchantProcEventMap;
EnchantCustomAttribute mEnchantCustomAttr;
PetLevelupSpellMap mPetLevelupSpellMap;
PetDefaultSpellsMap mPetDefaultSpellsMap; // only spells not listed in related mPetLevelupSpellMap entry
SpellAreaMap mSpellAreaMap;
+20 -10
View File
@@ -1704,9 +1704,6 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
}
if (slot != i)
continue;
// Check if item is useable (forms or disarm)
if (((Player*)this)->IsInFeralForm())
continue;
}
((Player*)this)->CastItemCombatSpell(item, damageInfo, proto);
}
@@ -8869,6 +8866,23 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
}
// Custom scripted damage
// Judgement of Vengeance/ Judgement of Corruption
if((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID==2292)
{
// Get stack of Holy Vengeance/Blood Corruption on the target added by caster
uint32 stacks = 0;
Unit::AuraEffectList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
for(Unit::AuraEffectList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
if(((*itr)->GetId() == 31803 || (*itr)->GetId() == 53742) && (*itr)->GetCasterGUID()==GetGUID())
{
stacks = (*itr)->GetParentAura()->GetStackAmount();
break;
}
// + 10% for each application of Holy Vengeance/Blood Corruption on the target
if(stacks)
DoneTotalMod *= stacks * 10 + 100.0f /100.0f;
}
// Ice Lance
if (spellProto->SpellFamilyName == SPELLFAMILY_MAGE && spellProto->SpellIconID == 186)
{
@@ -9368,11 +9382,6 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
bool scripted = false;
// No heal coeff for this class spells
if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
scripted = true;
else
{
for (uint8 i=0;i<3;++i)
{
switch (spellProto->EffectApplyAuraName[i])
@@ -9384,7 +9393,6 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
break;
}
}
}
// Check for table values
SpellBonusEntry const* bonus = !scripted ? spellmgr.GetSpellBonusData(spellProto->Id) : NULL;
@@ -9420,7 +9428,8 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
factorMod *= 0.45f;
}
// Already set to scripted? so not uses healing bonus coefficient
else if (scripted)
// No heal coeff for SPELL_DAMAGE_CLASS_NONE class spells by default
else if (scripted || spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
{
coeff = 0.0f;
}
@@ -12997,6 +13006,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue( AuraEffect* triggeredByAura )
CastCustomSpell(target,spellProto->Id,&heal,NULL,NULL,true,NULL,triggeredByAura,caster->GetGUID());
if (Aura * aur = target->GetAura(spellProto->Id, caster->GetGUID()))
aur->SetAuraCharges(jumps);
//caster->SpellHealingBonus(this, spellProto, heal, HEAL);
}
}
}
+3
View File
@@ -1339,6 +1339,9 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading spell extra attributes...(TODO)" );
spellmgr.LoadSpellCustomAttr();
sLog.outString( "Loading enchant custom attributes..." );
spellmgr.LoadEnchantCustomAttr();
sLog.outString( "Loading linked spells..." );
spellmgr.LoadSpellLinked();