本文整理汇总了C++中GetSpell函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSpell函数的具体用法?C++ GetSpell怎么用?C++ GetSpell使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetSpell函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendObjectDeSpawnAnim
void Totem::UnSummon()
{
SendObjectDeSpawnAnim(GetGUID());
CombatStop();
RemoveAurasDueToSpell(GetSpell());
Unit *owner = GetOwner();
if (owner)
{
owner->_RemoveTotem(this);
owner->RemoveAurasDueToSpell(GetSpell());
//remove aura all party members too
if (owner->GetTypeId() == TYPEID_PLAYER)
{
// Not only the player can summon the totem (scripted AI)
if(Group *pGroup = ((Player*)owner)->GetGroup())
{
for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
if(Target && pGroup->SameSubGroup((Player*)owner, Target))
Target->RemoveAurasDueToSpell(GetSpell());
}
}
}
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this);
}
AddObjectToRemoveList();
}
示例2: GetCreatureInfo
void Totem::Summon(Unit* owner)
{
owner->GetMap()->Add((Creature*)this);
// select totem model in dependent from owner team
CreatureInfo const *cinfo = GetCreatureInfo();
if(owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo);
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
if (minfo)
display_id = minfo->modelid;
SetDisplayId(display_id);
}
AIM_Initialize();
switch(m_type)
{
case TOTEM_PASSIVE:
CastSpell(this, GetSpell(), true);
break;
case TOTEM_STATUE:
CastSpell(GetOwner(), GetSpell(), true);
break;
default: break;
}
}
示例3: AIM_Initialize
void Totem::Summon(Unit* owner)
{
AIM_Initialize();
owner->GetMap()->Add((Creature*)this);
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
switch(m_type)
{
case TOTEM_PASSIVE:
{
for (uint32 i = 0; i <= GetSpellMaxIndex(); ++i)
{
if (uint32 spellId = GetSpell(i))
CastSpell(this, spellId, true);
}
break;
}
case TOTEM_STATUE:
{
if (GetSpell(0))
CastSpell(GetOwner(), GetSpell(0), true);
break;
}
default:
break;
}
}
示例4: CombatStop
void Totem::UnSummon() {
CombatStop();
RemoveAurasDueToSpell(GetSpell());
// clear owner's totem slot
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) {
if (m_owner->m_SummonSlot[i] == GetGUID()) {
m_owner->m_SummonSlot[i] = 0;
break;
}
}
m_owner->RemoveAurasDueToSpell(GetSpell());
//remove aura all party members too
Group *pGroup = NULL;
if (m_owner->GetTypeId() == TYPEID_PLAYER) {
m_owner->ToPlayer()->SendAutoRepeatCancel(this);
// Not only the player can summon the totem (scripted AI)
pGroup = m_owner->ToPlayer()->GetGroup();
if (pGroup) {
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL;
itr = itr->next()) {
Player* Target = itr->getSource();
if (Target && pGroup->SameSubGroup((Player*) m_owner, Target))
Target->RemoveAurasDueToSpell(GetSpell());
}
}
}
AddObjectToRemoveList();
}
示例5: GetSpell
void CMagicState::SpendCost()
{
if (m_PSpell->getSpellGroup() == SPELLGROUP_NINJUTSU)
{
if (!(m_flags & MAGICFLAGS_IGNORE_TOOLS))
{
// handle ninja tools
battleutils::HasNinjaTool(m_PEntity, GetSpell(), true);
}
}
else if (m_PSpell->hasMPCost() && !m_PEntity->StatusEffectContainer->HasStatusEffect(EFFECT_MANAFONT) && !(m_flags & MAGICFLAGS_IGNORE_MP))
{
int16 cost = battleutils::CalculateSpellCost(m_PEntity, GetSpell());
// conserve mp
int16 rate = m_PEntity->getMod(MOD_CONSERVE_MP);
if (dsprand::GetRandomNumber(100) < rate)
{
cost *= (dsprand::GetRandomNumber(8.f, 16.f) / 16.0f);
}
m_PEntity->addMP(-cost);
}
}
示例6: SetInstanceId
void Totem::Summon(Unit* owner)
{
sLog.outDebug("AddObject at Totem.cpp line 49");
SetInstanceId(owner->GetInstanceId());
owner->GetMap()->Add((Creature*)this);
// select totem model in dependent from owner team
CreatureInfo const *cinfo = GetCreatureInfo();
if(owner->GetTypeId()==TYPEID_PLAYER && cinfo)
{
uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(),cinfo);
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
if (minfo)
display_id = minfo->modelid;
SetDisplayId(display_id);
}
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
data << GetGUID();
SendMessageToSet(&data,true);
AIM_Initialize();
switch(m_type)
{
case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break;
case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break;
default: break;
}
}
示例7: AIM_Initialize
void Totem::Summon(Unit* owner)
{
AIM_Initialize();
owner->GetMap()->Add((Creature*)this);
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
// there are some totems, which exist just for their visual appeareance
if (!GetSpell())
return;
switch(m_type)
{
case TOTEM_PASSIVE:
for (int i=0; i<MAX_CREATURE_SPELL_DATA_SLOT; ++i)
if (m_spells[i])
CastSpell(this, m_spells[i], true);
break;
case TOTEM_STATUE:
CastSpell(GetOwner(), GetSpell(), true);
break;
default:
break;
}
}
示例8: AIM_Initialize
void Totem::Summon(Unit* owner)
{
AIM_Initialize();
owner->GetMap()->Add((Creature*)this);
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
#ifdef ENABLE_ELUNA
sEluna->OnSummoned(this, owner);
#endif /* ENABLE_ELUNA */
// there are some totems, which exist just for their visual appeareance
if (!GetSpell())
return;
switch (m_type)
{
case TOTEM_PASSIVE:
CastSpell(this, GetSpell(), true);
break;
case TOTEM_STATUE:
CastSpell(GetOwner(), GetSpell(), true);
break;
default: break;
}
}
示例9: SetMaxHealth
void Totem::Summon(Unit* owner)
{
// Mana Tide Totem should have 10% of caster's health
if(GetSpell() == 16191)
{
SetMaxHealth(owner->GetMaxHealth()*10/100);
SetHealth(GetMaxHealth());
}
owner->GetMap()->Add((Creature*)this);
AIM_Initialize();
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
// there are some totems, which exist just for their visual appeareance
if (!GetSpell())
return;
switch(m_type)
{
case TOTEM_PASSIVE:
CastSpell(this, GetSpell(), true);
break;
case TOTEM_STATUE:
CastSpell(GetOwner(), GetSpell(), true);
break;
default:
break;
}
}
示例10: AIM_Initialize
void Totem::Summon(Unit* owner)
{
AIM_Initialize();
owner->GetMap()->Add((Creature*)this);
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
data << GetObjectGuid();
SendMessageToSet(&data, true);
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
// there are some totems, which exist just for their visual appeareance
if (!GetSpell())
return;
switch (m_type)
{
case TOTEM_PASSIVE:
CastSpell(this, GetSpell(), true);
break;
case TOTEM_STATUE:
CastSpell(GetOwner(), GetSpell(), true);
break;
default: break;
}
}
示例11: CombatStop
void Totem::UnSummon()
{
CombatStop();
uint32 maxIdx = GetSpellMaxIndex();
for (int32 i = maxIdx; i >= 0; --i)
{
if (uint32 spellId = GetSpell(i))
RemoveAurasDueToSpell(spellId);
}
if (Unit* owner = GetOwner())
{
owner->_RemoveTotem(this);
for (int32 i = maxIdx; i >= 0; --i)
{
if (uint32 spellId = GetSpell(i))
owner->RemoveAurasDueToSpell(spellId);
}
// Remove Sentry Totem aura on totem unsummon
if (GetEntry() == SENTRY_TOTEM_ENTRY)
owner->RemoveAurasDueToSpell(6495);
//remove aura all party members too
if (owner->GetTypeId() == TYPEID_PLAYER)
{
((Player*)owner)->SendAutoRepeatCancel(this);
// Not only the player can summon the totem (scripted AI)
if (Group* pGroup = ((Player*)owner)->GetGroup())
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
if (Target && pGroup->SameSubGroup((Player*)owner, Target))
{
for (int32 i = maxIdx; i >= 0; --i)
{
if (uint32 spellId = GetSpell(i))
Target->RemoveAurasDueToSpell(spellId);
}
}
}
}
}
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this);
}
// any totem unsummon look like as totem kill, req. for proper animation
if (isAlive())
SetDeathState(DEAD);
AddObjectToRemoveList();
}
示例12: ForcedUnsummonDelayEvent
void Totem::UnSummon(uint32 msTime)
{
if (msTime)
{
m_Events.AddEvent(new ForcedUnsummonDelayEvent(*this), m_Events.CalculateTime(msTime));
return;
}
CombatStop();
RemoveAurasDueToSpell(GetSpell(), GetGUID());
// clear owner's totem slot
for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
{
if (GetOwner()->m_SummonSlot[i] == GetGUID())
{
GetOwner()->m_SummonSlot[i].Clear();
break;
}
}
GetOwner()->RemoveAurasDueToSpell(GetSpell(), GetGUID());
// Remove Sentry Totem Aura
if (GetEntry() == SENTRY_TOTEM_ENTRY)
GetOwner()->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID);
//remove aura all party members too
if (Player* owner = GetOwner()->ToPlayer())
{
owner->SendAutoRepeatCancel(this);
if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(GetUInt32Value(UNIT_CREATED_BY_SPELL)))
GetSpellHistory()->SendCooldownEvent(spell, 0, nullptr, false);
if (Group* group = owner->GetGroup())
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* target = itr->GetSource();
if (target && group->SameSubGroup(owner, target))
target->RemoveAurasDueToSpell(GetSpell(), GetGUID());
}
}
}
//npcbot: send SummonedCreatureDespawn()
if (GetCreatorGUID().IsCreature())
if (Unit* bot = ObjectAccessor::FindConnectedPlayer(GetCreatorGUID()))
if (bot->ToCreature()->GetIAmABot())
bot->ToCreature()->OnBotDespawn(this);
//end npcbot
AddObjectToRemoveList();
}
示例13: CastSpell
void Totem::InitSummon()
{
if (m_type == TOTEM_PASSIVE)
CastSpell(this, GetSpell(), true);
// Some totems can have both instant effect and passive spell
if (GetSpell(1))
CastSpell(this, GetSpell(1), true);
if (m_owner->HasAuraEffect(58585, 0))
CastSpell(this, 55277, true);
}
示例14: CastSpell
void Totem::InitSummon()
{
if (m_type == TOTEM_PASSIVE && GetSpell())
CastSpell(this, GetSpell(), true);
// Some totems can have both instant effect and passive spell
if (GetSpell(1))
CastSpell(this, GetSpell(1), true);
if (m_Properties->ID == SUMMON_TYPE_TOTEM_FIRE && GetOwner()->HasAura(SPELL_TOTEMIC_WRATH_TALENT))
CastSpell(this, SPELL_TOTEMIC_WRATH, true);
}
示例15: data
void Totem::InitSummon()
{
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
data << GetGUID();
SendMessageToSet(&data, true);
if(m_type == TOTEM_PASSIVE)
CastSpell(this, GetSpell(), true);
// Some totems can have both instant effect and passive spell
if (GetSpell(1))
CastSpell(this, GetSpell(1), true);
}