예제 #1
0
 public bool IsStrafePossible(CharacterInBattle target)
 {
     return(IsInRange(target) &&
            ((Character.RightHand == null) ||
             (Character.RightHand is Weapon &&
              (Character.RightHand as Weapon).WeaponClass == WeaponClass.Melee)));
 }
예제 #2
0
 public int GetDistance(CharacterInBattle other)
 {
     if (other != null)
     {
         return(Math.Abs(Location - other.Location));
     }
     return(-1);
 }
예제 #3
0
 public void MoveInFront(CharacterInBattle target)
 {
     if (IsStrafePossible(target))
     {
         OnTheSideOf = null;
         OnTheBackOf = null;
     }
 }
예제 #4
0
 public void MoveOnTheSide(CharacterInBattle target)
 {
     if (IsStrafePossible(target))
     {
         OnTheSideOf        = target.Character;
         OnTheBackOf        = null;
         target.OnTheSideOf = null;
         target.OnTheBackOf = null;
     }
 }
예제 #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));
 }
예제 #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));
        }
예제 #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);
        }