本文整理汇总了C#中WCell.RealmServer.Misc.DamageAction类的典型用法代码示例。如果您正苦于以下问题:C# DamageAction类的具体用法?C# DamageAction怎么用?C# DamageAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DamageAction类属于WCell.RealmServer.Misc命名空间,在下文中一共展示了DamageAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDefend
public override void OnDefend(DamageAction action)
{
var defender = Owner; // same as action.Victim
var power = defender.Power;
var damage = action.Damage;
var drainAmount = Math.Min(damage, (int)(power * factorInverse)); // figure out how much to drain
if (remaining < drainAmount)
{
// shield is used up
drainAmount = remaining;
remaining = 0;
m_aura.Remove(false);
}
else
{
remaining -= drainAmount;
}
drainAmount = (int)(drainAmount * factor);
var caster = Aura.CasterUnit;
if (caster != null)
{
// see MageArcaneArcaneShielding
drainAmount = caster.Auras.GetModifiedInt(SpellModifierType.HealingOrPowerGain, m_spellEffect.Spell, drainAmount);
}
defender.Power = power - drainAmount; // drain power
damage -= drainAmount; // reduce damage
action.Damage = damage;
}
示例2: OnDefend
public override void OnDefend(DamageAction action)
{
if (m_spellEffect.Spell.SchoolMask.HasAnyFlag(action.UsedSchool))
{
action.ModDamagePercent(EffectValue);
}
}
示例3: GenerateDefaultAttackerRage
/// <summary>
/// Rage for the attacker of an AttackAction
/// </summary>
public static void GenerateDefaultAttackerRage(DamageAction action)
{
var attacker = action.Attacker;
// only generate Rage for white damage
if (action.IsWeaponAttack)
{
double hitFactor;
if (action.Weapon == attacker.OffHandWeapon)
{
hitFactor = 1.75;
}
else
{
hitFactor = 3.5;
}
if (action.IsCritical)
{
hitFactor *= 2;
}
hitFactor *= action.Weapon.AttackTime;
var lvl = attacker.Level;
var c = 0.0092f * lvl * lvl + 3.23f * lvl + 4.27f;
var rageRight = ((15 * action.ActualDamage / (4f * c)) + (hitFactor / 2000));
var rageLeft = 15 * action.ActualDamage / c;
var rage = rageRight;
if (rageRight <= rageLeft)
rage = rageLeft;
// Multiplied by 2 to match an approximate value, check the formula instead.
attacker.Power += (int)(rage) * 10;
}
}
示例4: GenerateDefaultVictimRage
/// <summary>
/// Rage for the victim of an AttackAction
/// </summary>
public static void GenerateDefaultVictimRage(DamageAction action)
{
var victim = action.Victim;
var lvl = victim.Level;
var c = (int)(0.0092 * lvl * lvl + 3.23f * lvl + 4.27f); // polynomial rage co-efficient
victim.Power += (5 / 2 * action.ActualDamage / c) * 10;
}
示例5: OnAttack
public override void OnAttack(DamageAction action)
{
//if (!action.IsDot)
{
var amount = action.GetDamagePercent(EffectValue);
Owner.Heal(amount, m_aura.CasterUnit, m_spellEffect);
}
}
示例6: OnDefend
public override void OnDefend(DamageAction action)
{
RemainingValue = action.Absorb(RemainingValue, (DamageSchoolMask)m_spellEffect.MiscValue);
if (RemainingValue <= 0)
{
Owner.AddMessage(m_aura.Cancel);
}
}
示例7: OnAttack
public override void OnAttack(DamageAction action)
{
if (action.Victim is NPC && ((NPC)action.Victim).CheckCreatureType(Mask))
{
// crit this guy
action.IsCritical = true;
action.SetCriticalDamage();
}
}
示例8: OnDefend
public override void OnDefend(DamageAction action)
{
// if damage was blocked and we are lucky, we double the block amount
if (action.Blocked > 0 && EffectValue > Utility.Random(1, 101))
{
// crit block
action.Blocked *= 2;
}
}
示例9: OnDefend
public override void OnDefend(DamageAction action)
{
action.Victim.AddMessage(() =>
{
if (action.Victim.MayAttack(action.Attacker))
{
action.Attacker.DealSpellDamage(action.Victim, SpellEffect, EffectValue);
}
});
}
示例10: OnDefend
public override void OnDefend(DamageAction action)
{
// strike back
var victim = action.Victim;
var atk = action.Attacker;
if (!atk.IsBehind(victim))
{
victim.AddMessage(() =>
{
if (atk.IsInWorld && victim.MayAttack(atk))
{
victim.Strike(atk);
}
});
}
}
示例11: OnAttack
/// <summary>
/// Register with OnAttack, since it's executed right after OnDefend, which is where
/// Absorption handlers are handled.
/// "When your Mana Shield, Frost Ward, Fire Ward, or Ice Barrier absorbs damage
/// your spell damage is increased by $s1% of the amount absorbed for $44413d."
/// </summary>
public override void OnAttack(DamageAction action)
{
if (action.Absorbed > 0)
{
// apply aura
Owner.SpellCast.TriggerSelf(SpellId.EffectClassSkillIncantersAbsorption);
// retreive aura & handler
var aura = Owner.Auras[SpellId.EffectClassSkillIncantersAbsorption];
if (aura != null)
{
var handler = aura.GetHandler(AuraType.ModDamageDone) as ModDamageDoneHandler;
if (handler != null)
{
// override effect value
handler.BaseEffectValue = EffectValue;
}
}
}
}
示例12: OnDefend
public override void OnDefend(DamageAction action)
{
var defender = Owner; // same as action.Victim
var power = defender.Power;
var damage = action.Damage;
var amount = Math.Min(damage, (int)(power / factor)); // figure out how much to drain
if (remaining < amount)
{
// shield is used up
amount = remaining;
remaining = 0;
m_aura.Remove(false);
}
else
{
remaining -= amount;
}
defender.Power = power - (int)(amount * factor); // drain power
damage -= amount; // reduce damage
action.Damage = damage;
}
示例13: OnAttack
public override void OnAttack(DamageAction action)
{
if (action.IsMagic && TriggerSpells.Contains(action.Spell.Line.LineId))
{
if (!action.IsCritical)
{
critCount = 0; // reset critCount
}
else
{
critCount++;
if (critCount == 2)
{
// 2 crits in a row
critCount = 0; // reset critCount
if (Utility.Random(0, 101) < EffectValue)
{
// we have a Hot Streak
Owner.SpellCast.TriggerSelf(SpellId.HotStreak);
}
}
}
}
}
示例14: OnAttack
public override void OnAttack(DamageAction action)
{
// "Your spells and abilities deal 4% more damage to targets infected with Blood Plague."
if (action.SpellEffect != null && action.Victim.Auras.Contains(SpellId.EffectBloodPlague))
{
action.ModDamagePercent(EffectValue);
}
}
示例15: OnDefend
public override void OnDefend(DamageAction action)
{
// absorb EffectValue % from the damage
var absorbed = Math.Min(action.GetDamagePercent(EffectValue), RemainingValue);
// RemainingValue corresponds to AMZ's health, when it reaches 0, AMZ will be destroyed
RemainingValue = action.Absorb(absorbed, (DamageSchoolMask)m_spellEffect.MiscValue);
}