mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Fix certain planes by triggering once for each plane left when planeswalking.
This commit is contained in:
@@ -20,6 +20,7 @@ package forge.game.player;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@@ -2291,20 +2292,19 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
* Puts my currently active planes, if any, at the bottom of my planar deck.
|
||||
*/
|
||||
public void leaveCurrentPlane() {
|
||||
if (!currentPlanes.isEmpty()) {
|
||||
for (final Card plane : currentPlanes) {
|
||||
//Run PlaneswalkedFrom triggers here.
|
||||
HashMap<String,Object> runParams = new HashMap<String,Object>();
|
||||
runParams.put("Card", new CardCollection(currentPlanes));
|
||||
final Map<String, Object> runParams = new ImmutableMap.Builder<String, Object>().put("Card", plane).build();
|
||||
game.getTriggerHandler().runTrigger(TriggerType.PlaneswalkedFrom, runParams,false);
|
||||
|
||||
for (Card c : currentPlanes) {
|
||||
game.getZoneOf(c).remove(c);
|
||||
c.clearControllers();
|
||||
getZone(ZoneType.PlanarDeck).add(c);
|
||||
}
|
||||
currentPlanes.clear();
|
||||
}
|
||||
|
||||
for (final Card plane : currentPlanes) {
|
||||
game.getZoneOf(plane).remove(plane);
|
||||
plane.clearControllers();
|
||||
getZone(ZoneType.PlanarDeck).add(plane);
|
||||
}
|
||||
currentPlanes.clear();
|
||||
|
||||
//DBG
|
||||
//System.out.println("CurrentPlanes: " + currentPlanes);
|
||||
//System.out.println("ActivePlanes: " + game.getActivePlanes());
|
||||
|
||||
@@ -26,37 +26,30 @@ public class TriggerPlaneswalkedFrom extends Trigger {
|
||||
public TriggerPlaneswalkedFrom(final Map<String, String> params, final Card host, final boolean intrinsic) {
|
||||
super(params, host, intrinsic);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#performTest(java.util.Map)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean performTest(Map<String, Object> runParams2) {
|
||||
public boolean performTest(final Map<String, Object> runParams2) {
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
for(Card moved : (Iterable<Card>)runParams2.get("Card"))
|
||||
{
|
||||
if (moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
return true;
|
||||
}
|
||||
final Card moved = (Card) runParams2.get("Card");
|
||||
if (moved.isValid(this.mapParams.get("ValidCard").split(","), this
|
||||
.getHostCard().getController(), this.getHostCard())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#setTriggeringObjects(forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
@Override
|
||||
public void setTriggeringObjects(SpellAbility sa) {
|
||||
sa.setTriggeringObject("Cards", this.getRunParams().get("Card"));
|
||||
// The 'Card' triggered object above is actually an array list of the current planes being left,
|
||||
// so the actual source has to be determined differently than usual
|
||||
sa.setTriggeringObject("Source", this.hostCard);
|
||||
public void setTriggeringObjects(final SpellAbility sa) {
|
||||
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user