diff --git a/res/cardsfolder/f/fervent_denial.txt b/res/cardsfolder/f/fervent_denial.txt index 204d904d480..6dcaa918d4b 100644 --- a/res/cardsfolder/f/fervent_denial.txt +++ b/res/cardsfolder/f/fervent_denial.txt @@ -2,8 +2,8 @@ Name:Fervent Denial ManaCost:3 U U Types:Instant Text:no text +K:Flashback 5 U U A:SP$ Counter | Cost$ 3 U U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | SpellDescription$ Counter target spell. -A:SP$ Counter | Cost$ 5 U U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | Flashback$ True | CostDesc$ Flashback 5 U U | SpellDescription$ (You may cast this card from your graveyard for its flashback cost. Then exile it.) SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/fervent_denial.jpg SetInfo:ODY|Uncommon|http://magiccards.info/scans/en/od/86.jpg diff --git a/src/main/java/forge/ComputerUtil.java b/src/main/java/forge/ComputerUtil.java index 789286c25f1..3a7808b5ae4 100644 --- a/src/main/java/forge/ComputerUtil.java +++ b/src/main/java/forge/ComputerUtil.java @@ -224,18 +224,37 @@ public class ComputerUtil { int bestRestriction = Integer.MIN_VALUE; for (SpellAbility sa : possibleCounters) { + SpellAbility currentSA = sa; sa.setActivatingPlayer(AllZone.getComputerPlayer()); - if (canBePlayedAndPayedByAI(sa)) { // checks everything nescessary + Card source = sa.getSourceCard(); + + //Flashback + if (source.isInZone(Constant.Zone.Graveyard) && sa.isSpell() && (source.isInstant() || source.isSorcery())) { + for(String keyword : source.getKeyword()) { + if (keyword.startsWith("Flashback")) { + SpellAbility flashback = sa.copy(); + flashback.setActivatingPlayer(AllZone.getComputerPlayer()); + flashback.setFlashBackAbility(true); + if (!keyword.equals("Flashback")) {//there is a flashback cost (and not the cards cost) + final Cost fbCost = new Cost(keyword.substring(10), source.getName(), false); + flashback.setPayCosts(fbCost); + } + currentSA = flashback; + } + } + } + + if (canBePlayedAndPayedByAI(currentSA)) { // checks everything nescessary if (bestSA == null) { - bestSA = sa; - bestRestriction = counterSpellRestriction(sa); + bestSA = currentSA; + bestRestriction = counterSpellRestriction(currentSA); } else { // Compare bestSA with this SA - int restrictionLevel = counterSpellRestriction(sa); + int restrictionLevel = counterSpellRestriction(currentSA); if (restrictionLevel > bestRestriction) { bestRestriction = restrictionLevel; - bestSA = sa; + bestSA = currentSA; } } }