예제 #1
0
        public bool Attack(Borderland b, int sent)
        {
            int  def    = b.CalcDefense();
            int  atk    = CalcAttack(sent);
            bool result = false;

            if (atk > def)
            {
                //code
                int r = b.Relations[this];

                if (r > 3)
                {
                    //code
                }
                else
                {
                    //code
                }
            }
            else
            {
                //code
            }

            return(result);
        }
예제 #2
0
        public bool Attack(Borderland b, int sent)
        {
            int def = b.CalcDefense();
            int atk = CalcAttack(sent);
            bool result = false;

            if (atk > def)
            {
                //code
                int r = b.Relations[this];

                if (r > 3)
                {
                    //code
                }
                else
                {
                    //code
                }
            }
            else
            {
                //code
            }

            return result;
        }
예제 #3
0
        public int GetRelation(Borderland b)
        {
            int result = 0;

            if (MyBorders.Contains(b))
            {
                result = MyBorders[MyBorders.IndexOf(b)].BorderRelation;
            }
            else
            {
                result = OtherBorderlands[OtherBorderlands.IndexOf(b)].Relations.First(x => x.Key == this).Value;
            }

            return(result);
        }
예제 #4
0
        /*
         * Attacking Rules:
         * A nation can always attack a nation that borders itself
         * A nation can't attack a non-border nation unless at least one border nation is on friendlier terms than with the target, has relation of(1-2) with target, or is occupied/defeated
         * A player nation can't be attacked unless at least one bordering nation of the attack target is on friendlier terms than with the target, has relation of(1-2) with target, or is occupied/defeated
         */
        /*
         * public bool CanAttack(Nation n)
         * {
         *  bool result = false;
         *
         *  if (n is Borderland && ((n as Borderland).BorderingPlayer == this))
         *       result = true;
         *  else
         *  {
         *
         *  }
         *
         *  return result;
         * }
         * */
        public bool CanAttack(Borderland b)
        {
            bool result = false;

            if (b.BorderingPlayer == this)
            {
                result = true;
            }
            else
            {
                if (this is Borderland)
                {
                    result = true;
                }
                else if ((this as Player).MyBorders.Exists(x => (x.BorderRelation > 2 || x.Occupier == this)))
                {
                    result = true;
                }
            }

            return(result);
        }
예제 #5
0
        public int GetRelation(Borderland b)
        {
            int result = 0;

            if (MyBorders.Contains(b))
                result = MyBorders[MyBorders.IndexOf(b)].BorderRelation;
            else
                result = OtherBorderlands[OtherBorderlands.IndexOf(b)].Relations.First(x => x.Key == this).Value;

            return result;
        }
예제 #6
0
        /*
         * Attacking Rules:
         * A nation can always attack a nation that borders itself
         * A nation can't attack a non-border nation unless at least one border nation is on friendlier terms than with the target, has relation of(1-2) with target, or is occupied/defeated
         * A player nation can't be attacked unless at least one bordering nation of the attack target is on friendlier terms than with the target, has relation of(1-2) with target, or is occupied/defeated
         */
        /*
        public bool CanAttack(Nation n)
        {
            bool result = false;

            if (n is Borderland && ((n as Borderland).BorderingPlayer == this))
                 result = true;
            else
            {

            }

            return result;
        }
         * */
        public bool CanAttack(Borderland b)
        {
            bool result = false;

            if (b.BorderingPlayer == this)
                result = true;
            else
            {
                if (this is Borderland)
                    result = true;
                else if ((this as Player).MyBorders.Exists(x => (x.BorderRelation > 2 || x.Occupier == this)))
                    result = true;
            }

            return result;
        }