mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- The AI will now be aware of opponents Royal Assassin and similar cards.
This commit is contained in:
@@ -973,7 +973,15 @@ public class AiAttackController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ComputerUtilCard.canBeBlockedProfitably(defendingOpponent, attacker)) {
|
|
||||||
|
if (!attacker.hasKeyword("vigilance") && ComputerUtilCard.canBeKilledByRoyalAssassin(ai, attacker)) {
|
||||||
|
canKillAllDangerous = false;
|
||||||
|
canBeKilled = true;
|
||||||
|
canBeKilledByOne = true;
|
||||||
|
isWorthLessThanAllKillers = false;
|
||||||
|
hasCombatEffect = false;
|
||||||
|
}
|
||||||
|
else if (ComputerUtilCard.canBeBlockedProfitably(defendingOpponent, attacker)) {
|
||||||
canKillAllDangerous = false;
|
canKillAllDangerous = false;
|
||||||
canBeKilled = true;
|
canBeKilled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import forge.deck.Deck;
|
|||||||
import forge.deck.DeckSection;
|
import forge.deck.DeckSection;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
|
import forge.game.ability.ApiType;
|
||||||
import forge.game.card.*;
|
import forge.game.card.*;
|
||||||
import forge.game.combat.Combat;
|
import forge.game.combat.Combat;
|
||||||
import forge.game.combat.CombatUtil;
|
import forge.game.combat.CombatUtil;
|
||||||
@@ -593,6 +594,35 @@ public class ComputerUtilCard {
|
|||||||
return combat.isAttacking(card);
|
return combat.isAttacking(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean canBeKilledByRoyalAssassin(final Player ai, final Card card) {
|
||||||
|
boolean wasTapped = card.isTapped();
|
||||||
|
for (Player opp : ai.getOpponents()) {
|
||||||
|
for (Card c : opp.getCardsIn(ZoneType.Battlefield)) {
|
||||||
|
for (SpellAbility sa : c.getSpellAbilities()) {
|
||||||
|
if (sa.getApi() != ApiType.Destroy) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!ComputerUtilCost.canPayCost(sa, opp)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
sa.setActivatingPlayer(opp);
|
||||||
|
if (sa.canTarget(card)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// check whether the ability can only target tapped creatures
|
||||||
|
card.setTapped(true);
|
||||||
|
if (!sa.canTarget(card)) {
|
||||||
|
card.setTapped(wasTapped);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
card.setTapped(wasTapped);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a mock combat and returns the list of likely blockers.
|
* Create a mock combat and returns the list of likely blockers.
|
||||||
* @param ai blocking player
|
* @param ai blocking player
|
||||||
|
|||||||
Reference in New Issue
Block a user