Fix pictures for some tokens from recent sets

This commit is contained in:
Quercitron 2015-11-08 20:07:04 +03:00
parent 8caf33cdf0
commit e23fc13db0
29 changed files with 336 additions and 119 deletions

View file

@ -1,11 +1,14 @@
package mage.abilities.keyword;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
@ -31,9 +34,9 @@ public class LivingWeaponAbility extends EntersBattlefieldTriggeredAbility {
}
}
class LivingWeaponEffect extends OneShotEffect {
class LivingWeaponEffect extends CreateTokenEffect {
LivingWeaponEffect() {
super(Outcome.PutCreatureInPlay);
super(new GermToken());
}
LivingWeaponEffect(final LivingWeaponEffect effect) {
@ -44,13 +47,13 @@ class LivingWeaponEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
GermToken token = new GermToken();
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
Permanent p = game.getPermanent(token.getLastAddedToken());
if (p != null) {
p.addAttachment(source.getSourceId(), game);
return true;
}
if (super.apply(game, source)) {
Permanent p = game.getPermanent(this.getLastAddedTokenId());
if (p != null) {
p.addAttachment(source.getSourceId(), game);
return true;
}
}
}
return false;
}
@ -62,9 +65,16 @@ class LivingWeaponEffect extends OneShotEffect {
}
class GermToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("C14", "MBS", "MM2"));
}
public GermToken() {
super("Germ", "a 0/0 black Germ creature token");
this.setOriginalExpansionSetCode("MBS");
availableImageSetCodes = tokenImageSets;
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Germ");

View file

@ -1,25 +1,34 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.CardType;
public class AngelToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("AVR", "C14", "CFX", "GTC", "ISD", "M14", "ORI", "ZEN"));
}
public AngelToken() {
this("M14");
this(null);
}
public AngelToken(String setCode) {
super("Angel", "4/4 white Angel creature token with flying");
this.setOriginalExpansionSetCode(setCode);
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Angel");
power = new MageInt(4);
toughness = new MageInt(4);
addAbility(FlyingAbility.getInstance());
}
}

View file

@ -28,6 +28,9 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import mage.constants.CardType;
import mage.constants.Zone;
@ -42,6 +45,12 @@ import mage.abilities.mana.SimpleManaAbility;
*/
public class EldraziSpawnToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("ROE", "MM2", "DDP"));
}
public EldraziSpawnToken() {
super("Eldrazi Spawn", "0/1 colorless Eldrazi Spawn creature with \"Sacrifice this creature: Add {1} to your mana pool.\"");
cardType.add(CardType.CREATURE);
@ -50,7 +59,8 @@ public class EldraziSpawnToken extends Token {
power = new MageInt(0);
toughness = new MageInt(1);
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana, new SacrificeSourceCost()));
this.setOriginalExpansionSetCode("ROE");
availableImageSetCodes = tokenImageSets;
// Get one of the three possible token images
this.setTokenType(new Random().nextInt(3) + 1);
}

View file

@ -28,6 +28,10 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.ObjectColor;
import mage.constants.CardType;
@ -38,6 +42,12 @@ import mage.constants.CardType;
*/
public class ElephantToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("C14", "CNS", "DDD", "MM2", "WWK"));
}
public ElephantToken() {
super("Elephant", "3/3 green Elephant creature token");
cardType.add(CardType.CREATURE);
@ -46,7 +56,7 @@ public class ElephantToken extends Token {
power = new MageInt(3);
toughness = new MageInt(3);
this.setOriginalExpansionSetCode("DDD");
availableImageSetCodes = tokenImageSets;
}
}

View file

