mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Idyllic Grange
This commit is contained in:
parent
0d1e29bcc1
commit
275d28d22c
4 changed files with 124 additions and 36 deletions
69
Mage.Sets/src/mage/cards/i/IdyllicGrange.java
Normal file
69
Mage.Sets/src/mage/cards/i/IdyllicGrange.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.EntersBattlefieldUntappedTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.TapSourceEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.abilities.mana.WhiteManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class IdyllicGrange extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledPermanent(SubType.PLAINS);
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
private static final Condition condition
|
||||
= new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.FEWER_THAN, 3);
|
||||
|
||||
public IdyllicGrange(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||
|
||||
this.subtype.add(SubType.PLAINS);
|
||||
|
||||
// ({T}: Add {W}.)
|
||||
this.addAbility(new WhiteManaAbility());
|
||||
|
||||
// Idyllic Grange enters the battlefield tapped unless you control three or more other Plains.
|
||||
this.addAbility(new EntersBattlefieldAbility(
|
||||
new ConditionalOneShotEffect(new TapSourceEffect(), condition),
|
||||
"tapped unless you control three or more other Plains"
|
||||
));
|
||||
|
||||
// When Idyllic Grange enters the battlefield untapped, put a +1/+1 counter on target creature you control.
|
||||
Ability ability = new EntersBattlefieldUntappedTriggeredAbility(
|
||||
new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false
|
||||
);
|
||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private IdyllicGrange(final IdyllicGrange card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IdyllicGrange copy() {
|
||||
return new IdyllicGrange(this);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldUntappedTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
|
@ -16,9 +17,7 @@ import mage.constants.SubType;
|
|||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -30,6 +29,11 @@ public final class WitchsCottage extends CardImpl {
|
|||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledPermanent(SubType.SWAMP);
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
private static final Condition condition
|
||||
= new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.FEWER_THAN, 3);
|
||||
|
||||
|
@ -48,7 +52,13 @@ public final class WitchsCottage extends CardImpl {
|
|||
));
|
||||
|
||||
// When Witch's Cottage enters the battlefield untapped, you may put target creature card from your graveyard on top of your library.
|
||||
this.addAbility(new WitchsCottageTriggeredAbility());
|
||||
Ability ability = new EntersBattlefieldUntappedTriggeredAbility(
|
||||
new PutOnLibraryTargetEffect(true)
|
||||
.setText("put target creature card from your graveyard on top of your library"),
|
||||
true
|
||||
);
|
||||
ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private WitchsCottage(final WitchsCottage card) {
|
||||
|
@ -60,34 +70,3 @@ public final class WitchsCottage extends CardImpl {
|
|||
return new WitchsCottage(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WitchsCottageTriggeredAbility extends EntersBattlefieldTriggeredAbility {
|
||||
|
||||
WitchsCottageTriggeredAbility() {
|
||||
super(new PutOnLibraryTargetEffect(true), true);
|
||||
this.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
|
||||
}
|
||||
|
||||
private WitchsCottageTriggeredAbility(final WitchsCottageTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WitchsCottageTriggeredAbility copy() {
|
||||
return new WitchsCottageTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (!super.checkTrigger(event, game)) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
return permanent != null && permanent.isTapped();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When {this} enters the battlefield untapped, you may put target creature card from your graveyard on top of your library.";
|
||||
}
|
||||
}
|
|
@ -103,6 +103,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Henge Walker", 221, Rarity.COMMON, mage.cards.h.HengeWalker.class));
|
||||
cards.add(new SetCardInfo("Heraldic Banner", 222, Rarity.UNCOMMON, mage.cards.h.HeraldicBanner.class));
|
||||
cards.add(new SetCardInfo("Hypnotic Sprite", 49, Rarity.UNCOMMON, mage.cards.h.HypnoticSprite.class));
|
||||
cards.add(new SetCardInfo("Idyllic Grange", 246, Rarity.COMMON, mage.cards.i.IdyllicGrange.class));
|
||||
cards.add(new SetCardInfo("Inquisitive Puppet", 223, Rarity.UNCOMMON, mage.cards.i.InquisitivePuppet.class));
|
||||
cards.add(new SetCardInfo("Insatiable Appetite", 162, Rarity.COMMON, mage.cards.i.InsatiableAppetite.class));
|
||||
cards.add(new SetCardInfo("Inspiring Veteran", 194, Rarity.UNCOMMON, mage.cards.i.InspiringVeteran.class));
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class EntersBattlefieldUntappedTriggeredAbility extends EntersBattlefieldTriggeredAbility {
|
||||
|
||||
public EntersBattlefieldUntappedTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(effect, optional);
|
||||
}
|
||||
|
||||
private EntersBattlefieldUntappedTriggeredAbility(final EntersBattlefieldUntappedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntersBattlefieldUntappedTriggeredAbility copy() {
|
||||
return new EntersBattlefieldUntappedTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (!super.checkTrigger(event, game)) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
return permanent != null && permanent.isTapped();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When {this} enters the battlefield untapped, " + super.getRule();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue