mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
*Preliminary work to allow multiple planes.
*Fixed Panopticon triggering outside the Command zone.
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package forge.card.ability.effects;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.Card;
|
||||
import forge.card.ability.AbilityUtils;
|
||||
import forge.card.ability.SpellAbilityEffect;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.game.GameState;
|
||||
@@ -24,7 +28,15 @@ public class PlaneswalkEffect extends SpellAbilityEffect {
|
||||
{
|
||||
p.leaveCurrentPlane();
|
||||
}
|
||||
sa.getActivatingPlayer().planeswalk();
|
||||
if(sa.hasParam("Defined")) {
|
||||
List<Card> destinations = AbilityUtils.getDefinedCards(sa.getSourceCard(), sa.getParam("Defined"), sa);
|
||||
sa.getActivatingPlayer().planeswalkTo(destinations);
|
||||
}
|
||||
else
|
||||
{
|
||||
sa.getActivatingPlayer().planeswalk();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package forge.card.trigger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.Card;
|
||||
@@ -33,11 +34,14 @@ public class TriggerPlaneswalkedFrom extends Trigger {
|
||||
@Override
|
||||
public boolean performTest(Map<String, Object> runParams2) {
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
final Card moved = (Card) runParams2.get("Card");
|
||||
if (!moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
for(Card moved : (ArrayList<Card>)runParams2.get("Card"))
|
||||
{
|
||||
if (moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package forge.card.trigger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.Card;
|
||||
@@ -33,11 +34,14 @@ public class TriggerPlaneswalkedTo extends Trigger {
|
||||
@Override
|
||||
public boolean performTest(Map<String, Object> runParams2) {
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
final Card moved = (Card) runParams2.get("Card");
|
||||
if (!moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
for(Card moved : (ArrayList<Card>)runParams2.get("Card"))
|
||||
{
|
||||
if (moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -61,8 +61,7 @@ public class GameState {
|
||||
private final List<Player> allPlayers;
|
||||
private final List<Player> ingamePlayers = new ArrayList<Player>();
|
||||
|
||||
private final List<Card> communalPlanarDeck = new ArrayList<Card>();
|
||||
private Card activePlane = null;
|
||||
private List<Card> activePlanes = null;
|
||||
|
||||
public final Cleanup cleanup;
|
||||
public final EndOfTurn endOfTurn;
|
||||
@@ -561,15 +560,15 @@ public class GameState {
|
||||
/**
|
||||
* @return the activePlane
|
||||
*/
|
||||
public Card getActivePlane() {
|
||||
return activePlane;
|
||||
public List<Card> getActivePlanes() {
|
||||
return activePlanes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activePlane0 the activePlane to set
|
||||
*/
|
||||
public void setActivePlane(Card activePlane0) {
|
||||
this.activePlane = activePlane0;
|
||||
public void setActivePlanes(List<Card> activePlane0) {
|
||||
this.activePlanes = activePlane0;
|
||||
}
|
||||
|
||||
public void archenemy904_10() {
|
||||
|
||||
@@ -552,11 +552,13 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
SDisplayUtil.showTab(nextField);
|
||||
|
||||
if (game.getType() == GameType.Planechase) {
|
||||
Card p = game.getActivePlane();
|
||||
if (p != null) {
|
||||
p.setController(next, 0);
|
||||
game.getAction().controllerChangeZoneCorrection(p);
|
||||
}
|
||||
for(Card p :game.getActivePlanes())
|
||||
{
|
||||
if (p != null) {
|
||||
p.setController(next, 0);
|
||||
game.getAction().controllerChangeZoneCorrection(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return next;
|
||||
|
||||
@@ -159,7 +159,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
/** The zones. */
|
||||
private final Map<ZoneType, PlayerZone> zones = new EnumMap<ZoneType, PlayerZone>(ZoneType.class);
|
||||
|
||||
private Card currentPlane = null;
|
||||
private List<Card> currentPlanes = new ArrayList<Card>();
|
||||
|
||||
private PlayerStatistics stats = new PlayerStatistics();
|
||||
protected PlayerController controller;
|
||||
@@ -2948,38 +2948,51 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
* Then runs triggers.
|
||||
*/
|
||||
public void planeswalk()
|
||||
{
|
||||
planeswalkTo(Arrays.asList(getZone(ZoneType.PlanarDeck).get(0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the planes in the argument and puts them face up in the command zone.
|
||||
* Then runs triggers.
|
||||
*
|
||||
* @param destinations The planes to planeswalk to.
|
||||
*/
|
||||
public void planeswalkTo(final List<Card> destinations)
|
||||
{
|
||||
|
||||
currentPlane = getZone(ZoneType.PlanarDeck).get(0);
|
||||
currentPlanes = destinations;
|
||||
|
||||
getZone(ZoneType.PlanarDeck).remove(currentPlane);
|
||||
getZone(ZoneType.Command).add(currentPlane);
|
||||
for(Card c : currentPlanes) {
|
||||
getZone(ZoneType.PlanarDeck).remove(c);
|
||||
getZone(ZoneType.Command).add(c);
|
||||
}
|
||||
|
||||
game.setActivePlane(currentPlane);
|
||||
game.setActivePlanes(currentPlanes);
|
||||
//Run PlaneswalkedTo triggers here.
|
||||
HashMap<String,Object> runParams = new HashMap<String,Object>();
|
||||
runParams.put("Card", currentPlane);
|
||||
runParams.put("Card", currentPlanes);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.PlaneswalkedTo, runParams,false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Puts my currently active plane, if any, at the bottom of my planar deck.
|
||||
* Puts my currently active planes, if any, at the bottom of my planar deck.
|
||||
*/
|
||||
public void leaveCurrentPlane()
|
||||
{
|
||||
if(currentPlane != null)
|
||||
if(!currentPlanes.isEmpty())
|
||||
{
|
||||
//Run PlaneswalkedFrom triggers here.
|
||||
HashMap<String,Object> runParams = new HashMap<String,Object>();
|
||||
runParams.put("Card", currentPlane);
|
||||
runParams.put("Card", currentPlanes);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.PlaneswalkedFrom, runParams,false);
|
||||
|
||||
Zone com = game.getZoneOf(currentPlane);
|
||||
com.remove(currentPlane);
|
||||
currentPlane.clearControllers();
|
||||
getZone(ZoneType.PlanarDeck).add(currentPlane);
|
||||
currentPlane = null;
|
||||
for(Card c : currentPlanes) {
|
||||
getZone(ZoneType.Command).remove(c);
|
||||
c.clearControllers();
|
||||
getZone(ZoneType.PlanarDeck).add(c);
|
||||
}
|
||||
currentPlanes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3000,13 +3013,13 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
else
|
||||
{
|
||||
currentPlane = firstPlane;
|
||||
currentPlanes.add(firstPlane);
|
||||
getZone(ZoneType.Command).add(firstPlane);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
game.setActivePlane(currentPlane);
|
||||
game.setActivePlanes(currentPlanes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user