mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Make some more use of the isCardInPlay function.
This commit is contained in:
@@ -310,14 +310,14 @@ public class AiAttackController {
|
||||
final int humanExaltedBonus = this.countExaltedBonus(opp);
|
||||
|
||||
if (humanExaltedBonus > 0) {
|
||||
final int nFinestHours = opp.getCardsIn(ZoneType.Battlefield, "Finest Hour").size();
|
||||
final boolean finestHour = opp.isCardInPlay("Finest Hour");
|
||||
|
||||
if (((blockersNeeded == 0) || (nFinestHours > 0)) && (this.oppList.size() > 0)) {
|
||||
if ((blockersNeeded == 0 || finestHour) && !this.oppList.isEmpty()) {
|
||||
//
|
||||
// total attack = biggest creature + exalted, *2 if Rafiq is in
|
||||
// play
|
||||
int humanBasePower = this.getAttack(this.oppList.get(0)) + humanExaltedBonus;
|
||||
if (nFinestHours > 0) {
|
||||
if (finestHour) {
|
||||
// For Finest Hour, one creature could attack and get the
|
||||
// bonus TWICE
|
||||
humanBasePower = humanBasePower + humanExaltedBonus;
|
||||
@@ -325,15 +325,13 @@ public class AiAttackController {
|
||||
final int totalExaltedAttack = opp.isCardInPlay("Rafiq of the Many") ? 2 * humanBasePower
|
||||
: humanBasePower;
|
||||
if (ai.getLife() - 3 <= totalExaltedAttack) {
|
||||
// We will lose if there is an Exalted attack -- keep one
|
||||
// blocker
|
||||
if ((blockersNeeded == 0) && (notNeededAsBlockers.size() > 0)) {
|
||||
// We will lose if there is an Exalted attack -- keep one blocker
|
||||
if ((blockersNeeded == 0) && !notNeededAsBlockers.isEmpty()) {
|
||||
notNeededAsBlockers.remove(0);
|
||||
}
|
||||
|
||||
// Finest Hour allows a second Exalted attack: keep a
|
||||
// blocker for that too
|
||||
if ((nFinestHours > 0) && (notNeededAsBlockers.size() > 0)) {
|
||||
// Finest Hour allows a second Exalted attack: keep a blocker for that too
|
||||
if (finestHour && !notNeededAsBlockers.isEmpty()) {
|
||||
notNeededAsBlockers.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
if (c.getType().isLegendary()) {
|
||||
if (!ai.getCardsIn(ZoneType.Battlefield, c.getName()).isEmpty()) {
|
||||
if (ai.isCardInPlay(c.getName())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1141,7 +1141,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
if (c.getType().isLegendary()) {
|
||||
if (!decider.getCardsIn(ZoneType.Battlefield, c.getName()).isEmpty()) {
|
||||
if (decider.isCardInPlay(c.getName())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TokenAi extends SpellAbilityAi {
|
||||
for (final String type : this.tokenTypes) {
|
||||
if (type.equals("Legendary")) {
|
||||
// Don't kill AIs Legendary tokens
|
||||
if (!ai.getCardsIn(ZoneType.Battlefield, this.tokenName).isEmpty()) {
|
||||
if (ai.isCardInPlay(this.tokenName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user