diff options
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1041d69318c..5a60510e23f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -670,10 +670,8 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop) if(player && player!=pVictim) { - if(player->RewardPlayerAndGroupAtKill(pVictim)) - player->ProcDamageAndSpell(pVictim, PROC_FLAG_KILL_AND_GET_XP, PROC_FLAG_KILLED, PROC_EX_NONE, 0); - else - player->ProcDamageAndSpell(pVictim, PROC_FLAG_NONE, PROC_FLAG_KILLED,PROC_EX_NONE, 0); + player->RewardPlayerAndGroupAtKill(pVictim); + player->ProcDamageAndSpell(pVictim, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_EX_NONE, 0); } DEBUG_LOG("DealDamageAttackStop"); @@ -2178,7 +2176,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack } } - if(GetTypeId()!=TYPEID_PLAYER && !(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) && !((Creature*)this)->isPet() && !SpellCasted /*Only autoattack can be crushing blow*/ ) + if ((GetTypeId()!=TYPEID_PLAYER && !(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) && !((Creature*)this)->isPet()) && + !SpellCasted /*Only autoattack can be crashing blow*/ ) { // mobs can score crushing blows if they're 3 or more levels above victim // or when their weapon skill is 15 or more above victim's defense skill @@ -9014,8 +9013,11 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde int32 randomPoints = int32(spellProto->EffectDieSides[effect_index] + level * randomPointsPerLevel); float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index]; - // prevent random generator from getting confused by spells casted with Unit::CastCustomSpell - int32 randvalue = spellProto->EffectBaseDice[effect_index] >= randomPoints ? spellProto->EffectBaseDice[effect_index]:irand(spellProto->EffectBaseDice[effect_index], randomPoints); + // range can have possitive and negative values, so order its for irand + int32 randvalue = int32(spellProto->EffectBaseDice[effect_index]) >= randomPoints + ? irand(randomPoints, int32(spellProto->EffectBaseDice[effect_index])) + : irand(int32(spellProto->EffectBaseDice[effect_index]), randomPoints); + int32 value = basePoints + randvalue; //random damage if(comboDamage != 0 && unitPlayer /*&& target && (target->GetGUID() == unitPlayer->GetComboTarget())*/) @@ -9862,6 +9864,7 @@ bool InitTriggerAuraData() isTriggerAura[i]=false; isNonTriggerAura[i] = false; } + isTriggerAura[SPELL_AURA_PERIODIC_DAMAGE] = true; isTriggerAura[SPELL_AURA_DUMMY] = true; isTriggerAura[SPELL_AURA_MOD_CONFUSE] = true; isTriggerAura[SPELL_AURA_MOD_THREAT] = true; @@ -9935,18 +9938,8 @@ uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missC return procEx; } -static int deep = 0; void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage ) { - deep ++; - if (deep > 5) - { - sLog.outError("Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor"); - if (procSpell) - sLog.outError(" Spell %u", procSpell->Id); - deep--; - return; - } // For melee/ranged based attack need update skills and set some Aura states if (procFlag & MELEE_BASED_TRIGGER_MASK) { @@ -10030,7 +10023,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag for(AuraMap::const_iterator itr = GetAuras().begin(); itr!= GetAuras().end(); ++itr) { SpellProcEventEntry const* spellProcEvent = NULL; - if(!IsTriggeredAtSpellProcEvent(itr->second, procSpell, procFlag, procExtra, attType, isVictim, (damage > 0), spellProcEvent)) + if(!IsTriggeredAtSpellProcEvent(pTarget, itr->second, procSpell, procFlag, procExtra, attType, isVictim, (damage > 0), spellProcEvent)) continue; procTriggered.push_back( ProcTriggeredData(spellProcEvent, itr->second) ); @@ -10208,7 +10201,6 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();i++) RemoveAurasDueToSpell(*i); } - deep--; } SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const @@ -10823,7 +10815,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) return pet; } -bool Unit::IsTriggeredAtSpellProcEvent(Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent ) +bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent ) { SpellEntry const* spellProto = aura->GetSpellProto (); @@ -10853,7 +10845,17 @@ bool Unit::IsTriggeredAtSpellProcEvent(Aura* aura, SpellEntry const* procSpell, if(!SpellMgr::IsSpellProcEventCanTriggeredBy(spellProcEvent, EventProcFlag, procSpell, procFlag, procExtra, active)) return false; - // Aura added by spell can`t trogger from self (prevent drop cahres/do triggers) + // In most cases req get honor or XP from kill + if (EventProcFlag & PROC_FLAG_KILL && GetTypeId() == TYPEID_PLAYER) + { + bool allow = ((Player*)this)->isHonorOrXPTarget(pVictim); + // Shadow Word: Death - can trigger from every kill + if (aura->GetId() == 32409) + allow = true; + if (!allow) + return false; + } + // Aura added by spell can`t trogger from self (prevent drop charges/do triggers) // But except periodic triggers (can triggered from self) if(procSpell && procSpell->Id == spellProto->Id && !(spellProto->procFlags&PROC_FLAG_ON_TAKE_PERIODIC)) return false; |