- Fix DeckHints and put back in to LimitedDeck generation.

This commit is contained in:
mcrawford620
2012-08-02 23:02:24 +00:00
parent 1af53f38c2
commit 5ba0659f05
27 changed files with 311 additions and 286 deletions

4
.gitattributes vendored
View File

@@ -11863,7 +11863,7 @@ src/main/java/forge/card/CardRules.java -text
src/main/java/forge/card/CardRulesReader.java svneol=native#text/plain src/main/java/forge/card/CardRulesReader.java svneol=native#text/plain
src/main/java/forge/card/CardSuperType.java -text src/main/java/forge/card/CardSuperType.java -text
src/main/java/forge/card/CardType.java -text src/main/java/forge/card/CardType.java -text
src/main/java/forge/card/DeckWants.java -text src/main/java/forge/card/DeckHints.java -text
src/main/java/forge/card/EditionCollection.java svneol=native#text/plain src/main/java/forge/card/EditionCollection.java svneol=native#text/plain
src/main/java/forge/card/EditionInfo.java svneol=native#text/plain src/main/java/forge/card/EditionInfo.java svneol=native#text/plain
src/main/java/forge/card/FatPackData.java -text src/main/java/forge/card/FatPackData.java -text
@@ -12442,7 +12442,7 @@ src/test/java/forge/deck/generate/Generate3ColorDeckTest.java svneol=native#text
src/test/java/forge/deck/generate/Generate5ColorDeckTest.java svneol=native#text/plain src/test/java/forge/deck/generate/Generate5ColorDeckTest.java svneol=native#text/plain
src/test/java/forge/gui/ListChooserTest.java svneol=native#text/plain src/test/java/forge/gui/ListChooserTest.java svneol=native#text/plain
src/test/java/forge/gui/game/CardDetailPanelTest.java svneol=native#text/plain src/test/java/forge/gui/game/CardDetailPanelTest.java svneol=native#text/plain
src/test/java/forge/item/DeckWantsTest.java -text src/test/java/forge/item/DeckHintsTest.java -text
src/test/java/forge/model/BuildInfoTest.java -text src/test/java/forge/model/BuildInfoTest.java -text
src/test/java/forge/model/FModelTest.java -text src/test/java/forge/model/FModelTest.java -text
src/test/java/net/slightlymagic/braids/util/testng/BraidsAssertFunctions.java svneol=native#text/plain src/test/java/net/slightlymagic/braids/util/testng/BraidsAssertFunctions.java svneol=native#text/plain

View File

@@ -5,7 +5,7 @@ Text:no text
T:Mode$ SpellCast | ValidCard$ Card.White | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a white spell, you may gain 1 life. T:Mode$ SpellCast | ValidCard$ Card.White | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a white spell, you may gain 1 life.
SVar:TrigGainLife:AB$GainLife | Cost$ 0 | LifeAmount$ 1 SVar:TrigGainLife:AB$GainLife | Cost$ 0 | LifeAmount$ 1
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Color$white DeckHints:Color$white
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/angels_feather.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/angels_feather.jpg
SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/92.jpg SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/92.jpg

View File

@@ -7,7 +7,7 @@ SVar:TrigSac:AB$Sacrifice | Cost$ 0 | SacValid$ Creature.nonZombie | Defined$ Tr
T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | IsPresent$ Creature | PresentCompare$ EQ0 | Execute$ TrigSacSelf | TriggerDescription$ At the beginning of the end step, if no creatures are on the battlefield, sacrifice CARDNAME. T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | IsPresent$ Creature | PresentCompare$ EQ0 | Execute$ TrigSacSelf | TriggerDescription$ At the beginning of the end step, if no creatures are on the battlefield, sacrifice CARDNAME.
SVar:TrigSacSelf:AB$Sacrifice | Cost$ 0 | Defined$ Self SVar:TrigSacSelf:AB$Sacrifice | Cost$ 0 | Defined$ Self
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Type$Zombie DeckHints:Type$Zombie
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/call_to_the_grave.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/call_to_the_grave.jpg
SetInfo:SCG|Rare|http://magiccards.info/scans/en/sc/58.jpg SetInfo:SCG|Rare|http://magiccards.info/scans/en/sc/58.jpg

View File

@@ -5,7 +5,7 @@ Text:no text
A:AB$ Tap | Cost$ 3 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | ConditionNotAllM12Empires$ True | SubAbility$ DBControl | SpellDescription$ Tap target creature. Gain control of that creature instead if you control artifacts named Scepter of Empires and Throne of Empires. A:AB$ Tap | Cost$ 3 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | ConditionNotAllM12Empires$ True | SubAbility$ DBControl | SpellDescription$ Tap target creature. Gain control of that creature instead if you control artifacts named Scepter of Empires and Throne of Empires.
SVar:DBControl:DB$ GainControl | Defined$ Targeted | ConditionAllM12Empires$ True SVar:DBControl:DB$ GainControl | Defined$ Targeted | ConditionAllM12Empires$ True
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Name$Scepter of Empires|Throne of Empires DeckHints:Name$Scepter of Empires|Throne of Empires
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/crown_of_empires.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/crown_of_empires.jpg
SetInfo:M12|Uncommon|http://magiccards.info/scans/en/m12/203.jpg SetInfo:M12|Uncommon|http://magiccards.info/scans/en/m12/203.jpg

View File

@@ -5,7 +5,7 @@ Text:no text
T:Mode$ SpellCast | ValidCard$ Card.Black | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a black spell, you may gain 1 life. T:Mode$ SpellCast | ValidCard$ Card.Black | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a black spell, you may gain 1 life.
SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1 SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Color$Black DeckHints:Color$Black
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/demons_horn.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/demons_horn.jpg
SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/116.jpg SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/116.jpg

View File

@@ -5,7 +5,6 @@ Text:no text
K:CARDNAME enters the battlefield tapped. K:CARDNAME enters the battlefield tapped.
A:AB$ LosesGame | Cost$ W W U U B B R R G G T Sac<1/CARDNAME> | ValidTgts$ Player | TgtPrompt$ Select target player | SpellDescription$ Target player loses the game. A:AB$ LosesGame | Cost$ W W U U B B R R G G T Sac<1/CARDNAME> | ValidTgts$ Player | TgtPrompt$ Select target player | SpellDescription$ Target player loses the game.
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:ColorAll$white|blue|black|red|green
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/door_to_nothingness.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/door_to_nothingness.jpg
SetInfo:M13|Rare|http://magiccards.info/scans/en/m13/203.jpg SetInfo:M13|Rare|http://magiccards.info/scans/en/m13/203.jpg

View File

@@ -5,7 +5,7 @@ Text:no text
T:Mode$ SpellCast | ValidCard$ Card.Red | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a red spell, you may gain 1 life. T:Mode$ SpellCast | ValidCard$ Card.Red | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a red spell, you may gain 1 life.
SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1 SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Color$Red DeckHints:Color$Red
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/dragons_claw.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/dragons_claw.jpg
SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/117.jpg SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/117.jpg

View File

@@ -6,7 +6,7 @@ PT:2/2
S:Mode$ Continuous | Affected$ Creature.Elf+Other+YouCtrl | AddPower$ 1 | AddToughness$ 1 | Description$ Other Elf creatures you control get +1/+1. S:Mode$ Continuous | Affected$ Creature.Elf+Other+YouCtrl | AddPower$ 1 | AddToughness$ 1 | Description$ Other Elf creatures you control get +1/+1.
A:AB$ Mana | Cost$ T | Produced$ G | Amount$ X | References$ X | SpellDescription$ Add G to your mana pool for each Elf you control. A:AB$ Mana | Cost$ T | Produced$ G | Amount$ X | References$ X | SpellDescription$ Add G to your mana pool for each Elf you control.
SVar:X:Count$Valid Elf.YouCtrl SVar:X:Count$Valid Elf.YouCtrl
SVar:DeckWants:Type$Elf DeckHints:Type$Elf
SVar:PlayMain1:TRUE SVar:PlayMain1:TRUE
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/elvish_archdruid.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/elvish_archdruid.jpg

View File

@@ -7,7 +7,7 @@ S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 3 | AddToughness$ 3 | AddKe
SVar:X:Count$Valid Griffin.YouCtrl SVar:X:Count$Valid Griffin.YouCtrl
SVar:BuffedBy:Griffin SVar:BuffedBy:Griffin
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Type$Griffin DeckHints:Type$Griffin
SVar:Rarity:Common SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/griffin_rider.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/griffin_rider.jpg
SetInfo:M12|Common|http://magiccards.info/scans/en/m12/20.jpg SetInfo:M12|Common|http://magiccards.info/scans/en/m12/20.jpg

View File

@@ -5,7 +5,7 @@ Text:no text
T:Mode$ SpellCast | ValidCard$ Card.Blue | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a blue spell, you may gain 1 life. T:Mode$ SpellCast | ValidCard$ Card.Blue | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a blue spell, you may gain 1 life.
SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1 SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Color$Blue DeckHints:Color$Blue
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/krakens_eye.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/krakens_eye.jpg
SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/126.jpg SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/126.jpg

View File

@@ -6,7 +6,7 @@ PT:0/2
T:Mode$ SpellCast | ValidCard$ Enchantment | ValidActivatingPlayer$ You | Execute$ TrigDraw | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever you cast an enchantment spell, draw a card. T:Mode$ SpellCast | ValidCard$ Enchantment | ValidActivatingPlayer$ You | Execute$ TrigDraw | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever you cast an enchantment spell, draw a card.
SVar:TrigDraw:AB$Draw | Cost$ 0 | Defined$ You | NumCards$ 1 SVar:TrigDraw:AB$Draw | Cost$ 0 | Defined$ You | NumCards$ 1
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Type$Enchantment DeckHints:Type$Enchantment
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/mesa_enchantress.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/mesa_enchantress.jpg
SetInfo:M10|Rare|http://magiccards.info/scans/en/m10/20.jpg SetInfo:M10|Rare|http://magiccards.info/scans/en/m10/20.jpg

View File

@@ -6,7 +6,7 @@ PT:2/1
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ScoutSearch | TriggerDescription$ When CARDNAME enters the battlefield, search your library for a creature card with deathtouch, hexproof, reach or trample and reveal it. Shuffle your library, then put that card on top of it. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ScoutSearch | TriggerDescription$ When CARDNAME enters the battlefield, search your library for a creature card with deathtouch, hexproof, reach or trample and reveal it. Shuffle your library, then put that card on top of it.
SVar:ScoutSearch:DB$ ChangeZone | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeNum$ 1 | ChangeType$ Creature.withDeathtouch+YouCtrl,Creature.withHexproof+YouCtrl,Creature.withReach+YouCtrl,Creature.withTrample+YouCtrl SVar:ScoutSearch:DB$ ChangeZone | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeNum$ 1 | ChangeType$ Creature.withDeathtouch+YouCtrl,Creature.withHexproof+YouCtrl,Creature.withReach+YouCtrl,Creature.withTrample+YouCtrl
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:KeywordAny$Deathtouch|Hexproof|Reach|Trample DeckHints:Keyword$Deathtouch|Hexproof|Reach|Trample
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/mwonvuli_beast_tracker.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/mwonvuli_beast_tracker.jpg
SetInfo:M13|Uncommon|http://magiccards.info/scans/en/m13/177.jpg SetInfo:M13|Uncommon|http://magiccards.info/scans/en/m13/177.jpg

View File

@@ -7,7 +7,7 @@ K:Indestructible
T:Mode$ Always | TriggerZones$ Battlefield | IsPresent$ Permanent.counters_GE1_PHYLACTERY+YouCtrl | PresentCompare$ EQ0 | Execute$ TrigSac | TriggerDescription$ When you control no permanents with phylactery counters on them, sacrifice CARDNAME. T:Mode$ Always | TriggerZones$ Battlefield | IsPresent$ Permanent.counters_GE1_PHYLACTERY+YouCtrl | PresentCompare$ EQ0 | Execute$ TrigSac | TriggerDescription$ When you control no permanents with phylactery counters on them, sacrifice CARDNAME.
SVar:TrigSac:AB$Sacrifice | Cost$ 0 | Defined$ Self SVar:TrigSac:AB$Sacrifice | Cost$ 0 | Defined$ Self
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Type$Artifact DeckHints:Type$Artifact
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/phylactery_lich.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/phylactery_lich.jpg
SetInfo:M11|Rare|http://magiccards.info/scans/en/m11/110.jpg SetInfo:M11|Rare|http://magiccards.info/scans/en/m11/110.jpg

View File

