您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ IsPet函数代码示例

51自学网 2021-06-01 21:42:23
  C++
这篇教程C++ IsPet函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中IsPet函数的典型用法代码示例。如果您正苦于以下问题:C++ IsPet函数的具体用法?C++ IsPet怎么用?C++ IsPet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了IsPet函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ForcedUnsummonDelayEvent

void TempSummon::UnSummon(uint32 msTime){    if (msTime)    {        ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this);        m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));        return;    }    //ASSERT(!IsPet());    if (IsPet())    {        ((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);        ASSERT(!IsInWorld());        return;    }    Unit* owner = GetSummoner();    if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)        owner->ToCreature()->AI()->SummonedCreatureDespawn(this);    //npcbot    if (GetIAmABot() || GetIAmABotsPet())    {        //TC_LOG_ERROR("entities.player", "TempSummon::UnSummon(): Trying to unsummon Bot %s (guidLow: %u owner: %s)", GetName().c_str(), GetGUIDLow(), GetBotOwner()->GetName().c_str());        if (IsTempBot())            AI()->JustDied(NULL);        return;    }    //end npcbots    AddObjectToRemoveList();}
开发者ID:GlassFace,项目名称:XC_CORE,代码行数:34,


示例2: heal

//healing and buffing aggroint32 Mob::CheckHealAggroAmount(uint16 spell_id, Mob *target, uint32 heal_possible){	int32 AggroAmount = 0;	auto target_level = target ? target->GetLevel() : 1;	bool ignore_default_buff = false; // rune/hot don't use the default 9, HP buffs that heal (virtue) do use the default	for (int o = 0; o < EFFECT_COUNT; o++) {		switch (spells[spell_id].effectid[o]) {		case SE_CurrentHP: {			if (heal_possible == 0) {				AggroAmount += 1;				break;			}			// hate based on base healing power of the spell			int val = CalcSpellEffectValue_formula(spells[spell_id].formula[o],							 spells[spell_id].base[o], spells[spell_id].max[o], GetLevel(), spell_id);			if (val > 0) {				if (heal_possible < val)					val = heal_possible; // capped to amount healed				val = 2 * val / 3; // 3:2 ratio				if (target_level > 50 && val > 1500)					val = 1500; // target 51+ seems ~1500				else if (target_level <= 50 && val > 800)					val = 800; // per live patch notes, capped to 800			}			AggroAmount += std::max(val, 1);			break;		}		case SE_Rune:			AggroAmount += CalcSpellEffectValue_formula(spells[spell_id].formula[o],							 spells[spell_id].base[o], spells[spell_id].max[o], GetLevel(), spell_id) * 2;			ignore_default_buff = true;			break;		case SE_HealOverTime:			AggroAmount += 10;			ignore_default_buff = true;			break;		default:			break;		}	}	if (GetOwner() && IsPet())		AggroAmount = AggroAmount * RuleI(Aggro, PetSpellAggroMod) / 100;	if (!ignore_default_buff && IsBuffSpell(spell_id) && IsBeneficialSpell(spell_id))		AggroAmount = IsBardSong(spell_id) ? 2 : 9;	if (AggroAmount > 0) {		int HateMod = RuleI(Aggro, SpellAggroMod);		HateMod += GetFocusEffect(focusSpellHateMod, spell_id);		//Live AA - Spell casting subtlety		HateMod += aabonuses.hatemod + spellbonuses.hatemod + itembonuses.hatemod;		AggroAmount = (AggroAmount * HateMod) / 100;	}	return std::max(0, AggroAmount);}
开发者ID:kimura7150,项目名称:Server,代码行数:61,


示例3: ForcedUnsummonDelayEvent

void TempSummon::UnSummon(uint32 msTime){     if (msTime)    {        ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this);        m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));        return;    }	// Dont allow to call this function twice (possible)	if (m_type == TEMPSUMMON_DESPAWNED)		return;	SetTempSummonType(TEMPSUMMON_DESPAWNED);    //ASSERT(!IsPet());    if (IsPet())    {        ((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);        ASSERT(!IsInWorld());        return;    }    Unit* owner = GetSummoner();    if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)        owner->ToCreature()->AI()->SummonedCreatureDespawn(this);    AddObjectToRemoveList();}
开发者ID:Cryostorm,项目名称:SunwellCore,代码行数:29,


示例4: GetStat

