// a) my creatures
// b) Opponent creatures
// c) even a stack creature
//#import "scripts\Allround\SorceryComboCast.java"
AICardHints hints = new AICardHints(card);
AIHint hint;
Card chosen = null;
E.D.addLog("EAI: Player:!" + E.player,debugLevel);
E.D.addLog("EAI: InitiatorPlayer:!" + c.E.mInitiatorPlayer,debugLevel);
//if (E.player == c.E.mInitiatorPlayer)
{
E.D.addLog("EAI: Asked from myself!",debugLevel);
CardList targetList=null;
Card target=null;
CardList myCreatures = E.match.getBattlefield(E.player);
myCreatures = AIHelper.removeRS(myCreatures, c, E.match, E.player);
myCreatures=AIHelper.adjustListWithCardNeeds(myCreatures, card);
CardList opponentCreatures = E.match.getBattlefieldOpponent(E.player);
opponentCreatures = AIHelper.removeRS(opponentCreatures, c, E.match, E.player);
opponentCreatures=AIHelper.adjustListWithCardNeeds(opponentCreatures, card);
CardList stack = E.match.getStackCardList();
boolean myself = true;
if (AIHelper.isDamageCard(card))
{
if (opponentCreatures.size()>0)
{
targetList=opponentCreatures;
myself = false;
}
E.D.addLog("EAI: opponentCreatures.size():"+opponentCreatures.size(),debugLevel);
E.D.addLog("EAI: myCreatures.size():"+myCreatures.size(),debugLevel);
E.D.addLog("EAI: c.mIsMust:"+c.mIsMust,debugLevel);
if ((targetList==null) && (myCreatures.size()>0))
{
if (c.mIsMust)
{
targetList=myCreatures;
}
}
if ((targetList==null) && (stack.size()>0))
{
if (c.mIsMust)
if (stack.getCard(0).isCreature())
targetList=stack;
}
if (targetList==null)
{
c.E.mTargetCardTo = null;
c.setCardResult(null);
if (c.mIsMust)
{
c.setCancled(true);
c.setMaybeTaken(false);
}
else
{
c.setCancled(false);
c.setMaybeTaken(true);
}
c.setSuccessfull(false);
E.D.addLog("EAI: No creature (d)!",debugLevel);
// c.E.ev.iRet.bRet=false;
return;
}
E.D.addLog("EAI: TragetList:"+targetList,debugLevel);
if (AIHelper.hasBoolHint(card, "EFFECT_ONE_CREATURE_DAMAGE"))
{
int damageAmount = 0;
try
{
damageAmount = c.callerEv.amount;
// damageAmount = c.E.ev.amount;
}catch (Throwable e){}
if (damageAmount == 0)
{
hint = hints.getHintbyVarname("DAMAGE_AMOUNT");
if (hint != null)
{
damageAmount = hint.getInteger();
E.D.addLog("EAI: Hint.DAMAGE_AMOUNT: " + damageAmount,debugLevel);
}