@@ -7,7 +7,7 @@ T:Mode$ SpellCast | ValidCard$ Card.White,Card.Blue,Card.Black,Card.Red | ValidA
SVar:TrigPutCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1 SVar:TrigPutCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
SVar:BuffedBy:Card.White,Card.Blue,Card.Black,Card.Red SVar:BuffedBy:Card.White,Card.Blue,Card.Black,Card.Red
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:ColorAny$white|blue|black|red DeckHints:Color$white|blue|black|red
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/quirion_dryad.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/quirion_dryad.jpg
SetInfo:M13|Rare|http://magiccards.info/scans/en/m13/184.jpg SetInfo:M13|Rare|http://magiccards.info/scans/en/m13/184.jpg

View File

@@ -5,7 +5,7 @@ Text:no text
A:AB$ DealDamage | Cost$ T | Tgt$ TgtP | NumDmg$ X | References$ X | SpellDescription$ CARDNAME deals 1 damage to target player. It deals 3 damage to that player instead if you control artifacts named Crown of Empires and Throne of Empires. A:AB$ DealDamage | Cost$ T | Tgt$ TgtP | NumDmg$ X | References$ X | SpellDescription$ CARDNAME deals 1 damage to target player. It deals 3 damage to that player instead if you control artifacts named Crown of Empires and Throne of Empires.
SVar:X:Count$AllM12Empires.3.1 SVar:X:Count$AllM12Empires.3.1
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Name$Throne of Empires|Crown of Empires DeckHints:Name$Throne of Empires|Crown of Empires
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/scepter_of_empires.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/scepter_of_empires.jpg
SetInfo:M12|Uncommon|http://magiccards.info/scans/en/m12/216.jpg SetInfo:M12|Uncommon|http://magiccards.info/scans/en/m12/216.jpg

View File

@@ -5,7 +5,7 @@ Text:no text
A:AB$ Token | Cost$ 1 T | TokenAmount$ X | References$ X | TokenName$ Soldier | TokenTypes$ Creature,Soldier | TokenOwner$ You | TokenColors$ White | TokenPower$ 1 | TokenToughness$ 1 | SpellDescription$ Put a 1/1 white Soldier creature token onto the battlefield. Put five of those tokens onto the battlefield instead if you control artifacts named Crown of Empires and Scepter of Empires. A:AB$ Token | Cost$ 1 T | TokenAmount$ X | References$ X | TokenName$ Soldier | TokenTypes$ Creature,Soldier | TokenOwner$ You | TokenColors$ White | TokenPower$ 1 | TokenToughness$ 1 | SpellDescription$ Put a 1/1 white Soldier creature token onto the battlefield. Put five of those tokens onto the battlefield instead if you control artifacts named Crown of Empires and Scepter of Empires.
SVar:X:Count$AllM12Empires.5.1 SVar:X:Count$AllM12Empires.5.1
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Name$Scepter of Empires|Crown of Empires DeckHints:Name$Scepter of Empires|Crown of Empires
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/throne_of_empires.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/throne_of_empires.jpg
SetInfo:M12|Rare|http://magiccards.info/scans/en/m12/221.jpg SetInfo:M12|Rare|http://magiccards.info/scans/en/m12/221.jpg

View File

@@ -7,7 +7,7 @@ K:Flying
S:Mode$ Continuous | Affected$ Card.Self | AddHiddenKeyword$ HIDDEN CARDNAME can't attack. | CheckSVar$ X | SVarCompare$ EQ0 | Description$ CARDNAME can't attack unless you control a Knight or Soldier. S:Mode$ Continuous | Affected$ Card.Self | AddHiddenKeyword$ HIDDEN CARDNAME can't attack. | CheckSVar$ X | SVarCompare$ EQ0 | Description$ CARDNAME can't attack unless you control a Knight or Soldier.
SVar:X:Count$Valid Knight.YouCtrl,Soldier.YouCtrl SVar:X:Count$Valid Knight.YouCtrl,Soldier.YouCtrl
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:TypeAny$Knight|Soldier DeckHints:Type$Knight|Soldier
SVar:Rarity:Common SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/war_falcon.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/war_falcon.jpg
SetInfo:M13|Common|http://magiccards.info/scans/en/m13/38.jpg SetInfo:M13|Common|http://magiccards.info/scans/en/m13/38.jpg

View File

@@ -5,7 +5,7 @@ Text:no text
T:Mode$ SpellCast | ValidCard$ Card.Green | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a green spell, you may gain 1 life. T:Mode$ SpellCast | ValidCard$ Card.Green | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a player casts a green spell, you may gain 1 life.
SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1 SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:DeckWants:Color$Green DeckHints:Color$Green
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/wurms_tooth.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/wurms_tooth.jpg
SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/162.jpg SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/162.jpg

View File

@@ -17,6 +17,8 @@
*/ */
package forge.card; package forge.card;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
@@ -33,7 +35,8 @@ public class CardRuleCharacteristics {
private String[] cardRules = null; private String[] cardRules = null;
private Map<String, CardInSet> setsData = new TreeMap<String, CardInSet>(); private Map<String, CardInSet> setsData = new TreeMap<String, CardInSet>();
private String dlUrl; private String dlUrl;
private DeckWants deckHints; private DeckHints deckHints;
private List<String> keywords = new ArrayList<String>();
/** /**
* Gets the card name. * Gets the card name.
@@ -178,14 +181,40 @@ public class CardRuleCharacteristics {
} }
/** /**
* TODO: Write javadoc for this method. * Set the deck hints.
*
* @param valueAfterKey * @param valueAfterKey
*/ */
public void setDeckHints(String valueAfterKey) { public void setDeckHints(String valueAfterKey) {
deckHints = new DeckWants(valueAfterKey); deckHints = new DeckHints(valueAfterKey);
} }
public DeckWants getDeckHints() { public DeckHints getDeckHints() {
return deckHints; return deckHints;
} }
/**
* @return the keywords
*/
public List<String> getKeywords() {
return keywords;
}
/**
* @param keywords0
* the keywords to set
*/
public void setKeywords(List<String> keywords) {
this.keywords = keywords;
}
/**
* Add keyword.
*
* @param keyword
*/
public void addKeyword(String keyword) {
this.keywords.add(keyword);
}
} }

View File

