这篇教程C++ CalculatePct函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CalculatePct函数的典型用法代码示例。如果您正苦于以下问题:C++ CalculatePct函数的具体用法?C++ CalculatePct怎么用?C++ CalculatePct使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CalculatePct函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CalculatePctvoid BattlePetMgr::HealBattlePetsPct(uint8 pct){ // TODO: After each Pet Battle, any injured companion will automatically // regain 50 % of the damage that was taken during combat std::vector<BattlePet> updates; for (auto& pet : _pets) if (pet.second.PacketInfo.Health != pet.second.PacketInfo.MaxHealth) { pet.second.PacketInfo.Health += CalculatePct(pet.second.PacketInfo.MaxHealth, pct); // don't allow Health to be greater than MaxHealth pet.second.PacketInfo.Health = std::min(pet.second.PacketInfo.Health, pet.second.PacketInfo.MaxHealth); if (pet.second.SaveInfo != BATTLE_PET_NEW) pet.second.SaveInfo = BATTLE_PET_CHANGED; updates.push_back(pet.second); } SendUpdates(updates, false);}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:19,
示例2: HandleProc void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); DamageInfo* damageInfo = eventInfo.GetDamageInfo(); if (!damageInfo || !damageInfo->GetDamage()) return; SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE); int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); amount /= spellInfo->GetMaxTicks(DIFFICULTY_NONE); // Add remaining ticks to healing done Unit* caster = eventInfo.GetActor(); Unit* target = eventInfo.GetProcTarget(); amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE); caster->CastCustomSpell(SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE, SPELLVALUE_BASE_POINT0, amount, target, true); }
开发者ID:Lyill,项目名称:TrinityCore,代码行数:19,
示例3: HandleProc void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); HealInfo* healInfo = eventInfo.GetHealInfo(); if (!healInfo || !healInfo->GetHeal()) return; Unit* caster = eventInfo.GetActor(); Unit* target = eventInfo.GetProcTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_HOLY_MENDING); int32 amount = CalculatePct(static_cast<int32>(healInfo->GetHeal()), aurEff->GetAmount()); amount /= spellInfo->GetMaxTicks(DIFFICULTY_NONE); // Add remaining ticks to damage done amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_PALADIN_HOLY_MENDING, SPELL_AURA_PERIODIC_HEAL); caster->CastCustomSpell(SPELL_PALADIN_HOLY_MENDING, SPELLVALUE_BASE_POINT0, amount, target, true); }
开发者ID:Regigicas,项目名称:TrinityCore,代码行数:19,
示例4: CalculateAmount void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) { canBeRecalculated = false; if (Unit* caster = GetCaster()) { // 0.01 * $AP * cp uint8 cp = caster->ToPlayer()->GetComboPoints(); // Idol of Feral Shadows. Can't be handled as SpellMod due its dependency from CPs if (AuraEffect const* idol = caster->GetAuraEffect(SPELL_DRUID_IDOL_OF_FERAL_SHADOWS, EFFECT_0)) amount += cp * idol->GetAmount(); // Idol of Worship. Can't be handled as SpellMod due its dependency from CPs else if (AuraEffect const* idol = caster->GetAuraEffect(SPELL_DRUID_IDOL_OF_WORSHIP, EFFECT_0)) amount += cp * idol->GetAmount(); amount += int32(CalculatePct(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp)); } }
开发者ID:PavelDev,项目名称:wodnetcore,代码行数:19,
示例5: floatvoid 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:Dramacydal,项目名称:Trinitycore-5.3.0,代码行数:19,
示例6: OCTRegenMPPerSpiritvoid Player::UpdateManaRegen(){ // Mana regen from spirit float spirit_regen = OCTRegenMPPerSpirit(); // Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen spirit_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA); // SpiritRegen(SPI, INT, LEVEL) = (0.001 + (SPI x sqrt(INT) x BASE_REGEN[LEVEL])) x 5 if (GetStat(STAT_INTELLECT) > 0.0f) spirit_regen *= sqrt(GetStat(STAT_INTELLECT)); // CombatRegen = 5% of Base Mana float base_regen = GetCreateMana() * 0.01f + GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) / 5.0f; // Set regen rate in cast state apply only on spirit based regen int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT); SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, base_regen + CalculatePct(spirit_regen, modManaRegenInterrupt)); SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0.001f + spirit_regen + base_regen);}
开发者ID:AnthoDevMoP,项目名称:SkyFire_5xx,代码行数:20,
示例7: CalculateAmount void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* caster = GetCaster()) { // +75.00% from sp bonus float bonus = CalculatePct(caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask()), 75.0f); // Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage bonus = caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), bonus); bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); amount += int32(bonus); // Arena - Dampening if (AuraEffect const* auraEffArenaDampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0)) AddPct(amount, auraEffArenaDampening->GetAmount()); // Battleground - Dampening else if (AuraEffect const* auraEffBattlegroudDampening = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0)) AddPct(amount, auraEffBattlegroudDampening->GetAmount()); } }
开发者ID:mynew3,项目名称:LordPsyanBots,代码行数:21,
示例8: CalculatePctuint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count){ uint32 MSV = pItem->GetTemplate()->SellPrice; if (MSV <= 0) return AH_MINIMUM_DEPOSIT; float multiplier = CalculatePct(float(entry->depositPercent), 3); uint32 timeHr = (((time / 60) / 60) / 12); uint32 deposit = uint32(((multiplier * MSV * count / 3) * timeHr * 3) * sWorld->getRate(RATE_AUCTION_DEPOSIT)); TC_LOG_DEBUG("auctionHouse", "MSV: %u", MSV); TC_LOG_DEBUG("auctionHouse", "Items: %u", count); TC_LOG_DEBUG("auctionHouse", "Multiplier: %f", multiplier); TC_LOG_DEBUG("auctionHouse", "Deposit: %u", deposit); if (deposit < AH_MINIMUM_DEPOSIT) return AH_MINIMUM_DEPOSIT; else return deposit;}
开发者ID:Ayik0,项目名称:DeathCore_5.4.8,代码行数:21,
示例9: HandleHeal void HandleHeal(SpellEffIndex /*effIndex*/) { if (firstHeal) { // Check if the target has Riptide if (AuraEffect* aurEff = GetHitUnit()->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, GetCaster()->GetGUID())) { riptide = true; amount = aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue(); // Consume it GetHitUnit()->RemoveAura(aurEff->GetBase()); } firstHeal = false; } // Riptide increases the Chain Heal effect by 25% if (riptide) { uint32 bonus = CalculatePct(GetHitHeal(), amount); SetHitHeal(GetHitHeal() + bonus); } }
开发者ID:wow4all,项目名称:Script-Land,代码行数:21,
示例10: CalculateAmountCritMelee void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: float CritMelee = 0.0f; // Crit from Agility CritMelee += owner->GetMeleeCritFromAgility(); // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); // Increase crit from SPELL_AURA_MOD_CRIT_PCT CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); // Increase crit melee from melee crit ratings CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE); if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347)) if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase()) if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0)) amount += CalculatePct(CritMelee, improvedDemonicTacticsEffect->GetAmount()); } }
开发者ID:redlaine,项目名称:InfinityCore-Ark,代码行数:21,
示例11: CalculateAmountCritSpell void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/) { if (Player* owner = GetCaster()->GetOwner()->ToPlayer()) { // For others recalculate it from: float CritSpell = 0.0f; // Crit from Intellect CritSpell += owner->GetSpellCritFromIntellect(); // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE); // Increase crit from SPELL_AURA_MOD_CRIT_PCT CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); // Increase crit spell from spell crit ratings CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL); if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347)) if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase()) if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0)) amount += CalculatePct(CritSpell, improvedDemonicTacticsEffect->GetAmount()); } }
开发者ID:redlaine,项目名称:InfinityCore-Ark,代码行数:21,
示例12: GetModifierValuevoid Player::UpdateArmor(){ UnitMods unitMod = UNIT_MOD_ARMOR; float value = GetModifierValue(unitMod, BASE_VALUE); // base armor (from items) value *= GetModifierValue(unitMod, BASE_PCT); // armor percent from items value += GetStat(STAT_AGILITY) * 2.0f; // armor bonus from stats value += GetModifierValue(unitMod, TOTAL_VALUE); //add dynamic flat mods AuraEffectList const& mResbyIntellect = GetAuraEffectsByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT); for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i) { if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount()); } value *= GetModifierValue(unitMod, TOTAL_PCT); SetArmor(int32(value)); UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR}
开发者ID:Cryostorm,项目名称:SunwellCore,代码行数:23,
示例13: AfterRemove void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { // Final heal only on duration end if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) return; // final heal int32 stack = GetStackAmount(); int32 healAmount = aurEff->GetAmount(); if (Unit* caster = GetCaster()) { healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack); healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack); GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); // restore mana int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2; caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); return; } GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); }
开发者ID:Hlkz2,项目名称:ACoreOld,代码行数:24,
示例14: TC_LOG_DEBUGbool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3){ TC_LOG_DEBUG("outdoorpvp", "Creating capture point %u", entry); // check info existence GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CONTROL_ZONE) { TC_LOG_ERROR("outdoorpvp", "OutdoorPvP: GO %u is not capture point!", entry); return false; } m_capturePointSpawnId = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3); if (!m_capturePointSpawnId) return false; // get the needed values from goinfo m_maxValue = (float)goinfo->controlZone.maxTime; m_maxSpeed = m_maxValue / (goinfo->controlZone.minTime ? goinfo->controlZone.minTime : 60); m_neutralValuePct = goinfo->controlZone.neutralPercent; m_minValue = CalculatePct(m_maxValue, m_neutralValuePct); return true;}
开发者ID:Carbenium,项目名称:TrinityCore,代码行数:24,
示例15: MAKE_NEW_GUIDbool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3){ ;//sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Creating capture point %u", entry); // check info existence GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { sLog->outError("OutdoorPvP: GO %u is not capture point!", entry); return false; } uint32 lowguid = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3); if (!lowguid) return false; m_capturePointGUID = MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT); // get the needed values from goinfo m_maxValue = (float)goinfo->capturePoint.maxTime; m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60); m_neutralValuePct = goinfo->capturePoint.neutralPercent; m_minValue = CalculatePct(m_maxValue, m_neutralValuePct); return true;}
开发者ID:Cryostorm,项目名称:SunwellCore,代码行数:24,
示例16: HandleDispel void HandleDispel(DispelInfo* dispelInfo) { if (Unit* target = GetUnitOwner()) { if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) { // final heal int32 healAmount = aurEff->GetAmount(); if (Unit* caster = GetCaster()) { healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); // restore mana int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); return; } target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); } } }
开发者ID:Hlkz2,项目名称:ACoreOld,代码行数:24,
示例17: CalculateAmount void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { amount = CalculatePct(int32(GetUnitOwner()->GetCreatePowers(POWER_MANA) / aurEff->GetTotalTicks()), amount); }
开发者ID:Hlkz2,项目名称:ACoreOld,代码行数:4,
示例18: GetTotalStatValuebool Guardian::UpdateStats(Stats stat){ if (stat >= MAX_STATS) return false; // value = ((base_value * base_pct) + total_value) * total_pct float value = GetTotalStatValue(stat); ApplyStatBuffMod(stat, m_statFromOwner[stat], false); float ownersBonus = 0.0f; Unit* owner = GetOwner(); // Handle Death Knight Glyphs and Talents float mod = 0.75f; if (IsPetGhoul() && (stat == STAT_STAMINA || stat == STAT_STRENGTH)) { if (stat == STAT_STAMINA) mod = 0.3f; // Default Owner's Stamina scale else mod = 0.7f; // Default Owner's Strength scale // Check just if owner has Ravenous Dead since it's effect is not an aura AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); if (aurEff) { SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value AddPct(mod, spellInfo->Effects[EFFECT_1].CalcValue(owner)); // Ravenous Dead edits the original scale } // Glyph of the Ghoul aurEff = owner->GetAuraEffect(58686, 0); if (aurEff) mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod ownersBonus = float(owner->GetStat(stat)) * mod; value += ownersBonus; } else if (stat == STAT_STAMINA) { ownersBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 30); value += ownersBonus; } //warlock's and mage's pets gain 30% of owner's intellect else if (stat == STAT_INTELLECT) { if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE) { ownersBonus = CalculatePct(owner->GetStat(stat), 30); value += ownersBonus; } }/* else if (stat == STAT_STRENGTH) { if (IsPetGhoul()) value += float(owner->GetStat(stat)) * 0.3f; }*/ SetStat(stat, int32(value)); m_statFromOwner[stat] = ownersBonus; ApplyStatBuffMod(stat, m_statFromOwner[stat], true); 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:AnthoDevMoP,项目名称:SkyFire_5xx,代码行数:73,
示例19: GetStatvoid Player::UpdateManaRegen(){ float Intellect = GetStat(STAT_INTELLECT); // Mana regen from spirit and intellect float power_regen = sqrt(Intellect) * OCTRegenMPPerSpirit(); // Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen power_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA); // Mana regen from SPELL_AURA_MOD_POWER_REGEN aura float power_regen_mp5 = (GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) + m_baseManaRegen) / 5.0f; // Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura AuraEffectList const& regenAura = GetAuraEffectsByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT); for (AuraEffectList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i) { power_regen_mp5 += GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 500.0f; } // Set regen rate in cast state apply only on spirit based regen int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT); if (modManaRegenInterrupt > 100) modManaRegenInterrupt = 100; SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePct(power_regen, modManaRegenInterrupt)); SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);}
开发者ID:FirstCore,项目名称:FuckerCrazyEmu,代码行数:26,
示例20: floatvoid Player::UpdateAttackPowerAndDamage(bool ranged){ float val2 = 0.0f; float level = float(getLevel()); UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER; uint16 index = UNIT_FIELD_ATTACK_POWER; uint16 index_mod = UNIT_FIELD_ATTACK_POWER_MODS; uint16 index_mult = UNIT_FIELD_ATTACK_POWER_MULTIPLIER; if (ranged) { index = UNIT_FIELD_RANGED_ATTACK_POWER; index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS; index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER; switch (getClass()) { case CLASS_HUNTER: val2 = level * 2.0f + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_ROGUE: val2 = level + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_WARRIOR: val2 = level + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_DRUID: switch (GetShapeshiftForm()) { case FORM_CAT: case FORM_BEAR: case FORM_DIREBEAR: val2 = 0.0f; break; default: val2 = GetStat(STAT_AGILITY) - 10.0f; break; } break; default: val2 = GetStat(STAT_AGILITY) - 10.0f; break; } } else { switch (getClass()) { case CLASS_WARRIOR: val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; case CLASS_PALADIN: val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; case CLASS_DEATH_KNIGHT: val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; case CLASS_ROGUE: val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; case CLASS_HUNTER: val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; case CLASS_SHAMAN: val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; case CLASS_DRUID: { // Check if Predatory Strikes is skilled float mLevelMult = 0.0f; float weapon_bonus = 0.0f; if (IsInFeralForm()) { Unit::AuraEffectList const& mDummy = GetAuraEffectsByType(SPELL_AURA_DUMMY); for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr) { AuraEffect* aurEff = *itr; if (aurEff->GetSpellInfo()->SpellIconID == 1563) { switch (aurEff->GetEffIndex()) { case 0: // Predatory Strikes (effect 0) mLevelMult = CalculatePct(1.0f, aurEff->GetAmount()); break; case 1: // Predatory Strikes (effect 1) if (Item* mainHand = m_items[EQUIPMENT_SLOT_MAINHAND]) { // also gains % attack power from equipped weapon ItemTemplate const* proto = mainHand->GetTemplate(); if (!proto) continue; weapon_bonus = CalculatePct(float(proto->getFeralBonus()), aurEff->GetAmount()); } break; default: break; } } } }//.........这里部分代码省略.........
开发者ID:FirstCore,项目名称:FuckerCrazyEmu,代码行数:101,
示例21: Absorb void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // reduces all damage taken while Stunned in Cat Form if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)) absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); }
开发者ID:Hlkz2,项目名称:ACoreOld,代码行数:6,
示例22: HandleProc void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); int32 amount = CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount()); GetTarget()->CastCustomSpell(SPELL_DRUID_LIVING_SEED_PROC, SPELLVALUE_BASE_POINT0, amount, eventInfo.GetProcTarget(), true, NULL, aurEff); }
开发者ID:Hlkz2,项目名称:ACoreOld,代码行数:6,
示例23: Absorb void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); }
开发者ID:AlucardVoss,项目名称:Patchs,代码行数:4,
示例24: HandleScriptEffect void HandleScriptEffect(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); if (Unit* unitTarget = GetHitUnit()) { 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->GetSpellInfo()->SpellFamilyFlags; if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000)) continue; if (AuraEffect* 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 = SPELL_HUNTER_CHIMERA_SHOT_SERPENT; basePoint = (aurEff->GetAmount() + aurEff->GetBonusAmount()) * aurEff->GetDonePct(); ApplyPct(basePoint, TickCount * 40); basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(aura->GetSpellInfo()->Id, SPELLMOD_DOT, basePoint); aurEff->SetBonusAmount(caster->SpellDamageBonusDone(unitTarget, aurEff->GetSpellInfo(), 0, DOT)); } // 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 = SPELL_HUNTER_CHIMERA_SHOT_VIPER; // Amount of one aura tick basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount())); int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; /// @todo WTF? caster uses unitTarget? if (basePoint > casterBasePoint) basePoint = casterBasePoint; ApplyPct(basePoint, TickCount * 60); } // 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 = SPELL_HUNTER_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, true); if (spellId == SPELL_HUNTER_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown caster->GetSpellHistory()->AddCooldown(spellId, 0, std::chrono::minutes(1)); } }
开发者ID:AwkwardDev,项目名称:RE,代码行数:67,
示例25: TC_LOG_DEBUGvoid WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/){ TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT_MONEY"); Player* player = GetPlayer(); uint64 guid = player->GetLootGUID(); if (!guid) return; Loot* loot = NULL; bool shareMoney = true; switch (GUID_HIPART(guid)) { case HIGHGUID_GAMEOBJECT: { GameObject* go = GetPlayer()->GetMap()->GetGameObject(guid); // do not check distance for GO if player is the owner of it (ex. fishing bobber) if (go && ((go->GetOwnerGUID() == player->GetGUID() || go->IsWithinDistInMap(player, INTERACTION_DISTANCE)))) loot = &go->loot; break; } case HIGHGUID_CORPSE: // remove insignia ONLY in BG { Corpse* bones = ObjectAccessor::GetCorpse(*player, guid); if (bones && bones->IsWithinDistInMap(player, INTERACTION_DISTANCE)) { loot = &bones->loot; shareMoney = false; } break; } case HIGHGUID_ITEM: { if (Item* item = player->GetItemByGuid(guid)) { loot = &item->loot; shareMoney = false; } break; } case HIGHGUID_UNIT: case HIGHGUID_VEHICLE: { Creature* creature = player->GetMap()->GetCreature(guid); bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed); if (lootAllowed && creature->IsWithinDistInMap(player, INTERACTION_DISTANCE)) { loot = &creature->loot; if (creature->IsAlive()) shareMoney = false; } break; } default: return; // unlootable type } if (loot) { loot->NotifyMoneyRemoved(); if (shareMoney && player->GetGroup()) //item, pickpocket and players can be looted only single player { Group* group = player->GetGroup(); std::vector<Player*> playersNear; for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* member = itr->GetSource(); if (!member) continue; if (player->IsWithinDistInMap(member, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false)) playersNear.push_back(member); } uint32 goldPerPlayer = uint32((loot->gold) / (playersNear.size())); for (std::vector<Player*>::const_iterator i = playersNear.begin(); i != playersNear.end(); ++i) { (*i)->ModifyMoney(goldPerPlayer); (*i)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, goldPerPlayer); if (Guild* guild = sGuildMgr->GetGuildById((*i)->GetGuildId())) if (uint32 guildGold = CalculatePct(goldPerPlayer, (*i)->GetTotalAuraModifier(SPELL_AURA_DEPOSIT_BONUS_MONEY_IN_GUILD_BANK_ON_LOOT))) guild->HandleMemberDepositMoney(this, guildGold, true); WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1); data << uint32(goldPerPlayer); data << uint8(playersNear.size() <= 1); // Controls the text displayed in chat. 0 is "Your share is..." and 1 is "You loot..." (*i)->GetSession()->SendPacket(&data); } } else { player->ModifyMoney(loot->gold);//.........这里部分代码省略.........
开发者ID:Trust123,项目名称:ElunaTrinityCata,代码行数:101,
注:本文中的CalculatePct函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CalculatePctN函数代码示例 C++ CalculatePassengerPosition函数代码示例 |