Merge pull request #4795 from spjspj/master

Fix for BantPlane (Adding in new condition).
This commit is contained in:
spjspj 2018-04-19 17:55:30 +10:00 committed by GitHub
commit 2f3a5add9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 2 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

@ -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.