mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 12:22:10 -08:00
* Improved handling of enlarged images. Added mode to show other side of flip and transform cards. Added icon for copied cards and possibility to show enlarged original or copied card.
This commit is contained in:
parent
0babf49392
commit
59d907c981
24 changed files with 490 additions and 233 deletions
|
|
@ -28,7 +28,9 @@
|
|||
|
||||
package mage;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -36,12 +38,9 @@ import mage.abilities.costs.mana.ManaCost;
|
|||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.keyword.ChangelingAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements MageObject {
|
||||
|
||||
protected UUID objectId;
|
||||
|
|
@ -49,9 +48,9 @@ public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements Mag
|
|||
protected String name;
|
||||
protected ManaCosts<ManaCost> manaCost;
|
||||
protected ObjectColor color;
|
||||
protected List<CardType> cardType = new ArrayList<CardType>();
|
||||
protected List<String> subtype = new ArrayList<String>();
|
||||
protected List<String> supertype = new ArrayList<String>();
|
||||
protected List<CardType> cardType = new ArrayList<>();
|
||||
protected List<String> subtype = new ArrayList<>();
|
||||
protected List<String> supertype = new ArrayList<>();
|
||||
protected Abilities<Ability> abilities;
|
||||
protected String text;
|
||||
protected MageInt power;
|
||||
|
|
@ -70,8 +69,8 @@ public abstract class MageObjectImpl<T extends MageObjectImpl<T>> implements Mag
|
|||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
color = new ObjectColor();
|
||||
manaCost = new ManaCostsImpl<ManaCost>("");
|
||||
abilities = new AbilitiesImpl<Ability>();
|
||||
manaCost = new ManaCostsImpl<>("");
|
||||
abilities = new AbilitiesImpl<>();
|
||||
}
|
||||
|
||||
public MageObjectImpl(final MageObjectImpl<T> object) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.cards.Card;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
|
||||
/**
|
||||
|
|
@ -73,7 +72,6 @@ public class CopyEffect extends ContinuousEffectImpl<CopyEffect> {
|
|||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
permanent.setName(target.getName());
|
||||
permanent.getColor().setColor(target.getColor());
|
||||
permanent.getManaCost().clear();
|
||||
|
|
@ -97,9 +95,13 @@ public class CopyEffect extends ContinuousEffectImpl<CopyEffect> {
|
|||
permanent.getPower().setValue(target.getPower().getValue());
|
||||
permanent.getToughness().setValue(target.getToughness().getValue());
|
||||
if (target instanceof Permanent) {
|
||||
permanent.setTransformed(((Permanent)target).isTransformed());
|
||||
permanent.setSecondCardFace(((Permanent) target).getSecondCardFace());
|
||||
Permanent targetPermanent = (Permanent) target;
|
||||
permanent.setTransformed(targetPermanent.isTransformed());
|
||||
permanent.setSecondCardFace(targetPermanent.getSecondCardFace());
|
||||
permanent.setFlipCard(targetPermanent.isFlipCard());
|
||||
permanent.setFlipCardName(targetPermanent.getFlipCardName());
|
||||
}
|
||||
|
||||
// to get the image of the copied permanent copy number und expansionCode
|
||||
if (target instanceof PermanentCard) {
|
||||
permanent.setCardNumber(((PermanentCard) target).getCard().getCardNumber());
|
||||
|
|
|
|||
|
|
@ -2,7 +2,11 @@ package mage.abilities.effects.common;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ public interface Card extends MageObject {
|
|||
boolean isFaceDown();
|
||||
boolean isFlipCard();
|
||||
String getFlipCardName();
|
||||
void setFlipCard(boolean flipCard);
|
||||
void setFlipCardName(String flipCardName);
|
||||
boolean isSplitCard();
|
||||
|
||||
boolean canTransform();
|
||||
|
|
|
|||
|
|
@ -55,7 +55,10 @@ import mage.constants.TimingRule;
|
|||
import static mage.constants.Zone.EXILED;
|
||||
import mage.game.command.Commander;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T> implements Card {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
@ -63,7 +66,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
|
||||
protected UUID ownerId;
|
||||
protected int cardNumber;
|
||||
protected List<Watcher> watchers = new ArrayList<Watcher>();
|
||||
protected List<Watcher> watchers = new ArrayList<>();
|
||||
protected String expansionSetCode;
|
||||
protected String tokenSetCode;
|
||||
protected Rarity rarity;
|
||||
|
|
@ -127,7 +130,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
expansionSetCode = card.expansionSetCode;
|
||||
rarity = card.rarity;
|
||||
for (Watcher watcher: (List<Watcher>)card.watchers) {
|
||||
this.watchers.add(watcher.copy());
|
||||
watchers.add(watcher.copy());
|
||||
}
|
||||
faceDown = card.faceDown;
|
||||
|
||||
|
|
@ -138,14 +141,14 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
}
|
||||
zoneChangeCounter = card.zoneChangeCounter;
|
||||
if (card.info != null) {
|
||||
info = new HashMap<String, String>();
|
||||
info = new HashMap<>();
|
||||
info.putAll(card.info);
|
||||
}
|
||||
this.flipCard = card.flipCard;
|
||||
this.flipCardName = card.flipCardName;
|
||||
this.splitCard = card.splitCard;
|
||||
this.usesVariousArt = card.usesVariousArt;
|
||||
this.counters = card.counters.copy();
|
||||
flipCard = card.flipCard;
|
||||
flipCardName = card.flipCardName;
|
||||
splitCard = card.splitCard;
|
||||
usesVariousArt = card.usesVariousArt;
|
||||
counters = card.counters.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -210,7 +213,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
System.out.println("Exception in rules generation for card: " + this.getName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
ArrayList<String> rules = new ArrayList<String>();
|
||||
ArrayList<String> rules = new ArrayList<>();
|
||||
rules.add("Exception occured in rules generation");
|
||||
return rules;
|
||||
}
|
||||
|
|
@ -562,15 +565,27 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
return flipCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlipCardName() {
|
||||
return flipCardName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlipCard(boolean flipCard) {
|
||||
this.flipCard = flipCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlipCardName(String flipCardName) {
|
||||
this.flipCardName = flipCardName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSplitCard() {
|
||||
return splitCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlipCardName() {
|
||||
return flipCardName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZoneChangeCounter() {
|
||||
|
|
|
|||
11
Mage/src/mage/constants/EnlargeMode.java
Normal file
11
Mage/src/mage/constants/EnlargeMode.java
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package mage.constants;
|
||||
|
||||
/**
|
||||
* Controlls the display handling of the enlarged image of the card / permanent
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public enum EnlargeMode {
|
||||
|
||||
NORMAL, ALTERNATE, COPY
|
||||
}
|
||||
|
|
@ -78,11 +78,9 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
|
|||
|
||||
@Override
|
||||
public void reset(Game game) {
|
||||
// when the permanent is reset copy all original values from the card
|
||||
// when the permanent is reset, copy all original values from the card
|
||||
// must copy card each reset so that the original values don't get modified
|
||||
// game.getState().getContinuousEffects().removeGainedEffectsForSource(objectId);
|
||||
// game.getState().resetTriggersForSourceId(this.getId());
|
||||
copyFromCard(card, game);
|
||||
copyFromCard(card);
|
||||
super.reset(game);
|
||||
}
|
||||
|
||||
|
|
@ -98,16 +96,6 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
|
|||
this.manaCost = card.getManaCost().copy();
|
||||
this.power = card.getPower().copy();
|
||||
this.toughness = card.getToughness().copy();
|
||||
/*if (card instanceof LevelerCard) {
|
||||
LevelAbility level = ((LevelerCard) card).getLevel(this.getCounters().getCount(CounterType.LEVEL));
|
||||
if (level != null) {
|
||||
this.power.setValue(level.getPower());
|
||||
this.toughness.setValue(level.getToughness());
|
||||
for (Ability ability : level.getAbilities()) {
|
||||
this.addAbility(ability);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (card instanceof PermanentCard) {
|
||||
this.maxLevelCounters = ((PermanentCard) card).maxLevelCounters;
|
||||
}
|
||||
|
|
@ -125,46 +113,8 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
|
|||
secondSideCard = card.getSecondCardFace();
|
||||
nightCard = card.isNightCard();
|
||||
}
|
||||
}
|
||||
|
||||
protected void copyFromCard(Card card, Game game) {
|
||||
this.name = card.getName();
|
||||
// this.removeAllAbilities(objectId, game);
|
||||
this.abilities.clear();
|
||||
this.abilities.addAll(card.getAbilities());
|
||||
this.abilities.setControllerId(this.controllerId);
|
||||
this.cardType.clear();
|
||||
this.cardType.addAll(card.getCardType());
|
||||
this.color = card.getColor().copy();
|
||||
this.manaCost = card.getManaCost().copy();
|
||||
this.power = card.getPower().copy();
|
||||
this.toughness = card.getToughness().copy();
|
||||
/*if (card instanceof LevelerCard) {
|
||||
LevelAbility level = ((LevelerCard) card).getLevel(this.getCounters().getCount(CounterType.LEVEL));
|
||||
if (level != null) {
|
||||
this.power.setValue(level.getPower());
|
||||
this.toughness.setValue(level.getToughness());
|
||||
for (Ability ability : level.getAbilities()) {
|
||||
this.addAbility(ability, game);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (card instanceof PermanentCard) {
|
||||
this.maxLevelCounters = ((PermanentCard) card).maxLevelCounters;
|
||||
}
|
||||
this.subtype.clear();
|
||||
this.subtype.addAll(card.getSubtype());
|
||||
this.supertype.clear();
|
||||
this.supertype.addAll(card.getSupertype());
|
||||
this.expansionSetCode = card.getExpansionSetCode();
|
||||
this.rarity = card.getRarity();
|
||||
this.cardNumber = card.getCardNumber();
|
||||
|
||||
canTransform = card.canTransform();
|
||||
if (canTransform) {
|
||||
secondSideCard = card.getSecondCardFace();
|
||||
nightCard = card.isNightCard();
|
||||
}
|
||||
this.flipCard = card.isFlipCard();
|
||||
this.flipCardName = card.getFlipCardName();
|
||||
}
|
||||
|
||||
public Card getCard() {
|
||||
|
|
|
|||
|
|
@ -626,6 +626,17 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlipCard(boolean flipCard) {
|
||||
throw new UnsupportedOperationException("Not supported."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlipCardName(String flipCardName) {
|
||||
throw new UnsupportedOperationException("Not supported."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Spell copy() {
|
||||
return new Spell(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue