- Enabled the AI to play counterspells with the new flashback keyword.

- Converted Fervent Denial.
This commit is contained in:
Sloth
2011-11-13 11:11:27 +00:00
parent 9933b3fb09
commit 4d6820f499
2 changed files with 25 additions and 6 deletions

View File

@@ -2,8 +2,8 @@ Name:Fervent Denial
ManaCost:3 U U ManaCost:3 U U
Types:Instant Types:Instant
Text:no text 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$ 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:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/fervent_denial.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/fervent_denial.jpg
SetInfo:ODY|Uncommon|http://magiccards.info/scans/en/od/86.jpg SetInfo:ODY|Uncommon|http://magiccards.info/scans/en/od/86.jpg

View File

@@ -224,18 +224,37 @@ public class ComputerUtil {
int bestRestriction = Integer.MIN_VALUE; int bestRestriction = Integer.MIN_VALUE;
for (SpellAbility sa : possibleCounters) { for (SpellAbility sa : possibleCounters) {
SpellAbility currentSA = sa;
sa.setActivatingPlayer(AllZone.getComputerPlayer()); 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) { if (bestSA == null) {
bestSA = sa; bestSA = currentSA;
bestRestriction = counterSpellRestriction(sa); bestRestriction = counterSpellRestriction(currentSA);
} else { } else {
// Compare bestSA with this SA // Compare bestSA with this SA
int restrictionLevel = counterSpellRestriction(sa); int restrictionLevel = counterSpellRestriction(currentSA);
if (restrictionLevel > bestRestriction) { if (restrictionLevel > bestRestriction) {
bestRestriction = restrictionLevel; bestRestriction = restrictionLevel;
bestSA = sa; bestSA = currentSA;
} }
} }
} }