Merge pull request #52 from magefree/master

merge
This commit is contained in:
theelk801 2017-09-03 09:08:20 -04:00 committed by GitHub
commit b3a8aba62f
21 changed files with 701 additions and 62 deletions

View file

@ -62,7 +62,6 @@ public enum MythicspoilerComSource implements CardImageSource {
private Map<String, Set<String>> cardNameAliasesStart;
private final Map<String, Map<String, String>> sets;
@Override
public String getSourceName() {
return "mythicspoiler.com";
@ -72,6 +71,7 @@ public enum MythicspoilerComSource implements CardImageSource {
sets = new LinkedHashMap<>();
setsAliases = new HashMap<>();
setsAliases.put("exp", "bfz");
setsAliases.put("xln", "ixa");
cardNameAliases = new HashMap<>();
// set+wrong name from web side => correct card name
cardNameAliases.put("MM2-otherwordlyjourney", "otherworldlyjourney");

View file

@ -74,6 +74,6 @@ dd3evg=ddaevg
dd3gvl=ddagvl
dd3jvc=ddajvc
# Remove setname as soon as the images can be downloaded
ignore.urls=TOK,DDT,V17,IMA,XLN,RIX,,E02,M19,M25,DOM,UST,H17
ignore.urls=TOK,DDT,V17,IMA,RIX,E02,M19,M25,DOM,UST,H17
# sets ordered by release time (newest goes first)
token.lookup.order=M19,M25,DOM,E02,RIX,UST,XLN,IMA,H17,C17,V17,E01,DDT,CMA,HOU,MM3,DDS,AKH,DD3DVD,DD3EVG,DD3GVL,DD3JVC,H09,AER,PCA,C16,V16,MPS,KLD,DDR,CN2,EMN,EMA,SOI,DDQ,CP,CMA,ARENA,SUS,APAC,EURO,UGIN,C15,OGW,EXP,DDP,BFZ,DRB,V09,V10,V11,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

View file

@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
public final static int MAGE_VERSION_MAJOR = 1;
public final static int MAGE_VERSION_MINOR = 4;
public final static int MAGE_VERSION_PATCH = 26;
public final static String MAGE_VERSION_MINOR_PATCH = "V2";
public final static String MAGE_VERSION_MINOR_PATCH = "V3";
public final static String MAGE_VERSION_INFO = "";
private final int major;

View file

@ -30,19 +30,25 @@ package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.KickerAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.abilities.text.TextPartSubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.TextPartSubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
@ -52,7 +58,7 @@ import mage.target.targetpointer.FixedTarget;
public class AtarkaWorldRender extends CardImpl {
public AtarkaWorldRender(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{R}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}{G}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(6);
@ -65,7 +71,12 @@ public class AtarkaWorldRender extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// Whenever a Dragon you control attacks, it gains double strike until end of turn.
this.addAbility(new AtarkaWorldRenderEffect());
TextPartSubType textPart1 = (TextPartSubType) addTextPart(new TextPartSubType(SubType.DRAGON));
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Dragon you control");
filter.add(new TextPartSubtypePredicate(textPart1));
filter.add(Predicates.not(new TappedPredicate()));
this.addAbility(new KickerAbility(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true))));
this.addAbility(new AtarkaWorldRenderEffect(filter));
}
@ -81,18 +92,16 @@ public class AtarkaWorldRender extends CardImpl {
class AtarkaWorldRenderEffect extends TriggeredAbilityImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("dragon you control");
FilterControlledCreaturePermanent filter;
static {
filter.add(new SubtypePredicate(SubType.DRAGON));
}
public AtarkaWorldRenderEffect() {
public AtarkaWorldRenderEffect(FilterControlledCreaturePermanent filter) {
super(Zone.BATTLEFIELD, new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn));
this.filter = filter;
}
public AtarkaWorldRenderEffect(final AtarkaWorldRenderEffect ability) {
super(ability);
this.filter = ability.filter.copy();
}
@Override

View file

@ -35,6 +35,7 @@ import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.KickerAbility;
import mage.abilities.text.TextPartSubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -42,7 +43,7 @@ import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.TextPartSubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.players.Player;
@ -55,17 +56,14 @@ import mage.target.common.TargetOpponent;
*/
public class BloodTribute extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("an untapped Vampire you control");
static {
filter.add(Predicates.not(new TappedPredicate()));
filter.add(new SubtypePredicate(SubType.VAMPIRE));
}
public BloodTribute(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}{B}");
// Kicker - Tap an untapped Vampire you control.
TextPartSubType textPartVampire = (TextPartSubType) addTextPart(new TextPartSubType(SubType.VAMPIRE));
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("an untapped Vampire you control");
filter.add(new TextPartSubtypePredicate(textPartVampire));
filter.add(Predicates.not(new TappedPredicate()));
this.addAbility(new KickerAbility(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true))));
// Target opponent loses half his or her life, rounded up.

View file

@ -0,0 +1,230 @@
/*
* 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.cards.n;
import java.util.LinkedHashSet;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.text.TextPartSubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.TextPartSubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class NewBlood extends CardImpl {
public NewBlood(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{B}");
TextPartSubType textPartVampire = (TextPartSubType) addTextPart(new TextPartSubType(SubType.VAMPIRE));
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("an untapped Vampire you control");
filter.add(new TextPartSubtypePredicate(textPartVampire));
filter.add(Predicates.not(new TappedPredicate()));
// As an additional cost to cast New Blood, tap an untapped Vampire you control.
this.getSpellAbility().addCost(new TapTargetCost(
new TargetControlledCreaturePermanent(1, 1, filter, true)));
// Gain control of target creature. Change the text of that creature by replacing all instances of one creature type with Vampire.
getSpellAbility().addEffect(new NewBloodEffect());
getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public NewBlood(final NewBlood card) {
super(card);
}
@Override
public NewBlood copy() {
return new NewBlood(this);
}
}
class NewBloodEffect extends OneShotEffect {
public NewBloodEffect() {
super(Outcome.Benefit);
this.staticText = "Gain control of target creature. Change the text of that creature by replacing all instances of one creature type with Vampire";
}
public NewBloodEffect(final NewBloodEffect effect) {
super(effect);
}
@Override
public NewBloodEffect copy() {
return new NewBloodEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true);
effect.setTargetPointer(new FixedTarget(targetPermanent, game));
game.addEffect(effect, source);
effect = new ChangeCreatureTypeTargetEffect(null, SubType.VAMPIRE, Duration.Custom);
effect.setTargetPointer(new FixedTarget(targetPermanent, game));
game.addEffect(effect, source);
return true;
}
return false;
}
}
class ChangeCreatureTypeTargetEffect extends ContinuousEffectImpl {
private SubType fromSubType;
private SubType toSubType;
public ChangeCreatureTypeTargetEffect(SubType fromSubType, SubType toSubType, Duration duration) {
super(duration, Layer.TextChangingEffects_3, SubLayer.NA, Outcome.Benefit);
this.fromSubType = fromSubType;
this.toSubType = toSubType;
}
public ChangeCreatureTypeTargetEffect(final ChangeCreatureTypeTargetEffect effect) {
super(effect);
this.fromSubType = effect.fromSubType;
this.toSubType = effect.toSubType;
}
@Override
public void init(Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return;
}
if (fromSubType == null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose creature type to change to Vampire");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toCollection(LinkedHashSet::new)));
while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) {
return;
}
}
if (typeChoice.getChoice() == null) {
return;
}
fromSubType = SubType.byDescription(typeChoice.getChoice());
if (!game.isSimulation()) {
game.informPlayers(controller.getLogName() + " has chosen the creature type: " + fromSubType.toString());
}
}
super.init(source, game); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
if (fromSubType != null) {
boolean objectFound = false;
for (UUID targetId : targetPointer.getTargets(game, source)) {
MageObject targetObject = game.getObject(targetId);
if (targetObject != null) {
objectFound = true;
switch (layer) {
case TextChangingEffects_3:
targetObject.changeSubType(fromSubType, toSubType);
break;
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (targetObject.getSubtype(game).contains(fromSubType)) {
targetObject.getSubtype(game).remove(fromSubType);
if (!targetObject.getSubtype(game).contains(toSubType)) {
targetObject.getSubtype(game).add(toSubType);
}
}
break;
}
}
}
if (!objectFound && this.getDuration() == Duration.Custom) {
this.discard();
}
}
return true;
} else {
throw new UnsupportedOperationException("No subtype to change set");
}
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.TextChangingEffects_3
|| layer == Layer.TypeChangingEffects_4;
}
@Override
public ChangeCreatureTypeTargetEffect copy() {
return new ChangeCreatureTypeTargetEffect(this);
}
@Override
public String getText(Mode mode) {
return "Change the text of that creature by replacing all instances of one creature type with Vampire";
}
}

View file

@ -222,6 +222,7 @@ public class Commander2017 extends ExpansionSet {
cards.add(new SetCardInfo("Nazahn, Revered Bladesmith", 44, Rarity.MYTHIC, mage.cards.n.NazahnReveredBladesmith.class));
cards.add(new SetCardInfo("Necromantic Selection", 117, Rarity.RARE, mage.cards.n.NecromanticSelection.class));
cards.add(new SetCardInfo("Nevinyrral's Disk", 217, Rarity.RARE, mage.cards.n.NevinyrralsDisk.class));
cards.add(new SetCardInfo("New Blood", 19, Rarity.RARE, mage.cards.n.NewBlood.class));
cards.add(new SetCardInfo("Nihil Spellbomb", 218, Rarity.COMMON, mage.cards.n.NihilSpellbomb.class));
cards.add(new SetCardInfo("Nin, the Pain Artist", 183, Rarity.RARE, mage.cards.n.NinThePainArtist.class));
cards.add(new SetCardInfo("Nissa's Pilgrimage", 155, Rarity.COMMON, mage.cards.n.NissasPilgrimage.class));

View file

@ -1,10 +1,15 @@
package mage;
import java.io.Serializable;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.keyword.ChangelingAbility;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.CardType;
@ -14,10 +19,6 @@ import mage.game.Game;
import mage.game.events.ZoneChangeEvent;
import mage.util.SubTypeList;
import java.io.Serializable;
import java.util.EnumSet;
import java.util.UUID;
public interface MageObject extends MageItem, Serializable {
String getName();
@ -58,7 +59,6 @@ public interface MageObject extends MageItem, Serializable {
int getStartingLoyalty();
void adjustCosts(Ability ability, Game game);
void adjustTargets(Ability ability, Game game);
@ -85,7 +85,6 @@ public interface MageObject extends MageItem, Serializable {
void setZoneChangeCounter(int value, Game game);
default boolean isCreature() {
return getCardType().contains(CardType.CREATURE);
}
@ -163,7 +162,6 @@ public interface MageObject extends MageItem, Serializable {
return false;
}
default boolean shareSubtypes(Card otherCard, Game game) {
if (otherCard == null) {
@ -191,7 +189,15 @@ public interface MageObject extends MageItem, Serializable {
void setIsAllCreatureTypes(boolean value);
default void addCardTypes(EnumSet<CardType> cardType){
default void addCardTypes(EnumSet<CardType> cardType) {
getCardType().addAll(cardType);
}
List<TextPart> getTextParts();
TextPart addTextPart(TextPart textPart);
default void changeSubType(SubType fromSubType, SubType toSubType) {
}
}

View file

@ -27,6 +27,10 @@
*/
package mage;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
@ -36,6 +40,8 @@ import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.ChangelingAbility;
import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.abilities.text.TextPart;
import mage.abilities.text.TextPartSubType;
import mage.cards.FrameStyle;
import mage.constants.CardType;
import mage.constants.SubType;
@ -46,10 +52,6 @@ import mage.game.events.ZoneChangeEvent;
import mage.util.GameLog;
import mage.util.SubTypeList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
public abstract class MageObjectImpl implements MageObject {
protected UUID objectId;
@ -68,6 +70,7 @@ public abstract class MageObjectImpl implements MageObject {
protected MageInt power;
protected MageInt toughness;
protected boolean copy;
protected List<TextPart> textParts;
public MageObjectImpl() {
this(UUID.randomUUID());
@ -82,6 +85,7 @@ public abstract class MageObjectImpl implements MageObject {
frameStyle = FrameStyle.M15_NORMAL;
manaCost = new ManaCostsImpl<>("");
abilities = new AbilitiesImpl<>();
textParts = new ArrayList<>();
}
public MageObjectImpl(final MageObjectImpl object) {
@ -99,6 +103,8 @@ public abstract class MageObjectImpl implements MageObject {
this.subtype.addAll(object.subtype);
supertype.addAll(object.supertype);
this.copy = object.copy;
textParts = new ArrayList<>();
textParts.addAll(object.textParts);
}
@Override
@ -303,13 +309,33 @@ public abstract class MageObjectImpl implements MageObject {
}
@Override
public boolean isAllCreatureTypes(){
public boolean isAllCreatureTypes() {
return isAllCreatureTypes;
}
@Override
public void setIsAllCreatureTypes(boolean value){
public void setIsAllCreatureTypes(boolean value) {
isAllCreatureTypes = value;
}
@Override
public List<TextPart> getTextParts() {
return textParts;
}
@Override
public TextPart addTextPart(TextPart textPart) {
textParts.add(textPart);
return textPart;
}
@Override
public void changeSubType(SubType fromSubType, SubType toSubType) {
for (TextPart textPart : textParts) {
if (textPart instanceof TextPartSubType && textPart.getCurrentValue().equals(fromSubType)) {
textPart.replaceWith(toSubType);
}
}
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.abilities.text;
import java.io.Serializable;
import java.util.UUID;
import mage.util.Copyable;
/**
*
* @author LevelX2
* @param <E>
*/
public interface TextPart<E> extends Serializable, Copyable<TextPart> {
UUID getId();
String getText();
E getBaseValue();
E getCurrentValue();
void replaceWith(E o);
void reset();
}

View file

@ -0,0 +1,90 @@
/*
* 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.abilities.text;
import mage.ObjectColor;
/**
*
* This implementation is not finished yet. There is no support to also change
* the rules text of an object.
*
* @author LevelX2
*/
public class TextPartColor extends TextPartImpl<ObjectColor> {
private final ObjectColor objectColorBase;
private ObjectColor objectColorCurrent;
public TextPartColor(ObjectColor objectColor) {
this.objectColorBase = objectColor;
this.objectColorCurrent = objectColor;
}
public TextPartColor(final TextPartColor textPartColor) {
super();
this.objectColorBase = textPartColor.objectColorBase;
this.objectColorCurrent = textPartColor.objectColorCurrent;
}
@Override
public String getText() {
return objectColorCurrent.getDescription();
}
@Override
public ObjectColor getCurrentValue() {
return objectColorCurrent;
}
@Override
public ObjectColor getBaseValue() {
return objectColorBase;
}
@Override
public void replaceWith(ObjectColor objectColor) {
this.objectColorCurrent = objectColor;
}
@Override
public void reset() {
this.objectColorCurrent = this.objectColorBase;
}
@Override
public TextPartColor copy() {
return new TextPartColor(this);
}
@Override
public String toString() {
return objectColorCurrent.toString();
}
}

View file

@ -0,0 +1,32 @@
/*
* 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.text;
import java.util.UUID;
/**
*
* @author LevelX2
* @param <E>
*/
public abstract class TextPartImpl<E> implements TextPart<E> {
private final UUID id;
public TextPartImpl() {
this.id = UUID.randomUUID();
}
public TextPartImpl(final TextPartImpl textPartimpl) {
this.id = textPartimpl.id;
}
@Override
public UUID getId() {
return id;
}
}

View file

@ -0,0 +1,90 @@
/*
* 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.abilities.text;
import mage.constants.SubType;
/**
* This implementation is not finished yet. There is no support to also change
* the rules text of an object. Also all the cards that user subtypes in the
* text have to be updated with the new elements.
*
* @author LevelX2
*/
public class TextPartSubType extends TextPartImpl<SubType> {
private final SubType subTypeBase;
private SubType subTypeCurrent;
public TextPartSubType(SubType subType) {
this.subTypeBase = subType;
this.subTypeCurrent = subType;
}
public TextPartSubType(final TextPartSubType textPartSubType) {
super();
this.subTypeBase = textPartSubType.subTypeBase;
this.subTypeCurrent = textPartSubType.subTypeCurrent;
}
@Override
public String getText() {
return subTypeCurrent.getDescription();
}
@Override
public SubType getCurrentValue() {
return subTypeCurrent;
}
@Override
public SubType getBaseValue() {
return subTypeBase;
}
@Override
public void replaceWith(SubType subType) {
this.subTypeCurrent = subType;
}
@Override
public void reset() {
this.subTypeCurrent = this.subTypeBase;
}
@Override
public TextPartSubType copy() {
return new TextPartSubType(this);
}
@Override
public String toString() {
return subTypeCurrent.toString();
}
}

View file

@ -58,7 +58,7 @@ public enum CardRepository {
// raise this if db structure was changed
private static final long CARD_DB_VERSION = 51;
// raise this if new cards were added to the server
private static final long CARD_CONTENT_VERSION = 89;
private static final long CARD_CONTENT_VERSION = 90;
private Dao<CardInfo, Object> cardDao;
private Set<String> classNames;

View file

@ -27,11 +27,14 @@
*/
package mage.designations;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.effects.common.BecomesMonarchTargetEffect;
import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.abilities.text.TextPart;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
@ -40,8 +43,6 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author LevelX2
@ -73,6 +74,16 @@ public class Monarch extends Designation {
public void setIsAllCreatureTypes(boolean value) {
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
// At the beginning of the monarchs end step, that player draws a card
@ -159,5 +170,4 @@ class MonarchDealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility
return "Whenever a creature deals combat damage to the monarch, its controller becomes the monarch.";
}
}

View file

@ -0,0 +1,34 @@
/*
* 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.filter.predicate.mageobject;
import mage.MageObject;
import mage.abilities.text.TextPartSubType;
import mage.filter.predicate.Predicate;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public class TextPartSubtypePredicate implements Predicate<MageObject> {
private final TextPartSubType textPartSubtype;
public TextPartSubtypePredicate(TextPartSubType textPartSubtype) {
this.textPartSubtype = textPartSubtype;
}
@Override
public boolean apply(MageObject input, Game game) {
return input.hasSubtype(textPartSubtype.getCurrentValue(), game);
}
@Override
public String toString() {
return "Subtype(" + textPartSubtype.getCurrentValue() + ')';
}
}

View file

@ -27,6 +27,9 @@
*/
package mage.game.command;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Abilities;
@ -36,6 +39,7 @@ import mage.abilities.SpellAbility;
import mage.abilities.common.CastCommanderAbility;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.CardType;
@ -46,9 +50,6 @@ import mage.game.events.ZoneChangeEvent;
import mage.util.GameLog;
import mage.util.SubTypeList;
import java.util.EnumSet;
import java.util.UUID;
public class Commander implements CommandObject {
private final Card sourceObject;
@ -229,7 +230,23 @@ public class Commander implements CommandObject {
sourceObject.setZoneChangeCounter(value, game);
}
public boolean isAllCreatureTypes() { return false;}
@Override
public boolean isAllCreatureTypes() {
return false;
}
@Override
public void setIsAllCreatureTypes(boolean value) {
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public void setIsAllCreatureTypes(boolean value){}
}

View file

@ -27,6 +27,10 @@
*/
package mage.game.command;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.ObjectColor;
@ -36,6 +40,7 @@ import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.CardType;
@ -46,18 +51,13 @@ import mage.game.events.ZoneChangeEvent;
import mage.util.GameLog;
import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/**
* @author nantuko
*/
public class Emblem implements CommandObject {
private static EnumSet<CardType> emptySet = EnumSet.noneOf(CardType.class);
private static List emptyList = new ArrayList();
private static List emptyList = new ArrayList();
private static ObjectColor emptyColor = new ObjectColor();
private static ManaCosts emptyCost = new ManaCostsImpl();
@ -268,8 +268,21 @@ public class Emblem implements CommandObject {
throw new UnsupportedOperationException("Unsupported operation");
}
public boolean isAllCreatureTypes(){ return false;}
public boolean isAllCreatureTypes() {
return false;
}
public void setIsAllCreatureTypes(boolean value){}
public void setIsAllCreatureTypes(boolean value) {
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View file

@ -27,6 +27,7 @@
*/
package mage.game.permanent;
import java.util.*;
import mage.MageObject;
import mage.MageObjectReference;
import mage.ObjectColor;
@ -36,6 +37,7 @@ import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.keyword.*;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.*;
@ -55,8 +57,6 @@ import mage.players.Player;
import mage.util.GameLog;
import mage.util.ThreadLocalStringBuilder;
import java.util.*;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -204,6 +204,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.minBlockedBy = 1;
this.maxBlockedBy = 0;
this.copy = false;
for (TextPart textPart : textParts) {
textPart.reset();
}
}
@Override
@ -1210,7 +1213,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public boolean imprint(UUID imprintedCard, Game game) {
if (!game.getExile().containsId(imprintedCard, game)){
if (!game.getExile().containsId(imprintedCard, game)) {
return false;
}
if (connectedCards.containsKey("imprint")) {

View file

@ -45,6 +45,7 @@ import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.keyword.BestowAbility;
import mage.abilities.keyword.MorphAbility;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.CardsImpl;
import mage.cards.FrameStyle;
@ -927,10 +928,23 @@ public class Spell extends StackObjImpl implements Card {
return copy;
}
@Override
public boolean isAllCreatureTypes() {
return false;
}
@Override
public void setIsAllCreatureTypes(boolean value) {
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View file

@ -27,6 +27,10 @@
*/
package mage.game.stack;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.ObjectColor;
@ -39,6 +43,7 @@ import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.*;
@ -52,11 +57,6 @@ import mage.util.GameLog;
import mage.util.SubTypeList;
import mage.watchers.Watcher;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
@ -593,9 +593,23 @@ public class StackAbility extends StackObjImpl implements Ability {
return newStackAbility;
}
public boolean isAllCreatureTypes(){
@Override
public boolean isAllCreatureTypes() {
return false;
}
public void setIsAllCreatureTypes(boolean value){}
@Override
public void setIsAllCreatureTypes(boolean value) {
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}