[8232] Implement talent 48438 and ranks in target seelction and per-tick heal amount.

Original patch has been suggested by Beaste.
This commit is contained in:
VladimirMangos 2009-07-23 00:13:23 +04:00
parent 0cf083eb55
commit 6c395cf79c
4 changed files with 48 additions and 27 deletions

View file

@ -1690,16 +1690,16 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
case TARGET_ALL_PARTY_AROUND_CASTER: case TARGET_ALL_PARTY_AROUND_CASTER:
case TARGET_ALL_PARTY_AROUND_CASTER_2: case TARGET_ALL_PARTY_AROUND_CASTER_2:
case TARGET_ALL_PARTY: case TARGET_ALL_PARTY:
FillRaidOrPartyTargets(TagUnitMap,m_caster,radius,false,true,true); FillRaidOrPartyTargets(TagUnitMap, m_caster, m_caster, radius, false, true, true);
break; break;
case TARGET_ALL_RAID_AROUND_CASTER: case TARGET_ALL_RAID_AROUND_CASTER:
{ {
if(m_spellInfo->Id == 57669) // Replenishment (special target selection) if(m_spellInfo->Id == 57669) // Replenishment (special target selection)
FillRaidOrPartyManaPriorityTargets(TagUnitMap, m_caster, radius, 10, true, false, false); FillRaidOrPartyManaPriorityTargets(TagUnitMap, m_caster, m_caster, radius, 10, true, false, false);
else if (m_spellInfo->Id==52759) //Ancestral Awakening (special target selection) else if (m_spellInfo->Id==52759) //Ancestral Awakening (special target selection)
FillRaidOrPartyHealthPriorityTargets(TagUnitMap, m_caster, radius, 1, true, false, false); FillRaidOrPartyHealthPriorityTargets(TagUnitMap, m_caster, m_caster, radius, 1, true, false, false);
else else
FillRaidOrPartyTargets(TagUnitMap, m_caster, radius, true, true, true); FillRaidOrPartyTargets(TagUnitMap, m_caster, m_caster, radius, true, true, true);
break; break;
} }
case TARGET_SINGLE_FRIEND: case TARGET_SINGLE_FRIEND:
@ -1728,12 +1728,23 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
// special target order // special target order
if (m_spellInfo->Id==64904) // Hymn of Hope if (m_spellInfo->Id==64904) // Hymn of Hope
// target amount stored in parent spell dummy effect but hard for access // target amount stored in parent spell dummy effect but hard for access
FillRaidOrPartyManaPriorityTargets(TagUnitMap, m_caster, radius, 3, true, false, false); FillRaidOrPartyManaPriorityTargets(TagUnitMap, m_caster, m_caster, radius, 3, true, false, false);
else else
FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY); FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY);
break; break;
case TARGET_ALL_FRIENDLY_UNITS_IN_AREA: case TARGET_ALL_FRIENDLY_UNITS_IN_AREA:
FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_FRIENDLY); // Wild Growth
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellIconID == 2864)
{
Unit* target = m_targets.getUnitTarget();
if(!target)
target = m_caster;
uint32 count = CalculateDamage(2,m_caster); // stored in dummy effect, affected by mods
FillRaidOrPartyHealthPriorityTargets(TagUnitMap, m_caster, target, radius, count, true, false, true);
}
else
FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_FRIENDLY);
break; break;
// TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some seals, fire shield from imp, etc..) // TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some seals, fire shield from imp, etc..)
case TARGET_SINGLE_PARTY: case TARGET_SINGLE_PARTY:
@ -5751,14 +5762,14 @@ void Spell::FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radiu
cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap()); cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap());
} }
void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster ) void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster )
{ {
Player *pTarget = target->GetCharmerOrOwnerPlayerOrPlayerItself(); Player *pMember = member->GetCharmerOrOwnerPlayerOrPlayerItself();
Group *pGroup = pTarget ? pTarget->GetGroup() : NULL; Group *pGroup = pMember ? pMember->GetGroup() : NULL;
if (pGroup) if (pGroup)
{ {
uint8 subgroup = pTarget->GetSubGroup(); uint8 subgroup = pMember->GetSubGroup();
for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{ {
@ -5768,36 +5779,36 @@ void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float ra
if (Target && (raid || subgroup==Target->GetSubGroup()) if (Target && (raid || subgroup==Target->GetSubGroup())
&& !m_caster->IsHostileTo(Target)) && !m_caster->IsHostileTo(Target))
{ {
if (Target==m_caster && withcaster || if ((Target==center || center->IsWithinDistInMap(Target, radius)) &&
Target!=m_caster && m_caster->IsWithinDistInMap(Target, radius)) (withcaster || Target != m_caster))
TagUnitMap.push_back(Target); TagUnitMap.push_back(Target);
if (withPets) if (withPets)
if (Pet* pet = Target->GetPet()) if (Pet* pet = Target->GetPet())
if (pet==m_caster && withcaster || if ((pet==center || center->IsWithinDistInMap(pet, radius)) &&
pet!=m_caster && m_caster->IsWithinDistInMap(pet, radius)) (withcaster || pet != m_caster))
TagUnitMap.push_back(pet); TagUnitMap.push_back(pet);
} }
} }
} }
else else
{ {
Unit* ownerOrSelf = pTarget ? pTarget : target->GetCharmerOrOwnerOrSelf(); Unit* ownerOrSelf = pMember ? pMember : member->GetCharmerOrOwnerOrSelf();
if (ownerOrSelf==m_caster && withcaster || if ((ownerOrSelf==center || center->IsWithinDistInMap(ownerOrSelf, radius)) &&
ownerOrSelf!=m_caster && m_caster->IsWithinDistInMap(ownerOrSelf, radius)) (withcaster || ownerOrSelf != m_caster))
TagUnitMap.push_back(ownerOrSelf); TagUnitMap.push_back(ownerOrSelf);
if (withPets) if (withPets)
if (Pet* pet = ownerOrSelf->GetPet()) if (Pet* pet = ownerOrSelf->GetPet())
if (pet==m_caster && withcaster || if ((pet==center || center->IsWithinDistInMap(pet, radius)) &&
pet!=m_caster && m_caster->IsWithinDistInMap(pet, radius)) (withcaster || pet != m_caster))
TagUnitMap.push_back(pet); TagUnitMap.push_back(pet);
} }
} }
void Spell::FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster ) void Spell::FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster )
{ {
FillRaidOrPartyTargets(TagUnitMap,target,radius,raid,withPets,withCaster); FillRaidOrPartyTargets(TagUnitMap, member, center, radius, raid, withPets, withCaster);
PrioritizeManaUnitQueue manaUsers; PrioritizeManaUnitQueue manaUsers;
for(UnitList::const_iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end() && manaUsers.size() < count; ++itr) for(UnitList::const_iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end() && manaUsers.size() < count; ++itr)
@ -5812,9 +5823,9 @@ void Spell::FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* targ
} }
} }
void Spell::FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster ) void Spell::FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster )
{ {
FillRaidOrPartyTargets(TagUnitMap,target,radius,raid,withPets,withCaster); FillRaidOrPartyTargets(TagUnitMap, member, center, radius, raid, withPets, withCaster);
PrioritizeHealthUnitQueue healthQueue; PrioritizeHealthUnitQueue healthQueue;
for(UnitList::const_iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end() && healthQueue.size() < count; ++itr) for(UnitList::const_iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end() && healthQueue.size() < count; ++itr)

View file

@ -369,9 +369,9 @@ class Spell
void SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap); void SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap);
void FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets ); void FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets );
void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster ); void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster );
void FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withcaster ); void FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster );
void FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withcaster ); void FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster );
template<typename T> WorldObject* FindCorpseUsing(); template<typename T> WorldObject* FindCorpseUsing();

View file

@ -6067,8 +6067,18 @@ void Aura::PeriodicTick()
if(m_modifier.m_auraname==SPELL_AURA_OBS_MOD_HEALTH) if(m_modifier.m_auraname==SPELL_AURA_OBS_MOD_HEALTH)
pdamage = uint32(m_target->GetMaxHealth() * amount / 100); pdamage = uint32(m_target->GetMaxHealth() * amount / 100);
else else
{
pdamage = amount; pdamage = amount;
// Wild Growth (1/7 - 6 + 2*ramainTicks) %
if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellIconID == 2864)
{
int32 ticks = m_maxduration/m_modifier.periodictime;
int32 remainingTicks = int32(float(m_duration) / m_modifier.periodictime + 0.5);
pdamage = int32(pdamage) + int32(amount)*ticks*(-6+2*remainingTicks)/100;
}
}
pdamage = pCaster->SpellHealingBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount()); pdamage = pCaster->SpellHealingBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount());
// This method can modify pdamage // This method can modify pdamage

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8231" #define REVISION_NR "8232"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__