当前位置: 首页>>代码示例>>C++>>正文


C++ DamageInfo::GetDamage方法代码示例

本文整理汇总了C++中DamageInfo::GetDamage方法的典型用法代码示例。如果您正苦于以下问题:C++ DamageInfo::GetDamage方法的具体用法?C++ DamageInfo::GetDamage怎么用?C++ DamageInfo::GetDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DamageInfo的用法示例。


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

示例1: Absorb

        void Absorb(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
        {
            Unit * target = GetTarget();
            if (dmgInfo.GetDamage() < target->GetHealth())
                return;
            if (target->ToPlayer()->HasSpellCooldown(ROG_SPELL_CHEAT_DEATH_COOLDOWN))
                return;
            if (!roll_chance_i(absorbChance))
                return;

            target->CastSpell(target, ROG_SPELL_CHEAT_DEATH_COOLDOWN, true);
            target->ToPlayer()->AddSpellCooldown(ROG_SPELL_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60);

            uint32 health10 = target->CountPctFromMaxHealth(10);

            // hp > 10% - absorb hp till 10%
            if (target->GetHealth() > health10)
                absorbAmount = dmgInfo.GetDamage() - target->GetHealth() + health10;
            // hp lower than 10% - absorb everything
            else
                absorbAmount = dmgInfo.GetDamage();
        }
开发者ID:kmishima,项目名称:DarkCore,代码行数:22,代码来源:spell_rogue.cpp

示例2: HandleOnEffectAbsorb

void ShieldScript::HandleOnEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
    Unit* caster = GetCaster();
    Unit* attacker = dmgInfo.GetAttacker();

    if (!caster || !attacker)
        return;

    absorbAmount = dmgInfo.GetDamage();

    // Deal the damage and show it on caster's log
    caster->DealDamage(attacker, (uint32)(absorbAmount*0.25f), NULL, dmgInfo.GetDamageType(), dmgInfo.GetSchoolMask());
    caster->SendSpellNonMeleeDamageLog(attacker, GetSpellInfo()->Id, (uint32) (absorbAmount*0.25f),  dmgInfo.GetSchoolMask(), 0, 0, true, 0);
}
开发者ID:Allowed,项目名称:Strawberry335,代码行数:14,代码来源:Spell_ArgentumChallenge.cpp

示例3: Absorb

        void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
        {
            Unit* caster = GetCaster();

            if (!caster)
                return;

            int32 remainingHealth = caster->GetHealth() - dmgInfo.GetDamage();
            int32 cauterizeHeal = caster->CountPctFromMaxHealth(40);

            if (caster->ToPlayer()->HasSpellCooldown(SPELL_MAGE_CAUTERIZE_DAMAGE))
                return;

            if (!roll_chance_i(absorbChance))
                return;

            if (remainingHealth <= 0)
            {
                absorbAmount = dmgInfo.GetDamage();
                caster->CastCustomSpell(caster, SPELL_MAGE_CAUTERIZE_DAMAGE, NULL,&cauterizeHeal, NULL, true, NULL, aurEff);
                caster->ToPlayer()->AddSpellCooldown(SPELL_MAGE_CAUTERIZE_DAMAGE, 0, time(NULL) + 60);
            }
        }
开发者ID:Ksenon,项目名称:multi_realm_cell,代码行数:23,代码来源:spell_mage.cpp

示例4: Absorb

		void Absorb(AuraEffect* /*auraEffect*/, DamageInfo& dmgInfo, uint32& absorbAmount)
		{
			if (Unit* caster = GetCaster())
			{
				if (dmgInfo.GetDamage() < caster->GetHealth())
					return;

				if (caster->HasAura(PRIEST_SPELL_SPIRIT_OF_REDEMPTION_SHAPESHIFT))
					return;

				caster->CastSpell(caster, PRIEST_SPELL_SPIRIT_OF_REDEMPTION_FORM, true);
				caster->CastSpell(caster, PRIEST_SPELL_SPIRIT_OF_REDEMPTION_SHAPESHIFT, true);

				absorbAmount = caster->GetHealth() - 1;
			}
		}
开发者ID:Tithand,项目名称:TER-Server,代码行数:16,代码来源:spell_priest.cpp

示例5: Absorb

            void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
            {
                Unit* target = GetTarget();
                if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0))
                {
                    int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); // SPELL_EFFECT_DUMMY with NO_TARGET

                    if (roll_chance_i(chance))
                    {
                        int32 bp = dmgInfo.GetDamage();
                        dmgInfo.AbsorbDamage(bp);
                        target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
                        absorbAmount = 0;
                        PreventDefaultAction();
                    }
                }
            }
开发者ID:CrazyMeal,项目名称:Serval_Core,代码行数:17,代码来源:spell_mage.cpp

示例6: Absorb

 void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     // reduces all damage taken while stun or fear
     if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED | UNIT_FLAG_FLEEING))
         absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
 }
开发者ID:Neskafee,项目名称:TrinityCore,代码行数:6,代码来源:spell_rogue.cpp

示例7: Absorb

 void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
      absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
 }
开发者ID:bahajan95,项目名称:flame-core,代码行数:4,代码来源:spell_dk.cpp

示例8: HandleOnEffectAbsorb

 void HandleOnEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     sLog->outString("Our aura is now absorbing damage done to us!");
     // absorb whole damage done to us
     absorbAmount = dmgInfo.GetDamage();
 }
开发者ID:Bootz,项目名称:SkyFireEMU_430,代码行数:6,代码来源:example_spell.cpp

示例9: Absorb

 void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     // reduces all damage taken while stun, fear or silence
     if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
         absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
 }
开发者ID:BlackWolfsDen,项目名称:Justicar-WoW,代码行数:6,代码来源:spell_shaman.cpp

示例10: Absorb

 void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
         absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
 }
开发者ID:boom8866,项目名称:new,代码行数:5,代码来源:spell_druid.cpp

示例11: Absorb

 void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     // reduces all damage taken while Stunned in Moonkin Form
     if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
         absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
 }
开发者ID:Hlkz2,项目名称:ACoreOld,代码行数:6,代码来源:spell_druid.cpp

示例12: Absorb

        void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
        {
            Unit* victim = GetTarget();
            int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage();
            uint32 allowedHealth = victim->CountPctFromMaxHealth(35);

            //npcbot - calc for bots
            if (victim->GetTypeId() == TYPEID_UNIT/* && victim->ToCreature()->IsNPCBot()*/)
            {
                if (remainingHealth <= 0 && !victim->ToCreature()->GetSpellHistory()->HasCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL))
                {
                    // Cast healing spell, completely avoid damage
                    absorbAmount = dmgInfo.GetDamage();

                    uint32 defenseSkillValue = victim->GetDefenseSkillValue();
                    // Max heal when defense skill denies critical hits from raid bosses
                    // Formula: max defense at level + 140 (raiting from gear)
                    uint32 reqDefForMaxHeal  = victim->getLevel() * 5 + 140;
                    float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
                                           ? 1.0f
                                           : float(defenseSkillValue) / float(reqDefForMaxHeal);

                    int32 healAmount = int32(victim->CountPctFromMaxHealth(int32(healPct * pctFromDefense)));
                    victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
                    victim->ToCreature()->AddBotSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 120 * IN_MILLISECONDS);
                }
                else if (remainingHealth < int32(allowedHealth))
                {
                    // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x%
                    uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
                                            ? dmgInfo.GetDamage()
                                            : allowedHealth - remainingHealth;
                    absorbAmount = CalculatePct(damageToReduce, absorbPct);
                }

                return;
            }
            //end npcbot

            // If damage kills us
            if (remainingHealth <= 0 && !victim->GetSpellHistory()->HasCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL))
            {
                // Cast healing spell, completely avoid damage
                absorbAmount = dmgInfo.GetDamage();

                uint32 defenseSkillValue = victim->GetDefenseSkillValue();
                // Max heal when defense skill denies critical hits from raid bosses
                // Formula: max defense at level + 140 (raiting from gear)
                uint32 reqDefForMaxHeal  = victim->getLevel() * 5 + 140;
                float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
                                       ? 1.0f
                                       : float(defenseSkillValue) / float(reqDefForMaxHeal);

                int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense)));
                victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
                victim->GetSpellHistory()->AddCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, std::chrono::minutes(2));
            }
            else if (remainingHealth < int32(allowedHealth))
            {
                // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x%
                uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
                                        ? dmgInfo.GetDamage()
                                        : allowedHealth - remainingHealth;
                absorbAmount = CalculatePct(damageToReduce, absorbPct);
            }
        }
开发者ID:mynew3,项目名称:LordPsyanBots,代码行数:66,代码来源:spell_paladin.cpp

示例13: Absorb

 void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& /*absorbAmount*/)
 {
     PreventDefaultAction();
     int32 bp = dmgInfo.GetDamage();
     GetTarget()->CastCustomSpell(SPELL_SHARED_RULE, SPELLVALUE_BASE_POINT0, bp, (Unit*) nullptr, true, nullptr, aurEff);
 }
开发者ID:martial69320,项目名称:cerberus,代码行数:6,代码来源:boss_illidari_council.cpp

示例14: Absorb

 void Absorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
 {
     // we may only absorb a certain percentage of incoming damage.
     absorbAmount = dmgInfo.GetDamage() * uint32(absorbPct) / 100;
 }
开发者ID:DSlayerMan,项目名称:DraenorCore,代码行数:5,代码来源:spell_dk.cpp

示例15: OnAbsorb

void SpellValanarKineticBombAbsorbAuraScript::OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
    absorbAmount = CalculatePctN(dmgInfo.GetDamage(), aurEff->GetAmount());
    RoundToInterval<uint32>(absorbAmount, 0, dmgInfo.GetDamage());
    dmgInfo.AbsorbDamage(absorbAmount);
}
开发者ID:Allowed,项目名称:Strawberry335,代码行数:6,代码来源:Spell_KineticBomb.cpp


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