void Guardian::UpdateAttackPowerAndDamage(bool ranged){    if (ranged)        return;    float val = 0.0f;    float bonusAP = 0.0f;    UnitMods unitMod = UNIT_MOD_ATTACK_POWER;    if (GetEntry() == 416)                                   // imp's attack power        val = GetStat(STAT_STRENGTH) - 10.0f;    else        val = 2 * GetStat(STAT_STRENGTH) - 20.0f;    Unit* owner = GetOwner();    if (owner && owner->GetTypeId() == TYPEID_PLAYER)    {        if (IsHunterPet())                      //hunter pets benefit from owner's attack power        {            bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f;            SetBonusDamage(int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.125f));        }        //demons benefit from warlocks shadow or fire damage        else if (IsPet() && owner->getClass() == CLASS_WARLOCK)        {            int32 fire  = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);            int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);            int32 maximum  = (fire > shadow) ? fire : shadow;            if (maximum < 0)                maximum = 0;            SetBonusDamage(int32(maximum * 0.15f));            bonusAP = maximum * 0.57f;        }        //water elementals benefit from mage's frost damage        else if (GetEntry() == 510 && owner->getClass() == CLASS_MAGE)        {            int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);            if (frost < 0)                frost = 0;            SetBonusDamage(int32(frost * 0.4f));        }    }    SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, val + bonusAP);    //in BASE_VALUE of UNIT_MOD_ATTACK_POWER for creatures we store data of meleeattackpower field in DB    float base_attPower  = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);    float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);    float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;    //UNIT_FIELD_(RANGED)_ATTACK_POWER field    SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)base_attPower);    //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field    SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, (int32)attPowerMod);    //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field    SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, attPowerMultiplier);    //automatically update weapon damage after attack power modification    UpdateDamagePhysical(BASE_ATTACK);}
开发者ID:gitter-badger,项目名称:OregonCore,代码行数:60,


示例5: MakeNewPositionAndSendUpdate

bool Mob::CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ) {	if(IsNPC() || IsClient() || IsPet()) {		pRunAnimSpeed = (int8)(speed*NPC_RUNANIM_RATIO);		speed *= NPC_SPEED_MULTIPLIER;	}	return MakeNewPositionAndSendUpdate(x, y, z, speed, checkZ);}
开发者ID:Leere,项目名称:Server,代码行数:8,


示例6: switch

//healing and buffing aggroint32 Mob::CheckHealAggroAmount(uint16 spellid, uint32 heal_possible) {	uint16 spell_id = spellid;	int32 AggroAmount = 0;	for (int o = 0; o < EFFECT_COUNT; o++) {		switch(spells[spell_id].effectid[o]) {			case SE_CurrentHP: {				AggroAmount += spells[spell_id].mana;				break;			}			case SE_Rune: {				AggroAmount += CalcSpellEffectValue_formula(spells[spell_id].formula[0], spells[spell_id].base[0], spells[spell_id].max[o], this->GetLevel(), spellid) * 2;				break;			}			case SE_HealOverTime:{				AggroAmount += CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], this->GetLevel(), spell_id);				break;			}			default:{				break;			}		}	}	if (IsBardSong(spell_id))		AggroAmount = AggroAmount * RuleI(Aggro, SongAggroMod) / 100;	if (GetOwner() && IsPet())		AggroAmount = AggroAmount * RuleI(Aggro, PetSpellAggroMod) / 100;	if(AggroAmount > 0)	{		int HateMod = RuleI(Aggro, SpellAggroMod);		if(IsClient())		{			HateMod += CastToClient()->GetFocusEffect(focusSpellHateMod, spell_id);		}		//Live AA - Spell casting subtlety		HateMod += aabonuses.hatemod + spellbonuses.hatemod + itembonuses.hatemod;		AggroAmount = (AggroAmount * HateMod) / 100;		//made up number probably scales a bit differently on live but it seems like it will be close enough		//every time you cast on live you get a certain amount of "this is a spell" aggro		//confirmed by EQ devs to be 100 exactly at level 85. From their wording it doesn't seem like it's affected		//by hate modifiers either.		//AggroAmount += (slevel*slevel/72); // Moved Below	}	if(AggroAmount < 0)		return 0;	else		return AggroAmount;}
开发者ID:badcaptain,项目名称:Server,代码行数:58,


示例7: GetTypeName

std::string ObjectGuid::ToString() const{    std::ostringstream str;    str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << _guid << std::dec;    str << " Type: " << GetTypeName();    if (HasEntry())        str << (IsPet() ? " Pet number: " : " Entry: ") << GetEntry() << " ";    str << " Low: " << GetCounter();    return str.str();}
开发者ID:Aravu,项目名称:Talador-Project,代码行数:11,


示例8: GetTotalAuraModValue

void Guardian::UpdateResistances(uint32 school){    if (school > SPELL_SCHOOL_NORMAL)    {        float value  = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school));        // hunter and warlock pets gain 40% of owner's resistance        if (IsPet())            value += float(CalculatePct(m_owner->GetResistance(SpellSchools(school)), 40));        SetResistance(SpellSchools(school), int32(value));    }    else        UpdateArmor();}
开发者ID:AnthoDevMoP,项目名称:SkyFire_5xx,代码行数:15,


示例9: GetTotalAuraModValue