@ -28,7 +28,10 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.keyword.FlyingAbility;
@ -39,6 +42,12 @@ import mage.abilities.keyword.FlyingAbility;
*/
public class FaerieRogueToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("SHM", "MOR", "MMA", "MM2"));
}
public FaerieRogueToken() {
super("Faerie Rogue", "1/1 black Faerie Rogue creature token with flying");
cardType.add(CardType.CREATURE);
@ -48,6 +57,7 @@ public class FaerieRogueToken extends Token {
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
availableImageSetCodes.addAll(Arrays.asList("SHM", "MOR", "MMA"));
availableImageSetCodes = tokenImageSets;
}
}

View file

@ -27,6 +27,10 @@
*/
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.constants.CardType;
import mage.MageInt;
@ -36,8 +40,14 @@ import mage.MageInt;
*/
public class GolemToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("MM2", "NPH", "SOM"));
}
public GolemToken() {
this("SOM");
this(null);
}
public GolemToken(String setCode) {
@ -48,5 +58,7 @@ public class GolemToken extends Token {
subtype.add("Golem");
power = new MageInt(3);
toughness = new MageInt(3);
availableImageSetCodes = tokenImageSets;
}
}

View file

@ -28,6 +28,10 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.constants.CardType;
@ -37,8 +41,14 @@ import mage.constants.CardType;
*/
public class InsectToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("M10", "MM2"));
}
public InsectToken() {
this("M10");
this(null);
}
public InsectToken(String setCode) {
@ -49,5 +59,7 @@ public class InsectToken extends Token {
subtype.add("Insect");
power = new MageInt(1);
toughness = new MageInt(1);
availableImageSetCodes = tokenImageSets;
}
}

View file

@ -1,5 +1,8 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.keyword.VigilanceAbility;
@ -10,15 +13,21 @@ import mage.abilities.keyword.VigilanceAbility;
*/
public class KnightToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("ORI", "RTR"));
}
public KnightToken() {
super("Knight", "2/2 white Knight creature token with vigilance");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Knight");
power = new MageInt(2);
toughness = new MageInt(2);
this.addAbility(VigilanceAbility.getInstance());
setOriginalExpansionSetCode("RTR");
availableImageSetCodes = tokenImageSets;
}
}

View file

@ -1,12 +1,22 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.constants.CardType;
public class MyrToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("C14", "MM2", "NPH", "SOM"));
}
public MyrToken() {
this("SOM");
this(null);
}
public MyrToken(String expansionSetCode) {
@ -17,5 +27,7 @@ public class MyrToken extends Token {
subtype.add("Myr");
power = new MageInt(1);
toughness = new MageInt(1);
availableImageSetCodes = tokenImageSets;
}
}

View file

@ -28,10 +28,21 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.constants.CardType;
public class PlantToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("WWK", "DDP"));
}
public PlantToken() {
super("Plant", "0/1 green Plant creature");
cardType.add(CardType.CREATURE);
@ -39,6 +50,7 @@ public class PlantToken extends Token {
subtype.add("Plant");
power = new MageInt(0);
toughness = new MageInt(1);
this.setOriginalExpansionSetCode("WWK");
availableImageSetCodes = tokenImageSets;
}
}

View file

@ -28,6 +28,10 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.constants.CardType;
@ -37,6 +41,12 @@ import mage.constants.CardType;
*/
public class SaprolingToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("10E", "ALA", "DDE", "DDH", "DDJ", "M12", "M13", "M14", "MM2", "MMA", "RTR"));
}
public SaprolingToken() {
super("Saproling", "1/1 green Saproling creature token");
this.setOriginalExpansionSetCode("MMA");
@ -45,5 +55,7 @@ public class SaprolingToken extends Token {
subtype.add("Saproling");
power = new MageInt(1);
toughness = new MageInt(1);
availableImageSetCodes = tokenImageSets;
}
}

View file

@ -28,6 +28,10 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.constants.CardType;
@ -37,18 +41,26 @@ import mage.constants.CardType;
*/
public class SnakeToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("ZEN", "KTK", "MM2"));
}
public SnakeToken() {
this("ZEN");
this(null);
}
public SnakeToken(String setCode) {
super("Snake", "1/1 green Snake creature token");
setOriginalExpansionSetCode(setCode);
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Snake");
power = new MageInt(1);
toughness = new MageInt(1);
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
}
}

View file

@ -43,7 +43,7 @@ public class SoldierToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("10E", "M15", "C14", "ORI", "ALA", "DDF", "THS", "M12", "M13", "MM2", "MMA", "RTR", "SOM"));
tokenImageSets.addAll(Arrays.asList("10E", "M15", "C14", "ORI", "ALA", "DDF", "THS", "M12", "M13", "MM2", "MMA", "RTR", "SOM", "DDF", "M10"));
}
public SoldierToken() {

View file

@ -27,6 +27,9 @@
*/
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.CardType;
@ -36,15 +39,23 @@ import mage.constants.CardType;
*/
public class SpiritWhiteToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("AVR", "C14", "CNS", "DDC", "DDK", "FRF", "ISD", "KTK", "M15", "MM2", "SHM"));
}
public SpiritWhiteToken() {
this("SHM", 0);
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);
@ -57,4 +68,21 @@ public class SpiritWhiteToken extends Token {
addAbility(FlyingAbility.getInstance());
}
@Override
public void setExpansionSetCodeForImage(String code) {
super.setExpansionSetCodeForImage(code);
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("AVR")) {
setTokenType(1);
}
}
public SpiritWhiteToken(final SpiritWhiteToken token) {
super(token);
}
@Override
public SpiritWhiteToken copy() {
return new SpiritWhiteToken(this);
}
}

View file

@ -0,0 +1,59 @@
/*
* 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.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.constants.CardType;
/**
*
* @author Quercitron
*/
public class ThrullToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("MM2"));
}
public ThrullToken() {
super("Thrull", "1/1 black Thrull creature token");
cardType.add(CardType.CREATURE);
subtype.add("Thrull");
color.setBlack(true);
power = new MageInt(1);
toughness = new MageInt(1);
availableImageSetCodes = tokenImageSets;
}
}

View file

@ -235,7 +235,11 @@ public class Token extends MageObjectImpl {
if (availableImageSetCodes.contains(code)) {
setOriginalExpansionSetCode(code);
} else {
setOriginalExpansionSetCode(availableImageSetCodes.get(new Random().nextInt(availableImageSetCodes.size())));
// we should not set random set if appropriate set is already used
if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty()
|| !availableImageSetCodes.contains(getOriginalExpansionSetCode())) {
setOriginalExpansionSetCode(availableImageSetCodes.get(new Random().nextInt(availableImageSetCodes.size())));
}
}
} else {
if (getOriginalExpansionSetCode() == null || getOriginalExpansionSetCode().isEmpty()) {

View file

@ -28,9 +28,12 @@
package mage.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.constants.CardType;
import mage.MageInt;
import mage.ObjectColor;
/**
*
@ -38,16 +41,21 @@ import mage.ObjectColor;
*/
public class WolfToken extends Token {
public WolfToken() {
this("ISD");
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("BNG", "C14", "CNS", "FNMP", "ISD", "LRW", "M10", "M14", "MM2", "SHM", "SOM", "ZEN"));
}
public WolfToken() {
this((String) null);
}
public WolfToken(String setCode) {
super("Wolf", "2/2 green Wolf creature token");
this.setOriginalExpansionSetCode(setCode);
if (setCode.equals("ISD")) {
setTokenType(Type.SECOND.code);
}
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Wolf");
@ -55,9 +63,20 @@ public class WolfToken extends Token {
toughness = new MageInt(2);
}
public WolfToken(Token.Type type) {
this();
setTokenType(type.getCode());
@Override
public void setExpansionSetCodeForImage(String code) {
super.setExpansionSetCodeForImage(code);
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("ISD")) {
this.setTokenType(2);
}
}
public WolfToken(final WolfToken token) {
super(token);
}
@Override
public Token copy() {
return new WolfToken(this);
}
}