mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Card: changedCardTypesCharacterDefining + changedCardColorsCharacterDefining for better apply in Order
This commit is contained in:
@@ -120,7 +120,7 @@ public abstract class AnimateEffectBase extends SpellAbilityEffect {
|
|||||||
|
|
||||||
if (!addType.isEmpty() || !removeType.isEmpty() || removeCreatureTypes) {
|
if (!addType.isEmpty() || !removeType.isEmpty() || removeCreatureTypes) {
|
||||||
c.addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
c.addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
||||||
removeLandTypes, removeCreatureTypes, removeArtifactTypes, removeEnchantmentTypes, timestamp);
|
removeLandTypes, removeCreatureTypes, removeArtifactTypes, removeEnchantmentTypes, timestamp, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
c.addChangedCardKeywords(keywords, removeKeywords, removeAll, removeLandTypes, timestamp);
|
c.addChangedCardKeywords(keywords, removeKeywords, removeAll, removeLandTypes, timestamp);
|
||||||
@@ -133,7 +133,7 @@ public abstract class AnimateEffectBase extends SpellAbilityEffect {
|
|||||||
c.addHiddenExtrinsicKeyword(k);
|
c.addHiddenExtrinsicKeyword(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
c.addColor(colors, !sa.hasParam("OverwriteColors"), timestamp);
|
c.addColor(colors, !sa.hasParam("OverwriteColors"), timestamp, false);
|
||||||
|
|
||||||
if (sa.hasParam("LeaveBattlefield")) {
|
if (sa.hasParam("LeaveBattlefield")) {
|
||||||
addLeaveBattlefieldReplacement(c, sa, sa.getParam("LeaveBattlefield"));
|
addLeaveBattlefieldReplacement(c, sa, sa.getParam("LeaveBattlefield"));
|
||||||
|
|||||||
@@ -176,6 +176,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
private final Map<Long, KeywordsChange> changedCardKeywords = Maps.newTreeMap();
|
private final Map<Long, KeywordsChange> changedCardKeywords = Maps.newTreeMap();
|
||||||
private final Map<Long, CardTraitChanges> changedCardTraits = Maps.newTreeMap();
|
private final Map<Long, CardTraitChanges> changedCardTraits = Maps.newTreeMap();
|
||||||
private final Map<Long, CardColor> changedCardColors = Maps.newTreeMap();
|
private final Map<Long, CardColor> changedCardColors = Maps.newTreeMap();
|
||||||
|
|
||||||
|
private final Map<Long, CardChangedType> changedCardTypesCharacterDefining = Maps.newTreeMap();
|
||||||
|
private final Map<Long, CardColor> changedCardColorsCharacterDefining = Maps.newTreeMap();
|
||||||
|
|
||||||
private final NavigableMap<Long, CardCloneStates> clonedStates = Maps.newTreeMap();
|
private final NavigableMap<Long, CardCloneStates> clonedStates = Maps.newTreeMap();
|
||||||
private final NavigableMap<Long, CardCloneStates> textChangeStates = Maps.newTreeMap();
|
private final NavigableMap<Long, CardCloneStates> textChangeStates = Maps.newTreeMap();
|
||||||
|
|
||||||
@@ -3451,7 +3455,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<CardChangedType> getChangedCardTypes() {
|
public Iterable<CardChangedType> getChangedCardTypes() {
|
||||||
return Iterables.unmodifiableIterable(changedCardTypes.values());
|
return Iterables.unmodifiableIterable(Iterables.concat(changedCardTypesCharacterDefining.values(), changedCardTypes.values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Long, CardChangedType> getChangedCardTypesMap() {
|
public Map<Long, CardChangedType> getChangedCardTypesMap() {
|
||||||
@@ -3459,10 +3463,17 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean clearChangedCardTypes() {
|
public boolean clearChangedCardTypes() {
|
||||||
if (changedCardTypes.isEmpty())
|
boolean changed = false;
|
||||||
return false;
|
|
||||||
|
if (!changedCardTypesCharacterDefining.isEmpty())
|
||||||
|
changed = true;
|
||||||
|
changedCardTypesCharacterDefining.clear();
|
||||||
|
|
||||||
|
if (!changedCardTypes.isEmpty())
|
||||||
|
changed = true;
|
||||||
changedCardTypes.clear();
|
changedCardTypes.clear();
|
||||||
return true;
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean clearChangedCardKeywords() {
|
public boolean clearChangedCardKeywords() {
|
||||||
@@ -3473,10 +3484,17 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean clearChangedCardColors() {
|
public boolean clearChangedCardColors() {
|
||||||
if (changedCardColors.isEmpty())
|
boolean changed = false;
|
||||||
return false;
|
|
||||||
|
if (!changedCardTypesCharacterDefining.isEmpty())
|
||||||
|
changed = true;
|
||||||
|
changedCardTypesCharacterDefining.clear();
|
||||||
|
|
||||||
|
if (!changedCardColors.isEmpty())
|
||||||
|
changed = true;
|
||||||
changedCardColors.clear();
|
changedCardColors.clear();
|
||||||
return true;
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Long, KeywordsChange> getChangedCardKeywords() {
|
public Map<Long, KeywordsChange> getChangedCardKeywords() {
|
||||||
@@ -3491,18 +3509,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
||||||
final boolean removeLandTypes, final boolean removeCreatureTypes, final boolean removeArtifactTypes,
|
final boolean removeLandTypes, final boolean removeCreatureTypes, final boolean removeArtifactTypes,
|
||||||
final boolean removeEnchantmentTypes,
|
final boolean removeEnchantmentTypes,
|
||||||
final long timestamp) {
|
final long timestamp, final boolean updateView, final boolean cda) {
|
||||||
addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes, removeLandTypes,
|
|
||||||
removeCreatureTypes, removeArtifactTypes, removeEnchantmentTypes, timestamp, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void addChangedCardTypes(final CardType addType, final CardType removeType,
|
(cda ? changedCardTypesCharacterDefining : changedCardTypes).put(timestamp, new CardChangedType(
|
||||||
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
|
||||||
final boolean removeLandTypes, final boolean removeCreatureTypes, final boolean removeArtifactTypes,
|
|
||||||
final boolean removeEnchantmentTypes,
|
|
||||||
final long timestamp, final boolean updateView) {
|
|
||||||
|
|
||||||
changedCardTypes.put(timestamp, new CardChangedType(
|
|
||||||
addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
||||||
removeLandTypes, removeCreatureTypes, removeArtifactTypes, removeEnchantmentTypes));
|
removeLandTypes, removeCreatureTypes, removeArtifactTypes, removeEnchantmentTypes));
|
||||||
if (updateView) {
|
if (updateView) {
|
||||||
@@ -3514,17 +3523,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
||||||
final boolean removeLandTypes, final boolean removeCreatureTypes, final boolean removeArtifactTypes,
|
final boolean removeLandTypes, final boolean removeCreatureTypes, final boolean removeArtifactTypes,
|
||||||
final boolean removeEnchantmentTypes,
|
final boolean removeEnchantmentTypes,
|
||||||
final long timestamp) {
|
final long timestamp, final boolean updateView, final boolean cda) {
|
||||||
addChangedCardTypes(types, removeTypes, removeSuperTypes, removeCardTypes, removeSubTypes,
|
|
||||||
removeLandTypes, removeCreatureTypes, removeArtifactTypes, removeEnchantmentTypes,
|
|
||||||
timestamp, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void addChangedCardTypes(final Iterable<String> types, final Iterable<String> removeTypes,
|
|
||||||
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
|
||||||
final boolean removeLandTypes, final boolean removeCreatureTypes, final boolean removeArtifactTypes,
|
|
||||||
final boolean removeEnchantmentTypes,
|
|
||||||
final long timestamp, final boolean updateView) {
|
|
||||||
CardType addType = null;
|
CardType addType = null;
|
||||||
CardType removeType = null;
|
CardType removeType = null;
|
||||||
if (types != null) {
|
if (types != null) {
|
||||||
@@ -3537,7 +3536,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
|
|
||||||
addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
||||||
removeLandTypes, removeCreatureTypes, removeArtifactTypes, removeEnchantmentTypes,
|
removeLandTypes, removeCreatureTypes, removeArtifactTypes, removeEnchantmentTypes,
|
||||||
timestamp, updateView);
|
timestamp, updateView, cda);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void removeChangedCardTypes(final long timestamp) {
|
public final void removeChangedCardTypes(final long timestamp) {
|
||||||
@@ -3545,21 +3544,26 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void removeChangedCardTypes(final long timestamp, final boolean updateView) {
|
public final void removeChangedCardTypes(final long timestamp, final boolean updateView) {
|
||||||
if (changedCardTypes.remove(timestamp) != null && updateView) {
|
boolean removed = false;
|
||||||
|
removed |= changedCardTypes.remove(timestamp) != null;
|
||||||
|
removed |= changedCardTypesCharacterDefining.remove(timestamp) != null;
|
||||||
|
if (removed && updateView) {
|
||||||
currentState.getView().updateType(currentState);
|
currentState.getView().updateType(currentState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void addColor(final String s, final boolean addToColors, final long timestamp) {
|
public final void addColor(final String s, final boolean addToColors, final long timestamp, final boolean cda) {
|
||||||
changedCardColors.put(timestamp, new CardColor(s, addToColors, timestamp));
|
(cda ? changedCardColorsCharacterDefining : changedCardColors).put(timestamp, new CardColor(s, addToColors, timestamp));
|
||||||
currentState.getView().updateColors(this);
|
currentState.getView().updateColors(this);
|
||||||
currentState.getView().updateHasChangeColors(!getChangedCardColors().isEmpty());
|
currentState.getView().updateHasChangeColors(!getChangedCardColors().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void removeColor(final long timestampIn) {
|
public final void removeColor(final long timestampIn) {
|
||||||
final CardColor removeCol = changedCardColors.remove(timestampIn);
|
boolean removed = false;
|
||||||
|
removed |= changedCardColors.remove(timestampIn) != null;
|
||||||
|
removed |= changedCardColorsCharacterDefining.remove(timestampIn) != null;
|
||||||
|
|
||||||
if (removeCol != null) {
|
if (removed) {
|
||||||
currentState.getView().updateColors(this);
|
currentState.getView().updateColors(this);
|
||||||
currentState.getView().updateHasChangeColors(!getChangedCardColors().isEmpty());
|
currentState.getView().updateHasChangeColors(!getChangedCardColors().isEmpty());
|
||||||
}
|
}
|
||||||
@@ -3576,9 +3580,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
return determineColor(currentState);
|
return determineColor(currentState);
|
||||||
}
|
}
|
||||||
public final ColorSet determineColor(CardState state) {
|
public final ColorSet determineColor(CardState state) {
|
||||||
final Iterable<CardColor> colorList = changedCardColors.values();
|
|
||||||
byte colors = state.getColor();
|
byte colors = state.getColor();
|
||||||
for (final CardColor cc : colorList) {
|
for (final CardColor cc : Iterables.concat(changedCardColorsCharacterDefining.values(), changedCardColors.values())) {
|
||||||
if (cc.isAdditional()) {
|
if (cc.isAdditional()) {
|
||||||
colors |= cc.getColorMask();
|
colors |= cc.getColorMask();
|
||||||
} else {
|
} else {
|
||||||
@@ -4297,7 +4300,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
changedTextTypes.add(timestamp, originalWord, newWord);
|
changedTextTypes.add(timestamp, originalWord, newWord);
|
||||||
if (getType().hasSubtype(originalWord)) {
|
if (getType().hasSubtype(originalWord)) {
|
||||||
addChangedCardTypes(CardType.parse(newWord, true), CardType.parse(originalWord, true),
|
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, true, false);
|
||||||
}
|
}
|
||||||
updateKeywordsChangedText(timestamp);
|
updateKeywordsChangedText(timestamp);
|
||||||
updateChangedText();
|
updateChangedText();
|
||||||
@@ -5483,7 +5486,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
bestowTimestamp = getGame().getNextTimestamp();
|
bestowTimestamp = getGame().getNextTimestamp();
|
||||||
addChangedCardTypes(new CardType(Collections.singletonList("Aura"), true),
|
addChangedCardTypes(new CardType(Collections.singletonList("Aura"), true),
|
||||||
new CardType(Collections.singletonList("Creature"), true),
|
new CardType(Collections.singletonList("Creature"), true),
|
||||||
false, false, false, false, false, false, true, bestowTimestamp, updateView);
|
false, false, false, false, false, false, true, bestowTimestamp, updateView, false);
|
||||||
addChangedCardKeywords(Collections.singletonList("Enchant creature"), Lists.newArrayList(),
|
addChangedCardKeywords(Collections.singletonList("Enchant creature"), Lists.newArrayList(),
|
||||||
false, false, bestowTimestamp, updateView);
|
false, false, bestowTimestamp, updateView);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class CardFactory {
|
|||||||
}
|
}
|
||||||
final String finalColors = tmp;
|
final String finalColors = tmp;
|
||||||
|
|
||||||
c.addColor(finalColors, !sourceSA.hasParam("OverwriteColors"), c.getTimestamp());
|
c.addColor(finalColors, !sourceSA.hasParam("OverwriteColors"), c.getTimestamp(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
c.clearControllers();
|
c.clearControllers();
|
||||||
|
|||||||
@@ -844,12 +844,12 @@ public final class StaticAbilityContinuous {
|
|||||||
if ((addTypes != null) || (removeTypes != null)) {
|
if ((addTypes != null) || (removeTypes != null)) {
|
||||||
affectedCard.addChangedCardTypes(addTypes, removeTypes, removeSuperTypes, removeCardTypes,
|
affectedCard.addChangedCardTypes(addTypes, removeTypes, removeSuperTypes, removeCardTypes,
|
||||||
removeSubTypes, removeLandTypes, removeCreatureTypes, removeArtifactTypes,
|
removeSubTypes, removeLandTypes, removeCreatureTypes, removeArtifactTypes,
|
||||||
removeEnchantmentTypes, hostCard.getTimestamp());
|
removeEnchantmentTypes, hostCard.getTimestamp(), true, stAb.hasParam("CharacteristicDefining"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// add colors
|
// add colors
|
||||||
if (addColors != null) {
|
if (addColors != null) {
|
||||||
affectedCard.addColor(addColors, !overwriteColors, hostCard.getTimestamp());
|
affectedCard.addColor(addColors, !overwriteColors, hostCard.getTimestamp(), stAb.hasParam("CharacteristicDefining"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layer == StaticAbilityLayer.RULES) {
|
if (layer == StaticAbilityLayer.RULES) {
|
||||||
|
|||||||
Reference in New Issue
Block a user