mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Attempting to preserve the visual flickering-fixing effect of the previously reverted r32578 by not updating the view when temporarily animating a Bestow creature to make checks.
- Note: this may introduce a bit of overhead and definitely adds a bit of extra complexity into an already bloated Card.java. A better solution is welcome (feel free to revert this if a better solution is implemented).
This commit is contained in:
@@ -2593,14 +2593,28 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
public final void addChangedCardTypes(final CardType addType, final CardType removeType,
|
public final void addChangedCardTypes(final CardType addType, final CardType removeType,
|
||||||
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
||||||
final boolean removeCreatureTypes, final long timestamp) {
|
final boolean removeCreatureTypes, final long timestamp) {
|
||||||
|
addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes, removeCreatureTypes, timestamp, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void addChangedCardTypes(final CardType addType, final CardType removeType,
|
||||||
|
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
||||||
|
final boolean removeCreatureTypes, final long timestamp, final boolean updateView) {
|
||||||
|
|
||||||
changedCardTypes.put(timestamp, new CardChangedType(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes, removeCreatureTypes));
|
changedCardTypes.put(timestamp, new CardChangedType(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes, removeCreatureTypes));
|
||||||
|
if (updateView) {
|
||||||
currentState.getView().updateType(currentState);
|
currentState.getView().updateType(currentState);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public final void addChangedCardTypes(final String[] types, final String[] removeTypes,
|
public final void addChangedCardTypes(final String[] types, final String[] removeTypes,
|
||||||
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
||||||
final boolean removeCreatureTypes, final long timestamp) {
|
final boolean removeCreatureTypes, final long timestamp) {
|
||||||
|
addChangedCardTypes(types, removeTypes, removeSuperTypes, removeCardTypes, removeSubTypes, removeCreatureTypes, timestamp, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void addChangedCardTypes(final String[] types, final String[] removeTypes,
|
||||||
|
final boolean removeSuperTypes, final boolean removeCardTypes, final boolean removeSubTypes,
|
||||||
|
final boolean removeCreatureTypes, final long timestamp, final boolean updateView) {
|
||||||
CardType addType = null;
|
CardType addType = null;
|
||||||
CardType removeType = null;
|
CardType removeType = null;
|
||||||
if (types != null) {
|
if (types != null) {
|
||||||
@@ -2612,12 +2626,18 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
addChangedCardTypes(addType, removeType, removeSuperTypes, removeCardTypes, removeSubTypes,
|
||||||
removeCreatureTypes, timestamp);
|
removeCreatureTypes, timestamp, updateView);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void removeChangedCardTypes(final long timestamp) {
|
public final void removeChangedCardTypes(final long timestamp) {
|
||||||
|
removeChangedCardTypes(timestamp, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void removeChangedCardTypes(final long timestamp, final boolean updateView) {
|
||||||
CardChangedType changed = changedCardTypes.remove(timestamp);
|
CardChangedType changed = changedCardTypes.remove(timestamp);
|
||||||
|
if (updateView) {
|
||||||
currentState.getView().updateType(currentState);
|
currentState.getView().updateType(currentState);
|
||||||
|
}
|
||||||
|
|
||||||
// if it stops being a land, the abilities does need to be removed
|
// if it stops being a land, the abilities does need to be removed
|
||||||
if (changed != null && changed.getAddType() != null && changed.getAddType().isLand()) {
|
if (changed != null && changed.getAddType() != null && changed.getAddType().isLand()) {
|
||||||
@@ -3066,6 +3086,11 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
public final void addChangedCardKeywords(final List<String> keywords, final List<String> removeKeywords,
|
public final void addChangedCardKeywords(final List<String> keywords, final List<String> removeKeywords,
|
||||||
final boolean removeAllKeywords, final long timestamp) {
|
final boolean removeAllKeywords, final long timestamp) {
|
||||||
|
addChangedCardKeywords(keywords, removeKeywords, removeAllKeywords, timestamp, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void addChangedCardKeywords(final List<String> keywords, final List<String> removeKeywords,
|
||||||
|
final boolean removeAllKeywords, final long timestamp, final boolean updateView) {
|
||||||
keywords.removeAll(getCantHaveOrGainKeyword());
|
keywords.removeAll(getCantHaveOrGainKeyword());
|
||||||
// if the key already exists - merge entries
|
// if the key already exists - merge entries
|
||||||
final KeywordsChange cks = changedCardKeywords.get(timestamp);
|
final KeywordsChange cks = changedCardKeywords.get(timestamp);
|
||||||
@@ -3086,8 +3111,11 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
newCks.addKeywordsToCard(this);
|
newCks.addKeywordsToCard(this);
|
||||||
changedCardKeywords.put(timestamp, newCks);
|
changedCardKeywords.put(timestamp, newCks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateView) {
|
||||||
updateKeywords();
|
updateKeywords();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public final void addChangedCardKeywords(final String[] keywords, final String[] removeKeywords,
|
public final void addChangedCardKeywords(final String[] keywords, final String[] removeKeywords,
|
||||||
final boolean removeAllKeywords, final long timestamp) {
|
final boolean removeAllKeywords, final long timestamp) {
|
||||||
@@ -3105,11 +3133,17 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final KeywordsChange removeChangedCardKeywords(final long timestamp) {
|
public final KeywordsChange removeChangedCardKeywords(final long timestamp) {
|
||||||
|
return removeChangedCardKeywords(timestamp, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final KeywordsChange removeChangedCardKeywords(final long timestamp, final boolean updateView) {
|
||||||
KeywordsChange change = changedCardKeywords.remove(timestamp);
|
KeywordsChange change = changedCardKeywords.remove(timestamp);
|
||||||
if (change != null) {
|
if (change != null) {
|
||||||
change.removeKeywords(this);
|
change.removeKeywords(this);
|
||||||
|
if (updateView) {
|
||||||
updateKeywords();
|
updateKeywords();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6221,13 +6255,13 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
public final void animateBestow() {
|
public final void animateBestow() {
|
||||||
bestowTimestamp = getGame().getNextTimestamp();
|
bestowTimestamp = getGame().getNextTimestamp();
|
||||||
addChangedCardTypes(new CardType(Collections.singletonList("Aura")),
|
addChangedCardTypes(new CardType(Collections.singletonList("Aura")),
|
||||||
new CardType(Collections.singletonList("Creature")), false, false, false, true, bestowTimestamp);
|
new CardType(Collections.singletonList("Creature")), false, false, false, true, bestowTimestamp, false);
|
||||||
addChangedCardKeywords(Collections.singletonList("Enchant creature"), new ArrayList<String>(), false, bestowTimestamp);
|
addChangedCardKeywords(Collections.singletonList("Enchant creature"), new ArrayList<String>(), false, bestowTimestamp, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void unanimateBestow() {
|
public final void unanimateBestow() {
|
||||||
removeChangedCardKeywords(bestowTimestamp);
|
removeChangedCardKeywords(bestowTimestamp, false);
|
||||||
removeChangedCardTypes(bestowTimestamp);
|
removeChangedCardTypes(bestowTimestamp, false);
|
||||||
bestowTimestamp = -1;
|
bestowTimestamp = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user