[9285] Fixed unexpected double time for apply damage for spell 1464 and ranks.

* Implement way ignore some redundent data for triggered spells base at cast cost exist.
  Reason: some triggered spells inherited data from main spells
  just for porper client show spell attributes, we not need this data.
* Use check for ignore inherited cast time.
This commit is contained in:
VladimirMangos 2010-02-02 19:49:27 +03:00
parent 66c8c75914
commit 8ff7010750
4 changed files with 18 additions and 7 deletions

View file

@ -5277,7 +5277,7 @@ SpellCastResult Spell::CheckRange(bool strict)
int32 Spell::CalculatePowerCost() int32 Spell::CalculatePowerCost()
{ {
// item cast not used power // item cast not used power
if(m_CastItem) if (m_CastItem)
return 0; return 0;
// Spell drain all exist power on cast (Only paladin lay of Hands) // Spell drain all exist power on cast (Only paladin lay of Hands)
@ -6042,6 +6042,12 @@ bool Spell::IsNeedSendToClient() const
m_spellInfo->speed > 0.0f || !m_triggeredByAuraSpell && !m_IsTriggeredSpell; m_spellInfo->speed > 0.0f || !m_triggeredByAuraSpell && !m_IsTriggeredSpell;
} }
bool Spell::IsTriggeredSpellWithRedundentData() const
{
return m_IsTriggeredSpell && (m_spellInfo->manaCost || m_spellInfo->ManaCostPercentage);
}
bool Spell::HaveTargetsForEffect( uint8 effect ) const bool Spell::HaveTargetsForEffect( uint8 effect ) const
{ {
for(std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) for(std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)

View file

@ -431,7 +431,8 @@ class Spell
void SetDelayStart(uint64 m_time) { m_delayStart = m_time; } void SetDelayStart(uint64 m_time) { m_delayStart = m_time; }
uint64 GetDelayMoment() const { return m_delayMoment; } uint64 GetDelayMoment() const { return m_delayMoment; }
bool IsNeedSendToClient() const; bool IsNeedSendToClient() const; // use for hide spell cast for client in case when cast not have client side affect (animation or log entries)
bool IsTriggeredSpellWithRedundentData() const; // use for ignore some spell data for triggered spells like cast time, some triggered spells have redundent copy data from main spell for client use purpose
CurrentSpellTypes GetCurrentContainer(); CurrentSpellTypes GetCurrentContainer();

View file

@ -62,20 +62,24 @@ int32 GetSpellMaxDuration(SpellEntry const *spellInfo)
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell) uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
{ {
// some triggered spells have data only usable for client
if (spell && spell->IsTriggeredSpellWithRedundentData())
return 0;
SpellCastTimesEntry const *spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex); SpellCastTimesEntry const *spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex);
// not all spells have cast time index and this is all is pasiive abilities // not all spells have cast time index and this is all is pasiive abilities
if(!spellCastTimeEntry) if (!spellCastTimeEntry)
return 0; return 0;
int32 castTime = spellCastTimeEntry->CastTime; int32 castTime = spellCastTimeEntry->CastTime;
if (spell) if (spell)
{ {
if(Player* modOwner = spell->GetCaster()->GetSpellModOwner()) if (Player* modOwner = spell->GetCaster()->GetSpellModOwner())
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell); modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell);
if( !(spellInfo->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_TRADESPELL)) ) if (!(spellInfo->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_TRADESPELL)))
castTime = int32(castTime * spell->GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED)); castTime = int32(castTime * spell->GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED));
else else
{ {
@ -84,7 +88,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
} }
} }
if (spellInfo->Attributes & SPELL_ATTR_RANGED && (!spell || !(spell->IsAutoRepeat()))) if (spellInfo->Attributes & SPELL_ATTR_RANGED && (!spell || !spell->IsAutoRepeat()))
castTime += 500; castTime += 500;
return (castTime > 0) ? uint32(castTime) : 0; return (castTime > 0) ? uint32(castTime) : 0;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9284" #define REVISION_NR "9285"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__