private void assignDefender(LandTerritory passedTerritory)
 {
     defender = passedTerritory;
     
     if (!attacker.Equals(defender))
     {
         main.PopupLable1.Content = "A: " + attacker.getHouseOccupied().getName()  + ": " + calculateAttack(attacker);
         main.PopupLable2.Content = "D: " + defender.getHouseOccupied().getName() + ": " + calculateDefense(defender);
         main.Popup1.IsOpen = true;
         attacker.setOrderToken(new PlaceHolderOrderToken());
     }
     CancelAttack();
     
 }
        public void DrawIt(LandTerritory passedTerritory)
        {
            passedTerritory.getStackPanel().Children.Clear();
            passedTerritory.getStackPanel().Orientation = System.Windows.Controls.Orientation.Horizontal;
            string fileString = "";

            foreach (Knight k in passedTerritory.getKnights())
            {
                fileString = "C:\\Users\\User\\Desktop\\GameOfThronesProject\\GameOfThronesUnits\\" + passedTerritory.getHouseOccupied().getName() + "Knight.jpg";
                System.Windows.Controls.Image image1 = new System.Windows.Controls.Image();
                image1.Source = new BitmapImage(new Uri(fileString, UriKind.RelativeOrAbsolute));
                passedTerritory.getStackPanel().Children.Add(image1);
            }

            foreach (Infantry i in passedTerritory.getInfantry())
            {
                fileString = "C:\\Users\\User\\Desktop\\GameOfThronesProject\\GameOfThronesUnits\\" + passedTerritory.getHouseOccupied().getName() + "Footman.jpg";
                System.Windows.Controls.Image image1 = new System.Windows.Controls.Image();
                image1.Source = new BitmapImage(new Uri(fileString, UriKind.RelativeOrAbsolute));
                passedTerritory.getStackPanel().Children.Add(image1);
            }
            
        }
 public void doMarchOrder(LandTerritory passedTerritory)
 {
     if (attack)
     {
         if (passedTerritory.getOrderToken() is MarchOrder)
         {   
             showMarchTroopPopup(passedTerritory);
             assignAttacker(passedTerritory);
         }
     }
     else
     {
         //main.PopupChooseMarchTroops.IsOpen = false;
         
         //has enemy troops
         if (passedTerritory.getNumKnight() > 0 || passedTerritory.getNumInfantry() > 0 && !(passedTerritory.getHouseOccupied().Equals(attacker.getHouseOccupied())))
         {
             assignDefender(passedTerritory);
         }
         //Click on same territory to cancel attack
         else if (passedTerritory.Equals(attacker))
         {
             CancelAttack();
         }
         //Moving between friendly territories
         else if (passedTerritory.getHouseOccupied().Equals(attacker.getHouseOccupied()))
         {
             passedTerritory.setNumInfantry(passedTerritory.getNumInfantry() + getAttackingInfantry().Count);
             passedTerritory.setNumKnight(passedTerritory.getNumKnight() + getAttackingKnights().Count);
             attacker.setNumKnight(attacker.getNumKnight() - getAttackingKnights().Count);
             attacker.setNumInfantry(attacker.getNumInfantry() - getAttackingInfantry().Count);
             showMarchTroopPopup(attacker);
         }
         //Empty territory/has just a power token
         else
         {
             MoveToNewTerritory(passedTerritory);
             showMarchTroopPopup(attacker);
         }
         main.drawUnits.DrawIt(passedTerritory);
         main.drawUnits.DrawIt(attacker);
         
     }
 }
        private void routeTroops(LandTerritory passedTerritory)
        {


            if (passedTerritory.Equals(attacker))
            {

                //attacker lost

            }
            else
            {
                foreach (string s in passedTerritory.getConnections())
                {
                    if (main.resources.allLandConnections[s].getHouseOccupied().Equals(passedTerritory.getHouseOccupied()) || main.resources.allLandConnections[s].getHouseOccupied() is HouseNeutral)
                    {
                        main.resources.allLandConnections[s].getButton().IsEnabled = true;
                    }
                }

                //defender lost
                main.takeTurn.disableButtons(passedTerritory.getHouseOccupied());
            }
        }
 public string territoryPrintOut(LandTerritory passedTerritory)
 {
     string str = (territoryTextToString(passedTerritory.getHouseOccupied().getName(), passedTerritory.getNumInfantry(), passedTerritory.getNumKnight(),
                   passedTerritory.getNumSiegeEngine(), passedTerritory.getOrderToken(), passedTerritory));
     return str;
 }