void Guardian::UpdateResistances(uint32 school){    if (school > SPELL_SCHOOL_NORMAL)    {        float value  = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school));        Unit* owner = GetOwner();        // hunter and warlock pets gain 40% of owner's resistance        if (owner && (IsHunterPet() || (IsPet() && owner->getClass() == CLASS_WARLOCK)))            value += float(owner->GetResistance(SpellSchools(school))) * 0.4f;        SetResistance(SpellSchools(school), int32(value));    }    else        UpdateArmor();}
开发者ID:gitter-badger,项目名称:OregonCore,代码行数:16,


示例10: ASSERT

void TempSummon::InitStats(uint32 duration){     ASSERT(!IsPet());    m_timer = duration;    m_lifetime = duration;    if (m_type == TEMPSUMMON_MANUAL_DESPAWN)        m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;    Unit* owner = GetSummoner();    if (owner)	{		if (IsTrigger() && m_spells[0])		{			setFaction(owner->getFaction());			SetLevel(owner->getLevel());			if (owner->GetTypeId() == TYPEID_PLAYER)				m_ControlledByPlayer = true;		}		if (owner->GetTypeId() == TYPEID_PLAYER)			m_CreatedByPlayer = true;    }    if (!m_Properties)        return;    if (owner)    {        if (uint32 slot = m_Properties->Slot)        {            if (owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID())            {                Creature* oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]);                if (oldSummon && oldSummon->IsSummon())                    oldSummon->ToTempSummon()->UnSummon();            }            owner->m_SummonSlot[slot] = GetGUID();        }    }    if (m_Properties->Faction)        setFaction(m_Properties->Faction);    else if (IsVehicle() && owner) // properties should be vehicle        setFaction(owner->getFaction());}
开发者ID:Cryostorm,项目名称:SunwellCore,代码行数:47,


示例11: UseDiscipline

