本文整理汇总了C#中WCell.RealmServer.Spells.SpellEffect类的典型用法代码示例。如果您正苦于以下问题:C# SpellEffect类的具体用法?C# SpellEffect怎么用?C# SpellEffect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpellEffect类属于WCell.RealmServer.Spells命名空间,在下文中一共展示了SpellEffect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Trigger
//internal static readonly ObjectPool<List<AuraApplicationInfo>> AuraAppListPool = ObjectPoolMgr.CreatePool(() => new List<AuraApplicationInfo>());
public static void Trigger(WorldObject caster, SpellEffect triggerEffect, Spell spell)
{
var cast = SpellCastPool.Obtain();
cast.Caster = caster;
cast.m_triggerEffect = triggerEffect;
caster.ExecuteInContext(() =>
{
cast.Start(spell, true);
cast.Dispose();
});
}
示例2: CreateHandler
private void CreateHandler(SpellEffect effect, int h, SpellEffectHandler[] handlers, ref SpellTargetCollection targets, ref SpellFailedReason failReason)
{
var handler = effect.SpellEffectHandlerCreator(this, effect);
handlers[h] = handler;
// make sure, we have the right Caster-Type
handler.CheckCasterType(ref failReason);
if (failReason != SpellFailedReason.Ok)
{
return;
}
// find targets and amount SpellTargetCollection if effects have same ImplicitTargetTypes
if (InitialTargets != null)
{
// do we have given targets?
if (targets == null)
{
targets = CreateSpellTargetCollection();
}
}
else if (handler.HasOwnTargets)
{
// see if targets are shared between effects
targets = null;
for (var j = 0; j < h; j++)
{
var handler2 = handlers[j];
if (handler.Effect.SharesTargetsWith(handler2.Effect, IsAICast))
{
// same targets -> share target collection
targets = handler2.m_targets;
break;
}
}
if (targets == null)
{
targets = CreateSpellTargetCollection();
}
}
if (targets != null)
{
handler.m_targets = targets;
targets.m_handlers.Add(handler);
}
}
示例3: LeechPower
/// <summary>
/// Leeches the given amount of power from this Unit and adds it to the receiver (if receiver != null and is Unit).
/// </summary>
public void LeechPower(Unit receiver, int amount, float factor, SpellEffect effect)
{
var currentPower = Power;
// Resilience reduces mana drain by 2.2%, amount is rounded.
amount -= (amount * GetResiliencePct() * 2.2f).RoundInt();
if (amount > currentPower)
{
amount = currentPower;
}
Power = currentPower - amount;
if (receiver != null)
{
receiver.Energize(this, amount, effect);
}
}
示例4: LeechHealth
/// <summary>
/// Leeches the given amount of health from this Unit and adds it to the receiver (if receiver != null and is Unit).
/// </summary>
/// <param name="factor">The factor applied to the amount that was leeched before adding it to the receiver</param>
public void LeechHealth(Unit receiver, int amount, float factor, SpellEffect effect)
{
var initialHealth = Health;
DoSpellDamage(receiver != null ? receiver.Master : this, effect, amount);
// only apply as much as was leeched
amount = initialHealth - Health;
if (factor > 0)
{
amount = (int)(amount * factor);
}
if (receiver != null)
{
receiver.Heal(this, amount, effect);
}
}
示例5: Heal
/// <summary>
/// Heals this unit and sends the corresponding animation (healer might be null)
/// </summary>
/// <param name="effect">The effect of the spell that triggered the healing (or null)</param>
/// <param name="healer">The object that heals this Unit (or null)</param>
/// <param name="value">The amount to be healed</param>
public void Heal(Unit healer, int value, SpellEffect effect)
{
var critChance = 0f;
var crit = false;
int overheal = 0;
if (effect != null)
{
var oldVal = value;
if (healer != null)
{
if (effect.IsPeriodic)
{
// add periodic boni
if (healer is Character)
{
value = ((Character)healer).PlayerSpells.GetModifiedInt(SpellModifierType.PeriodicEffectValue, effect.Spell, value);
}
}
else
{
// add healing mods (spell power for healing)
value = healer.AddHealingModsToAction(value, effect, effect.Spell.Schools[0]);
}
}
if (this is Character)
{
value += (int) ((oldVal*((Character) this).HealingTakenModPct)/100);
}
critChance = GetSpellCritChance((DamageSchool) effect.Spell.SchoolMask)*100;
// do a critcheck
if (!effect.Spell.AttributesExB.HasFlag(SpellAttributesExB.CannotCrit) && critChance != 0)
{
var roll = Utility.Random(1f, 10001);
if (roll <= critChance)
{
value = (int) (value*(SpellHandler.SpellCritBaseFactor + GetIntMod(StatModifierInt.CriticalHealValuePct)));
crit = true;
}
}
}
if (value > 0)
{
value = (int)(value * Utility.Random(0.95f, 1.05f));
if (Health + value > MaxHealth)
{
overheal = (Health + value) - MaxHealth;
value = (MaxHealth - Health);
}
Health += value;
value += overheal;
CombatLogHandler.SendHealLog(healer, this, effect != null ? effect.Spell.Id : 0, value, crit, overheal);
}
if (healer != null)
{
var action = new HealAction
{
Attacker = (Unit)healer,
Victim = this,
Spell = effect != null ? effect.Spell : null,
IsCritical = crit,
Value = value
};
healer.Proc(ProcTriggerFlags.HealOther, this, action, true);
Proc(ProcTriggerFlags.Heal, healer, action, false);
OnHeal(healer, effect, value);
}
}
示例6: ClearEffects
public void ClearEffects()
{
Effects = new SpellEffect[0];
}
示例7: ReplaceEffect
/// <summary>
/// Removes the first Effect of the given Type and replace it with a new one which will be returned.
/// Appends a new one if none of the given type was found.
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public SpellEffect ReplaceEffect(SpellEffectType type)
{
for (var i = 0; i < Effects.Length; i++)
{
var effect = Effects[i];
if (effect.EffectType == type)
{
return Effects[i] = new SpellEffect();
}
}
return AddEffect(SpellEffectType.None);
}
示例8: Initialize
/// <summary>
/// Sets all default variables
/// </summary>
internal void Initialize()
{
var learnSpellEffect = GetEffect(SpellEffectType.LearnSpell);
if (learnSpellEffect == null)
{
learnSpellEffect = GetEffect(SpellEffectType.LearnPetSpell);
}
if (learnSpellEffect != null && learnSpellEffect.TriggerSpellId != 0)
{
IsTeachSpell = true;
}
// figure out Trigger spells
for (var i = 0; i < Effects.Length; i++)
{
var effect = Effects[i];
if (effect.TriggerSpellId != SpellId.None || effect.AuraType == AuraType.PeriodicTriggerSpell)
{
var triggeredSpell = SpellHandler.Get((uint)effect.TriggerSpellId);
if (triggeredSpell != null)
{
if (!IsTeachSpell)
{
triggeredSpell.IsTriggeredSpell = true;
}
else
{
LearnSpell = triggeredSpell;
}
effect.TriggerSpell = triggeredSpell;
}
else
{
if (IsTeachSpell)
{
IsTeachSpell = GetEffect(SpellEffectType.LearnSpell) != null;
}
Effects[i].IsInvalid = true;
}
}
}
foreach (var effect in Effects)
{
if (effect.EffectType == SpellEffectType.PersistantAreaAura || effect.HasTarget(ImplicitTargetType.DynamicObject))
{
DOEffect = effect;
break;
}
}
//foreach (var effect in Effects)
//{
// effect.Initialize();
//}
}
示例9: CorpseExplosionHandler
public CorpseExplosionHandler(SpellCast cast, SpellEffect effect)
: base(cast, effect)
{
}
示例10: DeathStrikeHealHandler
public DeathStrikeHealHandler(SpellCast cast, SpellEffect effect)
: base(cast, effect)
{
}
示例11: DeathCoilHandler
public DeathCoilHandler(SpellCast cast, SpellEffect effect)
: base(cast, effect)
{
}
示例12: AddBleedWeaponDamageHandler
public AddBleedWeaponDamageHandler(SpellCast cast, SpellEffect effect)
: base(cast, effect)
{
}
示例13: FerociousBiteHandler
public FerociousBiteHandler(SpellCast cast, SpellEffect effect)
: base(cast, effect)
{
}
示例14: IncDmgImmunityCount
/// <summary>
/// Adds immunity against given damage-schools
/// </summary>
public void IncDmgImmunityCount(SpellEffect effect)
{
if (m_dmgImmunities == null)
{
m_dmgImmunities = CreateDamageSchoolArr();
}
foreach (var school in effect.MiscBitSet)
{
m_dmgImmunities[(int)school]++;
}
Auras.RemoveWhere(aura =>
aura.Spell.AuraUID != effect.Spell.AuraUID &&
aura.Spell.SchoolMask.HasAnyFlag(effect.Spell.SchoolMask) &&
!aura.Spell.Attributes.HasFlag(SpellAttributes.UnaffectedByInvulnerability));
}
示例15: GetGeneratedThreat
/// <summary>
/// Threat mod in percent
/// </summary>
public virtual int GetGeneratedThreat(int dmg, DamageSchool school, SpellEffect effect)
{
if (m_threatMods == null)
{
return dmg;
}
return dmg + ((dmg * m_threatMods[(int)school]) / 100);
}