Ejemplo n.º 1
0
 public bool IsStrafePossible(CharacterInBattle target)
 {
     return(IsInRange(target) &&
            ((Character.RightHand == null) ||
             (Character.RightHand is Weapon &&
              (Character.RightHand as Weapon).WeaponClass == WeaponClass.Melee)));
 }
Ejemplo n.º 2
0
 public int GetDistance(CharacterInBattle other)
 {
     if (other != null)
     {
         return(Math.Abs(Location - other.Location));
     }
     return(-1);
 }
Ejemplo n.º 3
0
 public void MoveInFront(CharacterInBattle target)
 {
     if (IsStrafePossible(target))
     {
         OnTheSideOf = null;
         OnTheBackOf = null;
     }
 }
Ejemplo n.º 4
0
 public void MoveOnTheSide(CharacterInBattle target)
 {
     if (IsStrafePossible(target))
     {
         OnTheSideOf        = target.Character;
         OnTheBackOf        = null;
         target.OnTheSideOf = null;
         target.OnTheBackOf = null;
     }
 }
Ejemplo n.º 5
0
 public int MoveFrom(CharacterInBattle other, int distance)
 {
     OnTheSideOf = null;
     OnTheBackOf = null;
     if (Location < other.Location)
     {
         distance *= -1;
     }
     Location += distance;
     return(Math.Abs(distance));
 }
Ejemplo n.º 6
0
        public int MoveTo(CharacterInBattle other, int distance)
        {
            OnTheSideOf = null;
            OnTheBackOf = null;
            var realDistance = GetDistance(other);

            if (realDistance < Math.Abs(distance))
            {
                distance = realDistance;
            }
            if (Location > other.Location)
            {
                distance *= -1;
            }
            Location += distance;
            return(Math.Abs(distance));
        }
Ejemplo n.º 7
0
        public bool IsInRange(CharacterInBattle target)
        {
            int range = 0;

            if (Character.RightHand != null &&
                Character.RightHand is Weapon)
            {
                var RightWeapon = Character.RightHand as Weapon;
                range = RightWeapon.Range;
                if (Character.LeftHand != null &&
                    Character.LeftHand is Weapon)
                {
                    var LeftWeapon = (Character.LeftHand as Weapon);
                    if (LeftWeapon.Range < range)
                    {
                        range = LeftWeapon.Range;
                    }
                }
            }

            return(GetDistance(target) <= range);
        }