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


C++ DamageInfo类代码示例

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


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

示例1: 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

示例2: 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:FrenchCORE,项目名称:OLD_FrenchCORE,代码行数:7,代码来源:spell_rogue.cpp

示例3: HandleProc

            void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
            {
                PreventDefaultAction();
                DamageInfo* damageInfo = eventInfo.GetDamageInfo();
                if (!damageInfo || !damageInfo->GetDamage())
                    return;

                int32 amount = aurEff->GetAmount() + damageInfo->GetDamage();
                if (amount >= 15000)
                {
                    if (Unit* caster = GetCaster())
                        caster->CastSpell(GetTarget(), SPELL_AMBER_SHOCK_CHARGE, true);
                    amount -= 15000;
                }

                const_cast<AuraEffect*>(aurEff)->SetAmount(amount);
            }
开发者ID:090809,项目名称:TrinityCore,代码行数:17,代码来源:oculus.cpp

示例4: 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();

                    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:AtVirus,项目名称:Tenerby,代码行数:17,代码来源:spell_mage.cpp

示例5: Absorb

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

                target->CastSpell(target, ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, true);
                target->AddSpellCooldown(ROGUE_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:BlackwaterEmu,项目名称:Trinity-Zero,代码行数:18,代码来源:spell_rogue.cpp

示例6: 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,代码来源:spell_shaman.cpp

示例7: OnAbsorb

            void OnAbsorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
            {
                uint32 damage = dmgInfo.GetDamage();

                if (absorbAmount > damage)
                    return;

                if (Unit* caster = GetCaster())
                    caster->CastSpell(caster, SPELL_SHIELD_OF_RUNES_BUFF, true);
            }
开发者ID:AwkwardDev,项目名称:TrinityCore,代码行数:10,代码来源:boss_assembly_of_iron.cpp

示例8: Absorb

            void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
            {
                Player* target = GetTarget()->ToPlayer();
                if (dmgInfo.GetDamage() < target->GetHealth() || target->GetSpellHistory()->HasCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
                    return;

                target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true);
                target->GetSpellHistory()->AddCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, std::chrono::minutes(1));

                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();

                target->CastSpell(target, 45182); // cheat death aura
            }
开发者ID:mynew4,项目名称:RE,代码行数:20,代码来源:spell_rogue.cpp

示例9: Trigger

 void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     Unit * target = dmgInfo.GetAttacker();
     if (!target)
         return;
     Unit * caster = GetCaster();
     if (!caster)
         return;
     int32 bp = CalculatePct(absorbAmount, 25);
     target->CastCustomSpell(target, SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
 }
开发者ID:mynew3,项目名称:Trinity-Core,代码行数:11,代码来源:boss_argent_challenge.cpp

示例10: Absorb

        void Absorb(AuraEffectPtr aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
        {
            if (!GetTarget())
                return;

            uint32 curHealth = GetTarget()->GetHealth();

            if (curHealth >= 10000)
            {
                absorbAmount = dmgInfo.GetDamage() - curHealth + 1;
            }
        }
开发者ID:mynew4,项目名称:5.4.7-mop-core,代码行数:12,代码来源:boss_chimaeron.cpp

示例11: Absorb

            void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & /*absorbAmount*/)
            {
                if (Unit* owner = GetUnitOwner())
                {
                    if (dmgInfo.GetSpellInfo())
                    {
                        if (urand(0, 99) < 5)
                            GetTarget()->CastSpell(GetTarget(), spellId, true);

                        // Twin Vortex part
                        uint32 lightVortex = SPELL_LIGHT_VORTEX_DAMAGE;
                        uint32 darkVortex = SPELL_DARK_VORTEX_DAMAGE;
                        int32 stacksCount = dmgInfo.GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue() / 1000 - 1;

                        if (lightVortex && darkVortex && stacksCount)
                        {
                            if (dmgInfo.GetSpellInfo()->Id == darkVortex || dmgInfo.GetSpellInfo()->Id == lightVortex)
                            {
                                Aura* pAura = owner->GetAura(SPELL_POWERING_UP);
                                if (pAura)
                                {
                                    pAura->ModStackAmount(stacksCount);
                                    owner->CastSpell(owner, SPELL_POWERING_UP, true);
                                }
                                else
                                {
                                    owner->CastSpell(owner, SPELL_POWERING_UP, true);
                                    if (Aura* pTemp = owner->GetAura(SPELL_POWERING_UP))
                                        pTemp->ModStackAmount(stacksCount);
                                }
                            }
                        }

                        // Picking floating balls
                        uint32 unleashedDark = SPELL_UNLEASHED_DARK;
                        uint32 unleashedLight = SPELL_UNLEASHED_LIGHT;

                        if (unleashedDark && unleashedLight)
                        {
                            if (dmgInfo.GetSpellInfo()->Id == unleashedDark || dmgInfo.GetSpellInfo()->Id == unleashedLight)
                            {
                                // need to do the things in this order, else players might have 100 charges of Powering Up without anything happening
                                Aura* pAura = owner->GetAura(SPELL_POWERING_UP);
                                if (pAura)
                                {
                                    // 2 lines together add the correct amount of buff stacks
                                    pAura->ModStackAmount(stacksCount);
                                    owner->CastSpell(owner, SPELL_POWERING_UP, true);
                                }
                                else
                                {
                                    owner->CastSpell(owner, SPELL_POWERING_UP, true);
                                    if (Aura* pTemp = owner->GetAura(SPELL_POWERING_UP))
                                        pTemp->ModStackAmount(stacksCount);
                                }
                            }
                        }
                    }
                }
            }
开发者ID:GlassFace,项目名称:LegacyCore_6.x.x,代码行数:60,代码来源:boss_twin_valkyr.cpp

示例12: dealDamage

void Virus::dealDamage(const DamageInfo &damage) {
  if (!isActive()) {
    return;
  }

  double modifier = 0.0;

  unsigned char proteinTypes = virusData->getProteinTypes();
  if (proteinTypes & damage.getDamageType()) {
    modifier = 1.0;
  }

  VirusColor color = virusData->getVirusColor();
  if (color == damage.getDamageColor()) {
    modifier *= 2.0;
  }

  if (modifier > 1.0) {
    flash = 45;
    flashColor = Color(1.0, 1.0, 1.0);
  } else if (modifier > 0.0) {
    flash = 22;
    flashColor = Color(1.0, 1.0, 1.0);
  }
  
  this->hp -= (modifier * damage.getDamageValue());
  if (hp <= 0.0) {
    hp = 0.0;
    dead = true;

    VisualEffect *effect = new ShockwaveEffect(position, 10.0, 60, 
					       virusData->getColor());
    map->addVisualEffect(effect);

    effect = new BubbleEffect(position, position, CELL_RADIUS / 3.0,
			      60, virusData->getColor());
    map->addVisualEffect(effect);
  }
}
开发者ID:jefrsilva,项目名称:PGCPandora,代码行数:39,代码来源:Virus.cpp

示例13: Absorb

		void Absorb(AuraEffect * aurEff, DamageInfo & dmgInfo,
				uint32 & absorbAmount) {
			Unit * pVictim = GetTarget();
			int32 remainingHealth = pVictim->GetHealth() - dmgInfo.GetDamage();
			uint32 allowedHealth = pVictim->CountPctFromMaxHealth(35);
			// If damage kills us
			if (remainingHealth <= 0
					&& !pVictim->ToPlayer()->HasSpellCooldown(
							PAL_SPELL_ARDENT_DEFENDER_HEAL)) {
				// Cast healing spell, completely avoid damage
				absorbAmount = dmgInfo.GetDamage();

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

				int32 healAmount = int32(
						pVictim->CountPctFromMaxHealth(
								uint32(healPct * pctFromDefense)));
				pVictim->CastCustomSpell(pVictim,
						PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL,
						true, NULL, aurEff);
				pVictim->ToPlayer()->AddSpellCooldown(
						PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, time(NULL) + 120);
			} 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 =
						(pVictim->GetHealth() < allowedHealth) ?
								dmgInfo.GetDamage() :
								allowedHealth - remainingHealth;
				absorbAmount = CalculatePctN(damageToReduce, absorbPct);
			}
		}
开发者ID:jsj2008,项目名称:StarGate-Plus-EMU,代码行数:39,代码来源:spell_paladin.cpp

示例14: 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

示例15: 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


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