コード例 #1
0
 @Override
 public void end() {
   super.end();
   resetAttempts();
   if (games.strategy.triplea.Properties.getTriggers(getData())) {
     // First set up a match for what we want to have fire as a default in this delegate. List out
     // as a composite match
     // OR.
     // use 'null, null' because this is the Default firing location for any trigger that does NOT
     // have 'when' set.
     final Match<TriggerAttachment> politicsDelegateTriggerMatch =
         new CompositeMatchAnd<TriggerAttachment>(
             TriggerAttachment.availableUses,
             TriggerAttachment.whenOrDefaultMatch(null, null),
             new CompositeMatchOr<TriggerAttachment>(TriggerAttachment.relationshipChangeMatch()));
     // get all possible triggers based on this match.
     final HashSet<TriggerAttachment> toFirePossible =
         TriggerAttachment.collectForAllTriggersMatching(
             new HashSet<PlayerID>(Collections.singleton(m_player)),
             politicsDelegateTriggerMatch,
             m_bridge);
     if (!toFirePossible.isEmpty()) {
       // get all conditions possibly needed by these triggers, and then test them.
       final HashMap<ICondition, Boolean> testedConditions =
           TriggerAttachment.collectTestsForAllTriggers(toFirePossible, m_bridge);
       // get all triggers that are satisfied based on the tested conditions.
       final Set<TriggerAttachment> toFireTestedAndSatisfied =
           new HashSet<TriggerAttachment>(
               Match.getMatches(
                   toFirePossible, TriggerAttachment.isSatisfiedMatch(testedConditions)));
       // now list out individual types to fire, once for each of the matches above.
       TriggerAttachment.triggerRelationshipChange(
           toFireTestedAndSatisfied, m_bridge, null, null, true, true, true, true);
     }
   }
   chainAlliancesTogether(m_bridge);
   givesBackOriginalTerritories(m_bridge);
   // m_needToInitialize = true;
 }
コード例 #2
0
 @Override
 public void loadState(final Serializable state) {
   final PoliticsExtendedDelegateState s = (PoliticsExtendedDelegateState) state;
   super.loadState(s.superState);
 }
コード例 #3
0
 /** Called before the delegate will run. */
 @Override
 public void start() {
   super.start();
 }