diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/CharacterHandler.cpp | 2 | ||||
-rw-r--r-- | src/game/Pet.cpp | 30 | ||||
-rw-r--r-- | src/game/Pet.h | 3 | ||||
-rw-r--r-- | src/game/Player.cpp | 57 | ||||
-rw-r--r-- | src/game/Player.h | 7 | ||||
-rw-r--r-- | src/game/SharedDefines.h | 3 | ||||
-rw-r--r-- | src/game/Spell.cpp | 24 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 587 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 50 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 92 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 14 | ||||
-rw-r--r-- | src/game/StatSystem.cpp | 8 | ||||
-rw-r--r-- | src/game/Unit.cpp | 385 | ||||
-rw-r--r-- | src/game/Unit.h | 4 | ||||
-rw-r--r-- | src/mangosd/mangosd.conf.dist.in | 4 | ||||
-rw-r--r-- | src/shared/revision_nr.h | 2 |
16 files changed, 636 insertions, 636 deletions
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index b51f24800ad..7556e9e7c86 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -68,7 +68,7 @@ bool LoginQueryHolder::Initialize() res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid)); - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,slot,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid)); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADTUTORIALS, "SELECT tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7 FROM character_tutorial WHERE account = '%u' AND realmid = '%u'", GetAccountId(), realmID); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index e889d365096..f02587c1e1b 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -593,7 +593,7 @@ void Pet::RegenerateFocus() AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) if ((*i)->GetModifier()->m_miscvalue == POWER_FOCUS) - addvalue *= ((*i)->GetModifierValue() + 100) / 100.0f; + addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f; ModifyPower(POWER_FOCUS, (int32)addvalue); } @@ -1108,7 +1108,7 @@ void Pet::_SaveSpellCooldowns() void Pet::_LoadSpells() { - QueryResult *result = CharacterDatabase.PQuery("SELECT spell,slot,active FROM pet_spell WHERE guid = '%u'",m_charmInfo->GetPetNumber()); + QueryResult *result = CharacterDatabase.PQuery("SELECT spell,active FROM pet_spell WHERE guid = '%u'",m_charmInfo->GetPetNumber()); if(result) { @@ -1116,7 +1116,7 @@ void Pet::_LoadSpells() { Field *fields = result->Fetch(); - addSpell(fields[0].GetUInt16(), fields[2].GetUInt16(), PETSPELL_UNCHANGED, fields[1].GetUInt16()); + addSpell(fields[0].GetUInt16(), fields[1].GetUInt16(), PETSPELL_UNCHANGED); } while( result->NextRow() ); @@ -1133,7 +1133,7 @@ void Pet::_SaveSpells() if (itr->second->state == PETSPELL_REMOVED || itr->second->state == PETSPELL_CHANGED) CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE guid = '%u' and spell = '%u'", m_charmInfo->GetPetNumber(), itr->first); if (itr->second->state == PETSPELL_NEW || itr->second->state == PETSPELL_CHANGED) - CharacterDatabase.PExecute("INSERT INTO pet_spell (guid,spell,slot,active) VALUES ('%u', '%u', '%u','%u')", m_charmInfo->GetPetNumber(), itr->first, itr->second->slotId,itr->second->active); + CharacterDatabase.PExecute("INSERT INTO pet_spell (guid,spell,active) VALUES ('%u', '%u', '%u')", m_charmInfo->GetPetNumber(), itr->first, itr->second->active); if (itr->second->state == PETSPELL_REMOVED) _removeSpell(itr->first); @@ -1251,7 +1251,7 @@ void Pet::_SaveAuras() { CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) " "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%u', '%d', '%d', '%d', '%d')", - m_charmInfo->GetPetNumber(), itr2->second->GetCasterGUID(),(uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges())); + m_charmInfo->GetPetNumber(), itr2->second->GetCasterGUID(),(uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount ,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges())); } } } @@ -1269,7 +1269,7 @@ void Pet::_SaveAuras() } } -bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, uint16 slot_id, PetSpellType type) +bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, PetSpellType type) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); if (!spellInfo) @@ -1333,7 +1333,6 @@ bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, uint16 s if(spellmgr.GetFirstSpellInChain(itr->first) == chainstart) { - slot_id = itr->second->slotId; newspell->active = itr->second->active; if(newspell->active == ACT_ENABLED) @@ -1345,21 +1344,6 @@ bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, uint16 s } } - uint16 tmpslot = slot_id; - - if (tmpslot == 0xffff) - { - uint16 maxid = 0; - PetSpellMap::iterator itr; - for (itr = m_spells.begin(); itr != m_spells.end(); ++itr) - { - if(itr->second->state == PETSPELL_REMOVED) continue; - if (itr->second->slotId > maxid) maxid = itr->second->slotId; - } - tmpslot = maxid + 1; - } - - newspell->slotId = tmpslot; m_spells[spell_id] = newspell; if (IsPassiveSpell(spell_id)) @@ -1631,7 +1615,7 @@ void Pet::LearnPetPassives() // Passive 01~10, Passive 00 (20782, not used), Ferocious Inspiration (34457) // Scale 01~03 (34902~34904, bonus from owner, not used) for(PetFamilySpellsSet::const_iterator petSet = petStore->second.begin(); petSet != petStore->second.end(); ++petSet) - addSpell(*petSet, ACT_DECIDE, PETSPELL_NEW, 0xffff, PETSPELL_FAMILY); + addSpell(*petSet, ACT_DECIDE, PETSPELL_NEW, PETSPELL_FAMILY); } } diff --git a/src/game/Pet.h b/src/game/Pet.h index 178ebfb131e..d62418e8ee7 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -68,7 +68,6 @@ enum PetSpellType struct PetSpell { - uint16 slotId; uint16 active; PetSpellState state : 16; @@ -191,7 +190,7 @@ class Pet : public Creature void _LoadSpells(); void _SaveSpells(); - bool addSpell(uint16 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, uint16 slot_id=0xffff, PetSpellType type = PETSPELL_NORMAL); + bool addSpell(uint16 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL); bool learnSpell(uint16 spell_id); void learnLevelupSpells(); bool unlearnSpell(uint16 spell_id); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 20b6a911fa9..0b046d36aba 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -945,7 +945,7 @@ void Player::HandleDrowning() AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING); for(AuraList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i) - UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetModifierValue()) / 100.0f); + UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetModifier()->m_amount) / 100.0f); if ((m_isunderwater & 0x01) && !(m_isunderwater & 0x80) && isAlive()) { @@ -1987,7 +1987,7 @@ void Player::Regenerate(Powers power) AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) if ((*i)->GetModifier()->m_miscvalue == power) - addvalue *= ((*i)->GetModifierValue() + 100) / 100.0f; + addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f; } if (power != POWER_RAGE && power != POWER_RUNIC_POWER) @@ -2028,7 +2028,7 @@ void Player::RegenerateHealth() { AuraList const& mModHealthRegenPct = GetAurasByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT); for(AuraList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i) - addvalue *= (100.0f + (*i)->GetModifierValue()) / 100.0f; + addvalue *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; } else if(HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT)) addvalue *= GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT) / 100.0f; @@ -2226,7 +2226,7 @@ void Player::GiveXP(uint32 xp, Unit* victim) // handle SPELL_AURA_MOD_XP_PCT auras Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_XP_PCT); for(Unit::AuraList::const_iterator i = ModXPPctAuras.begin();i != ModXPPctAuras.end(); ++i) - xp = uint32(xp*(1.0f + (*i)->GetModifierValue() / 100.0f)); + xp = uint32(xp*(1.0f + (*i)->GetModifier()->m_amount / 100.0f)); // XP resting bonus for kill uint32 rested_bonus_xp = victim ? GetXPRestBonus(xp) : 0; @@ -2633,7 +2633,7 @@ void Player::AddNewMailDeliverTime(time_t deliver_time) } } -bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, uint16 slot_id, bool disabled) +bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, bool disabled) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); if (!spellInfo) @@ -2751,7 +2751,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, else if(uint32 prev_spell = spellmgr.GetPrevSpellInChain(spell_id)) { if(loading) // at spells loading, no output, but allow save - addSpell(prev_spell,active,true,loading,SPELL_WITHOUT_SLOT_ID,disabled); + addSpell(prev_spell,active,true,loading,disabled); else // at normal learning learnSpell(prev_spell); } @@ -2809,23 +2809,6 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, } } - uint16 tmpslot=slot_id; - - if (tmpslot == SPELL_WITHOUT_SLOT_ID) - { - uint16 maxid = 0; - PlayerSpellMap::iterator itr; - for (itr = m_spells.begin(); itr != m_spells.end(); ++itr) - { - if(itr->second->state == PLAYERSPELL_REMOVED) - continue; - if (itr->second->slotId > maxid) - maxid = itr->second->slotId; - } - tmpslot = maxid + 1; - } - - newspell->slotId = tmpslot; m_spells[spell_id] = newspell; // return false if spell disabled @@ -4961,22 +4944,8 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType) UpdateAllCritPercentages(); } -void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, MeleeHitOutcome outcome, bool defence) +void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool defence) { -/* Not need, this checked on call this func from trigger system - switch(outcome) - { - case MELEE_HIT_CRIT: - case MELEE_HIT_DODGE: - case MELEE_HIT_PARRY: - case MELEE_HIT_BLOCK: - case MELEE_HIT_BLOCK_CRIT: - return; - - default: - break; - } -*/ uint32 plevel = getLevel(); // if defense than pVictim == attacker uint32 greylevel = Trinity::XP::GetGrayLevel(plevel); uint32 moblevel = pVictim->getLevelForTarget(this); @@ -6920,7 +6889,7 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attac if (item->IsFitToSpellRequirements(aura->GetSpellProto())) { - HandleBaseModValue(mod, FLAT_MOD, float (aura->GetModifierValue()), apply); + HandleBaseModValue(mod, FLAT_MOD, float (aura->GetModifier()->m_amount), apply); } } @@ -6954,7 +6923,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att if (item->IsFitToSpellRequirements(aura->GetSpellProto())) { - HandleStatModifier(unitMod, unitModType, float(aura->GetModifierValue()),apply); + HandleStatModifier(unitMod, unitModType, float(aura->GetModifier()->m_amount),apply); } } @@ -15342,7 +15311,7 @@ void Player::_LoadSpells(QueryResult *result) delete itr->second; m_spells.clear(); - //QueryResult *result = CharacterDatabase.PQuery("SELECT spell,slot,active FROM character_spell WHERE guid = '%u'",GetGUIDLow()); + //QueryResult *result = CharacterDatabase.PQuery("SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'",GetGUIDLow()); if(result) { @@ -15350,7 +15319,7 @@ void Player::_LoadSpells(QueryResult *result) { Field *fields = result->Fetch(); - addSpell(fields[0].GetUInt16(), fields[2].GetBool(), false, true, fields[1].GetUInt16(), fields[3].GetBool()); + addSpell(fields[0].GetUInt16(), fields[1].GetBool(), false, true, fields[2].GetBool()); } while( result->NextRow() ); @@ -15927,7 +15896,7 @@ void Player::_SaveAuras() { CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) " "VALUES ('%u', '" I64FMTD "' ,'%u', '%u', '%u', '%d', '%d', '%d', '%d')", - GetGUIDLow(), itr2->second->GetCasterGUID(), (uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges())); + GetGUIDLow(), itr2->second->GetCasterGUID(), (uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount ,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges())); } } } @@ -16134,7 +16103,7 @@ void Player::_SaveSpells() if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED) CharacterDatabase.PExecute("DELETE FROM character_spell WHERE guid = '%u' and spell = '%u'", GetGUIDLow(), itr->first); if (itr->second->state == PLAYERSPELL_NEW || itr->second->state == PLAYERSPELL_CHANGED) - CharacterDatabase.PExecute("INSERT INTO character_spell (guid,spell,slot,active,disabled) VALUES ('%u', '%u', '%u','%u','%u')", GetGUIDLow(), itr->first, itr->second->slotId,itr->second->active ? 1 : 0,itr->second->disabled ? 1 : 0); + CharacterDatabase.PExecute("INSERT INTO character_spell (guid,spell,active,disabled) VALUES ('%u', '%u', '%u', '%u')", GetGUIDLow(), itr->first, itr->second->active ? 1 : 0,itr->second->disabled ? 1 : 0); if (itr->second->state == PLAYERSPELL_REMOVED) _removeSpell(itr->first); diff --git a/src/game/Player.h b/src/game/Player.h index f4a089ec1c1..63e11ea1cfe 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -75,14 +75,11 @@ enum PlayerSpellState struct PlayerSpell { - uint16 slotId : 16; PlayerSpellState state : 8; bool active : 1; bool disabled : 1; }; -#define SPELL_WITHOUT_SLOT_ID uint16(-1) - // Spell modifier (used for modify other spells) struct SpellModifier { @@ -1481,7 +1478,7 @@ class TRINITY_DLL_SPEC Player : public Unit void SendProficiency(uint8 pr1, uint32 pr2); void SendInitialSpells(); - bool addSpell(uint32 spell_id, bool active, bool learning = true, bool loading = false, uint16 slot_id=SPELL_WITHOUT_SLOT_ID, bool disabled = false); + bool addSpell(uint32 spell_id, bool active, bool learning = true, bool loading = false, bool disabled = false); void learnSpell(uint32 spell_id); void removeSpell(uint32 spell_id, bool disabled = false); void resetSpells(); @@ -1749,7 +1746,7 @@ class TRINITY_DLL_SPEC Player : public Unit void UpdateDefense(); void UpdateWeaponSkill (WeaponAttackType attType); - void UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, MeleeHitOutcome outcome, bool defence); + void UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool defence); void SetSkill(uint32 id, uint16 currVal, uint16 maxVal); uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index d9b88829531..d192495c70a 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -288,7 +288,7 @@ enum SpellCategory #define SPELL_ATTR_EX2_UNK2 0x00000004 // 2 boss spells? #define SPELL_ATTR_EX2_UNK3 0x00000008 // 3 #define SPELL_ATTR_EX2_UNK4 0x00000010 // 4 -#define SPELL_ATTR_EX2_UNK5 0x00000020 // 5 +#define SPELL_ATTR_EX2_AUTOREPEAT_FLAG 0x00000020 // 5 #define SPELL_ATTR_EX2_UNK6 0x00000040 // 6 #define SPELL_ATTR_EX2_UNK7 0x00000080 // 7 #define SPELL_ATTR_EX2_UNK8 0x00000100 // 8 not set in 3.0.3 @@ -2149,6 +2149,7 @@ enum SummonType SUMMON_TYPE_UNKNOWN5 = 409, SUMMON_TYPE_POSESSED3 = 427, SUMMON_TYPE_POSESSED2 = 428, + SUMMON_TYPE_FORCE_OF_NATURE = 669, SUMMON_TYPE_GUARDIAN2 = 1161 }; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 16e5ebd894f..7214fdd103b 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -658,22 +658,30 @@ void Spell::prepareDataForTriggerSystem() m_procVictim = PROC_FLAG_TAKEN_MELEE_SPELL_HIT; break; case SPELL_DAMAGE_CLASS_RANGED: - m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT; - m_procVictim = PROC_FLAG_TAKEN_RANGED_SPELL_HIT; + // Auto attack + if (m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG) + { + m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_HIT; + m_procVictim = PROC_FLAG_TAKEN_RANGED_HIT; + } + else // Ranged spell attack + { + m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT; + m_procVictim = PROC_FLAG_TAKEN_RANGED_SPELL_HIT; + } break; default: - if (IsPositiveSpell(m_spellInfo->Id)) // Check for positive spell + if (IsPositiveSpell(m_spellInfo->Id)) // Check for positive spell { m_procAttacker = PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL; m_procVictim = PROC_FLAG_TAKEN_POSITIVE_SPELL; } - // Wands - else if (IsAutoRepeatRangedSpell(m_spellInfo) && m_spellInfo->Id != SPELL_ID_AUTOSHOT) + else if (m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG) // Wands auto attack { - m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT; - m_procVictim = PROC_FLAG_TAKEN_RANGED_SPELL_HIT; + m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_HIT; + m_procVictim = PROC_FLAG_TAKEN_RANGED_HIT; } - else + else // Negative spell { m_procAttacker = PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT; m_procVictim = PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index b3af266501b..808b04c8cc1 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -341,11 +341,11 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= }; Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) : -m_procCharges(0), m_stackAmount(1), m_spellmod(NULL), m_effIndex(eff), m_caster_guid(0), m_target(target), -m_timeCla(1000), m_castItemGuid(castItem?castItem->GetGUID():0), m_auraSlot(MAX_AURAS), -m_positive(false), m_permanent(false), m_isPeriodic(false), m_isTrigger(false), m_isAreaAura(false), -m_isPersistent(false), m_updated(false), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_isRemovedOnShapeLost(true), m_in_use(false), -m_periodicTimer(0), m_PeriodicEventId(0), m_AuraDRGroup(DIMINISHING_NONE) +m_spellmod(NULL), m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target), +m_timeCla(1000), m_periodicTimer(0), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), +m_effIndex(eff), m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0), m_stackAmount(1), +m_positive(false), m_permanent(false), m_isPeriodic(false), m_isTrigger(false), m_isAreaAura(false), m_isPersistent(false), +m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false) { assert(target); @@ -796,11 +796,12 @@ void Aura::_AddAura() if(!m_target) return; - // we can found aura in NULL_AURA_SLOT and then need store state instead check slot != NULL_AURA_SLOT + // Second aura if some spell bool secondaura = false; + // Try find slot for aura uint8 slot = NULL_AURA_SLOT; - - for(uint8 i = 0; i < 3; i++) + // Lookup for some spell auras (and get slot from it) + for(uint8 i = 0; i < m_effIndex; i++) { Unit::spellEffectPair spair = Unit::spellEffectPair(GetId(), i); for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr) @@ -808,18 +809,30 @@ void Aura::_AddAura() // allow use single slot only by auras from same caster if(itr->second->GetCasterGUID()==GetCasterGUID()) { - secondaura = true; slot = itr->second->GetAuraSlot(); + secondaura = true; break; } } - - if(secondaura) + if (secondaura) break; } - - Unit* caster = GetCaster(); - + // Lookup free slot + if (!secondaura && m_target->GetVisibleAurasCount() < MAX_AURAS) + { + Unit::VisibleAuraMap const *visibleAuras = m_target->GetVisibleAuras(); + for(uint8 i = 0; i < MAX_AURAS; ++i) + { + Unit::VisibleAuraMap::const_iterator itr = visibleAuras->find(i); + if(itr == visibleAuras->end()) + { + slot = i; + // update for out of range group members (on 1 slot use) + m_target->UpdateAuraForGroup(slot); + break; + } + } + } // not call total regen auras at adding switch (m_modifier.m_auraname) { @@ -847,60 +860,51 @@ void Aura::_AddAura() if (getDiminishGroup() != DIMINISHING_NONE ) m_target->ApplyDiminishingAura(getDiminishGroup(),true); + Unit* caster = GetCaster(); + // passive auras (except totem auras) do not get placed in the slots // area auras with SPELL_AURA_NONE are not shown on target if((!m_isPassive || (caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem())) && (m_spellProto->Effect[GetEffIndex()] != SPELL_EFFECT_APPLY_AREA_AURA_ENEMY || m_target != caster)) { - if(!secondaura) // new slot need + SetAuraSlot( slot ); + if(slot < MAX_AURAS) // slot found send data to client { - if(m_target->GetVisibleAurasCount() < MAX_AURAS) - { - Unit::VisibleAuraMap const *visibleAuras = m_target->GetVisibleAuras(); - for(uint8 i = 0; i < MAX_AURAS; ++i) - { - Unit::VisibleAuraMap::const_iterator itr = visibleAuras->find(i); - if(itr == visibleAuras->end()) - { - slot = i; - break; - } - } - } - - SetAuraSlot( slot ); - - // Not update fields for not first spell's aura, all data already in fields - if(slot < MAX_AURAS) // slot found - { - SetAura(false); - SetAuraFlags((1 << GetEffIndex()) | AFLAG_NOT_CASTER | ((GetAuraMaxDuration() > 0) ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE)); - SetAuraLevel(caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)); - SendAuraUpdate(false); - - // update for out of range group members - m_target->UpdateAuraForGroup(slot); - } + SetAura(false); + SetAuraFlags((1 << GetEffIndex()) | AFLAG_NOT_CASTER | ((GetAuraMaxDuration() > 0) ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE)); + SetAuraLevel(caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)); + SendAuraUpdate(false); } - else // use found slot + + //***************************************************** + // Update target aura state flag (at 1 aura apply) + // TODO: Make it easer + //***************************************************** + if (!secondaura) { - SetAuraSlot( slot ); - } - - UpdateSlotCounterAndDuration(); + // Update Seals information + if( IsSealSpell(GetSpellProto()) ) + m_target->ModifyAuraState(AURA_STATE_JUDGEMENT, true); - // Update Seals information - if( IsSealSpell(GetSpellProto()) ) - m_target->ModifyAuraState(AURA_STATE_JUDGEMENT, true); + // Conflagrate aura state on Immolate + if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellProto->SpellFamilyFlags & 4) + m_target->ModifyAuraState(AURA_STATE_IMMOLATE, true); + + // Faerie Fire (druid versions) + if( m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags & 0x0000000000000400LL) + m_target->ModifyAuraState(AURA_STATE_FAERIE_FIRE, true); - // Conflagrate aura state - if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & 4)) - m_target->ModifyAuraState(AURA_STATE_IMMOLATE, true); + // Victorious + if( m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags & 0x0004000000000000LL) + m_target->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH, true); - if(GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID - && (GetSpellProto()->SpellFamilyFlags == 0x40 || GetSpellProto()->SpellFamilyFlags == 0x10)) - { - m_target->ModifyAuraState(AURA_STATE_SWIFTMEND, true); + // Swiftmend state on Regrowth & Rejuvenation + if(m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags & 0x50 ) + m_target->ModifyAuraState(AURA_STATE_SWIFTMEND, true); + + // Deadly poison aura state + if(m_spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && m_spellProto->SpellFamilyFlags & 0x10000) + m_target->ModifyAuraState(AURA_STATE_DEADLY_POISON, true); } } } @@ -938,7 +942,7 @@ void Aura::_RemoveAura() if(m_target->GetVisibleAura(slot) == 0) return; - bool samespell = false; + bool lastaura = true; // find other aura in same slot (current already removed from list) for(uint8 i = 0; i < 3; i++) @@ -948,27 +952,30 @@ void Aura::_RemoveAura() { if(itr->second->GetAuraSlot()==slot) { - samespell = true; - + lastaura = false; break; } } - if(samespell) + if(!lastaura) break; } // only remove icon when the last aura of the spell is removed (current aura already removed from list) - if (!samespell) + if (lastaura) { SetAura(true); SetAuraFlags(AFLAG_NONE); SetAuraLevel(0); - SetAuraCharges(0); SendAuraUpdate(true); // update for out of range group members m_target->UpdateAuraForGroup(slot); + //***************************************************** + // Update target aura state flag (at last aura remove) + // TODO: Make it easer + //***************************************************** + // Update Seals information if( IsSealSpell(GetSpellProto()) ) m_target->ModifyAuraState(AURA_STATE_JUDGEMENT,false); @@ -976,16 +983,22 @@ void Aura::_RemoveAura() if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & 4)) m_target->ModifyAuraState(AURA_STATE_IMMOLATE, false); + // Faerie Fire (druid versions) + if( m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags & 0x0000000000000400LL) + m_target->ModifyAuraState(AURA_STATE_FAERIE_FIRE, false); + + // Victorious + if( m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags & 0x0004000000000000LL) + m_target->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH, false); + // Swiftmend aura state - if(GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID - && (GetSpellProto()->SpellFamilyFlags == 0x40 || GetSpellProto()->SpellFamilyFlags == 0x10)) + if(GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellProto()->SpellFamilyFlags & 0x50) { bool found = false; Unit::AuraList const& RejorRegr = m_target->GetAurasByType(SPELL_AURA_PERIODIC_HEAL); for(Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) { - if((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID - && ((*i)->GetSpellProto()->SpellFamilyFlags == 0x40 || (*i)->GetSpellProto()->SpellFamilyFlags == 0x10) ) + if((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && (*i)->GetSpellProto()->SpellFamilyFlags & 0x50 ) { found = true; break; @@ -995,6 +1008,26 @@ void Aura::_RemoveAura() m_target->ModifyAuraState(AURA_STATE_SWIFTMEND, false); } + // Deadly poison aura state + if(m_spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && m_spellProto->SpellFamilyFlags & 0x10000) + { + // current aura already removed, search present of another + bool found = false; + Unit::AuraList const& auras = m_target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); + for(Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* itr_spell = (*itr)->GetSpellProto(); + if(itr_spell && itr_spell->SpellFamilyName==SPELLFAMILY_ROGUE && itr_spell->SpellFamilyFlags & 0x10000) + { + found = true; + break; + } + } + // this has been last deadly poison aura + if(!found) + m_target->ModifyAuraState(AURA_STATE_DEADLY_POISON,false); + } + // reset cooldown state for spells if(caster && caster->GetTypeId() == TYPEID_PLAYER) { @@ -1020,7 +1053,7 @@ void Aura::SendAuraUpdate(bool remove) uint8 auraFlags = GetAuraFlags(); data << uint8(auraFlags); data << uint8(GetAuraLevel()); - data << uint8(GetAuraCharges()); + data << uint8(m_procCharges ? m_procCharges : m_stackAmount); if(!(auraFlags & AFLAG_NOT_CASTER)) { @@ -1036,22 +1069,52 @@ void Aura::SendAuraUpdate(bool remove) m_target->SendMessageToSet(&data, true); } -void Aura::UpdateSlotCounterAndDuration() +void Aura::SetStackAmount(uint8 stackAmount) { - uint8 slot = GetAuraSlot(); - if(slot >= MAX_AURAS) - return; + if (stackAmount != m_stackAmount) + { + Unit *target = GetTarget(); + Unit *caster = GetCaster(); + if (!target || !caster) + return; + m_stackAmount = stackAmount; + int32 amount = m_stackAmount * caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, target); + // Reapply if amount change + if (amount!=m_modifier.m_amount) + { + ApplyModifier(false, true); + m_modifier.m_amount = amount; + ApplyModifier(true, true); + } + } + RefreshAura(); +} - // Three possibilities: - // Charge = 0; Stack >= 0 - // Charge = 1; Stack >= 0 - // Charge > 1; Stack = 0 - //SetAuraDuration(GetAuraDuration()); - if(m_procCharges < 2) +bool Aura::modStackAmount(int32 num) +{ + // Can`t mod + if (!m_spellProto->StackAmount) + return true; + + // Modify stack but limit it + int32 stackAmount = m_stackAmount + num; + if (stackAmount > m_spellProto->StackAmount) + stackAmount = m_spellProto->StackAmount; + else if (stackAmount <=0) // Last aura from stack removed { - SetAuraCharges(m_stackAmount-1); - SendAuraUpdate(false); + m_stackAmount = 0; + return true; // need remove aura } + + // Update stack amount + SetStackAmount(stackAmount); + return false; +} + +void Aura::RefreshAura() +{ + m_duration = m_maxduration; + SendAuraUpdate(false); } bool Aura::isAffectedOnSpell(SpellEntry const *spell) const @@ -1090,13 +1153,14 @@ void Aura::HandleAddModifier(bool apply, bool Real) case 34754: // Clearcasting case 34936: // Backlash case 48108: // Hot Streak + case 57761: // Fireball! SetAuraCharges(1); break; } SpellModifier *mod = new SpellModifier; mod->op = SpellModOp(m_modifier.m_miscvalue); - mod->value = GetModifierValue(); + mod->value = m_modifier.m_amount; mod->type = SpellModType(m_modifier.m_auraname); // SpellModType value == spell aura types mod->spellId = GetId(); @@ -1851,8 +1915,8 @@ void Aura::TriggerSpell() { switch((*i)->GetModifier()->m_miscvalue) { - case STAT_INTELLECT: intellectLoss += (*i)->GetModifierValue(); break; - case STAT_SPIRIT: spiritLoss += (*i)->GetModifierValue(); break; + case STAT_INTELLECT: intellectLoss += (*i)->GetModifier()->m_amount; break; + case STAT_SPIRIT: spiritLoss += (*i)->GetModifier()->m_amount; break; default: break; } } @@ -1920,7 +1984,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; case 43873: // Headless Horseman Laugh if(caster->GetTypeId() == TYPEID_PLAYER) - ((Player*)caster)->SendPlaySound(11965, false); + ((Player*)caster)->PlaySound(11965, false); return; case 46354: // Blood Elf Illusion if(caster) @@ -2056,12 +2120,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real) m_target->RemoveAurasDueToSpell(spellId); return; } - // Victorious - if(GetId()==32216 && m_target->getClass()==CLASS_WARRIOR) - { - m_target->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH, apply); - return; - } //Summon Fire Elemental if (GetId() == 40133 && caster) { @@ -2114,15 +2172,29 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if(m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading()) m_modifier.m_amount = caster->SpellHealingBonus(GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE, m_target); } - // Do final heal for real !apply - else if (Real) + else { - if (GetAuraDuration() <= 0 || m_removeMode==AURA_REMOVE_BY_DISPEL) + // Final heal only on dispelled or duration end + if ( !(GetAuraDuration() <= 0 || m_removeMode==AURA_REMOVE_BY_DISPEL) ) + return; + + // final heal + if(m_target->IsInWorld()) + m_target->CastCustomSpell(m_target,33778,&m_modifier.m_amount,NULL,NULL,true,NULL,this,GetCasterGUID()); + + /*// have a look if there is still some other Lifebloom dummy aura + Unit::AuraList auras = m_target->GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraList::iterator itr = auras.begin(); itr!=auras.end(); ++itr) + if((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && + (*itr)->GetSpellProto()->SpellFamilyFlags & 0x1000000000LL) + return; + + // final heal + if(m_target->IsInWorld() && m_stackAmount > 0) { - // final heal - if(m_target->IsInWorld()) - m_target->CastCustomSpell(m_target,33778,&m_modifier.m_amount,NULL,NULL,true,NULL,this,GetCasterGUID()); - } + int32 amount = m_modifier.m_amount / m_stackAmount; + m_target->CastCustomSpell(m_target,33778,&amount,NULL,NULL,true,NULL,this,GetCasterGUID()); + }*/ } return; } @@ -2804,7 +2876,7 @@ void Aura::HandleAuraModSkill(bool apply, bool Real) return; uint32 prot=GetSpellProto()->EffectMiscValue[m_effIndex]; - int32 points = GetModifierValue(); + int32 points = m_modifier.m_amount; ((Player*)m_target)->ModifySkillBonus(prot,(apply ? points: -points),m_modifier.m_auraname==SPELL_AURA_MOD_SKILL_TALENT); if(prot == SKILL_DEFENSE) @@ -2901,7 +2973,7 @@ void Aura::HandleAuraTrackStealthed(bool apply, bool Real) void Aura::HandleAuraModScale(bool apply, bool Real) { - m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,GetModifierValue(),apply); + m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,m_modifier.m_amount,apply); } void Aura::HandleModPossess(bool apply, bool Real) @@ -3446,7 +3518,7 @@ void Aura::HandleAuraModSilence(bool apply, bool Real) return; // Search Mana Tap auras on caster - Aura * dummy = m_target->GetDummyAura(28734); + Aura * dummy = caster->GetDummyAura(28734); if (dummy) { int32 bp = dummy->GetStackAmount() * 10; @@ -3503,7 +3575,7 @@ void Aura::HandleModThreat(bool apply, bool Real) if(m_modifier.m_miscvalue & int32(1<<x)) { if(m_target->GetTypeId() == TYPEID_PLAYER) - ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_positive ? GetModifierValue() : -GetModifierValue(), apply); + ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_positive ? m_modifier.m_amount : -m_modifier.m_amount, apply); } } } @@ -3524,9 +3596,9 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real) float threatMod = 0.0f; if(apply) - threatMod = float(GetModifierValue()); + threatMod = float(m_modifier.m_amount); else - threatMod = float(-GetModifierValue()); + threatMod = float(-m_modifier.m_amount); m_target->getHostilRefManager().threatAssist(caster, threatMod); } @@ -3943,6 +4015,10 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) Unit *caster = GetCaster(); + // Custom damage calculation after + if (!apply || loading || !caster) + return; + switch (m_spellProto->SpellFamilyName) { case SPELLFAMILY_GENERIC: @@ -3951,8 +4027,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) if ( m_spellProto->SpellIconID == 147 && m_spellProto->SpellVisual[0] == 0 ) { // $AP*0.18/6 bonus per tick - if (apply && !loading && caster) - m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 / 100); + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 / 100); return; } break; @@ -3962,16 +4037,12 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) // Rend if (m_spellProto->SpellFamilyFlags & 0x0000000000000020LL) { - // 0.00743*(($MWB+$mwb)/2+$AP/14*$MWS) bonus per tick - if (apply && !loading && caster) - { - float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK); - int32 mws = caster->GetAttackTime(BASE_ATTACK); - float mwb_min = caster->GetWeaponDamageRange(BASE_ATTACK,MINDAMAGE); - float mwb_max = caster->GetWeaponDamageRange(BASE_ATTACK,MAXDAMAGE); - // WARNING! in 3.0 multiplier 0.00743f change to 0.6 - m_modifier.m_amount+=int32(((mwb_min+mwb_max)/2+ap*mws/14000)*0.00743f); - } + // $0.2*(($MWB+$mwb)/2+$AP/14*$MWS) bonus per tick + float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK); + int32 mws = caster->GetAttackTime(BASE_ATTACK); + float mwb_min = caster->GetWeaponDamageRange(BASE_ATTACK,MINDAMAGE); + float mwb_max = caster->GetWeaponDamageRange(BASE_ATTACK,MAXDAMAGE); + m_modifier.m_amount+=int32(((mwb_min+mwb_max)/2+ap*mws/14000)*0.2f); return; } break; @@ -3981,90 +4052,78 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) // Rake if (m_spellProto->SpellFamilyFlags & 0x0000000000001000LL) { - // $AP*0.06/3 bonus per tick - if (apply && !loading && caster) - m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 2 / 100); + // $AP*0.06 bonus per tick + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 6 / 100); return; } // Lacerate if (m_spellProto->SpellFamilyFlags & 0x000000010000000000LL) { // $AP*0.05/5 bonus per tick - if (apply && !loading && caster) - m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); return; } // Rip if (m_spellProto->SpellFamilyFlags & 0x000000000000800000LL) { - // $AP * min(0.06*$cp, 0.24)/6 [Yes, there is no difference, whether 4 or 5 CPs are being used] - if (apply && !loading && caster && caster->GetTypeId() == TYPEID_PLAYER) - { - uint8 cp = ((Player*)caster)->GetComboPoints(); + // 0.01*$AP*cp + if (caster->GetTypeId() != TYPEID_PLAYER) + return; - // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs - Unit::AuraList const& dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) + uint8 cp = ((Player*)caster)->GetComboPoints(); + + // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs + Unit::AuraList const& dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) + { + if((*itr)->GetId()==34241) { - if((*itr)->GetId()==34241) - { - m_modifier.m_amount += cp * (*itr)->GetModifier()->m_amount; - break; - } + m_modifier.m_amount += cp * (*itr)->GetModifier()->m_amount; + break; } - - if (cp > 4) cp = 4; - m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100); } + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100); + return; + } + // Lock Jaw + if (m_spellProto->SpellFamilyFlags & 0x1000000000000000LL) + { + // 0.15*$AP + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 15 / 100); return; } break; } case SPELLFAMILY_ROGUE: { - // Deadly poison aura state - if((m_spellProto->SpellFamilyFlags & 0x10000) && m_spellProto->SpellVisual[0]==5100) - { - if(apply) - m_target->ModifyAuraState(AURA_STATE_DEADLY_POISON,true); - else - { - // current aura already removed, search present of another - bool found = false; - Unit::AuraList const& auras = m_target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - { - SpellEntry const* itr_spell = (*itr)->GetSpellProto(); - if(itr_spell && itr_spell->SpellFamilyName==SPELLFAMILY_ROGUE && (itr_spell->SpellFamilyFlags & 0x10000) && itr_spell->SpellVisual[0]==5100) - { - found = true; - break; - } - } - // this has been last deadly poison aura - if(!found) - m_target->ModifyAuraState(AURA_STATE_DEADLY_POISON,false); - } - return; - } // Rupture if (m_spellProto->SpellFamilyFlags & 0x000000000000100000LL) { - // Dmg/tick = $AP*min(0.01*$cp, 0.03) [Like Rip: only the first three CP increase the contribution from AP] - if (apply && !loading && caster && caster->GetTypeId() == TYPEID_PLAYER) - { - uint8 cp = ((Player*)caster)->GetComboPoints(); - if (cp > 3) cp = 3; - m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100); - } + if (caster->GetTypeId() != TYPEID_PLAYER) + return; + //1 point : ${($m1+$b1*1+0.015*$AP)*4} damage over 8 secs + //2 points: ${($m1+$b1*2+0.024*$AP)*5} damage over 10 secs + //3 points: ${($m1+$b1*3+0.03*$AP)*6} damage over 12 secs + //4 points: ${($m1+$b1*4+0.03428571*$AP)*7} damage over 14 secs + //5 points: ${($m1+$b1*5+0.0375*$AP)*8} damage over 16 secs + float AP_per_combo[] = {0, 0.015f, 0.024, 0.03, 0.03428571, 0.0375}; + uint8 cp = ((Player*)caster)->GetComboPoints(); + if (cp > 5) cp = 5; + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]); return; } // Garrote if (m_spellProto->SpellFamilyFlags & 0x000000000000000100LL) { - // $AP*0.18/6 bonus per tick - if (apply && !loading && caster) - m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 / 100); + // $AP*0.07 bonus per tick + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 7 / 100); + return; + } + // Deadly Poison + if (m_spellProto->SpellFamilyFlags & 0x0000000000010000) + { + // 0.08*$AP / 4 * amount of stack + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 2 * GetStackAmount() / 100); return; } break; @@ -4075,16 +4134,14 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) if (m_spellProto->SpellFamilyFlags & 0x0000000000004000LL) { // $RAP*0.1/5 bonus per tick - if (apply && !loading && caster) - m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); return; } // Immolation Trap if (m_spellProto->SpellFamilyFlags & 0x0000000000000004LL && m_spellProto->SpellIconID == 678) { // $RAP*0.1/5 bonus per tick - if (apply && !loading && caster) - m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); return; } break; @@ -4094,27 +4151,37 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) // Consecration if (m_spellProto->SpellFamilyFlags & 0x0000000000000020LL) { - if (apply && !loading) + // ($m1+0.04*$SPH+0.04*$AP) + float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK); + int32 holy = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) + + caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellProto), m_target); + m_modifier.m_amount += int32(0.04f*holy + 0.04f*ap); + + // Improved Consecration - Libram of the Eternal Rest + Unit::AuraList const& classScripts = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for(Unit::AuraList::const_iterator k = classScripts.begin(); k != classScripts.end(); ++k) { - if(Unit* caster = GetCaster()) + switch((*k)->GetModifier()->m_miscvalue) { - Unit::AuraList const& classScripts = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator k = classScripts.begin(); k != classScripts.end(); ++k) + case 5147: { int32 tickcount = GetSpellDuration(m_spellProto) / m_spellProto->EffectAmplitude[m_effIndex]; - switch((*k)->GetModifier()->m_miscvalue) - { - case 5147: // Improved Consecration - Libram of the Eternal Rest - { - m_modifier.m_amount += (*k)->GetModifier()->m_amount / tickcount; - break; - } - } + m_modifier.m_amount += (*k)->GetModifier()->m_amount / tickcount; + break; } } } return; } + // Seal of Vengeance 0.013*$SPH+0.025*$AP per tick (also can stack) + if(m_spellProto->SpellFamilyFlags & 0x0000080000000000LL) + { + float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK); + int32 holy = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) + + caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellProto), m_target); + m_modifier.m_amount += int32((0.013f*holy + 0.025f*ap) * GetStackAmount()); + return; + } break; } default: @@ -4160,9 +4227,9 @@ void Aura::HandleAuraModResistanceExclusive(bool apply, bool Real) { if(m_modifier.m_miscvalue & int32(1<<x)) { - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply); if(m_target->GetTypeId() == TYPEID_PLAYER) - m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,GetModifierValue(), apply); + m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,m_modifier.m_amount, apply); } } } @@ -4173,19 +4240,11 @@ void Aura::HandleAuraModResistance(bool apply, bool Real) { if(m_modifier.m_miscvalue & int32(1<<x)) { - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,GetModifierValue(), apply); + m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,m_modifier.m_amount, apply); } } - - // Faerie Fire (druid versions) - if( m_spellProto->SpellIconID == 109 && - m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && - m_spellProto->SpellFamilyFlags & 0x0000000000000400LL ) - { - m_target->ModifyAuraState(AURA_STATE_FAERIE_FIRE,apply); - } } void Aura::HandleAuraModBaseResistancePCT(bool apply, bool Real) @@ -4195,14 +4254,14 @@ void Aura::HandleAuraModBaseResistancePCT(bool apply, bool Real) { //pets only have base armor if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply); } else { for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++) { if(m_modifier.m_miscvalue & int32(1<<x)) - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_modifier.m_amount), apply); } } } @@ -4213,11 +4272,11 @@ void Aura::HandleModResistancePercent(bool apply, bool Real) { if(m_modifier.m_miscvalue & int32(1<<i)) { - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) { - m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,GetModifierValue(), apply); - m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,GetModifierValue(), apply); + m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,m_modifier.m_amount, apply); + m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,m_modifier.m_amount, apply); } } } @@ -4230,13 +4289,13 @@ void Aura::HandleModBaseResistance(bool apply, bool Real) { //only pets have base stats if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_modifier.m_amount), apply); } else { for(int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) if(m_modifier.m_miscvalue & (1<<i)) - m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); } } @@ -4258,9 +4317,9 @@ void Aura::HandleAuraModStat(bool apply, bool Real) if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue == i) { //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply); - m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyStatBuffMod(Stats(i),GetModifierValue(),apply); + m_target->ApplyStatBuffMod(Stats(i),m_modifier.m_amount,apply); } } } @@ -4280,7 +4339,7 @@ void Aura::HandleModPercentStat(bool apply, bool Real) for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i) { if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) - m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply); } } @@ -4358,9 +4417,9 @@ void Aura::HandleModTotalPercentStat(bool apply, bool Real) { if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) { - m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyStatPercentBuffMod(Stats(i), GetModifierValue(), apply ); + m_target->ApplyStatPercentBuffMod(Stats(i), m_modifier.m_amount, apply ); } } @@ -4458,7 +4517,7 @@ void Aura::HandleModRegen(bool apply, bool Real) // eating if(m_periodicTimer <= 0) { m_periodicTimer += 5000; - int32 gain = m_target->ModifyHealth(GetModifierValue()); + int32 gain = m_target->ModifyHealth(m_modifier.m_amount); Unit *caster = GetCaster(); if (caster) { @@ -4549,7 +4608,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) { if(apply) { - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); m_target->ModifyHealth(m_modifier.m_amount); } else @@ -4558,7 +4617,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) m_target->ModifyHealth(-m_modifier.m_amount); else m_target->SetHealth(1); - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); } } } @@ -4589,7 +4648,7 @@ void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real) UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType); - m_target->HandleStatModifier(unitMod, TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(unitMod, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/) @@ -4600,12 +4659,12 @@ void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/) UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType); - m_target->HandleStatModifier(unitMod, TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool /*Real*/) { - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/) @@ -4674,9 +4733,9 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real) if (GetSpellProto()->EquippedItemClass == -1) { - ((Player*)m_target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetModifierValue()), apply); - ((Player*)m_target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (GetModifierValue()), apply); - ((Player*)m_target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (GetModifierValue()), apply); + ((Player*)m_target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)m_target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)m_target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); } else { @@ -4722,7 +4781,7 @@ void Aura::HandleModSpellCritChance(bool apply, bool Real) } else { - m_target->m_baseSpellCritChance += apply ? GetModifierValue():-GetModifierValue(); + m_target->m_baseSpellCritChance += apply ? m_modifier.m_amount:-m_modifier.m_amount; } } @@ -4746,22 +4805,22 @@ void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real) void Aura::HandleModCastingSpeed(bool apply, bool Real) { - m_target->ApplyCastTimePercentMod(GetModifierValue(),apply); + m_target->ApplyCastTimePercentMod(m_modifier.m_amount,apply); } void Aura::HandleModMeleeRangedSpeedPct(bool apply, bool Real) { - m_target->ApplyAttackTimePercentMod(BASE_ATTACK,GetModifierValue(),apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK,GetModifierValue(),apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetModifierValue(), apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); } void Aura::HandleModCombatSpeedPct(bool apply, bool Real) { - m_target->ApplyCastTimePercentMod(GetModifierValue(),apply); - m_target->ApplyAttackTimePercentMod(BASE_ATTACK,GetModifierValue(),apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK,GetModifierValue(),apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetModifierValue(), apply); + m_target->ApplyCastTimePercentMod(m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); } void Aura::HandleModAttackSpeed(bool apply, bool Real) @@ -4769,26 +4828,26 @@ void Aura::HandleModAttackSpeed(bool apply, bool Real) if(!m_target->isAlive() ) return; - m_target->ApplyAttackTimePercentMod(BASE_ATTACK,GetModifierValue(),apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply); } void Aura::HandleHaste(bool apply, bool Real) { - m_target->ApplyAttackTimePercentMod(BASE_ATTACK, GetModifierValue(),apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK, GetModifierValue(),apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,GetModifierValue(),apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_modifier.m_amount,apply); } void Aura::HandleAuraModRangedHaste(bool apply, bool Real) { - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetModifierValue(), apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); } void Aura::HandleRangedAmmoHaste(bool apply, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,GetModifierValue(), apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_modifier.m_amount, apply); } /********************************/ @@ -4797,7 +4856,7 @@ void Aura::HandleRangedAmmoHaste(bool apply, bool Real) void Aura::HandleAuraModAttackPower(bool apply, bool Real) { - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModRangedAttackPower(bool apply, bool Real) @@ -4805,13 +4864,13 @@ void Aura::HandleAuraModRangedAttackPower(bool apply, bool Real) if((m_target->getClassMask() & CLASSMASK_WAND_USERS)!=0) return; - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModAttackPowerPercent(bool apply, bool Real) { //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1 - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModRangedAttackPowerPercent(bool apply, bool Real) @@ -4820,7 +4879,7 @@ void Aura::HandleAuraModRangedAttackPowerPercent(bool apply, bool Real) return; //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1 - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real) @@ -4872,9 +4931,9 @@ void Aura::HandleModDamageDone(bool apply, bool Real) // apply generic physical damage bonuses including wand case if (GetSpellProto()->EquippedItemClass == -1 || m_target->GetTypeId() != TYPEID_PLAYER) { - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(GetModifierValue()), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(GetModifierValue()), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); } else { @@ -4884,9 +4943,9 @@ void Aura::HandleModDamageDone(bool apply, bool Real) if(m_target->GetTypeId() == TYPEID_PLAYER) { if(m_positive) - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS,GetModifierValue(),apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS,m_modifier.m_amount,apply); else - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG,GetModifierValue(),apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG,m_modifier.m_amount,apply); } } @@ -4912,7 +4971,7 @@ void Aura::HandleModDamageDone(bool apply, bool Real) for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++) { if((m_modifier.m_miscvalue & (1<<i)) != 0) - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i,GetModifierValue(),apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i,m_modifier.m_amount,apply); } } else @@ -4920,7 +4979,7 @@ void Aura::HandleModDamageDone(bool apply, bool Real) for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++) { if((m_modifier.m_miscvalue & (1<<i)) != 0) - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i,GetModifierValue(),apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i,m_modifier.m_amount,apply); } } Pet* pet = m_target->GetPet(); @@ -4955,9 +5014,9 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) // apply generic physical damage bonuses including wand case if (GetSpellProto()->EquippedItemClass == -1 || m_target->GetTypeId() != TYPEID_PLAYER) { - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(GetModifierValue()), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetModifierValue()), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply); } else { @@ -4996,7 +5055,7 @@ void Aura::HandleModOffhandDamagePercent(bool apply, bool Real) sLog.outDebug("AURA MOD OFFHAND DAMAGE"); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetModifierValue()), apply); + m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); } /********************************/ @@ -5009,7 +5068,7 @@ void Aura::HandleModPowerCostPCT(bool apply, bool Real) if(!Real) return; - float amount = GetModifierValue() /100.0f; + float amount = m_modifier.m_amount /100.0f; for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) if(m_modifier.m_miscvalue & (1<<i)) m_target->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+i,amount,apply); @@ -5023,7 +5082,7 @@ void Aura::HandleModPowerCost(bool apply, bool Real) for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) if(m_modifier.m_miscvalue & (1<<i)) - m_target->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,GetModifierValue(),apply); + m_target->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,m_modifier.m_amount,apply); } void Aura::HandleNoReagentUseAura(bool Apply, bool Real) @@ -5270,7 +5329,7 @@ void Aura::HandleModRating(bool apply, bool Real) for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) if (m_modifier.m_miscvalue & (1 << rating)) - ((Player*)m_target)->ApplyRatingMod(CombatRating(rating), GetModifierValue(), apply); + ((Player*)m_target)->ApplyRatingMod(CombatRating(rating), m_modifier.m_amount, apply); } void Aura::HandleModRatingFromStat(bool apply, bool Real) @@ -5315,11 +5374,11 @@ void Aura::HandleModTargetResistance(bool apply, bool Real) // show armor penetration if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE,GetModifierValue(), apply); + m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE,m_modifier.m_amount, apply); // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_SPELL)==SPELL_SCHOOL_MASK_SPELL) - m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,GetModifierValue(), apply); + m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,m_modifier.m_amount, apply); } void Aura::HandleShieldBlockValue(bool apply, bool Real) @@ -5329,7 +5388,7 @@ void Aura::HandleShieldBlockValue(bool apply, bool Real) modType = PCT_MOD; if(m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetModifierValue()), apply); + ((Player*)m_target)->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(m_modifier.m_amount), apply); } void Aura::HandleAuraRetainComboPoints(bool apply, bool Real) @@ -5347,7 +5406,7 @@ void Aura::HandleAuraRetainComboPoints(bool apply, bool Real) // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost) if( !apply && m_duration==0 && target->GetComboTarget()) if(Unit* unit = ObjectAccessor::GetUnit(*m_target,target->GetComboTarget())) - target->AddComboPoints(unit, -GetModifierValue()); + target->AddComboPoints(unit, -m_modifier.m_amount); } void Aura::HandleModUnattackable( bool Apply, bool Real ) @@ -5859,7 +5918,7 @@ void Aura::PeriodicTick() return; // ignore non positive values (can be result apply spellmods to aura damage - uint32 pdamage = GetModifierValue() > 0 ? GetModifierValue() : 0; + uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; sLog.outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); @@ -5921,7 +5980,7 @@ void Aura::PeriodicTick() case SPELL_AURA_PERIODIC_ENERGIZE: { // ignore non positive values (can be result apply spellmods to aura damage - uint32 pdamage = GetModifierValue() > 0 ? GetModifierValue() : 0; + uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); @@ -5953,7 +6012,7 @@ void Aura::PeriodicTick() case SPELL_AURA_OBS_MOD_MANA: { // ignore non positive values (can be result apply spellmods to aura damage - uint32 amount = GetModifierValue() > 0 ? GetModifierValue() : 0; + uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; uint32 pdamage = uint32(m_target->GetMaxPower(POWER_MANA) * amount/100); @@ -5989,7 +6048,7 @@ void Aura::PeriodicTick() if(m_target->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto()))) return; - int32 pdamage = GetModifierValue() > 0 ? GetModifierValue() : 0; + int32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; Powers powerType = Powers(m_modifier.m_miscvalue); @@ -6426,8 +6485,12 @@ void Aura::PeriodicDummyTick() case SPELLFAMILY_DEATHKNIGHT: { // Death and Decay -// if (spell->SpellFamilyFlags & 0x0000000000000020LL) -// return; + if (spell->SpellFamilyFlags & 0x0000000000000020LL) + { + if (caster) + caster->CastCustomSpell(m_target, 52212, &m_modifier.m_amount, NULL, NULL, true); + return; + } // Raise Dead // if (spell->SpellFamilyFlags & 0x0000000000001000LL) // return; diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 9b1ac66c795..8a8c30df04b 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -222,8 +222,6 @@ class TRINITY_DLL_SPEC Aura void SetModifier(AuraType t, int32 a, uint32 pt, int32 miscValue); Modifier* GetModifier() {return &m_modifier;} - int32 GetModifierValuePerStack() {return m_modifier.m_amount;} - int32 GetModifierValue() {return m_modifier.m_amount * m_stackAmount;} int32 GetMiscValue() {return m_spellProto->EffectMiscValue[m_effIndex];} int32 GetMiscBValue() {return m_spellProto->EffectMiscValueB[m_effIndex];} @@ -238,11 +236,8 @@ class TRINITY_DLL_SPEC Aura int32 GetAuraDuration() const { return m_duration; } void SetAuraDuration(int32 duration) { m_duration = duration; } time_t GetAuraApplyTime() { return m_applyTime; } - SpellModifier *getAuraSpellMod() {return m_spellmod; } - void UpdateAuraDuration(); - void SendAuraDurationForCaster(Player* caster); - void UpdateSlotCounterAndDuration(); + SpellModifier *getAuraSpellMod() {return m_spellmod; } uint64 const& GetCasterGUID() const { return m_caster_guid; } Unit* GetCaster() const; @@ -283,6 +278,12 @@ class TRINITY_DLL_SPEC Aura void SetAura(bool remove) { m_target->SetVisibleAura(m_auraSlot, remove ? 0 : GetId()); } void SendAuraUpdate(bool remove); + int8 GetStackAmount() {return m_stackAmount;} + int32 GetModifierValuePerStack() {return m_modifier.m_amount / m_stackAmount;} + void SetStackAmount(uint8 num); + bool modStackAmount(int32 num); // return true if last charge dropped + void RefreshAura(); + bool IsPositive() { return m_positive; } void SetNegative() { m_positive = false; } void SetPositive() { m_positive = true; } @@ -323,31 +324,33 @@ class TRINITY_DLL_SPEC Aura uint32 const *getAuraSpellClassMask() const { return m_spellProto->EffectSpellClassMaskA + m_effIndex * 3; } bool isAffectedOnSpell(SpellEntry const *spell) const; - - int32 GetStackAmount() {return m_stackAmount;} - void SetStackAmount(int32 amount) {m_stackAmount=amount;} protected: Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL); Modifier m_modifier; SpellModifier *m_spellmod; - uint32 m_effIndex; + SpellEntry const *m_spellProto; - int32 m_currentBasePoints; // cache SpellEntry::EffectBasePoints and use for set custom base points - uint64 m_caster_guid; Unit* m_target; - int32 m_maxduration; - int32 m_duration; - int32 m_timeCla; + uint64 m_caster_guid; uint64 m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted time_t m_applyTime; - AuraRemoveMode m_removeMode; + int32 m_currentBasePoints; // cache SpellEntry::EffectBasePoints and use for set custom base points + int32 m_maxduration; // Max aura duration + int32 m_duration; // Current time + int32 m_timeCla; // Timer for power per sec calcultion + int32 m_periodicTimer; // Timer for periodic auras - uint8 m_auraSlot; - uint8 m_auraFlags; - uint8 m_auraLevel; - int8 m_procCharges; + AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason + DiminishingGroup m_AuraDRGroup:8; // Diminishing + + uint8 m_effIndex; // Aura effect index in spell + uint8 m_auraSlot; // Aura slot on unit (for show in client) + uint8 m_auraFlags; // Aura info flag (for send data to client) + uint8 m_auraLevel; // Aura level (store caster level for correct show level dep amount) + uint8 m_procCharges; // Aura charges (0 for infinite) + uint8 m_stackAmount; // Aura stack amount bool m_positive:1; bool m_permanent:1; @@ -358,14 +361,9 @@ class TRINITY_DLL_SPEC Aura bool m_isPersistent:1; bool m_isDeathPersist:1; bool m_isRemovedOnShapeLost:1; - bool m_updated:1; + bool m_updated:1; // Prevent remove aura by stack if set bool m_in_use:1; // true while in Aura::ApplyModifier call - int32 m_periodicTimer; - uint32 m_PeriodicEventId; - DiminishingGroup m_AuraDRGroup; - - int32 m_stackAmount; private: void CleanupTriggeredSpells(); }; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 11d1fa7f501..3de1f958c1a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -519,31 +519,29 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) // consume from stack dozes not more that have combo-points if(uint32 combo = ((Player*)m_caster)->GetComboPoints()) { - // count consumed deadly poison doses at target - uint32 doses = 0; - - // remove consumed poison doses + Aura *poison = 0; + // Lookup for Deadly poison (only attacker applied) Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end() && combo;) - { - // Deadly poison (only attacker applied) - if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_ROGUE && ((*itr)->GetSpellProto()->SpellFamilyFlags & 0x10000) && - (*itr)->GetSpellProto()->SpellVisual[0]==5100 && (*itr)->GetCasterGUID()==m_caster->GetGUID() ) + if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_ROGUE && + (*itr)->GetSpellProto()->SpellFamilyFlags & 0x10000 && + (*itr)->GetCasterGUID()==m_caster->GetGUID() ) { - --combo; - ++doses; - - unitTarget->RemoveSingleAuraFromStack((*itr)->GetId(), (*itr)->GetEffIndex()); - - itr = auras.begin(); + poison = *itr; + break; } - else - ++itr; + // count consumed deadly poison doses at target + if (poison) + { + uint32 spellId = poison->GetId(); + uint32 doses = poison->GetStackAmount(); + if (doses > combo) + doses = combo; + for (int i=0; i< doses; i++) + unitTarget->RemoveSingleSpellAurasFromStack(spellId); + damage *= doses; + damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.03f * doses); } - - damage *= doses; - damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.03f * doses); - // Eviscerate and Envenom Bonus Damage (item set effect) if(m_caster->GetDummyAura(37169)) damage += ((Player*)m_caster)->GetComboPoints()*40; @@ -628,19 +626,25 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) } case SPELLFAMILY_PALADIN: { - // Judgement of Vengeance + // Judgement of Vengeance ${1+0.22*$SPH+0.14*$AP} + 10% for each application of Holy Vengeance on the target if((m_spellInfo->SpellFamilyFlags & 0x800000000LL) && m_spellInfo->SpellIconID==2292) { + float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); + int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) + + m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget); + damage+=int32(ap * 0.14f) + int32(holy * 22 / 100); + // Get stack of Holy Vengeance on the target added by caster uint32 stacks = 0; Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) if((*itr)->GetId() == 31803 && (*itr)->GetCasterGUID()==m_caster->GetGUID()) - ++stacks; - if(!stacks) - //No damage if the target isn't affected by this - damage = -1; - else - damage *= stacks; + { + stacks = (*itr)->GetStackAmount(); + break; + } + // + 10% for each application of Holy Vengeance on the target + if(stacks) + damage += damage * stacks * 10 /100; } // Avenger's Shield ($m1+0.07*$SPH+0.07*$AP) else if(m_spellInfo->SpellFamilyFlags & 0x0000000000004000LL) @@ -1576,6 +1580,8 @@ void Spell::EffectDummy(uint32 i) case 20930: hurt = 25902; heal = 25903; break; case 27174: hurt = 27176; heal = 27175; break; case 33072: hurt = 33073; heal = 33074; break; + case 48824: hurt = 48822; heal = 48820; break; + case 48825: hurt = 48823; heal = 48821; break; default: sLog.outError("Spell::EffectDummy: Spell %u not handled in HS",m_spellInfo->Id); return; @@ -2249,7 +2255,8 @@ void Spell::EffectPowerDrain(uint32 i) unitTarget->ModifyPower(drain_power,-new_damage); - if(drain_power == POWER_MANA) + // Don`t restore from self drain + if(drain_power == POWER_MANA && m_caster != unitTarget) { float manaMultiplier = m_spellInfo->EffectMultipleValue[i]; if(manaMultiplier==0) @@ -2388,7 +2395,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/) Unit::AuraList const& mDummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) if((*i)->GetId() == 45062) - damageAmount+=(*i)->GetModifierValue(); + damageAmount+=(*i)->GetModifier()->m_amount; if (damageAmount) m_caster->RemoveAurasDueToSpell(45062); @@ -2428,7 +2435,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/) tickheal = auraCaster->SpellHealingBonus(targetAura->GetSpellProto(), tickheal, DOT, unitTarget); //int32 tickheal = targetAura->GetSpellProto()->EffectBasePoints[idx] + 1; //It is said that talent bonus should not be included - //int32 tickheal = targetAura->GetModifierValue(); + //int32 tickheal = targetAura->GetModifier()->m_amount; int32 tickcount = GetSpellDuration(targetAura->GetSpellProto()) / targetAura->GetSpellProto()->EffectAmplitude[idx]; addhealth += tickheal * tickcount; unitTarget->RemoveAurasDueToCasterSpell(targetAura->GetId(), targetAura->GetCasterGUID()); @@ -3161,6 +3168,7 @@ void Spell::EffectSummonType(uint32 i) case SUMMON_TYPE_POSESSED2: case SUMMON_TYPE_POSESSED3: EffectSummonPossessed(i); + case SUMMON_TYPE_FORCE_OF_NATURE: case SUMMON_TYPE_GUARDIAN2: EffectSummonGuardian(i); break; @@ -3404,12 +3412,7 @@ void Spell::EffectDispel(uint32 i) SpellEntry const* spellInfo = sSpellStore.LookupEntry(j->first); data << uint32(spellInfo->Id); // Spell Id data << uint8(0); // 0 - dispelled !=0 cleansed - if(spellInfo->StackAmount!= 0) - { - //Why are Aura's Removed by EffIndex? Auras should be removed as a whole..... - unitTarget->RemoveSingleAuraFromStackByDispel(spellInfo->Id); - } - else + //Why are Aura's Removed by EffIndex? Auras should be removed as a whole..... unitTarget->RemoveAurasDueToSpellByDispel(spellInfo->Id, j->second, m_caster); } m_caster->SendMessageToSet(&data, true); @@ -4299,7 +4302,6 @@ void Spell::SpellDamageWeaponDmg(uint32 i) if(m_spellInfo->SpellVisual[0] == 671 && m_spellInfo->SpellIconID == 1508) { uint32 stack = 0; - Unit::AuraList const& list = unitTarget->GetAurasByType(SPELL_AURA_MOD_RESISTANCE); for(Unit::AuraList::const_iterator itr=list.begin();itr!=list.end();++itr) { @@ -4307,9 +4309,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i) if(proto->SpellFamilyName == SPELLFAMILY_WARRIOR && proto->SpellFamilyFlags == SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR) { - int32 duration = GetSpellDuration(proto); - (*itr)->SetAuraDuration(duration); - (*itr)->SendAuraUpdate(false); + (*itr)->RefreshAura(); stack = (*itr)->GetStackAmount(); break; } @@ -4347,6 +4347,8 @@ void Spell::SpellDamageWeaponDmg(uint32 i) } } } + if (stack) + spell_bonus += stack * CalculateDamage(2, unitTarget); } break; } @@ -4732,6 +4734,8 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 11729: case 11730: case 27230: + case 47871: + case 47878: { uint32 itemtype; uint32 rank = 0; @@ -4779,12 +4783,11 @@ void Spell::EffectScriptEffect(uint32 effIndex) } // Brittle Armor - need remove one 24575 Brittle Armor aura case 24590: - unitTarget->RemoveSingleAuraFromStack(24575, 0); - unitTarget->RemoveSingleAuraFromStack(24575, 1); + unitTarget->RemoveSingleSpellAurasFromStack(24575); return; // Mercurial Shield - need remove one 26464 Mercurial Shield aura case 26465: - unitTarget->RemoveSingleAuraFromStack(26464, 0); + unitTarget->RemoveSingleSpellAurasFromStack(26464); return; // Orb teleport spells case 25140: @@ -5054,8 +5057,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) if (!(familyFlag & 0x000000800000C000LL)) continue; // Refresh aura duration - aura->SetAuraDuration(aura->GetAuraMaxDuration()); - aura->SendAuraUpdate(false); + aura->RefreshAura(); // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting. if (familyFlag & 0x0000000000004000LL && aura->GetEffIndex() == 0) diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index d8dd6bfc471..1f6101c6114 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -429,10 +429,9 @@ inline bool isSpellBreakStealth(SpellEntry const* spellInfo) inline bool IsAutoRepeatRangedSpell(SpellEntry const* spellInfo) { - return (spellInfo->Attributes & SPELL_ATTR_RANGED) && (spellInfo->AttributesEx2 == 0x000020 /*autorepeat*/); + return (spellInfo->Attributes & SPELL_ATTR_RANGED) && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG); } - uint8 GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 form); inline bool IsChanneledSpell(SpellEntry const* spellInfo) @@ -460,6 +459,17 @@ inline uint32 GetSpellMechanicMask(SpellEntry const* spellInfo, int32 effect) return mask; } +inline uint32 GetAllSpellMechanicMask(SpellEntry const* spellInfo) +{ + uint32 mask = 0; + if (spellInfo->Mechanic) + mask |= 1<<spellInfo->Mechanic; + for (int i=0; i< 3; ++i) + if (spellInfo->EffectMechanic[i]) + mask |= 1<<spellInfo->EffectMechanic[i]; + return mask; +} + inline Mechanics GetEffectMechanic(SpellEntry const* spellInfo, int32 effect) { if (spellInfo->EffectMechanic[effect]) diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 2cfac58f962..dde5a2cfb40 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -165,7 +165,7 @@ void Player::UpdateArmor() { Modifier* mod = (*i)->GetModifier(); if(mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) - value += int32(GetStat(Stats((*i)->GetMiscBValue())) * (*i)->GetModifierValue() / 100.0f); + value += int32(GetStat(Stats((*i)->GetMiscBValue())) * mod->m_amount / 100.0f); } value *= GetModifierValue(unitMod, TOTAL_PCT); @@ -612,10 +612,10 @@ void Player::UpdateExpertise(WeaponAttackType attack) { // item neutral spell if((*itr)->GetSpellProto()->EquippedItemClass == -1) - expertise += (*itr)->GetModifierValue(); + expertise += (*itr)->GetModifier()->m_amount; // item dependent spell else if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) - expertise += (*itr)->GetModifierValue(); + expertise += (*itr)->GetModifier()->m_amount; } if(expertise < 0) @@ -645,7 +645,7 @@ void Player::UpdateManaRegen() for(AuraList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - power_regen_mp5 += GetStat(Stats(mod->m_miscvalue)) * (*i)->GetModifierValue() / 500.0f; + power_regen_mp5 += GetStat(Stats(mod->m_miscvalue)) * mod->m_amount / 500.0f; } // Bonus from some dummy auras diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6f64a3ee57a..2c3432abb57 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1306,10 +1306,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) { SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); if( spellInfo->AttributesEx3 & 0x40000 && spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && ((*itr).second->GetCasterGUID() == GetGUID())) - { - (*itr).second->SetAuraDuration((*itr).second->GetAuraMaxDuration()); - (*itr).second->SendAuraUpdate(false); - } + (*itr).second->RefreshAura(); } } // Call default DealDamage @@ -1623,10 +1620,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) { SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); if( spellInfo->AttributesEx3 & 0x40000 && spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && ((*itr).second->GetCasterGUID() == GetGUID())) - { - (*itr).second->SetAuraDuration((*itr).second->GetAuraMaxDuration()); - (*itr).second->SendAuraUpdate(false); - } + (*itr).second->RefreshAura(); } } @@ -2551,7 +2545,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool Unit::AuraList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL); for(Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i) if((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spell)) - reflectchance = (*i)->GetModifierValue(); + reflectchance = (*i)->GetModifier()->m_amount; if (reflectchance > 0 && roll_chance_i(reflectchance)) { // Start triggers for remove charges if need (trigger only for victim, and mark as active spell) @@ -3167,7 +3161,7 @@ int32 Unit::GetTotalAuraModifier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) - modifier += (*i)->GetModifierValue(); + modifier += (*i)->GetModifier()->m_amount; return modifier; } @@ -3178,7 +3172,7 @@ float Unit::GetTotalAuraMultiplier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) - multiplier *= (100.0f + (*i)->GetModifierValue())/100.0f; + multiplier *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f; return multiplier; } @@ -3190,7 +3184,7 @@ int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { - int32 amount = (*i)->GetModifierValue(); + int32 amount = (*i)->GetModifier()->m_amount; if (amount > modifier) modifier = amount; } @@ -3205,7 +3199,7 @@ int32 Unit::GetMaxNegativeAuraModifier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { - int32 amount = (*i)->GetModifierValue(); + int32 amount = (*i)->GetModifier()->m_amount; if (amount < modifier) modifier = amount; } @@ -3222,7 +3216,7 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue & misc_mask) - modifier += (*i)->GetModifierValue(); + modifier += (*i)->GetModifier()->m_amount; } return modifier; } @@ -3236,7 +3230,7 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue & misc_mask) - multiplier *= (100.0f + (*i)->GetModifierValue())/100.0f; + multiplier *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f; } return multiplier; } @@ -3249,7 +3243,7 @@ int32 Unit::GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_ for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - int32 amount = (*i)->GetModifierValue(); + int32 amount = (*i)->GetModifier()->m_amount; if (mod->m_miscvalue & misc_mask && amount > modifier) modifier = amount; } @@ -3265,7 +3259,7 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_ for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - int32 amount = (*i)->GetModifierValue(); + int32 amount = (*i)->GetModifier()->m_amount; if (mod->m_miscvalue & misc_mask && amount < modifier) modifier = amount; } @@ -3282,7 +3276,7 @@ int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue == misc_value) - modifier += (*i)->GetModifierValue(); + modifier += (*i)->GetModifier()->m_amount; } return modifier; } @@ -3296,7 +3290,7 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue == misc_value) - multiplier *= (100.0f + (*i)->GetModifierValue())/100.0f; + multiplier *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f; } return multiplier; } @@ -3309,7 +3303,7 @@ int32 Unit::GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_ for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - int32 amount = (*i)->GetModifierValue(); + int32 amount = (*i)->GetModifier()->m_amount; if (mod->m_miscvalue == misc_value && amount > modifier) modifier = amount; } @@ -3325,7 +3319,7 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_ for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - int32 amount = (*i)->GetModifierValue(); + int32 amount = (*i)->GetModifier()->m_amount; if (mod->m_miscvalue == misc_value && amount < modifier) modifier = amount; } @@ -3363,50 +3357,45 @@ bool Unit::AddAura(Aura *Aur) // passive and persistent auras can stack with themselves any number of times if (!Aur->IsPassive() && !Aur->IsPersistent()) { - // replace aura if next will > spell StackAmount - if(aurSpellInfo->StackAmount) + for(AuraMap::iterator i2 = m_Auras.lower_bound(spair); i2 != m_Auras.upper_bound(spair); ++i2) { - Aur->SetStackAmount(i->second->GetStackAmount()); - if(Aur->GetStackAmount() < aurSpellInfo->StackAmount) - Aur->SetStackAmount(Aur->GetStackAmount()+1); - RemoveAura(i,AURA_REMOVE_BY_STACK); - } - // if StackAmount==0 not allow auras from same caster - else - { - for(AuraMap::iterator i2 = m_Auras.lower_bound(spair); i2 != m_Auras.upper_bound(spair); ++i2) + if(i2->second->GetCasterGUID()==Aur->GetCasterGUID()) { - if(i2->second->GetCasterGUID()==Aur->GetCasterGUID()) + // Aura can stack on self -> Stack it; + if(aurSpellInfo->StackAmount) { - // can be only single (this check done at _each_ aura add - RemoveAura(i2,AURA_REMOVE_BY_STACK); - break; - } - - bool stop = false; - switch(aurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]) - { - // DoT/HoT/etc - case SPELL_AURA_PERIODIC_DAMAGE: // allow stack - case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: - case SPELL_AURA_PERIODIC_LEECH: - case SPELL_AURA_PERIODIC_HEAL: - case SPELL_AURA_OBS_MOD_HEALTH: - case SPELL_AURA_PERIODIC_MANA_LEECH: - case SPELL_AURA_PERIODIC_ENERGIZE: - case SPELL_AURA_OBS_MOD_MANA: - case SPELL_AURA_POWER_BURN_MANA: - break; - default: // not allow - // can be only single (this check done at _each_ aura add - RemoveAura(i2,AURA_REMOVE_BY_STACK); - stop = true; - break; + i2->second->modStackAmount(1); + delete Aur; + return false; } + // can be only single (this check done at _each_ aura add + RemoveAura(i2,AURA_REMOVE_BY_STACK); + break; + } - if(stop) + bool stop = false; + switch(aurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]) + { + // DoT/HoT/etc + case SPELL_AURA_PERIODIC_DAMAGE: // allow stack + case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: + case SPELL_AURA_PERIODIC_LEECH: + case SPELL_AURA_PERIODIC_HEAL: + case SPELL_AURA_OBS_MOD_HEALTH: + case SPELL_AURA_PERIODIC_MANA_LEECH: + case SPELL_AURA_PERIODIC_ENERGIZE: + case SPELL_AURA_OBS_MOD_MANA: + case SPELL_AURA_POWER_BURN_MANA: + break; + default: // not allow + // can be only single (this check done at _each_ aura add + RemoveAura(i2,AURA_REMOVE_BY_STACK); + stop = true; break; } + + if(stop) + break; } } } @@ -3656,14 +3645,15 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit uint64 caster_guid = aur->GetCasterGUID(); // Remove aura - RemoveAura(iter, AURA_REMOVE_BY_DISPEL); + if (iter->second->modStackAmount(-1)) + RemoveAura(iter, AURA_REMOVE_BY_DISPEL); // backfire damage and silence dispeler->CastCustomSpell(dispeler, 31117, &damage, NULL, NULL, true, NULL, NULL,caster_guid); iter = m_Auras.begin(); // iterator can be invalidate at cast if self-dispel } - else + else if (iter->second->modStackAmount(-1)) RemoveAura(iter, AURA_REMOVE_BY_DISPEL); } else @@ -3695,7 +3685,8 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit stealer->AddAura(new_aur); // Remove aura as dispel - RemoveAura(iter, AURA_REMOVE_BY_DISPEL); + if (iter->second->modStackAmount(-1)) + RemoveAura(iter, AURA_REMOVE_BY_DISPEL); } else ++iter; @@ -3733,48 +3724,20 @@ void Unit::RemoveAurasWithDispelType( DispelType type ) } } -void Unit::RemoveSingleAuraFromStackByDispel(uint32 spellId) -{ - for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) - { - Aura *aur = iter->second; - if (aur->GetId() == spellId) - { - if(iter->second->GetStackAmount() > 1) - { - // reapply modifier with reduced stack amount - iter->second->ApplyModifier(false,true); - iter->second->SetStackAmount(iter->second->GetStackAmount()-1); - iter->second->ApplyModifier(true,true); - - iter->second->UpdateSlotCounterAndDuration(); - return; // not remove aura if stack amount > 1 - } - else - RemoveAura(iter,AURA_REMOVE_BY_DISPEL); - } - else - ++iter; - } -} - void Unit::RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex) { AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex)); if(iter != m_Auras.end()) { - if(iter->second->GetStackAmount() > 1) - { - // reapply modifier with reduced stack amount - iter->second->ApplyModifier(false,true); - iter->second->SetStackAmount(iter->second->GetStackAmount()-1); - iter->second->ApplyModifier(true,true); + if (iter->second->modStackAmount(-1)) + RemoveAura(iter); + } +} - iter->second->UpdateSlotCounterAndDuration(); - return; // not remove aura if stack amount > 1 - } - RemoveAura(iter); - } +void Unit::RemoveSingleSpellAurasFromStack(uint32 spellId) +{ + for (int i=0; i<3; ++i) + RemoveSingleAuraFromStack(spellId, i); } void Unit::RemoveAurasDueToSpell(uint32 spellId, Aura* except) @@ -4478,15 +4441,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!procSpell || procSpell->Id == 24659) return false; // Need remove one 24659 aura - RemoveSingleAuraFromStack(24659, 0); - RemoveSingleAuraFromStack(24659, 1); + RemoveSingleSpellAurasFromStack(24659); return true; } // Restless Strength case 24661: { // Need remove one 24662 aura - RemoveSingleAuraFromStack(24662, 0); + RemoveSingleSpellAurasFromStack(24662); return true; } // Adaptive Warding (Frostfire Regalia set) @@ -4809,7 +4771,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // mana cost save - basepoints0 = procSpell->manaCost * triggeredByAura->GetModifier()->m_amount/100; + int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; + basepoints0 = cost * triggeredByAura->GetModifier()->m_amount/100; if( basepoints0 <=0 ) return false; @@ -4840,6 +4803,20 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu mod->m_amount = 25; return true; } + // Burnout + if (dummySpell->SpellIconID == 2998) + { + if(!procSpell) + return false; + + int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; + basepoints0 = cost * triggeredByAura->GetModifier()->m_amount/100; + if( basepoints0 <=0 ) + return false; + triggered_spell_id = 44450; + target = this; + break; + } // Incanter's Regalia set (add trigger chance to Mana Shield) if (dummySpell->SpellFamilyFlags & 0x0000000000008000LL) { @@ -4908,15 +4885,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) || this == pVictim) return false; // Need stun or root mechanic - if (procSpell->Mechanic != MECHANIC_ROOT && procSpell->Mechanic != MECHANIC_STUN) - { - int32 i; - for (i=0; i<3; i++) - if (procSpell->EffectMechanic[i] == MECHANIC_ROOT || procSpell->EffectMechanic[i] == MECHANIC_STUN) - break; - if (i == 3) - return false; - } + if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_ROOT)|(1<<MECHANIC_STUN)))) + return false; switch (dummySpell->Id) { @@ -5262,48 +5232,15 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu } case SPELLFAMILY_PALADIN: { - // TODO: spell list, formula change in 3.0.3 - // Seal of Righteousness - melee proc dummy + // Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage) if (dummySpell->SpellFamilyFlags&0x000000008000000LL && triggeredByAura->GetEffIndex()==0) { - if(GetTypeId() != TYPEID_PLAYER) - return false; - - uint32 spellId; - switch (triggeredByAura->GetId()) - { - case 21084: spellId = 25742; break; // Rank 1 - case 20287: spellId = 25740; break; // Rank 2 - case 20288: spellId = 25739; break; // Rank 3 - case 20289: spellId = 25738; break; // Rank 4 - case 20290: spellId = 25737; break; // Rank 5 - case 20291: spellId = 25736; break; // Rank 6 - case 20292: spellId = 25735; break; // Rank 7 - case 20293: spellId = 25713; break; // Rank 8 - case 27155: spellId = 27156; break; // Rank 9 - default: - sLog.outError("Unit::HandleDummyAuraProc: non handled possibly SoR (Id = %u)", triggeredByAura->GetId()); - return false; - } - Item *item = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); - float speed = (item ? item->GetProto()->Delay : BASE_ATTACK_TIME)/1000.0f; - - float damageBasePoints; - if(item && item->GetProto()->InventoryType == INVTYPE_2HWEAPON) - // two hand weapon - damageBasePoints=1.20f*triggeredByAura->GetModifier()->m_amount * 1.2f * 1.03f * speed/100.0f + 1; - else - // one hand weapon/no weapon - damageBasePoints=0.85f*ceil(triggeredByAura->GetModifier()->m_amount * 1.2f * 1.03f * speed/100.0f) - 1; - - int32 damagePoint = int32(damageBasePoints + 0.03f * (GetWeaponDamageRange(BASE_ATTACK,MINDAMAGE)+GetWeaponDamageRange(BASE_ATTACK,MAXDAMAGE))/2.0f) + 1; - - // apply damage bonuses manually - if(damagePoint >= 0) - damagePoint = SpellDamageBonus(pVictim, dummySpell, damagePoint, SPELL_DIRECT_DAMAGE); - - CastCustomSpell(pVictim,spellId,&damagePoint,NULL,NULL,true,NULL, triggeredByAura); - return true; // no hidden cooldown + triggered_spell_id = 25742; + float ap = GetTotalAttackPowerValue(BASE_ATTACK); + int32 holy = SpellBaseDamageBonus(SPELL_SCHOOL_MASK_HOLY) + + SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_HOLY, pVictim); + basepoints0 = GetAttackTime(BASE_ATTACK) * int32(ap*0.022f + 0.044f * holy) / 1000; + break; } // Seal of Blood do damage trigger if(dummySpell->SpellFamilyFlags & 0x0000040000000000LL) @@ -5359,8 +5296,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu } break; } - // TODO: fix basepoint calculation (changed in 3.0.3) - // Seal of Vengeance + // Seal of Vengeance (damage calc on apply aura) case 31801: { if(effIndex != 0) // effect 1,2 used by seal unleashing code @@ -5496,14 +5432,19 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if( cooldown && ((Player*)this)->HasSpellCooldown(dummySpell->Id)) return false; + // Now amount of extra power stored in 1 effect of Enchant spell + // Get it by item enchant id uint32 spellId; switch (castItem->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT))) { - case 283: spellId = 33757; break; //1 Rank - case 284: spellId = 33756; break; //2 Rank - case 525: spellId = 33755; break; //3 Rank - case 1669:spellId = 33754; break; //4 Rank - case 2636:spellId = 33727; break; //5 Rank + case 283: spellId = 8232; break; // 1 Rank + case 284: spellId = 8235; break; // 2 Rank + case 525: spellId = 10486; break; // 3 Rank + case 1669:spellId = 16362; break; // 4 Rank + case 2636:spellId = 25505; break; // 5 Rank + case 3785:spellId = 58801; break; // 6 Rank + case 3786:spellId = 58803; break; // 7 Rank + case 3787:spellId = 58804; break; // 8 Rank default: { sLog.outError("Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)", @@ -5519,7 +5460,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; } - int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry,0,windfurySpellEntry->EffectBasePoints[0],pVictim); + int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, 1, windfurySpellEntry->EffectBasePoints[1], pVictim); // Off-Hand case if ( castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND ) @@ -5577,15 +5518,22 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu target = this; break; } + // Glyph of Healing Wave + case 55440: + { + // Not proc from self heals + if (this==pVictim) + return false; + basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + target = this; + triggered_spell_id = 55533; + break; + } } // Earth Shield if(dummySpell->SpellFamilyFlags & 0x0000040000000000LL) { - if(GetTypeId() != TYPEID_PLAYER) - return false; - - // heal basepoints0 = triggeredByAura->GetModifier()->m_amount; target = this; triggered_spell_id = 379; @@ -5656,17 +5604,6 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return true; } - // Glyph of Healing Wave - case 55440: - { - // Not proc from self heals - if (this==pVictim) - return false; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; - target = this; - triggered_spell_id = 55533; - break; - } break; } case SPELLFAMILY_DEATHKNIGHT: @@ -6071,8 +6008,8 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; // procspell is triggered spell but we need mana cost of original casted spell uint32 originalSpellId = procSpell->Id; - // Holy Shock - if(procSpell->SpellFamilyFlags & 0x00200000) + // Holy Shock heal + if(procSpell->SpellFamilyFlags & 0x0001000000000000LL) { switch(procSpell->Id) { @@ -6081,6 +6018,8 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB case 25903: originalSpellId = 20930; break; case 27175: originalSpellId = 27174; break; case 33074: originalSpellId = 33072; break; + case 48820: originalSpellId = 48824; break; + case 48821: originalSpellId = 48825; break; default: sLog.outError("Unit::HandleProcTriggerSpell: Spell %u not handled in HShock",procSpell->Id); return false; @@ -6093,7 +6032,8 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; } // percent stored in effect 1 (class scripts) base points - basepoints0 = originalSpell->manaCost*(auraSpellInfo->EffectBasePoints[1]+1)/100; + int32 cost = originalSpell->manaCost + originalSpell->ManaCostPercentage * GetCreateMana() / 100; + basepoints0 = cost*(auraSpellInfo->EffectBasePoints[1]+1)/100; trigger_spell_id = 20272; target = this; } @@ -6104,12 +6044,10 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; // stacking CastSpell(this, 37658, true, NULL, triggeredByAura); - // counting + Aura * dummy = GetDummyAura(37658); - if (!dummy) - return false; // release at 3 aura in stack (cont contain in basepoint of trigger aura) - if(dummy->GetStackAmount() < triggerAmount) + if(!dummy || dummy->GetStackAmount() < triggerAmount) return false; RemoveAurasDueToSpell(37658); @@ -6123,14 +6061,11 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; // stacking CastSpell(this, 54842, true, NULL, triggeredByAura); + // counting - uint32 count = 0; - AuraList const& dummyAura = GetAurasByType(SPELL_AURA_DUMMY); - for(AuraList::const_iterator itr = dummyAura.begin(); itr != dummyAura.end(); ++itr) - if((*itr)->GetId()==54842) - ++count; + Aura * dummy = GetDummyAura(54842); // release at 3 aura in stack (cont contain in basepoint of trigger aura) - if(count < triggerAmount) + if(!dummy || dummy->GetStackAmount() < triggerAmount) return false; RemoveAurasDueToSpell(54842); @@ -6359,6 +6294,40 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; break; } + // Brain Freeze + case 57761: + { + if(!procSpell) + return false; + // For trigger from Blizzard need exist Improved Blizzard + if (procSpell->SpellFamilyName==SPELLFAMILY_MAGE && procSpell->SpellFamilyFlags & 0x0000000000000080) + { + bool found = false; + AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) + { + int32 script = (*i)->GetModifier()->m_miscvalue; + if(script==836 || script==988 || script==989) + { + found=true; + break; + } + } + if(!found) + return false; + } + break; + } + // Burning Determination + case 54748: + { + if(!procSpell) + return false; + // Need Interrupt or Silenced mechanic + if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_INTERRUPT)|(1<<MECHANIC_SILENCE)))) + return false; + break; + } } if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id)) @@ -7247,7 +7216,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 ) // 0 == any inventory type (not wand then) { - DoneTotalMod *= ((*i)->GetModifierValue() +100.0f)/100.0f; + DoneTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f; } } @@ -7255,13 +7224,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - DoneTotalMod *= ((*i)->GetModifierValue() +100.0f)/100.0f; + DoneTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f; // ..taken AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) ) - TakenTotalMod *= ((*i)->GetModifierValue() +100.0f)/100.0f; + TakenTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f; // .. taken pct: scripted (increases damage of * against targets *) AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); @@ -7596,7 +7565,7 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) // -1 == any item class (not wand then) (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 ) // 0 == any inventory type (not wand then) - DoneAdvertisedBenefit += (*i)->GetModifierValue(); + DoneAdvertisedBenefit += (*i)->GetModifier()->m_amount; if (GetTypeId() == TYPEID_PLAYER) { @@ -7608,14 +7577,14 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask) { // stat used stored in miscValueB for this aura Stats usedStat = Stats((*i)->GetMiscBValue()); - DoneAdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifierValue() / 100.0f); + DoneAdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifier()->m_amount / 100.0f); } } // ... and attack power AuraList const& mDamageDonebyAP = GetAurasByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER); for(AuraList::const_iterator i =mDamageDonebyAP.begin();i != mDamageDonebyAP.end(); ++i) if ((*i)->GetModifier()->m_miscvalue & schoolMask) - DoneAdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifierValue() / 100.0f); + DoneAdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifier()->m_amount / 100.0f); } return DoneAdvertisedBenefit; @@ -7630,13 +7599,13 @@ int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVic AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - TakenAdvertisedBenefit += (*i)->GetModifierValue(); + TakenAdvertisedBenefit += (*i)->GetModifier()->m_amount; // ..taken AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN); for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i) if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0) - TakenAdvertisedBenefit += (*i)->GetModifierValue(); + TakenAdvertisedBenefit += (*i)->GetModifier()->m_amount; return TakenAdvertisedBenefit; } @@ -7923,7 +7892,7 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, // Healing done percent AuraList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); for(AuraList::const_iterator i = mHealingDonePct.begin();i != mHealingDonePct.end(); ++i) - heal *= (100.0f + (*i)->GetModifierValue()) / 100.0f; + heal *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; // apply spellmod to Done amount if(Player* modOwner = GetSpellModOwner()) @@ -7964,7 +7933,7 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) AuraList const& mHealingDone = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE); for(AuraList::const_iterator i = mHealingDone.begin();i != mHealingDone.end(); ++i) if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0) - AdvertisedBenefit += (*i)->GetModifierValue(); + AdvertisedBenefit += (*i)->GetModifier()->m_amount; // Healing bonus of spirit, intellect and strength if (GetTypeId() == TYPEID_PLAYER) @@ -7975,14 +7944,14 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) { // stat used dependent from misc value (stat index) Stats usedStat = Stats((*i)->GetSpellProto()->EffectMiscValue[(*i)->GetEffIndex()]); - AdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifierValue() / 100.0f); + AdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifier()->m_amount / 100.0f); } // ... and attack power AuraList const& mHealingDonebyAP = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER); for(AuraList::const_iterator i = mHealingDonebyAP.begin();i != mHealingDonebyAP.end(); ++i) if ((*i)->GetModifier()->m_miscvalue & schoolMask) - AdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifierValue() / 100.0f); + AdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifier()->m_amount / 100.0f); } return AdvertisedBenefit; } @@ -7993,7 +7962,7 @@ int32 Unit::SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVi AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING); for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i) if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0) - AdvertisedBenefit += (*i)->GetModifierValue(); + AdvertisedBenefit += (*i)->GetModifier()->m_amount; return AdvertisedBenefit; } @@ -8105,7 +8074,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - DoneFlatBenefit += (*i)->GetModifierValue(); + DoneFlatBenefit += (*i)->GetModifier()->m_amount; // ..done // SPELL_AURA_MOD_DAMAGE_DONE included in weapon damage @@ -8120,7 +8089,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mCreatureAttackPower = GetAurasByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS); for(AuraList::const_iterator i = mCreatureAttackPower.begin();i != mCreatureAttackPower.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - APbonus += (*i)->GetModifierValue(); + APbonus += (*i)->GetModifier()->m_amount; } else { @@ -8130,7 +8099,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mCreatureAttackPower = GetAurasByType(SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS); for(AuraList::const_iterator i = mCreatureAttackPower.begin();i != mCreatureAttackPower.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - APbonus += (*i)->GetModifierValue(); + APbonus += (*i)->GetModifier()->m_amount; } if (APbonus!=0) // Can be negative @@ -8155,7 +8124,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN); for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i) if((*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask()) - TakenFlatBenefit += (*i)->GetModifierValue(); + TakenFlatBenefit += (*i)->GetModifier()->m_amount; if(attType!=RANGED_ATTACK) TakenFlatBenefit += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN); @@ -8173,13 +8142,13 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) - DoneTotalMod *= ((*i)->GetModifierValue()+100.0f)/100.0f; + DoneTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f; // ..taken AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) if((*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask()) - TakenTotalMod *= ((*i)->GetModifierValue()+100.0f)/100.0f; + TakenTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f; // .. taken pct: dummy auras AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); @@ -8237,13 +8206,13 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT { AuraList const& mModMeleeDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT); for(AuraList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i) - TakenTotalMod *= ((*i)->GetModifierValue()+100.0f)/100.0f; + TakenTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f; } else { AuraList const& mModRangedDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT); for(AuraList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i) - TakenTotalMod *= ((*i)->GetModifierValue()+100.0f)/100.0f; + TakenTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f; } float tmpDamage = float(int32(*pdamage) + DoneFlatBenefit) * DoneTotalMod; @@ -10116,7 +10085,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag if (procExtra&(PROC_EX_NORMAL_HIT|PROC_EX_MISS|PROC_EX_RESIST)) { if (pTarget->GetTypeId() != TYPEID_PLAYER && pTarget->GetCreatureType() != CREATURE_TYPE_CRITTER) - ((Player*)this)->UpdateCombatSkills(pTarget, attType, MELEE_HIT_MISS, isVictim); + ((Player*)this)->UpdateCombatSkills(pTarget, attType, isVictim); } // Update defence if player is victim and parry/dodge/block if (isVictim && procExtra&(PROC_EX_DODGE|PROC_EX_PARRY|PROC_EX_BLOCK)) diff --git a/src/game/Unit.h b/src/game/Unit.h index b5fa89e04b8..10efed0570c 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1147,8 +1147,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAura(uint32 spellId, uint32 effindex, Aura* except = NULL); - void RemoveSingleAuraFromStackByDispel(uint32 spellId); - void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex); + void RemoveSingleSpellAurasFromStack(uint32 spellId); + void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex); void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL); void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId); void RemoveAurasDueToCasterSpell(uint32 spellId, uint64 guid); diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 0c845141ccb..ed6f63946a9 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -362,9 +362,9 @@ LogColors = "" # # Expansion # Allow server use content from expansion -# 2 - check expansion 2 maps existence, and if client support expansion 2 and account have +# Default: 2 - check expansion 2 maps existence, and if client support expansion 2 and account have # expansion 2 setting then allow visit expansion 2 maps, allow create new class character) -# Default: 1 - check expansion 1 maps existence, and if client support expansion 1 and account have +# 1 - check expansion 1 maps existence, and if client support expansion 1 and account have # expansion 1 setting then allow visit expansion 1 maps, allow create new races character) # 0 - not check expansion maps existence, not allow wisit its, not allow create new race or new class # characters, ignore account expansion setting) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index eb0a9466642..038ed3ff5c9 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7047" + #define REVISION_NR "7059" #endif // __REVISION_NR_H__ |