forked from External/mage
Refactor: removed server side objects from a client side game's data (#10788)
* Clean original values transmitted with CardView.originalObject * Move RateCard to mage.Common, support cardView as argument. * Clean PermanentView constructor for TestCardRenderDialog
This commit is contained in:
parent
ba411e0054
commit
5062c84098
17 changed files with 285 additions and 149 deletions
|
|
@ -6,12 +6,12 @@ import mage.cards.Card;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -142,6 +142,41 @@ public class PermanentView extends CardView {
|
|||
this.attachedControllerDiffers = attachedControllerDiffers;
|
||||
}
|
||||
|
||||
public PermanentView(PermanentView permanentView, Card card, UUID createdForPlayerId, Game game) {
|
||||
super(permanentView);
|
||||
this.controlled = permanentView.controlled;
|
||||
this.tapped = permanentView.isTapped();
|
||||
this.flipped = permanentView.isFlipped();
|
||||
this.phasedIn = permanentView.isPhasedIn();
|
||||
this.summoningSickness = permanentView.summoningSickness;
|
||||
this.damage = permanentView.damage;
|
||||
this.attachments = permanentView.attachments.stream().collect(Collectors.toList());
|
||||
|
||||
boolean showFaceDownInfo = controlled || (game != null && game.hasEnded());
|
||||
|
||||
if (isToken()) {
|
||||
original = new CardView(permanentView.original);
|
||||
original.expansionSetCode = permanentView.original.getExpansionSetCode();
|
||||
expansionSetCode = permanentView.original.getExpansionSetCode();
|
||||
} else {
|
||||
if (card != null && showFaceDownInfo) {
|
||||
// face down card must be hidden from opponent, but shown on game end for all
|
||||
original = new CardView(card.copy(), (Game) null);
|
||||
} else {
|
||||
original = null;
|
||||
}
|
||||
}
|
||||
|
||||
this.copy = permanentView.copy;
|
||||
this.nameOwner = permanentView.nameOwner;
|
||||
this.nameController = permanentView.nameController;
|
||||
this.attachedTo = permanentView.attachedTo;
|
||||
this.morphed = permanentView.morphed;
|
||||
this.manifested = permanentView.manifested;
|
||||
this.attachedToPermanent = permanentView.attachedToPermanent;
|
||||
this.attachedControllerDiffers = permanentView.attachedControllerDiffers;
|
||||
}
|
||||
|
||||
public boolean isTapped() {
|
||||
return tapped;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue