diff options
-rw-r--r-- | src/game/DBCStructure.h | 2 | ||||
-rw-r--r-- | src/game/Spell.cpp | 66 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 28 | ||||
-rw-r--r-- | src/game/Unit.cpp | 2 |
4 files changed, 97 insertions, 1 deletions
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 686c43fc355..eaca4737cc3 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -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]); } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index ed818d95570..c2f17009554 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -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); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 6d1c986d7b2..08f833d0b6f 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -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); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e107eb90f55..096f55a294b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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; } |