bool Client::UseDiscipline(uint8 disc_id){    // Dont let client waste a reuse timer if they can't use the disc    if (IsStunned() || IsFeared() || IsMezzed() || IsAmnesiad() || IsPet())    {        return(false);    }    //Check the disc timer    uint32 remain = p_timers.GetRemainingTime(pTimerDisciplineReuseStart);    if(remain > 0 && !GetGM())    {        char val1[20]= {0};        char val2[20]= {0};        Message_StringID(CC_User_Disciplines, DISCIPLINE_CANUSEIN, ConvertArray((remain)/60,val1), ConvertArray(remain%60,val2));        return(false);    }    bool active = disc_ability_timer.Enabled();    if(active)    {        Message(CC_User_Disciplines, "You must wait before using this discipline."); //find correct message        return(false);    }    //can we use the disc? the client checks this for us, but we should also confirm server side.    uint8 level_to_use = DisciplineUseLevel(disc_id);    if(level_to_use > GetLevel() || level_to_use == 0) {        Message_StringID(CC_User_Disciplines, DISC_LEVEL_USE_ERROR);        return(false);    }    // Disciplines with no ability timer (ashenhand, silentfist, thunderkick, and unholyaura) will remain on the player until they either    // use the skill the disc affects successfully, camp/zone, or attempt to use another disc. If we're here, clear that disc so they can    // cast a new one.    if(GetActiveDisc() != 0)    {        Log.Out(Logs::General, Logs::Discs, "Clearing disc %d so that disc %d can be cast.", GetActiveDisc(), disc_id);        FadeDisc();    }    //cast the disc    if(CastDiscipline(disc_id, level_to_use))        return(true);    else        return(false);}
开发者ID:jcon321,项目名称:Server,代码行数:47,


示例12: GetTotalStatValue

bool Guardian::UpdateStats(Stats stat){    if (stat > STAT_SPIRIT)        return false;    // value = ((base_value * base_pct) + total_value) * total_pct    float value  = GetTotalStatValue(stat);    Unit* owner = GetOwner();    if (stat == STAT_STAMINA)    {        if (owner && (IsHunterPet() || owner->getClass() == CLASS_WARLOCK))            value += float(owner->GetStat(stat)) * 0.3f;    }    //warlock's and mage's pets gain 30% of owner's intellect    else if (stat == STAT_INTELLECT && IsPet())    {        if (owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))            value += float(owner->GetStat(stat)) * 0.3f;    }    SetStat(stat, int32(value));    switch (stat)    {    case STAT_STRENGTH:        UpdateAttackPowerAndDamage();        break;    case STAT_AGILITY:        UpdateArmor();        break;    case STAT_STAMINA:        UpdateMaxHealth();        break;    case STAT_INTELLECT:        UpdateMaxPower(POWER_MANA);        break;    case STAT_SPIRIT:    default:        break;    }    return true;}
开发者ID:gitter-badger,项目名称:OregonCore,代码行数:44,


示例13: GetOwner

void Guardian::UpdateArmor(){    float value = 0.0f;    float bonus_armor = 0.0f;    UnitMods unitMod = UNIT_MOD_ARMOR;    Unit* owner = GetOwner();    // hunter and warlock pets gain 35% of owner's armor value    if (owner && (IsHunterPet() || (IsPet() && owner->getClass() == CLASS_WARLOCK)))        bonus_armor = 0.35f * float(owner->GetArmor());    value  = GetModifierValue(unitMod, BASE_VALUE);    value *= GetModifierValue(unitMod, BASE_PCT);    value += GetStat(STAT_AGILITY) * 2.0f;    value += GetModifierValue(unitMod, TOTAL_VALUE) + bonus_armor;    value *= GetModifierValue(unitMod, TOTAL_PCT);    SetArmor(int32(value));}
开发者ID:gitter-badger,项目名称:OregonCore,代码行数:19,


示例14: float

void Guardian::UpdateArmor(){    float value = 0.0f;    float bonus_armor = 0.0f;    UnitMods unitMod = UNIT_MOD_ARMOR;    // hunter pets gain 35% of owner's armor value, warlock pets gain 100% of owner's armor    if (IsHunterPet())        bonus_armor = float(CalculatePct(m_owner->GetArmor(), 70));    else if (IsPet())        bonus_armor = m_owner->GetArmor();    value  = GetModifierValue(unitMod, BASE_VALUE);    value *= GetModifierValue(unitMod, BASE_PCT);    value += GetModifierValue(unitMod, TOTAL_VALUE) + bonus_armor;    value *= GetModifierValue(unitMod, TOTAL_PCT);    SetArmor(int32(value));}
开发者ID:AnthoDevMoP,项目名称:SkyFire_5xx,代码行数:19,


示例15: RemoveAllAuras

void Creature::RemoveFromWorld(bool addrespawnevent, bool free_guid){	RemoveAllAuras();		if(IsPet()) /* Is a pet: IsPet() actually returns false on a pet? o_X */	{		if(IsInWorld())			Unit::RemoveFromWorld(true);		SafeDelete();		return;	}	if(IsInWorld())	{		uint32 delay = 0;		if(addrespawnevent && proto && proto->RespawnTime > 0)			delay = proto->RespawnTime;		Despawn(0, delay);	}}
开发者ID:AwkwardDev,项目名称:ascent_classic,代码行数:21,


示例16: ForcedUnsummonDelayEvent

void TempSummon::UnSummon(uint32 msTime){    if (msTime)    {        ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this);        m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));        return;    }    //ASSERT(!IsPet());    if (IsPet())    {        ((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);        ASSERT(!IsInWorld());        return;    }    Unit* owner = GetSummoner();    if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)        owner->ToCreature()->AI()->SummonedCreatureDespawn(this);    AddObjectToRemoveList();}
开发者ID:oMadMano,项目名称:MistyWorld_6xx,代码行数:24,


示例17: GetLevel

//.........这里部分代码省略.........			case SE_INT:			case SE_WIS:			case SE_CHA: {				int val = CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], slevel, spell_id);				if (val < 0)					AggroAmount += 10;				break;			}			case SE_ResistAll: {				int val = CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], slevel, spell_id);				if (val < 0)					AggroAmount += 50;				break;			}			case SE_AllStats: {				int val = CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], slevel, spell_id);				if (val < 0)					AggroAmount += 70;				break;			}			case SE_BardAEDot:				AggroAmount += 10;				break;			case SE_SpinTarget:			case SE_Amnesia:			case SE_Silence:			case SE_Destroy:				AggroAmount += default_aggro;				break;			// unsure -- leave them this for now			case SE_Harmony:			case SE_CastingLevel:			case SE_MeleeMitigation:			case SE_CriticalHitChance:			case SE_AvoidMeleeChance:			case SE_RiposteChance:			case SE_DodgeChance:			case SE_ParryChance:			case SE_DualWieldChance:			case SE_DoubleAttackChance:			case SE_MeleeSkillCheck:			case SE_HitChance:			case SE_DamageModifier:			case SE_MinDamageModifier:			case SE_IncreaseBlockChance:			case SE_Accuracy:			case SE_DamageShield:			case SE_SpellDamageShield:			case SE_ReverseDS: {				AggroAmount += slevel * 2;				break;			}			// unsure -- leave them this for now			case SE_CurrentMana:			case SE_ManaRegen_v2:			case SE_ManaPool:			case SE_CurrentEndurance: {				int val = CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], slevel, spell_id);				if (val < 0)					AggroAmount -= val * 2;				break;			}			case SE_CancelMagic:			case SE_DispelDetrimental:				dispel = true;				break;			case SE_ReduceHate:			case SE_InstantHate:				nonModifiedAggro = CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], slevel, spell_id);				break;		}	}	if (IsBardSong(spell_id) && AggroAmount > 40)		AggroAmount = 40; // bard songs seem to cap to 40 for most of their spells?	if (dispel && target && target->GetHateAmount(this) < 100)		AggroAmount += 50;	if (spells[spell_id].HateAdded > 0) // overrides the hate (ex. tash)		AggroAmount = spells[spell_id].HateAdded;	if (GetOwner() && IsPet())		AggroAmount = AggroAmount * RuleI(Aggro, PetSpellAggroMod) / 100;	// hate focus ignored on first action for some reason	if (!on_hatelist && AggroAmount > 0) {		int HateMod = RuleI(Aggro, SpellAggroMod);		HateMod += GetFocusEffect(focusSpellHateMod, spell_id);		AggroAmount = (AggroAmount * HateMod) / 100;	}	// initial aggro gets a bonus 100 besides for dispel or hate override	// We add this 100 in AddToHateList so we need to account for the oddities here	if (dispel && spells[spell_id].HateAdded > 0 && !on_hatelist)		AggroAmount -= 100;	return AggroAmount + spells[spell_id].bonushate + nonModifiedAggro;}
开发者ID:AthrogatePEQ,项目名称:Server,代码行数:101,


示例18: IsPet

bool Minion::IsGuardianPet() const{    return IsPet() || (m_Properties && m_Properties->Category == SUMMON_CATEGORY_PET);}
开发者ID:oMadMano,项目名称:MistyWorld_6xx,代码行数:4,


示例19: UseDiscipline

bool Client::UseDiscipline(uint32 spell_id, uint32 target) {    // Dont let client waste a reuse timer if they can't use the disc    if (IsStunned() || IsFeared() || IsMezzed() || IsAmnesiad() || IsPet())    {        return(false);    }    //make sure we have the spell...    int r;    for(r = 0; r < MAX_PP_DISCIPLINES; r++) {        if(m_pp.disciplines.values[r] == spell_id)            break;    }    if(r == MAX_PP_DISCIPLINES)        return(false);	//not found.    //Check the disc timer    pTimerType DiscTimer = pTimerDisciplineReuseStart + spells[spell_id].EndurTimerIndex;    if(!p_timers.Expired(&database, DiscTimer)) {        /*char val1[20]={0};*/	//unused        /*char val2[20]={0};*/	//unused        uint32 remain = p_timers.GetRemainingTime(DiscTimer);        //Message_StringID(0, DISCIPLINE_CANUSEIN, ConvertArray((remain)/60,val1), ConvertArray(remain%60,val2));        Message(0, "You can use this discipline in %d minutes %d seconds.", ((remain)/60), (remain%60));        return(false);    }    //make sure we can use it..    if(!IsValidSpell(spell_id)) {        Message(13, "This tome contains invalid knowledge.");        return(false);    }    //can we use the spell?    const SPDat_Spell_Struct &spell = spells[spell_id];    uint8 level_to_use = spell.classes[GetClass() - 1];    if(level_to_use == 255) {        Message(13, "Your class cannot learn from this tome.");        //should summon them a new one...        return(false);    }    if(level_to_use > GetLevel()) {        Message_StringID(13, DISC_LEVEL_USE_ERROR);        //should summon them a new one...        return(false);    }    if(GetEndurance() > spell.EndurCost) {        SetEndurance(GetEndurance() - spell.EndurCost);    } else {        Message(11, "You are too fatigued to use this skill right now.");        return(false);    }    if(spell.recast_time > 0)    {        uint32 reduced_recast = spell.recast_time / 1000;        reduced_recast -= CastToClient()->GetFocusEffect(focusReduceRecastTime, spell_id);        if(reduced_recast < 0)            reduced_recast = 0;        CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast);        if(spells[spell_id].EndurTimerIndex < MAX_DISCIPLINE_TIMERS)        {            EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct));            DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer;            dts->TimerID = spells[spell_id].EndurTimerIndex;            dts->Duration = reduced_recast;            QueuePacket(outapp);            safe_delete(outapp);        }    }    else    {        CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT);    }    return(true);}
开发者ID:regneq,项目名称:projecteqemu,代码行数:79,


示例20: IsBuffSpell

void Aura::ProcessOnGroupMembersPets(Mob *owner){	auto &mob_list = entity_list.GetMobList(); // read only reference so we can do it all inline	std::set<int> delayed_remove;	bool is_buff = IsBuffSpell(spell_id); // non-buff spells don't cast on enter	// This type can either live on the pet (level 55/70 MAG aura) or on the pet owner (level 85 MAG aura)	auto group_member = owner->GetOwnerOrSelf();	if (group_member->IsRaidGrouped() && group_member->IsClient()) { // currently raids are just client, but safety check		auto raid = group_member->GetRaid();		if (raid == nullptr) { // well shit			owner->RemoveAura(GetID(), false, true);			return;		}		auto group_id = raid->GetGroup(group_member->CastToClient());		// some lambdas so the for loop is less horrible ...		auto verify_raid_client_pet = [&raid, &group_id, &group_member, this](Mob *m) {			auto idx = raid->GetPlayerIndex(m->GetOwner()->CastToClient());			if (m->GetOwner()->GetID() == group_member->GetID()) {				return DistanceSquared(GetPosition(), m->GetPosition()) <= distance;			} else if (idx == 0xFFFFFFFF || raid->members[idx].GroupNumber != group_id || raid->members[idx].GroupNumber == 0xFFFFFFFF) {				return false;			} else if (DistanceSquared(GetPosition(), m->GetPosition()) > distance) {				return false;			}			return true;		};		auto verify_raid_client_swarm = [&raid, &group_id, &group_member, this](NPC *n) {			auto owner = entity_list.GetMob(n->GetSwarmOwner());			if (owner == nullptr)				return false;			auto idx = raid->GetPlayerIndex(owner->CastToClient());			if (owner->GetID() == group_member->GetID()) {				return DistanceSquared(GetPosition(), n->GetPosition()) <= distance;			} else if (idx == 0xFFFFFFFF || raid->members[idx].GroupNumber != group_id || raid->members[idx].GroupNumber == 0xFFFFFFFF) {				return false;			} else if (DistanceSquared(GetPosition(), n->GetPosition()) > distance) {				return false;			}			return true;		};		for (auto &e : mob_list) {			auto mob = e.second;			// step 1: check if we're already managing this NPC's buff			auto it = casted_on.find(mob->GetID());			if (it != casted_on.end()) {				// verify still good!				if (mob->IsPet() && mob->IsPetOwnerClient() && mob->GetOwner()) {					if (!verify_raid_client_pet(mob))						delayed_remove.insert(mob->GetID());				} else if (mob->IsNPC() && mob->IsPetOwnerClient()) {					auto npc = mob->CastToNPC();					if (!verify_raid_client_swarm(npc))						delayed_remove.insert(mob->GetID());				}			} else { // we're not on it!				if (mob->IsClient()) {					continue; // never hit client				} else if (mob->IsPet() && mob->IsPetOwnerClient() && mob->GetOwner() && verify_raid_client_pet(mob)) {					casted_on.insert(mob->GetID());					if (is_buff)						SpellFinished(spell_id, mob);				} else if (mob->IsNPC() && mob->IsPetOwnerClient()) {					auto npc = mob->CastToNPC();					if (verify_raid_client_swarm(npc)) {						casted_on.insert(mob->GetID());						if (is_buff)							SpellFinished(spell_id, mob);					}				}			}		}	} else if (group_member->IsGrouped()) {		auto group = group_member->GetGroup();		if (group == nullptr) { // uh oh			owner->RemoveAura(GetID(), false, true);			return;		}		// lambdas to make for loop less ugly		auto verify_group_pet = [&group, this](Mob *m) {			auto owner = m->GetOwner();			if (owner != nullptr && group->IsGroupMember(owner) && DistanceSquared(GetPosition(), m->GetPosition()) <= distance)				return true;			return false;		};		auto verify_group_swarm = [&group, this](NPC *n) {			auto owner = entity_list.GetMob(n->GetSwarmOwner());			if (owner != nullptr && group->IsGroupMember(owner) && DistanceSquared(GetPosition(), n->GetPosition()) <= distance)				return true;			return false;		};		for (auto &e : mob_list) {			auto mob = e.second;			auto it = casted_on.find(mob->GetID());//.........这里部分代码省略.........
开发者ID:SecretsOTheP,项目名称:Server,代码行数:101,


示例21: GetStat

void Guardian::UpdateAttackPowerAndDamage(bool ranged){    if (ranged)        return;    float val = 0.0f;    float bonusAP = 0.0f;    UnitMods unitMod = UNIT_MOD_ATTACK_POWER;    if (GetEntry() == ENTRY_IMP)                                   // imp's attack power        val = GetStat(STAT_STRENGTH) - 10.0f;    else        val = 2 * GetStat(STAT_STRENGTH) - 20.0f;    Unit* owner = GetOwner();    if (owner && owner->GetTypeId() == TYPEID_PLAYER)    {        if (IsHunterPet())                      //hunter pets benefit from owner's attack power        {            float mod = 1.0f;                                                 //Hunter contribution modifier            bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;            SetBonusDamage(int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod));        }        else if (IsPetGhoul()) //ghouls benefit from deathknight's attack power (may be summon pet or not)        {            bonusAP = owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.22f;            SetBonusDamage(int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.1287f));        }        else if (IsSpiritWolf()) //wolf benefit from shaman's attack power        {            float dmg_multiplier = 0.31f;            if (m_owner->GetAuraEffect(63271, 0)) // Glyph of Feral Spirit                dmg_multiplier = 0.61f;            bonusAP = owner->GetTotalAttackPowerValue(BASE_ATTACK) * dmg_multiplier;            SetBonusDamage(int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * dmg_multiplier));        }        //demons benefit from warlocks shadow or fire damage        else if (IsPet())        {            int32 fire  = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) + owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);            int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) + owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);            int32 maximum  = (fire > shadow) ? fire : shadow;            if (maximum < 0)                maximum = 0;            SetBonusDamage(int32(maximum * 0.15f));            bonusAP = maximum * 0.57f;        }        //water elementals benefit from mage's frost damage        else if (GetEntry() == ENTRY_WATER_ELEMENTAL)        {            int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) + owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);            if (frost < 0)                frost = 0;            SetBonusDamage(int32(frost * 0.4f));        }    }    SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, val + bonusAP);    //in BASE_VALUE of UNIT_MOD_ATTACK_POWER for creatures we store data of meleeattackpower field in DB    float base_attPower  = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);    float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;    //UNIT_FIELD_(RANGED)_ATTACK_POWER field    SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)base_attPower);    //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field    SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, attPowerMultiplier);    //automatically update weapon damage after attack power modification    UpdateDamagePhysical(BASE_ATTACK);}
开发者ID:AnthoDevMoP,项目名称:SkyFire_5xx,代码行数:71,


示例22: ActivateAA

void Client::ActivateAA(aaID activate){	if (activate < 0 || activate >= aaHighestID)		return;	if (IsStunned() || IsFeared() || IsMezzed() || IsSilenced() || IsPet() || IsSitting() || GetFeigned())		return;	int AATimerID = GetAATimerID(activate);	SendAA_Struct* aa2 = nullptr;	aaID aaid = activate;	uint8 activate_val = GetAA(activate);	//this wasn't taking into acct multi tiered act talents before...	if (activate_val == 0){		aa2 = zone->FindAA(activate);		if (!aa2){			int i;			int a;			for (i = 1; i<MAX_AA_ACTION_RANKS; i++){				a = activate - i;				if (a <= 0)					break;				aa2 = zone->FindAA(a);				if (aa2 != nullptr)					break;			}		}		if (aa2){			aaid = (aaID)aa2->id;			activate_val = GetAA(aa2->id);		}	}	if (activate_val == 0){		return;	}	if (aa2)	{		if (aa2->account_time_required)		{			if ((Timer::GetTimeSeconds() + account_creation) < aa2->account_time_required)			{				return;			}		}	}	if (!p_timers.Expired(&database, AATimerID + pTimerAAStart))	{		uint32 aaremain = p_timers.GetRemainingTime(AATimerID + pTimerAAStart);		uint32 aaremain_hr = aaremain / (60 * 60);		uint32 aaremain_min = (aaremain / 60) % 60;		uint32 aaremain_sec = aaremain % 60;		if (aa2) {			if (aaremain_hr >= 1)	//1 hour or more				Message(CC_Red, "You can use the ability %s again in %u hour(s) %u minute(s) %u seconds",				aa2->name, aaremain_hr, aaremain_min, aaremain_sec);			else	//less than an hour				Message(CC_Red, "You can use the ability %s again in %u minute(s) %u seconds",				aa2->name, aaremain_min, aaremain_sec);		}		else {			if (aaremain_hr >= 1)	//1 hour or more				Message(CC_Red, "You can use this ability again in %u hour(s) %u minute(s) %u seconds",				aaremain_hr, aaremain_min, aaremain_sec);			else	//less than an hour				Message(CC_Red, "You can use this ability again in %u minute(s) %u seconds",				aaremain_min, aaremain_sec);		}		return;	}	if (activate_val > MAX_AA_ACTION_RANKS)		activate_val = MAX_AA_ACTION_RANKS;	activate_val--;		//to get array index.	//get our current node, now that the indices are well bounded	const AA_DBAction *caa = &AA_Actions[aaid][activate_val];	if ((aaid == aaImprovedHarmTouch || aaid == aaLeechTouch) && !p_timers.Expired(&database, pTimerHarmTouch)){		Message(CC_Red, "Ability recovery time not yet met.");		return;	}	//everything should be configured out now	uint16 target_id = 0;	//figure out our target	switch (caa->target) {	case aaTargetUser:	case aaTargetGroup:		target_id = GetID();		break;	case aaTargetCurrent:	case aaTargetCurrentGroup:		if (GetTarget() == nullptr) {			Message_StringID(MT_DefaultText, AA_NO_TARGET);	//You must first select a target for this ability!//.........这里部分代码省略.........
开发者ID:vingiarrusso,项目名称:Server,代码行数:101,


示例23: return

//.........这里部分代码省略.........		{			if (mob->GetBaseRace() != exclude->GetBaseRace())				continue;		}		Count++;	}	return Count;}void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {	if(!sender || !attacker)		return;	if (sender->GetPrimaryFaction() == 0 )		return; // well, if we dont have a faction set, we're gonna be indiff to everybody	for (auto it = npc_list.begin(); it != npc_list.end(); ++it) {		NPC *mob = it->second;		if (!mob)			continue;		float r = mob->GetAssistRange();		r = r * r;		if (			mob != sender			&& mob != attacker//			&& !mob->IsCorpse()//			&& mob->IsAIControlled()			&& mob->GetPrimaryFaction() != 0			&& mob->DistNoRoot(*sender) <= r			&& !mob->IsEngaged()			&& ((!mob->IsPet()) || (mob->IsPet() && mob->GetOwner() && !mob->GetOwner()->IsClient()))				// If we're a pet we don't react to any calls for help if our owner is a client			)		{			//if they are in range, make sure we are not green...			//then jump in if they are our friend			if(attacker->GetLevelCon(mob->GetLevel()) != CON_GREEN)			{				// AK Style pet pulling.				if(attacker->IsPet() && mob->GetLevelCon(attacker->GetLevel()) == CON_GREEN)				{					return;				}				bool useprimfaction = false;				if(mob->GetPrimaryFaction() == sender->CastToNPC()->GetPrimaryFaction())				{					const NPCFactionList *cf = database.GetNPCFactionEntry(mob->GetNPCFactionID());					if(cf){						if(cf->assistprimaryfaction != 0)							useprimfaction = true;					}				}				if(useprimfaction || sender->GetReverseFactionCon(mob) <= FACTION_AMIABLE )				{					//attacking someone on same faction, or a friend					//Father Nitwit: make sure we can see them.					if(mob->CheckLosFN(sender)) {#if (EQDEBUG>=11)						LogFile->write(EQEMuLog::Debug, "AIYellForHelp(/"%s/",/"%s/") %s attacking %s Dist %f Z %f",						sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ()));#endif
开发者ID:bwilliams1,项目名称:Server,代码行数:67,


示例24: GetLevel

//.........这里部分代码省略.........			case SE_AllStats: {				int val = CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], slevel, spell_id);				if (val < 0)					AggroAmount -= val * 6;				break;			}			case SE_BardAEDot: {				AggroAmount += slevel * 2;				break;			}			case SE_SpinTarget: {				AggroAmount += (5 + ((slevel * slevel) / 5));				break;			}			case SE_Amnesia:			case SE_Silence: {				AggroAmount += slevel * 2;				break;			}			case SE_Destroy: {				AggroAmount += slevel * 2;				break;			}			case SE_Harmony:			case SE_CastingLevel:			case SE_MeleeMitigation:			case SE_CriticalHitChance:			case SE_AvoidMeleeChance:			case SE_RiposteChance:			case SE_DodgeChance:			case SE_ParryChance:			case SE_DualWieldChance:			case SE_DoubleAttackChance:			case SE_MeleeSkillCheck:			case SE_HitChance:			case SE_IncreaseArchery:			case SE_DamageModifier:			case SE_MinDamageModifier:			case SE_IncreaseBlockChance:			case SE_Accuracy:			case SE_DamageShield:			case SE_SpellDamageShield:			case SE_ReverseDS: {				AggroAmount += slevel * 2;				break;			}			case SE_CurrentMana:			case SE_ManaRegen_v2:			case SE_ManaPool:			case SE_CurrentEndurance: {				int val = CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], slevel, spell_id);				if (val < 0)					AggroAmount -= val * 2;				break;			}			case SE_CancelMagic:			case SE_DispelDetrimental: {				AggroAmount += slevel;				break;			}			case SE_ReduceHate:			case SE_InstantHate: {				nonModifiedAggro = CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], slevel, spell_id);				break;			}		}	}	if (IsAEDurationSpell(spell_id))		AggroAmount /= 2;	if (spells[spell_id].HateAdded > 0)		AggroAmount = spells[spell_id].HateAdded;	if (IsBardSong(spell_id))		AggroAmount = AggroAmount * RuleI(Aggro, SongAggroMod) / 100;	if (GetOwner() && IsPet())		AggroAmount = AggroAmount * RuleI(Aggro, PetSpellAggroMod) / 100;	if (AggroAmount > 0) {		int HateMod = RuleI(Aggro, SpellAggroMod);		if (IsClient())			HateMod += CastToClient()->GetFocusEffect(focusSpellHateMod, spell_id);		AggroAmount = (AggroAmount * HateMod) / 100;		//made up number probably scales a bit differently on live but it seems like it will be close enough		//every time you cast on live you get a certain amount of "this is a spell" aggro		//confirmed by EQ devs to be 100 exactly at level 85. From their wording it doesn't seem like it's affected		//by hate modifiers either.		//AggroAmount += (slevel*slevel/72);		// Saved so I can reimplement it;		// this should only be on the spell to aggro the npc not every spell	}	return AggroAmount + spells[spell_id].bonushate + nonModifiedAggro;}
开发者ID:bwilliams1,项目名称:Server,代码行数:101,



注:本文中的IsPet函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ IsPlaying函数代码示例
C++ IsPerson函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。