Пример #1
0
 @Override
 public void attemptAction(final PoliticalActionAttachment paa) {
   if (!games.strategy.triplea.Properties.getUsePolitics(getData())) {
     notifyPoliticsTurnedOff();
     return;
   }
   if (paa.canPerform(getTestedConditions())) {
     if (checkEnoughMoney(paa)) { // See if the player has got enough money to pay for the action
       // Charge for attempting the action
       chargeForAction(paa);
       // take one of the uses this round
       paa.useAttempt(getBridge());
       if (actionRollSucceeds(paa)) { // See if the action is successful
         if (actionIsAccepted(paa)) {
           // change the relationships
           changeRelationships(paa);
           // notify the players
           notifySuccess(paa);
         } else {
           // notify the players of the failed attempt
           notifyFailure(paa);
         }
       } else {
         // notify the players of the failed attempt
         notifyFailure(paa);
       }
     } else {
       // notify the player he hasn't got enough money;
       notifyMoney(paa, false);
     }
   } else {
     // notify the player the action isn't valid anymore (shouldn't happen)
     notifyNoValidAction(paa);
   }
 }