private int calculateAttack(LandTerritory passedTerritory)
        {
            //TODO: ***** calculate support
            int attackPower = 0;

            attackPower += (getAttackingInfantry().Count * infantry.getAttackPower());
            attackPower += (getAttackingKnights().Count * knight.getAttackPower());
            MarchOrder marchOrder = (MarchOrder)passedTerritory.getOrderToken();
            if (marchOrder.getStar())
            {
                attackPower += 1;
            }
            else if (marchOrder.getNegToken())
            {
                attackPower -= 1;
            }
            return attackPower;
        }
 private int calculateDefense(LandTerritory passedTerritory)
 {
     //TODO **** calculate support
     int defensePower = 0;
     defensePower += (getAttackingInfantry().Count * infantry.getDefensePower());
     defensePower += (getAttackingKnights().Count * knight.getDefensePower());
     if (passedTerritory.getOrderToken() is DefenseOrder)
     {
         DefenseOrder defenseOrder = (DefenseOrder)passedTerritory.getOrderToken();
         if (defenseOrder.getStar())
         {
             defensePower += 2;
         }
         else
         {
             defensePower += 1;
         }
     }
     return defensePower;
 }
 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);
         
     }
 }
예제 #4
0
 public string territoryPrintOut(LandTerritory passedTerritory)
 {
     string str = (territoryTextToString(passedTerritory.getHouseOccupied().getName(), passedTerritory.getNumInfantry(), passedTerritory.getNumKnight(),
                   passedTerritory.getNumSiegeEngine(), passedTerritory.getOrderToken(), passedTerritory));
     return str;
 }