@@ -371,12 +371,19 @@ public final class CardRules {
} }
/** /**
* @return the deckWants * @return the deckHints
*/ */
public DeckWants getDeckWants() { public DeckHints getDeckHints() {
return characteristics.getDeckHints(); return characteristics.getDeckHints();
} }
/**
* @return the keywords
*/
public List<String> getKeywords() {
return characteristics.getKeywords();
}
/** /**
* Filtering conditions specific for CardRules class, defined here along * Filtering conditions specific for CardRules class, defined here along
* with some presets. * with some presets.
@@ -502,6 +509,22 @@ public final class CardRules {
return new LeafString(LeafString.CardField.JOINED_TYPE, op, what); return new LeafString(LeafString.CardField.JOINED_TYPE, op, what);
} }
/**
* Has Keyword.
*
* @param keyword
* the keyword
* @return the predicate
*/
public static Predicate<CardRules> hasKeyword(final String keyword) {
return new Predicate<CardRules>() {
@Override
public boolean isTrue(final CardRules card) {
return card.getKeywords().contains(keyword);
}
};
}
/** /**
* Was printed in sets. * Was printed in sets.
* *
@@ -640,18 +663,18 @@ public final class CardRules {
@Override @Override
public boolean isTrue(final CardRules card) { public boolean isTrue(final CardRules card) {
boolean shouldConatin; boolean shouldContain;
switch (this.field) { switch (this.field) {
case NAME: case NAME:
return this.op(card.getName(), this.operand); return this.op(card.getName(), this.operand);
case SUBTYPE: case SUBTYPE:
shouldConatin = (this.getOperator() == StringOp.CONTAINS) shouldContain = (this.getOperator() == StringOp.CONTAINS)
|| (this.getOperator() == StringOp.EQUALS); || (this.getOperator() == StringOp.EQUALS);
return shouldConatin == card.getType().subTypeContains(this.operand); return shouldContain == card.getType().subTypeContains(this.operand);
case RULES: case RULES:
shouldConatin = (this.getOperator() == StringOp.CONTAINS) shouldContain = (this.getOperator() == StringOp.CONTAINS)
|| (this.getOperator() == StringOp.EQUALS); || (this.getOperator() == StringOp.EQUALS);
return shouldConatin == card.rulesContain(this.operand); return shouldContain == card.rulesContain(this.operand);
case JOINED_TYPE: case JOINED_TYPE:
return this.op(card.getType().toString(), this.operand); return this.op(card.getType().toString(), this.operand);
default: default:

View File

@@ -105,6 +105,19 @@ public class CardRulesReader {
} }
break; break;
case 'D':
if (line.startsWith("DeckHints:")) {
this.characteristics[this.curCharacteristics].setDeckHints(CardRulesReader.getValueAfterKey(line, "DeckHints:"));
}
break;
case 'K':
if (line.startsWith("K:")) {
final String value = line.substring(2);
this.characteristics[this.curCharacteristics].addKeyword(value);
}
break;
case 'L': case 'L':
if (line.startsWith("Loyalty:")) { if (line.startsWith("Loyalty:")) {
this.characteristics[this.curCharacteristics].setPtLine(CardRulesReader.getValueAfterKey(line, "Loyalty:")); this.characteristics[this.curCharacteristics].setPtLine(CardRulesReader.getValueAfterKey(line, "Loyalty:"));
@@ -150,9 +163,6 @@ public class CardRulesReader {
this.removedFromRandomDecks = "True".equalsIgnoreCase(CardRulesReader.getValueAfterKey(line, "SVar:RemRandomDeck:")); this.removedFromRandomDecks = "True".equalsIgnoreCase(CardRulesReader.getValueAfterKey(line, "SVar:RemRandomDeck:"));
} else if (line.startsWith("SVar:Picture:")) { } else if (line.startsWith("SVar:Picture:")) {
this.characteristics[this.curCharacteristics].setDlUrl(CardRulesReader.getValueAfterKey(line, "SVar:Picture:")); this.characteristics[this.curCharacteristics].setDlUrl(CardRulesReader.getValueAfterKey(line, "SVar:Picture:"));
} else if (line.startsWith("SVar:DeckWants:")) {
this.characteristics[this.curCharacteristics].setDeckHints(CardRulesReader.getValueAfterKey(line, "SVar:DeckWants:"));
} else if (line.startsWith("SetInfo:")) { } else if (line.startsWith("SetInfo:")) {
CardRulesReader.parseSetInfoLine(line, this.characteristics[this.curCharacteristics].getSetsData()); CardRulesReader.parseSetInfoLine(line, this.characteristics[this.curCharacteristics].getSetsData());
} }

View File

@@ -0,0 +1,105 @@
package forge.card;
import java.util.ArrayList;
import java.util.List;
import forge.item.CardPrinted;
import forge.util.closures.PredicateString.StringOp;
/**
* DeckHints provides the ability for a Card to "want" another Card or type of
* Cards in its random deck.
*
*/
public class DeckHints {
/**
* Enum of types of DeckHints.
*/
public enum Type {
COLOR, KEYWORD, NAME, TYPE, NONE
}
private Type type = Type.NONE;
private String filterParam = null;
/**
* Construct a DeckHints from the SVar string.
*
* @param wants
* SVar for DeckHints
*/
public DeckHints(String wants) {
String[] pieces = wants.split("\\$");
if (pieces.length == 2) {
try {
Type typeValue = Type.valueOf(pieces[0].toUpperCase());
for (Type t : Type.values()) {
if (typeValue == t) {
type = t;
break;
}
}
} catch (IllegalArgumentException e) {
// type will remain NONE
}
filterParam = pieces[1];
}
}
/**
* @return the type
*/
public Type getType() {
return type;
}
/**
* Returns a list of Cards from the given CardList that match this
* DeckHints. I.e., other cards that this Card needs in its deck.
*
* @param cardList
* list of cards to be filtered
* @return CardList of Cards that match this DeckHints.
*/
public List<CardPrinted> filter(List<CardPrinted> cardList) {
List<CardPrinted> ret;
switch (type) {
case TYPE:
ret = new ArrayList<CardPrinted>();
String[] types = filterParam.split("\\|");
for (String type : types) {
ret.addAll(CardRules.Predicates.subType(type).select(cardList, CardPrinted.FN_GET_RULES));
}
break;
case COLOR:
ret = new ArrayList<CardPrinted>();
String[] colors = filterParam.split("\\|");
for (String color : colors) {
CardColor cc = CardColor.fromNames(color);
ret.addAll(CardRules.Predicates.isColor(cc.getColor()).select(cardList, CardPrinted.FN_GET_RULES));
}
break;
case KEYWORD:
ret = new ArrayList<CardPrinted>();
String[] keywords = filterParam.split("\\|");
for (String keyword : keywords) {
ret.addAll(CardRules.Predicates.hasKeyword(keyword).select(cardList, CardPrinted.FN_GET_RULES));
}
break;
case NAME:
ret = new ArrayList<CardPrinted>();
String[] names = filterParam.split("\\|");
for (String name : names) {
ret.addAll(CardRules.Predicates.name(StringOp.EQUALS, name).select(cardList, CardPrinted.FN_GET_RULES));
}
break;
default:
ret = cardList;
break;
}
return ret;
}
}

View File

@@ -1,133 +0,0 @@
package forge.card;
import java.util.ArrayList;
import java.util.List;
import forge.item.CardPrinted;
import forge.util.closures.PredicateString;
import forge.util.closures.PredicateString.StringOp;
/**
* DeckWants provides the ability for a Card to "want" another Card or type of
* Cards in its random deck.
*
*/
public class DeckWants {
/**
* Enum of types of DeckWants.
*/
public enum Type { CARD, COLOR, COLORANY, COLORALL, KEYWORDANY, NAME, TYPE, TYPEANY, NONE }
private Type type = Type.NONE;
private String filterParam = null;
/**
* Construct a DeckWants from the SVar string.
*
* @param wants
* SVar for DeckWants
*/
public DeckWants(String wants) {
String[] pieces = wants.split("\\$");
if (pieces.length == 2) {
try {
Type typeValue = Type.valueOf(pieces[0].toUpperCase());
for (Type t : Type.values()) {
if (typeValue == t) {
type = t;
break;
}
}
} catch (IllegalArgumentException e) {
// type will remain NONE
}
filterParam = pieces[1];
}
}
/**
* @return the type
*/
public Type getType() {
return type;
}
/**
* Returns a list of Cards from the given CardList that match this
* DeckWants. I.e., other cards that this Card needs in its deck.
*
* @param cardList
* list of cards to be filtered
* @return CardList of Cards that match this DeckWants.
*/
public List<CardPrinted> filter(List<CardPrinted> cardList) {
List<CardPrinted> ret;
switch (type) {
case TYPE:
ret = CardRules.Predicates.subType(filterParam).select(cardList, CardPrinted.FN_GET_RULES);
break;
// case TYPEANY:
// ret = new CardList();
// String[] types = filterParam.split("\\|");
// for (String type : types) {
// CardList found = cardList.getType(type.trim());
// if (found.size() > 0) {
// ret.addAll(found);
// }
// }
// case CARD:
// ret = cardList.getName(filterParam);
// break;
case COLOR:
CardColor color = CardColor.fromNames(filterParam);
ret = CardRules.Predicates.isColor(color.getColor()).select(cardList, CardPrinted.FN_GET_RULES);
break;
// case COLORANY:
// ret = new CardList();
// String[] colors = filterParam.split("\\|");
// for (String color : colors) {
// CardList found = cardList.getColorByManaCost(color.trim().toLowerCase());
// if (found.size() > 0) {
// ret.addAll(found);
// }
// }
// break;
// case COLORALL:
// ret = new CardList();
// int numFound = 0;
// colors = filterParam.split("\\|");
// for (String color : colors) {
// CardList found = cardList.getColorByManaCost(color.trim().toLowerCase());
// if (found.size() > 0) {
// ret.addAll(found);
// numFound++;
// }
// }
// if (numFound < colors.length) {
// ret.clear();
// }
// break;
// case KEYWORDANY:
// ret = new ArrayList<CardPrinted>();
// String[] keywords = filterParam.split("\\|");
// for (String keyword : keywords) {
// ret.addAll(CardRules.Predicates..select(cardList, CardPrinted.FN_GET_RULES));
// }
// break;
case NAME:
ret = new ArrayList<CardPrinted>();
String[] names = filterParam.split("\\|");
for (String name : names) {
ret.addAll(CardRules.Predicates.name(StringOp.EQUALS, name).select(cardList, CardPrinted.FN_GET_RULES));
}
break;
default:
ret = cardList;
break;
}
return ret;
}
}

View File

