这篇教程C++ GetSpellStore函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetSpellStore函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSpellStore函数的具体用法?C++ GetSpellStore怎么用?C++ GetSpellStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetSpellStore函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例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,
示例3: ItemUse_item_petrov_cluster_bombsbool 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,
示例4: _DoCastSpellIfCanCanCastResult 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,
示例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,
示例6: ItemUse_item_Capteur_Telluriquebool 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,
示例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,
示例8: GOGossipSelect_go_ulduar_teleporterbool 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,
示例9: GetSpellStorebool 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,
示例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,
示例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,
示例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,
示例13: error_logbool 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,
示例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,
示例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,
示例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,
示例17: FillSpellSummaryvoid 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,
示例18: GetSpellStoreSpellEntry 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,
示例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,
示例20: memsetSpellEntry 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,
示例21: UpdateAI//.........这里部分代码省略......... { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANE_BUFFET) == CAST_OK) { m_uiArcaneBuffetTimer = 20000; } } else m_uiArcaneBuffetTimer -= uiDiff; if (m_uiFrostBreathTimer < uiDiff) { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_BREATH) == CAST_OK) { if (!urand(0, 1)) DoScriptText(SAY_EVIL_SPELL2, m_creature); m_uiFrostBreathTimer = 25000; } } else m_uiFrostBreathTimer -= uiDiff; if (m_uiTailLashTimer < uiDiff) { if (m_creature->getVictim()) DoCast(m_creature->getVictim(), SPELL_TAIL_LASH); m_uiTailLashTimer = urand(25000, 40000); }else m_uiTailLashTimer -= uiDiff; if (m_uiWildMagicTimer < uiDiff) { CastWildMagic(); }else m_uiWildMagicTimer -= uiDiff; //end of simple spells DoMeleeAttackIfReady(); //Teleport To Spectral Realm if (m_uiSpectralBlastTimer < uiDiff) { ThreatList const& m_threatlist = m_creature->getThreatManager().getThreatList(); if (m_threatlist.empty()) { m_uiSpectralBlastTimer = 1000; return; } std::list<Unit*> targetList; for(ThreatList::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) if((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() && !(*itr)->getTarget()->HasAura(SPELL_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->IsInRange(m_creature, 0.0f, 50.0f, true)) targetList.push_back((*itr)->getTarget()); if(targetList.empty()) { m_uiSpectralBlastTimer = 1000; return; } std::list<Unit*>::iterator i = targetList.begin(); advance(i, rand()%targetList.size()); if((*i)) { if(m_pInstance && m_pInstance->GetData(DATA_KALECGOS_EVENT) == SPECIAL) { m_uiSpectralBlastTimer = urand(20000, 25000); } else { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 0)) if ( pTarget == (*i)) return; m_creature->AddThreat((*i), -100000.0f); (*i)->InterruptNonMeleeSpells(true); SpellEntry* pTempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SPECTRAL_BLAST); if (pTempSpell) { pTempSpell->Effect[EFFECT_INDEX_2] = 0; (*i)->CastSpell((*i), pTempSpell, true); } (*i)->CastSpell((*i), SPELL_SPECTRAL_EXHAUSTION,true); ((Player*)(*i))->TeleportTo((*i)->GetMapId(), (*i)->GetPositionX(), (*i)->GetPositionY(), DEMON_REALM_Z, (*i)->GetOrientation()); } m_uiSpectralBlastTimer = urand(20000, 25000); }else m_uiSpectralBlastTimer = 1000; }else m_uiSpectralBlastTimer -= uiDiff; if (m_uiSathrovarrTimer < uiDiff && !bSathrospawnd) { if (m_pInstance) if (Creature* pSath = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(DATA_SATHROVARR))) { pSath->SetVisibility(VISIBILITY_ON); pSath->setFaction(14); bSathrospawnd = true; if(pSath->AI()) pSath->AI()->AttackStart(m_creature->getVictim()); } }else m_uiSathrovarrTimer -= uiDiff; }
开发者ID:leecher227,项目名称:scriptdev2,代码行数:101,
示例22: GetAIvoid PlayerbotShamanAI::LoadSpells() { PlayerbotAI *ai = GetAI(); if (!ai) return; #pragma region SpellId Fill //totems HEALING_STREAM_TOTEM = ai->getSpellIdExact("Healing Stream Totem"); MANA_SPRING_TOTEM = ai->getSpellIdExact("Mana Spring Totem"); MANA_TIDE_TOTEM = ai->getSpellIdExact("Mana Tide Totem"); CLEANSING_TOTEM = ai->getSpellIdExact("Cleansing Totem"); FIRE_RESISTANCE_TOTEM = ai->getSpellIdExact("Fire Resistance Totem"); WINDFURY_TOTEM = ai->getSpellIdExact("Windfury Totem"); WRATH_OF_AIR_TOTEM = ai->getSpellIdExact("Wrath of Air Totem"); GROUNDING_TOTEM = ai->getSpellIdExact("Grounding Totem"); NATURE_RESISTANCE_TOTEM = ai->getSpellIdExact("Nature Resistance Totem"); STRENGTH_OF_EARTH_TOTEM = ai->getSpellIdExact("Strength of Earth Totem"); EARTHBIND_TOTEM = ai->getSpellIdExact("Earthbind Totem"); STONESKIN_TOTEM = ai->getSpellIdExact("Stoneskin Totem"); STONECLAW_TOTEM = ai->getSpellIdExact("Stoneclaw Totem"); TREMOR_TOTEM = ai->getSpellIdExact("Tremor Totem"); EARTH_ELEMENTAL_TOTEM = ai->getSpellIdExact("Earth Elemental Totem"); FLAMETONGUE_TOTEM = ai->getSpellIdExact("Flametongue Totem"); TOTEM_OF_WRATH = ai->getSpellIdExact("Totem of Wrath"); SEARING_TOTEM = ai->getSpellIdExact("Searing Totem"); MAGMA_TOTEM = ai->getSpellIdExact("Magma Totem"); FIRE_ELEMENTAL_TOTEM = ai->getSpellIdExact("Fire Elemental Totem"); FROST_RESISTANCE_TOTEM = ai->getSpellIdExact("Frost Resistance Totem"); TOTEMIC_RECALL = ai->getSpellIdExact("Totemic Recall"); CALL_OF_THE_ELEMENTS = ai->getSpellIdExact("Call of the Elements"); CALL_OF_THE_ANCESTORS = ai->getSpellIdExact("Call of the Ancestors"); CALL_OF_THE_SPIRITS = ai->getSpellIdExact("Call of the Spirits"); //restoration HEAL = ai->getSpellIdExact("Healing Wave"); LESSER_HEAL = ai->getSpellIdExact("Lesser Healing Wave"); CHAIN_HEAL = ai->getSpellIdExact("Chain Heal"); RIPTIDE = ai->getSpellIdExact("Riptide"); ANCESTRAL_SPIRIT = ai->getSpellIdExact("Ancestral Spirit"); CLEANSE_SPIRIT = ai->getSpellIdExact("Cleanse Spirit"); if (CLEANSE_SPIRIT) CLEANSE_SPIRIT = ai->getSpellIdExact("Cure Toxins"); //offensive spells LIGHTNING_BOLT = ai->getSpellIdExact("Lightning Bolt"); CHAIN_LIGHTNING = ai->getSpellIdExact("Chain Lightning"); FIRE_NOVA = ai->getSpellIdExact("Fire Nova"); THUNDERSTORM = ai->getSpellIdExact("Thunderstorm"); LAVA_BURST = ai->getSpellIdExact("Lava Burst"); EARTH_SHOCK = ai->getSpellIdExact("Earth Shock"); WIND_SHEAR = ai->getSpellIdExact("Wind Shear"); FLAME_SHOCK = ai->getSpellIdExact("Flame Shock"); FROST_SHOCK = ai->getSpellIdExact("Frost Shock"); PURGE = ai->getSpellIdExact("Purge"); HEX = ai->getSpellIdExact("Hex"); //buffs LIGHTNING_SHIELD = ai->getSpellIdExact("Lightning Shield"); WATER_SHIELD = ai->getSpellIdExact("Water Shield"); EARTH_SHIELD = ai->getSpellIdExact("Earth Shield"); HEROISM = ai->getSpellIdExact("Heroism"); if (HEROISM) HEROISM = ai->getSpellIdExact("Bloodlust"); ELEMENTAL_MASTERY = ai->getSpellIdExact("Elemental Mastery"); NATURES_SWIFTNESS = ai->getSpellIdExact("Nature's Swiftness"); WINDFURY_WEAPON = ai->getSpellIdExact("Windfury Weapon"); FLAMETONGUE_WEAPON = ai->getSpellIdExact("Flametongue Weapon"); FROSTBRAND_WEAPON = ai->getSpellIdExact("Frostbrand Weapon"); ROCKBITER_WEAPON = ai->getSpellIdExact("Rockbiter Weapon"); EARTHLIVING_WEAPON = ai->getSpellIdExact("Earthliving Weapon"); WATER_BREATHING = ai->getSpellIdExact("Water Breathing"); WATER_WALKING = ai->getSpellIdExact("Water Walking"); //melee LAVA_LASH = ai->getSpellIdExact("Lava Lash"); STORMSTRIKE = ai->getSpellIdExact("Stormstrike"); SHAMANISTIC_RAGE = ai->getSpellIdExact("Shamanistic Rage"); FERAL_SPIRIT = ai->getSpellIdExact("Feral Spirit"); GHOST_WOLF = ai->getSpellIdExact("Ghost Wolf"); EXHAUSTION = 57723; // heroism debuff SATED = 57724; // bloodlust debuff //MAELSTROM_WEAPON = 0; // We want the triggered aura, not the talent spell uint32 mwtrigger = ai->getSpellIdExact("Maelstrom Weapon",true); if (mwtrigger) { SpellEntry const *mwtSpell = GetSpellStore()->LookupEntry(mwtrigger); if (mwtSpell && mwtSpell->EffectTriggerSpell[0] > 0) MAELSTROM_WEAPON = mwtSpell->EffectTriggerSpell[0]; } TALENT_ELEMENTAL = ELEMENTAL_MASTERY; TALENT_ENHANCEMENT = STORMSTRIKE; TALENT_RESTO = EARTH_SHIELD; uint8 talentCounter = 0; if (TALENT_ELEMENTAL) talentCounter++; if (TALENT_ENHANCEMENT) talentCounter++;//.........这里部分代码省略.........
开发者ID:Anonymus111,项目名称:chaoscore,代码行数:101,
示例23: error_logbool BSWScriptedAI::_doAura(uint32 SpellID, Unit* pTarget, SpellEffectIndex index, int32 basepoint, bool isStack){ 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",SpellID); return false; } if (_hasAura(SpellID,pTarget)) debug_log("BSW: adding aura stack from spell %u index %u",SpellID, index); else debug_log("BSW: adding new aura from spell %u index %u",SpellID, index); SpellEntry const *spell = (SpellEntry *)GetSpellStore()->LookupEntry(SpellID); if (spell) { if (IsSpellAppliesAura(spell, (1 << EFFECT_INDEX_0) | (1 << EFFECT_INDEX_1) | (1 << EFFECT_INDEX_2)) || IsSpellHaveEffect(spell, SPELL_EFFECT_PERSISTENT_AREA_AURA)) { int32 _basepoint = basepoint ? basepoint - 1 : spell->EffectBasePoints[index] + 1; bool addedToExisting = true; SpellAuraHolderPtr holder = pTarget->GetSpellAuraHolder(SpellID, pTarget->GetObjectGuid()); Aura* aura = NULL; if (!holder) { holder = CreateSpellAuraHolder(spell, pTarget, pTarget); addedToExisting = false; } if (aura = holder->GetAuraByEffectIndex(index)) { if (isStack) holder->ModStackAmount(1); } else { aura = holder->CreateAura(spell, index, &_basepoint, holder, pTarget, m_creature, NULL); holder->SetAuraDuration(aura->GetAuraMaxDuration()); } if (addedToExisting) { pTarget->AddAuraToModList(aura); holder->SetInUse(true); aura->ApplyModifier(true,true); holder->SetInUse(false); } else pTarget->AddSpellAuraHolder(holder); return true; } } error_log("BSW: FAILED adding aura from spell %u index %u",SpellID, index); return false;};
开发者ID:Reamer,项目名称:cyber-scriptdev2,代码行数:62,
示例24: debug_log//.........这里部分代码省略......... { _BSWDoCast(m_uiSpellIdx, pTarget); }; result = CAST_OK; }; } } else result = CAST_FAIL_OTHER; } break; case CAST_ON_FRENDLY: pTarget = DoSelectLowestHpFriendly(pSpell->LocData.x,0); result = _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case CAST_ON_FRENDLY_LOWHP: pTarget = DoSelectLowestHpFriendly(pSpell->LocData.x,1); result = _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case CAST_ON_RANDOM_POINT: if (!pTarget) pTarget = m_creature; if (pSpell->LocData.z <= 1.0f) { float fPosX, fPosY, fPosZ; if (!pTarget->IsPositionValid() || !pTarget->IsInMap(m_creature)) { if (pTarget->GetTypeId() == TYPEID_PLAYER) error_log("BSW: CAST_ON_RANDOM_POINT FAILED: player has invalid position. SpellID is %u",pSpell->m_uiSpellEntry[currentDifficulty]); else error_log("BSW: CAST_ON_RANDOM_POINT FAILED: creature has invalid position. SpellID is %u",pSpell->m_uiSpellEntry[currentDifficulty]); result = CAST_FAIL_OTHER; break; } pTarget->GetPosition(fPosX, fPosY, fPosZ); pTarget->GetRandomPoint(fPosX, fPosY, fPosZ, urand((uint32)pSpell->LocData.x, (uint32)pSpell->LocData.y), fPosX, fPosY, fPosZ); if ((int)fPosZ == 0) { error_log("BSW: CAST_ON_RANDOM_POINT FAILED: Positon Z is NULL. Strange bug"); result = CAST_FAIL_OTHER; break; } if (SpellEntry const *spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty])) if (SpellRangeEntry const *pSpellRange = GetSpellRangeStore()->LookupEntry(spell->rangeIndex)) if (m_creature->GetDistance(fPosX, fPosY, fPosZ) <= pSpellRange->maxRange) { m_creature->CastSpell(fPosX, fPosY, fPosZ, pSpell->m_uiSpellEntry[currentDifficulty], false); result = CAST_OK; break; }; result = CAST_FAIL_TOO_FAR; } else result = CAST_FAIL_OTHER; break; case CAST_ON_RANDOM_PLAYER: if ( pSpell->LocData.x < 1 ) pTarget = _doSelect(0, false, 60.0f); else pTarget = _doSelect(0, false, (float)pSpell->LocData.x); result = _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case APPLY_AURA_ALLPLAYERS: { Map* pMap = m_creature->GetMap(); Map::PlayerList const& pPlayers = pMap->GetPlayers(); for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr) { pTarget = itr->getSource(); if (pTarget && pTarget->isAlive() && pTarget->IsWithinDistInMap(m_creature, pSpell->LocData.x)) { _doAura(m_uiSpellIdx, pTarget, EFFECT_INDEX_0); result = CAST_OK; } } } break; case FORCE_CAST: result = _BSWDoForceCast(m_uiSpellIdx, pTarget); break; case SPELLTABLEPARM_NUMBER: default: error_log("BSW: FAILED casting spell number %u type %u - type not exists",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget); result = CAST_FAIL_OTHER; break; }; if (pSpell->textEntry && result == CAST_OK) { if (pTarget) DoScriptText(pSpell->textEntry,m_creature,pTarget); else DoScriptText(pSpell->textEntry,m_creature); }; debug_log("BSW: Casted spell number %u, result = %u",pSpell->m_uiSpellEntry[currentDifficulty], result); return result;};
开发者ID:Reamer,项目名称:cyber-scriptdev2,代码行数:101,
示例25: debug_logCanCastResult BossSpellWorker::_BSWSpellSelector(uint8 m_uiSpellIdx, Unit* pTarget){ if (_bossSpellCount == 0) return CAST_FAIL_OTHER; SpellEntry const *spell; SpellTable* pSpell = &m_BossSpell[m_uiSpellIdx]; Unit* pSummon = NULL; debug_log("BSW: Casting spell number %u type %u",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget); switch (pSpell->m_CastTarget) { case DO_NOTHING: return CAST_OK; case CAST_ON_SELF: if (!pSpell->m_IsBugged) return _DoCastSpellIfCan(boss, pSpell->m_uiSpellEntry[currentDifficulty]); else return _BSWDoCast(m_uiSpellIdx, boss); break; case CAST_ON_SUMMONS: if (!pTarget) return CAST_FAIL_OTHER; else return _DoCastSpellIfCan(pTarget, pSpell->m_uiSpellEntry[currentDifficulty]); break; case CAST_ON_VICTIM: pTarget = boss->getVictim(); return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case CAST_ON_RANDOM: pTarget = SelectUnit(SELECT_TARGET_RANDOM); return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case CAST_ON_BOTTOMAGGRO: pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case CAST_ON_TARGET: return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case APPLY_AURA_SELF: if (spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty])) if(boss->AddAura(pSpell->m_uiSpellEntry[currentDifficulty], boss)) return CAST_OK; else return CAST_FAIL_OTHER; break; case APPLY_AURA_TARGET: if (!pTarget) return CAST_FAIL_OTHER; if (spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty])) if (pTarget->AddAura(pSpell->m_uiSpellEntry[currentDifficulty], pTarget)) return CAST_OK; else return CAST_FAIL_OTHER; break; case SUMMON_NORMAL: pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); if(pSummon) return CAST_OK; else return CAST_FAIL_OTHER; break; case SUMMON_TEMP: pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, urand(pSpell->m_uiSpellTimerMin[currentDifficulty],pSpell->m_uiSpellTimerMax[currentDifficulty])); if(pSummon) return CAST_OK; else return CAST_FAIL_OTHER; break; case SUMMON_INSTANT: pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_MANUAL_DESPAWN,0); if(pSummon) return CAST_OK; else return CAST_FAIL_OTHER; break; case CAST_ON_ALLPLAYERS: { CanCastResult res1 = CAST_FAIL_OTHER; Map::PlayerList const& pPlayers = pMap->GetPlayers(); for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr) { pTarget = itr->getSource(); if (pTarget && pTarget->isAlive() && pTarget->IsWithinDistInMap(boss, pSpell->LocData.x)) if (!pSpell->m_IsBugged) { res1 = _DoCastSpellIfCan(pTarget, pSpell->m_uiSpellEntry[currentDifficulty]); } else { _BSWDoCast(m_uiSpellIdx, pTarget); res1 = CAST_OK; }; return res1; } break; } case CAST_ON_FRENDLY: pTarget = SelectLowHPFriendly(); return _BSWCastOnTarget(pTarget, m_uiSpellIdx);//.........这里部分代码省略.........
开发者ID:PhantomCore,项目名称:PhantomCore,代码行数:101,
示例26: GetPlayerBotbool PlayerbotClassAI::castSelfCCBreakers (uint32 castList[]){ uint32 dispelSpell = 0; Player *dTarget = GetPlayerBot(); /* dispelSpell = (uint32) R_ESCAPE_ARTIST; // this is script effect, 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 ( ( aura->GetSpellProto()->Mechanic == MECHANIC_SNARE ) || ( aura->GetSpellProto()->Mechanic == MECHANIC_ROOT ) ) { 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(caster)) continue; } return castSpell(dispelSpell, dTarget); } } return false; */ // racial abilities /* if( GetPlayerBot()->getRace() == RACE_BLOODELF && !pTarget->HasAura( ARCANE_TORRENT,0 ) && castSpell( ARCANE_TORRENT,pTarget ) ) { //GetPlayerBot()->Say("Arcane Torrent!", LANG_UNIVERSAL); } else if( GetPlayerBot()->getRace() == RACE_HUMAN && (GetPlayerBot()->HasUnitState( UNIT_STAT_STUNNED ) || GetPlayerBot()->HasAuraType( SPELL_AURA_MOD_FEAR ) || GetPlayerBot()->HasAuraType( SPELL_AURA_MOD_DECREASE_SPEED ) || GetPlayerBot()->HasAuraType( SPELL_AURA_MOD_CHARM )) && castSpell( EVERY_MAN_FOR_HIMSELF, GetPlayerBot() ) ) { //GetPlayerBot()->Say("EVERY MAN FOR HIMSELF!", LANG_UNIVERSAL); } else if( GetPlayerBot()->getRace() == RACE_UNDEAD_PLAYER && (GetPlayerBot()->HasAuraType( SPELL_AURA_MOD_FEAR ) || GetPlayerBot()->HasAuraType( SPELL_AURA_MOD_CHARM )) && castSpell( WILL_OF_THE_FORSAKEN, GetPlayerBot() ) ) { // GetPlayerBot()->Say("WILL OF THE FORSAKEN!", LANG_UNIVERSAL); } else if( GetPlayerBot()->getRace() == RACE_DWARF && GetPlayerBot()->HasAuraState( AURA_STATE_DEADLY_POISON ) && castSpell( STONEFORM, GetPlayerBot() ) ) { //GetPlayerBot()->Say("STONEFORM!", LANG_UNIVERSAL); } else if( GetPlayerBot()->getRace() == RACE_GNOME && (GetPlayerBot()->HasUnitState( UNIT_STAT_STUNNED ) || GetPlayerBot()->HasAuraType( SPELL_AURA_MOD_DECREASE_SPEED )) && castSpell( ESCAPE_ARTIST, GetPlayerBot() ) ) { // GetPlayerBot()->Say("ESCAPE ARTIST!", LANG_UNIVERSAL); } */ for (uint8 j = 0; j < sizeof (castList); j++) { dispelSpell = castList[j]; if (dispelSpell == 0 || !dTarget->HasSpell(dispelSpell) || !CanCast(dispelSpell, dTarget, true)) continue; SpellEntry const *dSpell = GetSpellStore()->LookupEntry(dispelSpell); if (!dSpell) continue; for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i) { if (dSpell->Effect[i] != (uint32)SPELL_EFFECT_DISPEL && dSpell->Effect[i] != (uint32)SPELL_EFFECT_APPLY_AURA) continue; if (dSpell->Effect[i] == (uint32)SPELL_EFFECT_APPLY_AURA && ( (dSpell->EffectApplyAuraName[i] != (uint32) SPELL_AURA_MECHANIC_IMMUNITY) || (dSpell->EffectApplyAuraName[i] != (uint32) SPELL_AURA_DISPEL_IMMUNITY) )) continue; 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 (aura->GetSpellProto() && ( (dSpell->Effect[i] == (uint32)SPELL_EFFECT_DISPEL && ((1<<aura->GetSpellProto()->Dispel) & GetDispellMask(DispelType(dSpell->EffectMiscValue[i]))) ) || (dSpell->EffectApplyAuraName[i] == (uint32) SPELL_AURA_MECHANIC_IMMUNITY && ( GetAllSpellMechanicMask(aura->GetSpellProto()) & ( 1 << dSpell->EffectMiscValue[i]) ) ) || (dSpell->EffectApplyAuraName[i] == (uint32) SPELL_AURA_DISPEL_IMMUNITY && ( (1<<aura->GetSpellProto()->Dispel) & GetDispellMask(DispelType(dSpell->EffectMiscValue[i])) ) ) ) ) { if(aura->GetSpellProto()->Dispel == DISPEL_MAGIC) { bool positive = aurApp->IsPositive() ? (!(aura->GetSpellProto()->AttributesEx & SPELL_ATTR0_UNK7)) : false; if(positive)continue; } return CastSpell(dispelSpell, dTarget, false); } } } } return false;}
开发者ID:Togy,项目名称:prydevserv_backup,代码行数:84,
示例27: GetSpellStorevoid ScriptMgr::FillSpellSummary(){ SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()]; SpellEntry const* pTempSpell; for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) { SpellSummary[i].Effects = 0; SpellSummary[i].Targets = 0; pTempSpell = GetSpellStore()->LookupEntry(i); //This spell doesn't exist if (!pTempSpell) continue; for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) { //Spell targets self if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1); //Spell targets a single enemy if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY || pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1); //Spell targets AoE at enemy if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST || pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1); //Spell targets an enemy if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY || pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST || pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1); //Spell targets a single friend(or self) if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1); //Spell targets aoe friends if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_TARGET || pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1); //Spell targets any friend(or self) if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER || pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_TARGET || pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER) SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1); //Make sure that this spell includes a damage effect if (pTempSpell->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE || pTempSpell->Effect[j] == SPELL_EFFECT_INSTAKILL || pTempSpell->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE || pTempSpell->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 (pTempSpell->Effect[j] == SPELL_EFFECT_HEAL || pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MAX_HEALTH || pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MECHANICAL || (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && pTempSpell->EffectApplyAuraName[j] == 8)) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1); //Make sure that this spell applies an aura if (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA) SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1); } }}
开发者ID:Ramusik,项目名称:MadboxpcWOW_3.0,代码行数:84,
示例28: memsetSpellEntry const* ScriptedAI::SelectSpell(Unit* target, int32 school, int32 mechanic, SelectTarget selectTargets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect selectEffects){ // No target so we can't cast if (!target) return nullptr; // Silenced so we can't cast if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) return nullptr; // Using the extended script system we first create a list of viable spells SpellEntry const* spellInfos[4]; memset(spellInfos, 0, sizeof(SpellEntry*) * 4); uint32 spellCount = 0; SpellEntry const* tempSpellInfo; SpellRangeEntry const* tempRange; // Check if each spell is viable(set it to null if not) for (uint8 i = 0; i < 4; ++i) { tempSpellInfo = GetSpellStore()->LookupEntry<SpellEntry>(m_creature->m_spells[i]); // This spell doesn't exist if (!tempSpellInfo) 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 (school >= 0 && tempSpellInfo->SchoolMask & school) continue; // Check for spell mechanic if specified if (mechanic >= 0 && tempSpellInfo->Mechanic != (uint32)mechanic) continue; // Make sure that the spell uses the requested amount of power if (powerCostMin && tempSpellInfo->manaCost < powerCostMin) continue; if (powerCostMax && tempSpellInfo->manaCost > powerCostMax) continue; // Continue if we don't have the mana to actually cast this spell if (tempSpellInfo->manaCost > m_creature->GetPower((Powers)tempSpellInfo->powerType)) continue; // Get the Range tempRange = GetSpellRangeStore()->LookupEntry(tempSpellInfo->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 spellInfos[spellCount] = tempSpellInfo; ++spellCount; } // We got our usable spells so now lets randomly pick one if (!spellCount) return nullptr; return spellInfos[urand(0, spellCount - 1)];}
开发者ID:killerwife,项目名称:mangos-tbc,代码行数:85,
注:本文中的GetSpellStore函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetSprite函数代码示例 C++ GetSpellRecoveryTime函数代码示例 |