public bool AddRange(Unit unit) { if (!HasUnit()) { return(false); } if (CombatInterface.IsEnemy(GetUnit(), unit)) { if ((unit.Realm == Realms.REALMS_REALM_NEUTRAL && !unit.Aggressive) || (!unit.IsPlayer() && !unit.Aggressive) || (!GetUnit().IsPlayer() && !GetUnit().Aggressive) || (unit is Creature && ((Creature)unit).Entry == 47) /*|| (unit is Creature && !unit.IsPlayer() && !unit.IsGameObject() && IsNeutralFaction(unit as Creature))*/) { return(true); } lock (RangedEnemies) RangedEnemies.Add(unit.GetUnit()); } else { lock (RangedAllies) RangedAllies.Add(unit.GetUnit()); } return(true); }
public bool AddRange(Unit Obj) { if (!HasUnit()) { return(false); } if (CombatInterface.IsEnemy(GetUnit(), Obj)) { RangedEnemies.Add(Obj.GetUnit()); } else { RangedAllies.Add(Obj.GetUnit()); } return(true); }
public override GameData.AbilityResult CanCast(bool IsStart) { GameData.AbilityResult Result = GameData.AbilityResult.ABILITYRESULT_OK; if (Target == null) { Result = GameData.AbilityResult.ABILITYRESULT_ILLEGALTARGET; } else if (Target.IsDead) { Result = GameData.AbilityResult.ABILITYRESULT_ILLEGALTARGET_DEAD; } else if (!CombatInterface.CanAttack(Ab.Caster.GetUnit(), Target)) { Result = GameData.AbilityResult.ABILITYRESULT_ILLEGALTARGET_NOT_PVP_FLAGGED; } else if (!CombatInterface.IsEnemy(Ab.Caster.GetUnit(), Target)) { Result = GameData.AbilityResult.ABILITYRESULT_ILLEGALTARGET_IN_YOUR_ALLIANCE; } else if (IsStart) { float Distance = Ab.Caster.GetDistanceTo(Target); if (Distance > Ab.Info.Info.MaxRange) { Result = GameData.AbilityResult.ABILITYRESULT_OUTOFRANGE; } else if (Distance < Ab.Info.Info.MinRange) { Result = GameData.AbilityResult.ABILITYRESULT_TOOCLOSE; } else if (Ab.Info.Info.MaxRange <= 5 && !Ab.Caster.IsObjectInFront(Target, 110)) { Result = GameData.AbilityResult.ABILITYRESULT_OUT_OF_ARC; } } else { CalcualteStat(); // get Offensive/Defensive stat //Result = CheckBlock(); // check for parry, evade or disrupt. } return(Result); }
public override GameData.AbilityResult CanCast(bool IsStart) { GameData.AbilityResult Result = GameData.AbilityResult.ABILITYRESULT_OK; if (Target == null) { Result = GameData.AbilityResult.ABILITYRESULT_ILLEGALTARGET; } else if (!Target.IsDead) { Result = GameData.AbilityResult.ABILITYRESULT_ILLEGALTARGET_DEAD; } else if (CombatInterface.IsEnemy(Ab.Caster.GetUnit(), Target)) { Result = GameData.AbilityResult.ABILITYRESULT_ILLEGALTARGET_IN_YOUR_ALLIANCE; } return(Result); }