本文整理汇总了C#中UnitSelectionDelegate类的典型用法代码示例。如果您正苦于以下问题:C# UnitSelectionDelegate类的具体用法?C# UnitSelectionDelegate怎么用?C# UnitSelectionDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnitSelectionDelegate类属于命名空间,在下文中一共展示了UnitSelectionDelegate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CastFreeze
/// <summary>
/// Cast "Freeze" pet ability on a target. Uses a local store for location to
/// avoid target position changing during cast preparation and being out of
/// range after range check
/// </summary>
/// <param name="onUnit">target to cast on</param>
/// <returns></returns>
public static Composite CastFreeze( UnitSelectionDelegate onUnit, SimpleBooleanDelegate require = null)
{
if (onUnit == null)
return new ActionAlwaysFail();
if (require == null)
require = req => true;
return new Sequence(
ctx => onUnit(ctx),
new Decorator(
req => req != null && (req as WoWUnit).SpellDistance() < 40 && require(req),
new Action( r =>
{
_locFreeze = (r as WoWUnit).Location;
if (StyxWoW.Me.Location.Distance(_locFreeze) > 45)
_locFreeze = WoWMathHelper.CalculatePointFrom(StyxWoW.Me.Location, _locFreeze, 7f + (r as WoWUnit).CombatReach);
if (StyxWoW.Me.Location.Distance(_locFreeze) > 45)
return RunStatus.Failure;
return RunStatus.Success;
})
),
new Throttle( TimeSpan.FromMilliseconds(250),
Pet.CastPetActionOnLocation(
"Freeze",
on => _locFreeze,
ret => !Me.CurrentTarget.TreatAsFrozen()
)
)
);
}
开发者ID:aash,项目名称:Singular,代码行数:38,代码来源:Frost.cs
示例2: MovementMoveBehind
public Composite MovementMoveBehind(UnitSelectionDelegate toUnit)
{
return
new Decorator(
ret =>
THSettings.Instance.AutoMove &&
DateTime.Now > DoNotMove &&
!Me.Mounted &&
!IsOverrideModeOn &&
!Me.IsCasting &&
//!Me.IsChanneling &&
toUnit != null &&
toUnit(ret) != null &&
toUnit(ret) != Me &&
toUnit(ret).IsAlive &&
//only MovementMoveBehind if IsWithinMeleeRange
GetDistance(toUnit(ret)) <= 5 &&
!Me.IsBehind(toUnit(ret)) &&
//!IsTank(Me) &&
//Only Move again After a certain delay or target move 3 yard from original posision
(toUnit(ret).IsPlayer ||
!toUnit(ret).IsPlayer && toUnit(ret).CurrentTarget != Me && toUnit(ret).Combat),
new Action(ret =>
{
WoWPoint pointBehind =
toUnit(ret).Location.RayCast(
toUnit(ret).Rotation + WoWMathHelper.DegreesToRadians(150), 3f);
Navigator.MoveTo(pointBehind);
return RunStatus.Failure;
}));
}
开发者ID:bjss1976,项目名称:shamanspecialedition,代码行数:32,代码来源:THMovement.cs
示例3: CreateHunterTrapBehavior
public static Composite CreateHunterTrapBehavior(string trapName, bool useLauncher, UnitSelectionDelegate onUnit)
{
return new PrioritySelector(
new Decorator(
ret => onUnit != null && onUnit(ret) != null && onUnit(ret).DistanceSqr < 40 * 40 &&
SpellManager.HasSpell(trapName) && !SpellManager.Spells[trapName].Cooldown,
new PrioritySelector(
Spell.BuffSelf(trapName, ret => !useLauncher),
Spell.BuffSelf("Trap Launcher", ret => useLauncher),
new Decorator(
ret => StyxWoW.Me.HasAura("Trap Launcher"),
new Sequence(
new Switch<string>(ctx => trapName,
new SwitchArgument<string>("Immolation Trap",
new Action(ret => LegacySpellManager.CastSpellById(82945))),
new SwitchArgument<string>("Freezing Trap",
new Action(ret => LegacySpellManager.CastSpellById(60192))),
new SwitchArgument<string>("Explosive Trap",
new Action(ret => LegacySpellManager.CastSpellById(82939))),
new SwitchArgument<string>("Ice Trap",
new Action(ret => LegacySpellManager.CastSpellById(82941))),
new SwitchArgument<string>("Snake Trap",
new Action(ret => LegacySpellManager.CastSpellById(82948)))
),
new ActionSleep(200),
new Action(ret => LegacySpellManager.ClickRemoteLocation(onUnit(ret).Location)))))));
}
开发者ID:killingzor,项目名称:pqrotation-profiles,代码行数:27,代码来源:Common.cs
示例4: CreateFaceTargetBehavior
public static Composite CreateFaceTargetBehavior(UnitSelectionDelegate toUnit, float viewDegrees = 70f)
{
return new Decorator(
ret =>
!SingularSettings.Instance.DisableAllMovement && toUnit != null && toUnit(ret) != null &&
!StyxWoW.Me.IsMoving && !toUnit(ret).IsMe &&
!StyxWoW.Me.IsSafelyFacing(toUnit(ret), viewDegrees ),
new Action(ret =>
{
StyxWoW.Me.CurrentTarget.Face();
return RunStatus.Failure;
}));
}
开发者ID:superkhung,项目名称:SingularMod,代码行数:13,代码来源:Movement.cs
示例5: Cast
private static Composite Cast(string spell, UnitSelectionDelegate onUnit, Selection<bool> reqs = null)
{
return
new Decorator(
ret => onUnit != null && onUnit(ret) != null &&
((reqs != null && reqs(ret)) || (reqs == null)) &&
SpellManager.CanCast(spell, onUnit(ret), true),
new Sequence(
new Action(ret => SpellManager.Cast(spell, onUnit(ret))),
new Action(
ret =>
Log.Info(string.Format("[Casting:{0}] [Target:{1}] [Distance:{2:F1}yds]", spell,
onUnit(ret).SafeName, onUnit(ret).Distance)))
));
}
开发者ID:Lbniese,项目名称:IWantMovement2,代码行数:15,代码来源:CombatRoutineHook.cs
示例6: Cast
public static Composite Cast(string spell, UnitSelectionDelegate onUnit, Selection<bool> reqs = null)
{
return
new Decorator(
ret =>
(onUnit != null && onUnit(ret) != null && (reqs == null || reqs(ret)) &&
AbilityManager.CanCast(spell, onUnit(ret))),
new PrioritySelector(
new Action(delegate
{
Logger.Write(">> Casting << " + spell);
return RunStatus.Failure;
}),
new Action(ret => AbilityManager.Cast(spell, onUnit(ret))))
);
}
开发者ID:Markeeen,项目名称:BuddyWing.DefaultCombat,代码行数:16,代码来源:Spell.cs
示例7: CreateInterruptSpellCast
/// <summary>Creates an interrupt spell cast composite. This will attempt to use racials before any class/spec abilities. It will attempt to stun if possible!</summary>
/// <remarks>Created 9/7/2011.</remarks>
/// <param name="onUnit">The on unit.</param>
/// <returns>.</returns>
public static Composite CreateInterruptSpellCast(UnitSelectionDelegate onUnit)
{
return
new Decorator(
// If the target is casting, and can actually be interrupted, AND we've waited out the double-interrupt timer, then find something to interrupt with.
ret => onUnit != null && onUnit(ret) != null && onUnit(ret).IsCasting && onUnit(ret).CanInterruptCurrentSpellCast
/* && PreventDoubleInterrupt*/,
new PrioritySelector(
Spell.Cast("Rebuke", onUnit),
Spell.Cast("Avenger's Shield", onUnit),
Spell.Cast("Hammer of Justice", onUnit),
Spell.Cast("Repentance", onUnit,
ret => onUnit(ret).IsPlayer || onUnit(ret).IsDemon || onUnit(ret).IsHumanoid ||
onUnit(ret).IsDragon || onUnit(ret).IsGiant || onUnit(ret).IsUndead),
Spell.Cast("Kick", onUnit),
Spell.Cast("Gouge", onUnit, ret => !onUnit(ret).IsBoss() && !onUnit(ret).MeIsSafelyBehind), // Can't gouge bosses.
Spell.Cast("Counterspell", onUnit),
Spell.Cast("Wind Shear", onUnit),
Spell.Cast("Pummel", onUnit),
// Gag Order only works on non-bosses due to it being a silence, not an interrupt!
Spell.Cast("Heroic Throw", onUnit, ret => TalentManager.GetCount(3, 7) == 2 && !onUnit(ret).IsBoss()),
Spell.Cast("Silence", onUnit),
Spell.Cast("Silencing Shot", onUnit),
// Can't stun most bosses. So use it on trash, etc.
Spell.Cast("Bash", onUnit, ret => !onUnit(ret).IsBoss()),
Spell.Cast("Skull Bash (Cat)", onUnit, ret => StyxWoW.Me.Shapeshift == ShapeshiftForm.Cat),
Spell.Cast("Skull Bash (Bear)", onUnit, ret => StyxWoW.Me.Shapeshift == ShapeshiftForm.Bear),
Spell.Cast("Solar Beam", onUnit, ret => StyxWoW.Me.Shapeshift == ShapeshiftForm.Moonkin),
Spell.Cast("Strangulate", onUnit),
Spell.Cast("Mind Freeze", onUnit),
// Racials last.
Spell.Cast("Arcane Torrent", onUnit),
// Don't waste stomp on bosses. They can't be stunned 99% of the time!
Spell.Cast("War Stomp", onUnit, ret => !onUnit(ret).IsBoss() && onUnit(ret).Distance < 8)
));
}
开发者ID:killingzor,项目名称:pqrotation-profiles,代码行数:50,代码来源:Common.cs
示例8: CastFreeze
/// <summary>
/// Cast "Freeze" pet ability on a target. Uses a local store for location to
/// avoid target position changing during cast preparation and being out of
/// range after range check
/// </summary>
/// <param name="onUnit">target to cast on</param>
/// <returns></returns>
public static Composite CastFreeze( UnitSelectionDelegate onUnit )
{
return new Sequence(
new Decorator(
ret => onUnit != null && onUnit(ret) != null,
new Action( ret => _locFreeze = onUnit(ret).Location)
),
new Throttle( TimeSpan.FromMilliseconds(250),
Pet.CreateCastPetActionOnLocation(
"Freeze",
on => _locFreeze,
ret => Me.Pet.ManaPercent >= 12
&& Me.Pet.Location.Distance(_locFreeze) < 45
&& !Me.CurrentTarget.IsFrozen()
)
)
);
}
开发者ID:superkhung,项目名称:SingularMod3,代码行数:25,代码来源:Frost.cs
示例9: MovementMoveStop
private static Composite MovementMoveStop(UnitSelectionDelegate toUnit, double range)
{
return new Decorator(
ret =>
THSettings.Instance.AutoMove &&
!IsOverrideModeOn &&
toUnit != null &&
toUnit(ret) != null &&
toUnit(ret) != Me &&
toUnit(ret).IsAlive &&
IsMoving(Me) &&
IsEnemy(toUnit(ret)) &&
GetDistance(toUnit(ret)) <= range &&
InLineOfSpellSightCheck(toUnit(ret)),
new Action(ret =>
{
Navigator.PlayerMover.MoveStop();
return RunStatus.Failure;
}));
}
开发者ID:bjss1976,项目名称:shamanspecialedition,代码行数:20,代码来源:THMovement.cs
示例10: CreateMoveToAndFace
/// <summary>
/// Creates a behavior to move within range, within LOS, and keep facing the specified target.
/// </summary>
/// <remarks>
/// Created 3/4/2011.
/// </remarks>
/// <param name = "maxRange">The maximum range.</param>
/// <param name = "coneDegrees">The cone in degrees. (If we're facing +/- this many degrees from the target, we will face the target)</param>
/// <param name = "unit">The unit.</param>
/// <param name="noMovement"></param>
/// <returns>.</returns>
protected Composite CreateMoveToAndFace(float maxRange, float coneDegrees, UnitSelectionDelegate unit, bool noMovement)
{
return new Decorator(
ret =>!SingularSettings.Instance.DisableAllMovement&& unit(ret) != null,
new PrioritySelector(
new Decorator(
ret =>(!unit(ret).InLineOfSightOCD || (!noMovement && unit(ret).DistanceSqr > maxRange * maxRange)),
new Action(ret => Navigator.MoveTo(unit(ret).Location))),
//Returning failure for movestop for smoother movement
//Rest should return success !
new Decorator(
ret =>Me.IsMoving && unit(ret).DistanceSqr <= maxRange * maxRange,
new Action(delegate
{
Navigator.PlayerMover.MoveStop();
return RunStatus.Failure;
})),
new Decorator(
ret => Me.CurrentTarget != null && Me.CurrentTarget.IsAlive && !Me.IsSafelyFacing(Me.CurrentTarget, coneDegrees),
new Action(ret => Me.CurrentTarget.Face()))
));
}
开发者ID:naacra,项目名称:wowhbbotcracked,代码行数:33,代码来源:SingularRoutine.Movement.cs
示例11: Buff
public static Composite Buff(string name, bool myBuff, UnitSelectionDelegate onUnit, params string[] buffNames)
{
return Buff(name, myBuff, onUnit, ret => true, buffNames);
}
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:4,代码来源:Spell.cs
示例12: PreventDoubleCast
/// <summary>
/// Creates a composite to avoid double casting spells on specified unit. Mostly usable for spells like Immolate, Devouring Plague etc.
/// </summary>
/// <remarks>
/// Created 19/12/2011 raphus
/// </remarks>
/// <param name="unit"> Unit to check </param>
/// <param name="spellNames"> Spell names to check </param>
/// <returns></returns>
public static Composite PreventDoubleCast(UnitSelectionDelegate unit, params string[] spellNames)
{
return
new PrioritySelector(
new Decorator(
ret =>
StyxWoW.Me.IsCasting && spellNames.Contains(StyxWoW.Me.CastingSpell.Name) && unit != null &&
unit(ret) != null &&
unit(ret).Auras.Any(
a => a.Value.SpellId == StyxWoW.Me.CastingSpellId && a.Value.CreatorGuid == StyxWoW.Me.Guid),
new Action(ret => SpellManager.StopCasting())));
}
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:21,代码来源:Spell.cs
示例13: Heal
public static Composite Heal(string name, SimpleBooleanDelegate checkMovement, UnitSelectionDelegate onUnit,
SimpleBooleanDelegate requirements, bool allowLagTollerance = false)
{
return Heal(name, checkMovement, onUnit, requirements,
ret => onUnit(ret).HealthPercent > SingularSettings.Instance.IgnoreHealTargetsAboveHealth,
false);
}
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:7,代码来源:Spell.cs
示例14: Cast
/// <summary>
/// Creates a behavior to cast a spell by ID, on a specific unit. Returns
/// RunStatus.Success if successful, RunStatus.Failure otherwise.
/// </summary>
/// <remarks>
/// Created 5/2/2011.
/// </remarks>
/// <param name = "spellId">Identifier for the spell.</param>
/// <param name = "onUnit">The on unit.</param>
/// <returns>.</returns>
public static Composite Cast(int spellId, UnitSelectionDelegate onUnit)
{
return Cast(spellId, onUnit, ret => true);
}
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:14,代码来源:Spell.cs
示例15: Cast
private Composite Cast(string spell, SimpleBooleanDelegate requirements, UnitSelectionDelegate unit)
{
return new Decorator(ret => requirements != null && requirements(ret) && SpellManager.HasSpell(spell) && SpellManager.CanCast(spell, unit(ret), true, true),
new Styx.TreeSharp.Action(ctx =>
{
SpellManager.Cast(spell, unit(ctx));
Logging.Write(LogLevel.Normal, MONK_COLOR, "Casting Spell [{0}].", spell);
return RunStatus.Success;
})
);
}
开发者ID:arkandel,项目名称:Mistweaver-Monk,代码行数:11,代码来源:Mistweaver.cs
示例16: CastLikeMonk
private Composite CastLikeMonk(string spell, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements, bool face = false)
{
return new Decorator(
ret => requirements != null && onUnit != null && requirements(ret) && onUnit(ret) != null && spell != null && CanCastLikeMonk(spell, onUnit(ret)),
new Sequence(
new Styx.TreeSharp.Action(ctx =>
{
Logging.Write(LogLevel.Normal, MONK_COLOR, "{0} on {1} at {2:F1} yds at {3:F1}%", spell, onUnit(ctx).Name, onUnit(ctx).Distance, onUnit(ctx).HealthPercent);
if (face)
onUnit(ctx).Face();
SpellManager.Cast(spell, onUnit(ctx));
}
),
new WaitContinue(TimeSpan.FromMilliseconds((int)StyxWoW.WoWClient.Latency << 1),
ctx => !(SpellManager.GlobalCooldown || StyxWoW.Me.IsCasting || StyxWoW.Me.ChanneledSpell != null),
new ActionAlwaysSucceed()
),
new WaitContinue(TimeSpan.FromMilliseconds((int)StyxWoW.WoWClient.Latency << 1),
ctx => SpellManager.GlobalCooldown || StyxWoW.Me.IsCasting || StyxWoW.Me.ChanneledSpell != null,
new ActionAlwaysSucceed()
)
)
);
}
开发者ID:arkandel,项目名称:Mistweaver-Monk,代码行数:24,代码来源:Mistweaver.cs
示例17: CreateWordOfGloryBehavior
public static Composite CreateWordOfGloryBehavior(UnitSelectionDelegate onUnit )
{
if ( HasTalent( PaladinTalents.EternalFlame ))
{
if (onUnit == null)
return new ActionAlwaysFail();
return new PrioritySelector(
ctx => onUnit(ctx),
Spell.Cast(
"Eternal Flame",
on => (WoWUnit) on,
ret => ret is WoWPlayer && PaladinSettings.KeepEternalFlameUp && Group.Tanks.Contains((WoWPlayer)onUnit(ret)) && !Group.Tanks.Any(t => t.HasMyAura("Eternal Flame"))),
Spell.Cast(
"Eternal Flame",
on => (WoWUnit) on,
ret => (Me.CurrentHolyPower >= 3 || Me.GetAuraTimeLeft("Divine Purpose", true).TotalSeconds > 0)
&& ((WoWUnit)ret).HealthPercent <= SingularSettings.Instance.Paladin().SelfEternalFlameHealth)
);
}
return new PrioritySelector(
new Decorator(
req => Me.HealthPercent <= Math.Max( PaladinSettings.SelfWordOfGloryHealth1, Math.Max( PaladinSettings.SelfWordOfGloryHealth2, PaladinSettings.SelfWordOfGloryHealth3))
&& Me.ActiveAuras.ContainsKey("Divine Purpose"),
Spell.Cast("Word of Glory", onUnit)
),
new Decorator(
req => Me.CurrentHolyPower >= 1 && Me.HealthPercent <= PaladinSettings.SelfWordOfGloryHealth1,
Spell.Cast("Word of Glory", onUnit)
),
new Decorator(
req => Me.CurrentHolyPower >= 2 && Me.HealthPercent <= PaladinSettings.SelfWordOfGloryHealth2,
Spell.Cast("Word of Glory", onUnit)
),
new Decorator(
req => Me.CurrentHolyPower >= 3 && Me.HealthPercent <= PaladinSettings.SelfWordOfGloryHealth3,
Spell.Cast("Word of Glory", onUnit)
)
);
}
开发者ID:aash,项目名称:Singular,代码行数:43,代码来源:Common.cs
示例18: CreateShieldCharge
private static Composite CreateShieldCharge(UnitSelectionDelegate onUnit = null, SimpleBooleanDelegate requirements = null)
{
if (onUnit == null)
onUnit = on => Me.CurrentTarget;
if (requirements == null)
requirements = req => true;
return new Sequence(
new Decorator(
req => Spell.DoubleCastContains(Me, "Shield Charge") || !HasShieldInOffHand,
new ActionAlwaysFail()
),
Spell.Cast("Shield Charge", onUnit, req => requirements(req), gcd: HasGcd.No),
new Action(ret => Spell.UpdateDoubleCast("Shield Charge", Me))
);
}
开发者ID:aash,项目名称:Singular,代码行数:17,代码来源:Protection.cs
示例19: CreateWarlockRessurectBehavior
public static Composite CreateWarlockRessurectBehavior(UnitSelectionDelegate onUnit)
{
if (!UseSoulstoneForBattleRez())
return new PrioritySelector();
if (onUnit == null)
{
Logger.WriteDebug("CreateWarlockRessurectBehavior: error - onUnit == null");
return new PrioritySelector();
}
return new Decorator(
ret => Me.Combat && onUnit(ret) != null && onUnit(ret).IsDead && Spell.CanCastHack( "Soulstone", onUnit(ret)) && !Group.Healers.Any(h => h.IsAlive && !h.Combat && h.SpellDistance() < 40),
new Sequence(
new Action( r => _targetRez = onUnit(r)),
new PrioritySelector(
Spell.WaitForCastOrChannel(),
Movement.CreateMoveToUnitBehavior(ret => _targetRez, 40f),
new Decorator(
ret => !Spell.IsGlobalCooldown(),
Spell.Cast("Soulstone", mov => true, on => _targetRez, req => true, cancel => ((WoWUnit)cancel).IsAlive)
)
)
)
);
}
开发者ID:superkhung,项目名称:SingularMod3,代码行数:26,代码来源:Common.cs
示例20: BuffUnit
/// <summary>
/// private function to buff individual units. makes assumptions
/// that certain states have been checked previously. only the
/// group interface to PartyBuffs is exposed since it handles the
/// case of LocalPlayer not in a group as well
/// </summary>
/// <param name="name">spell name</param>
/// <param name="onUnit">unit selection delegate</param>
/// <param name="requirements">requirements delegate that must be true to cast buff</param>
/// <param name="myMutexBuffs">list of buffs your mechanics make mutually exclusive for you to cast. For example, BuffGroup("Blessing of Kings", ret => true, "Blessing of Might") </param>
/// <returns></returns>
private static Composite BuffUnit(string name, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements, params string[] myMutexBuffs)
{
return
new Decorator(
ret => onUnit(ret) != null
&& (PartyBuffType.None != (onUnit(ret).GetMissingPartyBuffs() & GetPartyBuffForSpell(name)))
&& (myMutexBuffs == null || myMutexBuffs.Count() == 0 || !onUnit(ret).GetAllAuras().Any(a => a.CreatorGuid == StyxWoW.Me.Guid && myMutexBuffs.Contains(a.Name))),
new Sequence(
Spell.Buff( name, onUnit, requirements),
new Wait( 1, until => StyxWoW.Me.HasPartyBuff(name), new ActionAlwaysSucceed()),
new Action(ret =>
{
System.Diagnostics.Debug.Assert( PartyBuffType.None != GetPartyBuffForSpell(name));
if (PartyBuffType.None != GetPartyBuffForSpell(name))
ResetReadyToPartyBuffTimer();
else
Logger.WriteDebug("Programmer Error: should use Spell.Buff(\"{0}\") instead", name);
})
)
);
}
开发者ID:superkhung,项目名称:SingularMod3,代码行数:32,代码来源:Party.cs
注:本文中的UnitSelectionDelegate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论