mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
CardType: add flag to show when its used incomplete in Animate Effects
This commit is contained in:
@@ -251,7 +251,7 @@ public class AnimateAi extends SpellAbilityAi {
|
|||||||
&& sa.getTargetRestrictions() != null
|
&& sa.getTargetRestrictions() != null
|
||||||
&& sa.getTargetRestrictions().getMinTargets(sa.getHostCard(), sa) == 0;
|
&& sa.getTargetRestrictions().getMinTargets(sa.getHostCard(), sa) == 0;
|
||||||
|
|
||||||
final CardType types = new CardType();
|
final CardType types = new CardType(true);
|
||||||
if (sa.hasParam("Types")) {
|
if (sa.hasParam("Types")) {
|
||||||
types.addAll(Arrays.asList(sa.getParam("Types").split(",")));
|
types.addAll(Arrays.asList(sa.getParam("Types").split(",")));
|
||||||
}
|
}
|
||||||
@@ -383,12 +383,12 @@ public class AnimateAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final CardType types = new CardType();
|
final CardType types = new CardType(true);
|
||||||
if (sa.hasParam("Types")) {
|
if (sa.hasParam("Types")) {
|
||||||
types.addAll(Arrays.asList(sa.getParam("Types").split(",")));
|
types.addAll(Arrays.asList(sa.getParam("Types").split(",")));
|
||||||
}
|
}
|
||||||
|
|
||||||
final CardType removeTypes = new CardType();
|
final CardType removeTypes = new CardType(true);
|
||||||
if (sa.hasParam("RemoveTypes")) {
|
if (sa.hasParam("RemoveTypes")) {
|
||||||
removeTypes.addAll(Arrays.asList(sa.getParam("RemoveTypes").split(",")));
|
removeTypes.addAll(Arrays.asList(sa.getParam("RemoveTypes").split(",")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
if ("T".equals(key)) {
|
if ("T".equals(key)) {
|
||||||
this.faces[this.curFace].addTrigger(value);
|
this.faces[this.curFace].addTrigger(value);
|
||||||
} else if ("Types".equals(key)) {
|
} else if ("Types".equals(key)) {
|
||||||
this.faces[this.curFace].setType(CardType.parse(value));
|
this.faces[this.curFace].setType(CardType.parse(value, false));
|
||||||
} else if ("Text".equals(key) && !"no text".equals(value) && StringUtils.isNotBlank(value)) {
|
} else if ("Text".equals(key) && !"no text".equals(value) && StringUtils.isNotBlank(value)) {
|
||||||
this.faces[this.curFace].setNonAbilityText(value);
|
this.faces[this.curFace].setNonAbilityText(value);
|
||||||
}
|
}
|
||||||
@@ -557,7 +557,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
CardAiHints cah = new CardAiHints(true, true, true, null, null, null);
|
CardAiHints cah = new CardAiHints(true, true, true, null, null, null);
|
||||||
CardFace[] faces = { new CardFace(name), null};
|
CardFace[] faces = { new CardFace(name), null};
|
||||||
faces[0].setColor(ColorSet.fromMask(0));
|
faces[0].setColor(ColorSet.fromMask(0));
|
||||||
faces[0].setType(CardType.parse(""));
|
faces[0].setType(CardType.parse("", false));
|
||||||
faces[0].setOracleText("This card is not supported by Forge. Whenever you start a game with this card, it will be bugged.");
|
faces[0].setOracleText("This card is not supported by Forge. Whenever you start a game with this card, it will be bugged.");
|
||||||
faces[0].setNonAbilityText("This card is not supported by Forge.\nWhenever you start a game with this card, it will be bugged.");
|
faces[0].setNonAbilityText("This card is not supported by Forge.\nWhenever you start a game with this card, it will be bugged.");
|
||||||
faces[0].assignMissingFields();
|
faces[0].assignMissingFields();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import forge.util.Settable;
|
|||||||
public final class CardType implements Comparable<CardType>, CardTypeView {
|
public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||||
private static final long serialVersionUID = 4629853583167022151L;
|
private static final long serialVersionUID = 4629853583167022151L;
|
||||||
|
|
||||||
public static final CardTypeView EMPTY = new CardType();
|
public static final CardTypeView EMPTY = new CardType(false);
|
||||||
|
|
||||||
public static final String AllCreatureTypes = "AllCreatureTypes";
|
public static final String AllCreatureTypes = "AllCreatureTypes";
|
||||||
|
|
||||||
@@ -111,11 +111,14 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
|||||||
private final Set<CoreType> coreTypes = EnumSet.noneOf(CoreType.class);
|
private final Set<CoreType> coreTypes = EnumSet.noneOf(CoreType.class);
|
||||||
private final Set<Supertype> supertypes = EnumSet.noneOf(Supertype.class);
|
private final Set<Supertype> supertypes = EnumSet.noneOf(Supertype.class);
|
||||||
private final Set<String> subtypes = Sets.newLinkedHashSet();
|
private final Set<String> subtypes = Sets.newLinkedHashSet();
|
||||||
|
private boolean incomplete = false;
|
||||||
private transient String calculatedType = null;
|
private transient String calculatedType = null;
|
||||||
|
|
||||||
public CardType() {
|
public CardType(boolean incomplete) {
|
||||||
|
this.incomplete = incomplete;
|
||||||
}
|
}
|
||||||
public CardType(final Iterable<String> from0) {
|
public CardType(final Iterable<String> from0, boolean incomplete) {
|
||||||
|
this.incomplete = incomplete;
|
||||||
addAll(from0);
|
addAll(from0);
|
||||||
}
|
}
|
||||||
public CardType(final CardType from0) {
|
public CardType(final CardType from0) {
|
||||||
@@ -516,6 +519,10 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sanisfySubtypes() {
|
public void sanisfySubtypes() {
|
||||||
|
// incomplete types are used for changing effects
|
||||||
|
if (this.incomplete) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!isCreature() && !isTribal()) {
|
if (!isCreature() && !isTribal()) {
|
||||||
Iterables.removeIf(subtypes, Predicates.IS_CREATURE_TYPE);
|
Iterables.removeIf(subtypes, Predicates.IS_CREATURE_TYPE);
|
||||||
subtypes.remove(AllCreatureTypes);
|
subtypes.remove(AllCreatureTypes);
|
||||||
@@ -637,11 +644,11 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CardType parse(final String typeText) {
|
public static CardType parse(final String typeText, boolean incomplete) {
|
||||||
// Most types and subtypes, except "Serra's Realm" and
|
// Most types and subtypes, except "Serra's Realm" and
|
||||||
// "Bolas's Meditation Realm" consist of only one word
|
// "Bolas's Meditation Realm" consist of only one word
|
||||||
final char space = ' ';
|
final char space = ' ';
|
||||||
final CardType result = new CardType();
|
final CardType result = new CardType(incomplete);
|
||||||
|
|
||||||
int iTypeStart = 0;
|
int iTypeStart = 0;
|
||||||
int iSpace = typeText.indexOf(space);
|
int iSpace = typeText.indexOf(space);
|
||||||
@@ -661,7 +668,7 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CardType combine(final CardType a, final CardType b) {
|
public static CardType combine(final CardType a, final CardType b) {
|
||||||
final CardType result = new CardType();
|
final CardType result = new CardType(false);
|
||||||
result.supertypes.addAll(a.supertypes);
|
result.supertypes.addAll(a.supertypes);
|
||||||
result.supertypes.addAll(b.supertypes);
|
result.supertypes.addAll(b.supertypes);
|
||||||
result.coreTypes.addAll(a.coreTypes);
|
result.coreTypes.addAll(a.coreTypes);
|
||||||
|
|||||||
@@ -51,12 +51,12 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
|||||||
|
|
||||||
final boolean permanent = sa.hasParam("Permanent");
|
final boolean permanent = sa.hasParam("Permanent");
|
||||||
|
|
||||||
final CardType types = new CardType();
|
final CardType types = new CardType(true);
|
||||||
if (sa.hasParam("Types")) {
|
if (sa.hasParam("Types")) {
|
||||||
types.addAll(Arrays.asList(sa.getParam("Types").split(",")));
|
types.addAll(Arrays.asList(sa.getParam("Types").split(",")));
|
||||||
}
|
}
|
||||||
|
|
||||||
final CardType removeTypes = new CardType();
|
final CardType removeTypes = new CardType(true);
|
||||||
if (sa.hasParam("RemoveTypes")) {
|
if (sa.hasParam("RemoveTypes")) {
|
||||||
removeTypes.addAll(Arrays.asList(sa.getParam("RemoveTypes").split(",")));
|
removeTypes.addAll(Arrays.asList(sa.getParam("RemoveTypes").split(",")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,12 +64,12 @@ public class AnimateEffect extends AnimateEffectBase {
|
|||||||
|
|
||||||
final boolean permanent = sa.hasParam("Permanent");
|
final boolean permanent = sa.hasParam("Permanent");
|
||||||
|
|
||||||
final CardType types = new CardType();
|
final CardType types = new CardType(true);
|
||||||
if (sa.hasParam("Types")) {
|
if (sa.hasParam("Types")) {
|
||||||
types.addAll(Arrays.asList(sa.getParam("Types").split(",")));
|
types.addAll(Arrays.asList(sa.getParam("Types").split(",")));
|
||||||
}
|
}
|
||||||
|
|
||||||
final CardType removeTypes = new CardType();
|
final CardType removeTypes = new CardType(true);
|
||||||
if (sa.hasParam("RemoveTypes")) {
|
if (sa.hasParam("RemoveTypes")) {
|
||||||
removeTypes.addAll(Arrays.asList(sa.getParam("RemoveTypes").split(",")));
|
removeTypes.addAll(Arrays.asList(sa.getParam("RemoveTypes").split(",")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3199,11 +3199,11 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
CardType addType = null;
|
CardType addType = null;
|
||||||
CardType removeType = null;
|
CardType removeType = null;
|
||||||
if (types != null) {
|
if (types != null) {
|
||||||
addType = new CardType(types);
|
addType = new CardType(types, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removeTypes != null) {
|
if (removeTypes != null) {
|
||||||
removeType = new CardType(removeTypes);
|
removeType = new CardType(removeTypes, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
||||||
@@ -3964,7 +3964,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
public final void addChangedTextTypeWord(final String originalWord, final String newWord, final Long timestamp) {
|
public final void addChangedTextTypeWord(final String originalWord, final String newWord, final Long timestamp) {
|
||||||
changedTextTypes.add(timestamp, originalWord, newWord);
|
changedTextTypes.add(timestamp, originalWord, newWord);
|
||||||
if (getType().hasSubtype(originalWord)) {
|
if (getType().hasSubtype(originalWord)) {
|
||||||
addChangedCardTypes(CardType.parse(newWord), CardType.parse(originalWord),
|
addChangedCardTypes(CardType.parse(newWord, true), CardType.parse(originalWord, true),
|
||||||
false, false, false, false, false, false, false, timestamp);
|
false, false, false, false, false, false, false, timestamp);
|
||||||
}
|
}
|
||||||
updateKeywordsChangedText(timestamp);
|
updateKeywordsChangedText(timestamp);
|
||||||
@@ -5268,8 +5268,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
public final void animateBestow(final boolean updateView) {
|
public final void animateBestow(final boolean updateView) {
|
||||||
bestowTimestamp = getGame().getNextTimestamp();
|
bestowTimestamp = getGame().getNextTimestamp();
|
||||||
addChangedCardTypes(new CardType(Collections.singletonList("Aura")),
|
addChangedCardTypes(new CardType(Collections.singletonList("Aura"), true),
|
||||||
new CardType(Collections.singletonList("Creature")),
|
new CardType(Collections.singletonList("Creature"), true),
|
||||||
false, false, false, false, false, false, true, bestowTimestamp, updateView);
|
false, false, false, false, false, false, true, bestowTimestamp, updateView);
|
||||||
addChangedCardKeywords(Collections.singletonList("Enchant creature"), Lists.newArrayList(),
|
addChangedCardKeywords(Collections.singletonList("Enchant creature"), Lists.newArrayList(),
|
||||||
false, false, bestowTimestamp, updateView);
|
false, false, bestowTimestamp, updateView);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import io.sentry.event.BreadcrumbBuilder;
|
|||||||
|
|
||||||
public class CardState extends GameObject {
|
public class CardState extends GameObject {
|
||||||
private String name = "";
|
private String name = "";
|
||||||
private CardType type = new CardType();
|
private CardType type = new CardType(false);
|
||||||
private ManaCost manaCost = ManaCost.NO_COST;
|
private ManaCost manaCost = ManaCost.NO_COST;
|
||||||
private byte color = MagicColor.COLORLESS;
|
private byte color = MagicColor.COLORLESS;
|
||||||
private int basePower = 0;
|
private int basePower = 0;
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ public final class CardUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CardState getFaceDownCharacteristic(Card c) {
|
public static CardState getFaceDownCharacteristic(Card c) {
|
||||||
final CardType type = new CardType();
|
final CardType type = new CardType(false);
|
||||||
type.add("Creature");
|
type.add("Creature");
|
||||||
|
|
||||||
final CardState ret = new CardState(c, CardStateName.FaceDown);
|
final CardState ret = new CardState(c, CardStateName.FaceDown);
|
||||||
|
|||||||
Reference in New Issue
Block a user