Continuing implementation of Planechase.

This commit is contained in:
spjspj 2018-04-12 11:51:28 +10:00
parent c8b741f0bf
commit 87d19c7d51
8 changed files with 242 additions and 12 deletions

View file

@ -116,7 +116,7 @@ public class RollPlanarDieEffect extends OneShotEffect {
}
try {
effect.apply(game, source);
} catch (UnsupportedOperationException exception) {
} catch (UnsupportedOperationException exception) {
}
if (effect instanceof ContinuousEffect) {
game.addEffect((ContinuousEffect) effect, source);
@ -160,7 +160,6 @@ public class RollPlanarDieEffect extends OneShotEffect {
foundNextPlane = true;
plane.setControllerId(controller.getId());
game.addPlane(plane, null, controller.getId());
game.informPlayers("You have planeswalked to " + plane.getLogName());
}
} catch (Exception ex) {
}
@ -176,7 +175,16 @@ public class RollPlanarDieEffect extends OneShotEffect {
if (!staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder("Roll the planar die");
StringBuilder sb = new StringBuilder("Roll the planar die. If you roll CHAOS, ");
for (int i = 0; i < chaosEffects.size(); i++) {
Effect effect = chaosEffects.get(i);
if (effect != null) {
String emode = effect.getText(mode);
emode = emode.substring(0, 1).toLowerCase() + emode.substring(1);
sb.append(emode);
}
}
sb.append(". If you roll PW, planeswalk to a new plane");
return sb.toString();
}

View file

@ -34,6 +34,7 @@ package mage.constants;
public enum Planes {
PLANE_ACADEMY_AT_TOLARIA_WEST("AcademyAtTolariaWestPlane"),
PLANE_AGYREM("AgyremPlane"),
PLANE_AKOUM("AkoumPlane"),
PLANE_BANT("BantPlane"),
PLANE_EDGE_OF_MALACOL("EdgeOfMalacolPlane"),
PLANE_FEEDING_GROUNDS("FeedingGroundsPlane"),
@ -42,6 +43,7 @@ public enum Planes {
PLANE_LETHE_LAKE("LetheLakePlane"),
PLANE_NAYA("NayaPlane"),
PLANE_THE_DARK_BARONY("TheDarkBaronyPlane"),
PLANE_TAZEEM("TazeemPlane"),
PLANE_THE_EON_FOG("TheEonFogPlane"),
PLANE_TURRI_ISLAND("TurriIslandPlane");

View file

@ -1034,7 +1034,7 @@ public abstract class GameImpl implements Game, Serializable {
watchers.add(new BlockedAttackerWatcher());
watchers.add(new DamageDoneWatcher());
watchers.add(new PlanarRollWatcher());
//20100716 - 103.5
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
Player player = getPlayer(playerId);
@ -1072,10 +1072,12 @@ public abstract class GameImpl implements Game, Serializable {
cardsWithOpeningAction.remove(card);
}
}
// 20180408 - 901.5
if (gameOptions.planeChase) {
addPlane(Plane.getRandomPlane(), null, getActivePlayerId());
Plane plane = Plane.getRandomPlane();
plane.setControllerId(getActivePlayerId());
addPlane(plane, null, getActivePlayerId());
}
}
@ -1544,7 +1546,7 @@ public abstract class GameImpl implements Game, Serializable {
public boolean addPlane(Plane plane, MageObject sourceObject, UUID toPlayerId) {
// Implementing planechase as if it were 901.15. Single Planar Deck Option
// Here, can enforce the world plane restriction (the Grand Melee format may have some impact on this implementation)
// Enforce 'world' rule for planes
for (CommandObject cobject : state.getCommand()) {
if (cobject instanceof Plane) {
@ -1560,6 +1562,7 @@ public abstract class GameImpl implements Game, Serializable {
ability.setSourceId(newPlane.getId());
}
state.addCommandObject(newPlane);
informPlayers("You have planeswalked to " + newPlane.getLogName());
return true;
}

View file

@ -0,0 +1,91 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ..AS IS.. AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.EnchantedPredicate;
import mage.game.command.Plane;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.common.PlanarRollWatcher;
/**
*
* @author spjspj
*/
public class AkoumPlane extends Plane {
private static final FilterCard filterCard = new FilterCard("enchantment spells");
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that isn't enchanted");
static {
filter.add(Predicates.not(new EnchantedPredicate()));
filterCard.add(new CardTypePredicate(CardType.ENCHANTMENT));
}
public AkoumPlane() {
this.setName("Plane - Akoum");
this.setExpansionSetCodeForImage("PCA");
// Players may cast enchantment spells as if they had flash
SimpleStaticAbility ability = new SimpleStaticAbility(Zone.COMMAND, new CastAsThoughItHadFlashAllEffect(Duration.Custom, filterCard, false));
this.getAbilities().add(ability);
// Active player can roll the planar die: Whenever you roll {CHAOS}, destroy target creature that isn't enchanted
Effect chaosEffect = new DestroyTargetEffect(true);
Target chaosTarget = new TargetCreaturePermanent(filter);
List<Effect> chaosEffects = new ArrayList<Effect>();
chaosEffects.add(chaosEffect);
List<Target> chaosTargets = new ArrayList<Target>();
chaosTargets.add(chaosTarget);
ActivateIfConditionActivatedAbility chaosAbility = new ActivateIfConditionActivatedAbility(Zone.COMMAND, new RollPlanarDieEffect(chaosEffects, chaosTargets), new GenericManaCost(0), MainPhaseStackEmptyCondition.instance);
chaosAbility.addWatcher(new PlanarRollWatcher());
this.getAbilities().add(chaosAbility);
chaosAbility.setMayActivate(TargetController.ANY);
this.getAbilities().add(new SimpleStaticAbility(Zone.ALL, new PlanarDieRollCostIncreasingEffect(chaosAbility.getOriginalId())));
}
}

View file

@ -30,6 +30,7 @@ package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
@ -93,6 +94,7 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl {
public EdgeOfMalacolEffect() {
super(Duration.Custom, Outcome.Detriment);
this.staticText = "If a creature you control would untap during your untap step, put two +1/+1 counters on it instead";
}
public EdgeOfMalacolEffect(final EdgeOfMalacolEffect effect) {