本文整理汇总了C++中Aura::GetSpellProto方法的典型用法代码示例。如果您正苦于以下问题:C++ Aura::GetSpellProto方法的具体用法?C++ Aura::GetSpellProto怎么用?C++ Aura::GetSpellProto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura
的用法示例。
在下文中一共展示了Aura::GetSpellProto方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMSTime
SPELL_EFFECT_OVERRIDE_RETURNS AH_17( Aura *aur, bool apply, uint8 i )
{
if( apply == false && aur->GetSpellProto()->eff[i].EffectApplyAuraName == SPELL_AURA_SCHOOL_ABSORB )
{
Absorb *abs = (Absorb*)aur->temp_custom_structure_holder;
if( abs && abs->amt <= 0 )
{
Unit * caster = aur->GetUnitCaster();
if( caster )
{
Aura *a = caster->HasAuraWithNameHash( SPELL_HASH_RAPTURE, 0, AURA_SEARCH_PASSIVE );
if( a )
{
//ever initialized ?
if( a->m_modList[0].fixed_amount[0] < (int32)getMSTime() )
{
uint32 energize_pct = a->GetSpellProto()->eff[0].EffectBasePoints;
Aura *b = caster->HasAuraWithNameHash( SPELL_HASH_ITEM___PRIEST_T13_HEALER_4P_BONUS__HOLY_WORD_AND_POWER_WORD__SHIELD_, 0, AURA_SEARCH_PASSIVE );
if( b )
energize_pct += b->GetSpellProto()->eff[1].EffectBasePoints;
caster->Energize( caster, 47755, caster->GetMaxPower( POWER_TYPE_MANA ) * energize_pct / 100, POWER_TYPE_MANA, 0 );
a->m_modList[0].fixed_amount[0] = getMSTime() + a->GetSpellProto()->proc_interval; // 12 seconds
}
}
}
}
}
return SPELL_EFFECT_OVERRIDE_CONTINUE_EXECUTION;
}
示例2: MassDispel
void AuraInterface::MassDispel(Unit* caster, uint32 index, SpellEntry* Dispelling, uint32 MaxDispel, uint8 start, uint8 end)
{
WorldPacket data(SMSG_SPELLDISPELLOG, 16);
Aura* aur = NULL;
for(uint32 x = start; x < end; x++)
{
if(m_auras.find(x) != m_auras.end())
{
aur = m_auras.at(x);
//Nothing can dispel resurrection sickness;
if(aur != NULL && !aur->IsPassive() && !(aur->GetSpellProto()->Attributes & ATTRIBUTES_IGNORE_INVULNERABILITY))
{
int32 resistchance = 0;
Unit* caster = aur->GetUnitCaster();
if( caster )
SM_FIValue(caster->SM[SMT_RESIST_DISPEL][0], &resistchance, aur->GetSpellProto()->SpellGroupType);
if( !Rand(resistchance) )
{
if(Dispelling->DispelType == DISPEL_ALL)
{
m_Unit->HandleProc( PROC_ON_DISPEL_AURA_VICTIM, NULL, caster, Dispelling, aur->GetSpellId() );
data.clear();
data << caster->GetNewGUID();
data << m_Unit->GetNewGUID();
data << (uint32)1;//probably dispel type
data << aur->GetSpellId();
caster->SendMessageToSet(&data,true);
aur->AttemptDispel( caster );
if(!--MaxDispel)
return;
}
else if(aur->GetSpellProto()->DispelType == Dispelling->EffectMiscValue[index])
{
if( (aur->GetSpellProto()->NameHash != SPELL_HASH_ICE_BARRIER &&
aur->GetSpellProto()->NameHash != SPELL_HASH_DIVINE_SHIELD)
|| Dispelling->NameHash == SPELL_HASH_MASS_DISPEL )
{
m_Unit->HandleProc( PROC_ON_DISPEL_AURA_VICTIM, NULL, caster, Dispelling, aur->GetSpellId() );
data.clear();
data << caster->GetNewGUID();
data << m_Unit->GetNewGUID();
data << (uint32)1;
data << aur->GetSpellId();
caster->SendMessageToSet(&data,true);
aur->AttemptDispel( caster );
if(!--MaxDispel)
return;
}
}
}
else if( !--MaxDispel )
return;
}
}
}
}
示例3: DeathStrike
bool DeathStrike(uint32 i, Spell* pSpell)
{
if(pSpell->p_caster == NULL || pSpell->GetUnitTarget() == NULL)
return true;
Unit* Target = pSpell->GetUnitTarget();
int count = 0;
if(Target->HasAura(BLOOD_PLAGUE))
count++;
if(Target->HasAura(FROST_FEVER))
count++;
if(Target->HasAurasWithNameHash(SPELL_HASH_EBON_PLAGUE))
count++;
if(Target->HasAurasWithNameHash(SPELL_HASH_CRYPT_FEVER))
count++;
count = min(count, 3); //limited to 15% incase spell uniques are wrong for ebon plague and crypt fever
if(count)
{
float pct = pSpell->p_caster->GetMaxHealth() * 0.05f;
uint32 val = float2int32(pct * count);
Aura* aur = pSpell->p_caster->FindAuraByNameHash(SPELL_HASH_IMPROVED_DEATH_STRIKE);
if(aur != NULL)
val += val * (aur->GetSpellProto()->EffectBasePoints[2] + 1) / 100;
if(val > 0)
pSpell->u_caster->Heal(pSpell->u_caster, pSpell->GetProto()->Id, val);
}
return true;
}
示例4: DeathStrike
bool DeathStrike(uint32 i, Spell* pSpell)
{
if(pSpell->p_caster == NULL || pSpell->GetUnitTarget() == NULL)
return true;
Unit* Target = pSpell->GetUnitTarget();
// Get count of diseases on target which were casted by caster
uint32 count = Target->GetAuraCountWithDispelType(DISPEL_DISEASE, pSpell->p_caster->GetGUID());
// Not a logical error, Death Strike should heal only when diseases are presented on its target
if(count)
{
// Calculate heal amount:
// A deadly attack that deals $s2% weapon damage plus ${$m1*$m2/100}
// and heals the Death Knight for $F% of $Ghis:her; maximum health for each of $Ghis:her; diseases on the target.
// $F is dmg_multiplier.
float amt = static_cast< float >(pSpell->p_caster->GetMaxHealth()) * pSpell->GetProto()->dmg_multiplier[0] / 100.0f;
// Calculate heal amount with diseases on target
uint32 val = static_cast< uint32 >(amt * count);
Aura* aur = pSpell->p_caster->FindAuraByNameHash(SPELL_HASH_IMPROVED_DEATH_STRIKE);
if(aur != NULL)
val += val * (aur->GetSpellProto()->EffectBasePoints[2] + 1) / 100;
if(val > 0)
pSpell->u_caster->Heal(pSpell->u_caster, pSpell->GetProto()->Id, val);
}
return true;
}
示例5: PrepareSpellForAutocast
void FelhunterAI::PrepareSpellForAutocast(uint32 spellID)
{
if (!spellID)
return;
if (sSpellMgr.GetFirstSpellInChain(spellID) == 19505) // Devour Magic
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID);
Unit *target = me->getVictim();
if (!spellInfo || !target)
return;
Unit::AuraMap const& auras = target->GetAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Aura *aur = (*itr).second;
if (aur && aur->GetSpellProto()->Dispel == DISPEL_MAGIC)
{
if (aur->IsPositive())
{
AddSpellForAutocast(spellID, target);
return;
}
}
}
}
else
PetAI::PrepareSpellForAutocast(spellID);
}
示例6: HandleScriptEffect
void HandleScriptEffect(SpellEffIndex effIndex)
{
Unit* caster = GetCaster();
Unit* unitTarget = GetHitUnit();
if (!unitTarget)
return;
uint32 spellId = 0;
int32 basePoint = 0;
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
{
Aura* aura = i->second->GetBase();
if (aura->GetCasterGUID() != caster->GetGUID())
continue;
// Search only Serpent Sting, Viper Sting, Scorpid Sting auras
flag96 familyFlag = aura->GetSpellProto()->SpellFamilyFlags;
if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
continue;
if (AuraEffect const * aurEff = aura->GetEffect(0))
{
// Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
if (familyFlag[0] & 0x4000)
{
int32 TickCount = aurEff->GetTotalTicks();
spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
basePoint = aurEff->GetAmount() * TickCount * 40 / 100;
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
else if (familyFlag[1] & 0x00000080)
{
int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER;
// Amount of one aura tick
basePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 100 ;
int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50 ;
if (basePoint > casterBasePoint)
basePoint = casterBasePoint;
basePoint = basePoint * TickCount * 60 / 100;
}
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
else if (familyFlag[0] & 0x00008000)
spellId = HUNTER_SPELL_CHIMERA_SHOT_SCORPID;
// ?? nothing say in spell desc (possibly need addition check)
//if (familyFlag & 0x0000010000000000LL || // dot
// familyFlag & 0x0000100000000000LL) // stun
//{
// spellId = 53366; // 53366 Chimera Shot - Wyvern
//}
// Refresh aura duration
aura->RefreshDuration();
}
break;
}
if (spellId)
caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, false);
}
示例7: HasAura
bool PlayerbotAI::HasAura(string name, Unit* unit)
{
if (!unit)
return false;
uint32 spellId = aiObjectContext->GetValue<uint32>("spell id", name)->Get();
if (spellId)
return HasAura(spellId, unit);
wstring wnamepart;
if (!Utf8toWStr(name, wnamepart))
return 0;
wstrToLower(wnamepart);
for (uint32 auraType = SPELL_AURA_BIND_SIGHT; auraType < TOTAL_AURAS; auraType++)
{
Unit::AuraList const& auras = unit->GetAurasByType((AuraType)auraType);
for (Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); i++)
{
Aura* aura = *i;
if (!aura)
continue;
const string auraName = aura->GetSpellProto()->SpellName[0];
if (auraName.empty() || auraName.length() != wnamepart.length() || !Utf8FitTo(auraName, wnamepart))
continue;
if (IsRealAura(bot, aura, unit))
return true;
}
}
return false;
}
示例8: CloakOfShadows
bool CloakOfShadows(uint32 i, Spell* s)
{
Unit* unitTarget = s->GetUnitTarget();
if(!unitTarget || !unitTarget->isAlive())
return false;
Aura* pAura;
for(uint32 j = MAX_NEGATIVE_AURAS_EXTEDED_START; j < MAX_NEGATIVE_AURAS_EXTEDED_END; ++j)
{
pAura = unitTarget->m_auras[j];
if(pAura != NULL && !pAura->IsPassive()
&& !pAura->IsPositive()
&& !(pAura->GetSpellProto()->Attributes & ATTRIBUTES_IGNORE_INVULNERABILITY)
&& pAura->GetSpellProto()->School != 0
)
pAura->Remove();
}
return true;
}
示例9: castDispel
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;
}
示例10: SpellStealAuras
void AuraInterface::SpellStealAuras(Unit* caster, int32 MaxSteals)
{
Aura* aur = NULL;
int32 spells_to_steal = MaxSteals > 1 ? MaxSteals : 1;
for(uint32 x = 0; x < MAX_POSITIVE_AURAS; x++)
{
if(m_auras.find(x) != m_auras.end())
{
aur = m_auras.at(x);
if(aur != NULL && aur->GetSpellId() != 15007 && !aur->IsPassive() && aur->IsPositive()) //Nothing can dispel resurrection sickness
{
if(aur->GetSpellProto()->DispelType == DISPEL_MAGIC && aur->GetDuration() > 0)
{
WorldPacket data(SMSG_SPELLDISPELLOG, 16);
data << caster->GetNewGUID();
data << m_Unit->GetNewGUID();
data << uint32(1);
data << aur->GetSpellId();
caster->SendMessageToSet(&data,true);
Aura* aura = new Aura(aur->GetSpellProto(), (aur->GetDuration()>120000) ? 120000 : aur->GetDuration(), caster, caster);
aura->stackSize = aur->stackSize;
// copy the mods across
for( uint32 m = 0; m < aur->GetModCount(); ++m )
{
Modifier *mod = aur->GetMod(m);
aura->AddMod(mod->m_type, mod->m_baseAmount, mod->m_miscValue, mod->i);
}
caster->AddAura(aura);
RemoveAuraBySlot(x);
if( --spells_to_steal <= 0 )
break; //exit loop now
}
}
}
}
}
示例11: SkyShatterRegalia
bool SkyShatterRegalia(uint32 i, Spell* s)
{
// Shaman - Skyshatter Regalia - Two Piece Bonus
// it checks for earth, air, water, fire totems and triggers Totemic Mastery spell 38437.
if(!s->p_caster)
return false;
if(s->p_caster->summonhandler.HasSummonInSlot(0) &&
s->p_caster->summonhandler.HasSummonInSlot(1) &&
s->p_caster->summonhandler.HasSummonInSlot(2) &&
s->p_caster->summonhandler.HasSummonInSlot(3))
{
Aura* aur = sSpellFactoryMgr.NewAura(dbcSpell.LookupEntry(38437), 5000, s->p_caster, s->p_caster, true);
for(uint32 j = 0; j < 3; j++)
aur->AddMod(aur->GetSpellProto()->eff[j].EffectApplyAuraName, aur->GetSpellProto()->eff[j].EffectBasePoints + 1, aur->GetSpellProto()->eff[j].EffectMiscValue, j);
s->p_caster->AddAura(aur);
}
return true;
}
示例12: DoAfterHandleEffect
void DoAfterHandleEffect(Unit* target, uint32 i)
{
if(p_caster == NULL || i != 1)
return;
Aura* aur = p_caster->FindAuraByNameHash(SPELL_HASH_SUDDEN_DOOM);
if(aur == NULL)
return;
if(! Rand(aur->GetSpellProto()->procChance))
return;
p_caster->CastSpell(target, 47632, false);
}
示例13: DoEffect
bool DoEffect(Unit* victim, SpellEntry* CastingSpell, uint32 flag, uint32 dmg, uint32 abs, int* dmg_overwrite, uint32 weapon_damage_type)
{
Aura* aura = mTarget->FindAuraByNameHash(SPELL_HASH_SLICE_AND_DICE);
if(aura)
{
// Duration of 5 combo maximum
int32 dur = 21 * MSTIME_SECOND;
SM_FIValue(mTarget->SM_FDur, &dur, aura->GetSpellProto()->SpellGroupType);
SM_PIValue(mTarget->SM_PDur, &dur, aura->GetSpellProto()->SpellGroupType);
// Set new aura's duration, reset event timer and set client visual aura
aura->SetDuration(dur);
sEventMgr.ModifyEventTimeLeft(aura, EVENT_AURA_REMOVE, aura->GetDuration());
mTarget->ModVisualAuraStackCount(aura, 0);
}
return true;
}
示例14: HandleScriptEffect
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00000002, 0, 0, caster->GetGUID()))
{
Aura* aura = aurEff->GetBase();
uint32 countMin = aura->GetMaxDuration();
uint32 countMax = GetSpellMaxDuration(aura->GetSpellProto()) + 9000;
if (caster->HasAura(DRUID_INCREASED_MOONFIRE_DURATION))
countMax += 3000;
if (caster->HasAura(DRUID_NATURES_SPLENDOR))
countMax += 3000;
if (countMin < countMax)
{
aura->SetDuration(uint32(aura->GetDuration() + 3000));
aura->SetMaxDuration(countMin + 3000);
}
}
}
示例15: HandleCastSpellOpcode
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
{
uint32 spellId;
uint8 cast_count, unk_flags;
recvPacket >> cast_count;
recvPacket >> spellId;
recvPacket >> unk_flags; // flags (if 0x02 - some additional data are received)
// ignore for remote control state (for player case)
Unit* _mover = GetPlayer()->GetMover();
if (_mover != GetPlayer() && _mover->GetTypeId()==TYPEID_PLAYER)
{
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
}
DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i",
spellId, cast_count, unk_flags, (uint32)recvPacket.size());
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
if(!spellInfo)
{
sLog.outError("WORLD: unknown spell id %u", spellId);
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
}
// Players on vehicles may cast many simple spells (like knock) from self
Unit* mover = NULL;
if (spellInfo->AttributesEx6 & SPELL_ATTR_EX6_CASTABLE_ON_VEHICLE && _mover->IsCharmerOrOwnerPlayerOrPlayerItself())
mover = _mover->GetCharmerOrOwnerPlayerOrPlayerItself();
else
mover = _mover;
// casting own spells on some vehicles
if (mover->GetObjectGuid().IsVehicle() && mover->GetCharmerOrOwnerPlayerOrPlayerItself())
{
Player *plr = mover->GetCharmerOrOwnerPlayerOrPlayerItself();
if (mover->GetVehicleKit()->GetSeatInfo(plr) &&
(mover->GetVehicleKit()->GetSeatInfo(plr)->m_flags & SEAT_FLAG_CAN_ATTACK ||
mover->GetVehicleKit()->GetSeatInfo(plr)->m_flags & SEAT_FLAG_CAN_CAST ))
mover = plr;
}
bool triggered = false;
SpellEntry const* triggeredBy = NULL;
Aura* triggeredByAura = mover->GetTriggeredByClientAura(spellId);
if (triggeredByAura)
{
triggered = true;
triggeredBy = triggeredByAura->GetSpellProto();
cast_count = 0;
}
if (mover->GetTypeId()==TYPEID_PLAYER)
{
// not have spell in spellbook or spell passive and not casted by client
if (((((Player*)mover)->GetUInt16Value(PLAYER_FIELD_BYTES2, 0) == 0 &&
(!((Player*)mover)->HasActiveSpell(spellId) && !triggered))
|| IsPassiveSpell(spellInfo)) && spellId != 1843)
{
sLog.outError("WorldSession::HandleCastSpellOpcode: %s casts spell %u which he shouldn't have", mover->GetObjectGuid().GetString().c_str(), spellId);
//cheater? kick? ban?
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
}
}
else
{
// not have spell in spellbook or spell passive and not casted by client
if ((!((Creature*)mover)->HasSpell(spellId) && !triggered)
|| IsPassiveSpell(spellInfo))
{
sLog.outError("WorldSession::HandleCastSpellOpcode: %s try casts spell %u which he shouldn't have", mover->GetObjectGuid().GetString().c_str(), spellId);
//cheater? kick? ban?
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
}
}
// client provided targets
SpellCastTargets targets;
recvPacket >> targets.ReadForCaster(mover);
// some spell cast packet including more data (for projectiles?)
if (unk_flags & 0x02)
targets.ReadAdditionalData(recvPacket);
// auto-selection buff level base at target level (in spellInfo)
if (Unit* target = targets.getUnitTarget())
{
// if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message
if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel()))
spellInfo = actualSpellInfo;
}
//.........这里部分代码省略.........