E.D.addLog("EAI: Player:!" + E.player,debugLevel);
E.D.addLog("EAI: InitiatorPlayer:!" + c.E.mInitiatorPlayer,debugLevel);
Card target=null;
CardList myCreatures = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createCreaturePlayerCreature(E.player, E.opponent));
myCreatures = AIHelper.removeRS(myCreatures, c, E.match, E.player);
myCreatures = AIHelper.adjustListWithCardNeeds(myCreatures, card);
boolean myself = true;
CardList targetList=null;
if (AIHelper.isDamageCard(card))
{
if (myCreatures.size()>0) targetList = myCreatures;
if (targetList==null)
{
c.E.mTargetCardTo = null;
c.setCardResult(null);
c.setCancled(true);
c.setMaybeTaken(true);
c.setSuccessfull(false);
E.D.addLog("EAI: No creature!",debugLevel);
return;
}
if (AIHelper.hasBoolHint(card, "EFFECT_ONE_CREATURE_DAMAGE"))
{
int damageAmount = c.callerEv.amount;
// above is probably right, if trouble try this, changed: 7.4.2010 int damageAmount = c.E.ev.amount;
if (damageAmount == 0)
{
hint = hints.getHintbyVarname("DAMAGE_AMOUNT");
if (hint != null)
{
damageAmount = hint.getInteger();
E.D.addLog("EAI: Hint.DAMAGE_AMOUNT: " + damageAmount,debugLevel);
}
}
target = AIHelper.getDamageTarget(targetList, damageAmount, myself,E.match, E.player);
AIHelper.addToRS(target, c, E.match, E.player);
c.E.mTargetCardTo = target;
c.setCardResult(target);
c.setSuccessfull(true);
E.D.addLog("EAI: Successfull end!" ,debugLevel);
return;
}
target = AIHelper.getKillTarget(targetList, myself,E.match, E.player);
AIHelper.addToRS(target, c, E.match, E.player);
c.E.mTargetCardTo = target;
c.setCardResult(target);
c.setSuccessfull(true);
E.D.addLog("EAI: Successfull end!",debugLevel);
return;
}
else if (AIHelper.isBufCard(card))
{
myCreatures = myCreatures.getSubListBooleanState(Card.CARD_SICKNESS, false);
if ((targetList==null) && (myCreatures.size()>0)) targetList=myCreatures;
if (targetList==null)
{
c.E.mTargetCardTo = null;
c.setCardResult(null);
c.setCancled(true);
c.setMaybeTaken(true);
c.setSuccessfull(false);
E.D.addLog("EAI: No creature!",debugLevel);
return;
}
target = AIHelper.getAttackerBufTarget(targetList, myself,E.match, E.player);
AIHelper.addToRS(target, c, E.match, E.player);
c.E.mTargetCardTo = target;
c.setCardResult(target);
c.setSuccessfull(true);
E.D.addLog("EAI: Successfull end!",debugLevel);
return;
}
else if (AIHelper.isReplayCard(card))
{
boolean healerMode=false;
if ((myCreatures.size() > 0) && (AIHelper.hasHealer(myCreatures)))
{
targetList=myCreatures;
target = AIHelper.getHealerTarget(targetList,E.match, E.player);
}
else if (myCreatures.size()>0)
{
targetList=myCreatures;
target = AIHelper.getHarmlessTarget(targetList);
}
AIHelper.addToRS(target, c, E.match, E.player);
c.E.mTargetCardTo = target;
c.setCardResult(target);
c.setSuccessfull(true);
E.D.addLog("EAI: Successfull end!",debugLevel);
return;
}
else
{
E.D.addLog("EAI: No Supported Hint found - don´t know what to do, taking strongest... give more hints!!!!",debugLevel);
// e.g. Goblin War Cry-> EFFECT_OPPONENT_CREATURE_ONLY_ONE_BLOCK
CardList powerlist = myCreatures.removeWithAbility("NoBlock, Flying");
if (powerlist.size() == 0)
powerlist = myCreatures.removeWithAbility("Flying");
if (powerlist.size() == 0)
powerlist = myCreatures.removeWithAbility("NoBlock");
if (powerlist.size() == 0)
powerlist = myCreatures.copyList();
CardList powerlist2 = powerlist.getSubListTapState(false);
if (powerlist2.size() != 0)
powerlist = powerlist2;
powerlist = powerlist.sortListByPower();
// for now take the strongest...
if (powerlist.size() == 0)