How do Resistance Astromech M9-G8 and Rebel Pilot Han Solo interact with each other? The abilities read as follows:
M9-G8: While a ship you are locking performs an attack, you may choose 1 attack die. If you do, the attacker rerolls that die.
Han Solo: After you roll dice, if you are at range 0-1 of an obstacle, you may reroll all of your dice. This does not count as rerolling for the purpose of other effects.
The scenario is as follows: The ship carrying M9-G8 has a lock on Han Solo, Han Solo is at range 1 of an obstacle, and Han Solo performs an attack. Because of the attack tree the defending player modifies the attack dice first. So using M9-G8 the defending player rerolls one of Han Solo's attack dice. If Han Solo first rerolled all the dice using his ability and has a lock on the defender, what dice can he use that lock to reroll?