2016-10-06 04:26:58 -07:00
|
|
|
package magic.model;
|
2015-12-19 07:05:52 -08:00
|
|
|
|
|
|
|
import java.util.Collection;
|
2016-01-05 22:26:58 -08:00
|
|
|
import java.util.Collections;
|
2016-10-06 04:26:58 -07:00
|
|
|
import java.util.HashSet;
|
2016-01-05 22:26:58 -08:00
|
|
|
import java.util.List;
|
2015-12-19 07:05:52 -08:00
|
|
|
import java.util.Set;
|
|
|
|
import magic.model.event.MagicManaActivation;
|
|
|
|
|
|
|
|
public interface IRenderableCard {
|
|
|
|
|
|
|
|
Collection<MagicManaActivation> getManaActivations();
|
2015-12-24 16:50:31 -08:00
|
|
|
Set<MagicSubType> getSubTypes();
|
2015-12-19 07:05:52 -08:00
|
|
|
int getColorFlags();
|
|
|
|
String getPowerToughnessText();
|
|
|
|
String getName();
|
|
|
|
boolean hasSubType(MagicSubType subType);
|
|
|
|
boolean hasColor(MagicColor color);
|
|
|
|
boolean hasType(MagicType type);
|
|
|
|
boolean isToken();
|
|
|
|
boolean isFlipCard();
|
2016-01-31 07:06:24 -08:00
|
|
|
boolean isSplitCard();
|
2015-12-19 07:05:52 -08:00
|
|
|
boolean isDoubleFaced();
|
|
|
|
boolean hasAbility(MagicAbility ability);
|
2016-01-05 22:26:58 -08:00
|
|
|
MagicCardDefinition getCardDefinition();
|
|
|
|
|
|
|
|
default MagicCardDefinition getTransformedDefinition() {
|
|
|
|
return getCardDefinition().getTransformedDefinition();
|
|
|
|
}
|
|
|
|
|
2016-01-31 11:17:52 -08:00
|
|
|
default MagicCardDefinition getSplitDefinition() {
|
|
|
|
return getCardDefinition().getSplitDefinition();
|
|
|
|
}
|
|
|
|
|
2016-01-06 01:23:23 -08:00
|
|
|
default int getStartingLoyalty() {
|
|
|
|
return getCardDefinition().getStartingLoyalty();
|
|
|
|
}
|
|
|
|
|
|
|
|
default boolean isMulti() {
|
|
|
|
return getNumColors() > 1;
|
2016-01-05 22:26:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
default boolean isHybrid() {
|
2016-10-06 04:00:24 -07:00
|
|
|
final List<MagicCostManaType> list = getCost().getCostManaTypes(0);
|
2016-01-05 22:26:58 -08:00
|
|
|
//If doesn't contain single color mana, and does contain hybrid mana. Checks for absence
|
2016-10-06 04:00:24 -07:00
|
|
|
return Collections.disjoint(list, MagicCostManaType.MONO) && !Collections.disjoint(list, MagicCostManaType.HYBRID);
|
2016-01-05 22:26:58 -08:00
|
|
|
}
|
|
|
|
|
2016-02-17 18:03:15 -08:00
|
|
|
default boolean isPlaneswalker() {
|
|
|
|
return hasType(MagicType.Planeswalker);
|
|
|
|
}
|
|
|
|
|
2018-04-05 05:21:52 -07:00
|
|
|
default boolean isLegendary() {
|
|
|
|
return hasType(MagicType.Legendary);
|
|
|
|
}
|
|
|
|
|
2016-01-06 01:23:23 -08:00
|
|
|
default boolean isLand() {
|
|
|
|
return hasType(MagicType.Land);
|
2016-01-05 22:26:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
default boolean isCreature() {
|
|
|
|
return hasType(MagicType.Creature);
|
|
|
|
}
|
|
|
|
|
|
|
|
default boolean isArtifact() {
|
|
|
|
return hasType(MagicType.Artifact);
|
|
|
|
}
|
|
|
|
|
|
|
|
default boolean isEnchantment() {
|
|
|
|
return hasType(MagicType.Enchantment);
|
|
|
|
}
|
|
|
|
|
|
|
|
default boolean isInstant() {
|
|
|
|
return hasType(MagicType.Instant);
|
|
|
|
}
|
|
|
|
|
|
|
|
default boolean isSorcery() {
|
|
|
|
return hasType(MagicType.Sorcery);
|
|
|
|
}
|
|
|
|
|
2018-05-03 23:17:55 -07:00
|
|
|
default boolean isSaga() {
|
|
|
|
return isEnchantment() && hasSubType(MagicSubType.Saga);
|
|
|
|
}
|
|
|
|
|
2016-01-05 22:26:58 -08:00
|
|
|
default boolean isHidden() {
|
|
|
|
return getCardDefinition().isHidden();
|
|
|
|
}
|
|
|
|
|
2016-01-31 11:17:52 -08:00
|
|
|
default boolean isSecondHalf() {
|
|
|
|
return getCardDefinition().isSecondHalf();
|
|
|
|
}
|
|
|
|
|
2016-01-05 22:26:58 -08:00
|
|
|
default Character getRarityChar() {
|
|
|
|
return getCardDefinition().getRarityChar();
|
|
|
|
}
|
|
|
|
|
|
|
|
default boolean hasText() {
|
|
|
|
return getCardDefinition().hasText();
|
|
|
|
}
|
|
|
|
|
|
|
|
default int getNumColors() {
|
|
|
|
int numColors = 0;
|
|
|
|
for (final MagicColor color : MagicColor.values()) {
|
|
|
|
if (hasColor(color)) {
|
|
|
|
numColors++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return numColors;
|
|
|
|
}
|
|
|
|
|
|
|
|
default Set<MagicType> getTypes() {
|
2018-04-07 17:59:14 -07:00
|
|
|
Set<MagicType> types = new HashSet<>();
|
2016-01-05 22:26:58 -08:00
|
|
|
for (MagicType type : MagicType.values()) {
|
|
|
|
if (hasType(type)) {
|
|
|
|
types.add(type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return types;
|
|
|
|
}
|
|
|
|
|
|
|
|
default String getSubTypeText() {
|
|
|
|
// returning from CardDefinition, no in-game changes
|
2016-10-05 17:54:42 -07:00
|
|
|
return getCardDefinition().getSubTypeText();
|
2016-01-05 22:26:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
default String getImageName() {
|
|
|
|
return getCardDefinition().getImageName();
|
|
|
|
}
|
|
|
|
|
|
|
|
default String getText() {
|
|
|
|
// returns oracle text, no in-game changes
|
|
|
|
return getCardDefinition().getText();
|
|
|
|
}
|
|
|
|
|
|
|
|
default MagicManaCost getCost() {
|
|
|
|
// returning from CardDefinition, no in-game changes
|
|
|
|
return getCardDefinition().getCost();
|
|
|
|
}
|
2016-01-06 10:38:30 -08:00
|
|
|
|
|
|
|
default boolean hasOverlay() {
|
|
|
|
return hasAbility(MagicAbility.Devoid) || hasAbility(MagicAbility.Miracle);
|
|
|
|
}
|
2016-01-06 14:47:39 -08:00
|
|
|
|
|
|
|
default boolean hasTextOverlay() {
|
2016-01-09 07:48:06 -08:00
|
|
|
return hasAbility(MagicAbility.LevelUp) || isLand();
|
2016-01-06 14:47:39 -08:00
|
|
|
}
|
2016-10-05 23:12:38 -07:00
|
|
|
|
|
|
|
default long getRenderKey() {
|
|
|
|
return getCardDefinition().getDistinctName().hashCode();
|
|
|
|
}
|
2016-10-12 10:21:43 -07:00
|
|
|
|
|
|
|
default boolean isUnknown() {
|
|
|
|
return getCardDefinition() == MagicCardDefinition.UNKNOWN;
|
|
|
|
}
|
2016-10-12 10:37:34 -07:00
|
|
|
|
|
|
|
default String getImageUrl() {
|
|
|
|
return getCardDefinition().getImageURL();
|
|
|
|
}
|
2017-07-11 23:25:32 -07:00
|
|
|
|
|
|
|
default boolean isInvalid() {
|
|
|
|
return getCardDefinition().isInvalid();
|
|
|
|
}
|
2015-12-19 07:05:52 -08:00
|
|
|
}
|