mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 06:22:01 -08:00
* Morph Ability - Some fixes for displaying / handling morph cards/permanents.
This commit is contained in:
parent
7cacff2ce7
commit
341db7b01f
7 changed files with 72 additions and 40 deletions
|
|
@ -129,10 +129,10 @@ public class PermanentCard extends PermanentImpl {
|
|||
|
||||
@Override
|
||||
public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, ArrayList<UUID> appliedEffects) {
|
||||
Zone fromZone = game.getState().getZone(objectId);
|
||||
Zone fromZone = game.getState().getZone(objectId);
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
if (controller != null && controller.removeFromBattlefield(this, game)) {
|
||||
if (isFaceDown()) {
|
||||
if (isFaceDown() && isMorphCard()) {
|
||||
setFaceDown(false);
|
||||
game.getCard(this.getId()).setFaceDown(false); //TODO: Do this in a better way
|
||||
}
|
||||
|
|
@ -183,6 +183,10 @@ public class PermanentCard extends PermanentImpl {
|
|||
@Override
|
||||
public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects) {
|
||||
Zone fromZone = game.getState().getZone(objectId);
|
||||
if (isMorphCard() && isFaceDown()) {
|
||||
setFaceDown(false);
|
||||
game.getCard(this.getId()).setFaceDown(false); //TODO: Do this in a better way
|
||||
}
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
if (controller != null && controller.removeFromBattlefield(this, game)) {
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(this, sourceId, ownerId, fromZone, Zone.EXILED, appliedEffects);
|
||||
|
|
|
|||
|
|
@ -2469,6 +2469,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
|
||||
boolean result = false;
|
||||
if (card.moveToZone(Zone.HAND, sourceId, game, false)) {
|
||||
if (card instanceof Permanent) {
|
||||
card = game.getCard(card.getId());
|
||||
}
|
||||
game.informPlayers(new StringBuilder(this.getName())
|
||||
.append(" puts ").append(card.isFaceDown() ? " a face down card":card.getLogName()).append(" ")
|
||||
.append(fromZone != null ? new StringBuilder("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" "):"")
|
||||
|
|
@ -2482,6 +2485,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
|
||||
boolean result = false;
|
||||
if (card.moveToZone(Zone.GRAVEYARD, sourceId, game, fromZone != null ? fromZone.equals(Zone.BATTLEFIELD) : false)) {
|
||||
if (card instanceof Permanent) {
|
||||
card = game.getCard(card.getId());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(this.getName())
|
||||
.append(" puts ").append(card.getLogName()).append(" ")
|
||||
.append(fromZone != null ? new StringBuilder("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" "):"");
|
||||
|
|
@ -2500,6 +2506,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName) {
|
||||
boolean result = false;
|
||||
if (card.moveToZone(Zone.LIBRARY, sourceId, game, toTop)) {
|
||||
if (card instanceof Permanent) {
|
||||
card = game.getCard(card.getId());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(this.getName())
|
||||
.append(" puts ").append(withName ? card.getLogName():"a card").append(" ");
|
||||
if (fromZone != null) {
|
||||
|
|
@ -2528,6 +2537,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone) {
|
||||
boolean result = false;
|
||||
if (card.moveToExile(exileId, exileName, sourceId, game)) {
|
||||
if (card instanceof Permanent) {
|
||||
card = game.getCard(card.getId());
|
||||
}
|
||||
game.informPlayers(new StringBuilder(this.getName())
|
||||
.append(" moves ").append(card.getLogName()).append(" ")
|
||||
.append(fromZone != null ? new StringBuilder("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" "):"")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue