Implemented Plaza of Harmony

This commit is contained in:
Evan Kranzler 2019-01-10 17:59:47 -05:00
parent 0acf5eeac4
commit acf34f9429
3 changed files with 81 additions and 9 deletions

View file

@ -0,0 +1,62 @@
package mage.cards.p;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.mana.AnyColorLandsProduceManaAbility;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PlazaOfHarmony extends CardImpl {
private static final FilterPermanent filter = new FilterControlledPermanent();
private static final FilterPermanent filter2 = new FilterPermanent(SubType.GATE, "Gate");
static {
filter.add(new SubtypePredicate(SubType.GATE));
}
private static final Condition condition
= new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1);
public PlazaOfHarmony(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// When Plaza of Harmony enters the battlefield, if you control two or more Gates, you gain 3 life.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new GainLifeEffect(3)),
condition, "When {this} enters the battlefield, " +
"if you control two or more Gates, you gain 3 life."
));
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {T}: Add one mana of any type a Gate you control could produce.
this.addAbility(new AnyColorLandsProduceManaAbility(TargetController.YOU, false, filter2));
}
private PlazaOfHarmony(final PlazaOfHarmony card) {
super(card);
}
@Override
public PlazaOfHarmony copy() {
return new PlazaOfHarmony(this);
}
}

View file

@ -134,6 +134,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Persistent Petitioners", 44, Rarity.COMMON, mage.cards.p.PersistentPetitioners.class));
cards.add(new SetCardInfo("Pestilent Spirit", 81, Rarity.RARE, mage.cards.p.PestilentSpirit.class));
cards.add(new SetCardInfo("Pitiless Pontiff", 194, Rarity.UNCOMMON, mage.cards.p.PitilessPontiff.class));
cards.add(new SetCardInfo("Plaza of Harmony", 254, Rarity.RARE, mage.cards.p.PlazaOfHarmony.class));
cards.add(new SetCardInfo("Precognitive Perception", 45, Rarity.RARE, mage.cards.p.PrecognitivePerception.class));
cards.add(new SetCardInfo("Priest of Forgotten Gods", 83, Rarity.RARE, mage.cards.p.PriestOfForgottenGods.class));
cards.add(new SetCardInfo("Prime Speaker Vannifar", 195, Rarity.MYTHIC, mage.cards.p.PrimeSpeakerVannifar.class));

View file

@ -1,8 +1,6 @@
package mage.abilities.mana;
import java.util.ArrayList;
import java.util.List;
import mage.Mana;
import mage.abilities.Abilities;
import mage.abilities.Ability;
@ -20,8 +18,10 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author LevelX2
*/
public class AnyColorLandsProduceManaAbility extends ActivatedManaAbilityImpl {
@ -31,7 +31,11 @@ public class AnyColorLandsProduceManaAbility extends ActivatedManaAbilityImpl {
}
public AnyColorLandsProduceManaAbility(TargetController targetController, boolean onlyColors) {
super(Zone.BATTLEFIELD, new AnyColorLandsProduceManaEffect(targetController, onlyColors), new TapSourceCost());
this(targetController, onlyColors, null);
}
public AnyColorLandsProduceManaAbility(TargetController targetController, boolean onlyColors, FilterPermanent filter) {
super(Zone.BATTLEFIELD, new AnyColorLandsProduceManaEffect(targetController, onlyColors, filter), new TapSourceCost());
}
public AnyColorLandsProduceManaAbility(final AnyColorLandsProduceManaAbility ability) {
@ -62,16 +66,21 @@ class AnyColorLandsProduceManaEffect extends ManaEffect {
private boolean inManaTypeCalculation = false;
public AnyColorLandsProduceManaEffect(TargetController targetController, boolean onlyColors) {
AnyColorLandsProduceManaEffect(TargetController targetController, boolean onlyColors, FilterPermanent filter) {
super();
filter = new FilterLandPermanent();
if (filter == null) {
this.filter = new FilterLandPermanent();
} else {
this.filter = filter.copy();
}
this.onlyColors = onlyColors;
filter.add(new ControllerPredicate(targetController));
this.filter.add(new ControllerPredicate(targetController));
String text = targetController == TargetController.OPPONENT ? "an opponent controls" : "you control";
staticText = "Add one mana of any " + (this.onlyColors ? "color" : "type") + " that a land " + text + " could produce";
staticText = "Add one mana of any " + (this.onlyColors ? "color" : "type") + " that a "
+ (filter == null ? "land " : filter.getMessage() + " ") + text + " could produce";
}
public AnyColorLandsProduceManaEffect(final AnyColorLandsProduceManaEffect effect) {
private AnyColorLandsProduceManaEffect(final AnyColorLandsProduceManaEffect effect) {
super(effect);
this.filter = effect.filter.copy();
this.onlyColors = effect.onlyColors;