}
// regarding to phase
public static CardSimList reduceActivationEvaluation(CardSimList list, int phase, boolean ownTurn, VirtualMatch vMatch)
{
CardSimList ret = new CardSimList();
for (int i = 0; i < list.size(); i++)
{
CardSim card = list.getCard(i);
boolean allowedNow = isAllowedToActivate(card, phase, ownTurn, vMatch);
if (!allowedNow) continue;
boolean recomendedNow = allowedNow;
if (hasHint(card, HintAll.HINT_SITUATION_ACTIVATION, new HintBundle(PR_JIT_ACTIVATION)))
{
// if in stack we do not come here at all - so ignore stack checking
// JIT means Just in Time
// meaning here:
// - only as stack reaction
// - or in response to defining of blockers of opponent (after all blockers)
// - or after opponent declares attacker (after all attackers)
// - or while our own block declaration
//
// for now this leaves us to block / attack checking
boolean goOn = false;
// must do it... grml
if ((vMatch.getStack() == null) || (vMatch.getStack().isEmpty()))
{
if ((phase != MatchConstants.PHASE_COMBAT_DECLARE_ATTACKERS) && (phase != MatchConstants.PHASE_COMBAT_DECLARE_BLOCKERS))
continue;
}
if ((phase == MatchConstants.PHASE_COMBAT_DECLARE_ATTACKERS) && (!ownTurn))
{
goOn = true;
}
if ((phase == MatchConstants.PHASE_COMBAT_DECLARE_BLOCKERS) /*&& (ownTurn)*/)
{
goOn = true;
}
if (!goOn) continue;
}
else if ((allowedNow) && (ownTurn))
{
if (!((phase == MatchConstants.PHASE_MAIN1)|| (phase == MatchConstants.PHASE_MAIN2)))
{
boolean allowedMain = isAllowedToActivate(card, MatchConstants.PHASE_MAIN1, ownTurn, vMatch);
allowedMain = allowedMain || isAllowedToActivate(card, MatchConstants.PHASE_MAIN2, ownTurn, vMatch);
if (allowedMain)
recomendedNow = false;
}
}
if (recomendedNow)
ret.addCard(card);
}
return ret;
}