@@ -4,13 +4,16 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import forge.Constant; import forge.Constant;
import forge.card.CardColor; import forge.card.CardColor;
import forge.card.CardManaCost; import forge.card.CardManaCost;
import forge.card.CardRules; import forge.card.CardRules;
import forge.card.DeckHints;
import forge.card.mana.ManaCostShard; import forge.card.mana.ManaCostShard;
import forge.deck.Deck; import forge.deck.Deck;
import forge.deck.generate.GenerateDeckUtil; import forge.deck.generate.GenerateDeckUtil;
@@ -32,6 +35,7 @@ public class LimitedDeck extends Deck {
private List<CardPrinted> availableList; private List<CardPrinted> availableList;
private List<CardPrinted> aiPlayables; private List<CardPrinted> aiPlayables;
private List<CardPrinted> deckList = new ArrayList<CardPrinted>(); private List<CardPrinted> deckList = new ArrayList<CardPrinted>();
private List<String> setsWithBasicLands = new ArrayList<String>();
private static ReadDraftRankings draftRankings = new ReadDraftRankings(); private static ReadDraftRankings draftRankings = new ReadDraftRankings();
/** /**
@@ -48,6 +52,7 @@ public class LimitedDeck extends Deck {
this.availableList = dList; this.availableList = dList;
this.colors = pClrs; this.colors = pClrs;
removeUnplayables(); removeUnplayables();
findBasicLandSets();
} }
/** /**
@@ -60,6 +65,7 @@ public class LimitedDeck extends Deck {
super(""); super("");
this.availableList = list; this.availableList = list;
removeUnplayables(); removeUnplayables();
findBasicLandSets();
} }
/** /**
@@ -103,9 +109,9 @@ public class LimitedDeck extends Deck {
List<CardPrinted> nonLands = hasColor.select(aiPlayables, CardPrinted.FN_GET_RULES); List<CardPrinted> nonLands = hasColor.select(aiPlayables, CardPrinted.FN_GET_RULES);
if (deckList.size() == numSpellsNeeded && getAverageCMC(deckList) < 3 && !nonLands.isEmpty()) { if (deckList.size() == numSpellsNeeded && getAverageCMC(deckList) < 3 && !nonLands.isEmpty()) {
List<CardRankingBean> list = rankCards(nonLands); List<CardRankingBean> list = rankCards(nonLands);
CardPrinted c = list.get(0).getCard(); CardPrinted c = list.get(0).getCardPrinted();
deckList.add(c); deckList.add(c);
getAiPlayables().remove(0); getAiPlayables().remove(c);
landsNeeded--; landsNeeded--;
} }
@@ -195,8 +201,7 @@ public class LimitedDeck extends Deck {
// if no playable cards remain fill up with basic lands // if no playable cards remain fill up with basic lands
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
if (clrCnts[i].getCount() > 0) { if (clrCnts[i].getCount() > 0) {
final CardPrinted cp = CardDb.instance().getCard(clrCnts[i].getColor(), final CardPrinted cp = getBasicLand(clrCnts[i].getColor());
IBoosterDraft.LAND_SET_CODE[0]);
deckList.add(cp); deckList.add(cp);
System.out.println(" - Added " + cp.getName() + " as last resort."); System.out.println(" - Added " + cp.getName() + " as last resort.");
break; break;
@@ -214,6 +219,19 @@ public class LimitedDeck extends Deck {
availableList.removeAll(getAiPlayables()); availableList.removeAll(getAiPlayables());
} }
private void findBasicLandSets() {
Set<String> sets = new HashSet<String>();
for (CardPrinted cp : aiPlayables) {
if (CardDb.instance().isCardSupported("Plains", cp.getEdition())) {
sets.add(cp.getEdition());
}
}
setsWithBasicLands.addAll(sets);
if (setsWithBasicLands.isEmpty()) {
setsWithBasicLands.add("M13");
}
}
/** /**
* Add lands to fulfill the given color counts. * Add lands to fulfill the given color counts.
* *
@@ -242,8 +260,7 @@ public class LimitedDeck extends Deck {
} }
for (int j = 0; j < nLand; j++) { for (int j = 0; j < nLand; j++) {
final CardPrinted cp = CardDb.instance().getCard(clrCnts[i].getColor(), aiPlayables.get(0).getEdition()); deckList.add(getBasicLand(clrCnts[i].getColor()));
deckList.add(cp);
landsAdded++; landsAdded++;
} }
} }
@@ -256,7 +273,7 @@ public class LimitedDeck extends Deck {
int n = 0; int n = 0;
while (landsNeeded > 0) { while (landsNeeded > 0) {
if (clrCnts[n].getCount() > 0) { if (clrCnts[n].getCount() > 0) {
CardPrinted cp = CardDb.instance().getCard(clrCnts[n].getColor(), aiPlayables.get(0).getEdition()); final CardPrinted cp = getBasicLand(clrCnts[n].getColor());
deckList.add(cp); deckList.add(cp);
landsNeeded--; landsNeeded--;
@@ -270,6 +287,22 @@ public class LimitedDeck extends Deck {
} }
} }
/**
* Get basic land.
*
* @param basicLand
* @return card
*/
private CardPrinted getBasicLand(String basicLand) {
String set;
if (setsWithBasicLands.size() > 1) {
set = setsWithBasicLands.get(MyRandom.getRandom().nextInt(setsWithBasicLands.size() - 1));
} else {
set = setsWithBasicLands.get(0);
}
return CardDb.instance().getCard(basicLand, set);
}
/** /**
* attempt to optimize basic land counts according to color representation. * attempt to optimize basic land counts according to color representation.
* *
@@ -339,12 +372,12 @@ public class LimitedDeck extends Deck {
List<CardRankingBean> ranked = rankCards(others); List<CardRankingBean> ranked = rankCards(others);
for (CardRankingBean bean : ranked) { for (CardRankingBean bean : ranked) {
if (nCards > 0) { if (nCards > 0) {
deckList.add(bean.getCard()); deckList.add(bean.getCardPrinted());
aiPlayables.remove(bean.getCard()); aiPlayables.remove(bean.getCardPrinted());
nCards--; nCards--;
if (Constant.Runtime.DEV_MODE[0]) { if (Constant.Runtime.DEV_MODE[0]) {
System.out.println("Random[" + nCards + "]:" + bean.getCard().getName() + "(" System.out.println("Random[" + nCards + "]:" + bean.getCardPrinted().getName() + "("
+ bean.getCard().getCard().getManaCost() + ")"); + bean.getCardPrinted().getCard().getManaCost() + ")");
} }
} else { } else {
break; break;
@@ -362,7 +395,7 @@ public class LimitedDeck extends Deck {
private void addNonCreatures(List<CardRankingBean> nonCreatures, int num) { private void addNonCreatures(List<CardRankingBean> nonCreatures, int num) {
for (CardRankingBean bean : nonCreatures) { for (CardRankingBean bean : nonCreatures) {
if (num > 0) { if (num > 0) {
CardPrinted cardToAdd = bean.getCard(); CardPrinted cardToAdd = bean.getCardPrinted();
deckList.add(cardToAdd); deckList.add(cardToAdd);
num--; num--;
getAiPlayables().remove(cardToAdd); getAiPlayables().remove(cardToAdd);
@@ -370,7 +403,7 @@ public class LimitedDeck extends Deck {
System.out.println("Others[" + num + "]:" + cardToAdd.getName() + " (" System.out.println("Others[" + num + "]:" + cardToAdd.getName() + " ("
+ cardToAdd.getCard().getManaCost() + ")"); + cardToAdd.getCard().getManaCost() + ")");
} }
// num = addComboCards(cardToAdd, num); num = addComboCards(cardToAdd, num);
} else { } else {
break; break;
} }
@@ -386,32 +419,32 @@ public class LimitedDeck extends Deck {
* number of cards * number of cards
* @return number left after adding * @return number left after adding
*/ */
// private int addComboCards(CardPrinted cardToAdd, int num) { private int addComboCards(CardPrinted cardToAdd, int num) {
// if (!cardToAdd.getCard().getSVar("DeckWants").equals("")) { if (cardToAdd.getCard().getDeckHints() != null
// DeckWants wants = cardToAdd.getDeckWants(); && cardToAdd.getCard().getDeckHints().getType() != DeckHints.Type.NONE) {
// CardList comboCards = wants.filter(getAiPlayables()); DeckHints hints = cardToAdd.getCard().getDeckHints();
// if (Constant.Runtime.DEV_MODE[0]) { List<CardPrinted> comboCards = hints.filter(getAiPlayables());
// System.out.println("Found " + comboCards.size() + " cards for " + if (Constant.Runtime.DEV_MODE[0]) {
// cardToAdd.getName()); System.out.println("Found " + comboCards.size() + " cards for " + cardToAdd.getName());
// } }
// List<CardRankingBean> rankedComboCards = rankCards(comboCards); List<CardRankingBean> rankedComboCards = rankCards(comboCards);
// for (CardRankingBean comboBean : rankedComboCards) { for (CardRankingBean comboBean : rankedComboCards) {
// if (num > 0) { if (num > 0) {
// // TODO: This is not exactly right, because the // TODO: This is not exactly right, because the
// // rankedComboCards could include creatures and // rankedComboCards could include creatures and
// // non-creatures. This code could add too many of one or the // non-creatures. This code could add too many of one or the
// // other. // other.
// Card combo = comboBean.getCard(); CardPrinted combo = comboBean.getCardPrinted();
// deckList.add(combo); deckList.add(combo);
// num--; num--;
// getAiPlayables().remove(combo); getAiPlayables().remove(combo);
// } else { } else {
// break; break;
// } }
// } }
// } }
// return num; return num;
// } }
/** /**
* Add creatures to the deck. * Add creatures to the deck.
@@ -423,14 +456,14 @@ public class LimitedDeck extends Deck {
private void addCreatures(List<CardRankingBean> creatures, int num) { private void addCreatures(List<CardRankingBean> creatures, int num) {
for (CardRankingBean bean : creatures) { for (CardRankingBean bean : creatures) {
if (num > 0) { if (num > 0) {
CardPrinted c = bean.getCard(); CardPrinted c = bean.getCardPrinted();
deckList.add(c); deckList.add(c);
num--; num--;
getAiPlayables().remove(c); getAiPlayables().remove(c);
if (Constant.Runtime.DEV_MODE[0]) { if (Constant.Runtime.DEV_MODE[0]) {
System.out.println("Creature[" + num + "]:" + c.getName() + " (" + c.getCard().getManaCost() + ")"); System.out.println("Creature[" + num + "]:" + c.getName() + " (" + c.getCard().getManaCost() + ")");
} }
// num = addComboCards(c, num); num = addComboCards(c, num);
} else { } else {
break; break;
} }
@@ -464,7 +497,7 @@ public class LimitedDeck extends Deck {
} }
for (CardRankingBean bean : creatures) { for (CardRankingBean bean : creatures) {
CardPrinted c = bean.getCard(); CardPrinted c = bean.getCardPrinted();
int cmc = c.getCard().getManaCost().getCMC(); int cmc = c.getCard().getManaCost().getCMC();
if (cmc < 1) { if (cmc < 1) {
cmc = 1; cmc = 1;
@@ -495,7 +528,7 @@ public class LimitedDeck extends Deck {
if (Constant.Runtime.DEV_MODE[0]) { if (Constant.Runtime.DEV_MODE[0]) {
System.out.println("Creature[" + num + "]:" + c.getName() + " (" + c.getCard().getManaCost() + ")"); System.out.println("Creature[" + num + "]:" + c.getName() + " (" + c.getCard().getManaCost() + ")");
} }
// num = addComboCards(c, num); num = addComboCards(c, num);
} else { } else {
if (Constant.Runtime.DEV_MODE[0]) { if (Constant.Runtime.DEV_MODE[0]) {
System.out.println(c.getName() + " not added because CMC " + c.getCard().getManaCost().getCMC() System.out.println(c.getName() + " not added because CMC " + c.getCard().getManaCost().getCMC()
@@ -527,6 +560,12 @@ public class LimitedDeck extends Deck {
return ranked; return ranked;
} }
/**
* Calculate average CMC.
*
* @param cards
* @return the average
*/
private double getAverageCMC(List<CardPrinted> cards) { private double getAverageCMC(List<CardPrinted> cards) {
double sum = 0.0; double sum = 0.0;
for (CardPrinted cardPrinted : cards) { for (CardPrinted cardPrinted : cards) {
@@ -584,7 +623,7 @@ public class LimitedDeck extends Deck {
/** /**
* @return the card * @return the card
*/ */
public CardPrinted getCard() { public CardPrinted getCardPrinted() {
return card; return card;
} }

View File

@@ -44,9 +44,9 @@ public class SealedDeck extends LimitedDeck {
final List<CardPrinted> colorChooserList = new ArrayList<CardPrinted>(); final List<CardPrinted> colorChooserList = new ArrayList<CardPrinted>();
double limit = rankedCards.size() * .33; double limit = rankedCards.size() * .33;
for (int i = 0; i < limit; i++) { for (int i = 0; i < limit; i++) {
colorChooserList.add(rankedCards.get(i).getCard()); colorChooserList.add(rankedCards.get(i).getCardPrinted());
System.out.println(rankedCards.get(i).getCard().getName() + " " System.out.println(rankedCards.get(i).getCardPrinted().getName() + " "
+ rankedCards.get(i).getCard().getCard().getManaCost().toString()); + rankedCards.get(i).getCardPrinted().getCard().getManaCost().toString());
} }
int white = CardRules.Predicates.Presets.IS_WHITE.select(colorChooserList, CardPrinted.FN_GET_RULES).size(); int white = CardRules.Predicates.Presets.IS_WHITE.select(colorChooserList, CardPrinted.FN_GET_RULES).size();

View File

@@ -13,7 +13,7 @@ import forge.properties.NewConstants;
import forge.util.FileUtil; import forge.util.FileUtil;
/** /**
* Tests for DeckWants. * Tests for ReadDraftRankings.
* *
*/ */
@Test(enabled = true) @Test(enabled = true)

View File

@@ -10,17 +10,17 @@ import org.testng.annotations.Test;
import forge.card.CardRarity; import forge.card.CardRarity;
import forge.card.CardRulesReader; import forge.card.CardRulesReader;
import forge.card.DeckWants; import forge.card.DeckHints;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
import forge.properties.NewConstants; import forge.properties.NewConstants;
import forge.util.FileUtil; import forge.util.FileUtil;
/** /**
* Tests for DeckWants. * Tests for DeckHints.
* *
*/ */
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
public class DeckWantsTest { public class DeckHintsTest {
/** /**
* Card test. * Card test.
@@ -29,9 +29,9 @@ public class DeckWantsTest {
void test() { void test() {
CardPrinted cp = readCard("griffin_rider.txt"); CardPrinted cp = readCard("griffin_rider.txt");
Assert.assertEquals("Griffin Rider", cp.getName()); Assert.assertEquals("Griffin Rider", cp.getName());
DeckWants hints = cp.getCard().getDeckWants(); DeckHints hints = cp.getCard().getDeckHints();
Assert.assertNotNull(hints); Assert.assertNotNull(hints);
Assert.assertEquals(DeckWants.Type.TYPE, hints.getType()); Assert.assertEquals(DeckHints.Type.TYPE, hints.getType());
List<CardPrinted> list = new ArrayList<CardPrinted>(); List<CardPrinted> list = new ArrayList<CardPrinted>();
CardPrinted c0 = readCard("assault_griffin.txt"); CardPrinted c0 = readCard("assault_griffin.txt");
@@ -50,9 +50,9 @@ public class DeckWantsTest {
void testCards() { void testCards() {
CardPrinted cp = readCard("throne_of_empires.txt"); CardPrinted cp = readCard("throne_of_empires.txt");
Assert.assertEquals("Throne of Empires", cp.getName()); Assert.assertEquals("Throne of Empires", cp.getName());
DeckWants hints = cp.getCard().getDeckWants(); DeckHints hints = cp.getCard().getDeckHints();
Assert.assertNotNull(hints); Assert.assertNotNull(hints);
Assert.assertEquals(DeckWants.Type.NAME, hints.getType()); Assert.assertEquals(DeckHints.Type.NAME, hints.getType());
List<CardPrinted> list = new ArrayList<CardPrinted>(); List<CardPrinted> list = new ArrayList<CardPrinted>();
CardPrinted c0 = readCard("assault_griffin.txt"); CardPrinted c0 = readCard("assault_griffin.txt");
@@ -67,13 +67,13 @@ public class DeckWantsTest {
/** /**
* Filter for keywords. * Filter for keywords.
*_/ */
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
void testKeywords() { void testKeywords() {
CardPrinted cp = readCard("mwonvuli_beast_tracker.txt"); CardPrinted cp = readCard("mwonvuli_beast_tracker.txt");
DeckWants hints = cp.getCard().getDeckWants(); DeckHints hints = cp.getCard().getDeckHints();
Assert.assertNotNull(hints); Assert.assertNotNull(hints);
Assert.assertEquals(DeckWants.Type.KEYWORDANY, hints.getType()); Assert.assertEquals(DeckHints.Type.KEYWORD, hints.getType());
List<CardPrinted> list = new ArrayList<CardPrinted>(); List<CardPrinted> list = new ArrayList<CardPrinted>();
CardPrinted c0 = readCard("acidic_slime.txt"); CardPrinted c0 = readCard("acidic_slime.txt");
@@ -83,7 +83,6 @@ public class DeckWantsTest {
Assert.assertEquals(1, hints.filter(list).size()); Assert.assertEquals(1, hints.filter(list).size());
} }
*/
/** /**
@@ -92,9 +91,9 @@ public class DeckWantsTest {
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
void testColor() { void testColor() {
CardPrinted cp = readCard("wurms_tooth.txt"); CardPrinted cp = readCard("wurms_tooth.txt");
DeckWants hints = cp.getCard().getDeckWants(); DeckHints hints = cp.getCard().getDeckHints();
Assert.assertNotNull(hints); Assert.assertNotNull(hints);
Assert.assertEquals(DeckWants.Type.COLOR, hints.getType()); Assert.assertEquals(DeckHints.Type.COLOR, hints.getType());
List<CardPrinted> list = new ArrayList<CardPrinted>(); List<CardPrinted> list = new ArrayList<CardPrinted>();
CardPrinted c0 = readCard("llanowar_elves.txt"); CardPrinted c0 = readCard("llanowar_elves.txt");
@@ -105,71 +104,25 @@ public class DeckWantsTest {
Assert.assertEquals(1, hints.filter(list).size()); Assert.assertEquals(1, hints.filter(list).size());
} }
/**
* Failing filter for cards.
*_/
@Test(timeOut = 1000, enabled = true)
void testFailCards() {
List<String> cardLines = FileUtil
.readFile(new File(ForgeProps.getFile(NewConstants.CARDSFOLDER) + "/t", "throne_of_empires.txt"));
Card c = CardReader.readCard(cardLines);
Assert.assertEquals("Throne of Empires", c.getName());
Assert.assertNotNull(c.getDeckWants());
Assert.assertEquals(DeckWants.Type.LISTALL, c.getDeckWants().getType());
cardLines = FileUtil
.readFile(new File(ForgeProps.getFile(NewConstants.CARDSFOLDER) + "/a", "assault_griffin.txt"));
Card assaultGriffin = CardReader.readCard(cardLines);
CardList cl = new CardList();
cl.add(assaultGriffin);
cardLines = FileUtil
.readFile(new File(ForgeProps.getFile(NewConstants.CARDSFOLDER) + "/s", "scepter_of_empires.txt"));
Card sc = CardReader.readCard(cardLines);
cl.add(sc);
Assert.assertEquals(0, c.getDeckWants().filter(cl).size());
Assert.assertEquals(2, c.getDeckWants().getMinCardsNeeded());
}
/**
* Card test for junk deck wants.
*_/
@Test(timeOut = 1000, enabled = true)
void testJunk() {
List<String> cardLines = FileUtil
.readFile(new File(ForgeProps.getFile(NewConstants.CARDSFOLDER) + "/g", "griffin_rider.txt"));
Card c = CardReader.readCard(cardLines);
c.setSVar("DeckWants", "Junk$Junk");
Assert.assertNotNull(c.getDeckWants());
Assert.assertEquals(DeckWants.Type.NONE, c.getDeckWants().getType());
}
/** /**
* *
* Test for no wants. * Test for no wants.
*_/ */
@Test(timeOut = 1000, enabled = false) @Test(timeOut = 1000, enabled = false)
void testNoFilter() { void testNoFilter() {
CardPrinted cp = readCard("assault_griffin.txt");
DeckHints hints = cp.getCard().getDeckHints();
Assert.assertEquals("Assault Griffin", cp.getName());
Assert.assertNotNull(hints);
Assert.assertEquals(DeckHints.Type.NONE, hints.getType());
CardRules c = readCard("assault_griffin.txt"); List<CardPrinted> list = new ArrayList<CardPrinted>();
Assert.assertEquals("Assault Griffin", c.getName()); CardPrinted c0 = readCard("assault_griffin.txt");
Assert.assertNotNull(c.getDeckWants()); list.add(c0);
Assert.assertEquals(DeckWants.Type.NONE, c.getDeckWants().getType());
List<String> cardLines = FileUtil
.readFile(new File(ForgeProps.getFile(NewConstants.CARDSFOLDER) + "/a", "assault_griffin.txt"));
CardRulesReader crr = new CardRulesReader();
for(String line: cardLines)
crr.parseLine(line);
Card assaultGriffin = CardReader.readCard(cardLines);
CardList cl = new CardList();
cl.add(assaultGriffin);
Assert.assertEquals(1, c.getDeckWants().filter(cl).size());
Assert.assertEquals(1, hints.filter(list).size());
} }
*/
protected CardPrinted readCard(String filename) { protected CardPrinted readCard(String filename) {
String firstLetter = filename.substring(0,1); String firstLetter = filename.substring(0,1);