[C20] tokens support and fixes:

* Added tokens for C20;
* Added tokens images download for C20;
* Fixed that some tokens uses wrong images or images from wrong set (example: Elemental);
This commit is contained in:
Oleg Agafonov 2020-06-15 20:29:52 +04:00
parent 2b21298377
commit c2487aec7d
48 changed files with 406 additions and 349 deletions

View file

@ -16,7 +16,7 @@ public final class BeastToken2 extends TokenImpl {
static final private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("ZEN", "C14", "DDD", "C15", "DD3GVL", "MM3", "CMA", "E01", "C19"));
tokenImageSets.addAll(Arrays.asList("ZEN", "C14", "DDD", "C15", "DD3GVL", "MM3", "CMA", "E01", "C19", "C20"));
}
public BeastToken2() {

View file

@ -1,15 +1,13 @@
package mage.game.permanent.token;
import java.util.Arrays;
import mage.MageInt;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.Arrays;
/**
*
* @author LoneFox
*/
public final class BirdToken extends TokenImpl {
@ -22,6 +20,7 @@ public final class BirdToken extends TokenImpl {
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
availableImageSetCodes.addAll(Arrays.asList("BNG", "RTR", "ZEN", "C16", "MM3", "DGM"));
}
@ -30,7 +29,7 @@ public final class BirdToken extends TokenImpl {
}
@Override
public BirdToken copy() {
public BirdToken copy() {
return new BirdToken(this);
}

View file

@ -1,63 +0,0 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.abilities.keyword.HasteAbility;
import mage.constants.CardType;
import mage.constants.SubType;
/**
*
* @author magenoxx
*/
public final class ElementalToken extends TokenImpl {
static final private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("OGW", "CON", "DIS"));
}
public ElementalToken() {
this ("OGW", 0);
}
public ElementalToken(String setCode, int tokenType) {
super("Elemental", "3/1 red Elemental creature token");
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add(SubType.ELEMENTAL);
power = new MageInt(3);
toughness = new MageInt(1);
this.setOriginalExpansionSetCode("CON");
}
public ElementalToken(String setCode, int tokenType, boolean hasHaste) {
super("Elemental", "3/1 red Elemental creature token");
setTokenType(tokenType);
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add(SubType.ELEMENTAL);
power = new MageInt(3);
toughness = new MageInt(1);
if (hasHaste) this.addAbility(HasteAbility.getInstance());
}
public ElementalToken(final ElementalToken token) {
super(token);
}
public ElementalToken copy() {
return new ElementalToken(this);
}
}

View file

@ -0,0 +1,51 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.keyword.HasteAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author magenoxx
*/
public final class ElementalTokenWithHaste extends TokenImpl {
static final private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("C20", "MBP", "OGW", "SOK", "MRD"));
}
public ElementalTokenWithHaste() {
super("Elemental", "3/1 red Elemental creature token with haste");
availableImageSetCodes = tokenImageSets;
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add(SubType.ELEMENTAL);
power = new MageInt(3);
toughness = new MageInt(1);
this.addAbility(HasteAbility.getInstance());
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("OGW")) {
setTokenType(2);
}
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("C20")) {
setTokenType(1);
}
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("SOK")) {
setTokenType(1);
}
}
public ElementalTokenWithHaste(final ElementalTokenWithHaste token) {
super(token);
}
public ElementalTokenWithHaste copy() {
return new ElementalTokenWithHaste(this);
}
}

View file

