- Added an AILogic parameter to AF NameCard.

- Added Vexing Arcanix by Jeff.
This commit is contained in:
Sloth
2012-01-25 18:18:09 +00:00
parent 90c248bb81
commit 6b3bfde7aa
4 changed files with 86 additions and 15 deletions

1
.gitattributes vendored
View File

@@ -9337,6 +9337,7 @@ res/cardsfolder/v/veteran_swordsmith.txt svneol=native#text/plain
res/cardsfolder/v/veterans_reflexes.txt svneol=native#text/plain
res/cardsfolder/v/veterans_voice.txt -text
res/cardsfolder/v/vex.txt svneol=native#text/plain
res/cardsfolder/v/vexing_arcanix.txt -text
res/cardsfolder/v/vexing_beetle.txt svneol=native#text/plain
res/cardsfolder/v/vhati_il_dal.txt -text
res/cardsfolder/v/viashino_bladescout.txt svneol=native#text/plain

View File

@@ -0,0 +1,15 @@
Name:Vexing Arcanix
ManaCost:4
Types:Artifact
Text:no text
A:AB$ NameCard | Cost$ 3 T | ValidTgts$ Player | TgtPrompt$ Select target player | SubAbility$ DBDig | AILogic$ MostProminentInComputerDeck | SpellDescription$ Target player names a card, then reveals the top card of his or her library. If it's the named card, the player puts it into his or her hand. Otherwise, the player puts it into his or her graveyard and CARDNAME deals 2 damage to him or her.
SVar:DBDig:DB$ Dig | DigNum$ 1 | Defined$ Targeted | ChangeNum$ All | ChangeValid$ Card.NamedCard | DestinationZone2$ Graveyard | Reveal$ True | RememberChanged$ True | SubAbility$ DBDamage
SVar:DBDamage:DB$ DealDamage | NumDmg$ 2 | Defined$ Targeted | ConditionDefined$ Remembered | ConditionPresent$ Card.NamedCard | ConditionCompare$ EQ0 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/vexing_arcanix.jpg
SetInfo:8ED|Rare|http://magiccards.info/scans/en/8e/319.jpg
SetInfo:ICE|Rare|http://magiccards.info/scans/en/ia/319.jpg
Oracle:{3}, {T}: Target player names a card, then reveals the top card of his or her library. If it's the named card, the player puts it into his or her hand. Otherwise, the player puts it into his or her graveyard and Vexing Arcanix deals 2 damage to him or her.
End

View File

@@ -668,10 +668,10 @@ public final class AbilityFactoryChoose {
chosen = CardFactoryUtil.getMostProminentColor(AllZoneUtil.getCardsInGame().getController(
AllZone.getHumanPlayer()));
}
if (logic.equals("MostProminentInGame")) {
else if (logic.equals("MostProminentInGame")) {
chosen = CardFactoryUtil.getMostProminentColor(AllZoneUtil.getCardsInGame());
}
if (logic.equals("MostProminentHumanCreatures")) {
else if (logic.equals("MostProminentHumanCreatures")) {
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
if (list.isEmpty()) {
list = AllZoneUtil.getCardsInGame().getController(AllZone.getHumanPlayer())
@@ -679,15 +679,15 @@ public final class AbilityFactoryChoose {
}
chosen = CardFactoryUtil.getMostProminentColor(list);
}
if (logic.equals("MostProminentComputerControls")) {
else if (logic.equals("MostProminentComputerControls")) {
chosen = CardFactoryUtil.getMostProminentColor(AllZone.getComputerPlayer().getCardsIn(
Zone.Battlefield));
}
if (logic.equals("MostProminentPermanent")) {
else if (logic.equals("MostProminentPermanent")) {
final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
chosen = CardFactoryUtil.getMostProminentColor(list);
}
if (logic.equals("MostProminentAttackers")) {
else if (logic.equals("MostProminentAttackers")) {
chosen = CardFactoryUtil.getMostProminentColor(new CardList(AllZone.getCombat()
.getAttackers()));
}
@@ -1415,7 +1415,7 @@ public final class AbilityFactoryChoose {
boolean ok = false;
String name = null;
while (!ok) {
if (sa.getActivatingPlayer().isHuman()) {
if (p.isHuman()) {
final String message = validDesc.equals("card") ? "Name a card" : "Name a " + validDesc
+ " card. (Case sensitive)";
/*
@@ -1446,17 +1446,31 @@ public final class AbilityFactoryChoose {
ok = true;
}
} else {
CardList list = AllZoneUtil.getCardsInGame().getController(AllZone.getHumanPlayer());
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return !c.isLand();
String chosen = "";
if (params.containsKey("AILogic")) {
final String logic = params.get("AILogic");
if (logic.equals("MostProminentInComputerDeck")) {
chosen = CardFactoryUtil.getMostProminentCardName(AllZone.getComputerPlayer()
.getCardsIn(Constant.Zone.Library));
}
} else {
CardList list = AllZoneUtil.getCardsInGame().getController(AllZone.getHumanPlayer());
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
return !c.isLand();
}
});
if (!list.isEmpty()) {
chosen = list.get(0).getName();
}
});
if (!list.isEmpty()) {
host.setNamedCard(list.get(0).getName());
ok = true;
}
if (chosen == "") {
chosen = "Forest";
}
GuiUtils.getChoice("Computer picked: ", chosen);
host.setNamedCard(chosen);
ok = true;
}
}
}

View File

@@ -3485,6 +3485,47 @@ public class CardFactoryUtil {
return untap;
}
/**
* <p>
* getMostProminentCardName.
* </p>
*
* @param list
* a {@link forge.CardList} object.
* @return a {@link java.lang.String} object.
*/
public static String getMostProminentCardName(final CardList list) {
if (list.size() == 0) {
return "";
}
final Map<String, Integer> map = new HashMap<String, Integer>();
for (final Card c : list) {
final String name = c.getName();
if (!map.containsKey(name)) {
map.put(name, 1);
} else {
map.put(name, map.get(name) + 1);
}
} // for
int max = 0;
String maxName = "";
for (final Entry<String, Integer> entry : map.entrySet()) {
final String type = entry.getKey();
// Log.debug(type + " - " + entry.getValue());
if (max < entry.getValue()) {
max = entry.getValue();
maxName = type;
}
}
return maxName;
}
/**
* <p>
* getMostProminentCreatureType.