diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Creature.cpp | 6 | ||||
-rw-r--r-- | src/game/NullCreatureAI.cpp | 5 | ||||
-rw-r--r-- | src/game/NullCreatureAI.h | 1 | ||||
-rw-r--r-- | src/game/Player.cpp | 45 | ||||
-rw-r--r-- | src/game/Player.h | 1 | ||||
-rw-r--r-- | src/game/Spell.cpp | 2 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 46 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 8 | ||||
-rw-r--r-- | src/game/Unit.cpp | 47 |
9 files changed, 115 insertions, 46 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index d31e6dec1a1..c075a33e92f 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -290,6 +290,9 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) if(!m_respawnradius && m_defaultMovementType==RANDOM_MOTION_TYPE) m_defaultMovementType = IDLE_MOTION_TYPE; + for(int i=0; i < CREATURE_MAX_SPELLS; ++i) + m_spells[i] = GetCreatureInfo()->spells[i]; + return true; } @@ -345,9 +348,6 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) SetPvP(true); } - for(int i=0; i < CREATURE_MAX_SPELLS; ++i) - m_spells[i] = GetCreatureInfo()->spells[i]; - // HACK: trigger creature is always not selectable if(isTrigger()) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); diff --git a/src/game/NullCreatureAI.cpp b/src/game/NullCreatureAI.cpp index 2745dd3ea8d..be59ed6e40d 100644 --- a/src/game/NullCreatureAI.cpp +++ b/src/game/NullCreatureAI.cpp @@ -27,6 +27,11 @@ void PassiveAI::UpdateAI(const uint32) EnterEvadeMode(); } +void PossessedAI::AttackStart(Unit *target) +{ + me->Attack(target, true); +} + void PossessedAI::UpdateAI(const uint32 diff) { if(me->getVictim()) diff --git a/src/game/NullCreatureAI.h b/src/game/NullCreatureAI.h index f628a7e8ac9..626dd307ef3 100644 --- a/src/game/NullCreatureAI.h +++ b/src/game/NullCreatureAI.h @@ -41,6 +41,7 @@ class TRINITY_DLL_DECL PossessedAI : public PassiveAI public: PossessedAI(Creature *c) : PassiveAI(c) {} + void AttackStart(Unit *target); void UpdateAI(const uint32); void EnterEvadeMode() {} diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 68bb5628887..d3af537026f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17367,6 +17367,38 @@ void Player::PossessSpellInitialize() GetSession()->SendPacket(&data); } +void Player::VehicleSpellInitialize() +{ + Unit* charm = GetCharm(); + if(!charm || charm->GetTypeId() != TYPEID_UNIT) + return; + + WorldPacket data(SMSG_PET_SPELLS, 8+4+4+4+4*10+1+1); + data << uint64(charm->GetGUID()); + data << uint32(0x00000000); + data << uint32(0x00000000); + data << uint32(0x00000101); + + for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) + { + uint32 spellId = ((Creature*)charm)->m_spells[i]; + if(IsPassiveSpell(spellId)) + { + charm->CastSpell(charm, spellId, true); + data << uint16(0) << uint8(0) << uint8(i+8); + } + else + data << uint16(spellId) << uint8(0) << uint8(i+8); + } + + for(uint32 i = CREATURE_MAX_SPELLS; i < 10; ++i) + data << uint16(0) << uint8(0) << uint8(i+8); + + data << uint8(0); + data << uint8(0); + GetSession()->SendPacket(&data); +} + void Player::CharmSpellInitialize() { Unit* charm = GetCharm(); @@ -20302,18 +20334,7 @@ void Player::EnterVehicle(Vehicle *vehicle) data << uint32(0); // fall time GetSession()->SendPacket(&data); - data.Initialize(SMSG_PET_SPELLS, 8+4+4+4+4*10+1+1); - data << uint64(vehicle->GetGUID()); - data << uint32(0x00000000); - data << uint32(0x00000000); - data << uint32(0x00000101); - - for(uint32 i = 0; i < 10; ++i) - data << uint16(0) << uint8(0) << uint8(i+8); - - data << uint8(0); - data << uint8(0); - GetSession()->SendPacket(&data); + VehicleSpellInitialize(); } void Player::ExitVehicle(Vehicle *vehicle) diff --git a/src/game/Player.h b/src/game/Player.h index fcf3b0b005e..c0d2483e1ef 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1454,6 +1454,7 @@ class TRINITY_DLL_SPEC Player : public Unit void PetSpellInitialize(); void CharmSpellInitialize(); void PossessSpellInitialize(); + void VehicleSpellInitialize(); bool HasSpell(uint32 spell) const; bool HasActiveSpell(uint32 spell) const; // show in spellbook TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 34f52daa974..294d016e33d 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3381,7 +3381,7 @@ void Spell::TakeRunePower() } // you can gain some runic power when use runes - float rp = src->runePowerGain;; + float rp = src->runePowerGain; rp *= sWorld.getRate(RATE_POWER_RUNICPOWER_INCOME); plr->ModifyPower(POWER_RUNIC_POWER, (int32)rp); } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index efca1bdc600..20878e0679a 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -433,7 +433,12 @@ m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false) sLog.outDebug("Aura: construct Spellid : %u, Aura : %u Duration : %d Target : %d Damage : %d", m_spellProto->Id, m_spellProto->EffectApplyAuraName[eff], m_maxduration, m_spellProto->EffectImplicitTargetA[eff],damage); m_effIndex = eff; - SetModifier(AuraType(m_spellProto->EffectApplyAuraName[eff]), damage, m_spellProto->EffectAmplitude[eff], m_spellProto->EffectMiscValue[eff]); + int32 periodicTime = m_spellProto->EffectAmplitude[eff]; + //apply casting time mods for channeled spells + if (caster && IsChanneledSpell(m_spellProto)) + caster->ModSpellCastTime(m_spellProto, periodicTime); + + SetModifier(AuraType(m_spellProto->EffectApplyAuraName[eff]), damage,periodicTime , m_spellProto->EffectMiscValue[eff]); // Apply periodic time mod if(modOwner && m_modifier.periodictime) @@ -2234,6 +2239,25 @@ void Aura::HandleAuraDummy(bool apply, bool Real) ((Player*)m_target)->AddSpellMod(m_spellmod, apply); return; } + // Glyph of Aspect of the Monkey + if(m_spellProto->Id==56833) + { + if(apply) + { + // Reduce backfire damage (dot damage) from Shadow Word: Death + SpellModifier *mod = new SpellModifier; + mod->op = SPELLMOD_CHANCE_OF_SUCCESS; + mod->value = 100; + mod->type = SPELLMOD_FLAT; + mod->spellId = GetId(); + mod->mask[2] = 8192; + mod->mask[1] = 0x00000000; + mod->mask[0] = 524288; + m_spellmod = mod; + } + ((Player*)m_target)->AddSpellMod(m_spellmod, apply); + return; + } break; } case SPELLFAMILY_SHAMAN: @@ -5663,6 +5687,9 @@ void Aura::PeriodicTick() if(m_target != pCaster && GetSpellProto()->SpellVisual[0]==163 && !pCaster->isAlive()) return; + if(m_duration ==-1 && m_target->GetHealth()==m_target->GetMaxHealth()) + return; + // ignore non positive values (can be result apply spellmods to aura damage //uint32 amount = GetModifierValuePerStack() > 0 ? GetModifierValuePerStack() : 0; uint32 pdamage = GetModifier()->m_amount > 0 ? GetModifier()->m_amount : 0; @@ -5853,7 +5880,7 @@ void Aura::PeriodicTick() case SPELL_AURA_OBS_MOD_ENERGY: { if(m_modifier.m_miscvalue < 0) - break; + return; Powers power; if (m_modifier.m_miscvalue == POWER_ALL) @@ -5862,7 +5889,10 @@ void Aura::PeriodicTick() power = Powers(m_modifier.m_miscvalue); if(m_target->GetMaxPower(power) == 0) - break; + return; + + if(m_duration ==-1 && m_target->GetPower(power)==m_target->GetMaxPower(power)) + return; uint32 amount = m_modifier.m_amount * m_target->GetMaxPower(power) /100; sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", @@ -5888,12 +5918,15 @@ void Aura::PeriodicTick() { // ignore non positive values (can be result apply spellmods to aura damage if(m_modifier.m_amount < 0 || m_modifier.m_miscvalue >= MAX_POWERS) - break; + return; Powers power = Powers(m_modifier.m_miscvalue); if(m_target->GetMaxPower(power) == 0) - break; + return; + + if(m_duration ==-1 && m_target->GetPower(power)==m_target->GetMaxPower(power)) + return; uint32 amount = m_modifier.m_amount; @@ -5933,6 +5966,9 @@ void Aura::PeriodicTick() if(!m_target->isAlive() || m_target->getPowerType() != powerType) return; + if(m_duration ==-1 && m_target->GetPower(powerType)==m_target->GetMaxPower(powerType)) + return; + // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) if (powerType == POWER_MANA && m_target->GetTypeId() == TYPEID_PLAYER) pdamage -= ((Player*)m_target)->GetSpellCritDamageReduction(pdamage); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 4a7ab708c3d..a976ca04a68 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -378,7 +378,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId) return SPELL_STING; // only hunter aspects have this - if( spellInfo->SpellFamilyFlags[1] & 0x00440000 || spellInfo->SpellFamilyFlags[0] & 0x00380000 || spellInfo->SpellFamilyFlags[2] & 0x00003010) + if( spellInfo->SpellFamilyFlags[1] & 0x00440000 || spellInfo->SpellFamilyFlags[0] & 0x00380000 || spellInfo->SpellFamilyFlags[2] & 0x00001010) return SPELL_ASPECT; if( spellInfo->SpellFamilyFlags[2] & 0x00000002 ) @@ -521,7 +521,6 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) switch(spellId) { case 23333: case 23335: case 34976: // BG spell - case 30482: case 43045: case 43046: // Molten armor expection need find the real bug return true; case 28441: // not positive dummy spell case 37675: // Chaos Blast @@ -702,7 +701,10 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) if(spellproto->AttributesEx & SPELL_ATTR_EX_NEGATIVE) return false; - if (!deep && spellproto->EffectTriggerSpell[effIndex] && !IsPositiveSpell(spellproto->EffectTriggerSpell[effIndex], true)) + if (!deep && spellproto->EffectTriggerSpell[effIndex] + && !spellproto->procFlags + && IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex],spellproto->EffectImplicitTargetB[effIndex]) + && !IsPositiveSpell(spellproto->EffectTriggerSpell[effIndex], true)) return false; // ok, positive diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d91a6bf83e6..eb20ee91845 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -483,7 +483,7 @@ void Unit::RemoveAuraTypeByCaster(AuraType auraType, uint64 casterGUID) { if (auraType >= TOTAL_AURAS) return; AuraList::iterator iter, next; - for(iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); ++iter) + for(iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); iter = next) { next = iter; ++next; @@ -3981,6 +3981,8 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) SpellSpecific spellId_spec = GetSpellSpecific(spellId); + //bool linked = spellmgr.GetSpellCustomAttr(spellId) & SPELL_ATTR_CU_LINK_AURA? true : false; + AuraMap::iterator i,next; for (i = m_Auras.begin(); i != m_Auras.end(); i = next) { @@ -4017,11 +4019,29 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id) is_triggered_by_spell = true; - if (is_triggered_by_spell) - continue; + for(int j = 0; j < 3; ++j) + if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id) + is_triggered_by_spell = true; // check if they can stack bool sameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID(); + + /*// Dont remove by stack with linked auras + // Not needed for now + if(sameCaster && linked) + { + if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(spellId + SPELL_LINK_AURA)) + for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) + if(*itr>0 && *itr==i_spellId) + { + is_triggered_by_spell=true; + break; + } + }*/ + + if (is_triggered_by_spell) + continue; + if(!spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId, sameCaster)) continue; @@ -8715,16 +8735,11 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 { // Damage Done from spell damage bonus int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - if (IsChanneledSpell(spellProto)) - ModSpellCastTime(spellProto, CastingTime); // Damage over Time spells bonus calculation float DotFactor = 1.0f; if(damagetype == DOT) { int32 DotDuration = GetSpellDuration(spellProto); - //apply casting time mods for channeled spells - if (IsChanneledSpell(spellProto)) - ModSpellCastTime(spellProto, DotDuration); // 200% limit if(DotDuration > 0) { @@ -9211,16 +9226,11 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint { // Damage Done from spell damage bonus int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - if (IsChanneledSpell(spellProto)) - ModSpellCastTime(spellProto, CastingTime); // Damage over Time spells bonus calculation float DotFactor = 1.0f; if(damagetype == DOT) { int32 DotDuration = GetSpellDuration(spellProto); - //apply casting time mods for channeled spells - if (IsChanneledSpell(spellProto)) - ModSpellCastTime(spellProto, DotDuration); // 200% limit if(DotDuration > 0) { @@ -11425,20 +11435,13 @@ void CharmInfo::InitPossessCreateSpells() InitEmptyActionBar(); if(m_unit->GetTypeId() == TYPEID_UNIT) { - /*for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) + for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { uint32 spellid = ((Creature*)m_unit)->m_spells[i]; if(IsPassiveSpell(spellid)) m_unit->CastSpell(m_unit, spellid, true); else - AddSpellToAB(0, spellid, ACT_CAST); - }*/ - for(uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x) - { - if (IsPassiveSpell(((Creature*)m_unit)->m_spells[x])) - m_unit->CastSpell(m_unit, ((Creature*)m_unit)->m_spells[x], true); - else - AddSpellToAB(0, ((Creature*)m_unit)->m_spells[x], ACT_PASSIVE); + AddSpellToAB(0, spellid, ACT_DISABLED); } } } |