mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-16 13:09:50 -04:00
*Fix Death Pact and Corpse Explosion - original patch by Astellar, thanks for help in conversion for Azrael.
--HG-- branch : trunk
This commit is contained in:
@@ -1423,7 +1423,7 @@ struct SpellEntry
|
||||
uint32 SchoolMask; // 228 m_schoolMask
|
||||
uint32 runeCostID; // 229 m_runeCostID
|
||||
//uint32 spellMissileID; // 230 m_spellMissileID not used
|
||||
//uint32 PowerDisplayId; // 231 PowerDisplay.dbc, new in 3.1
|
||||
//uint32 PowerDisplayId; // 231 PowerDisplay.dbc, new in 3.1
|
||||
|
||||
// helpers
|
||||
int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(EffectBaseDice[eff]); }
|
||||
|
||||
@@ -2195,6 +2195,44 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Corpse Explosion
|
||||
case 53717:
|
||||
case 51325:
|
||||
case 51326:
|
||||
case 51327:
|
||||
case 51328:
|
||||
// Search for ghoul if our ghoul or dead body not valid unit target
|
||||
if (!(m_targets.getUnitTarget() && (m_targets.getUnitTarget()->GetEntry() == 26125 && m_targets.getUnitTarget()->GetOwnerGUID() == m_caster->GetGUID()
|
||||
|| (m_targets.getUnitTarget()->getDeathState() == CORPSE
|
||||
&& m_targets.getUnitTarget()->GetTypeId()== TYPEID_UNIT
|
||||
&& !((Creature*)m_targets.getUnitTarget())->isDeadByDefault()
|
||||
&& !(m_targets.getUnitTarget()->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL))
|
||||
&& m_targets.getUnitTarget()->GetDisplayId() == m_targets.getUnitTarget()->GetNativeDisplayId())))
|
||||
{
|
||||
CleanupTargetList();
|
||||
|
||||
WorldObject* result = FindCorpseUsing <Trinity::ExplodeCorpseObjectCheck> ();
|
||||
|
||||
if(result)
|
||||
{
|
||||
switch(result->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
case TYPEID_PLAYER:
|
||||
m_targets.setUnitTarget((Unit*)result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||
SendCastResult(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);
|
||||
finish(false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
sLog.outDebug("Spell (ID: %u) (caster Entry: %u) does not have record in `spell_script_target`", m_spellInfo->Id, m_caster->GetEntry());
|
||||
|
||||
@@ -2380,6 +2418,34 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
|
||||
healedMembers.pop();
|
||||
}
|
||||
}
|
||||
// Death Pact
|
||||
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00080000)
|
||||
{
|
||||
Unit * unit_to_add = NULL;
|
||||
for (std::list<Unit*>::iterator itr = unitList.begin() ; itr != unitList.end();++itr)
|
||||
{
|
||||
if ((*itr)->GetTypeId() == TYPEID_UNIT
|
||||
&& (*itr)->GetOwnerGUID() == m_caster->GetGUID()
|
||||
&& ((Creature*)(*itr))->GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD)
|
||||
{
|
||||
unit_to_add = (*itr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unit_to_add)
|
||||
{
|
||||
unitList.clear();
|
||||
unitList.push_back(unit_to_add);
|
||||
}
|
||||
// Pet not found - remove cooldown
|
||||
else
|
||||
{
|
||||
if (modOwner->GetTypeId()==TYPEID_PLAYER)
|
||||
modOwner->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||
SendCastResult(SPELL_FAILED_NO_PET);
|
||||
finish(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
|
||||
AddUnitTarget(*itr, i);
|
||||
|
||||
@@ -1950,6 +1950,29 @@ void Spell::EffectDummy(uint32 i)
|
||||
|
||||
spell_id = m_currentBasePoints[0];
|
||||
}
|
||||
// Corpse Explosion
|
||||
else if(m_spellInfo->SpellIconID == 1737)
|
||||
{
|
||||
// Dummy effect 1 is used only for targeting and damage amount
|
||||
if (i!=0)
|
||||
return;
|
||||
int32 bp = 0;
|
||||
// Living ghoul as a target
|
||||
if (unitTarget->isAlive())
|
||||
{
|
||||
bp = unitTarget->GetMaxHealth()*0.25f;
|
||||
}
|
||||
// Some corpse
|
||||
else
|
||||
{
|
||||
bp = damage;
|
||||
}
|
||||
m_caster->CastCustomSpell(unitTarget,m_spellInfo->CalculateSimpleValue(1),&bp,NULL,NULL,true);
|
||||
// Suicide
|
||||
unitTarget->CastCustomSpell(unitTarget,43999,&bp,NULL,NULL,true);
|
||||
// Set corpse look
|
||||
unitTarget->SetDisplayId(25537+urand(0,3));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2635,6 +2658,11 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
|
||||
unitTarget->RemoveAura(aurEff->GetParentAura());
|
||||
}
|
||||
}
|
||||
// Death Pact - return pct of max health to caster
|
||||
else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00080000)
|
||||
{
|
||||
addhealth = int32(caster->GetMaxHealth()*damage/100.0f);
|
||||
}
|
||||
else
|
||||
addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL);
|
||||
|
||||
|
||||
@@ -11089,6 +11089,8 @@ void Unit::setDeathState(DeathState s)
|
||||
if (m_deathState != ALIVE && s == ALIVE)
|
||||
{
|
||||
//_ApplyAllAuraMods();
|
||||
// Reset display id on resurection - needed by corpse explosion to cleanup after display change
|
||||
SetDisplayId(GetNativeDisplayId());
|
||||
}
|
||||
m_deathState = s;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user