mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[8734] Re-implement talent 31789
* Allow apply to enemies of attacked party member * Correctly apply effect to 3 attackers
This commit is contained in:
parent
9746a97174
commit
9e4b833054
2 changed files with 23 additions and 13 deletions
|
|
@ -1760,13 +1760,25 @@ void Spell::EffectDummy(uint32 i)
|
||||||
}
|
}
|
||||||
case 31789: // Righteous Defense (step 1)
|
case 31789: // Righteous Defense (step 1)
|
||||||
{
|
{
|
||||||
|
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
|
SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 31989 -> dummy effect (step 1) + dummy effect (step 2) -> 31709 (taunt like spell for each target)
|
// 31989 -> dummy effect (step 1) + dummy effect (step 2) -> 31709 (taunt like spell for each target)
|
||||||
|
Unit* friendTarget = !unitTarget || unitTarget->IsFriendlyTo(m_caster) ? unitTarget : unitTarget->getVictim();
|
||||||
|
if (friendTarget)
|
||||||
|
{
|
||||||
|
Player* player = friendTarget->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||||
|
if (!player || !player->IsInSameRaidWith((Player*)m_caster))
|
||||||
|
friendTarget = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// non-standard cast requirement check
|
// non-standard cast requirement check
|
||||||
if (!unitTarget || unitTarget->getAttackers().empty())
|
if (!friendTarget || friendTarget->getAttackers().empty())
|
||||||
{
|
{
|
||||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||||
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
|
|
||||||
SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT);
|
SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1776,18 +1788,16 @@ void Spell::EffectDummy(uint32 i)
|
||||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||||
ihit->effectMask &= ~(1<<1);
|
ihit->effectMask &= ~(1<<1);
|
||||||
|
|
||||||
// not empty (checked)
|
// not empty (checked), copy
|
||||||
Unit::AttackerSet const& attackers = unitTarget->getAttackers();
|
Unit::AttackerSet attackers = friendTarget->getAttackers();
|
||||||
|
|
||||||
// chance to be selected from list
|
// selected from list 3
|
||||||
float chance = 100.0f/attackers.size();
|
for(int i = 0; i < std::min(size_t(3),attackers.size()); ++i)
|
||||||
uint32 count=0;
|
|
||||||
for(Unit::AttackerSet::const_iterator aItr = attackers.begin(); aItr != attackers.end() && count < 3; ++aItr)
|
|
||||||
{
|
{
|
||||||
if (!roll_chance_f(chance))
|
Unit::AttackerSet::iterator aItr = attackers.begin();
|
||||||
continue;
|
std::advance(aItr, rand() % attackers.size());
|
||||||
++count;
|
|
||||||
AddUnitTarget((*aItr), 1);
|
AddUnitTarget((*aItr), 1);
|
||||||
|
attackers.erase(aItr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now let next effect cast spell at each target.
|
// now let next effect cast spell at each target.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8733"
|
#define REVISION_NR "8734"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue