mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
Merge pull request #4772 from spjspj/master
Continuing implementation of Planechase.
This commit is contained in:
commit
91cf3556d4
6 changed files with 141 additions and 10 deletions
|
@ -1077,7 +1077,7 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
// 20180408 - 901.5
|
// 20180408 - 901.5
|
||||||
if (gameOptions.planeChase) {
|
if (gameOptions.planeChase) {
|
||||||
Plane plane = Plane.getRandomPlane();
|
Plane plane = Plane.getRandomPlane();
|
||||||
plane.setControllerId(getActivePlayerId());
|
plane.setControllerId(startingPlayerId);
|
||||||
addPlane(plane, null, getActivePlayerId());
|
addPlane(plane, null, getActivePlayerId());
|
||||||
state.setPlaneChase(this, gameOptions.planeChase);
|
state.setPlaneChase(this, gameOptions.planeChase);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,17 +33,23 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.condition.common.HellbentCondition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
|
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.RollPlanarDieEffect;
|
import mage.abilities.effects.common.RollPlanarDieEffect;
|
||||||
import mage.abilities.effects.common.discard.DiscardHandControllerEffect;
|
import mage.abilities.effects.common.discard.DiscardHandControllerEffect;
|
||||||
|
import mage.constants.Outcome;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
import mage.game.command.Plane;
|
import mage.game.command.Plane;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
import mage.util.CardUtil;
|
||||||
import mage.watchers.common.PlanarRollWatcher;
|
import mage.watchers.common.PlanarRollWatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +63,7 @@ public class AcademyAtTolariaWestPlane extends Plane {
|
||||||
this.setExpansionSetCodeForImage("PCA");
|
this.setExpansionSetCodeForImage("PCA");
|
||||||
|
|
||||||
// At the beginning of your end step, if you have 0 cards in hand, draw seven cards
|
// At the beginning of your end step, if you have 0 cards in hand, draw seven cards
|
||||||
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new DrawCardSourceControllerEffect(7), TargetController.ANY, HellbentCondition.instance, false);
|
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new DrawCardsActivePlayerEffect(7), TargetController.ANY, HellbentAPCondition.instance, false);
|
||||||
this.getAbilities().add(ability);
|
this.getAbilities().add(ability);
|
||||||
|
|
||||||
// Active player can roll the planar die: Whenever you roll {CHAOS}, discard your hand
|
// Active player can roll the planar die: Whenever you roll {CHAOS}, discard your hand
|
||||||
|
@ -77,3 +83,66 @@ public class AcademyAtTolariaWestPlane extends Plane {
|
||||||
this.getAbilities().add(new SimpleStaticAbility(Zone.ALL, new PlanarDieRollCostIncreasingEffect(chaosAbility.getOriginalId())));
|
this.getAbilities().add(new SimpleStaticAbility(Zone.ALL, new PlanarDieRollCostIncreasingEffect(chaosAbility.getOriginalId())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DrawCardsActivePlayerEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
protected DynamicValue amount;
|
||||||
|
|
||||||
|
public DrawCardsActivePlayerEffect(int amount) {
|
||||||
|
this(new StaticValue(amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DrawCardsActivePlayerEffect(DynamicValue amount) {
|
||||||
|
super(Outcome.DrawCard);
|
||||||
|
this.amount = amount.copy();
|
||||||
|
setText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DrawCardsActivePlayerEffect(final DrawCardsActivePlayerEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
this.amount = effect.amount.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DrawCardsActivePlayerEffect copy() {
|
||||||
|
return new DrawCardsActivePlayerEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
if (game.getState().getCurrentPlane() != null) {
|
||||||
|
if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - Academy at Tolaria West")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = game.getPlayer(game.getActivePlayerId());
|
||||||
|
if (player != null) {
|
||||||
|
player.drawCards(amount.calculate(game, source, this), game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setText() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("draw ").append(CardUtil.numberToText(amount.toString())).append(" cards");
|
||||||
|
staticText = sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
enum HellbentAPCondition implements Condition {
|
||||||
|
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
return game.getPlayer(game.getActivePlayerId()).getHand().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "if you have no cards in hand";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -29,15 +29,17 @@ package mage.game.command.planes;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
|
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.RollPlanarDieEffect;
|
import mage.abilities.effects.common.RollPlanarDieEffect;
|
||||||
|
import mage.abilities.effects.common.SkipUntapStepEffect;
|
||||||
import mage.abilities.effects.common.UntapAllControllerEffect;
|
import mage.abilities.effects.common.UntapAllControllerEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
@ -120,11 +122,19 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
// Prevent untap event of creatures of target player
|
// Prevent untap event of creatures of target player
|
||||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP) {
|
if (game.getTurn().getStepType() == PhaseStep.UNTAP) {
|
||||||
|
if (game.getState().getCurrentPlane() != null) {
|
||||||
|
if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - Edge of Malacol")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && filter.match(permanent, game)) {
|
if (permanent != null && filter.match(permanent, game) && permanent.getControllerId() == game.getActivePlayerId()) {
|
||||||
|
UUID oldController = source.getControllerId();
|
||||||
|
source.setControllerId(game.getActivePlayerId());
|
||||||
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(2));
|
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(2));
|
||||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
|
source.setControllerId(oldController);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,11 @@ class HedronFieldsOfAgadeemRestrictionEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
|
if (game.getState().getCurrentPlane() != null) {
|
||||||
|
if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - Hedron Fields of Agadeem")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return filter.match(permanent, source.getSourceId(), source.getControllerId(), game);
|
return filter.match(permanent, source.getSourceId(), source.getControllerId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,18 @@ import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
|
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.RollPlanarDieEffect;
|
import mage.abilities.effects.common.RollPlanarDieEffect;
|
||||||
import mage.abilities.effects.common.SkipUntapStepEffect;
|
|
||||||
import mage.abilities.effects.common.UntapAllControllerEffect;
|
import mage.abilities.effects.common.UntapAllControllerEffect;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
|
import mage.game.Game;
|
||||||
import mage.game.command.Plane;
|
import mage.game.command.Plane;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.watchers.common.PlanarRollWatcher;
|
import mage.watchers.common.PlanarRollWatcher;
|
||||||
|
|
||||||
|
@ -56,7 +60,7 @@ public class TheEonFogPlane extends Plane {
|
||||||
this.setExpansionSetCodeForImage("PCA");
|
this.setExpansionSetCodeForImage("PCA");
|
||||||
|
|
||||||
// All players miss their untap step
|
// All players miss their untap step
|
||||||
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new SkipUntapStepEffect());
|
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new TheEonFogSkipUntapStepEffect(Duration.Custom, true));
|
||||||
this.getAbilities().add(ability);
|
this.getAbilities().add(ability);
|
||||||
|
|
||||||
// Active player can roll the planar die: Whenever you roll {CHAOS}, untap all permanents you control
|
// Active player can roll the planar die: Whenever you roll {CHAOS}, untap all permanents you control
|
||||||
|
@ -76,3 +80,40 @@ public class TheEonFogPlane extends Plane {
|
||||||
this.getAbilities().add(new SimpleStaticAbility(Zone.ALL, new PlanarDieRollCostIncreasingEffect(chaosAbility.getOriginalId())));
|
this.getAbilities().add(new SimpleStaticAbility(Zone.ALL, new PlanarDieRollCostIncreasingEffect(chaosAbility.getOriginalId())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
|
boolean allPlayers = false;
|
||||||
|
|
||||||
|
public TheEonFogSkipUntapStepEffect() {
|
||||||
|
super(Duration.WhileOnBattlefield, Outcome.Neutral, false, false);
|
||||||
|
this.allPlayers = false;
|
||||||
|
staticText = "Players skip their untap steps";
|
||||||
|
}
|
||||||
|
|
||||||
|
public TheEonFogSkipUntapStepEffect(Duration d, boolean allPlayers) {
|
||||||
|
super(d, Outcome.Neutral, false, false);
|
||||||
|
this.allPlayers = allPlayers;
|
||||||
|
staticText = "Players skip their untap steps";
|
||||||
|
}
|
||||||
|
|
||||||
|
public TheEonFogSkipUntapStepEffect(final TheEonFogSkipUntapStepEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
this.allPlayers = effect.allPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TheEonFogSkipUntapStepEffect copy() {
|
||||||
|
return new TheEonFogSkipUntapStepEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
if (game.getState().getCurrentPlane() != null) {
|
||||||
|
if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - The Eon Fog")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return event.getType() == GameEvent.EventType.UNTAP_STEP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -29,14 +29,16 @@ package mage.game.command.planes;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import static jdk.nashorn.internal.objects.NativeRegExp.source;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
|
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||||
import mage.abilities.effects.common.RollPlanarDieEffect;
|
import mage.abilities.effects.common.RollPlanarDieEffect;
|
||||||
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
|
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
|
||||||
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect.HandSizeModification;
|
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect.HandSizeModification;
|
||||||
|
@ -53,6 +55,7 @@ import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.watchers.common.PlanarRollWatcher;
|
import mage.watchers.common.PlanarRollWatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +99,7 @@ public class UndercityReachesPlane extends Plane {
|
||||||
class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl {
|
class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
public UndercityReachesTriggeredAbility() {
|
public UndercityReachesTriggeredAbility() {
|
||||||
super(Zone.COMMAND, new DrawCardSourceControllerEffect(1), true);
|
super(Zone.COMMAND, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UndercityReachesTriggeredAbility(final UndercityReachesTriggeredAbility ability) {
|
public UndercityReachesTriggeredAbility(final UndercityReachesTriggeredAbility ability) {
|
||||||
|
@ -118,6 +121,9 @@ class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (((DamagedPlayerEvent) event).isCombatDamage()) {
|
if (((DamagedPlayerEvent) event).isCombatDamage()) {
|
||||||
Permanent creature = game.getPermanent(event.getSourceId());
|
Permanent creature = game.getPermanent(event.getSourceId());
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
|
Effect effect = new DrawCardTargetEffect(new StaticValue(1), false, true);
|
||||||
|
effect.setTargetPointer(new FixedTarget(creature.getControllerId()));
|
||||||
|
effect.apply(game, null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue