diff options
author | QAston <none@none> | 2009-05-24 22:54:13 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-05-24 22:54:13 +0200 |
commit | 1c505261bc13585924e553eeea7b7a14232eb08f (patch) | |
tree | 5cadb31ffd26cab61782ae8beccbf3ac9c9ebacc /src | |
parent | db834e7c7d10b7738830c2c732414da9933e0ae6 (diff) |
*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
Diffstat (limited to 'src')
-rw-r--r-- | src/game/BattleGround.cpp | 15 | ||||
-rw-r--r-- | src/game/Player.cpp | 8 | ||||
-rw-r--r-- | src/game/Player.h | 5 | ||||
-rw-r--r-- | src/game/SharedDefines.h | 2 | ||||
-rw-r--r-- | src/game/Spell.cpp | 2 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 22 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 35 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 8 | ||||
-rw-r--r-- | src/game/Unit.cpp | 44 | ||||
-rw-r--r-- | src/game/World.cpp | 3 |
10 files changed, 99 insertions, 45 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index b76e0c7835c..7f5a1182cdc 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -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) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index b73a49fb990..910a1bf70be 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -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 diff --git a/src/game/Player.h b/src/game/Player.h index b657cce7622..aee7cd14991 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -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); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 0eacd37dae2..052d98f56c8 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -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 diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index d33266a2d37..bcca1f2c873 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -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) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 1049234f4d7..19b451a9040 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -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); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index bad3c94a034..0d39c6cf336 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -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 ); } - diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 6bcba4cd95c..c3174a05e7c 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -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; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e488253b4b7..651d09d98a1 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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,21 +9382,15 @@ 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) { - for (uint8 i=0;i<3;++i) + switch (spellProto->EffectApplyAuraName[i]) { - switch (spellProto->EffectApplyAuraName[i]) - { - // These auras do not use healing coeff - case SPELL_AURA_PERIODIC_LEECH: - case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: - scripted = true; - break; - } + // These auras do not use healing coeff + case SPELL_AURA_PERIODIC_LEECH: + case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: + scripted = true; + break; } } @@ -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); } } } diff --git a/src/game/World.cpp b/src/game/World.cpp index 2a08f03c23f..ad6e54a64cf 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -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(); |