Implemented Glyph of Drain Soul. Partly based on thenecromancer's code.

--HG--
branch : trunk
This commit is contained in:
Xanadu
2010-03-21 16:03:38 +01:00
parent 36b2b5a1bc
commit 91260d8409
2 changed files with 42 additions and 21 deletions
+39 -12
View File
@@ -1257,10 +1257,19 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
// 5..8 ticks have normal tick damage // 5..8 ticks have normal tick damage
} }
// There is a Chance to make a Soul Shard when Drain soul does damage // There is a Chance to make a Soul Shard when Drain soul does damage
if (GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000)) if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000))
{ {
if(caster && roll_chance_i(20)) if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
caster->CastSpell(caster, 24827, true, 0, this); {
if (roll_chance_i(20))
{
caster->CastSpell(caster, 64018, true, 0, this);
// Glyph of Drain Soul - chance to create an additional Soul Shard
if (AuraEffect *aur = caster->GetAuraEffect(58070, 0))
if (roll_chance_i(aur->GetMiscValue()))
caster->CastSpell(caster, 58068, true, 0, aur);
}
}
} }
} }
else else
@@ -5971,8 +5980,6 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mo
if(!(mode & AURA_EFFECT_HANDLE_REAL)) if(!(mode & AURA_EFFECT_HANDLE_REAL))
return; return;
Unit * target = aurApp->GetTarget();
if(!(apply)) if(!(apply))
{ {
Unit * caster = GetCaster(); Unit * caster = GetCaster();
@@ -5980,6 +5987,9 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mo
if(!caster || caster->GetTypeId() != TYPEID_PLAYER) if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
return; return;
Player *plCaster = caster->ToPlayer();
Unit *target = aurApp->GetTarget();
if(target->getDeathState() != JUST_DIED) if(target->getDeathState() != JUST_DIED)
return; return;
@@ -5990,28 +6000,45 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mo
if(GetSpellProto()->EffectItemType[m_effIndex] == 0) if(GetSpellProto()->EffectItemType[m_effIndex] == 0)
return; return;
// Soul Shard
if (GetSpellProto()->EffectItemType[m_effIndex] == 6265)
{
// Soul Shard only from units that grant XP or honor // Soul Shard only from units that grant XP or honor
if( GetSpellProto()->EffectItemType[m_effIndex] == 6265 && if (!plCaster->isHonorOrXPTarget(target) ||
(!caster->ToPlayer()->isHonorOrXPTarget(target) || (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(caster->ToPlayer())) )
return; return;
// If this is Drain Soul, check for Glyph of Drain Soul
if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000))
{
// Glyph of Drain Soul - chance to create an additional Soul Shard
if (AuraEffect *aur = caster->GetAuraEffect(58070, 0))
if (roll_chance_i(aur->GetMiscValue()))
caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
}
}
//Adding items //Adding items
uint32 noSpaceForCount = 0; uint32 noSpaceForCount = 0;
uint32 count = m_amount; uint32 count = m_amount;
ItemPosCountVec dest; ItemPosCountVec dest;
uint8 msg = caster->ToPlayer()->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, GetSpellProto()->EffectItemType[m_effIndex], count, &noSpaceForCount); uint8 msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellProto()->EffectItemType[m_effIndex], count, &noSpaceForCount);
if( msg != EQUIP_ERR_OK ) if( msg != EQUIP_ERR_OK )
{ {
count-=noSpaceForCount; count-=noSpaceForCount;
caster->ToPlayer()->SendEquipError( msg, NULL, NULL ); plCaster->SendEquipError(msg, NULL, NULL);
if (count==0) if (count==0)
return; return;
} }
Item* newitem = caster->ToPlayer()->StoreNewItem(dest, GetSpellProto()->EffectItemType[m_effIndex], true); Item* newitem = plCaster->StoreNewItem(dest, GetSpellProto()->EffectItemType[m_effIndex], true);
caster->ToPlayer()->SendNewItem(newitem, count, true, false); if (!newitem)
{
plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
return;
}
plCaster->SendNewItem(newitem, count, true, true);
} }
} }
-6
View File
@@ -5687,12 +5687,6 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
return true; return true;
} }
// Glyph of Drain Soul
case 58070:
{
triggered_spell_id = 58068;
break;
}
// Glyph of Icy Veins // Glyph of Icy Veins
case 56374: case 56374:
{ {