   result.forEach(function(maneuver, i)
   {
      LOGGER.debug(i + " maneuver = " + maneuver);
   });
});

QUnit.test("determineValidShipActions() <NAME>", function(assert)
{
   // Setup.
   const environment = EnvironmentFactory.createCoreSetEnvironment(undefined, MediumAgentStrategy, MediumAgentStrategy);
   const store = environment.store();
   Adjudicator.create(store);
   const token = environment.pilotInstances()[2]; // X-Wing.
   const agent = token.agent();
   const upgrade = new CardInstance(store, UpgradeCard.properties[UpgradeCard.LANDO_CALRISSIAN]);
   store.dispatch(CardAction.addUpgrade(token, upgrade));
   const damage = new CardInstance(store, DamageCard.CONSOLE_FIRE);
   token.receiveCriticalDamage(damage);
   environment.setActiveToken(token);

   // Run.
   const result = agent.determineValidShipActions(token);

   // Validate.
   assert.ok(result);
   assert.equal(result.length, 3);
   result.forEach(function(ability, i)
   {
      LOGGER.debug(i + " ability = " + ability);
   });
   assert.equal(result[0].sourceKey(), ShipAction.FOCUS);

   assert.ok(result[1]);
   assert.equal(result[1].source(), UpgradeCard);
   assert.equal(result[1].sourceKey(), UpgradeCard.LANDO_CALRISSIAN);

   assert.ok(result[2]);
   assert.equal(result[2].source(), DamageCard);
   assert.equal(result[2].sourceKey(), DamageCard.CONSOLE_FIRE);
});

QUnit.test("determineValidShipActions() <NAME>", function(assert)
{
   // Setup.
   const store00 = Redux.createStore(Reducer.root);
   let imperialAgent = new Agent(store00, "Imperial Agent");
   let rebelAgent = new Agent(store00, "Rebel Agent");
   const squad1 = new Squad(Faction.REBEL, "squad1", 2016, "squad1", [new CardInstance(store00, PilotCard.MAULER_MITHEL, imperialAgent, [UpgradeCard.MARKSMANSHIP]), new CardInstance(store00, PilotCard.DARK_CURSE, imperialAgent)]);
   const squad2 = new Squad(Faction.REBEL, "squad2", 2017, "squad2", [new CardInstance(store00, PilotCard.LUKE_SKYWALKER, rebelAgent, [UpgradeCard.PROTON_TORPEDOES, UpgradeCard.R2_D2_ASTROMECH]), new CardInstance(store00, PilotCard.MIRANDA_DONI, rebelAgent)]);
   const positions1 = [new Position(305, 20, 90), new Position(610, 20, 90)];
   const positions2 = [new Position(458, 895, 270), new Position(400, 400, 0)];

   const store = Redux.createStore(Reducer.root);
   const environment = new Environment(store, imperialAgent, squad1, rebelAgent, squad2, positions1, positions2);
   Adjudicator.create(store);
   imperialAgent = environment.firstAgent();
   rebelAgent = environment.secondAgent();
   const token = environment.pilotInstances()[3]; // K-Wing.
   const previousManeuver = Maneuver.properties[Maneuver.STRAIGHT_2_EASY];
   store.dispatch(Action.setTokenManeuver(token, previousManeuver));

   // Run.
   const result = rebelAgent.determineValidShipActions(token);

   // Validate.
   assert.ok(result);
   assert.equal(result.length, 6);
   assert.equal(result[0].sourceKey(), ShipAction.FOCUS);
   assert.ok(result[1]);
   assert.equal(result[1].sourceKey(), ShipAction.SLAM);
   assert.equal(result[1].context().maneuverKey, Maneuver.TURN_LEFT_2_STANDARD);

   assert.ok(result[2]);
   assert.equal(result[2].sourceKey(), ShipAction.SLAM);
   assert.equal(result[2].context().maneuverKey, Maneuver.BANK_LEFT_2_STANDARD);

   assert.ok(result[3]);
   assert.equal(result[3].sourceKey(), ShipAction.SLAM);
   assert.equal(result[3].context().maneuverKey, Maneuver.STRAIGHT_2_EASY);

   assert.ok(result[4]);
   assert.equal(result[4].sourceKey(), ShipAction.SLAM);
   assert.equal(result[4].context().maneuverKey, Maneuver.BANK_RIGHT_2_STANDARD);

   assert.ok(result[5]);
   assert.equal(result[5].sourceKey(), ShipAction.SLAM);
   assert.equal(result[5].context().maneuverKey, Maneuver.TURN_RIGHT_2_STANDARD);
});

QUnit.test("getDecloakAction()", function(assert)
{
   // Setup.
   const environment = EnvironmentFactory.createCoreSetEnvironment(undefined, MediumAgentStrategy, MediumAgentStrategy);
   const store = environment.store();
   Adjudicator.create(store);
   const agent = new Agent(store, "Imperial Agent");
   const token = new CardInstance(store, PilotCard.SIGMA_SQUADRON_PILOT, agent);
   store.dispatch(EnvironmentAction.placeToken(new Position(200, 200, 0), token));
   store.dispatch(CardAction.addCloakCount(token));

   let result;

   function callback(token, maneuverAction)
   {
      LOGGER.debug("callback()");
      result = maneuverAction;

      // Verify.
      if (result)
      {
         assert.ok(result);
         assert.ok(result.context().maneuverKey);
      }
      else
      {
         assert.ok(!result);
      }
   }

   // Run.
   result = agent.getDecloakAction(token, callback);
});

QUnit.test("getModifyAttackDiceAction() focus", function(assert)
{
   // Setup.
   const environment = EnvironmentFactory.createCoreSetEnvironment(undefined, MediumAgentStrategy, MediumAgentStrategy);
   const store = environment.store();
   Adjudicator.create(store);
   const attacker = environment.pilotInstances()[0]; // TIE Fighter
   const defender = environment.pilotInstances()[2]; // X-Wing
   const weapon = attacker.primaryWeapon();
   const caCallback = function() {};
   const combatAction = new CombatAction(store, attacker, weapon, defender, caCallback, MockAttackDice, MockDefenseDice);
   const agent = attacker.agent();
   environment.setActiveToken(attacker);
   store.dispatch(Action.setTokenCombatAction(attacker, combatAction));
   store.dispatch(CardAction.addFocusCount(attacker));

   function callback(modifyAbility)
   {
      LOGGER.debug("callback() modifyAbility = " + modifyAbility);

      // Verify.
      assert.ok(modifyAbility);
      assert.equal(modifyAbility.sourceKey(), DiceModification.ATTACK_SPEND_FOCUS);
   }

   // Run.
   agent.getModifyAttackDiceAction(attacker, defender, callback);
});

QUnit.test("getModifyDefenseDiceAction() evade", function(assert)
{
   // Setup.
   const environment = EnvironmentFactory.createCoreSetEnvironment(undefined, MediumAgentStrategy, MediumAgentStrategy);
   const store = environment.store();
   Adjudicator.create(store);
   const attacker = environment.pilotInstances()[2]; // X-Wing
   const defender = environment.pilotInstances()[0]; // TIE Fighter
   const weapon = attacker.primaryWeapon();
   const caCallback = function() {};
   const combatAction = new CombatAction(store, attacker, weapon, defender, caCallback, MockAttackDice, MockDefenseDice);
   const agent = defender.agent();
   environment.setActiveToken(attacker);
   store.dispatch(Action