--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-24 21:08:43 -06:00
13 changed files with 830 additions and 40 deletions
+27 -17
View File
@@ -404,13 +404,11 @@ Spell::~Spell()
void Spell::FillTargetMap()
{
// TODO: ADD the correct target FILLS!!!!!!
for(uint32 i=0;i<3;i++)
for(uint32 i = 0; i < 3; ++i)
{
// not call for empty effect.
// Also some spells use not used effect targets for store targets for dummy effect in triggered spells
if(m_spellInfo->Effect[i]==0)
if(!m_spellInfo->Effect[i])
continue;
// TODO: find a way so this is not needed?
@@ -419,23 +417,34 @@ void Spell::FillTargetMap()
AddUnitTarget(m_caster, i);
std::list<Unit*> tmpUnitMap;
uint32 targetA = m_spellInfo->EffectImplicitTargetA[i];
uint32 targetB = m_spellInfo->EffectImplicitTargetB[i];
SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap);
SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap);
if(targetA)
SetTargetMap(i, targetA, tmpUnitMap);
if(targetB) // In very rare case !A && B
SetTargetMap(i, targetB, tmpUnitMap);
if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT)
{
if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_DEST
&& m_targets.HasDest() && m_spellInfo->speed > 0.0f)
if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_DEST)
{
float dist = m_caster->GetDistance(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ);
if (dist < 5.0f) dist = 5.0f;
m_delayMoment = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
if(m_targets.HasDest() && m_spellInfo->speed > 0.0f)
{
float dist = m_caster->GetDistance(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ);
if (dist < 5.0f) dist = 5.0f;
m_delayMoment = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
}
}
else if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_ITEM)
{
if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
}
continue;
}
if(tmpUnitMap.empty())
if(!targetA && !targetB)
{
// add here custom effects that need default target.
// FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
@@ -502,12 +511,12 @@ void Spell::FillTargetMap()
case SPELL_EFFECT_RESURRECT:
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_TRIGGER_SPELL:
//case SPELL_EFFECT_TRIGGER_MISSILE: ??
case SPELL_EFFECT_SKILL_STEP:
case SPELL_EFFECT_PROFICIENCY:
case SPELL_EFFECT_SUMMON_OBJECT_WILD:
case SPELL_EFFECT_SELF_RESURRECT:
case SPELL_EFFECT_REPUTATION:
case SPELL_EFFECT_LEARN_SPELL:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
else
@@ -546,7 +555,7 @@ void Spell::FillTargetMap()
if(Pet* pet = m_caster->GetPet())
tmpUnitMap.push_back(pet);
break;
case SPELL_EFFECT_ENCHANT_ITEM:
/*case SPELL_EFFECT_ENCHANT_ITEM:
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
case SPELL_EFFECT_DISENCHANT:
case SPELL_EFFECT_FEED_PET:
@@ -554,7 +563,7 @@ void Spell::FillTargetMap()
case SPELL_EFFECT_MILLING:
if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
break;
break;*/
case SPELL_EFFECT_APPLY_AURA:
switch(m_spellInfo->EffectApplyAuraName[i])
{
@@ -2451,8 +2460,9 @@ void Spell::_handle_immediate_phase()
{
if(spellmgr.EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_DEST)
{
if(m_targets.HasDest())
HandleEffects(m_originalCaster, NULL, NULL, j);
if(!m_targets.HasDest())
m_targets.setDestination(m_caster, false);
HandleEffects(m_originalCaster, NULL, NULL, j);
}
else if(spellmgr.EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_NONE)
HandleEffects(m_originalCaster, NULL, NULL, j);
+1 -1
View File
@@ -468,7 +468,7 @@ class Spell
Unit* m_caster;
uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection
// e.g. damage around area spell trigered by victim aura and da,age emeies of aura caster
// e.g. damage around area spell trigered by victim aura and damage enemies of aura caster
Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers()
Spell** m_selfContainer; // pointer to our spell container (if applicable)
+15 -3
View File
@@ -353,14 +353,26 @@ m_periodicTimer(0), m_PeriodicEventId(0), m_AuraDRGroup(DIMINISHING_NONE)
m_spellProto = spellproto;
m_currentBasePoints = currentBasePoints ? *currentBasePoints : m_spellProto->EffectBasePoints[eff];
int32 damage;
if(currentBasePoints)
{
damage = *currentBasePoints;
m_currentBasePoints = damage - 1;
}
else
{
m_currentBasePoints = m_spellProto->EffectBasePoints[eff];
if(caster)
damage = caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, target);
else
damage = m_currentBasePoints + 1;
}
m_isPassive = IsPassiveSpell(GetId());
m_positive = IsPositiveEffect(GetId(), m_effIndex);
m_applyTime = time(NULL);
int32 damage;
if(!caster)
{
m_caster_guid = target->GetGUID();
@@ -371,7 +383,7 @@ m_periodicTimer(0), m_PeriodicEventId(0), m_AuraDRGroup(DIMINISHING_NONE)
{
m_caster_guid = caster->GetGUID();
damage = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target);
//damage = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target);
m_maxduration = caster->CalculateSpellDuration(m_spellProto, m_effIndex, target);
if (!damage && castItem && castItem->GetItemSuffixFactor())
+15 -8
View File
@@ -61,11 +61,18 @@ SpellMgr::SpellMgr()
case SPELL_EFFECT_PARRY: // 0
case SPELL_EFFECT_BLOCK: // 0
case SPELL_EFFECT_SKILL: // always with dummy 3 as A
case SPELL_EFFECT_LEARN_SPELL: // 0
//case SPELL_EFFECT_LEARN_SPELL: // 0 may be 5 pet
case SPELL_EFFECT_TRADE_SKILL: // 0 or 1
case SPELL_EFFECT_PROFICIENCY: // 0
EffectTargetType[i] = SPELL_REQUIRE_NONE;
break;
case SPELL_EFFECT_ENCHANT_ITEM:
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
case SPELL_EFFECT_DISENCHANT:
case SPELL_EFFECT_FEED_PET:
case SPELL_EFFECT_PROSPECTING:
EffectTargetType[i] = SPELL_REQUIRE_ITEM;
break;
default:
EffectTargetType[i] = SPELL_REQUIRE_UNIT;
break;
@@ -1331,14 +1338,14 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool
// return true;
//use data of highest rank spell(needed for spells which ranks have different effects)
SpellEntry const *spellInfo1=sSpellStore.LookupEntry(GetLastSpellInChain(spellId_1));
SpellEntry const *spellInfo2=sSpellStore.LookupEntry(GetLastSpellInChain(spellId_2));
spellInfo_1=sSpellStore.LookupEntry(GetLastSpellInChain(spellId_1));
spellInfo_2=sSpellStore.LookupEntry(GetLastSpellInChain(spellId_2));
//if spells have exactly the same effect they cannot stack
for(uint32 i = 0; i < 3; ++i)
if(spellInfo1->Effect[i] != spellInfo2->Effect[i]
|| spellInfo1->EffectApplyAuraName[i] != spellInfo2->EffectApplyAuraName[i]
|| spellInfo1->EffectMiscValue[i] != spellInfo2->EffectMiscValue[i]) // paladin resist aura
if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i]
|| spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]
|| spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i]) // paladin resist aura
return false; // need itemtype check? need an example to add that check
return true;
@@ -1430,8 +1437,8 @@ void SpellMgr::LoadSpellRequired()
bar.step();
sLog.outString();
sLog.outString( ">> Loaded 0 spell chain records" );
sLog.outErrorDb("`spell_chains` table is empty!");
sLog.outString( ">> Loaded 0 spell required records" );
sLog.outErrorDb("`spell_required` table is empty!");
return;
}
uint32 rows = 0;
+1
View File
@@ -258,6 +258,7 @@ enum SpellEffectTargetTypes
SPELL_REQUIRE_NONE,
SPELL_REQUIRE_UNIT,
SPELL_REQUIRE_DEST,
SPELL_REQUIRE_ITEM,
};
enum SpellSelectTargetTypes