@ -1,17 +1,17 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.MageInt;
import java.util.Arrays;
/**
*
* @author spjspj
*/
public final class WortTheRaidmotherToken extends TokenImpl {
public final class GoblinWarriorToken extends TokenImpl {
public WortTheRaidmotherToken() {
public GoblinWarriorToken() {
super("Goblin Warrior", "1/1 red and green Goblin Warrior creature token");
cardType.add(CardType.CREATURE);
color.setRed(true);
@ -20,13 +20,15 @@ public final class WortTheRaidmotherToken extends TokenImpl {
subtype.add(SubType.WARRIOR);
power = new MageInt(1);
toughness = new MageInt(1);
availableImageSetCodes.addAll(Arrays.asList("C20"));
}
public WortTheRaidmotherToken(final WortTheRaidmotherToken token) {
public GoblinWarriorToken(final GoblinWarriorToken token) {
super(token);
}
public WortTheRaidmotherToken copy() {
return new WortTheRaidmotherToken(this);
public GoblinWarriorToken copy() {
return new GoblinWarriorToken(this);
}
}

View file

@ -0,0 +1,41 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.keyword.VigilanceAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author JayDi85
*/
public final class GreenAndWhiteElementalToken extends TokenImpl {
static final private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("GK1", "PTC", "RTR"));
}
public GreenAndWhiteElementalToken() {
super("Elemental", "8/8 green and white Elemental creature token with vigilance");
cardType.add(CardType.CREATURE);
color.setGreen(true);
color.setWhite(true);
this.subtype.add(SubType.ELEMENTAL);
power = new MageInt(8);
toughness = new MageInt(8);
this.addAbility(VigilanceAbility.getInstance());
}
public GreenAndWhiteElementalToken(final GreenAndWhiteElementalToken token) {
super(token);
}
public GreenAndWhiteElementalToken copy() {
return new GreenAndWhiteElementalToken(this);
}
}

View file

@ -1,21 +1,20 @@
package mage.game.permanent.token;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.MageInt;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.Arrays;
/**
*
* @author spjspj
*/
public final class HornetQueenInsectToken extends TokenImpl {
public HornetQueenInsectToken() {
super("Insect", "1/1 green Insect creature token with flying and deathtouch");
setOriginalExpansionSetCode("M15");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add(SubType.INSECT);
@ -23,6 +22,8 @@ public final class HornetQueenInsectToken extends TokenImpl {
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
addAbility(DeathtouchAbility.getInstance());
availableImageSetCodes = Arrays.asList("M15", "C20");
}
public HornetQueenInsectToken(final HornetQueenInsectToken token) {

View file

@ -18,7 +18,7 @@ public final class HumanToken extends TokenImpl {
subtype.add(SubType.HUMAN);
power = new MageInt(1);
toughness = new MageInt(1);
availableImageSetCodes.addAll(Arrays.asList("DKA", "AVR", "FNMP", "RNA", "ELD", "C19"));
availableImageSetCodes.addAll(Arrays.asList("DKA", "AVR", "FNMP", "RNA", "ELD", "C19", "C20"));
}
public HumanToken(final HumanToken token) {

View file

@ -1,29 +1,29 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.MageInt;
import java.util.Arrays;
/**
*
* @author spjspj
*/
public final class HydraBroodmasterToken extends TokenImpl {
public HydraBroodmasterToken() {
this(1,1);
this(1, 1);
}
public HydraBroodmasterToken(int power, int toughness) {
super("Hydra", "green Hydra creature token");
this.setOriginalExpansionSetCode("JOU");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add(SubType.HYDRA);
this.power = new MageInt(power);
this.toughness = new MageInt(toughness);
availableImageSetCodes = Arrays.asList("JOU");
}
public HydraBroodmasterToken(final HydraBroodmasterToken token) {

View file

@ -0,0 +1,39 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author JayDi85
*/
public final class ResearchDevelopmentToken extends TokenImpl {
static final private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("DIS"));
}
public ResearchDevelopmentToken() {
super("Elemental", "3/1 red Elemental creature token");
availableImageSetCodes = tokenImageSets;
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add(SubType.ELEMENTAL);
power = new MageInt(3);
toughness = new MageInt(1);
}
public ResearchDevelopmentToken(final ResearchDevelopmentToken token) {
super(token);
}
public ResearchDevelopmentToken copy() {
return new ResearchDevelopmentToken(this);
}
}

View file

@ -32,39 +32,33 @@ public final class SaprolingToken extends TokenImpl {
"RTR",
"C15",
"MM3",
"INV",
"C16", // 2 different token images...
"CMA",
"VMA", // 2 different token, one with DIFFERENT stats, "Saproling Burst" create different token, see https://scryfall.com/card/tvma/12
"E02",
"RIX",
"DOM", // 3 different token images
"C19"
"C19",
"C20"
));
}
public SaprolingToken() {
this(null, 0);
}
public SaprolingToken(String setCode) {
this(setCode, 0);
}
public SaprolingToken(String setCode, int tokenType) {
super("Saproling", "1/1 green Saproling creature token");
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add(SubType.SAPROLING);
power = new MageInt(1);
toughness = new MageInt(1);
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("C16")) {
this.setTokenType(RandomUtil.nextInt(2) + 1);
}
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("DOM")) {
this.setTokenType(RandomUtil.nextInt(3) + 1);
}
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add(SubType.SAPROLING);
power = new MageInt(1);
toughness = new MageInt(1);
}
public SaprolingToken(final SaprolingToken token) {

View file

@ -18,7 +18,7 @@ public final class SoldierToken extends TokenImpl {
static {
tokenImageSets.addAll(Arrays.asList("10E", "M15", "C14", "ORI", "ALA", "DDF", "THS", "M12", "M13", "MM2", "MMA", "RTR",
"SOM", "DDO", "M10", "ORI", "EMN", "EMA", "CN2", "C16", "MM3", "E01", "DOM", "MH1", "M20"));
"SOM", "DDO", "M10", "ORI", "EMN", "EMA", "CN2", "C16", "MM3", "E01", "DOM", "MH1", "M20", "C20"));
}
public SoldierToken() {
@ -30,7 +30,6 @@ public final class SoldierToken extends TokenImpl {
subtype.add(SubType.SOLDIER);
power = new MageInt(1);
toughness = new MageInt(1);
}
@Override
@ -39,7 +38,7 @@ public final class SoldierToken extends TokenImpl {
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("THS")) {
this.setTokenType(RandomUtil.nextInt(2) + 1);
}
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("CN2") || getOriginalExpansionSetCode().equals("MM3")) {
if (getOriginalExpansionSetCode() != null && (getOriginalExpansionSetCode().equals("CN2") || getOriginalExpansionSetCode().equals("MM3"))) {
setTokenType(1);
}
}

View file

@ -18,24 +18,12 @@ public final class SpiritWhiteToken extends TokenImpl {
static {
tokenImageSets.addAll(Arrays.asList("AVR", "C14", "CNS", "DDC", "DDK", "FRF", "ISD", "KTK", "M15", "MM2", "SHM",
"SOI", "EMA", "C16", "MM3", "CMA", "E01", "ANA", "RNA", "M20"));
"SOI", "EMA", "C16", "MM3", "CMA", "E01", "ANA", "GPT", "RAV", "EMN", "RNA", "M20", "C20"));
}
public SpiritWhiteToken() {
this(null, 0);
}
public SpiritWhiteToken(String setCode) {
this(setCode, 0);
}
public SpiritWhiteToken(String setCode, int tokenType) {
super("Spirit", "1/1 white Spirit creature token with flying");
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
if (tokenType > 0) {
setTokenType(tokenType);
}
cardType.add(CardType.CREATURE);
subtype.add(SubType.SPIRIT);
color.setWhite(true);

View file

@ -1,21 +1,20 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.MageInt;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.FlyingAbility;
import java.util.Arrays;
/**
*
* @author spjspj
*/
public final class TheLocustGodInsectToken extends TokenImpl {
public TheLocustGodInsectToken() {
super("Insect", "1/1 blue and red Insect creature token with flying and haste");
setOriginalExpansionSetCode("HOU");
cardType.add(CardType.CREATURE);
color.setBlue(true);
color.setRed(true);
@ -24,6 +23,8 @@ public final class TheLocustGodInsectToken extends TokenImpl {
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
addAbility(HasteAbility.getInstance());
availableImageSetCodes = Arrays.asList("HOU", "C20");
}
public TheLocustGodInsectToken(final TheLocustGodInsectToken token) {

View file

@ -2,15 +2,12 @@ package mage.game.permanent.token;
import mage.MageObject;
import mage.MageObjectImpl;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.CreateTokenEvent;
import mage.game.events.CreatedTokenEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
@ -53,7 +50,8 @@ public abstract class TokenImpl extends MageObjectImpl implements Token {
}
}
public TokenImpl() { }
public TokenImpl() {
}
public TokenImpl(String name, String description) {
this.name = name;
@ -165,6 +163,9 @@ public abstract class TokenImpl extends MageObjectImpl implements Token {
if (controller == null) {
return false;
}
if (amount == 0) {
return false;
}
lastAddedTokenIds.clear();
CreateTokenEvent event = new CreateTokenEvent(sourceId, controllerId, amount, this);
@ -240,6 +241,10 @@ public abstract class TokenImpl extends MageObjectImpl implements Token {
return tokenType;
}
/**
* Set token index to search in card-pictures-tok.txt (if set have multiple tokens with same name)
* Default is 1
*/
@Override
public void setTokenType(int tokenType) {
this.tokenType = tokenType;

View file

@ -20,24 +20,11 @@ public final class TreasureToken extends TokenImpl {
static final private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("XLN", "RNA", "M20", "C19"));
}
public TreasureToken() {
this(null, 0);
}
public TreasureToken(String setCode) {
this(setCode, 0);
}
public TreasureToken(String setCode, int tokenType) {
super("Treasure", "Treasure token");
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
cardType.add(CardType.ARTIFACT);
subtype.add(SubType.TREASURE);
availableImageSetCodes = Arrays.asList("XLN", "RNA", "M20", "C19", "C20");
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());

View file

@ -1,13 +1,11 @@
package mage.game.permanent.token;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.MageInt;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.CardType;
import mage.constants.SubType;
/**
*
* @author spjspj
*/
public final class WhiteElementalToken extends TokenImpl {
@ -19,8 +17,11 @@ public final class WhiteElementalToken extends TokenImpl {
subtype.add(SubType.ELEMENTAL);
power = new MageInt(4);
toughness = new MageInt(4);
setTokenType(2);
this.addAbility(FlyingAbility.getInstance());
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("C20")) {
setTokenType(2);
}
}
public WhiteElementalToken(final WhiteElementalToken token) {

View file

@ -0,0 +1,33 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.Arrays;
/**
* @author AsterAether
*/
public class ZaxaraTheExemplaryHydraToken extends TokenImpl {
public ZaxaraTheExemplaryHydraToken() {
super("Hydra", "0/0 green Hydra creature token");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add(SubType.HYDRA);
power = new MageInt(0);
toughness = new MageInt(0);
availableImageSetCodes = Arrays.asList("C20");
}
private ZaxaraTheExemplaryHydraToken(final ZaxaraTheExemplaryHydraToken token) {
super(token);
}
@Override
public ZaxaraTheExemplaryHydraToken copy() {
return new ZaxaraTheExemplaryHydraToken(this);
}
}