From 6bc040ef6c7a34f3c05693113b6c0684c55f370d Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Thu, 5 Nov 2020 12:22:55 +0400 Subject: [PATCH] [ZNR] Added tokens support and download --- .../dl/sources/ScryfallImageSupportTokens.java | 12 ++++++++++++ .../src/main/resources/card-pictures-tok.txt | 15 ++++++++++++++- .../mage/cards/g/GrakmawSkyclaveRavager.java | 6 +++--- .../src/mage/cards/i/InscriptionOfInsight.java | 6 +++--- .../src/mage/cards/s/SkyclaveApparition.java | 4 ++-- .../mage/game/permanent/token/AngelToken.java | 4 ---- .../permanent/token/AngelWarriorToken.java | 5 +++++ .../game/permanent/token/CatBeastToken.java | 4 ++++ .../mage/game/permanent/token/CatToken3.java | 4 ++++ .../game/permanent/token/ConstructToken.java | 4 ++++ ...ightToken.java => CustomIllusionToken.java} | 14 +++++++++----- .../mage/game/permanent/token/DrakeToken.java | 10 ++++++---- ...a => GrakmawSkyclaveRavagerHydraToken.java} | 14 +++++++++----- .../mage/game/permanent/token/InsectToken.java | 18 ++++-------------- .../game/permanent/token/KorWarriorToken.java | 5 ++++- .../mage/game/permanent/token/PlantToken.java | 13 +++---------- .../game/permanent/token/RelicRobberToken.java | 8 ++++---- 17 files changed, 90 insertions(+), 56 deletions(-) rename Mage/src/main/java/mage/game/permanent/token/{InscriptionOfInsightToken.java => CustomIllusionToken.java} (56%) rename Mage/src/main/java/mage/game/permanent/token/{GrakmawSkyclaveRavagerToken.java => GrakmawSkyclaveRavagerHydraToken.java} (53%) diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSupportTokens.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSupportTokens.java index 627c761e2c..d30be8964b 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSupportTokens.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSupportTokens.java @@ -448,6 +448,18 @@ public class ScryfallImageSupportTokens { put("M21/Weird", "https://api.scryfall.com/cards/tm21/13/en?format=image"); put("M21/Zombie", "https://api.scryfall.com/cards/tm21/7/en?format=image"); + // ZNR + put("ZNR/Angel Warrior", "https://api.scryfall.com/cards/tznr/1/en?format=image"); + put("ZNR/Cat Beast", "https://api.scryfall.com/cards/tznr/3/en?format=image"); + put("ZNR/Cat", "https://api.scryfall.com/cards/tznr/2/en?format=image"); + put("ZNR/Construct", "https://api.scryfall.com/cards/tznr/10/en?format=image"); + put("ZNR/Drake", "https://api.scryfall.com/cards/tznr/5/en?format=image"); + put("ZNR/Goblin Construct", "https://api.scryfall.com/cards/tznr/11/en?format=image"); + put("ZNR/Hydra", "https://api.scryfall.com/cards/tznr/9/en?format=image"); + put("ZNR/Illusion", "https://api.scryfall.com/cards/tznr/6/en?format=image"); + put("ZNR/Insect", "https://api.scryfall.com/cards/tznr/7/en?format=image"); + put("ZNR/Kor Warrior", "https://api.scryfall.com/cards/tznr/4/en?format=image"); + put("ZNR/Plant", "https://api.scryfall.com/cards/tznr/8/en?format=image"); // generate supported sets supportedSets.clear(); diff --git a/Mage.Client/src/main/resources/card-pictures-tok.txt b/Mage.Client/src/main/resources/card-pictures-tok.txt index 05dc6dac50..86638fc6f9 100644 --- a/Mage.Client/src/main/resources/card-pictures-tok.txt +++ b/Mage.Client/src/main/resources/card-pictures-tok.txt @@ -1425,4 +1425,17 @@ # JMP # Jumpstart uses tokens and emblems from M21 set, # TODO: check scryfall for JMP tokens after set's release -|Generate|TOK:JMP|Unicorn|||UnicornToken| \ No newline at end of file +|Generate|TOK:JMP|Unicorn|||UnicornToken| + +# ZNR +|Generate|TOK:ZNR|Angel Warrior|||AngelWarriorToken| +|Generate|TOK:ZNR|Cat|||CatToken3| +|Generate|TOK:ZNR|Cat Beast|||CatBeastToken| +|Generate|TOK:ZNR|Construct|||ConstructToken| +|Generate|TOK:ZNR|Goblin Construct|||RelicRobberToken| +|Generate|TOK:ZNR|Drake|||DrakeToken| +|Generate|TOK:ZNR|Hydra|||GrakmawSkyclaveRavagerHydraToken| +|Generate|TOK:ZNR|Illusion|||CustomIllusionToken| +|Generate|TOK:ZNR|Insect|||InsectToken| +|Generate|TOK:ZNR|Kor Warrior|||KorWarriorToken| +|Generate|TOK:ZNR|Plant|||PlantToken| \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java b/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java index fc155c4869..33696bd6ef 100644 --- a/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java +++ b/Mage.Sets/src/mage/cards/g/GrakmawSkyclaveRavager.java @@ -3,6 +3,7 @@ package mage.cards.g; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.common.DiesSourceTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; @@ -18,10 +19,9 @@ import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.game.permanent.token.GrakmawSkyclaveRavagerToken; +import mage.game.permanent.token.GrakmawSkyclaveRavagerHydraToken; import java.util.UUID; -import mage.abilities.common.DiesSourceTriggeredAbility; /** * @author TheElk801 @@ -96,7 +96,7 @@ class GrakmawSkyclaveRavagerEffect extends OneShotEffect { if (permanent != null) { counters = permanent.getCounters(game).getCount(CounterType.P1P1); } - return new GrakmawSkyclaveRavagerToken(counters).putOntoBattlefield( + return new GrakmawSkyclaveRavagerHydraToken(counters).putOntoBattlefield( 1, game, source.getSourceId(), source.getControllerId() ); } diff --git a/Mage.Sets/src/mage/cards/i/InscriptionOfInsight.java b/Mage.Sets/src/mage/cards/i/InscriptionOfInsight.java index 8e3d56dc89..8553533ded 100644 --- a/Mage.Sets/src/mage/cards/i/InscriptionOfInsight.java +++ b/Mage.Sets/src/mage/cards/i/InscriptionOfInsight.java @@ -12,7 +12,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.game.Game; -import mage.game.permanent.token.InscriptionOfInsightToken; +import mage.game.permanent.token.CustomIllusionToken; import mage.players.Player; import mage.target.TargetPlayer; import mage.target.common.TargetCreaturePermanent; @@ -80,8 +80,8 @@ class InscriptionOfInsightEffect extends OneShotEffect { if (player == null) { return false; } - int cardsInHand = player.getHand().size(); - return new InscriptionOfInsightToken(player.getHand().size()).putOntoBattlefield( + + return new CustomIllusionToken(player.getHand().size()).putOntoBattlefield( 1, game, source.getSourceId(), source.getFirstTarget() ); } diff --git a/Mage.Sets/src/mage/cards/s/SkyclaveApparition.java b/Mage.Sets/src/mage/cards/s/SkyclaveApparition.java index 990f6c0e6f..42a1ab8019 100644 --- a/Mage.Sets/src/mage/cards/s/SkyclaveApparition.java +++ b/Mage.Sets/src/mage/cards/s/SkyclaveApparition.java @@ -17,7 +17,7 @@ import mage.filter.predicate.permanent.TokenPredicate; import mage.game.ExileZone; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.game.permanent.token.InscriptionOfInsightToken; +import mage.game.permanent.token.CustomIllusionToken; import mage.target.TargetPermanent; import mage.util.CardUtil; @@ -104,7 +104,7 @@ class SkyclaveApparitionEffect extends OneShotEffect { card.getOwnerId(), (u, i) -> i == null ? card.getConvertedManaCost() : Integer.sum(card.getConvertedManaCost(), i) )); for (Map.Entry entry : map.entrySet()) { - new InscriptionOfInsightToken(entry.getValue()).putOntoBattlefield( + new CustomIllusionToken(entry.getValue()).putOntoBattlefield( 1, game, source.getSourceId(), entry.getKey() ); } diff --git a/Mage/src/main/java/mage/game/permanent/token/AngelToken.java b/Mage/src/main/java/mage/game/permanent/token/AngelToken.java index 0a1f871834..d5e3a3c654 100644 --- a/Mage/src/main/java/mage/game/permanent/token/AngelToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/AngelToken.java @@ -5,14 +5,10 @@ import mage.abilities.keyword.FlyingAbility; import mage.constants.CardType; import mage.constants.SubType; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; public final class AngelToken extends TokenImpl { - static final private List tokenImageSets = new ArrayList<>(); - public AngelToken() { super("Angel", "4/4 white Angel creature token with flying"); cardType.add(CardType.CREATURE); diff --git a/Mage/src/main/java/mage/game/permanent/token/AngelWarriorToken.java b/Mage/src/main/java/mage/game/permanent/token/AngelWarriorToken.java index c2ae11aed8..d0c8682364 100644 --- a/Mage/src/main/java/mage/game/permanent/token/AngelWarriorToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/AngelWarriorToken.java @@ -5,6 +5,8 @@ import mage.abilities.keyword.FlyingAbility; import mage.constants.CardType; import mage.constants.SubType; +import java.util.Arrays; + public final class AngelWarriorToken extends TokenImpl { public AngelWarriorToken() { @@ -15,7 +17,10 @@ public final class AngelWarriorToken extends TokenImpl { subtype.add(SubType.WARRIOR); power = new MageInt(4); toughness = new MageInt(4); + addAbility(FlyingAbility.getInstance()); + + availableImageSetCodes = Arrays.asList("ZNR"); } public AngelWarriorToken(final AngelWarriorToken token) { diff --git a/Mage/src/main/java/mage/game/permanent/token/CatBeastToken.java b/Mage/src/main/java/mage/game/permanent/token/CatBeastToken.java index b5d68b8826..a6b4ffc180 100644 --- a/Mage/src/main/java/mage/game/permanent/token/CatBeastToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/CatBeastToken.java @@ -4,6 +4,8 @@ import mage.MageInt; import mage.constants.CardType; import mage.constants.SubType; +import java.util.Arrays; + /** * @author TheElk801 */ @@ -17,6 +19,8 @@ public final class CatBeastToken extends TokenImpl { subtype.add(SubType.BEAST); power = new MageInt(2); toughness = new MageInt(2); + + availableImageSetCodes = Arrays.asList("ZNR"); } public CatBeastToken(final CatBeastToken token) { diff --git a/Mage/src/main/java/mage/game/permanent/token/CatToken3.java b/Mage/src/main/java/mage/game/permanent/token/CatToken3.java index 7f6f0bdfe2..af34cccab5 100644 --- a/Mage/src/main/java/mage/game/permanent/token/CatToken3.java +++ b/Mage/src/main/java/mage/game/permanent/token/CatToken3.java @@ -4,6 +4,8 @@ import mage.MageInt; import mage.constants.CardType; import mage.constants.SubType; +import java.util.Arrays; + /** * @author TheElk801 */ @@ -16,6 +18,8 @@ public final class CatToken3 extends TokenImpl { subtype.add(SubType.CAT); power = new MageInt(1); toughness = new MageInt(1); + + availableImageSetCodes = Arrays.asList("ZNR"); } private CatToken3(final CatToken3 token) { diff --git a/Mage/src/main/java/mage/game/permanent/token/ConstructToken.java b/Mage/src/main/java/mage/game/permanent/token/ConstructToken.java index 9cc999161a..bfd43be2e1 100644 --- a/Mage/src/main/java/mage/game/permanent/token/ConstructToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/ConstructToken.java @@ -4,6 +4,8 @@ import mage.MageInt; import mage.constants.CardType; import mage.constants.SubType; +import java.util.Arrays; + /** * @author spjspj */ @@ -16,6 +18,8 @@ public final class ConstructToken extends TokenImpl { subtype.add(SubType.CONSTRUCT); power = new MageInt(1); toughness = new MageInt(1); + + availableImageSetCodes = Arrays.asList("ZNR"); } public ConstructToken(final ConstructToken token) { diff --git a/Mage/src/main/java/mage/game/permanent/token/InscriptionOfInsightToken.java b/Mage/src/main/java/mage/game/permanent/token/CustomIllusionToken.java similarity index 56% rename from Mage/src/main/java/mage/game/permanent/token/InscriptionOfInsightToken.java rename to Mage/src/main/java/mage/game/permanent/token/CustomIllusionToken.java index 98012e0683..6b4b796021 100644 --- a/Mage/src/main/java/mage/game/permanent/token/InscriptionOfInsightToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/CustomIllusionToken.java @@ -4,25 +4,29 @@ import mage.MageInt; import mage.constants.CardType; import mage.constants.SubType; +import java.util.Arrays; + /** * @author TheElk801 */ -public final class InscriptionOfInsightToken extends TokenImpl { +public final class CustomIllusionToken extends TokenImpl { - public InscriptionOfInsightToken(int xValue) { + public CustomIllusionToken(int xValue) { super("Illusion", "X/X blue Illusion creature token"); cardType.add(CardType.CREATURE); color.setBlue(true); subtype.add(SubType.ILLUSION); power = new MageInt(xValue); toughness = new MageInt(xValue); + + availableImageSetCodes = Arrays.asList("ZNR"); } - public InscriptionOfInsightToken(final InscriptionOfInsightToken token) { + public CustomIllusionToken(final CustomIllusionToken token) { super(token); } - public InscriptionOfInsightToken copy() { - return new InscriptionOfInsightToken(this); + public CustomIllusionToken copy() { + return new CustomIllusionToken(this); } } diff --git a/Mage/src/main/java/mage/game/permanent/token/DrakeToken.java b/Mage/src/main/java/mage/game/permanent/token/DrakeToken.java index e603a6178f..b9f12cbcf9 100644 --- a/Mage/src/main/java/mage/game/permanent/token/DrakeToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/DrakeToken.java @@ -1,14 +1,14 @@ - package mage.game.permanent.token; -import mage.constants.CardType; -import mage.constants.SubType; import mage.MageInt; import mage.ObjectColor; import mage.abilities.keyword.FlyingAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +import java.util.Arrays; /** - * * @author North */ public final class DrakeToken extends TokenImpl { @@ -23,6 +23,8 @@ public final class DrakeToken extends TokenImpl { this.toughness = new MageInt(2); this.addAbility(FlyingAbility.getInstance()); + + availableImageSetCodes = Arrays.asList("AKH", "C15", "C19", "M13", "C20", "ZNR"); } public DrakeToken(final DrakeToken token) { diff --git a/Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerToken.java b/Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerHydraToken.java similarity index 53% rename from Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerToken.java rename to Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerHydraToken.java index 6a018a6319..a19eeb6477 100644 --- a/Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/GrakmawSkyclaveRavagerHydraToken.java @@ -4,12 +4,14 @@ import mage.MageInt; import mage.constants.CardType; import mage.constants.SubType; +import java.util.Arrays; + /** * @author TheElk801 */ -public final class GrakmawSkyclaveRavagerToken extends TokenImpl { +public final class GrakmawSkyclaveRavagerHydraToken extends TokenImpl { - public GrakmawSkyclaveRavagerToken(int xValue) { + public GrakmawSkyclaveRavagerHydraToken(int xValue) { super("Hydra", "X/X black and green Hydra creature token"); cardType.add(CardType.CREATURE); color.setBlack(true); @@ -17,13 +19,15 @@ public final class GrakmawSkyclaveRavagerToken extends TokenImpl { subtype.add(SubType.HYDRA); power = new MageInt(xValue); toughness = new MageInt(xValue); + + availableImageSetCodes = Arrays.asList("ZNR"); } - private GrakmawSkyclaveRavagerToken(final GrakmawSkyclaveRavagerToken token) { + private GrakmawSkyclaveRavagerHydraToken(final GrakmawSkyclaveRavagerHydraToken token) { super(token); } - public GrakmawSkyclaveRavagerToken copy() { - return new GrakmawSkyclaveRavagerToken(this); + public GrakmawSkyclaveRavagerHydraToken copy() { + return new GrakmawSkyclaveRavagerHydraToken(this); } } diff --git a/Mage/src/main/java/mage/game/permanent/token/InsectToken.java b/Mage/src/main/java/mage/game/permanent/token/InsectToken.java index 8b2fa6e4bf..9f7e4d3211 100644 --- a/Mage/src/main/java/mage/game/permanent/token/InsectToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/InsectToken.java @@ -1,28 +1,18 @@ - - package mage.game.permanent.token; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import mage.MageInt; import mage.constants.CardType; import mage.constants.SubType; +import java.util.Arrays; + /** - * * @author BetaSteward_at_googlemail.com */ public final class InsectToken extends TokenImpl { - static final private List tokenImageSets = new ArrayList<>(); - - static { - tokenImageSets.addAll(Arrays.asList("M10", "MM2", "SOI")); - } - public InsectToken() { - this((String)null); + this((String) null); } public InsectToken(String setCode) { @@ -34,7 +24,7 @@ public final class InsectToken extends TokenImpl { power = new MageInt(1); toughness = new MageInt(1); - availableImageSetCodes = tokenImageSets; + availableImageSetCodes = Arrays.asList("M10", "MM2", "SOI", "ZNR"); } public InsectToken(final InsectToken token) { diff --git a/Mage/src/main/java/mage/game/permanent/token/KorWarriorToken.java b/Mage/src/main/java/mage/game/permanent/token/KorWarriorToken.java index 04769211a3..9f75f1e110 100644 --- a/Mage/src/main/java/mage/game/permanent/token/KorWarriorToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/KorWarriorToken.java @@ -4,8 +4,9 @@ import mage.MageInt; import mage.constants.CardType; import mage.constants.SubType; +import java.util.Arrays; + /** - * * @author TheElk801 */ public final class KorWarriorToken extends TokenImpl { @@ -18,6 +19,8 @@ public final class KorWarriorToken extends TokenImpl { color.setWhite(true); power = new MageInt(1); toughness = new MageInt(1); + + availableImageSetCodes = Arrays.asList("ZNR"); } public KorWarriorToken(final KorWarriorToken token) { diff --git a/Mage/src/main/java/mage/game/permanent/token/PlantToken.java b/Mage/src/main/java/mage/game/permanent/token/PlantToken.java index 5bd4e17ca8..48ac66cea8 100644 --- a/Mage/src/main/java/mage/game/permanent/token/PlantToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/PlantToken.java @@ -1,20 +1,13 @@ package mage.game.permanent.token; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import mage.MageInt; import mage.constants.CardType; import mage.constants.SubType; +import java.util.Arrays; + public final class PlantToken extends TokenImpl { - static final private List tokenImageSets = new ArrayList<>(); - - static { - tokenImageSets.addAll(Arrays.asList("WWK", "DDP", "OGW")); - } - public PlantToken() { super("Plant", "0/1 green Plant creature token"); cardType.add(CardType.CREATURE); @@ -23,7 +16,7 @@ public final class PlantToken extends TokenImpl { power = new MageInt(0); toughness = new MageInt(1); - availableImageSetCodes = tokenImageSets; + availableImageSetCodes = Arrays.asList("WWK", "DDP", "OGW", "ZNR"); } public PlantToken(final PlantToken token) { diff --git a/Mage/src/main/java/mage/game/permanent/token/RelicRobberToken.java b/Mage/src/main/java/mage/game/permanent/token/RelicRobberToken.java index f9b300f299..b49c5d9791 100644 --- a/Mage/src/main/java/mage/game/permanent/token/RelicRobberToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/RelicRobberToken.java @@ -10,13 +10,10 @@ import mage.constants.Duration; import mage.constants.SubType; import mage.constants.TargetController; -import java.util.ArrayList; -import java.util.List; +import java.util.Arrays; public final class RelicRobberToken extends TokenImpl { - static final private List tokenImageSets = new ArrayList<>(); - public RelicRobberToken() { super("Goblin Construct", "0/1 colorless Goblin Construct artifact creature token with \"This creature can't block\" and \"At the beginning of your upkeep, this creature deals 1 damage to you.\""); cardType.add(CardType.ARTIFACT); @@ -25,12 +22,15 @@ public final class RelicRobberToken extends TokenImpl { subtype.add(SubType.CONSTRUCT); power = new MageInt(0); toughness = new MageInt(1); + this.addAbility(new SimpleStaticAbility( new CantBlockSourceEffect(Duration.WhileOnBattlefield).setText("this creature can't block") )); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DamageControllerEffect( 1, "this creature" ), TargetController.YOU, false)); + + availableImageSetCodes = Arrays.asList("ZNR"); } public RelicRobberToken(final RelicRobberToken token) {