这篇教程C++ u_check函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中u_check函数的典型用法代码示例。如果您正苦于以下问题:C++ u_check函数的具体用法?C++ u_check怎么用?C++ u_check使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了u_check函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: pvoid CreatureEventAI::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid){ CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.SetNoCreate(); Trinity::FriendlyMissingBuffInRange u_check(me, range, spellid); Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(me, _list, u_check); TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); cell.Visit(p, grid_creature_searcher, *me->GetMap(), *me, range);}
开发者ID:AtVirus,项目名称:Tenerby,代码行数:13,
示例2: GetSpellMaxRangevoidTotemAI::UpdateAI(const uint32 /*diff*/){ if (getTotem().GetTotemType() != TOTEM_ACTIVE) return; if (!m_creature->isAlive() || m_creature->IsNonMeleeSpellCasted(false)) return; // Search spell SpellEntry const *spellInfo = sSpellStore.LookupEntry(getTotem().GetSpell()); if (!spellInfo) return; SpellMiscEntry const* spellMisc = sSpellMiscStore.LookupEntry(spellInfo->Id); // Get spell rangy SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellMisc->rangeIndex); float max_range = GetSpellMaxRange(srange); // SPELLMOD_RANGE not applied in this place just because nonexistent range mods for attacking totems // pointer to appropriate target if found any Unit* victim = m_creature->GetMap()->GetUnit(i_victimGuid); // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) if( !victim || !victim->isTargetableForAttack() || !m_creature->IsWithinDistInMap(victim, max_range) || m_creature->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(m_creature,m_creature,false) ) { victim = NULL; Strawberry::NearestAttackableUnitInObjectRangeCheck u_check(m_creature, m_creature, max_range); Strawberry::UnitLastSearcher<Strawberry::NearestAttackableUnitInObjectRangeCheck> checker(victim, u_check); Cell::VisitAllObjects(m_creature, checker, max_range); } // If have target if (victim) { // remember i_victimGuid = victim->GetObjectGuid(); // attack m_creature->SetInFront(victim); // client change orientation by self m_creature->CastSpell(victim, getTotem().GetSpell(), false); } else i_victimGuid.Clear();}
开发者ID:Null45,项目名称:StrawberryCore-501Beta,代码行数:50,
示例3: pvoid CreatureEventAI::DoFindFriendlyCC(std::list<Creature*>& _list, float range){ CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::FriendlyCCedInRange u_check(me, range); Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(me, _list, u_check); TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); cell.Visit(p, grid_creature_searcher, *me->GetMap());}
开发者ID:naffbeats,项目名称:SkyFireEMU_rebase,代码行数:14,
示例4: UpdateAI void UpdateAI(uint32 diff) { if (_initialSelection) { _initialSelection = false; // Find victim of Summon Gargoyle spell std::list<Unit*> targets; Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 50); Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check); me->VisitNearbyObject(50, searcher); for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID())) { (*iter)->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID()); SetGazeOn(*iter); _targetGUID = (*iter)->GetGUID(); break; } } if (_despawnTimer > 4000) { _despawnTimer -= diff; if (!UpdateVictimWithGaze()) { MySelectNextTarget(); return; } _initialCastTimer += diff; _selectionTimer += diff; if (_selectionTimer >= 1000) { MySelectNextTarget(); _selectionTimer = 0; } if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) me->CastSpell(me->GetVictim(), 51963, false); } else { if (!_despawning) FlyAway(); if (_despawnTimer > diff) _despawnTimer -= diff; else me->DespawnOrUnsummon(); } }
开发者ID:Keader,项目名称:Sunwell,代码行数:49,
示例5: u_checkCreature* BossSpellWorker::SelectNearestCreature(uint32 guid, float range){ Creature* pTarget = NULL; MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*boss, guid, true, range*2); MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(boss, pTarget, u_check); Cell::VisitGridObjects(boss, searcher, range*2); if (pTarget && pTarget->IsInMap(boss) && pTarget != boss && pTarget->isAlive()) { debug_log("BSW: search creature %u in range %f - found it.",guid,range); return pTarget; } else return NULL;}
开发者ID:MoosOwn,项目名称:scriptdev2,代码行数:16,
示例6: u_checkCreature* BSWScriptedAI::doSelectNearestCreature(uint32 guid, float range){ Creature* pTarget = NULL; Diamond::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_creature, guid, true, range*2); Diamond::CreatureLastSearcher<Diamond::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(m_creature, pTarget, u_check); Cell::VisitGridObjects(m_creature, searcher, range*2); if (pTarget && pTarget->IsInMap(m_creature) && pTarget != m_creature && pTarget->isAlive()) { debug_log("BSW: search creature %u in range %f - found it.",guid,range); return pTarget; } else return NULL;}
开发者ID:Subv,项目名称:diamondcore,代码行数:16,
示例7: UpdateAI void UpdateAI(uint32 diff) { if (_initialSelection) { _initialSelection = false; // Find victim of Summon Gargoyle spell std::list<Unit*> targets; Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 50); Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check); me->VisitNearbyObject(50, searcher); for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID())) { SwitchTargetAndAttack((*iter)); break; } } if (_despawnTimer > 4000) { _despawnTimer -= diff; _initialCastTimer += diff; _selectionTimer += diff; if (_selectionTimer >= 1000) { MySelectNextTarget(); _selectionTimer = 0; } // check start timer and if not casting if(_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING)) if (!(me->HasAuraType(SPELL_AURA_MOD_FEAR) || me->HasAuraType(SPELL_AURA_MOD_ROOT) || me->HasAuraType(SPELL_AURA_MOD_CONFUSE) || me->HasAuraType(SPELL_AURA_MOD_STUN))) if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) me->CastSpell(me->GetVictim(), 51963, false); } else { if (!_despawning) FlyAway(); if (_despawnTimer > diff) _despawnTimer -= diff; else me->DespawnOrUnsummon(); } }
开发者ID:rynnokung,项目名称:azerothcore-wotlk,代码行数:47,
示例8: pGameObject* GameObject::LookupFishingHoleAround(float range){ GameObject* ok = NULL; CellPair p(MaNGOS::ComputeCellPair(GetPositionX(),GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; MaNGOS::NearestGameObjectFishingHole u_check(*this, range); MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole> checker(ok, u_check); CellLock<GridReadGuard> cell_lock(cell, p); TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker); cell_lock->Visit(cell_lock, grid_object_checker, *GetMap()); return ok;}
开发者ID:Actionfox,项目名称:mangos,代码行数:17,
示例9: u_checkvoid TotemAI::UpdateAI(uint32 /*diff*/){ if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE) return; if (!me->IsAlive() || me->IsNonMeleeSpellCast(false)) return; // Search spell SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->ToTotem()->GetSpell()); if (!spellInfo) return; // Get spell range float max_range = spellInfo->GetMaxRange(false); // SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems // pointer to appropriate target if found any Unit* victim = !i_victimGuid.IsEmpty() ? ObjectAccessor::GetUnit(*me, i_victimGuid) : NULL; // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) if (!victim || !victim->isTargetableForAttack() || !me->IsWithinDistInMap(victim, max_range) || me->IsFriendlyTo(victim) || !me->CanSeeOrDetect(victim)) { victim = NULL; Trinity::NearestAttackableUnitInObjectRangeCheck u_check(me, me->GetCharmerOrOwnerOrSelf(), max_range); Trinity::UnitLastSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck> checker(me, victim, u_check); Cell::VisitAllObjects(me, checker, max_range); } // If have target if (victim) { // remember i_victimGuid = victim->GetGUID(); // attack me->SetInFront(victim); // client change orientation by self me->CastSpell(victim, me->ToTotem()->GetSpell(), false); } else i_victimGuid.Clear();}
开发者ID:Carbenium,项目名称:TrinityCore,代码行数:45,
示例10: pUnit* BSWScriptedAI::doSelectLowHPFriendly(float fRange, uint32 uiMinHPDiff){ CellPair p(Diamond::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Unit* pUnit = NULL; Diamond::MostHPMissingInRange u_check(m_creature, fRange, uiMinHPDiff); Diamond::UnitLastSearcher<Diamond::MostHPMissingInRange> searcher(m_creature, pUnit, u_check); TypeContainerVisitor<Diamond::UnitLastSearcher<Diamond::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher); cell.Visit(p, grid_unit_searcher, *(pMap), *m_creature, fRange); return pUnit;}
开发者ID:Subv,项目名称:diamondcore,代码行数:18,
示例11: pstd::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellId){ CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Creature*> pList; MaNGOS::FriendlyMissingBuffInRange u_check(m_creature, fRange, uiSpellId); MaNGOS::CreatureListSearcher<MaNGOS::FriendlyMissingBuffInRange> searcher(m_creature, pList, u_check); TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); cell.Visit(p, grid_creature_searcher, *(m_creature->GetMap()), *m_creature, fRange); return pList;}
开发者ID:KillerFrca,项目名称:VP-sd2,代码行数:18,
示例12: pUnit* BossSpellWorker::SelectLowHPFriendly(float fRange, uint32 uiMinHPDiff){ CellPair p(Trinity::ComputeCellPair(boss->GetPositionX(), boss->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Unit* pUnit = NULL; Trinity::MostHPMissingInRange u_check(boss, fRange, uiMinHPDiff); Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(boss, pUnit, u_check); TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher); cell.Visit(p, grid_unit_searcher, *(pMap), *boss, fRange); return pUnit;}
开发者ID:PhantomCore,项目名称:PhantomCore,代码行数:18,
示例13: u_checkvoid CreatureAI::SendAIEventAround(AIEventType eventType, Unit* pInvoker, uint32 uiDelay, float fRadius, uint32 miscValue /*=0*/) const{ if (fRadius > 0) { std::list<Creature*> receiverList; // Use this check here to collect only assitable creatures in case of CALL_ASSISTANCE, else be less strict MaNGOS::AnyAssistCreatureInRangeCheck u_check(m_creature, eventType == AI_EVENT_CALL_ASSISTANCE ? pInvoker : NULL, fRadius); MaNGOS::CreatureListSearcher<MaNGOS::AnyAssistCreatureInRangeCheck> searcher(receiverList, u_check); Cell::VisitGridObjects(m_creature, searcher, fRadius); if (!receiverList.empty()) { AiDelayEventAround* e = new AiDelayEventAround(eventType, pInvoker ? pInvoker->GetObjectGuid() : ObjectGuid(), *m_creature, receiverList, miscValue); m_creature->m_Events.AddEvent(e, m_creature->m_Events.CalculateTime(uiDelay)); } }}
开发者ID:Adeer,项目名称:server,代码行数:18,
示例14: pstd::list<Creature*> ScriptedAI::DoFindFriendlyCC(float fRange){ CellPair p(Diamond::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Creature*> pList; Diamond::FriendlyCCedInRange u_check(m_creature, fRange); Diamond::CreatureListSearcher<Diamond::FriendlyCCedInRange> searcher(m_creature, pList, u_check); GridTypeVisitor<Diamond::CreatureListSearcher<Diamond::FriendlyCCedInRange> >::Grid grid_creature_searcher(searcher); cell.Visit(p, grid_creature_searcher, *(m_creature->GetMap()), *m_creature, fRange); return pList;}
开发者ID:Bootz,项目名称:diamondcore,代码行数:18,
示例15: u_checkUnit* GuardianAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff, bool onlyInCombat) const{ Unit* owner = m_creature->GetOwner(); if (!owner) return nullptr; Unit* pUnit = nullptr; MaNGOS::MostHPMissingInRangeCheck u_check(m_creature, range, MinHPDiff, onlyInCombat); MaNGOS::UnitLastSearcher<MaNGOS::MostHPMissingInRangeCheck> searcher(pUnit, u_check); if (owner->GetTypeId() == TYPEID_PLAYER) Cell::VisitWorldObjects(m_creature, searcher, range); // search all friendly unit including players else Cell::VisitGridObjects(m_creature, searcher, range); // search only friendly creatures return pUnit;}
开发者ID:Ozerev,项目名称:mangos-tbc,代码行数:18,
示例16: pstd::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range){ CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Creature*> pList; MaNGOS::FriendlyCCedInRange u_check(m_creature, range); MaNGOS::CreatureListSearcher<MaNGOS::FriendlyCCedInRange> searcher(m_creature, pList, u_check); TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap())); return pList;}
开发者ID:blaumann,项目名称:uecore,代码行数:19,
示例17: InitializeAI void InitializeAI() { CasterAI::InitializeAI(); uint64 ownerGuid = me->GetOwnerGUID(); if (!ownerGuid) return; // Not needed to be despawned now _despawnTimer = 0; // Find victim of Summon Gargoyle spell std::list<Unit*> targets; Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 30.0f); Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check); me->VisitNearbyObject(30.0f, searcher); for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, ownerGuid)) { me->Attack((*iter), false); break; } }
开发者ID:Caydan,项目名称:WoWSCore548,代码行数:21,
示例18: SearchForTrigger void SearchForTrigger(Unit* target, uint32 triggerEntry, uint32 SpellID, bool ArcRequirement) { Player* pPlayer = me->GetPlayer(*me, PlayerGuid); std::list<Unit*> SearchedTriggers; Trinity::AllCreaturesOfEntryInRange u_check(target, triggerEntry, 100.0f); Trinity::UnitListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(target, SearchedTriggers, u_check); target->VisitNearbyObject(100.0f, searcher); if(SearchedTriggers.empty()) return; for (std::list<Unit*>::const_iterator iter = SearchedTriggers.begin(); iter != SearchedTriggers.end(); ++iter) { if(ArcRequirement) { if((*iter)->HasInArc(M_PI/3, me)) (*iter)->CastSpell(target, SpellID, true); } else (*iter)->CastSpell(target, SpellID, true); } SearchedTriggers.clear(); }
开发者ID:AwkwardDev,项目名称:WoWSource434,代码行数:22,
示例19: HandleStormSequence void HandleStormSequence(Unit* Cloud) // 1: begin, 2-9: tick, 10: end { if (StormCount < 10 && StormCount > 1) { // deal damage int32 bp0 = 800; for (uint8 i = 2; i < StormCount; ++i) bp0 *= 2; std::list<Unit*> tempUnitMap; Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, SIZE_OF_GRIDS); Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check); Cell::VisitAllObjects(me, searcher, SIZE_OF_GRIDS); // deal damage for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) { if (Unit* target = (*i)) { if (Cloud && !Cloud->IsWithinDist(target, 6, false)) { CastSpellExtraArgs args; args.TriggerFlags = TRIGGERED_FULL_MASK; args.OriginalCaster = me->GetGUID(); args.AddSpellMod(SPELLVALUE_BASE_POINT0, bp0); Cloud->CastSpell(target, SPELL_ZAP, args); } } } // visual float x, y, z; z = me->GetPositionZ(); uint8 maxCount = 5 + rand32() % 5; for (uint8 i = 0; i < maxCount; ++i) { x = 343.0f + rand32() % 60; y = 1380.0f + rand32() % 60; if (Unit* trigger = me->SummonTrigger(x, y, z, 0, 2000)) { trigger->SetFaction(FACTION_FRIENDLY); trigger->SetMaxHealth(100000); trigger->SetHealth(100000); trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (Cloud) { CastSpellExtraArgs args; args.TriggerFlags = TRIGGERED_FULL_MASK; args.OriginalCaster = Cloud->GetGUID(); args.AddSpellMod(SPELLVALUE_BASE_POINT0, bp0); Cloud->CastSpell(trigger, SPELL_ZAP, args); } } } } ++StormCount; if (StormCount > 10) { StormCount = 0; // finish events.ScheduleEvent(EVENT_SUMMON_EAGLES, 5s); me->InterruptNonMeleeSpells(false); CloudGUID.Clear(); if (Cloud) Cloud->KillSelf(); SetWeather(WEATHER_STATE_FINE, 0.0f); isRaining = false; } events.ScheduleEvent(EVENT_STORM_SEQUENCE, 1s); }
开发者ID:ElunaLuaEngine,项目名称:ElunaTrinityWotlk,代码行数:71,
示例20: HandleStormSequence void HandleStormSequence(Unit *Cloud) // 1: begin, 2-9: tick, 10: end { if(StormCount < 10 && StormCount > 1) { // deal damage int32 bp0 = 800; for(uint8 i = 2; i < StormCount; ++i) bp0 *= 2; CellPair p(Ribon::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Unit *> tempUnitMap; { Ribon::AnyAoETargetUnitInObjectRangeCheck u_check(m_creature, m_creature, 999); Ribon::UnitListSearcher<Ribon::AnyAoETargetUnitInObjectRangeCheck> searcher(m_creature, tempUnitMap, u_check); TypeContainerVisitor<Ribon::UnitListSearcher<Ribon::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor<Ribon::UnitListSearcher<Ribon::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_unit_searcher, *(m_creature->GetMap())); cell_lock->Visit(cell_lock, grid_unit_searcher, *(m_creature->GetMap())); } //dealdamege for(std::list<Unit*>::iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) { if(!Cloud->IsWithinDist(*i, 6, false)) { Cloud->CastCustomSpell(*i, 43137, &bp0, NULL, NULL, true, 0, 0, m_creature->GetGUID()); } } // visual float x,y,z; z = m_creature->GetPositionZ(); for(uint8 i = 0; i < 5+rand()%5; ++i) { x = 343+rand()%60; y = 1380+rand()%60; if(Unit *trigger = m_creature->SummonTrigger(x, y, z, 0, 2000)) { trigger->setFaction(35); trigger->SetMaxHealth(100000); trigger->SetHealth(100000); trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (Cloud) Cloud->CastCustomSpell(trigger, /*43661*/43137, &bp0, NULL, NULL,true, 0, 0, Cloud->GetGUID()); } } } StormCount++; if(StormCount > 10) { StormCount = 0; // finish SummonEagles_Timer = 5000; m_creature->InterruptNonMeleeSpells(false); CloudGUID = 0; if (Cloud) Cloud->DealDamage(Cloud, Cloud->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); SetWeather(WEATHER_STATE_FINE, 0.0f); isRaining = false; } StormSequenceTimer = 1000; }
开发者ID:MilchBuby,项目名称:riboncore,代码行数:67,
示例21: u_checkvoid TotemAI::UpdateAI(uint32 const /*diff*/){ if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE) return; if (!me->IsAlive()) return; // pointer to appropriate target if found any Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*me, i_victimGuid) : NULL; if (me->IsNonMeleeSpellCasted(false)) { if (victim && victim->HasCrowdControlAura()) victim = NULL; else return; } // Search spell SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->ToTotem()->GetSpell()); if (!spellInfo) return; // Get spell range float max_range = spellInfo->GetMaxRange(false); // Apply SPELLMOD_RANGE from owner (required by Elemental Reach talent at least) if (Player * const modOwner = me->GetSpellModOwner()) modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RANGE, max_range); // Searing Totem prioritize Flame Shock or Stormstrike targets if (spellInfo->Id == 3606) { if (Unit * caster = me->GetOwner()) { std::list<Unit*> targets; Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, max_range); Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check); Trinity::VisitNearbyObject(caster, max_range, searcher); // Find Stormstrike and Flame Shock -> Stormstrike -> Flame Shock const uint64 guid = caster->GetGUID(); auto itr = std::find_if(targets.begin(), targets.end(), [guid](Unit *u) { return u->HasAura(17364, guid) && u->HasAura(8050, guid); }); if (itr == targets.end()) itr = std::find_if(targets.begin(), targets.end(), [guid](Unit *u) { return u->HasAura(17364, guid); }); if (itr == targets.end()) itr = std::find_if(targets.begin(), targets.end(), [guid](Unit *u) { return u->HasAura(8050, guid); }); if (itr != targets.end()) victim = *itr; } if (!victim) { victim = me->GetOwner()->GetVictim(); if (!victim) return; } } // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) if (!victim || !victim->isTargetableForAttack() || !me->IsWithinDistInMap(victim, max_range) || me->IsFriendlyTo(victim) || !me->canSeeOrDetect(victim) || victim->HasCrowdControlAura()) { victim = NULL; Trinity::NearestAttackableNoCCUnitInObjectRangeCheck u_check(me, me, max_range); Trinity::UnitLastSearcher<Trinity::NearestAttackableNoCCUnitInObjectRangeCheck> checker(me, victim, u_check); Trinity::VisitNearbyObject(me, max_range, checker); } // If have target if (victim) { // remember i_victimGuid = victim->GetGUID(); // attack me->SetInFront(victim); // client change orientation by self me->CastSpell(victim, me->ToTotem()->GetSpell(), false); } else i_victimGuid = 0;}
开发者ID:Exodius,项目名称:chuspi,代码行数:85,
示例22: switch//.........这里部分代码省略......... Unit* ok = NULL; // pointer to appropriate target if found any if(m_cooldownTime >= time(NULL)) return; bool IsBattleGroundTrap = false; //FIXME: this is activation radius (in different casting radius that must be selected from spell data) //TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state float radius = goInfo->trap.radius; if(!radius) { if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call) return; else { if(m_respawnTime > 0) break; radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3 IsBattleGroundTrap = true; } } bool NeedDespawn = (goInfo->trap.charges != 0); CellPair p(MaNGOS::ComputeCellPair(GetPositionX(),GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; // Note: this hack with search required until GO casting not implemented // search unfriendly creature if(owner && NeedDespawn) // hunter trap { MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, owner, radius); MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck> checker(ok, u_check); CellLock<GridReadGuard> cell_lock(cell, p); TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); cell_lock->Visit(cell_lock, grid_object_checker, *GetMap()); // or unfriendly player/pet if(!ok) { TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); cell_lock->Visit(cell_lock, world_object_checker, *GetMap()); } } else // environmental trap { // environmental damage spells already have around enemies targeting but this not help in case not existed GO casting support // affect only players Player* p_ok = NULL; MaNGOS::AnyPlayerInObjectRangeCheck p_check(this, radius); MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck> checker(p_ok, p_check); CellLock<GridReadGuard> cell_lock(cell, p); TypeContainerVisitor<MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); cell_lock->Visit(cell_lock, world_object_checker, *GetMap()); ok = p_ok; } if (ok) {
开发者ID:Actionfox,项目名称:mangos,代码行数:67,
示例23: u_checkvoid TotemAI::UpdateAI(uint32 const /*diff*/){ if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE) return; if (!me->isAlive()) return; // pointer to appropriate target if found any Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*me, i_victimGuid) : NULL; if (me->IsNonMeleeSpellCasted(false)) { if (victim && victim->HasCrowdControlAura()) victim = NULL; else return; } // Search spell SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->ToTotem()->GetSpell()); if (!spellInfo) return; // Get spell range float max_range = spellInfo->GetMaxRange(false); // SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) if (!victim || !victim->isTargetableForAttack() || !me->IsWithinDistInMap(victim, max_range) || me->IsFriendlyTo(victim) || !me->canSeeOrDetect(victim) || victim->HasCrowdControlAura()) { victim = NULL; MoPCore::NearestAttackableNoCCUnitInObjectRangeCheck u_check(me, me, max_range); MoPCore::UnitLastSearcher<MoPCore::NearestAttackableNoCCUnitInObjectRangeCheck> checker(me, victim, u_check); me->VisitNearbyObject(max_range, checker); } if (me->GetUInt32Value(UNIT_CREATED_BY_SPELL) == 3599) // Searing Totem { if (me->GetOwner() && me->GetOwner()->getVictim()) { i_victimGuid = me->GetOwner()->getVictim()->GetGUID(); victim = i_victimGuid ? ObjectAccessor::GetUnit(*me, i_victimGuid) : NULL; if (victim) { me->SetTarget(i_victimGuid); me->SetInCombatWith(victim); } } } // If have target if (victim) { // remember i_victimGuid = victim->GetGUID(); // attack me->SetInFront(victim); // client change orientation by self me->CastSpell(victim, me->ToTotem()->GetSpell(), false); } else i_victimGuid = 0;}
开发者ID:Mystiko,项目名称:MoPCore5.4.8,代码行数:68,
示例24: HandleStormSequence void HandleStormSequence(Unit* Cloud) // 1: begin, 2-9: tick, 10: end { if (StormCount < 10 && StormCount > 1) { // deal damage int32 bp0 = 800; for (uint8 i = 2; i < StormCount; ++i) bp0 *= 2; CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.SetNoCreate(); std::list<Unit*> tempUnitMap; { Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, SIZE_OF_GRIDS); Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check); TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); cell.Visit(p, world_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS); cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS); } // deal damage for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) { if (Unit* target = (*i)) { if (Cloud && !Cloud->IsWithinDist(target, 6, false)) Cloud->CastCustomSpell(target, SPELL_ZAP, &bp0, NULL, NULL, true, 0, 0, me->GetGUID()); } } // visual float x, y, z; z = me->GetPositionZ(); for (uint8 i = 0; i < 5+rand()%5; ++i) { x = 343.0f+rand()%60; y = 1380.0f+rand()%60; if (Unit* trigger = me->SummonTrigger(x, y, z, 0, 2000)) { trigger->setFaction(35); trigger->SetMaxHealth(100000); trigger->SetHealth(100000); trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (Cloud) Cloud->CastCustomSpell(trigger, /*43661*/SPELL_ZAP, &bp0, NULL, NULL, true, 0, 0, Cloud->GetGUID()); } } } ++StormCount; if (StormCount > 10) { StormCount = 0; // finish events.ScheduleEvent(EVENT_SUMMON_EAGLES, 5000); me->InterruptNonMeleeSpells(false); CloudGUID = 0; if (Cloud) Cloud->DealDamage(Cloud, Cloud->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); SetWeather(WEATHER_STATE_FINE, 0.0f); isRaining = false; } events.ScheduleEvent(EVENT_STORM_SEQUENCE, 1000); }
开发者ID:TheTwinkDude,项目名称:TrinityCore,代码行数:70,
示例25: u_checkvoidTotemAI::UpdateAI(const uint32 /*diff*/){ if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE) return; if (!me->isAlive() || me->IsNonMeleeSpellCasted(false)) return; // Search spell SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->ToTotem()->GetSpell()); if (!spellInfo) return; // Get spell range float max_range = spellInfo->GetMaxRange(false); // SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems // pointer to appropriate target if found any Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*me, i_victimGuid) : NULL; Unit* tmpvictim = 0; // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) if (!victim || (!victim->isTargetableForAttack() || !me->IsWithinDistInMap(victim, max_range) || me->IsFriendlyTo(victim) || !me->canSeeOrDetect(victim))) { Trinity::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range); Trinity::UnitLastSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck> checker(me, victim, u_check); me->VisitNearbyObject(max_range, checker); tmpvictim = victim; } else if(!(victim->HasAura(FLAME_SHOCK, me->GetOwnerGUID()) || victim->HasAura(STORMSTRIKE, me->GetOwnerGUID()))) tmpvictim = victim; Unit* owner = me->GetOwner(); // looking for attacker with specific auras, do only if new victim found in radius or current victim has no aura if (owner && tmpvictim) { if (Unit* ownervictim = owner->getVictim()) { //Owner's target is priority if (me->IsWithinDistInMap(ownervictim, max_range) && (ownervictim->HasAura(FLAME_SHOCK, owner->GetGUID()) || ownervictim->HasAura(STORMSTRIKE, owner->GetGUID()))) victim = ownervictim; else { Unit::AttackerSet attackers = owner->getAttackers(); for (Unit::AttackerSet::iterator itr = attackers.begin(); itr != attackers.end(); ++itr) { tmpvictim = *itr; if (me->IsWithinDistInMap(tmpvictim, max_range) && (tmpvictim->HasAura(FLAME_SHOCK, owner->GetGUID()) || tmpvictim->HasAura(STORMSTRIKE, owner->GetGUID()))) victim = tmpvictim; } } } } // If have target if (victim) { // remember i_victimGuid = victim->GetGUID(); // attack me->SetInFront(victim); // client change orientation by self me->CastSpell(victim, me->ToTotem()->GetSpell(), false, NULL, NULL, me->GetOwnerGUID()); } else i_victimGuid = 0;}
开发者ID:Exodius,项目名称:ZapekFapeCore,代码行数:71,
注:本文中的u_check函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ u_entity函数代码示例 C++ u_arraylist_length函数代码示例 |