Merge origin/master

This commit is contained in:
LevelX2 2018-04-19 12:33:32 +02:00
commit 753e01598a
13 changed files with 147 additions and 21 deletions

View file

@ -0,0 +1,61 @@
/*
* 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.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.game.command.Plane;
/**
* @author spjspj
*/
public class IsStillOnPlaneCondition implements Condition {
private String planeName;
public IsStillOnPlaneCondition(String planeName) {
this.planeName = planeName;
}
public IsStillOnPlaneCondition(IsStillOnPlaneCondition condition) {
this.planeName = condition.planeName;
}
@Override
public boolean apply(Game game, Ability source) {
Plane plane = game.getState().getCurrentPlane();
if (plane != null) {
if (plane.getName().equalsIgnoreCase(planeName)) {
return true;
}
}
return false;
}
}

View file

@ -1078,7 +1078,7 @@ public abstract class GameImpl implements Game, Serializable {
if (gameOptions.planeChase) {
Plane plane = Plane.getRandomPlane();
plane.setControllerId(startingPlayerId);
addPlane(plane, null, getActivePlayerId());
addPlane(plane, null, startingPlayerId);
state.setPlaneChase(this, gameOptions.planeChase);
}
}
@ -1565,14 +1565,14 @@ public abstract class GameImpl implements Game, Serializable {
}
state.addCommandObject(newPlane);
informPlayers("You have planeswalked to " + newPlane.getLogName());
// Fire off the planeswalked event
GameEvent event = new GameEvent(GameEvent.EventType.PLANESWALK, newPlane.getId(), null, newPlane.getId(), 0, true);
if (!replaceEvent(event)) {
GameEvent ge = new GameEvent(GameEvent.EventType.PLANESWALKED, newPlane.getId(), null, newPlane.getId(), 0, true);
fireEvent(ge);
}
return true;
}

View file

@ -110,12 +110,15 @@ class DrawCardsActivePlayerEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
if (game.getState().getCurrentPlane() != null) {
if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - Academy at Tolaria West")) {
Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null) {
return false;
}
if (cPlane != null) {
if (!cPlane.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);
@ -129,7 +132,6 @@ class DrawCardsActivePlayerEffect extends OneShotEffect {
sb.append("draw ").append(CardUtil.numberToText(amount.toString())).append(" cards");
staticText = sb.toString();
}
}
enum HellbentAPCondition implements Condition {

View file

@ -70,7 +70,7 @@ public class AkoumPlane extends Plane {
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));
SimpleStaticAbility ability = new SimpleStaticAbility(Zone.COMMAND, new CastAsThoughItHadFlashAllEffect(Duration.Custom, filterCard, true));
this.getAbilities().add(ability);
// Active player can roll the planar die: Whenever you roll {CHAOS}, destroy target creature that isn't enchanted

View file

@ -103,6 +103,16 @@ class AstralArenaAttackRestrictionEffect extends RestrictionEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null) {
return false;
}
if (cPlane != null) {
if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) {
return false;
}
}
return true;
}
@ -130,6 +140,15 @@ class AstralArenaBlockRestrictionEffect extends RestrictionEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null) {
return false;
}
if (cPlane != null) {
if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) {
return false;
}
}
return true;
}

View file

@ -34,6 +34,7 @@ import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.IsStillOnPlaneCondition;
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
import mage.abilities.condition.common.TargetHasCounterCondition;
import mage.abilities.costs.mana.GenericManaCost;
@ -78,13 +79,19 @@ public class BantPlane extends Plane {
}
private static final String rule = "{this} has indestructible as long as it has a divinity counter on it";
private static final String exaltedRule = "All creatures have exalted";
public BantPlane() {
this.setName("Plane - Bant");
this.setExpansionSetCodeForImage("PCA");
// All creatures have exalted
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new GainAbilityAllEffect(new ExaltedAbility(), Duration.Custom, StaticFilters.FILTER_PERMANENT_CREATURE));
// All creatures have exalted
SimpleStaticAbility ability
= new SimpleStaticAbility(Zone.COMMAND, new ConditionalContinuousEffect(
new GainAbilityAllEffect(new ExaltedAbility(), Duration.Custom, StaticFilters.FILTER_PERMANENT_CREATURE),
new IsStillOnPlaneCondition(this.getName()),
exaltedRule));
this.getAbilities().add(ability);
// Active player can roll the planar die: Whenever you roll {CHAOS}, put a divinity counter on target green, white, or blue creature. That creature gains indestructible for as long as it has a divinity counter on it.

View file

@ -122,8 +122,12 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
// Prevent untap event of creatures of target player
if (game.getTurn().getStepType() == PhaseStep.UNTAP) {
if (game.getState().getCurrentPlane() != null) {
if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - Edge of Malacol")) {
Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null) {
return false;
}
if (cPlane != null) {
if (!cPlane.getName().equalsIgnoreCase("Plane - Edge of Malacol")) {
return false;
}
}

View file

@ -103,6 +103,15 @@ class FieldsOfSummerEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null) {
return false;
}
if (cPlane != null) {
if (!cPlane.getName().equalsIgnoreCase("Plane - Fields of Summer")) {
return false;
}
}
Player controller = game.getPlayer(source.getControllerId());
Player owner = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (owner != null && owner.canRespond() && owner.chooseUse(Outcome.Benefit, "Gain 2 life?", source, game)) {

View file

@ -117,8 +117,12 @@ class HedronFieldsOfAgadeemRestrictionEffect extends RestrictionEffect {
@Override
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")) {
Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null) {
return false;
}
if (cPlane != null) {
if (!cPlane.getName().equalsIgnoreCase("Plane - Hedron Fields of Agadeem")) {
return false;
}
}

View file

@ -66,9 +66,9 @@ public class TheDarkBaronyPlane extends Plane {
this.setName("Plane - The Dark Barony");
this.setExpansionSetCodeForImage("PCA");
// Whenever a nonblack card is put into a player's graveyard from anywhere, that player loses 2 life
// Whenever a nonblack card is put into a player's graveyard from anywhere, that player loses 1 life
Ability ability = new PutCardIntoGraveFromAnywhereAllTriggeredAbility(Zone.COMMAND,
new LoseLifeTargetEffect(2), false, filter, TargetController.ANY, SetTargetPointer.PLAYER);
new LoseLifeTargetEffect(1), false, filter, TargetController.ANY, SetTargetPointer.PLAYER);
this.getAbilities().add(ability);
// Active player can roll the planar die: Whenever you roll {CHAOS}, each player dicards a card

View file

@ -109,8 +109,12 @@ class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl {
@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")) {
Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null) {
return false;
}
if (cPlane != null) {
if (!cPlane.getName().equalsIgnoreCase("Plane - The Eon Fog")) {
return false;
}
}

View file

@ -29,11 +29,12 @@ package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.IsStillOnPlaneCondition;
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect;
import mage.abilities.effects.common.RollPlanarDieEffect;
@ -54,12 +55,17 @@ import mage.watchers.common.PlanarRollWatcher;
*/
public class TrugaJunglePlane extends Plane {
private static final String rule = "All lands have '{t}: Add one mana of any color to your mana pool";
public TrugaJunglePlane() {
this.setName("Plane - Truga Jungle");
this.setExpansionSetCodeForImage("PCA");
// All lands have '{t}: Add one mana of any color to your mana pool"
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new GainAbilityAllEffect(new AnyColorManaAbility(), Duration.Custom, StaticFilters.FILTER_LANDS, false));
SimpleStaticAbility ability
= new SimpleStaticAbility(Zone.COMMAND, new ConditionalContinuousEffect(
new GainAbilityAllEffect(new AnyColorManaAbility(), Duration.Custom, StaticFilters.FILTER_LANDS),
new IsStillOnPlaneCondition(this.getName()),
rule));
this.getAbilities().add(ability);
// Active player can roll the planar die: Whenever you roll {CHAOS}, reveal the top three cards of your libary. Put all land cards revealed this way into your hand the rest on the bottom of your library in any order.

View file

@ -118,6 +118,16 @@ class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null) {
return false;
}
if (cPlane != null) {
if (!cPlane.getName().equalsIgnoreCase("Plane - Undercity Reaches")) {
return false;
}
}
if (((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent creature = game.getPermanent(event.getSourceId());
if (creature != null) {