本文整理汇总了C#中WCell.RealmServer.Entities.ObjectReference类的典型用法代码示例。如果您正苦于以下问题:C# ObjectReference类的具体用法?C# ObjectReference怎么用?C# ObjectReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectReference类属于WCell.RealmServer.Entities命名空间,在下文中一共展示了ObjectReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
if (!(target is Character))
{
failReason = SpellFailedReason.TargetNotPlayer;
}
}
示例2: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
Caster = casterReference.Object as Unit;
if (Caster == null || Caster is Vehicle)
{
log.Warn("Invalid SpellCaster \"{0}\" for Spell: {1}", Caster, SpellEffect.Spell);
failReason = SpellFailedReason.Error;
return;
}
Vehicle = target as Vehicle;
if (Vehicle == null)
{
failReason = SpellFailedReason.BadTargets;
}
else
{
Seat = Vehicle.GetSeatFor(Caster);
if (Seat == null)
{
// must never happen since Vehicle is unclickable when full
failReason = SpellFailedReason.BadTargets;
}
}
}
示例3: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterRef, Unit target, ref SpellFailedReason failReason)
{
var caster = creatingCast.CasterReference.Object as Unit;
if (caster == null)
{
failReason = SpellFailedReason.BadTargets;
}
else
{
if (caster.Charm != null)
{
failReason = SpellFailedReason.AlreadyHaveCharm;
}
else if (target.HasMaster)
{
failReason = SpellFailedReason.CantDoThatRightNow;
}
else if (caster.HasMaster)
{
failReason = SpellFailedReason.Possessed;
}
else if (caster is Character)
{
if (((Character)caster).ActivePet != null)
{
failReason = SpellFailedReason.AlreadyHaveSummon;
}
}
}
}
示例4: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
if (target.MaxPower == 0 || target.PowerType != (PowerType)m_spellEffect.MiscValue)
{
failReason = SpellFailedReason.BadTargets;
}
}
示例5: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterRef, Unit target, ref SpellFailedReason failReason)
{
if (!(target is NPC))
{
failReason = SpellFailedReason.BadTargets;
}
if (casterRef != null && casterRef.Object is Unit)
{
var caster = (Unit)casterRef.Object;
//if (target.Target == caster)
//{
// failReason = SpellFailedReason.NoValidTargets;
//}
//else
{
var spell = m_aura.Spell;
var hasSingleFriendTarget = spell.HasBeneficialEffects && !spell.IsAreaSpell && spell.HasTargets;
if (hasSingleFriendTarget && caster.Target != null && caster.IsFriendlyWith(caster.Target))
{
// taunting a friend, means we want to taunt his attackers
// needed for Righteous defense, amongst others
if (target.Target != caster.Target)
{
failReason = SpellFailedReason.NoValidTargets;
}
}
}
}
}
示例6: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
if (m_spellEffect.TriggerSpell == null)
{
failReason = SpellFailedReason.Error;
log.Warn("Tried to cast Spell \"{0}\" which has invalid TriggerSpellId {1}", m_spellEffect.Spell, m_spellEffect.TriggerSpellId);
}
}
示例7: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
if (target.Class != ClassId.Hunter)
{
failReason = SpellFailedReason.BadTargets;
return;
}
}
示例8: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
if (!(target is Character)) return;
var chr = (Character)target;
if (chr.Class != ClassId.Hunter)
{
failReason = SpellFailedReason.BadTargets;
}
}
示例9: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
if (target is Character)
{
var chr = (Character)target;
if (!chr.CanFly)
{
failReason = SpellFailedReason.NotHere;
}
}
}
示例10: CheckInitialize
/// <summary>
/// Ensure that the constraints are correct for the Flag aura to be applied
/// </summary>
protected override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
if (!(target is Character))
{
failReason = SpellFailedReason.BadTargets;
}
else
{
Instance = target.Region as WarsongGulch;
if (Instance == null)
{
failReason = SpellFailedReason.IncorrectArea;
}
}
}
示例11: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
form = (ShapeshiftForm)SpellEffect.MiscValue;
if (target.ShapeshiftForm == form)
{
// stances can't be undone:
if (form != ShapeshiftForm.BattleStance &&
form != ShapeshiftForm.BerserkerStance &&
form != ShapeshiftForm.DefensiveStance)
{
target.Auras.RemoveWhere(aura => aura.Spell.Id == m_aura.Spell.Id);
failReason = SpellFailedReason.DontReport;
}
}
}
示例12: CheckInitialize
protected override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
if (target is Character)
{
var chr = (Character)target;
var ap = target.TotalMeleeAP;
var sp = chr.GetDamageDoneMod(DamageSchool.Holy);
if (ap > sp)
{
totalBonus = ap;
}
else
{
totalBonus = sp;
}
}
}
示例13: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterRef, Unit target, ref SpellFailedReason failReason)
{
var caster = creatingCast.CasterReference.Object as Unit;
if (caster == null)
{
failReason = SpellFailedReason.BadTargets;
}
else
{
if (!(target is NPC))
{
LogManager.GetCurrentClassLogger().Warn("{0} tried to Charm {1} which is not an NPC, but Player charming is not yet supported.", caster, target);
failReason = SpellFailedReason.BadTargets;
}
if (caster.Charm != null)
{
failReason = SpellFailedReason.AlreadyHaveCharm;
}
else if (target.HasMaster)
{
failReason = SpellFailedReason.CantBeCharmed;
}
//else if (caster.Level < EffectValue)
//{
// failReason = SpellFailedReason.Highlevel;
//}
else if (caster.HasMaster)
{
failReason = SpellFailedReason.Charmed;
}
else if (caster is Character)
{
if (((Character)caster).ActivePet != null)
{
failReason = SpellFailedReason.AlreadyHaveSummon;
}
}
}
}
示例14: GetRadius
public float GetRadius(ObjectReference caster)
{
var radius = Radius;
var chr = caster.UnitMaster;
if (chr != null)
{
radius = chr.Auras.GetModifiedFloat(SpellModifierType.Radius, Spell, radius);
}
if (radius < 5)
{
return 5;
}
return radius;
}
示例15: CalcEffectValue
public int CalcEffectValue(ObjectReference casterReference)
{
var caster = casterReference.UnitMaster;
if (caster != null)
{
return CalcEffectValue(caster);
}
else
{
return CalcEffectValue(casterReference.Level, 0, false);
}
}