Merge pull request #21 from magefree/master

Merge https://github.com/magefree/mage
This commit is contained in:
Zzooouhh 2017-11-20 20:34:58 +01:00 committed by GitHub
commit 5c34f5018b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 147 additions and 42 deletions

View file

@ -38,8 +38,9 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AttachedToControlledPermanentPredicate;
import mage.filter.predicate.permanent.AttachedToPredicate; import mage.filter.predicate.permanent.AttachedToPredicate;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
@ -52,7 +53,8 @@ public class MiracleWorker extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("Aura attached to a creature you control"); private static final FilterPermanent filter = new FilterPermanent("Aura attached to a creature you control");
static { static {
filter.add(new AttachedToPredicate(new FilterControlledCreaturePermanent())); filter.add(new AttachedToControlledPermanentPredicate());
filter.add(new AttachedToPredicate(new FilterCreaturePermanent()));
filter.add(new SubtypePredicate(SubType.AURA)); filter.add(new SubtypePredicate(SubType.AURA));
} }

View file

@ -39,15 +39,12 @@ import mage.constants.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterEnchantmentPermanent; import mage.filter.common.FilterEnchantmentPermanent;
import mage.filter.predicate.ObjectPlayer;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.filter.predicate.permanent.AttachedToControlledPermanentPredicate;
import mage.game.permanent.Permanent;
/** /**
* *
* @author North * @author North & L_J
*/ */
public class UmbraMystic extends CardImpl { public class UmbraMystic extends CardImpl {
@ -55,6 +52,7 @@ public class UmbraMystic extends CardImpl {
static { static {
filter.add(new SubtypePredicate(SubType.AURA)); filter.add(new SubtypePredicate(SubType.AURA));
filter.add(new AttachedToControlledPermanentPredicate());
} }
public UmbraMystic(UUID ownerId, CardSetInfo setInfo) { public UmbraMystic(UUID ownerId, CardSetInfo setInfo) {
@ -78,24 +76,3 @@ public class UmbraMystic extends CardImpl {
return new UmbraMystic(this); return new UmbraMystic(this);
} }
} }
class UmbraMysticPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
@Override
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
Permanent attachement = input.getObject();
if (attachement != null) {
Permanent permanent = game.getPermanent(attachement.getAttachedTo());
if (permanent != null && permanent.getControllerId().equals(input.getPlayerId())) {
return true;
}
}
return false;
}
@Override
public String toString() {
return "Attached to permanents you control";
}
}

View file

@ -0,0 +1,58 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.filter.predicate.permanent;
import mage.filter.predicate.ObjectPlayer;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North & L_J
*/
public class AttachedToControlledPermanentPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
@Override
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
Permanent attachement = input.getObject();
if (attachement != null) {
Permanent permanent = game.getPermanent(attachement.getAttachedTo());
if (permanent != null && permanent.getControllerId().equals(input.getPlayerId())) {
return true;
}
}
return false;
}
@Override
public String toString() {
return "Attached to permanents you control";
}
}

View file

