mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Merge branch 'gristFixes' into 'master'
Card: fix getType when using changedCardTypesCharacterDefining See merge request core-developers/forge!4984
This commit is contained in:
@@ -286,7 +286,11 @@ public class GameCopier {
|
|||||||
newCard.setPTBoost(c.getPTBoostTable());
|
newCard.setPTBoost(c.getPTBoostTable());
|
||||||
newCard.setDamage(c.getDamage());
|
newCard.setDamage(c.getDamage());
|
||||||
|
|
||||||
|
newCard.setChangedCardColors(c.getChangedCardColorsMap());
|
||||||
|
newCard.setChangedCardColorsCharacterDefining(c.getChangedCardColorsCharacterDefiningMap());
|
||||||
|
|
||||||
newCard.setChangedCardTypes(c.getChangedCardTypesMap());
|
newCard.setChangedCardTypes(c.getChangedCardTypesMap());
|
||||||
|
newCard.setChangedCardTypesCharacterDefining(c.getChangedCardTypesCharacterDefiningMap());
|
||||||
newCard.setChangedCardKeywords(c.getChangedCardKeywords());
|
newCard.setChangedCardKeywords(c.getChangedCardKeywords());
|
||||||
newCard.setChangedCardNames(c.getChangedCardNames());
|
newCard.setChangedCardNames(c.getChangedCardNames());
|
||||||
|
|
||||||
|
|||||||
@@ -244,9 +244,11 @@ public class GameAction {
|
|||||||
|
|
||||||
if (zoneTo.is(ZoneType.Stack)) {
|
if (zoneTo.is(ZoneType.Stack)) {
|
||||||
// when moving to stack, copy changed card information
|
// when moving to stack, copy changed card information
|
||||||
copied.setChangedCardColors(c.getChangedCardColors());
|
copied.setChangedCardColors(c.getChangedCardColorsMap());
|
||||||
|
copied.setChangedCardColorsCharacterDefining(c.getChangedCardColorsCharacterDefiningMap());
|
||||||
copied.setChangedCardKeywords(c.getChangedCardKeywords());
|
copied.setChangedCardKeywords(c.getChangedCardKeywords());
|
||||||
copied.setChangedCardTypes(c.getChangedCardTypesMap());
|
copied.setChangedCardTypes(c.getChangedCardTypesMap());
|
||||||
|
copied.setChangedCardTypesCharacterDefining(c.getChangedCardTypesCharacterDefiningMap());
|
||||||
copied.setChangedCardNames(c.getChangedCardNames());
|
copied.setChangedCardNames(c.getChangedCardNames());
|
||||||
copied.setChangedCardTraits(c.getChangedCardTraits());
|
copied.setChangedCardTraits(c.getChangedCardTraits());
|
||||||
|
|
||||||
@@ -266,6 +268,9 @@ public class GameAction {
|
|||||||
// on Transformed objects)
|
// on Transformed objects)
|
||||||
copied.setState(CardStateName.Original, false);
|
copied.setState(CardStateName.Original, false);
|
||||||
copied.setBackSide(false);
|
copied.setBackSide(false);
|
||||||
|
|
||||||
|
// reset timestamp in changezone effects so they have same timestamp if ETB simutaneously
|
||||||
|
copied.setTimestamp(game.getNextTimestamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
copied.setUnearthed(c.isUnearthed());
|
copied.setUnearthed(c.isUnearthed());
|
||||||
@@ -278,6 +283,7 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
} else { //Token
|
} else { //Token
|
||||||
copied = c;
|
copied = c;
|
||||||
|
copied.setTimestamp(game.getNextTimestamp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,8 +609,6 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
unattachCardLeavingBattlefield(copied);
|
unattachCardLeavingBattlefield(copied);
|
||||||
} else if (toBattlefield) {
|
} else if (toBattlefield) {
|
||||||
// reset timestamp in changezone effects so they have same timestamp if ETB simutaneously
|
|
||||||
copied.setTimestamp(game.getNextTimestamp());
|
|
||||||
for (Player p : game.getPlayers()) {
|
for (Player p : game.getPlayers()) {
|
||||||
copied.getDamageHistory().setNotAttackedSinceLastUpkeepOf(p);
|
copied.getDamageHistory().setNotAttackedSinceLastUpkeepOf(p);
|
||||||
copied.getDamageHistory().setNotBlockedSinceLastUpkeepOf(p);
|
copied.getDamageHistory().setNotBlockedSinceLastUpkeepOf(p);
|
||||||
@@ -619,7 +623,6 @@ public class GameAction {
|
|||||||
|| zoneTo.is(ZoneType.Hand)
|
|| zoneTo.is(ZoneType.Hand)
|
||||||
|| zoneTo.is(ZoneType.Library)
|
|| zoneTo.is(ZoneType.Library)
|
||||||
|| zoneTo.is(ZoneType.Exile)) {
|
|| zoneTo.is(ZoneType.Exile)) {
|
||||||
copied.setTimestamp(game.getNextTimestamp());
|
|
||||||
copied.clearOptionalCostsPaid();
|
copied.clearOptionalCostsPaid();
|
||||||
if (copied.isFaceDown()) {
|
if (copied.isFaceDown()) {
|
||||||
copied.setState(CardStateName.Original, true);
|
copied.setState(CardStateName.Original, true);
|
||||||
|
|||||||
@@ -3495,7 +3495,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final CardTypeView getType(CardState state) {
|
public final CardTypeView getType(CardState state) {
|
||||||
if (changedCardTypes.isEmpty()) {
|
if (changedCardTypes.isEmpty() && changedCardTypesCharacterDefining.isEmpty()) {
|
||||||
return state.getType();
|
return state.getType();
|
||||||
}
|
}
|
||||||
return state.getType().getTypeWithChanges(getChangedCardTypes());
|
return state.getType().getTypeWithChanges(getChangedCardTypes());
|
||||||
@@ -3508,6 +3508,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
public Map<Long, CardChangedType> getChangedCardTypesMap() {
|
public Map<Long, CardChangedType> getChangedCardTypesMap() {
|
||||||
return Collections.unmodifiableMap(changedCardTypes);
|
return Collections.unmodifiableMap(changedCardTypes);
|
||||||
}
|
}
|
||||||
|
public Map<Long, CardChangedType> getChangedCardTypesCharacterDefiningMap() {
|
||||||
|
return Collections.unmodifiableMap(changedCardTypesCharacterDefining);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean clearChangedCardTypes() {
|
public boolean clearChangedCardTypes() {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
@@ -3548,9 +3551,15 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
return changedCardKeywords;
|
return changedCardKeywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Long, CardColor> getChangedCardColors() {
|
public Map<Long, CardColor> getChangedCardColorsMap() {
|
||||||
return changedCardColors;
|
return changedCardColors;
|
||||||
}
|
}
|
||||||
|
public Map<Long, CardColor> getChangedCardColorsCharacterDefiningMap() {
|
||||||
|
return changedCardColorsCharacterDefining;
|
||||||
|
}
|
||||||
|
public Iterable<CardColor> getChangedCardColors() {
|
||||||
|
return Iterables.concat(changedCardColorsCharacterDefining.values(), changedCardColors.values());
|
||||||
|
}
|
||||||
|
|
||||||
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,
|
||||||
@@ -3602,7 +3611,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
public final void addColor(final String s, final boolean addToColors, final long timestamp, final boolean cda) {
|
public final void addColor(final String s, final boolean addToColors, final long timestamp, final boolean cda) {
|
||||||
(cda ? changedCardColorsCharacterDefining : 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(!Iterables.isEmpty(getChangedCardColors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void removeColor(final long timestampIn) {
|
public final void removeColor(final long timestampIn) {
|
||||||
@@ -3612,7 +3621,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
|
|
||||||
if (removed) {
|
if (removed) {
|
||||||
currentState.getView().updateColors(this);
|
currentState.getView().updateColors(this);
|
||||||
currentState.getView().updateHasChangeColors(!getChangedCardColors().isEmpty());
|
currentState.getView().updateHasChangeColors(!Iterables.isEmpty(getChangedCardColors()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3628,7 +3637,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
}
|
}
|
||||||
public final ColorSet determineColor(CardState state) {
|
public final ColorSet determineColor(CardState state) {
|
||||||
byte colors = state.getColor();
|
byte colors = state.getColor();
|
||||||
for (final CardColor cc : Iterables.concat(changedCardColorsCharacterDefining.values(), changedCardColors.values())) {
|
for (final CardColor cc : getChangedCardColors()) {
|
||||||
if (cc.isAdditional()) {
|
if (cc.isAdditional()) {
|
||||||
colors |= cc.getColorMask();
|
colors |= cc.getColorMask();
|
||||||
} else {
|
} else {
|
||||||
@@ -6604,6 +6613,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
this.changedCardTypes.put(entry.getKey(), entry.getValue());
|
this.changedCardTypes.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void setChangedCardTypesCharacterDefining(Map<Long, CardChangedType> changedCardTypes) {
|
||||||
|
this.changedCardTypesCharacterDefining.clear();
|
||||||
|
for (Entry<Long, CardChangedType> entry : changedCardTypes.entrySet()) {
|
||||||
|
this.changedCardTypesCharacterDefining.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setChangedCardKeywords(Map<Long, KeywordsChange> changedCardKeywords) {
|
public void setChangedCardKeywords(Map<Long, KeywordsChange> changedCardKeywords) {
|
||||||
this.changedCardKeywords.clear();
|
this.changedCardKeywords.clear();
|
||||||
@@ -6618,6 +6633,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
this.changedCardColors.put(entry.getKey(), entry.getValue());
|
this.changedCardColors.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void setChangedCardColorsCharacterDefining(Map<Long, CardColor> changedCardColors) {
|
||||||
|
this.changedCardColorsCharacterDefining.clear();
|
||||||
|
for (Entry<Long, CardColor> entry : changedCardColors.entrySet()) {
|
||||||
|
this.changedCardColorsCharacterDefining.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void forceTurnFaceUp() {
|
public void forceTurnFaceUp() {
|
||||||
getGame().getTriggerHandler().suppressMode(TriggerType.TurnFaceUp);
|
getGame().getTriggerHandler().suppressMode(TriggerType.TurnFaceUp);
|
||||||
|
|||||||
@@ -281,9 +281,11 @@ public final class CardUtil {
|
|||||||
|
|
||||||
newCopy.setUnearthed(in.isUnearthed());
|
newCopy.setUnearthed(in.isUnearthed());
|
||||||
|
|
||||||
newCopy.setChangedCardColors(in.getChangedCardColors());
|
newCopy.setChangedCardColors(in.getChangedCardColorsMap());
|
||||||
|
newCopy.setChangedCardColorsCharacterDefining(in.getChangedCardColorsCharacterDefiningMap());
|
||||||
newCopy.setChangedCardKeywords(in.getChangedCardKeywords());
|
newCopy.setChangedCardKeywords(in.getChangedCardKeywords());
|
||||||
newCopy.setChangedCardTypes(in.getChangedCardTypesMap());
|
newCopy.setChangedCardTypes(in.getChangedCardTypesMap());
|
||||||
|
newCopy.setChangedCardTypesCharacterDefining(in.getChangedCardTypesCharacterDefiningMap());
|
||||||
newCopy.setChangedCardNames(in.getChangedCardNames());
|
newCopy.setChangedCardNames(in.getChangedCardNames());
|
||||||
newCopy.setChangedCardTraits(in.getChangedCardTraits());
|
newCopy.setChangedCardTraits(in.getChangedCardTraits());
|
||||||
|
|
||||||
|
|||||||
@@ -869,7 +869,7 @@ public class CardView extends GameEntityView {
|
|||||||
// update the color only while in Game
|
// update the color only while in Game
|
||||||
if (c.getGame() != null) {
|
if (c.getGame() != null) {
|
||||||
currentStateView.updateColors(currentState);
|
currentStateView.updateColors(currentState);
|
||||||
currentStateView.updateHasChangeColors(!c.getChangedCardColors().isEmpty());
|
currentStateView.updateHasChangeColors(!Iterables.isEmpty(c.getChangedCardColors()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentStateView.updateLoyalty(currentState);
|
currentStateView.updateLoyalty(currentState);
|
||||||
|
|||||||
Reference in New Issue
Block a user