Ejemplo n.º 1
0
 // If a transport has been in combat, it cannot load AND unload in non-combat
 public static boolean isTransportUnloadRestrictedInNonCombat(final Unit transport) {
   final TripleAUnit taUnit = (TripleAUnit) transport;
   if (GameStepPropertiesHelper.isNonCombatMove(transport.getData(), true)
       && taUnit.getWasInCombat()
       && taUnit.getWasLoadedAfterCombat()) {
     return true;
   }
   return false;
 }
Ejemplo n.º 2
0
 public static Change loadTransportChange(final TripleAUnit transport, final Unit unit) {
   assertTransport(transport);
   final CompositeChange change = new CompositeChange();
   // clear the loaded by
   change.add(ChangeFactory.unitPropertyChange(unit, transport, TripleAUnit.TRANSPORTED_BY));
   final Collection<Unit> newCarrying = new ArrayList<Unit>(transport.getTransporting());
   if (newCarrying.contains(unit)) {
     throw new IllegalStateException("Already carrying, transport:" + transport + " unt:" + unit);
   }
   newCarrying.add(unit);
   change.add(ChangeFactory.unitPropertyChange(unit, Boolean.TRUE, TripleAUnit.LOADED_THIS_TURN));
   change.add(ChangeFactory.unitPropertyChange(transport, true, TripleAUnit.LOADED_THIS_TURN));
   // If the transport was in combat, flag it as being loaded AFTER combat
   if (transport.getWasInCombat()) {
     change.add(
         ChangeFactory.unitPropertyChange(transport, true, TripleAUnit.LOADED_AFTER_COMBAT));
   }
   return change;
 }