Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Spell::EffectSummonPossessed(SpellEffectIndex eff_idx)
- {
- uint32 creature_entry = m_spellInfo->EffectMiscValue[eff_idx];
- if(!creature_entry)
- return;
- int32 duration = GetSpellDuration(m_spellInfo);
- float px, py, pz;
- // If dest location if present
- if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
- {
- // Summon 1 unit in dest location
- px = m_targets.m_destX;
- py = m_targets.m_destY;
- pz = m_targets.m_destZ;
- }
- // Summon if dest location not present near caster
- else
- m_caster->GetClosePoint(px,py,pz,1.0f);
- TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN;
- Creature *summon = m_caster->SummonCreature(creature_entry,px,py,pz,m_caster->GetOrientation(),summonType,duration);
- summon->addUnitState(UNIT_STAT_CONTROLLED);
- summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
- summon->SetCharmerGuid(m_caster->GetGUID());
- summon->setFaction(m_caster->getFaction());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement