Beispiel #1
0
        public override bool AcceptMove(Movable movable)
        {
            if (movable.GetType() == typeof(Movables.Baricade))
                return false;

            return base.AcceptMove(movable);
        }
Beispiel #2
0
        public virtual void Place(Movable movable)
        {
            if(movable.HasMovesLeft)
            {
                RemovePreviousMovable(movable);

                TempChild = movable;
            }
            else
            {
                if(!IsEmpty)
                {
                    if (Child is Pawn)
                    {
                        //geslagen Child gaat naar juiste collectionfield'
                        var sendToAfterHit = SendToAfterHit(Child as Pawn);
                        sendToAfterHit.Children.Add(Child);
                        Child.StandingOn = sendToAfterHit;
                    }

                    if(Child is Movables.Baricade)
                    {
                        Game.Current.SetBaricadeMoveMode(Child);
                    }
                    //baricademode moet worden aangezet als baricade wordt geslagen
                }
                RemovePreviousMovable(movable);
                
                Child = movable;                
            }
        }
Beispiel #3
0
        public static string Convert(Movable field)
        {
            var cf = field as Pawn;
            if (cf != null)
                return $"{cf.Number}";

            return "B";
        }
Beispiel #4
0
        public override bool AcceptMove(Movable movable)
        {
            if (movable.GetType() == typeof(Movables.Baricade))
                return false;

            if (movable.Owner != Player && !movable.IsHit)
                return false;

            if (Children.Count < 4)
                return base.AcceptMove(movable);

            return false;
        }
Beispiel #5
0
        public override bool AcceptMove(Movable movable)
        {
            if(movable.IsLastMove && !IsEmpty)
            {
                return false;
            }

            if(movable is Movables.Baricade)
            {
                return false;
            }

            return base.AcceptMove(movable);
        }
Beispiel #6
0
        public override bool AcceptMove(Movable movable)
        {

            if(movable is Pawn)
            {
                if(Child is Movables.Baricade)
                {
                    if(movable.HasMovesLeft)
                    {
                        return false;
                    }                 
                }
                else 
                {
                    if(!IsEmpty)
                    {
                        return movable.CanHit(Child.Owner);

                        //var pawn = movable as Pawn;
                        //var child = Child as Pawn;
                        //if (pawn.Owner == child.Owner && movable.IsLastMove)
                        //{
                        //    return false;
                        //}
                    }                    
                }
            }

            if(movable is Movables.Baricade)
            {
                if (Child != null)
                {
                    return false;
                }
            }

            return true;
        }
Beispiel #7
0
 public override bool AcceptMove(Movable movable)
 {
     return false;
 }
Beispiel #8
0
 public abstract bool AcceptMove(Movable movable);
Beispiel #9
0
 internal void SetBaricadeMoveMode(Movable baricade)
 {
     MovingBaricade = baricade;
     SetBaricadeCursor(baricade.StandingOn);
     IsBaricadeMoveModeActive = true;
 }
Beispiel #10
0
        public void ClearPrevious(Movable movable)
        {
            var cf = movable.StandingOn as ContainerField;
            if (cf != null)
            {                
                if (cf.TempChild == movable)
                    cf.TempChild = null;
                else
                    cf.Child = null;
            }

            var collf = movable.StandingOn as CollectionField;
            if (collf != null)
                collf.Children.Remove(movable);
        }
Beispiel #11
0
 void RemovePreviousMovable(Movable movable)
 {
     if (movable.IsFirstMove)
     {
         var standingOnContainer = movable.StandingOn as ContainerField;
         if (standingOnContainer == null)
         {
             var standingOnCollection = movable.StandingOn as CollectionField;
             standingOnCollection.Children.Remove(movable);
         }
         else //container
         {
             standingOnContainer.Child = null;
         }
     }
     else
     {
         var standingOnContainer = movable.StandingOn as ContainerField;
         if (standingOnContainer != null)
         {
             standingOnContainer.TempChild = null;
         }
     }
 }
Beispiel #12
0
        public override void Place(Movable movable)
        {
            base.Place(movable);

            Game.Current.SetWin();
        }