Fix certain planes by triggering once for each plane left when planeswalking.

This commit is contained in:
elcnesh
2014-12-14 13:08:26 +00:00
parent 50db5c165b
commit 6fb1fd3058
3 changed files with 20 additions and 27 deletions

View File

@@ -20,6 +20,7 @@ package forge.game.player;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; 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. * Puts my currently active planes, if any, at the bottom of my planar deck.
*/ */
public void leaveCurrentPlane() { public void leaveCurrentPlane() {
if (!currentPlanes.isEmpty()) { for (final Card plane : currentPlanes) {
//Run PlaneswalkedFrom triggers here. //Run PlaneswalkedFrom triggers here.
HashMap<String,Object> runParams = new HashMap<String,Object>(); final Map<String, Object> runParams = new ImmutableMap.Builder<String, Object>().put("Card", plane).build();
runParams.put("Card", new CardCollection(currentPlanes));
game.getTriggerHandler().runTrigger(TriggerType.PlaneswalkedFrom, runParams,false); 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 //DBG
//System.out.println("CurrentPlanes: " + currentPlanes); //System.out.println("CurrentPlanes: " + currentPlanes);
//System.out.println("ActivePlanes: " + game.getActivePlanes()); //System.out.println("ActivePlanes: " + game.getActivePlanes());

View File

@@ -30,16 +30,13 @@ public class TriggerPlaneswalkedFrom extends Trigger {
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.card.trigger.Trigger#performTest(java.util.Map) * @see forge.card.trigger.Trigger#performTest(java.util.Map)
*/ */
@SuppressWarnings("unchecked")
@Override @Override
public boolean performTest(Map<String, Object> runParams2) { public boolean performTest(final Map<String, Object> runParams2) {
if (this.mapParams.containsKey("ValidCard")) { if (this.mapParams.containsKey("ValidCard")) {
for(Card moved : (Iterable<Card>)runParams2.get("Card")) final Card moved = (Card) runParams2.get("Card");
{ if (moved.isValid(this.mapParams.get("ValidCard").split(","), this
if (moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(), .getHostCard().getController(), this.getHostCard())) {
this.getHostCard())) { return true;
return true;
}
} }
return false; return false;
} }
@@ -47,16 +44,12 @@ public class TriggerPlaneswalkedFrom extends Trigger {
return true; return true;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.card.trigger.Trigger#setTriggeringObjects(forge.card.spellability.SpellAbility) * @see forge.card.trigger.Trigger#setTriggeringObjects(forge.card.spellability.SpellAbility)
*/ */
@Override @Override
public void setTriggeringObjects(SpellAbility sa) { public void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Cards", this.getRunParams().get("Card")); sa.setTriggeringObject("Card", 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);
} }
} }

View File

@@ -8,7 +8,7 @@ SVar:Eruption:AB$ DamageAll | Cost$ 0 | ValidCards$ Creature,Planeswalker | Vali
T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChaos | TriggerDescription$ Whenever you roll {C}, prevent all damage that planes named CARDNAME would deal this game to permanents you control. T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChaos | TriggerDescription$ Whenever you roll {C}, prevent all damage that planes named CARDNAME would deal this game to permanents you control.
SVar:RolledChaos:AB$ Effect | Cost$ 0 | Name$ Mount Keralia Effect | StaticAbilities$ KeraliaProtection | EffectOwner$ You | Duration$ Permanent | SpellDescription$ Prevent all damage that planes named CARDNAME would deal this game to permanents you control. SVar:RolledChaos:AB$ Effect | Cost$ 0 | Name$ Mount Keralia Effect | StaticAbilities$ KeraliaProtection | EffectOwner$ You | Duration$ Permanent | SpellDescription$ Prevent all damage that planes named CARDNAME would deal this game to permanents you control.
SVar:KeraliaProtection:Mode$ PreventDamage | EffectZone$ Command | Target$ Permanent.YouCtrl | Source$ Plane.namedMount Keralia | Description$ Prevent all damage that planes named Mount Keralia would deal this game to permanents you control. SVar:KeraliaProtection:Mode$ PreventDamage | EffectZone$ Command | Target$ Permanent.YouCtrl | Source$ Plane.namedMount Keralia | Description$ Prevent all damage that planes named Mount Keralia would deal this game to permanents you control.
SVar:KeraliaX:TriggeredSource$CardCounters.PRESSURE SVar:KeraliaX:TriggeredCard$CardCounters.PRESSURE
SVar:AIRollPlanarDieParams:Mode$ Always | LowPriority$ True SVar:AIRollPlanarDieParams:Mode$ Always | LowPriority$ True
SVar:Picture:http://www.wizards.com/global/images/magic/general/mount_keralia.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/mount_keralia.jpg
Oracle:At the beginning of your end step, put a pressure counter on Mount Keralia.\nWhen you planeswalk away from Mount Keralia, it deals damage equal to the number of pressure counters on it to each creature and each planeswalker.\nWhenever you roll {C}, prevent all damage that planes named Mount Keralia would deal this game to permanents you control. Oracle:At the beginning of your end step, put a pressure counter on Mount Keralia.\nWhen you planeswalk away from Mount Keralia, it deals damage equal to the number of pressure counters on it to each creature and each planeswalker.\nWhenever you roll {C}, prevent all damage that planes named Mount Keralia would deal this game to permanents you control.