コード例 #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);
        }