本文整理汇总了C++中GetSpellStore函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSpellStore函数的具体用法?C++ GetSpellStore怎么用?C++ GetSpellStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetSpellStore函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: HandleLearnAllGMCommand
static bool HandleLearnAllGMCommand(ChatHandler* handler, const char* /*args*/)
{
for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(i);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
continue;
if (!sSpellMgr->IsSkillTypeSpell(i, SKILL_INTERNAL))
continue;
handler->GetSession()->GetPlayer()->learnSpell(i, false);
}
handler->SendSysMessage(LANG_LEARNING_GM_SKILLS);
return true;
}
开发者ID:AwkwardDev,项目名称:ZoneLimit,代码行数:17,代码来源:cs_learn.cpp
示例2: boss_netherspiteAI
boss_netherspiteAI(Creature* c) : ScriptedAI(c)
{
pInstance = c->GetInstanceData();
for (int i=0; i<3; ++i)
{
PortalGUID[i] = 0;
BeamTarget[i] = 0;
BeamerGUID[i] = 0;
}
// need core fix
for (int i=0; i<3; ++i)
{
if (SpellEntry *spell = (SpellEntry*)GetSpellStore()->LookupEntry(PlayerBuff[i]))
spell->AttributesEx |= SPELL_ATTR_EX_NEGATIVE;
}
}
开发者ID:Archives,项目名称:ro_core,代码行数:17,代码来源:boss_netherspite.cpp
示例3: ItemUse_item_petrov_cluster_bombs
bool ItemUse_item_petrov_cluster_bombs(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
{
if (pPlayer->GetZoneId() != ZONE_ID_HOWLING)
return false;
if (!pPlayer->GetTransport() || pPlayer->GetAreaId() != AREA_ID_SHATTERED_STRAITS)
{
pPlayer->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_PETROV_BOMB))
Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_NOT_HERE);
return true;
}
return false;
}
开发者ID:xXNembiXx,项目名称:ScriptDev2_333,代码行数:17,代码来源:item_scripts.cpp
示例4: _DoCastSpellIfCan
CanCastResult BossSpellWorker::_DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 uiCastFlags, uint64 uiOriginalCasterGUID)
{
Unit* pCaster = boss;
if (!pTarget) return CAST_FAIL_OTHER;
if (uiCastFlags & CAST_FORCE_TARGET_SELF)
pCaster = pTarget;
// Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered
if (!pCaster->IsNonMeleeSpellCasted(false) || (uiCastFlags & (CAST_TRIGGERED | CAST_INTERRUPT_PREVIOUS)))
{
if (const SpellEntry* pSpell = GetSpellStore()->LookupEntry(uiSpell))
{
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
if (uiCastFlags & CAST_AURA_NOT_PRESENT)
{
if (pTarget->HasAura(uiSpell))
return CAST_FAIL_TARGET_AURA;
}
// Check if cannot cast spell
if (!(uiCastFlags & (CAST_FORCE_TARGET_SELF | CAST_FORCE_CAST)))
{
CanCastResult castResult = _CanCastSpell(pTarget, pSpell, uiCastFlags & CAST_TRIGGERED);
if (castResult != CAST_OK)
return castResult;
}
// Interrupt any previous spell
if (uiCastFlags & CAST_INTERRUPT_PREVIOUS && pCaster->IsNonMeleeSpellCasted(false))
pCaster->InterruptNonMeleeSpells(false);
pCaster->CastSpell(pTarget, pSpell, uiCastFlags & CAST_TRIGGERED, NULL, NULL, uiOriginalCasterGUID);
return CAST_OK;
}
else
{
error_log("BSW: DoCastSpellIfCan by creature entry %u attempt to cast spell %u but spell does not exist.", boss->GetEntry(), uiSpell);
return CAST_FAIL_OTHER;
}
}
else
return CAST_FAIL_IS_CASTING;
}
开发者ID:PhantomCore,项目名称:PhantomCore,代码行数:45,代码来源:sc_boss_spell_worker.cpp
示例5: boss_nalorakkAI
boss_nalorakkAI(Creature *c) : ScriptedAI(c)
{
MoveEvent = true;
MovePhase = 0;
pInstance = (c->GetInstanceData());
SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_MANGLE);
if(TempSpell)
{
TempSpell->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ENEMY;
}
wLoc.coord_x = NalorakkWay[7][0];
wLoc.coord_y = NalorakkWay[7][1];
wLoc.coord_z = NalorakkWay[7][2];
wLoc.orientation = 0;
wLoc.mapid = m_creature->GetMapId();
m_creature->setActive(true);
}
开发者ID:Dolmero,项目名称:L4G_Core,代码行数:18,代码来源:boss_nalorakk.cpp
示例6: ItemUse_item_Capteur_Tellurique
bool ItemUse_item_Capteur_Tellurique(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
{
if(pPlayer->GetAreaId() == 4157)
{
if(pPlayer->GetPositionZ() < 185.0f)
{
pPlayer->TeleportTo(pPlayer->GetMapId(),3329.524f,2543.395f,197.317f,4.950f);
pPlayer->KilledMonsterCredit(27853,0);
}
else
pPlayer->TeleportTo(pPlayer->GetMapId(),3414.0f,2363.01f,37.911f,3.102f);
}
else
{
Spell::SendCastResult(pPlayer, GetSpellStore()->LookupEntry(47097), 1, SPELL_FAILED_INCORRECT_AREA);
return false;
}
return true;
}
开发者ID:AwkwardDev,项目名称:MangosFX,代码行数:19,代码来源:item_scripts.cpp
示例7: EnfeebleHealthEffect
void EnfeebleHealthEffect()
{
const SpellEntry *info = GetSpellStore()->LookupEntry(SPELL_ENFEEBLE_EFFECT);
if (!info)
return;
ThreatList const& tList = m_creature->getThreatManager().getThreatList();
std::vector<Unit *> targets;
if (tList.empty())
return;
//begin + 1 , so we don't target the one with the highest threat
ThreatList::const_iterator itr = tList.begin();
std::advance(itr, 1);
for(; itr!= tList.end(); ++itr) //store the threat list in a different container
{
Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
//only on alive players
if (target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER)
targets.push_back(target);
}
//cut down to size if we have more than 5 targets
while(targets.size() > 5)
targets.erase(targets.begin()+rand()%targets.size());
int i = 0;
for(std::vector<Unit *>::iterator iter = targets.begin(); iter!= targets.end(); ++iter, ++i)
{
Unit *target = *iter;
if (target)
{
enfeeble_targets[i] = target->GetGUID();
enfeeble_health[i] = target->GetHealth();
target->CastSpell(target, SPELL_ENFEEBLE, true, 0, 0, m_creature->GetGUID());
target->SetHealth(1);
}
}
}
开发者ID:eviljared,项目名称:diamondcore,代码行数:42,代码来源:boss_prince_malchezaar.cpp
示例8: GOGossipSelect_go_ulduar_teleporter
bool GOGossipSelect_go_ulduar_teleporter(Player *pPlayer, GameObject* pGo, uint32 sender, uint32 action)
{
int32 damage = 0;
if(sender != GOSSIP_SENDER_MAIN) return false;
if(!pPlayer->getAttackers().empty()) return false;
if(action >= 0 && action <= PORTALS_COUNT)
pPlayer->TeleportTo(PortalLoc[action].map_num, PortalLoc[action].x, PortalLoc[action].y, PortalLoc[action].z, PortalLoc[action].o);
if (PortalLoc[action].spellID != 0 )
if (SpellEntry const* spell = (SpellEntry *)GetSpellStore()->LookupEntry(PortalLoc[action].spellID))
{
SpellAuraHolder *holder = CreateSpellAuraHolder(spell, pPlayer, pPlayer);
Aura *aura = CreateAura(spell, EFFECT_INDEX_2, NULL, holder, pPlayer);
holder->AddAura(aura, EFFECT_INDEX_2);
}
pPlayer->CLOSE_GOSSIP_MENU();
return true;
}
开发者ID:leecher228,项目名称:scriptdev2,代码行数:20,代码来源:ulduar_teleport.cpp
示例9: GetSpellStore
bool PlayerbotClassAI::castDispel (uint32 dispelSpell, Unit *dTarget, bool checkFirst, bool castExistingAura, bool skipFriendlyCheck, bool skipEquipStanceCheck)
{
if (dispelSpell == 0 || !dTarget ) return false;
//if (!canCast(dispelSpell, dTarget, true)) return false; //Needless cpu cycles wasted, usually a playerbot can cast a dispell
const SpellEntry *dSpell = GetSpellStore()->LookupEntry(dispelSpell);
if (!dSpell) return false;
for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i)
{
if (dSpell->Effect[i] != (uint32)SPELL_EFFECT_DISPEL) continue;
uint32 dispel_type = dSpell->EffectMiscValue[i];
uint32 dispelMask = GetDispellMask(DispelType(dispel_type));
Unit::AuraMap const& auras = dTarget->GetOwnedAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); itr++)
{
Aura * aura = itr->second;
AuraApplication * aurApp = aura->GetApplicationOfTarget(dTarget->GetGUID());
if (!aurApp)
continue;
if ((1<<aura->GetSpellProto()->Dispel) & dispelMask)
{
if(aura->GetSpellProto()->Dispel == DISPEL_MAGIC)
{
bool positive = aurApp->IsPositive() ? (!(aura->GetSpellProto()->AttributesEx & SPELL_ATTR0_UNK7)) : false;
// do not remove positive auras if friendly target
// negative auras if non-friendly target
if(positive == dTarget->IsFriendlyTo(GetPlayerBot()))
continue;
}
// If there is a successfull match return, else continue searching.
if (CastSpell(dSpell, dTarget, checkFirst, castExistingAura, skipFriendlyCheck, skipEquipStanceCheck)) {
return true;
}
}
}
}
return false;
}
开发者ID:Sharki,项目名称:TC,代码行数:40,代码来源:PlayerbotClassAI.cpp
示例10: CastDoom
void CastDoom()
{
SpellEntry *spellInfo = (SpellEntry *)GetSpellStore()->LookupEntry(SPELL_DOOM);
if (spellInfo)
//target without tank
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,1))
{
if (pTarget->GetTypeId() == TYPEID_PLAYER)
{
for(uint8 i=0; i< MAX_EFFECT_INDEX; ++i)
{
uint8 eff = spellInfo->Effect[SpellEffectIndex(i)];
if (eff >= TOTAL_SPELL_EFFECTS)
continue;
//uint8 i=1;
/*pTarget->AddAura(new AzgalorDoom(spellInfo, SpellEffectIndex(i), NULL, pTarget, pTarget));*/
}
}
else
DoomTimer = 1000;
}
}
开发者ID:Bearq,项目名称:mangos,代码行数:22,代码来源:boss_azgalor.cpp
示例11: CastMark
void CastMark()
{
SpellEntry *spellInfo = (SpellEntry *)GetSpellStore()->LookupEntry(SPELL_MARK);
if (spellInfo)
{
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
for(std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
Unit *target = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid());
if (target && target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA)
{
for(uint32 i=0; i < MAX_EFFECT_INDEX; ++i)
{
uint8 eff = spellInfo->Effect[SpellEffectIndex(i)];
if (eff >= TOTAL_SPELL_EFFECTS)
continue;
/*target->AddAura(new KazrogalMark(spellInfo, SpellEffectIndex(i), NULL, target, target));*/
}
}
}
}
}
开发者ID:Bearq,项目名称:mangos,代码行数:22,代码来源:boss_kazrogal.cpp
示例12: EnfeebleHealthEffect
void EnfeebleHealthEffect() {
const SpellEntry *info = GetSpellStore()->LookupEntry(
SPELL_ENFEEBLE_EFFECT);
if (!info)
return;
std::list<HostileReference *> t_list =
me->getThreatManager().getThreatList();
std::vector<Unit *> targets;
if (!t_list.size())
return;
//begin + 1, so we don't target the one with the highest threat
std::list<HostileReference *>::const_iterator itr = t_list.begin();
std::advance(itr, 1);
for (; itr != t_list.end(); ++itr) //store the threat list in a different container
if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (pTarget->isAlive()
&& pTarget->GetTypeId() == TYPEID_PLAYER)
targets.push_back(pTarget);
//cut down to size if we have more than 5 targets
while (targets.size() > 5)
targets.erase(targets.begin() + rand() % targets.size());
uint32 i = 0;
for (std::vector<Unit *>::const_iterator iter = targets.begin();
iter != targets.end(); ++iter, ++i)
if (Unit *pTarget = *iter) {
enfeeble_targets[i] = pTarget->GetGUID();
enfeeble_health[i] = pTarget->GetHealth();
pTarget->CastSpell(pTarget, SPELL_ENFEEBLE, true, 0, 0,
me->GetGUID());
pTarget->SetHealth(1);
}
}
开发者ID:dsstest,项目名称:ArkCORE,代码行数:38,代码来源:boss_prince_malchezaar.cpp
示例13: error_log
bool BSWScriptedAI::_doAura(uint8 m_uiSpellIdx, Unit* pTarget, SpellEffectIndex index)
{
SpellTable* pSpell = &m_BossSpell[m_uiSpellIdx];
if (!pTarget || !pTarget->IsInMap(m_creature) || !pTarget->isAlive())
{
error_log("BSW: FAILED adding aura of spell number %u - no target or target not in map or target is dead",pSpell->m_uiSpellEntry[currentDifficulty]);
return false;
}
if (_hasAura(m_uiSpellIdx,pTarget))
debug_log("BSW: adding aura stack from spell %u index %u",pSpell->m_uiSpellEntry[currentDifficulty], index);
else debug_log("BSW: adding new aura from spell %u index %u",pSpell->m_uiSpellEntry[currentDifficulty], index);
SpellEntry const *spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty]);
if (spell && spell->Effect[index] < TOTAL_SPELL_EFFECTS)
{
if (IsSpellAppliesAura(spell, (1 << EFFECT_INDEX_0) | (1 << EFFECT_INDEX_1) | (1 << EFFECT_INDEX_2)) || IsSpellHaveEffect(spell, SPELL_EFFECT_PERSISTENT_AREA_AURA))
{
SpellAuraHolder *holder = CreateSpellAuraHolder(spell, pTarget, pTarget);
int32 basepoint = pSpell->varData ? pSpell->varData - 1 : spell->EffectBasePoints[index] + 1;
if ( IsAreaAuraEffect(spell->Effect[index]) ||
spell->Effect[index] == SPELL_EFFECT_APPLY_AURA ||
spell->Effect[index] == SPELL_EFFECT_PERSISTENT_AREA_AURA )
{
Aura *aura = CreateAura(spell, SpellEffectIndex(index), &basepoint, holder, pTarget);
holder->AddAura(aura, SpellEffectIndex(index));
return true;
}
}
}
error_log("BSW: FAILED adding aura from spell %u index %u",pSpell->m_uiSpellEntry[currentDifficulty], index);
return false;
};
开发者ID:Subv,项目名称:diamondcore,代码行数:38,代码来源:sc_boss_spell_worker.cpp
示例14: DoWorkaroundForQuestCredit
// some targeting issues with the spell, so use this workaround as temporary solution
void DoWorkaroundForQuestCredit() {
Map* pMap = me->GetMap();
if (!pMap || pMap->IsHeroic())
return;
Map::PlayerList const &lList = pMap->GetPlayers();
if (lList.isEmpty())
return;
SpellEntry const* pSpell = GetSpellStore()->LookupEntry(
SPELL_ORB_KILL_CREDIT);
for (Map::PlayerList::const_iterator i = lList.begin();
i != lList.end(); ++i) {
if (Player* pPlayer = i->getSource()) {
if (pSpell && pSpell->EffectMiscValue[0])
pPlayer->KilledMonsterCredit(pSpell->EffectMiscValue[0],
0);
}
}
}
开发者ID:dsstest,项目名称:ArkCORE,代码行数:24,代码来源:magisters_terrace.cpp
示例15: UpdateAI
void UpdateAI(const uint32 diff)
{
if(!me->IsNonMeleeSpellCasted(false) && !me->isInCombat())
{
if(OOCTimer < diff)
{
HandleOffCombatEffects();
OOCTimer = 10000;
}
else
OOCTimer -= diff;
}
if(!UpdateVictim())
return;
if(Frostbolt_Timer < diff)
{
AddSpellToCast(me->getVictim(), SPELL_FROSTBOLT);
Frostbolt_Timer = SpellMgr::GetSpellCastTime(GetSpellStore()->LookupEntry(SPELL_FROSTBOLT))-(diff+100);
}
else
Frostbolt_Timer -= diff;
if(Arcane_Nova_Timer < diff)
{
ClearCastQueue();
AddSpellToCast(SPELL_ARCANE_NOVA, CAST_SELF);
Arcane_Nova_Timer = urand(16000, 20000);
}
else
Arcane_Nova_Timer -= diff;
CheckCasterNoMovementInRange(diff, 35.0);
CastNextSpellIfAnyAndReady();
DoMeleeAttackIfReady();
}
开发者ID:ekzobam,项目名称:HGCore,代码行数:37,代码来源:magisters_terrace_trash.cpp
示例16: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!Vorpil)
{
me->DealDamage(me, me->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
}
if (move <= diff)
{
if (sacrificed)
{
SpellEntry* spell = (SpellEntry*)GetSpellStore()->LookupEntry(HeroicMode ? H_SPELL_EMPOWERING_SHADOWS : SPELL_EMPOWERING_SHADOWS);
if (spell)
Vorpil->AddAura(new EmpoweringShadowsAura(spell, 0, NULL, Vorpil, me));
Vorpil->SetHealth(Vorpil->GetHealth() + Vorpil->GetMaxHealth() / 25);
DoCast(me, SPELL_SHADOW_NOVA, true);
me->DealDamage(me, me->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
}
me->GetMotionMaster()->MoveFollow(Vorpil, 0, 0);
if (me->GetDistance(Vorpil) < 3)
{
DoCast(me, SPELL_SACRIFICE, false);
sacrificed = true;
move = 500;
return;
}
if (!Vorpil->IsInCombat() || Vorpil->isDead())
{
me->DealDamage(me, me->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
}
move = 1000;
}
else move -= diff;
}
开发者ID:Phentora,项目名称:OregonCore,代码行数:36,代码来源:boss_grandmaster_vorpil.cpp
示例17: FillSpellSummary
void FillSpellSummary()
{
SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()];
SpellEntry const* TempSpell;
for (int i=0; i < GetSpellStore()->GetNumRows(); i++)
{
SpellSummary[i].Effects = 0;
SpellSummary[i].Targets = 0;
TempSpell = GetSpellStore()->LookupEntry(i);
//This spell doesn't exist
if (!TempSpell)
continue;
for (int j=0; j<3; j++)
{
//Spell targets self
if (TempSpell->EffectImplicitTargetA[j] == TARGET_SELF)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1);
//Spell targets a single enemy
if (TempSpell->EffectImplicitTargetA[j] == TARGET_CHAIN_DAMAGE ||
TempSpell->EffectImplicitTargetA[j] == TARGET_CURRENT_ENEMY_COORDINATES)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1);
//Spell targets AoE at enemy
if (TempSpell->EffectImplicitTargetA[j] == TARGET_ALL_ENEMY_IN_AREA ||
TempSpell->EffectImplicitTargetA[j] == TARGET_ALL_ENEMY_IN_AREA_INSTANT ||
TempSpell->EffectImplicitTargetA[j] == TARGET_CASTER_COORDINATES ||
TempSpell->EffectImplicitTargetA[j] == TARGET_ALL_ENEMY_IN_AREA_CHANNELED)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1);
//Spell targets an enemy
if (TempSpell->EffectImplicitTargetA[j] == TARGET_CHAIN_DAMAGE ||
TempSpell->EffectImplicitTargetA[j] == TARGET_CURRENT_ENEMY_COORDINATES ||
TempSpell->EffectImplicitTargetA[j] == TARGET_ALL_ENEMY_IN_AREA ||
TempSpell->EffectImplicitTargetA[j] == TARGET_ALL_ENEMY_IN_AREA_INSTANT ||
TempSpell->EffectImplicitTargetA[j] == TARGET_CASTER_COORDINATES ||
TempSpell->EffectImplicitTargetA[j] == TARGET_ALL_ENEMY_IN_AREA_CHANNELED)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1);
//Spell targets a single friend(or self)
if (TempSpell->EffectImplicitTargetA[j] == TARGET_SELF ||
TempSpell->EffectImplicitTargetA[j] == TARGET_SINGLE_FRIEND ||
TempSpell->EffectImplicitTargetA[j] == TARGET_SINGLE_PARTY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1);
//Spell targets aoe friends
if (TempSpell->EffectImplicitTargetA[j] == TARGET_ALL_PARTY_AROUND_CASTER ||
TempSpell->EffectImplicitTargetA[j] == TARGET_AREAEFFECT_PARTY ||
TempSpell->EffectImplicitTargetA[j] == TARGET_CASTER_COORDINATES)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1);
//Spell targets any friend(or self)
if (TempSpell->EffectImplicitTargetA[j] == TARGET_SELF ||
TempSpell->EffectImplicitTargetA[j] == TARGET_SINGLE_FRIEND ||
TempSpell->EffectImplicitTargetA[j] == TARGET_SINGLE_PARTY ||
TempSpell->EffectImplicitTargetA[j] == TARGET_ALL_PARTY_AROUND_CASTER ||
TempSpell->EffectImplicitTargetA[j] == TARGET_AREAEFFECT_PARTY ||
TempSpell->EffectImplicitTargetA[j] == TARGET_CASTER_COORDINATES)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1);
//Make sure that this spell includes a damage effect
if (TempSpell->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ||
TempSpell->Effect[j] == SPELL_EFFECT_INSTAKILL ||
TempSpell->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE ||
TempSpell->Effect[j] == SPELL_EFFECT_HEALTH_LEECH)
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE-1);
//Make sure that this spell includes a healing effect (or an apply aura with a periodic heal)
if (TempSpell->Effect[j] == SPELL_EFFECT_HEAL ||
TempSpell->Effect[j] == SPELL_EFFECT_HEAL_MAX_HEALTH ||
TempSpell->Effect[j] == SPELL_EFFECT_HEAL_MECHANICAL ||
(TempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && TempSpell->EffectApplyAuraName[j]== 8))
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1);
//Make sure that this spell applies an aura
if (TempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA)
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1);
}
}
}
开发者ID:blaumann,项目名称:uecore,代码行数:84,代码来源:sc_creature.cpp
示例18: GetSpellStore
SpellEntry const* ScriptedAI::SelectSpell(Unit* Target, int32 School, int32 Mechanic, SelectTarget Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effects)
{
//No target so we can't cast
if (!Target)
return false;
//Silenced so we can't cast
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
return false;
//Using the extended script system we first create a list of viable spells
SpellEntry const* Spell[4];
Spell[0] = 0;
Spell[1] = 0;
Spell[2] = 0;
Spell[3] = 0;
uint32 SpellCount = 0;
SpellEntry const* TempSpell;
SpellRangeEntry const* TempRange;
//Check if each spell is viable(set it to null if not)
for (uint32 i = 0; i < 4; i++)
{
TempSpell = GetSpellStore()->LookupEntry(m_creature->m_spells[i]);
//This spell doesn't exist
if (!TempSpell)
continue;
// Targets and Effects checked first as most used restrictions
//Check the spell targets if specified
if (Targets && !(SpellSummary[m_creature->m_spells[i]].Targets & (1 << (Targets-1))))
continue;
//Check the type of spell if we are looking for a specific spell type
if (Effects && !(SpellSummary[m_creature->m_spells[i]].Effects & (1 << (Effects-1))))
continue;
//Check for school if specified
if (School >= 0 && TempSpell->SchoolMask & School)
continue;
//Check for spell mechanic if specified
if (Mechanic >= 0 && TempSpell->Mechanic != Mechanic)
continue;
//Make sure that the spell uses the requested amount of power
if (PowerCostMin && TempSpell->manaCost < PowerCostMin)
continue;
if (PowerCostMax && TempSpell->manaCost > PowerCostMax)
continue;
//Continue if we don't have the mana to actually cast this spell
if (TempSpell->manaCost > m_creature->GetPower((Powers)TempSpell->powerType))
continue;
//Get the Range
TempRange = GetSpellRangeStore()->LookupEntry(TempSpell->rangeIndex);
//Spell has invalid range store so we can't use it
if (!TempRange)
continue;
//Check if the spell meets our range requirements
if (RangeMin && TempRange->maxRange < RangeMin)
continue;
if (RangeMax && TempRange->maxRange > RangeMax)
continue;
//Check if our target is in range
if (m_creature->IsWithinDistInMap(Target, TempRange->minRange) || !m_creature->IsWithinDistInMap(Target, TempRange->maxRange))
continue;
//All good so lets add it to the spell list
Spell[SpellCount] = TempSpell;
SpellCount++;
}
//We got our usable spells so now lets randomly pick one
if (!SpellCount)
return NULL;
return Spell[rand()%SpellCount];
}
开发者ID:blaumann,项目名称:uecore,代码行数:87,代码来源:sc_creature.cpp
示例19: EffectDummyCreature_spell_dummy_npc
//.........这里部分代码省略.........
{
if (uiEffIndex == EFFECT_INDEX_0)
{
if (pCaster->GetTypeId() != TYPEID_PLAYER)
return true;
if (pCreatureTarget->GetEntry() != NPC_IRON_RUNESHAPER && pCreatureTarget->GetEntry() != NPC_RUNE_REAVER)
return true;
pCreatureTarget->CastSpell(pCreatureTarget, SPELL_BOULBER_IMPACT, true);
pCaster->CastSpell(pCaster, SPELL_BOULDER_TOSS_CREDIT, true);
return true;
}
return true;
}
case SPELL_ULTRASONIC_SCREWDRIVER:
{
if (uiEffIndex == EFFECT_INDEX_0)
{
if (pCreatureTarget->IsCorpse())
{
uint32 newSpellId = 0;
switch (pCreatureTarget->GetEntry())
{
case NPC_COLLECT_A_TRON: newSpellId = SPELL_SUMMON_COLLECT_A_TRON; break;
case NPC_DEFENDO_TANK: newSpellId = SPELL_SUMMON_DEFENDO_TANK; break;
case NPC_SCAVENGE_A8: newSpellId = SPELL_SUMMON_SCAVENGE_A8; break;
case NPC_SCAVENGE_B6: newSpellId = SPELL_SUMMON_SCAVENGE_B6; break;
case NPC_SENTRY_BOT: newSpellId = SPELL_SUMMON_SENTRY_BOT; break;
}
if (const SpellEntry* pSpell = GetSpellStore()->LookupEntry(newSpellId))
{
pCaster->CastSpell(pCreatureTarget, pSpell->Id, true);
if (Pet* pPet = pCaster->FindGuardianWithEntry(pSpell->GetEffectMiscValue(SpellEffectIndex(uiEffIndex))))
pPet->CastSpell(pCaster, SPELL_REPROGRAM_KILL_CREDIT, true);
pCreatureTarget->ForcedDespawn();
}
}
return true;
}
return true;
}
case SPELL_ORB_OF_MURLOC_CONTROL:
{
pCreatureTarget->CastSpell(pCaster, SPELL_GREENGILL_SLAVE_FREED, true);
// Freed Greengill Slave
pCreatureTarget->UpdateEntry(NPC_FREED_GREENGILL_SLAVE);
pCreatureTarget->CastSpell(pCreatureTarget, SPELL_ENRAGE, true);
return true;
}
case SPELL_FUMPING:
{
if (uiEffIndex == EFFECT_INDEX_2)
{
switch (urand(0, 2))
{
case 0:
{
开发者ID:aduosi1212,项目名称:scripts,代码行数:67,代码来源:spell_scripts.cpp
示例20: memset
SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects)
{
//No target so we can't cast
if (!pTarget)
return false;
//Silenced so we can't cast
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
return false;
//Using the extended script system we first create a list of viable spells
SpellEntry const* apSpell[CREATURE_MAX_SPELLS];
memset(apSpell, 0, sizeof(SpellEntry*)*CREATURE_MAX_SPELLS);
uint32 uiSpellCount = 0;
SpellEntry const* pTempSpell;
SpellRangeEntry const* pTempRange;
//Check if each spell is viable(set it to null if not)
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++)
{
pTempSpell = GetSpellStore()->LookupEntry(m_creature->m_spells[i]);
//This spell doesn't exist
if (!pTempSpell)
continue;
// Targets and Effects checked first as most used restrictions
//Check the spell targets if specified
if (selectTargets && !(SpellSummary[m_creature->m_spells[i]].Targets & (1 << (selectTargets-1))))
continue;
//Check the type of spell if we are looking for a specific spell type
if (selectEffects && !(SpellSummary[m_creature->m_spells[i]].Effects & (1 << (selectEffects-1))))
continue;
//Check for school if specified
if (uiSchool >= 0 && pTempSpell->SchoolMask & uiSchool)
continue;
//Check for spell mechanic if specified
if (uiMechanic >= 0 && pTempSpell->Mechanic != uiMechanic)
continue;
//Make sure that the spell uses the requested amount of power
if (uiPowerCostMin && pTempSpell->manaCost < uiPowerCostMin)
continue;
if (uiPowerCostMax && pTempSpell->manaCost > uiPowerCostMax)
continue;
//Continue if we don't have the mana to actually cast this spell
if (pTempSpell->manaCost > m_creature->GetPower((Powers)pTempSpell->powerType))
continue;
//Get the Range
pTempRange = GetSpellRangeStore()->LookupEntry(pTempSpell->rangeIndex);
//Spell has invalid range store so we can't use it
if (!pTempRange)
continue;
//Check if the spell meets our range requirements
if (fRangeMin && m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange) < fRangeMin)
continue;
if (fRangeMax && m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange) > fRangeMax)
continue;
//Check if our target is in range
if (m_creature->IsWithinDistInMap(pTarget, m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange)) || !m_creature->IsWithinDistInMap(pTarget, m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange)))
continue;
//All good so lets add it to the spell list
apSpell[uiSpellCount] = pTempSpell;
++uiSpellCount;
}
//We got our usable spells so now lets randomly pick one
if (!uiSpellCount)
return NULL;
return apSpell[rand()%uiSpellCount];
}
开发者ID:Ickybad,项目名称:diamondcore2,代码行数:84,代码来源:ScriptedCreature.cpp
注:本文中的GetSpellStore函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论