*Update castcustomspell(). Allow change other spell values than basepoints.

--HG--
branch : trunk
This commit is contained in:
megamage committed 2009-04-19 00:54:01 -05:00
1 parent 60736b1f7d
commit 7f8cf6c5fe
4 files changed
+105 -49

No files matched your search

+26 -7
View File
@@ -274,14 +274,11 @@ void SpellCastTargets::write ( WorldPacket * data )
}
Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer, bool skipCheck )
: m_spellInfo(info), m_spellValue(new SpellValue(m_spellInfo))
, m_caster(Caster)
{
ASSERT( Caster != NULL && info != NULL );
ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element");
m_spellInfo = info;
m_customAttr = spellmgr.GetSpellCustomAttr(m_spellInfo->Id);
m_skipCheck = skipCheck;
m_caster = Caster;
m_selfContainer = NULL;
m_triggeringContainer = triggeringContainer;
m_referencedFromCurrentSpell = false;
@@ -340,7 +337,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
}
for(int i=0; i <3; ++i)
m_currentBasePoints[i] = m_spellInfo->EffectBasePoints[i];
m_currentBasePoints[i] = m_spellValue->EffectBasePoints[i];
m_spellState = SPELL_STATE_NULL;
@@ -396,6 +393,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
Spell::~Spell()
{
delete m_spellValue;
}
void Spell::FillTargetMap()
@@ -1521,7 +1519,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
//Chain: 2, 6, 22, 25, 45, 77
uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i];
uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets;
uint32 unMaxTargets = m_spellValue->MaxAffectedTargets;
if(m_originalCaster)
{
@@ -5431,3 +5429,24 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul
return damageDone;
}
void Spell::SetSpellValue(SpellValueMod mod, int32 value)
{
switch(mod)
{
case SPELLVALUE_BASE_POINT0:
m_spellValue->EffectBasePoints[0] = value - int32(m_spellInfo->EffectBaseDice[0]);
m_currentBasePoints[0] = m_spellValue->EffectBasePoints[0]; //this should be removed in the future
break;
case SPELLVALUE_BASE_POINT1:
m_spellValue->EffectBasePoints[1] = value - int32(m_spellInfo->EffectBaseDice[1]);
m_currentBasePoints[1] = m_spellValue->EffectBasePoints[1];
break;
case SPELLVALUE_BASE_POINT2:
m_spellValue->EffectBasePoints[2] = value - int32(m_spellInfo->EffectBaseDice[2]);
m_currentBasePoints[2] = m_spellValue->EffectBasePoints[2];
break;
case SPELLVALUE_MAX_TARGETS:
m_spellValue->MaxAffectedTargets = (uint32)value;
break;
}
}