boolean ret = true;
Logable D = Configuration.getConfiguration().getDebugEntity();
int debugLevel = 3;
MatchComputerPlayer player = (MatchComputerPlayer)p;
AICardHints hints = new AICardHints(card);
AIHint hint = hints.getHintbyVarname("HINT_TARGET");
if (hint != null)
{
if (hint.getString().equals("TAP")) return true;
}
if (hint != null)
{
if (hint.getString().equals("ATTACK")) return true;
}
if (hint != null)
{
if (hint.getString().equals("LIBRARY")) return true;
}
CardList grave = match.getGraveyard(p);
CardList creature = match.getBattlefield(p).getSubListByType("Creature");
CardList land = match.getLand(p);
CardList hand = match.getHand(p);
CardList attacker = match.getAttackerList();
CardList opponentCreature = match.getBattlefieldOpponent(p).getSubListByType("Creature");
CardList opponentLand = match.getLandOpponent(p);
CardList opponentHand = match.getHandOpponent(p);
Vector ands = new Vector ();
// NEED are and booleans!
hint = hints.getHintbyVarname("PLAYER_CREATURE_GRAVE_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(grave.getSubListByType("Creature"), hints));
hint = hints.getHintbyVarname("PLAYER_CREATURE_NEED");
if (((hint != null) && (hint.getBoolean())))
{
ands.add(checkList(creature, hints));
if (!(AIHelper.hasBoolHint(card, "MAINPHASE2_NEEDED")))
ands.add(checkListCreaturesCombatEnabled(creature));
}
hint = hints.getHintbyVarname("PLAYER_LAND_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(land, hints));
hint = hints.getHintbyVarname("PLAYER_HAND_LAND_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(hand, hints));
hint = hints.getHintbyVarname("PLAYER_CREATURE_HAND_NEED");
if (((hint != null) && (hint.getBoolean())))
{
boolean helper = checkList(hand.getSubListByType("Creature"), hints);
ands.add(helper);
hint = hints.getHintbyVarname("CARD_SELF_OK");
if (((hint != null) && (!hint.getBoolean())))
{
ands.add(hand.getSubListByType("Creature").size() != 1);
}
}
hint = hints.getHintbyVarname("OPPONENT_ATTACKER_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(attacker, hints));
hint = hints.getHintbyVarname("OPPONENT_CREATURE_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(opponentCreature, hints));
hint = hints.getHintbyVarname("OPPONENT_LAND_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(opponentLand, hints));
hint = hints.getHintbyVarname("OPPONENT_HAND_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(opponentHand, hints));
hint = hints.getHintbyVarname("OPPONENT_UNTAPPED_LAND_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(opponentLand.getSubListTapState(false), hints));
hint = hints.getHintbyVarname("PLAYER_CREATURE_TAPPED_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(creature.getSubListTapState(true), hints));
hint = hints.getHintbyVarname("PLAYER_CREATURE_UNTAPPED_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(creature.getSubListTapState(false), hints));
hint = hints.getHintbyVarname("OPPONENT_TAPPED_CREATURE_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(opponentCreature.getSubListTapState(true), hints));
hint = hints.getHintbyVarname("OPPONENT_UNTAPPED_CREATURE_NEED");
if (((hint != null) && (hint.getBoolean())))
ands.add(checkList(opponentCreature.getSubListTapState(false), hints));
hint = hints.getHintbyVarname("MAINPHASE2_NEEDED");
if (((hint != null) && (hint.getBoolean())))
ands.add( match.getPhase() == match.PHASE_MAIN2 );
hint = hints.getHintbyVarname("OPPONENT_HIGHER_HEALTH_NEED");
if (((hint != null) && (hint.getBoolean())))
{
boolean ok = false;
int myLife = match.getLife(p);
int opLife = match.getLifeOpponent(p);
if (myLife < opLife)
{
ok = true;
hint = hints.getHintbyVarname("COUNT");
if (hint != null)
{
int dif = opLife - myLife;
int count = AIHelper.getHintInt(card, "COUNT");
if (dif > count) ok = false;
}
}
ands.add( ok );
}
if (card.isCreature())
{
hint = hints.getHintbyVarname("CARD_ONLY_ONE");
if (((hint != null) && (hint.getBoolean())))
{
ands.add( !creature.isInListID(card) );
}
}
for (int i = 0; i < ands.size(); i++)
{
Boolean boolean1 = (Boolean) ands.elementAt(i);
ret = ret && boolean1;
}
if (!ret) return ret;
ret = !checkDeath(card, match, player);
if (!ret) return ret;
hint = hints.getHintbyVarname("PLAYER_CREATURE_ATTACKER_NEED");
if (((hint != null) && (hint.getBoolean())))
{
CardList myCreatures = match.getBattlefield(player).getSubListByType("Creature");
//to ignore! CAN_BE_TAPPED_INSTEAD_ATTACK
myCreatures = AIHelper.removeWithHint(myCreatures, "CAN_BE_TAPPED_INSTEAD_ATTACK");