diff options
author | megamage <none@none> | 2008-12-23 15:51:07 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-12-23 15:51:07 -0600 |
commit | 7fe4b221db3689989ac091ae60b64f6384a2c3cb (patch) | |
tree | 50baf2dfecb0fdf2ae9b22025d6d5dd0970953be | |
parent | c230fb2c28a51b9033e4494d8aade3e7eedf09cf (diff) |
*Calculate spell points when casting but not hitting.
--HG--
branch : trunk
-rw-r--r-- | src/game/Spell.cpp | 7 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 22 | ||||
-rw-r--r-- | src/game/Unit.cpp | 4 |
3 files changed, 20 insertions, 13 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 3cd27d40305..a8b6a222f18 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2387,9 +2387,14 @@ void Spell::cast(bool skipCheck) return; } + + SendCastResult(castResult); SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()... + for(int i = 0; i < 3; ++i) + m_currentBasePoints[i] = CalculateDamage(i, NULL); + // Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells if (m_spellInfo->speed > 0.0f && !IsChanneledSpell(m_spellInfo)) { @@ -3427,7 +3432,7 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar uint8 eff = m_spellInfo->Effect[i]; uint32 mechanic = m_spellInfo->EffectMechanic[i]; - damage = int32(CalculateDamage((uint8)i,unitTarget)*DamageMultiplier); + damage = int32(m_currentBasePoints[i] * DamageMultiplier); sLog.outDebug( "Spell: Effect : %u", eff); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index c18e265b9db..04a93bfb77c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1258,7 +1258,7 @@ void Spell::EffectDummy(uint32 i) //Life Tap (only it have this with dummy effect) if (m_spellInfo->SpellFamilyFlags == 0x40000) { - float cost = m_currentBasePoints[0]+1; + float cost = m_currentBasePoints[0];//+1; if(Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, cost,this); @@ -1502,7 +1502,7 @@ void Spell::EffectDummy(uint32 i) if(!unitTarget) return; - uint32 spell_id = m_currentBasePoints[i]+1; + uint32 spell_id = m_spellInfo->EffectBasePoints[i]+1;//m_currentBasePoints[i]+1; SpellEntry const* spell_proto = sSpellStore.LookupEntry(spell_id); if(!spell_proto) return; @@ -2470,20 +2470,22 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) // TODO: maybe all this can be replaced by using correct calculated `damage` value if(pProto->Class != ITEM_CLASS_CONSUMABLE || m_spellInfo->SpellFamilyName != SPELLFAMILY_MAGE) { - int32 basePoints = m_currentBasePoints[i]; + num_to_add = m_currentBasePoints[i]; + /*int32 basePoints = m_currentBasePoints[i]; int32 randomPoints = m_spellInfo->EffectDieSides[i]; if (randomPoints) num_to_add = basePoints + irand(1, randomPoints); else - num_to_add = basePoints + 1; + num_to_add = basePoints + 1;*/ } else if (pProto->MaxCount == 1) num_to_add = 1; else if(player->getLevel() >= m_spellInfo->spellLevel) { - int32 basePoints = m_currentBasePoints[i]; + num_to_add = m_currentBasePoints[i]; + /*int32 basePoints = m_currentBasePoints[i]; float pointPerLevel = m_spellInfo->EffectRealPointsPerLevel[i]; - num_to_add = basePoints + 1 + uint32((player->getLevel() - m_spellInfo->spellLevel)*pointPerLevel); + num_to_add = basePoints + 1 + uint32((player->getLevel() - m_spellInfo->spellLevel)*pointPerLevel);*/ } else num_to_add = 2; @@ -2894,7 +2896,7 @@ void Spell::EffectOpenLock(uint32 /*i*/) SkillId = SKILL_LOCKPICKING; // skill bonus provided by casting spell (mostly item spells) - uint32 spellSkillBonus = uint32(m_currentBasePoints[0]+1); + uint32 spellSkillBonus = uint32(m_currentBasePoints[0]/*+1*/); uint32 reqSkillValue = lockInfo->requiredminingskill; @@ -3798,7 +3800,7 @@ void Spell::EffectEnchantItemTmp(uint32 i) // Shaman Rockbiter Weapon if(i==0 && m_spellInfo->Effect[1]==SPELL_EFFECT_DUMMY) { - int32 enchnting_damage = m_currentBasePoints[1]+1; + int32 enchnting_damage = m_currentBasePoints[1];//+1; // enchanting id selected by calculated damage-per-sec stored in Effect[1] base value // with already applied percent bonus from Elemental Weapons talent @@ -5304,7 +5306,7 @@ void Spell::EffectEnchantHeldItem(uint32 i) uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; int32 duration = GetSpellDuration(m_spellInfo); //Try duration index first .. if(!duration) - duration = m_currentBasePoints[i]+1; //Base points after .. + duration = m_currentBasePoints[i];//+1; //Base points after .. if(!duration) duration = 10; //10 seconds for enchants which don't have listed duration @@ -5610,7 +5612,7 @@ void Spell::EffectReputation(uint32 i) Player *_player = (Player*)unitTarget; - int32 rep_change = m_currentBasePoints[i]+1; // field store reputation change -1 + int32 rep_change = m_currentBasePoints[i];//+1; // field store reputation change -1 uint32 faction_id = m_spellInfo->EffectMiscValue[i]; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1603c458932..2a0787fb31e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10454,7 +10454,7 @@ bool Unit::SelectHostilTarget() //====================================================================== //====================================================================== -int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 effBasePoints, Unit const* target) +int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 effBasePoints, Unit const* /*target*/) { Player* unitPlayer = (GetTypeId() == TYPEID_PLAYER) ? (Player*)this : NULL; @@ -10477,7 +10477,7 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde int32 randvalue = spellProto->EffectBaseDice[effect_index] >= randomPoints ? spellProto->EffectBaseDice[effect_index]:irand(spellProto->EffectBaseDice[effect_index], randomPoints); int32 value = basePoints + randvalue; //random damage - if(comboDamage != 0 && unitPlayer && target && (target->GetGUID() == unitPlayer->GetComboTarget())) + if(comboDamage != 0 && unitPlayer /*&& target && (target->GetGUID() == unitPlayer->GetComboTarget())*/) value += (int32)(comboDamage * comboPoints); if(Player* modOwner = GetSpellModOwner()) |