- Improved AI handling of "You may have CARDNAME assign its combat damage as though it weren't blocked.".

This commit is contained in:
Sloth
2012-02-09 19:01:14 +00:00
parent 0b1a0b7007
commit 2509965f7b
3 changed files with 13 additions and 6 deletions

View File

@@ -1063,7 +1063,8 @@ public class CombatUtil {
final CardList blockers = combat.getBlockers(attacker);
if (blockers.size() == 0) {
if (blockers.size() == 0 || attacker.hasKeyword("You may have CARDNAME assign its combat damage " +
"as though it weren't blocked.")) {
unblocked.add(attacker);
} else if (attacker.hasKeyword("Trample")
&& (CombatUtil.getAttack(attacker) > CombatUtil.totalShieldDamage(attacker, blockers))) {
@@ -1103,7 +1104,8 @@ public class CombatUtil {
final CardList blockers = combat.getBlockers(attacker);
if (blockers.size() == 0) {
if (blockers.size() == 0 || attacker.hasKeyword("You may have CARDNAME assign its combat damage" +
" as though it weren't blocked.")) {
unblocked.add(attacker);
} else if (attacker.hasKeyword("Trample")
&& (CombatUtil.getAttack(attacker) > CombatUtil.totalShieldDamage(attacker, blockers))) {

View File

@@ -339,7 +339,7 @@ public class ComputerUtilBlock {
killingBlockers = ComputerUtilBlock.getKillingBlockers(attacker, safeBlockers, combat);
if (killingBlockers.size() > 0) {
blocker = CardFactoryUtil.getWorstCreatureAI(killingBlockers);
} else {
} else if (!attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.")) {
blocker = CardFactoryUtil.getWorstCreatureAI(safeBlockers);
ComputerUtilBlock.getBlockedButUnkilled().add(attacker);
}
@@ -548,7 +548,8 @@ public class ComputerUtilBlock {
for (final Card attacker : ComputerUtilBlock.getAttackersLeft()) {
if (attacker.hasKeyword("CARDNAME can't be blocked except by two or more creatures.")) {
if (attacker.hasKeyword("CARDNAME can't be blocked except by two or more creatures.")
|| attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.")) {
continue;
}
@@ -594,8 +595,9 @@ public class ComputerUtilBlock {
for (final Card attacker : tramplingAttackers) {
if (attacker.hasKeyword("CARDNAME can't be blocked except by two or more creatures.")
&& !combat.isBlocked(attacker)) {
if ((attacker.hasKeyword("CARDNAME can't be blocked except by two or more creatures.")
&& !combat.isBlocked(attacker))
|| attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.")) {
continue;
}

View File

@@ -445,6 +445,9 @@ public class CardFactoryUtil {
if (c.hasKeyword("Unblockable")) {
value += power * 10;
}
if (c.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.")) {
value += power * 6;
}
if (c.hasKeyword("Fear")) {
value += power * 6;
}