Beginning of implementation of Planechase.

10 or so initial planes that (mostly) have been tested, no phenomenons as yet and no modifying yet of chaos rolls.  Also no support for a user to be able to set if it is planechase (able to do so via the cheat button).
This commit is contained in:
spjspj 2018-04-09 08:44:48 +10:00
parent ecbe7e68a6
commit e932c139d9
32 changed files with 2042 additions and 18 deletions

View file

@ -46,7 +46,6 @@ import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.stack.Spell;
import mage.game.stack.StackAbility;
@ -55,6 +54,7 @@ import mage.target.Targets;
import mage.util.SubTypeList;
import com.google.gson.annotations.Expose;
import mage.game.command.Plane;
/**
* @author BetaSteward_at_googlemail.com
@ -521,6 +521,13 @@ public class CardView extends SimpleCardView {
Emblem emblem = (Emblem) object;
this.rarity = Rarity.SPECIAL;
this.rules = emblem.getAbilities().getRules(emblem.getName());
} else if (object instanceof Plane) {
this.mageObjectType = MageObjectType.PLANE;
Plane plane = (Plane) object;
this.rarity = Rarity.SPECIAL;
// Display in landscape/rotated/on its side
this.rotate = true;
this.rules = plane.getAbilities().getRules(plane.getName());
}
if (this.rarity == null && object instanceof StackAbility) {
StackAbility stackAbility = (StackAbility) object;
@ -557,6 +564,21 @@ public class CardView extends SimpleCardView {
this.rarity = Rarity.COMMON;
}
public CardView(PlaneView plane) {
this(true);
this.gameObject = true;
this.id = plane.getId();
this.mageObjectType = MageObjectType.EMBLEM;
this.name = plane.getName();
this.displayName = name;
this.rules = plane.getRules();
// Display the plane in landscape (similar to Fused cards)
this.rotate = true;
this.frameStyle = FrameStyle.MPRP_FULL_ART_BASIC;
this.expansionSetCode = plane.getExpansionSetCode();
this.rarity = Rarity.COMMON;
}
public CardView(Designation designation, StackAbility stackAbility) {
this(true);
this.gameObject = true;

View file

@ -40,6 +40,7 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.GameState;
import mage.game.command.Emblem;
import mage.game.command.Plane;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.target.targetpointer.TargetPointer;
@ -118,6 +119,9 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
abilityView = new AbilityView(ability, sourceObject.getName(), new CardView(new EmblemView((Emblem) sourceObject)));
abilityView.setName(((Emblem) sourceObject).getName());
// abilityView.setExpansionSetCode(sourceCard.getExpansionSetCode());
} else if (sourceObject instanceof Plane) {
abilityView = new AbilityView(ability, sourceObject.getName(), new CardView(new PlaneView((Plane) sourceObject)));
abilityView.setName(((Plane) sourceObject).getName());
}
break;
}

View file

@ -47,6 +47,7 @@ import mage.game.Game;
import mage.game.GameState;
import mage.game.combat.CombatGroup;
import mage.game.command.Emblem;
import mage.game.command.Plane;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
import mage.game.permanent.PermanentToken;
@ -139,6 +140,12 @@ public class GameView implements Serializable {
stack.put(stackObject.getId(),
new StackAbilityView(game, (StackAbility) stackObject, object.getName(), cardView));
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
} else if (object instanceof Plane) {
CardView cardView = new CardView(new PlaneView((Plane) object));
((StackAbility) stackObject).setName(((Plane) object).getName());
stack.put(stackObject.getId(),
new StackAbilityView(game, (StackAbility) stackObject, object.getName(), cardView));
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
} else if (object instanceof Designation) {
Designation designation = (Designation) game.getObject(object.getId());
if (designation != null) {

View file

@ -0,0 +1,57 @@
package mage.view;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
import mage.cards.Card;
import mage.game.command.Plane;
/**
* @author spjspj
*/
public class PlaneView implements CommandObjectView, Serializable {
protected UUID id;
protected String name;
protected String expansionSetCode;
protected List<String> rules;
public PlaneView(Plane plane, Card sourceCard) {
id = plane.getId();
name = "Plane " + sourceCard.getName();
if (plane.getExpansionSetCodeForImage() == null) {
expansionSetCode = sourceCard.getExpansionSetCode();
} else {
expansionSetCode = plane.getExpansionSetCodeForImage();
}
rules = plane.getAbilities().getRules(sourceCard.getName());
}
public PlaneView(Plane plane) {
id = plane.getId();
name = plane.getName();
expansionSetCode = plane.getExpansionSetCodeForImage();
rules = plane.getAbilities().getRules(plane.getName());
}
@Override
public String getExpansionSetCode() {
return expansionSetCode;
}
@Override
public String getName() {
return name;
}
@Override
public UUID getId() {
return id;
}
@Override
public List<String> getRules() {
return rules;
}
}

View file

@ -43,6 +43,7 @@ import mage.game.GameState;
import mage.game.command.CommandObject;
import mage.game.command.Commander;
import mage.game.command.Emblem;
import mage.game.command.Plane;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.players.net.UserData;
@ -141,6 +142,10 @@ public class PlayerView implements Serializable {
if (emblem.getControllerId().equals(this.playerId)) {
commandList.add(new EmblemView(emblem));
}
} else if (commandObject instanceof Plane) {
Plane plane = (Plane) commandObject;
// Planes are universal and all players can see them.
commandList.add(new PlaneView(plane));
} else if (commandObject instanceof Commander) {
Commander commander = (Commander) commandObject;
if (commander.getControllerId().equals(this.playerId)) {