@ -84,7 +84,7 @@ $fix_set_codes {"WL"} = "WTH";
print ("Finished reading $count names\n"); print ("Finished reading $count names\n");
#$vals = `find /I "<" *lient*`; #$vals = `find /I "<" *client*`;
$vals = `findstr /I "CARDNAME_STRING DIGITALOBJECT ARTID CLONE FRAMESTYLE " *lient* | find /I /V "_DO.xml"`; $vals = `findstr /I "CARDNAME_STRING DIGITALOBJECT ARTID CLONE FRAMESTYLE " *lient* | find /I /V "_DO.xml"`;
my $current_artid = ""; my $current_artid = "";
@ -177,12 +177,67 @@ $fix_set_codes {"WL"} = "WTH";
my $current_framestyle = ""; my $current_framestyle = "";
my %framestyles; my %framestyles;
$framestyles {1} = "001"; $framestyles {1} = "001"; # Pre-modern cards
$framestyles {3} = "010"; $framestyles {2} = "010";
$framestyles {31} = "010"; $framestyles {3} = "010"; # M15 cards
$framestyles {11} = "010"; $framestyles {4} = "013";
$framestyles {14} = "010"; $framestyles {5} = "020";
$framestyles {15} = "010"; $framestyles {6} = "010";
$framestyles {7} = "020";
$framestyles {8} = "010";
$framestyles {9} = "010";
$framestyles {10} = "030"; # "040";
$framestyles {11} = "010"; # Avatars
$framestyles {12} = "010";
$framestyles {13} = "050";
$framestyles {14} = "010"; # Tokens
$framestyles {15} = "010"; # Tokens as well
$framestyles {18} = "010";
$framestyles {19} = "030"; # "040";
$framestyles {19} = "010";
$framestyles {20} = "030";
$framestyles {22} = "010";
$framestyles {23} = "010";
$framestyles {24} = "010";
$framestyles {25} = "050";
$framestyles {26} = "010";
$framestyles {27} = "010";
$framestyles {28} = "010";
$framestyles {30} = "050";
$framestyles {31} = "010"; # New cards
$framestyles {34} = "030"; # "040";
$framestyles {35} = "030"; # "040";
$framestyles {36} = "050";
$framestyles {37} = "010";
$framestyles {38} = "010";
$framestyles {39} = "050";
$framestyles {42} = "010";
$framestyles {43} = "010";
$framestyles {45} = "030";
$framestyles {45} = "030"; # "040";
$framestyles {46} = "050";
$framestyles {47} = "020"; # Expedition lands
$framestyles {48} = "020";
$framestyles {49} = "030"; # "040";
$framestyles {50} = "030";
$framestyles {51} = "050";
$framestyles {52} = "010";
$framestyles {53} = "050";
$framestyles {54} = "010";
my %types;
my $current_type = "reg";
$types {4} = "flip";
$types {10} = "planeswk";
$types {19} = "planeswk";
$types {20} = "planeswk";
$types {34} = "planeswk";
$types {35} = "planeswk";
$types {45} = "planeswk";
$types {49} = "planeswk";
$types {50} = "planeswk";
while ($vals =~ s/^(.*)\n//im) while ($vals =~ s/^(.*)\n//im)
{ {
@ -217,8 +272,19 @@ $fix_set_codes {"WL"} = "WTH";
} }
if ($line =~ m/FRAMESTYLE value='([^']+)'/) if ($line =~ m/FRAMESTYLE value='([^']+)'/)
{ {
$current_framestyle = "$1"; my $val = $1;
$current_framestyle = $framestyles {$current_framestyle}; $current_framestyle = $framestyles {$val};
$current_type = $types {$val};
if ($current_framestyle =~ m/^$/)
{
print (" ERROR: $current_framestyle not known: ($line) --- ");
print (" http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/0000$current_artid" . "_typ_$current_type" . "_sty_$current_framestyle.jpg\n");
}
if ($current_type =~ m/^$/)
{
$current_type = "reg";
}
} }
if ($line =~ m/<\/DigitalObject/) if ($line =~ m/<\/DigitalObject/)
@ -246,23 +312,23 @@ $fix_set_codes {"WL"} = "WTH";
$seen_artids {$current_artid} = "$current_set\\$current_name.jpg"; $seen_artids {$current_artid} = "$current_set\\$current_name.jpg";
if ($current_artid < 10) if ($current_artid < 10)
{ {
print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/0000$current_artid" . "_typ_reg_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n"); print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/0000$current_artid" . "_typ_$current_type" . "_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n");
} }
if ($current_artid < 100) if ($current_artid < 100)
{ {
print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/000$current_artid" . "_typ_reg_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n"); print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/000$current_artid" . "_typ_$current_type" . "_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n");
} }
elsif ($current_artid < 1000) elsif ($current_artid < 1000)
{ {
print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/00$current_artid" . "_typ_reg_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n"); print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/00$current_artid" . "_typ_$current_type" . "_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n");
} }
elsif ($current_artid < 10000) elsif ($current_artid < 10000)
{ {
print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/0$current_artid" . "_typ_reg_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n"); print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/0$current_artid" . "_typ_$current_type" . "_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n");
} }
else else
{ {
print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/$current_artid" . "_typ_reg_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n"); print (" echo \"1\" | cut.pl stdin \"http://mtgoclientdepot.onlinegaming.wizards.com/Graphics/Cards/Pics/$current_artid" . "_typ_$current_type" . "_sty_$current_framestyle.jpg\" \"$current_set\\$current_name.jpg\" wget_image\n");
} }
} }
else else
@ -276,6 +342,8 @@ $fix_set_codes {"WL"} = "WTH";
$current_doc_id = ""; $current_doc_id = "";
$current_line = ""; $current_line = "";
$current_name = ""; $current_name = "";
$current_type = "";
$current_framestyle = "";
} }
} }
} }