diff options
| -rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 4 | ||||
| -rw-r--r-- | src/game/Spell.cpp | 79 | ||||
| -rw-r--r-- | src/game/Spell.h | 28 | ||||
| -rw-r--r-- | src/game/SpellAuras.cpp | 26 | ||||
| -rw-r--r-- | src/game/SpellAuras.h | 2 | ||||
| -rw-r--r-- | src/game/SpellEffects.cpp | 9 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 122 | ||||
| -rw-r--r-- | src/game/Unit.h | 28 |
8 files changed, 190 insertions, 108 deletions
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index f23fd83832d..850b9bb467f 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -1622,14 +1622,14 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) void Script::RegisterSelf() { int id = GetScriptId(Name.c_str()); - if (id != 0) + if(id) { m_scripts[id] = this; ++num_sc_scripts; } else { - debug_log("TSCR: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str()); + error_db_log("CRASH ALERT! TrinityScript: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str()); delete this; } } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 8b0014caaae..2656e1af3c5 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -295,14 +295,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; @@ -362,7 +359,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; @@ -419,6 +416,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi Spell::~Spell() { + delete m_spellValue; } void Spell::FillTargetMap() @@ -1506,7 +1504,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; Unit::AuraEffectList const& Auras = m_caster->GetAurasByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS); for(Unit::AuraEffectList::const_iterator j = Auras.begin();j != Auras.end(); ++j) @@ -1571,6 +1569,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) break; } + if(!IsPositiveSpell(m_spellInfo->Id)) + if(Unit *magnet = m_caster->SelectMagnetTarget(target)) + if(magnet != target) + m_targets.setUnitTarget(magnet); + switch(cur) { case TARGET_UNIT_MINIPET: @@ -1579,7 +1582,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) break; case TARGET_UNIT_TARGET_ALLY: case TARGET_UNIT_TARGET_RAID: - case TARGET_UNIT_TARGET_ANY: // SelectMagnetTarget()? + case TARGET_UNIT_TARGET_ANY: case TARGET_UNIT_TARGET_PARTY: TagUnitMap.push_back(target); break; @@ -1588,8 +1591,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) break; case TARGET_UNIT_TARGET_ENEMY: if(EffectChainTarget <= 1) - TagUnitMap.push_back(SelectMagnetTarget()); - else if(SelectMagnetTarget()) //TODO: chain target should also use magnet target + TagUnitMap.push_back(target); + else SearchChainTarget(TagUnitMap, radius_h, EffectChainTarget, SPELL_TARGETS_ENEMY); break; case TARGET_UNIT_CHAINHEAL: @@ -5386,40 +5389,6 @@ bool Spell::CheckTarget( Unit* target, uint32 eff ) return true; } -Unit* Spell::SelectMagnetTarget() -{ - Unit* target = m_targets.getUnitTarget(); - - if(target && m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && target->HasAuraType(SPELL_AURA_SPELL_MAGNET)) //Attributes & 0x10 what is this? - { - Unit::AuraEffectList const& magnetAuras = target->GetAurasByType(SPELL_AURA_SPELL_MAGNET); - for(Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr) - { - if(Unit* magnet = (*itr)->GetCaster()) - { - if((*itr)->GetParentAura()->DropAuraCharge()) - { - target = magnet; - m_targets.setUnitTarget(target); - AddUnitTarget(target, 0); - uint64 targetGUID = target->GetGUID(); - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) - { - if (targetGUID == ihit->targetGUID) // Found in list - { - (*ihit).damage = target->GetHealth(); - break; - } - } - break; - } - } - } - } - - return target; -} - bool Spell::IsNeedSendToClient() const { return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || IsChanneledSpell(m_spellInfo) || @@ -5767,3 +5736,25 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk return SPELL_CAST_OK; } + +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; + } +} diff --git a/src/game/Spell.h b/src/game/Spell.h index 0f9483bf38c..660ab8f53a7 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -24,12 +24,9 @@ #include "GridDefines.h" #include "SharedDefines.h" -class WorldSession; class Unit; -class DynamicObj; class Player; class GameObject; -class Group; class Aura; enum SpellCastTargetFlags @@ -209,6 +206,18 @@ class SpellCastTargets uint32 m_itemTargetEntry; }; +struct SpellValue +{ + explicit SpellValue(SpellEntry const *proto) + { + for(uint32 i = 0; i < 3; ++i) + EffectBasePoints[i] = proto->EffectBasePoints[i]; + MaxAffectedTargets = proto->MaxAffectedTargets; + } + int32 EffectBasePoints[3]; + uint32 MaxAffectedTargets; +}; + enum SpellState { SPELL_STATE_NULL = 0, @@ -235,10 +244,6 @@ enum SpellTargets SPELL_TARGETS_CHAINHEAL, }; -#define SPELL_SPELL_CHANNEL_UPDATE_INTERVAL (1*IN_MILISECONDS) - -typedef std::multimap<uint64, uint64> SpellTargetTimeMap; - class Spell { friend struct Trinity::SpellNotifierCreatureAndPlayer; @@ -400,7 +405,6 @@ class Spell void SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap); - Unit* SelectMagnetTarget(); bool CheckTarget( Unit* target, uint32 eff ); bool CanAutoCast(Unit* target); @@ -419,7 +423,7 @@ class Spell void HandleThreatSpells(uint32 spellId); //void HandleAddAura(Unit* Target); - SpellEntry const* m_spellInfo; + const SpellEntry * const m_spellInfo; int32 m_currentBasePoints[3]; // cache SpellEntry::EffectBasePoints and use for set custom base points Item* m_CastItem; uint64 m_castItemGUID; @@ -467,11 +471,15 @@ class Spell void AddTriggeredSpell(SpellEntry const* spell) { m_TriggerSpells.push_back(spell); } void CleanupTargetList(); + + void SetSpellValue(SpellValueMod mod, int32 value); protected: void SendLoot(uint64 guid, LootType loottype); - Unit* m_caster; + Unit* const m_caster; + + SpellValue * const m_spellValue; 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 damage enemies of aura caster diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index a619d14ff06..ddc1b9c59a4 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -147,7 +147,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &AuraEffect::HandleModUnattackable, // 93 SPELL_AURA_MOD_UNATTACKABLE &AuraEffect::HandleNoImmediateEffect, // 94 SPELL_AURA_INTERRUPT_REGEN implemented in Player::RegenerateAll &AuraEffect::HandleAuraGhost, // 95 SPELL_AURA_GHOST - &AuraEffect::HandleNoImmediateEffect, // 96 SPELL_AURA_SPELL_MAGNET implemented in Spell::SelectMagnetTarget + &AuraEffect::HandleNoImmediateEffect, // 96 SPELL_AURA_SPELL_MAGNET implemented in Unit::SelectMagnetTarget &AuraEffect::HandleManaShield, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalcAbsorbResist &AuraEffect::HandleAuraModSkill, // 98 SPELL_AURA_MOD_SKILL_TALENT &AuraEffect::HandleAuraModAttackPower, // 99 SPELL_AURA_MOD_ATTACK_POWER @@ -162,7 +162,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &AuraEffect::HandleAddModifier, //108 SPELL_AURA_ADD_PCT_MODIFIER &AuraEffect::HandleAddTargetTrigger, //109 SPELL_AURA_ADD_TARGET_TRIGGER &AuraEffect::HandleModPowerRegenPCT, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT - &AuraEffect::HandleNULL, //111 SPELL_AURA_ADD_CASTER_HIT_TRIGGER chance redirect attack to caster + &AuraEffect::HandleNoImmediateEffect, //111 SPELL_AURA_ADD_CASTER_HIT_TRIGGER implemented in Unit::SelectMagnetTarget &AuraEffect::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS &AuraEffect::HandleNoImmediateEffect, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus &AuraEffect::HandleNoImmediateEffect, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus @@ -1260,14 +1260,16 @@ void Aura::SetAuraCharges(uint8 charges) SendAuraUpdate(); } -bool Aura::DropAuraCharge() +void Aura::DropAuraCharge() { - if (m_procCharges == 0) - return false; - m_procCharges--; - SendAuraUpdate(); - // return true if last charge dropped - return m_procCharges == 0; + if(m_procCharges) //auras without charges always have charge = 0 + { + --m_procCharges; + if(m_procCharges) // Send charge change + SendAuraUpdate(); + else // Last charge dropped + m_target->RemoveAura(this); + } } bool Aura::IsPersistent() const @@ -2216,6 +2218,12 @@ void AuraEffect::TriggerSpell() caster->CastCustomSpell(target, trigger_spell_id, &m_amount, NULL, NULL, true, NULL, this); return; } + // Negative Energy Periodic + case 46284: + { + caster->CastCustomSpell(trigger_spell_id, SPELLVALUE_MAX_TARGETS, m_tickNumber / 10 + 1, NULL, true, NULL, this, originalCasterGUID); + return; + } } } diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 698df1f9a30..bef0be0bdd9 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -73,7 +73,7 @@ class TRINITY_DLL_SPEC Aura void SetAuraSlot(uint8 slot) { m_auraSlot = slot; } uint8 GetAuraCharges() const { return m_procCharges; } void SetAuraCharges(uint8 charges); - bool DropAuraCharge(); + void DropAuraCharge(); void SetProcDamage(uint32 val) { m_procDamage = val; } uint32 GetProcDamage() const { return m_procDamage; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index f4f7ae2e78b..cd1471055cb 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4714,6 +4714,15 @@ void Spell::EffectScriptEffect(uint32 effIndex) unitTarget->CastSpell(unitTarget, 44870, true); break; } + // Negative Energy + case 46289: + { + if(!unitTarget) + return; + + m_caster->CastSpell(unitTarget, 46285, true); + break; + } // Goblin Weather Machine case 46203: { diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index efa85d137a4..f2ae30ffee6 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1023,66 +1023,75 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I spell->prepare(&targets, triggeredByAura); } -void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); - - if(!spellInfo) - { - sLog.outError("CastCustomSpell: unknown spell id %i", spellId); - return; - } + CustomSpellValues values; + if(bp0) values.AddSpellMod(SPELLVALUE_BASE_POINT0, *bp0); + if(bp1) values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1); + if(bp2) values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2); + CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster); +} - CastCustomSpell(Victim,spellInfo,bp0,bp1,bp2,triggered,castItem,triggeredByAura, originalCaster); +void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, uint32 value, Unit* target, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster) +{ + CustomSpellValues values; + values.AddSpellMod(mod, value); + CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster); } -void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster) { + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); if(!spellInfo) { - sLog.outError("CastCustomSpell: unknown spell"); + sLog.outError("CastSpell: unknown spell id %i by caster: %s %u)", spellId,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } SpellCastTargets targets; uint32 targetMask = spellInfo->Targets; - targets.setUnitTarget(Victim); - /*if(targetMask & (TARGET_FLAG_UNIT|TARGET_FLAG_UNK2)) + + //check unit target + for(int i = 0; i < 3; ++i) { - if(!Victim) + if(spellmgr.SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET) { - sLog.outError("CastCustomSpell: spell id %i by caster: %s %u) does not have unit target", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); - return; + if(!Victim) + { + sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have unit target", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + return; + } + else + break; } - }*/ + } + targets.setUnitTarget(Victim); + + //check destination if(targetMask & (TARGET_FLAG_SOURCE_LOCATION|TARGET_FLAG_DEST_LOCATION)) { if(!Victim) { - sLog.outError("CastCustomSpell: spell id %i by caster: %s %u) does not have destination", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + sLog.outError("CastSpell: spell id %i by caster: %s %u) does not have destination", spellInfo->Id,(GetTypeId()==TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"),(GetTypeId()==TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } targets.setDestination(Victim); } - if (castItem) - DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); - if(!originalCaster && triggeredByAura) originalCaster = triggeredByAura->GetCasterGUID(); - Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); - - if(bp0) - spell->m_currentBasePoints[0] = *bp0-int32(spellInfo->EffectBaseDice[0]); + Spell *spell = new Spell(this, spellInfo, triggered, originalCaster ); - if(bp1) - spell->m_currentBasePoints[1] = *bp1-int32(spellInfo->EffectBaseDice[1]); + if(castItem) + { + DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); + spell->m_CastItem = castItem; + } - if(bp2) - spell->m_currentBasePoints[2] = *bp2-int32(spellInfo->EffectBaseDice[2]); + for(CustomSpellValues::const_iterator itr = value.begin(); itr != value.end(); ++itr) + spell->SetSpellValue(itr->first, itr->second); - spell->m_CastItem = castItem; spell->prepare(&targets, triggeredByAura); } @@ -2257,6 +2266,9 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex return; } + // attack can be redirected to another target + pVictim = SelectMagnetTarget(pVictim); + CalcDamageInfo damageInfo; CalculateMeleeDamage(pVictim, 0, &damageInfo, attType); // Send log damage message to client @@ -6285,8 +6297,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger { uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()]; CastSpell(this, spell, true, castItem, triggeredByAura); - if ((*itr)->GetParentAura()->DropAuraCharge()) - RemoveAurasDueToSpell((*itr)->GetId()); + (*itr)->GetParentAura()->DropAuraCharge(); return true; } } @@ -6370,8 +6381,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger return false; } CastSpell(this, spell, true, castItem, triggeredByAura); - if ((*itr)->GetParentAura()->DropAuraCharge()) - RemoveAurasDueToSpell((*itr)->GetId()); + (*itr)->GetParentAura()->DropAuraCharge(); return true; } } @@ -8166,6 +8176,44 @@ void Unit::SetCharm(Unit* charm, bool apply) } } +Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo) +{ + if(!victim) + return NULL; + + // Magic case + if(spellInfo && (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC)) + { + //I am not sure if this should be redirected. + if(spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE) + return victim; + + Unit::AuraEffectList const& magnetAuras = victim->GetAurasByType(SPELL_AURA_SPELL_MAGNET); + for(Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr) + if(Unit* magnet = (*itr)->GetCaster()) + if(magnet->isAlive()) + { + (*itr)->GetParentAura()->DropAuraCharge(); + return magnet; + } + } + // Melee && ranged case + else + { + AuraEffectList const& hitTriggerAuras = victim->GetAurasByType(SPELL_AURA_ADD_CASTER_HIT_TRIGGER); + for(AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i) + if(Unit* magnet = (*i)->GetCaster()) + if(magnet->isAlive() && magnet->IsWithinLOSInMap(this)) + if(roll_chance_i((*i)->GetAmount())) + { + (*i)->GetParentAura()->DropAuraCharge(); + return magnet; + } + } + + return victim; +} + Unit* Unit::GetFirstControlled() const { //Sequence: charmed, pet, other guardians @@ -8774,8 +8822,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM // Fingers of Frost // TODO: Change this code to less hacky if (Aura * aur = GetAura(44544)) - if (aur->DropAuraCharge()) - RemoveAura(aur); + aur->DropAuraCharge(); break; case 7917: // Glyph of Shadowburn if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this)) @@ -11759,8 +11806,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag // Remove charge (aura can be removed by triggers) if(useCharges && takeCharges) { - if (i->aura->DropAuraCharge()) - RemoveAura(i->aura); + i->aura->DropAuraCharge(); } } } diff --git a/src/game/Unit.h b/src/game/Unit.h index 03331861b9e..4d328042f53 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -123,6 +123,24 @@ enum SpellModOp #define MAX_SPELLMOD 32 +enum SpellValueMod +{ + SPELLVALUE_BASE_POINT0, + SPELLVALUE_BASE_POINT1, + SPELLVALUE_BASE_POINT2, + SPELLVALUE_MAX_TARGETS, +}; + +typedef std::pair<SpellValueMod, int32> CustomSpellValueMod; +class CustomSpellValues : public std::vector<CustomSpellValueMod> +{ + public: + void AddSpellMod(SpellValueMod mod, int32 value) + { + push_back(std::make_pair(mod, value)); + } +}; + enum SpellFacingFlags { SPELL_FACING_FLAG_INFRONT = 0x0001 @@ -282,7 +300,7 @@ enum InventorySlot struct FactionTemplateEntry; struct SpellEntry; -struct SpellEntryExt; +struct SpellValue; class Aura; class AuraEffect; @@ -1155,10 +1173,11 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype); uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true); void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(uint32 spellId, SpellValueMod mod, uint32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void AddAura(uint32 spellId, Unit *target); void HandleAuraEffect(AuraEffect * aureff, bool apply); @@ -1481,6 +1500,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void ModifyAuraState(AuraState flag, bool apply); bool HasAuraState(AuraState flag, SpellEntry const *spellProto = NULL, Unit * Caster = NULL) const ; void UnsummonAllTotems(); + Unit* SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo = NULL); int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask); int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask); int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim); |
