// TODO
// check if only a limited number of blockers are allowed
// from attackers View
boolean ret = true;
AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(attacker);
String aKey = "ATTACKING";
// if no key available for "ATTACKING" -> than no restriction!
if (aHints.hasKey(aKey))
{
// attacker gives limitation to blocker...
if (aHints.hasHint(aKey, HintTargetTypes.TY_GENERAL_BLOCKER_LIMITATION))
{
if (aHints.hasHint(aKey, HintTargetTypes.TY_NOT_BLOCKABLE))
{
boolean restriction = false;
String colorRestriction = aHints.getHintValue(aKey, HintTargetRestrictions.TR_CARD_COLOR_RESTRICTION);
if (colorRestriction.length() != 0)
{
if (blocker.hasOneColor(colorRestriction))
{
return false;
}
restriction = true;
}
String colorNeed = aHints.getHintValue(aKey, HintTargetRestrictions.TR_CARD_COLOR_NEED);
if (colorNeed.length() != 0)
{
if (!blocker.hasOneColor(colorNeed))
{
return false;
}
restriction = true;
}
String abilityRestriction = aHints.getHintValue(aKey, HintTargetRestrictions.TR_CARD_ABILITY_RESTRICTION);
if (abilityRestriction.length() != 0)
{
if (blocker.hasOneAbility(abilityRestriction))
{
return false;
}
restriction = true;
}
String abilityNeed = aHints.getHintValue(aKey, HintTargetRestrictions.TR_CARD_ABILITY_NEED);
if (abilityNeed.length() != 0)
{
if (!blocker.hasOneAbility(abilityNeed))
{
return false;
}
restriction = true;
}
int powerRestriction = aHints.getHintValueInt(aKey, HintTargetRestrictions.TR_CARD_POWER_MAX);
if (powerRestriction != 0)
{
if (blocker.getNowPower()>powerRestriction)
{
return false;
}
restriction = true;
}
int countRestriction = aHints.getHintValueInt(aKey, HintTargetRestrictions.TR_CARD_COUNT_MAX);
if (countRestriction != 0)
{
CardSimList blockers = attacker.getBlocker();
if (blockers.size()>countRestriction)
{
int blNum = 0;
for (int b = 0; b< blockers.size(); b++)
{
if (blocker.getCard().getUniqueID().equals(blockers.getCard(b).getCard().getUniqueID()))
{
blNum = b;
}
}
if (blNum>=countRestriction)
return false;
}
restriction = true;
}
// this attacker is in general unblockanle!
if (!restriction)
{
boolean anyRestriction = aHints.hasHintType(aKey, HintDefinition.HINT_TYPE_TARGET_RESTRICTION);
if (!anyRestriction)
return false;
// TODO:
// other restrctions must still be programmed!
System.out.println("CAN block not supported attacker restriction found! -> " + attacker );
}
}
}
if (aHints.hasHint(aKey, HintTargetTypes.TY_NOT_BLOCKABLE_IF_SINGLE_ATTACKER))
{
int size = config.attackers.size();
if (size == 1) return false;
}
}
AIEnhancedCardHints bHints = AIEnhancedCardHints.getHints(blocker);
String bKey = "BLOCKING";
// if no key available for "ATTACKING" -> than no restriction!
if (bHints.hasKey(bKey))
{
// attacker gives limitation to blocker...
if (bHints.hasHint(bKey, HintTargetTypes.TY_GENERAL_BLOCK_LIMITATION))
{
if (bHints.hasHint(bKey, HintTargetTypes.TY_CANT_BLOCK))
{
boolean restriction = false;
String colorRestriction = bHints.getHintValue(bKey, HintTargetRestrictions.TR_CARD_COLOR_RESTRICTION);
if (colorRestriction.length() != 0)
{
if (attacker.hasOneColor(colorRestriction))
{
return false;
}
restriction = true;
}
String colorNeed = bHints.getHintValue(bKey, HintTargetRestrictions.TR_CARD_COLOR_NEED);
if (colorNeed.length() != 0)
{
if (!attacker.hasOneColor(colorNeed))
{
return false;
}
restriction = true;
}
String abilityRestriction = bHints.getHintValue(bKey, HintTargetRestrictions.TR_CARD_ABILITY_RESTRICTION);
if (abilityRestriction.length() != 0)
{
if (attacker.hasOneAbility(abilityRestriction))
{
return false;
}
restriction = true;
}
String abilityNeed = bHints.getHintValue(bKey, HintTargetRestrictions.TR_CARD_ABILITY_NEED);
if (abilityNeed.length() != 0)
{
if (!attacker.hasOneAbility(abilityNeed))
{
return false;
}
restriction = true;
}
// this blocker in general c an not block!
if (!restriction)
{
boolean anyRestriction = bHints.hasHintType(bKey, HintDefinition.HINT_TYPE_TARGET_RESTRICTION);
if (!anyRestriction)
return false;
// TODO:
// other restrctions must still be programmed!
System.out.println("CAN block not supported blocker restriction found! -> " + blocker );