diff --git a/Mage.Client/src/main/resources/image.url.properties b/Mage.Client/src/main/resources/image.url.properties index 625d27d3bac..21627b43ec6 100644 --- a/Mage.Client/src/main/resources/image.url.properties +++ b/Mage.Client/src/main/resources/image.url.properties @@ -64,6 +64,6 @@ ddd=gvl unh=uh dde=pvc # Remove setname as soon as the images can be downloaded -ignore.urls=TOK,MM2,V15,BFZ,DDP +ignore.urls=TOK,V15,DDP # sets ordered by release time (newest goes first) token.lookup.order=DDP,BFZ,FVD,FVE,FVL,FVR,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC \ No newline at end of file diff --git a/Mage/src/mage/abilities/keyword/DevoidAbility.java b/Mage/src/mage/abilities/keyword/DevoidAbility.java new file mode 100644 index 00000000000..ec25acc9727 --- /dev/null +++ b/Mage/src/mage/abilities/keyword/DevoidAbility.java @@ -0,0 +1,41 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.keyword; + +import mage.ObjectColor; +import mage.abilities.common.SimpleStaticAbility; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ +public class DevoidAbility extends SimpleStaticAbility { + + public DevoidAbility(ObjectColor color) { + super(Zone.ALL, null); + color.setBlack(false); + color.setWhite(false); + color.setGreen(false); + color.setBlue(false); + color.setRed(false); + } + + public DevoidAbility(final DevoidAbility ability) { + super(ability); + } + + @Override + public DevoidAbility copy() { + return new DevoidAbility(this); + } + + @Override + public String getRule() { + return "Devoid (This card has no color.)"; + } + +} diff --git a/Mage/src/mage/abilities/keyword/IngestAbility.java b/Mage/src/mage/abilities/keyword/IngestAbility.java new file mode 100644 index 00000000000..40f68dc4b8f --- /dev/null +++ b/Mage/src/mage/abilities/keyword/IngestAbility.java @@ -0,0 +1,71 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.keyword; + +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class IngestAbility extends DealsCombatDamageToAPlayerTriggeredAbility { + + public IngestAbility() { + super(new IngestEffect(), false, true); + + } + + public IngestAbility(IngestAbility ability) { + super(ability); + } + + @Override + public String getRule() { + return "Ingest (Whenever this creature deals combat damage to a player, that player exiles the top card of his or her library.)"; + } + + @Override + public IngestAbility copy() { + return new IngestAbility(this); + } +} + +class IngestEffect extends OneShotEffect { + + public IngestEffect() { + super(Outcome.Exile); + this.staticText = "that player exiles the top card of his or her library"; + } + + public IngestEffect(final IngestEffect effect) { + super(effect); + } + + @Override + public IngestEffect copy() { + return new IngestEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (targetPlayer != null) { + Card card = targetPlayer.getLibrary().getFromTop(game); + if (card != null) { + targetPlayer.moveCards(card, Zone.LIBRARY, Zone.EXILED, source, game); + } + return true; + } + return false; + } +} diff --git a/Utils/gen-card.pl b/Utils/gen-card.pl index d18b670427a..880b8d13ab2 100755 --- a/Utils/gen-card.pl +++ b/Utils/gen-card.pl @@ -1,245 +1,247 @@ -#!/usr/bin/perl -w - -#author: North - -use Text::Template; -use strict; - - -my $authorFile = 'author.txt'; -my $dataFile = 'mtg-cards-data.txt'; -my $setsFile = 'mtg-sets-data.txt'; -my $knownSetsFile = 'known-sets.txt'; -my $keywordsFile = 'keywords.txt'; - - -my %cards; -my %sets; -my %knownSets; -my %keywords; - -sub toCamelCase { - my $string = $_[0]; - $string =~ s/\b([\w']+)\b/ucfirst($1)/ge; - $string =~ s/[-,\s\']//g; - $string; -} - -sub fixCost { - my $string = $_[0]; - $string =~ s/{([2BUGRW])([2BUGRW])}/{$1\/$2}/g; - $string; -} - -my $author; -if (-e $authorFile) { - open (DATA, $authorFile); - $author = ; - chomp $author; - close(DATA); -} else { - $author = 'anonymous'; -} - -open (DATA, $dataFile) || die "can't open $dataFile"; -while(my $line = ) { - my @data = split('\\|', $line); - $cards{$data[0]}{$data[1]} = \@data; -} -close(DATA); - -open (DATA, $setsFile) || die "can't open $setsFile"; -while(my $line = ) { - my @data = split('\\|', $line); - $sets{$data[0]}= $data[1]; - #print "$data[0]--$data[1]\n" -} -close(DATA); - -open (DATA, $knownSetsFile) || die "can't open $knownSetsFile"; -while(my $line = ) { - my @data = split('\\|', $line); - $knownSets{$data[0]}= $data[1]; -} -close(DATA); - -open (DATA, $keywordsFile) || die "can't open $keywordsFile"; -while(my $line = ) { - my @data = split('\\|', $line); - $keywords{toCamelCase($data[0])}= $data[1]; -} -close(DATA); - -my %cardTypes; -$cardTypes{'Artifact'} = 'CardType.ARTIFACT'; -$cardTypes{'Conspiracy'} = 'CardType.CONSPIRACY'; -$cardTypes{'Creature'} = 'CardType.CREATURE'; -$cardTypes{'Enchantment'} = 'CardType.ENCHANTMENT'; -$cardTypes{'Instant'} = 'CardType.INSTANT'; -$cardTypes{'Land'} = 'CardType.LAND'; -$cardTypes{'Sorcery'} = 'CardType.SORCERY'; -$cardTypes{'Planeswalker'} = 'CardType.PLANESWALKER'; -$cardTypes{'Tribal'} = 'CardType.TRIBAL'; - -my %raritiesConversion; -$raritiesConversion{'C'} = 'COMMON'; -$raritiesConversion{'U'} = 'UNCOMMON'; -$raritiesConversion{'R'} = 'RARE'; -$raritiesConversion{'M'} = 'MYTHIC'; -$raritiesConversion{'Special'} = 'SPECIAL'; -$raritiesConversion{'Bonus'} = 'BONUS'; - -# Get card name -my $cardName = $ARGV[0]; -if(!$cardName) { - print 'Enter a card name: '; - $cardName = ; - chomp $cardName; -} - -if (!exists $cards{$cardName}) { - die "Card name doesn't exist: $cardName\n"; -} - -# Check if card is already implemented -foreach my $setName (keys %{$cards{$cardName}}) { - if (exists $knownSets{$setName}) { - my $fileName = "../Mage.Sets/src/mage/sets/" . $knownSets{$setName} . "/" . toCamelCase($cardName) . ".java"; - if(-e $fileName) { - die "$cardName is already implemented (set found in: $setName).\n"; - } - } -} - -# Generate the cards -my $simpleOnly = $ARGV[1] || 'false'; -my $template = Text::Template->new(TYPE => 'FILE', SOURCE => 'cardClass.tmpl', DELIMITERS => [ '[=', '=]' ]); -my $templateExtended = Text::Template->new(TYPE => 'FILE', SOURCE => 'cardExtendedClass.tmpl', DELIMITERS => [ '[=', '=]' ]); -my %vars; - -$vars{'author'} = $author; -$vars{'name'} = $cardName; -$vars{'className'} = toCamelCase($cardName); - -if ($simpleOnly ne 'true') { - print "Files generated:\n"; -} -my $baseRarity = ''; -foreach my $setName (keys %{$cards{$cardName}}) { - if (exists $knownSets{$setName}) { - my $fileName = "../Mage.Sets/src/mage/sets/" . $knownSets{$setName} . "/" . toCamelCase($cardName) . ".java"; - my $result; - - $vars{'set'} = $knownSets{$setName}; - $vars{'expansionSetCode'} = $sets{$setName}; - $vars{'cardNumber'} = $cards{$cardName}{$setName}[2]; - $vars{'rarity'} = $raritiesConversion{$cards{$cardName}{$setName}[3]}; - - if (!$baseRarity) { - $baseRarity = $cards{$cardName}{$setName}[3]; - - $vars{'manaCost'} = fixCost($cards{$cardName}{$setName}[4]); - $vars{'power'} = $cards{$cardName}{$setName}[6]; - $vars{'toughness'} = $cards{$cardName}{$setName}[7]; - - my @types; - $vars{'subType'} = ''; - my $type = $cards{$cardName}{$setName}[5]; - while ($type =~ m/([a-zA-Z]+)( )*/g) { - if (exists($cardTypes{$1})) { - push(@types, $cardTypes{$1}); - } else { - if (@types) { - $vars{'subType'} .= "\n this.subtype.add(\"$1\");"; - } else { - $vars{'subType'} .= "\n this.supertype.add(\"$1\");"; - } - } - } - $vars{'type'} = join(', ', @types); - - $vars{'abilitiesImports'} = ''; - $vars{'abilities'} = ''; - - my @abilities = split('\$', $cards{$cardName}{$setName}[8]); - foreach my $ability (@abilities) { - $ability =~ s/ .+?<\/i>//g; - - my $notKeyWord; - foreach my $keyword (keys %keywords) { - if (toCamelCase($ability) =~ m/^$keyword(?=[A-Z{\d]|$)/g) { - $notKeyWord = 'false'; - my @ka = split(', ', $ability); - foreach my $kw (@ka) { - my $kwUnchanged = $kw; - foreach my $kk (keys %keywords) { - if (toCamelCase($kw) =~ m/^$kk(?=[A-Z{\d]|$)/g) { - $kw = $kk; - } - } - if ($keywords{$kw}) { - $vars{'abilities'} .= "\n // " . ucfirst($kwUnchanged); - if ($keywords{$kw} eq 'instance') { - $vars{'abilities'} .= "\n this.addAbility(" . $kw . "Ability.getInstance());"; - } elsif ($keywords{$kw} eq 'new') { - $vars{'abilities'} .= "\n this.addAbility(new " . $kw . "Ability());"; - } elsif ($keywords{$kw} eq 'number') { - $ability =~ m/(\b\d+?\b)/g; - $vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(' . $1 . '));'; - } elsif ($keywords{$kw} eq 'cost') { - $ability =~ m/({.*})/g; - $vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(new ManaCostsImpl("' . fixCost($1) . '")));'; - $vars{'abilitiesImports'} .= "\nimport mage.abilities.costs.mana.ManaCostsImpl;"; - } elsif ($keywords{$kw} eq 'card, manaString') { - $ability =~ m/({.*})/g; - $vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(this, "' . fixCost($1) . '"));'; - } elsif ($keywords{$kw} eq 'card, cost') { - $ability =~ m/({.*})/g; - $vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(this, new ManaCostsImpl("' . fixCost($1) . '")));'; - $vars{'abilitiesImports'} .= "\nimport mage.abilities.costs.mana.ManaCostsImpl;"; - } - - - $vars{'abilitiesImports'} .= "\nimport mage.abilities.keyword." . $kw . "Ability;"; - } else { - $vars{'abilities'} .= "\n // $kwUnchanged"; - if ($simpleOnly eq 'true') { - exit 0; - } - } - } - } - } - - if (!$notKeyWord) { - $vars{'abilities'} .= "\n // $ability"; - if ($simpleOnly eq 'true') { - exit 0; - } - } - } - if ($vars{'abilities'}) { - $vars{'abilities'} = "\n" . $vars{'abilities'}; - } - - $vars{'baseSet'} = $vars{'set'}; - $vars{'baseClassName'} = $vars{'className'}; - - $result = $template->fill_in(HASH => \%vars); - } else { - $vars{'rarityExtended'} = ''; - if ($baseRarity ne $cards{$cardName}{$setName}[3]) { - $vars{'rarityExtended'} = "\n this.rarity = Rarity.$raritiesConversion{$cards{$cardName}{$setName}[3]};"; - } - $result = $templateExtended->fill_in(HASH => \%vars); - } - - open CARD, "> $fileName"; - print CARD $result; - close CARD; - - print "$vars{'set'}.$vars{'className'}\n"; - } else { - print "Set not found in known sets: $setName\n"; - } -} +#!/usr/bin/perl -w + +#author: North + +use Text::Template; +use strict; + + +my $authorFile = 'author.txt'; +my $dataFile = 'mtg-cards-data.txt'; +my $setsFile = 'mtg-sets-data.txt'; +my $knownSetsFile = 'known-sets.txt'; +my $keywordsFile = 'keywords.txt'; + + +my %cards; +my %sets; +my %knownSets; +my %keywords; + +sub toCamelCase { + my $string = $_[0]; + $string =~ s/\b([\w']+)\b/ucfirst($1)/ge; + $string =~ s/[-,\s\']//g; + $string; +} + +sub fixCost { + my $string = $_[0]; + $string =~ s/{([2BUGRW])([2BUGRW])}/{$1\/$2}/g; + $string; +} + +my $author; +if (-e $authorFile) { + open (DATA, $authorFile); + $author = ; + chomp $author; + close(DATA); +} else { + $author = 'anonymous'; +} + +open (DATA, $dataFile) || die "can't open $dataFile"; +while(my $line = ) { + my @data = split('\\|', $line); + $cards{$data[0]}{$data[1]} = \@data; +} +close(DATA); + +open (DATA, $setsFile) || die "can't open $setsFile"; +while(my $line = ) { + my @data = split('\\|', $line); + $sets{$data[0]}= $data[1]; + #print "$data[0]--$data[1]\n" +} +close(DATA); + +open (DATA, $knownSetsFile) || die "can't open $knownSetsFile"; +while(my $line = ) { + my @data = split('\\|', $line); + $knownSets{$data[0]}= $data[1]; +} +close(DATA); + +open (DATA, $keywordsFile) || die "can't open $keywordsFile"; +while(my $line = ) { + my @data = split('\\|', $line); + $keywords{toCamelCase($data[0])}= $data[1]; +} +close(DATA); + +my %cardTypes; +$cardTypes{'Artifact'} = 'CardType.ARTIFACT'; +$cardTypes{'Conspiracy'} = 'CardType.CONSPIRACY'; +$cardTypes{'Creature'} = 'CardType.CREATURE'; +$cardTypes{'Enchantment'} = 'CardType.ENCHANTMENT'; +$cardTypes{'Instant'} = 'CardType.INSTANT'; +$cardTypes{'Land'} = 'CardType.LAND'; +$cardTypes{'Sorcery'} = 'CardType.SORCERY'; +$cardTypes{'Planeswalker'} = 'CardType.PLANESWALKER'; +$cardTypes{'Tribal'} = 'CardType.TRIBAL'; + +my %raritiesConversion; +$raritiesConversion{'C'} = 'COMMON'; +$raritiesConversion{'U'} = 'UNCOMMON'; +$raritiesConversion{'R'} = 'RARE'; +$raritiesConversion{'M'} = 'MYTHIC'; +$raritiesConversion{'Special'} = 'SPECIAL'; +$raritiesConversion{'Bonus'} = 'BONUS'; + +# Get card name +my $cardName = $ARGV[0]; +if(!$cardName) { + print 'Enter a card name: '; + $cardName = ; + chomp $cardName; +} + +if (!exists $cards{$cardName}) { + die "Card name doesn't exist: $cardName\n"; +} + +# Check if card is already implemented +foreach my $setName (keys %{$cards{$cardName}}) { + if (exists $knownSets{$setName}) { + my $fileName = "../Mage.Sets/src/mage/sets/" . $knownSets{$setName} . "/" . toCamelCase($cardName) . ".java"; + if(-e $fileName) { + die "$cardName is already implemented (set found in: $setName).\n"; + } + } +} + +# Generate the cards +my $simpleOnly = $ARGV[1] || 'false'; +my $template = Text::Template->new(TYPE => 'FILE', SOURCE => 'cardClass.tmpl', DELIMITERS => [ '[=', '=]' ]); +my $templateExtended = Text::Template->new(TYPE => 'FILE', SOURCE => 'cardExtendedClass.tmpl', DELIMITERS => [ '[=', '=]' ]); +my %vars; + +$vars{'author'} = $author; +$vars{'name'} = $cardName; +$vars{'className'} = toCamelCase($cardName); + +if ($simpleOnly ne 'true') { + print "Files generated:\n"; +} +my $baseRarity = ''; +foreach my $setName (keys %{$cards{$cardName}}) { + if (exists $knownSets{$setName}) { + my $fileName = "../Mage.Sets/src/mage/sets/" . $knownSets{$setName} . "/" . toCamelCase($cardName) . ".java"; + my $result; + + $vars{'set'} = $knownSets{$setName}; + $vars{'expansionSetCode'} = $sets{$setName}; + $vars{'cardNumber'} = $cards{$cardName}{$setName}[2]; + $vars{'rarity'} = $raritiesConversion{$cards{$cardName}{$setName}[3]}; + + if (!$baseRarity) { + $baseRarity = $cards{$cardName}{$setName}[3]; + + $vars{'manaCost'} = fixCost($cards{$cardName}{$setName}[4]); + $vars{'power'} = $cards{$cardName}{$setName}[6]; + $vars{'toughness'} = $cards{$cardName}{$setName}[7]; + + my @types; + $vars{'subType'} = ''; + my $type = $cards{$cardName}{$setName}[5]; + while ($type =~ m/([a-zA-Z]+)( )*/g) { + if (exists($cardTypes{$1})) { + push(@types, $cardTypes{$1}); + } else { + if (@types) { + $vars{'subType'} .= "\n this.subtype.add(\"$1\");"; + } else { + $vars{'subType'} .= "\n this.supertype.add(\"$1\");"; + } + } + } + $vars{'type'} = join(', ', @types); + + $vars{'abilitiesImports'} = ''; + $vars{'abilities'} = ''; + + my @abilities = split('\$', $cards{$cardName}{$setName}[8]); + foreach my $ability (@abilities) { + $ability =~ s/ .+?<\/i>//g; + + my $notKeyWord; + foreach my $keyword (keys %keywords) { + if (toCamelCase($ability) =~ m/^$keyword(?=[A-Z{\d]|$)/g) { + $notKeyWord = 'false'; + my @ka = split(', ', $ability); + foreach my $kw (@ka) { + my $kwUnchanged = $kw; + foreach my $kk (keys %keywords) { + if (toCamelCase($kw) =~ m/^$kk(?=[A-Z{\d]|$)/g) { + $kw = $kk; + } + } + if ($keywords{$kw}) { + $vars{'abilities'} .= "\n // " . ucfirst($kwUnchanged); + if ($keywords{$kw} eq 'instance') { + $vars{'abilities'} .= "\n this.addAbility(" . $kw . "Ability.getInstance());"; + } elsif ($keywords{$kw} eq 'new') { + $vars{'abilities'} .= "\n this.addAbility(new " . $kw . "Ability());"; + } elsif ($keywords{$kw} eq 'color') { + $vars{'abilities'} .= "\n this.addAbility(new " . $kw . "Ability(this.color));"; + } elsif ($keywords{$kw} eq 'number') { + $ability =~ m/(\b\d+?\b)/g; + $vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(' . $1 . '));'; + } elsif ($keywords{$kw} eq 'cost') { + $ability =~ m/({.*})/g; + $vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(new ManaCostsImpl("' . fixCost($1) . '")));'; + $vars{'abilitiesImports'} .= "\nimport mage.abilities.costs.mana.ManaCostsImpl;"; + } elsif ($keywords{$kw} eq 'card, manaString') { + $ability =~ m/({.*})/g; + $vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(this, "' . fixCost($1) . '"));'; + } elsif ($keywords{$kw} eq 'card, cost') { + $ability =~ m/({.*})/g; + $vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(this, new ManaCostsImpl("' . fixCost($1) . '")));'; + $vars{'abilitiesImports'} .= "\nimport mage.abilities.costs.mana.ManaCostsImpl;"; + } + + + $vars{'abilitiesImports'} .= "\nimport mage.abilities.keyword." . $kw . "Ability;"; + } else { + $vars{'abilities'} .= "\n // $kwUnchanged"; + if ($simpleOnly eq 'true') { + exit 0; + } + } + } + } + } + + if (!$notKeyWord) { + $vars{'abilities'} .= "\n // $ability"; + if ($simpleOnly eq 'true') { + exit 0; + } + } + } + if ($vars{'abilities'}) { + $vars{'abilities'} = "\n" . $vars{'abilities'}; + } + + $vars{'baseSet'} = $vars{'set'}; + $vars{'baseClassName'} = $vars{'className'}; + + $result = $template->fill_in(HASH => \%vars); + } else { + $vars{'rarityExtended'} = ''; + if ($baseRarity ne $cards{$cardName}{$setName}[3]) { + $vars{'rarityExtended'} = "\n this.rarity = Rarity.$raritiesConversion{$cards{$cardName}{$setName}[3]};"; + } + $result = $templateExtended->fill_in(HASH => \%vars); + } + + open CARD, "> $fileName"; + print CARD $result; + close CARD; + + print "$vars{'set'}.$vars{'className'}\n"; + } else { + print "Set not found in known sets: $setName\n"; + } +} diff --git a/Utils/keywords.txt b/Utils/keywords.txt index 0e7ad4bea2d..dd3fd7f5942 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -11,6 +11,7 @@ Dash|card, manaString| Deathtouch|instance| Delve|new| Dethrone|new| +Devoid|color| Defender|instance| Double Strike|instance| Dredge|number| @@ -32,6 +33,7 @@ Hexproof|instance| Indestructible|instance| Infect|instance| Intimidate|instance| +Ingest|new| Islandcycling|cost| Islandwalk|new| Level up|cost|