本文整理汇总了C#中WCell.RealmServer.Entities.Unit类的典型用法代码示例。如果您正苦于以下问题:C# Unit类的具体用法?C# Unit怎么用?C# Unit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Unit类属于WCell.RealmServer.Entities命名空间,在下文中一共展示了Unit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例2: 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;
}
}
}
}
}
示例3: CalculateManaRegen
/// <summary>
/// Calculates the amount of power regeneration for the class at a specific level, Intellect and Spirit.
/// Changed in 3.1, overrides for casters are redundant.
/// </summary>
public static int CalculateManaRegen(Unit unit)
{
// default mana generation
// see: http://www.wowwiki.com/Mana_regeneration
var regen = (int)((0.001f + unit.Spirit * (float)Math.Sqrt(unit.Intellect) * GameTables.GetBaseRegenForLevel(unit.Level)) * 0.6f + 0.9f); // rounded up
return regen * RegenRateFactor;
}
示例4: Init
/// <summary>
/// Method is called before the Unit is actually in the World
/// to initialize the set of Actions.
/// </summary>
/// <param name="owner"></param>
public override void Init(Unit owner)
{
base.Init(owner);
this[BrainState.Idle] = new AIIdleAction(owner);
this[BrainState.Dead] = this[BrainState.Idle];
this[BrainState.Evade] = new AIEvadeAction(owner);
this[BrainState.Roam] = new AIRoamAction(owner)
{
Strategy = new AIWaypointMoveAction(owner, AIMovementType.ForwardThenBack, owner.Waypoints)
};
this[BrainState.Follow] = new AIFollowMasterAction(owner);
this[BrainState.Guard] = new AIGuardMasterAction(owner);
if (owner is NPC)
{
this[BrainState.Combat] = new AICombatAction((NPC)owner)
{
Strategy = new AIAttackAction((NPC)owner)
};
this[BrainState.FormationMove] = new AIFormationMoveAction((NPC)owner);
}
}
示例5: 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;
}
}
}
示例6: CheckInitialize
protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
{
if (!(target is Character))
{
failReason = SpellFailedReason.TargetNotPlayer;
}
}
示例7: OnProc
public override void OnProc(Unit triggerer, IUnitAction action)
{
if (action is IDamageAction)
{
var owner = Owner;
var dmgAction = ((IDamageAction)action);
var healSelfAmount = ((dmgAction.Damage * EffectValue) + 50) / 100; // don't forget rounding
var healPartyAmount = (healSelfAmount + 3) / 5; // don't forget rounding
owner.Heal(healSelfAmount, owner, SpellEffect);
if (owner is Character)
{
var chr = (Character)owner;
var group = chr.Group;
if (group != null)
{
// heal all group members in same context (ie same Map in current implementation)
group.CallOnAllInSameContext(chr.ContextHandler, (member) =>
{
member.Heal(healPartyAmount, owner, SpellEffect);
});
}
}
}
}
示例8: SpellCollection
protected SpellCollection(Unit owner, bool initDictionary)
{
if (initDictionary)
m_byId = new Dictionary<uint, Spell>(60);
Owner = owner;
}
示例9: 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;
}
}
}
}
示例10: AuraCollection
public AuraCollection(Unit owner)
{
m_auras = new Dictionary<AuraIndexId, Aura>();
m_AuraArray = Aura.EmptyArray;
m_owner = owner;
}
示例11: CheckInitialize
protected internal override void CheckInitialize(CasterInfo casterInfo, Unit target, ref SpellFailedReason failReason)
{
if (!(target is Character))
{
failReason = SpellFailedReason.TargetNotPlayer;
}
}
示例12: SendAllAuras
public static void SendAllAuras(IPacketReceiver rcv, Unit owner)
{
using (var packet = CreateAllAuraPacket(owner))
{
rcv.Send(packet);
}
}
示例13: CheckInitialize
protected internal override void CheckInitialize(CasterInfo casterInfo, Unit target, ref SpellFailedReason failReason)
{
if (target.MaxPower == 0 || target.PowerType != (PowerType)m_spellEffect.MiscValue)
{
failReason = SpellFailedReason.BadTargets;
}
}
示例14: AIWaypointMoveAction
public AIWaypointMoveAction(Unit owner, AIMovementType waypointSequence)
: base(owner)
{
m_waypoints = new LinkedList<WaypointEntry>();
_waypointSequence = waypointSequence;
}
示例15: AIWaypointMoveAction
public AIWaypointMoveAction(Unit owner, AIMovementType wpMovementType)
: base(owner)
{
m_waypoints = new LinkedList<WaypointEntry>();
m_WPmovementType = wpMovementType;
}