if (AIHelper.hasHint(cardToPayFor, "EFFECT_ONE_CREATURE_DAMAGE"))
{
if (!((AIHelper.hasHint(cardToPayFor, "EFFECT_ONE_PLAYER_DAMAGE")) || (AIHelper.hasHint(cardToPayFor, "EFFECT_OPPONENT_DAMAGE"))))
{
// seek creature
CardList opponentCreatures = E.match.getBattlefieldOpponent(E.player);
if (opponentCreatures.size() == 0)
{
// whats this??
xCost = 0;
}
else
{
Card target = AIHelper.getDamageTarget(opponentCreatures, xCost, false, E.match, E.player);
xCost = target.getNowToughness();
}
}
}
// than x < E.player life No Suicide!
if (AIHelper.hasHint(cardToPayFor, "EFFECT_PLAYER_DAMAGE"))
{
int life = E.match.getLife(E.player);
if (life-1 < xCost) xCost = life-1;
}
allCost = xCost+baseCost;
}
E.aiPlayer.setIntData(keyHead+"_All", allCost);
}
// now all data is set so we can continue to pay
// I take it that we ALLWAYS!!! have enough Lands to pay!
// no checking is done here!
CardList lands = E.match.getLand(E.player);
CardList untappedLands = lands.getSubListTapState(false);
E.D.addLog("EAI: Untapped lands: " + untappedLands ,debugLevel);
Card toTap=null;
if (E.aiPlayer.getIntData(keyHead+"_G")>0)
{
E.D.addLog("EAI: Payment 1 forest." ,debugLevel);
CardList greens = untappedLands.getSubListBySubType("Forest");
if (greens.size()!=0)
{
toTap = greens.getCard(0);
int green = E.aiPlayer.getIntData(keyHead+"_G")-1;
E.aiPlayer.setIntData(keyHead+"_G", green);
}
}
if ( (toTap==null) &&(E.aiPlayer.getIntData(keyHead+"_B")>0))
{
E.D.addLog("EAI: Payment 1 swamp." ,debugLevel);
CardList blacks = untappedLands.getSubListBySubType("Swamp");
if (blacks.size()!=0)
{
toTap = blacks.getCard(0);
int black = E.aiPlayer.getIntData(keyHead+"_B")-1;
E.aiPlayer.setIntData(keyHead+"_B", black);
}
}
if ( (toTap==null) &&(E.aiPlayer.getIntData(keyHead+"_U")>0))
{
E.D.addLog("EAI: Payment 1 islanE.D." ,debugLevel);
CardList blues = untappedLands.getSubListBySubType("Island");
if (blues.size()!=0)
{
toTap = blues.getCard(0);
int blue = E.aiPlayer.getIntData(keyHead+"_U")-1;
E.aiPlayer.setIntData(keyHead+"_U", blue);
}
}
if ( (toTap==null) &&(E.aiPlayer.getIntData(keyHead+"_W")>0))
{
E.D.addLog("EAI: Payment 1 plain." ,debugLevel);
CardList whites = untappedLands.getSubListBySubType("Plains");
if (whites.size()!=0)
{
toTap = whites.getCard(0);
int white = E.aiPlayer.getIntData(keyHead+"_W")-1;
E.aiPlayer.setIntData(keyHead+"_W", white);
}
}
if ( (toTap==null) &&(E.aiPlayer.getIntData(keyHead+"_R")>0))
{
E.D.addLog("EAI: Payment 1 mountain." ,debugLevel);
CardList reds = untappedLands.getSubListBySubType("Mountain");
if (reds.size()!=0)
{
toTap = reds.getCard(0);
int red = E.aiPlayer.getIntData(keyHead+"_R")-1;
E.aiPlayer.setIntData(keyHead+"_R", red);
}
}
// if still not one tapped, than all colored is done and we