本文整理汇总了C#中WoWUnit.HasAura方法的典型用法代码示例。如果您正苦于以下问题:C# WoWUnit.HasAura方法的具体用法?C# WoWUnit.HasAura怎么用?C# WoWUnit.HasAura使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WoWUnit
的用法示例。
在下文中一共展示了WoWUnit.HasAura方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanCastFortitudeOn
private static bool CanCastFortitudeOn(WoWUnit unit)
{
//return !unit.HasAura("Blood Pact") &&
return !unit.HasAura("Power Word: Fortitude") &&
!unit.HasAura("Qiraji Fortitude") &&
!unit.HasAura("Commanding Shout");
}
示例2: HasMyAura
public static bool HasMyAura(string SpellName, WoWUnit Player)
{
try
{
if (!Player.HasAura(SpellName)) return false;
if (!Player.ActiveAuras[SpellName].IsActive) return false;
if (Player.ActiveAuras[SpellName].CreatorGuid != StyxWoW.Me.Guid) return false;
return true;
}
catch (Exception)
{
return false;
}
}
示例3: HasAuraStacks
public static bool HasAuraStacks(string aura, int stacks, WoWUnit unit)
{
// Active auras first.
if (unit.ActiveAuras.ContainsKey(aura))
{
return unit.ActiveAuras[aura].StackCount >= stacks;
}
// Check passive shit. (Yep)
if (unit.Auras.ContainsKey(aura))
{
return unit.Auras[aura].StackCount >= stacks;
}
// Try just plain old auras...
if (stacks == 0)
{
return unit.HasAura(aura);
}
return false;
}
示例4: HasSpiritShellAbsorb
private static bool HasSpiritShellAbsorb(WoWUnit u) { return u.HasAura(SPIRIT_SHELL_ABSORB); }
示例5: MyDebuffTime
//Used for checking how the time left on "my" debuff
private int MyDebuffTime(String spellName, WoWUnit unit)
{
using (new FrameLock())
{
if (unit.HasAura(spellName))
{
var auras = unit.GetAllAuras();
foreach (var a in auras)
{
if (a.Name == spellName && a.CreatorGuid == Me.Guid)
{
return a.TimeLeft.Seconds;
}
}
}
}
return 0;
}
示例6: DebuffTime
//Used for checking debuff timers
private int DebuffTime(String spellName, WoWUnit unit)
{
using (new FrameLock())
{
if (unit.HasAura(spellName))
{
var auras = unit.GetAllAuras();
foreach (var b in auras)
{
if (b.Name == spellName)
{
return b.TimeLeft.Seconds;
}
}
}
}
return 0;
}
示例7: IsUseItemNeeded
private bool IsUseItemNeeded(WoWUnit target)
{
return
IsViableForItemUse(target)
&& ((UseWhenMeHasAuraId > 0) && Me.HasAura(UseWhenMeHasAuraId))
|| ((UseWhenMeMissingAuraId > 0) && !Me.HasAura(UseWhenMeMissingAuraId))
|| ((UseWhenMobCastingSpellId > 0) && (target.CastingSpellId == UseWhenMobCastingSpellId))
|| ((UseWhenMobHasAuraId > 0) && target.HasAura(UseWhenMobHasAuraId))
|| ((UseWhenMobMissingAuraId > 0) && !target.HasAura(UseWhenMobMissingAuraId))
|| ((UseWhenMobHasHealthPercent > 0) && (target.HealthPercent <= UseWhenMobHasHealthPercent));
}
示例8: CastBuff
/// <summary>
/// Cast a buff on a specific target
/// </summary>
/// <param name="spellName">Name of the buff to cast</param>
/// <param name="targetUnit">WoWUnit to cast the buff on</param>
/// <returns>TRUE if the buff was cast successfully</returns>
public static bool CastBuff(string spellName, WoWUnit targetUnit)
{
if (targetUnit.HasAura(spellName) || !CanCast(spellName)) return false;
bool result = SpellManager.Cast(spellName, targetUnit);
if (!result) return false;
Utils.Log(spellName);
return true;
}
示例9: CanCastMotWOn
public bool CanCastMotWOn(WoWUnit unit)
{
return !unit.HasAura("Mark of the Wild") &&
!unit.HasAura("Embrace of the Shale Spider") &&
!unit.HasAura("Blessing of Kings");
}
示例10: HasMyAuraTimeLeft
/// <summary>
/// Returns time left in MS.
/// </summary>
/// <param name="SpellName"></param>
/// <param name="Player"></param>
/// <returns></returns>
public static int HasMyAuraTimeLeft(string SpellName, WoWUnit Player)
{
try
{
if (!Player.HasAura(SpellName)) return 0;
if (!Player.ActiveAuras[SpellName].IsActive) return 0;
if (Player.ActiveAuras[SpellName].CreatorGuid != StyxWoW.Me.Guid) return 0;
int Total = Player.ActiveAuras[SpellName].TimeLeft.Seconds * 1000;
return Player.ActiveAuras[SpellName].TimeLeft.Milliseconds + Total;
}
catch (Exception)
{
return 0;
}
}
示例11: Slowable
public Boolean Slowable(WoWUnit target)
{
foreach (string spell in Immunes)
{
if (target.HasAura(spell))
{
return false;
}
}
return true;
}
示例12: Replace
private string Replace(string prefix, string s, WoWUnit theunit)
{
string fnname = "FTWCore.Replace";
MyTimer.Start(fnname);
if (theunit != null && theunit.Guid == StyxWoW.Me.Guid)
{
if (StyxWoW.Me.HasAura("Eclipse (Solar)"))
FTWProps._eclipsedirection = -1;
else if (StyxWoW.Me.HasAura("Eclipse (Lunar)"))
FTWProps._eclipsedirection = 1;
}
// Replace aura checks with parenthese (Target.HasMyAura("Bad Aura") > 3)
string findstring = string.Format(@"{0}\.(?<action>.*)\(""(?<aura>.*)""\)", prefix);
Regex rg = new Regex(findstring);
Match match = rg.Match(s);
Dictionary<String, Object> d = new Dictionary<String, Object>();
while (match.Success)
{
if (!d.ContainsKey(match.Value))
{
string action = match.Groups["action"].Value;
string aura = match.Groups["aura"].Value;
int value = 0;
if (false) { }
else if (action == "Weapon1HasAura") value = (theunit != null && FTWCoreItems.WeaponEnchant(1) == aura) ? 1 : 0;
else if (action == "Weapon2HasAura") value = (theunit != null && FTWCoreItems.WeaponEnchant(2) == aura) ? 1 : 0;
else if (action == "AuraExpiring") value = (theunit != null) ? theunit.AuraExpiring(aura) : 0;
else if (action == "CanCast") value = (theunit != null && SpellManager.CanCast(aura, theunit)) ? 1 : 0;
else if (action == "ClearBehindMe") value = (theunit != null && StyxWoW.Me.ClearBehindMe(aura) ? 1 : 0);
else if (action == "HasAura") value = (theunit != null && theunit.HasAura(aura)) ? 1 : 0;
else if (action == "HasItem") value = StyxWoW.Me.HasItem(aura) ? 1 : 0;
else if (action == "HasMyAura") value = (theunit != null && theunit.HasMyAura(aura)) ? 1 : 0;
else if (action == "HasSpell") value = (StyxWoW.Me.HasSpell(aura)) ? 1 : 0;
else if (action == "HasTotem") value = FTWCoreStatus.HasTotem(aura) ? 1 : 0;
else if (action == "IsCasting") value = (theunit != null && theunit.CurrentSpellName() == aura) ? 1 : 0;
else if (action == "ItemOnCooldown") value = FTWCoreItems.ItemOnCooldown(aura) ? 1 : 0;
else if (action == "MyAuraExpiring") value = (theunit != null) ? theunit.MyAuraExpiring(aura) : 0;
else if (action == "MyStackCount") value = (theunit != null) ? theunit.MyStackCount(aura) : 0;
else if (action == "OnCooldown") value = FTWCoreStatus.OnCooldown(aura) ? 1 : 0;
else if (action == "PartyWithAura") value = FTWCoreUnits.GetPartyWithAura(aura);
else if (action == "PartyWithHealth") value = FTWCoreUnits.GetPartyWithHealth(aura);
else if (action == "StackCount") value = (theunit != null) ? theunit.StackCount(aura) : 0;
else if (action == "NumItems") value = (theunit != null) ? FTWCoreItems.NumItems(aura) : 0;
else throw new Exception(string.Format("Unknown action {0}!", action));
d.Add(match.Value, 0);
s = s.Replace(match.Value, value.ToString());
}
match = match.NextMatch();
}
// Replace simple properties
for (int i = 0; i < FTWProps.PropertyNames.Count(); i++)
{
string propname = FTWProps.PropertyNames[i].Trim();
if (propname.Length > 0)
{
string search = prefix + "." + propname;
if (s.Contains(search))
s = s.Replace(search, GetProperty(theunit, propname).ToString());
}
}
// Stop the timer
MyTimer.Stop(fnname);
return s;
}
示例13: GetPropValue
private double GetPropValue(WoWUnit theunit, string name)
{
double value = 0;
switch (name)
{
case "IsHostile": value = theunit != null && theunit.IsHostile ? 1 : 0; break;
case "AvgHealth": value = FTWProps.avgHealth; break;
case "AddsCount": value = FTWProps.adds.Count; break;
case "StunCount": value = theunit != null ? FTWCoreStatus.StunCount(theunit.Location) : 0; break;
case "Aggro": value = theunit != null ? (int)theunit.ThreatInfo.ThreatStatus : 5; break;
case "MovementDisabled": value = theunit != null && FTWUtils.MovementDisabled() ? 1 : 0; break;
case "ClusterSize": value = theunit != null ? theunit.ClusterSize() : 0; break;
case "CapsLock": value = FTWUtils.CapsLockDown() ? 1 : 0; break;
case "BearForm": value = theunit != null && theunit.HasAura("Bear Form") ? 1 : 0; break;
case "CatForm": value = theunit != null && theunit.HasAura("Cat Form") ? 1 : 0; break;
case "MoonkinForm": value = theunit != null && theunit.HasAura("Moonkin Form") ? 1 : 0; break;
case "NormalForm": value = theunit != null && (theunit.HasAura("Cat Form") == false && theunit.HasAura("Bear Form") == false && theunit.HasAura("Moonkin Form") == false) ? 1 : 0; break;
case "FlightForm": value = theunit != null && (theunit.HasAura("Flight Form") || theunit.HasAura("Swift Flight Form")) ? 1 : 0; break;
case "FeralForm": value = theunit != null && (theunit.HasAura("Bear Form") || theunit.HasAura("Cat Form")) ? 1 : 0; break;
case "ComboPoints": value = StyxWoW.Me.ComboPoints; break;
case "AllComboPoints": value = StyxWoW.Me.RawComboPoints; break;
case "Rage": value = StyxWoW.Me.RageInfo.CurrentI; break;
case "Focus": value = StyxWoW.Me.FocusInfo.CurrentI; break;
case "Energy": value = StyxWoW.Me.EnergyInfo.CurrentI; break;
case "ShadowOrbs": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.ShadowOrbs).CurrentI; break;
case "SoulShards": value = StyxWoW.Me.SoulShardsInfo.CurrentI; break;
case "Balance": value = StyxWoW.Me.UnitPower(8); break;
case "HolyPower": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.HolyPower).CurrentI; break;
case "Chi": value = StyxWoW.Me.UnitPower(12); break;
case "BurningEmbers": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.BurningEmbers).CurrentI; break;
case "DemonicFury": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.DemonicFury).CurrentI; break;
case "EclipseDirection": value = FTWProps._eclipsedirection; break;
case "Distance": value = theunit != null ? theunit.Distance2D : 0; break;
case "MeleeRange": value = 4.95; break;
case "IsTank": value = StyxWoW.Me.IsTank() ? 1 : 0; break;
case "IsHealer": value = StyxWoW.Me.IsHealer() ? 1 : 0; break;
case "IsDPS": value = StyxWoW.Me.IsDPS() ? 1 : 0; break;
case "IsDemon": value = theunit != null && theunit.CreatureType == WoWCreatureType.Demon ? 1 : 0; break;
case "IsElemental": value = theunit != null && theunit.CreatureType == WoWCreatureType.Elemental ? 1 : 0; break;
case "IsBeast": value = theunit != null && theunit.CreatureType == WoWCreatureType.Beast ? 1 : 0; break;
case "IsCritter": value = theunit != null && theunit.CreatureType == WoWCreatureType.Critter ? 1 : 0; break;
case "IsDragon": value = theunit != null && theunit.CreatureType == WoWCreatureType.Dragon ? 1 : 0; break;
case "IsGasCloud": value = theunit != null && theunit.CreatureType == WoWCreatureType.GasCloud ? 1 : 0; break;
case "IsGiant": value = theunit != null && theunit.CreatureType == WoWCreatureType.Giant ? 1 : 0; break;
case "IsHumanoid": value = theunit != null && theunit.CreatureType == WoWCreatureType.Humanoid ? 1 : 0; break;
case "IsMechanical": value = theunit != null && theunit.CreatureType == WoWCreatureType.Mechanical ? 1 : 0; break;
case "IsNonCombatPet": value = theunit != null && theunit.CreatureType == WoWCreatureType.NonCombatPet ? 1 : 0; break;
case "IsTotem": value = theunit != null && theunit.CreatureType == WoWCreatureType.Totem ? 1 : 0; break;
case "IsUndead": value = theunit != null && theunit.CreatureType == WoWCreatureType.Undead ? 1 : 0; break;
case "Health": value = theunit != null ? (int)theunit.HealthPercent : 100; break;
case "Mana": value = theunit != null && (theunit.PowerType == WoWPowerType.Mana || theunit.Class == WoWClass.Druid) ? theunit.ManaPercent : 100; break;
case "Mounted": value = theunit != null && (theunit.Mounted) ? 1 : 0; break;
case "InBattleground": value = Battlegrounds.IsInsideBattleground ? 1 : 0; break;
case "InParty": value = StyxWoW.Me.GroupInfo.IsInParty || StyxWoW.Me.GroupInfo.IsInRaid ? 1 : 0; break;
case "InRaid": value = StyxWoW.Me.GroupInfo.IsInRaid ? 1 : 0; break;
case "IsDiseased": value = theunit != null && theunit.IsDiseased() ? 1 : 0; break;
case "Dead": value = theunit != null && theunit.IsDead ? 1 : 0; break;
case "IsCasting": value = theunit != null && (theunit.IsCasting || theunit.IsChanneling) ? 1 : 0; break;
case "IsMoving": value = theunit != null && theunit.IsMoving ? 1 : 0; break;
case "IsFlying": value = theunit != null && theunit.IsFlying ? 1 : 0; break;
case "LineOfSight": value = theunit != null && theunit.InLineOfSight ? 1 : 0; break;
case "Interruptable": value = theunit != null && theunit.CanInterruptCurrentSpellCast ? 1 : 0; break;
case "IsElite": value = theunit != null && (theunit.Elite || theunit.Name.Contains("Training Dummy")) ? 1 : 0; break;
case "IsBehind": value = theunit != null && theunit.CurrentTarget != null && theunit.CurrentTarget.MeIsSafelyBehind ? 1 : 0; break;
case "IsFacingTarget": value = theunit != null && theunit.CurrentTarget != null && theunit.IsSafelyFacing(theunit.CurrentTarget) ? 1 : 0; break;
case "IsFleeing": value = theunit != null && theunit.Fleeing ? 1 : 0; break;
case "IsIncapacitated": value = theunit != null && (theunit.IsDead || theunit.IsCrowdControlled()) ? 1 : 0; break;
case "IsRooted": value = theunit != null && theunit.HasAuraWithMechanic(WoWSpellMechanic.Rooted, WoWSpellMechanic.Shackled) ? 1 : 0; break;
case "IsLooting": value = BotPoi.Current.Type == PoiType.Loot ? 1 : 0; break;
case "PetIsMissing": value = StyxWoW.Me.PetIsMissing(); break;
case "TotemCount": value = theunit != null ? FTWCoreStatus.TotemCount() : 0; break;
case "RuneCount": value = StyxWoW.Me.DeathRuneCount +
StyxWoW.Me.FrostRuneCount +
StyxWoW.Me.BloodRuneCount +
StyxWoW.Me.UnholyRuneCount; break;
case "DeathRune": value = StyxWoW.Me.DeathRuneCount; break;
case "FrostRune": value = StyxWoW.Me.FrostRuneCount; break;
case "BloodRune": value = StyxWoW.Me.BloodRuneCount; break;
case "UnholyRune": value = StyxWoW.Me.UnholyRuneCount; break;
case "RunicPower": value = StyxWoW.Me.RunicPowerPercent; break;
case "LevelDiff": value = theunit != null ? theunit.Level - StyxWoW.Me.Level : 0; break;
case "Level": value = theunit != null ? theunit.Level : 0; break;
default: throw new Exception(string.Format("Unknown property {0}!", name));
}
return value;
}
示例14: Buff
public static Composite Buff(SimpleStringDelegate name, bool myBuff, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements, params string[] buffNames)
{
return new Decorator(
ret =>
{
if (onUnit == null || name == null || requirements == null)
return false;
_buffUnit = onUnit(ret);
if (_buffUnit == null)
return false;
_buffName = name(ret);
if (_buffName == null)
return false;
if (DoubleCastPreventionDict.Contains(_buffUnit, _buffName))
return false;
if (!buffNames.Any())
return !(myBuff ? _buffUnit.HasMyAura(_buffName) : _buffUnit.HasAura(_buffName));
bool buffFound;
try
{
if (myBuff)
buffFound = buffNames.Any(b => _buffUnit.HasMyAura(b));
else
buffFound = buffNames.Any(b => _buffUnit.HasAura(b));
}
catch
{
// mark as found buff, so we return false
buffFound = true;
}
return !buffFound;
},
new Sequence(
// new Action(ctx => _lastBuffCast = name),
Cast( sp => _buffName, chkMov => true, on => _buffUnit, requirements, cancel => false /* causes cast to complete */ ),
new Action(ret => UpdateDoubleCastDict(_buffName, _buffUnit))
)
);
}
示例15: IsViableForItemUse
// 24Feb2013-08:11UTC chinajade
private bool IsViableForItemUse(WoWUnit wowUnit)
{
return
IsViableForInteracting(wowUnit)
&& wowUnit.IsAlive
&& !wowUnit.HasAura(ItemAppliesAuraId);
}