foul-magics/Mage.Common/src/main/java/mage/view/EmblemView.java
Artemis Kearney 41874b0b4b
new feature: Emblem Cards (#10498)
* new feature: Emblem Cards

Allows match/tournament creator to specify cards to give each player
emblem versions of (or just the starting player for symmetric effects).

Technical details:
- new UI for specifying emblem cards (.dck files)
  - available for all match/tournament types
- new class `EmblemOfCard`
- new method `copyWithZone` on `AbilityImpl` (used to make abilities
  work from command zone)
- new fields on `GameOptions` and `MatchOptions` for emblem cards
- emblems are granted after mulligans, before first turn (technically
  after Planechase starting plane creation)

* fixes

* defaults for emblem cards in match options (fixes quick game buttons)

* minor fixes

* use DeckCardInfo instead of Card for emblem cards options

* restore accessible parent properties

* fix images for card emblems

* look up cards in a way that preserves which art

* fix typos; make Emblem.sourceObject protected

* add descriptions to planechase and emblem cards

* fixes

* add some unit tests for known working cards

* fix author name

* add explanation comment

* fix up tests

* copyWithZone: no longer modifies zone for singleton abilities

* directly check for MageSingleton
2023-09-26 22:47:13 -04:00

105 lines
2.3 KiB
Java

package mage.view;
import mage.game.command.Emblem;
import mage.game.command.emblems.EmblemOfCard;
import mage.players.PlayableObjectStats;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
/**
* @author noxx
*/
public class EmblemView implements CommandObjectView, Serializable {
protected UUID id;
protected String name;
protected String cardNumber = "";
protected int imageNum;
protected boolean usesVariousArt = false;
protected String expansionSetCode;
protected List<String> rules;
protected PlayableObjectStats playableStats = new PlayableObjectStats();
public EmblemView(Emblem emblem) {
this.id = emblem.getId();
this.name = emblem.getName();
this.imageNum = emblem.getImageNumber();
this.expansionSetCode = emblem.getExpansionSetCode();
this.rules = emblem.getAbilities().getRules(emblem.getName());
if (emblem instanceof EmblemOfCard) {
cardNumber = emblem.getCardNumber();
usesVariousArt = ((EmblemOfCard) emblem).getUsesVariousArt();
}
}
@Override
public String getExpansionSetCode() {
return expansionSetCode;
}
@Override
public String getName() {
return name;
}
@Override
public UUID getId() {
return id;
}
public String getCardNumber() {
return cardNumber;
}
@Override
public int getImageNumber() {
return imageNum;
}
public boolean getUsesVariousArt() {
return this.usesVariousArt;
}
@Override
public List<String> getRules() {
return rules;
}
@Override
public boolean isPlayable() {
return this.playableStats.getPlayableAmount() > 0;
}
@Override
public void setPlayableStats(PlayableObjectStats playableStats) {
this.playableStats = playableStats;
}
@Override
public PlayableObjectStats getPlayableStats() {
return this.playableStats;
}
@Override
public boolean isChoosable() {
// unsupported
return false;
}
@Override
public void setChoosable(boolean isChoosable) {
// unsupported
}
@Override
public boolean isSelected() {
// unsupported
return false;
}
@Override
public void setSelected(boolean isSelected) {
// unsupported
}
}