mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
Started to implement a solution for effects that change words in rule text.
This commit is contained in:
parent
e3f6a6b418
commit
66c69e51a3
14 changed files with 441 additions and 40 deletions
|
|
@ -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("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("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("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("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("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));
|
cards.add(new SetCardInfo("Nissa's Pilgrimage", 155, Rarity.COMMON, mage.cards.n.NissasPilgrimage.class));
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
package mage;
|
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.Abilities;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.mana.ManaCost;
|
import mage.abilities.costs.mana.ManaCost;
|
||||||
import mage.abilities.costs.mana.ManaCosts;
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
import mage.abilities.keyword.ChangelingAbility;
|
import mage.abilities.keyword.ChangelingAbility;
|
||||||
|
import mage.abilities.text.TextPart;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.FrameStyle;
|
import mage.cards.FrameStyle;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
|
@ -14,10 +19,6 @@ import mage.game.Game;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.util.SubTypeList;
|
import mage.util.SubTypeList;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public interface MageObject extends MageItem, Serializable {
|
public interface MageObject extends MageItem, Serializable {
|
||||||
|
|
||||||
String getName();
|
String getName();
|
||||||
|
|
@ -58,7 +59,6 @@ public interface MageObject extends MageItem, Serializable {
|
||||||
|
|
||||||
int getStartingLoyalty();
|
int getStartingLoyalty();
|
||||||
|
|
||||||
|
|
||||||
void adjustCosts(Ability ability, Game game);
|
void adjustCosts(Ability ability, Game game);
|
||||||
|
|
||||||
void adjustTargets(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);
|
void setZoneChangeCounter(int value, Game game);
|
||||||
|
|
||||||
|
|
||||||
default boolean isCreature() {
|
default boolean isCreature() {
|
||||||
return getCardType().contains(CardType.CREATURE);
|
return getCardType().contains(CardType.CREATURE);
|
||||||
}
|
}
|
||||||
|
|
@ -163,7 +162,6 @@ public interface MageObject extends MageItem, Serializable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
default boolean shareSubtypes(Card otherCard, Game game) {
|
default boolean shareSubtypes(Card otherCard, Game game) {
|
||||||
|
|
||||||
if (otherCard == null) {
|
if (otherCard == null) {
|
||||||
|
|
@ -191,7 +189,15 @@ public interface MageObject extends MageItem, Serializable {
|
||||||
|
|
||||||
void setIsAllCreatureTypes(boolean value);
|
void setIsAllCreatureTypes(boolean value);
|
||||||
|
|
||||||
default void addCardTypes(EnumSet<CardType> cardType){
|
default void addCardTypes(EnumSet<CardType> cardType) {
|
||||||
getCardType().addAll(cardType);
|
getCardType().addAll(cardType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<TextPart> getTextParts();
|
||||||
|
|
||||||
|
TextPart addTextPart(TextPart textPart);
|
||||||
|
|
||||||
|
default void changeSubType(SubType fromSubType, SubType toSubType) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,10 @@
|
||||||
*/
|
*/
|
||||||
package mage;
|
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.Abilities;
|
||||||
import mage.abilities.AbilitiesImpl;
|
import mage.abilities.AbilitiesImpl;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -36,6 +40,8 @@ import mage.abilities.costs.mana.ManaCosts;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.keyword.ChangelingAbility;
|
import mage.abilities.keyword.ChangelingAbility;
|
||||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||||
|
import mage.abilities.text.TextPart;
|
||||||
|
import mage.abilities.text.TextPartSubType;
|
||||||
import mage.cards.FrameStyle;
|
import mage.cards.FrameStyle;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
|
|
@ -46,10 +52,6 @@ import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.util.GameLog;
|
import mage.util.GameLog;
|
||||||
import mage.util.SubTypeList;
|
import mage.util.SubTypeList;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public abstract class MageObjectImpl implements MageObject {
|
public abstract class MageObjectImpl implements MageObject {
|
||||||
|
|
||||||
protected UUID objectId;
|
protected UUID objectId;
|
||||||
|
|
@ -68,6 +70,7 @@ public abstract class MageObjectImpl implements MageObject {
|
||||||
protected MageInt power;
|
protected MageInt power;
|
||||||
protected MageInt toughness;
|
protected MageInt toughness;
|
||||||
protected boolean copy;
|
protected boolean copy;
|
||||||
|
protected List<TextPart> textParts;
|
||||||
|
|
||||||
public MageObjectImpl() {
|
public MageObjectImpl() {
|
||||||
this(UUID.randomUUID());
|
this(UUID.randomUUID());
|
||||||
|
|
@ -82,6 +85,7 @@ public abstract class MageObjectImpl implements MageObject {
|
||||||
frameStyle = FrameStyle.M15_NORMAL;
|
frameStyle = FrameStyle.M15_NORMAL;
|
||||||
manaCost = new ManaCostsImpl<>("");
|
manaCost = new ManaCostsImpl<>("");
|
||||||
abilities = new AbilitiesImpl<>();
|
abilities = new AbilitiesImpl<>();
|
||||||
|
textParts = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MageObjectImpl(final MageObjectImpl object) {
|
public MageObjectImpl(final MageObjectImpl object) {
|
||||||
|
|
@ -99,6 +103,7 @@ public abstract class MageObjectImpl implements MageObject {
|
||||||
this.subtype.addAll(object.subtype);
|
this.subtype.addAll(object.subtype);
|
||||||
supertype.addAll(object.supertype);
|
supertype.addAll(object.supertype);
|
||||||
this.copy = object.copy;
|
this.copy = object.copy;
|
||||||
|
textParts = new ArrayList<>(object.textParts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -303,13 +308,33 @@ public abstract class MageObjectImpl implements MageObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAllCreatureTypes(){
|
public boolean isAllCreatureTypes() {
|
||||||
return isAllCreatureTypes;
|
return isAllCreatureTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsAllCreatureTypes(boolean value){
|
public void setIsAllCreatureTypes(boolean value) {
|
||||||
isAllCreatureTypes = 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
52
Mage/src/main/java/mage/abilities/text/TextPart.java
Normal file
52
Mage/src/main/java/mage/abilities/text/TextPart.java
Normal 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();
|
||||||
|
}
|
||||||
90
Mage/src/main/java/mage/abilities/text/TextPartColor.java
Normal file
90
Mage/src/main/java/mage/abilities/text/TextPartColor.java
Normal 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
32
Mage/src/main/java/mage/abilities/text/TextPartImpl.java
Normal file
32
Mage/src/main/java/mage/abilities/text/TextPartImpl.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
90
Mage/src/main/java/mage/abilities/text/TextPartSubType.java
Normal file
90
Mage/src/main/java/mage/abilities/text/TextPartSubType.java
Normal 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -27,11 +27,14 @@
|
||||||
*/
|
*/
|
||||||
package mage.designations;
|
package mage.designations;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||||
import mage.abilities.effects.common.BecomesMonarchTargetEffect;
|
import mage.abilities.effects.common.BecomesMonarchTargetEffect;
|
||||||
import mage.abilities.effects.common.DrawCardTargetEffect;
|
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||||
|
import mage.abilities.text.TextPart;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
@ -40,8 +43,6 @@ import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
|
|
@ -73,6 +74,16 @@ public class Monarch extends Designation {
|
||||||
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.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// At the beginning of the monarch’s end step, that player draws a card
|
// At the beginning of the monarch’s 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.";
|
return "Whenever a creature deals combat damage to the monarch, its controller becomes the monarch.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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() + ')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,6 +27,9 @@
|
||||||
*/
|
*/
|
||||||
package mage.game.command;
|
package mage.game.command;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Abilities;
|
import mage.abilities.Abilities;
|
||||||
|
|
@ -36,6 +39,7 @@ import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.CastCommanderAbility;
|
import mage.abilities.common.CastCommanderAbility;
|
||||||
import mage.abilities.costs.mana.ManaCost;
|
import mage.abilities.costs.mana.ManaCost;
|
||||||
import mage.abilities.costs.mana.ManaCosts;
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
|
import mage.abilities.text.TextPart;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.FrameStyle;
|
import mage.cards.FrameStyle;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
|
@ -46,9 +50,6 @@ import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.util.GameLog;
|
import mage.util.GameLog;
|
||||||
import mage.util.SubTypeList;
|
import mage.util.SubTypeList;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class Commander implements CommandObject {
|
public class Commander implements CommandObject {
|
||||||
|
|
||||||
private final Card sourceObject;
|
private final Card sourceObject;
|
||||||
|
|
@ -229,7 +230,23 @@ public class Commander implements CommandObject {
|
||||||
sourceObject.setZoneChangeCounter(value, game);
|
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){}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,10 @@
|
||||||
*/
|
*/
|
||||||
package mage.game.command;
|
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.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
|
|
@ -36,6 +40,7 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.mana.ManaCost;
|
import mage.abilities.costs.mana.ManaCost;
|
||||||
import mage.abilities.costs.mana.ManaCosts;
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.text.TextPart;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.FrameStyle;
|
import mage.cards.FrameStyle;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
|
@ -46,11 +51,6 @@ import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.util.GameLog;
|
import mage.util.GameLog;
|
||||||
import mage.util.SubTypeList;
|
import mage.util.SubTypeList;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
|
|
@ -268,8 +268,21 @@ public class Emblem implements CommandObject {
|
||||||
throw new UnsupportedOperationException("Unsupported operation");
|
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.
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.game.permanent;
|
package mage.game.permanent;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
|
|
@ -36,6 +37,7 @@ import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
import mage.abilities.effects.RestrictionEffect;
|
||||||
import mage.abilities.keyword.*;
|
import mage.abilities.keyword.*;
|
||||||
|
import mage.abilities.text.TextPart;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
|
|
@ -55,8 +57,6 @@ import mage.players.Player;
|
||||||
import mage.util.GameLog;
|
import mage.util.GameLog;
|
||||||
import mage.util.ThreadLocalStringBuilder;
|
import mage.util.ThreadLocalStringBuilder;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
|
@ -204,6 +204,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
this.minBlockedBy = 1;
|
this.minBlockedBy = 1;
|
||||||
this.maxBlockedBy = 0;
|
this.maxBlockedBy = 0;
|
||||||
this.copy = false;
|
this.copy = false;
|
||||||
|
for (TextPart textPart : textParts) {
|
||||||
|
textPart.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -1210,7 +1213,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean imprint(UUID imprintedCard, Game game) {
|
public boolean imprint(UUID imprintedCard, Game game) {
|
||||||
if (!game.getExile().containsId(imprintedCard, game)){
|
if (!game.getExile().containsId(imprintedCard, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (connectedCards.containsKey("imprint")) {
|
if (connectedCards.containsKey("imprint")) {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ import mage.abilities.costs.mana.ManaCost;
|
||||||
import mage.abilities.costs.mana.ManaCosts;
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
import mage.abilities.keyword.BestowAbility;
|
import mage.abilities.keyword.BestowAbility;
|
||||||
import mage.abilities.keyword.MorphAbility;
|
import mage.abilities.keyword.MorphAbility;
|
||||||
|
import mage.abilities.text.TextPart;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
import mage.cards.FrameStyle;
|
import mage.cards.FrameStyle;
|
||||||
|
|
@ -927,10 +928,23 @@ public class Spell extends StackObjImpl implements Card {
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAllCreatureTypes() {
|
public boolean isAllCreatureTypes() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
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.
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,10 @@
|
||||||
*/
|
*/
|
||||||
package mage.game.stack;
|
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.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
|
|
@ -39,6 +43,7 @@ import mage.abilities.costs.mana.ManaCosts;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.Effects;
|
import mage.abilities.effects.Effects;
|
||||||
|
import mage.abilities.text.TextPart;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.FrameStyle;
|
import mage.cards.FrameStyle;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
|
|
@ -52,11 +57,6 @@ import mage.util.GameLog;
|
||||||
import mage.util.SubTypeList;
|
import mage.util.SubTypeList;
|
||||||
import mage.watchers.Watcher;
|
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
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -593,9 +593,23 @@ public class StackAbility extends StackObjImpl implements Ability {
|
||||||
return newStackAbility;
|
return newStackAbility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllCreatureTypes(){
|
@Override
|
||||||
|
public boolean isAllCreatureTypes() {
|
||||||
return false;
|
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.
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue