// blocking that is assumed in the scoring process of the current attack.
// therefor only ONE blocker strategy is the result
void generateOpponentBlockerActions(int strategy)
{
int opponentNo = (E.pNumber+1)%2;
CardSimList attacker = vMatch.getAttacker();
CardSimList blocker = vMatch.getBattlefield(opponentNo).getSubListByType("Creature");
// remove creatures with activation ability
blocker = blocker.removeActivateable();
blocker = vMatch.removeAllreadyBlocking(blocker);
blocker = blocker.onlyTapstate(false);
String blKey = generateBlockerKey(attacker, blocker);
CombatFormation formation = blockerCache.get(blKey);
if (formation == null)
{
CombatSimConfig c = new CombatSimConfig(E.aiPlayer);
c.attackers = attacker;
c.attackerLands = vMatch.getLand(E.pNumber);
c.blockerLands = vMatch.getLand(opponentNo);
CombatSimNew csim = new CombatSimNew(attacker, blocker, c, false);
int blockerHealth = vMatch.getLife(opponentNo);
int preventDamage = EAIHelper.getDamagePrevention(vMatch, player, vMatch.getBattlefield((player)));
// TEST new Blocking!
formation = csim.computeBestBlock(blockerHealth, Weighting.DEFAULT, preventDamage);
if (formation != null)
{
blockerCache.put(blKey, formation);
}
else
{
formation = new CombatFormation();
blockerCache.put(blKey, formation);
}
cacheNotHit++;
}
else
{
cacheHit++;
}
Vector <SingleFight> fights = formation.getFormation();
int no=0;
for (int f = 0; f < fights.size(); f++)
{
SingleFight singleFight = fights.elementAt(f);
CardSim matchAttacker = vMatch.getAttacker(singleFight.attacker);
CardSimList blockers = singleFight.blocker;
if (blockers.size() > 0)
{
EAIAction target = EAIAction.createTargetAction(0, MatchConstants.PHASE_COMBAT_DECLARE_BLOCKERS, matchAttacker , -1);
for (int b = 0; b < blockers.size(); b++)
{
// using a blocker, even from a different vMatch does work,
// since vMatch in "DeclareBlcoker" uses
// mBattlefield[].getCard(blocker)
// which compares the UId of the original card.
// which in fact is allways the same!
EAIAction block = EAIAction.createDeclareBlockerAction(no, blockers.getCard(b), target);
boolean success = vMatch.executeAction(block, opponentNo,false);
if (success)
{