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 MoveToNewTerritory(LandTerritory passedTerritory)
        {
            Infantry placeHolderInfantry;
            Knight placeHolderKnight;
            passedTerritory.setNumKnight(getAttackingKnights().Count);
            passedTerritory.setNumInfantry(getAttackingInfantry().Count);
            attacker.setNumKnight(attacker.getNumKnight() - getAttackingKnights().Count);
            attacker.setNumInfantry(attacker.getNumInfantry() - getAttackingInfantry().Count);
            passedTerritory.setHouseOccupied(attacker.getHouseOccupied());
            passedTerritory.setOrderToken(new PlaceHolderOrderToken());

            foreach(Knight k in getAttackingKnights())
            {
                attacker.getKnights().Remove(k);
                passedTerritory.getKnights().Add(k);
            }

            foreach(Infantry i in getAttackingInfantry())
            {    
                attacker.getInfantry().Remove(i);
                passedTerritory.getInfantry().Add(i);  
            }
        }
Exemplo n.º 3
0
        public void setHouseStartingLand(House house, LandTerritory land, int numInfantry, int numKnights, int numSiegeEngine)
        {
            List<Infantry> infantry = new List<Infantry>();
            List<Knight> knight = new List<Knight>();
            land.setHouseOccupied(house);
            land.setNumInfantry(numInfantry);
            for (int i = 0; i < numInfantry; i++)
            {
                infantry.Add(new Infantry());
            }
            land.setInfantry(infantry);
            land.setNumKnight(numKnights);
            for (int i = 0; i < numKnights; i++)
            {
                knight.Add(new Knight());
            }
            land.setKnights(knight);

            main.drawUnits.DrawIt(land);
        }