mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented The Great Henge
This commit is contained in:
parent
e20c5f2da8
commit
c3d141d83c
3 changed files with 114 additions and 4 deletions
110
Mage.Sets/src/mage/cards/t/TheGreatHenge.java
Normal file
110
Mage.Sets/src/mage/cards/t/TheGreatHenge.java
Normal file
|
@ -0,0 +1,110 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TheGreatHenge extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterCreaturePermanent();
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(TokenPredicate.instance));
|
||||
}
|
||||
|
||||
public TheGreatHenge(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{7}{G}{G}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
|
||||
// This spell costs {X} less to cast, where X is the greatest power among creatures you control.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new TheGreatHengeCostReductionEffect()));
|
||||
|
||||
// {T}: Add {G}{G}. You gain 2 life.
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, Mana.GreenMana(2), new TapSourceCost());
|
||||
ability.addEffect(new GainLifeEffect(2).setText("You gain 2 life."));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Whenever a nontoken creature enters the battlefield under your control, put a +1/+1 counter on it and draw a card.
|
||||
ability = new EntersBattlefieldControlledTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
|
||||
filter, false, SetTargetPointer.PERMANENT, "Whenever a nontoken creature " +
|
||||
"enters the battlefield under your control, put a +1/+1 counter on it and draw a card."
|
||||
);
|
||||
ability.addEffect(new DrawCardSourceControllerEffect(1));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private TheGreatHenge(final TheGreatHenge card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheGreatHenge copy() {
|
||||
return new TheGreatHenge(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TheGreatHengeCostReductionEffect extends CostModificationEffectImpl {
|
||||
|
||||
TheGreatHengeCostReductionEffect() {
|
||||
super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
staticText = "This spell costs {X} less to cast, where X is the greatest power among creatures you control";
|
||||
}
|
||||
|
||||
private TheGreatHengeCostReductionEffect(final TheGreatHengeCostReductionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
int reductionAmount = game.getBattlefield()
|
||||
.getAllActivePermanents(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game
|
||||
).stream()
|
||||
.map(Permanent::getPower)
|
||||
.mapToInt(MageInt::getValue)
|
||||
.max()
|
||||
.getAsInt();
|
||||
CardUtil.reduceCost(abilityToModify, reductionAmount);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return abilityToModify instanceof SpellAbility
|
||||
&& abilityToModify.getSourceId().equals(source.getSourceId())
|
||||
&& game.getCard(abilityToModify.getSourceId()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheGreatHengeCostReductionEffect copy() {
|
||||
return new TheGreatHengeCostReductionEffect(this);
|
||||
}
|
||||
}
|
|
@ -215,6 +215,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Taste of Death", 320, Rarity.RARE, mage.cards.t.TasteOfDeath.class));
|
||||
cards.add(new SetCardInfo("Tempting Witch", 108, Rarity.COMMON, mage.cards.t.TemptingWitch.class));
|
||||
cards.add(new SetCardInfo("The Circle of Loyalty", 9, Rarity.MYTHIC, mage.cards.t.TheCircleOfLoyalty.class));
|
||||
cards.add(new SetCardInfo("The Great Henge", 161, Rarity.MYTHIC, mage.cards.t.TheGreatHenge.class));
|
||||
cards.add(new SetCardInfo("The Magic Mirror", 51, Rarity.MYTHIC, mage.cards.t.TheMagicMirror.class));
|
||||
cards.add(new SetCardInfo("The Royal Scions", 199, Rarity.MYTHIC, mage.cards.t.TheRoyalScions.class));
|
||||
cards.add(new SetCardInfo("Thorn Mammoth", 323, Rarity.RARE, mage.cards.t.ThornMammoth.class));
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common.cost;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -7,12 +6,12 @@ import mage.constants.CostModificationType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public class SourceCostReductionForEachCardInGraveyardEffect extends CostModificationEffectImpl {
|
||||
|
@ -20,7 +19,7 @@ public class SourceCostReductionForEachCardInGraveyardEffect extends CostModific
|
|||
private FilterCard filter;
|
||||
|
||||
public SourceCostReductionForEachCardInGraveyardEffect() {
|
||||
this(new FilterCard());
|
||||
this(StaticFilters.FILTER_CARD);
|
||||
}
|
||||
|
||||
public SourceCostReductionForEachCardInGraveyardEffect(FilterCard filter) {
|
||||
|
@ -29,7 +28,7 @@ public class SourceCostReductionForEachCardInGraveyardEffect extends CostModific
|
|||
staticText = "{this} costs {1} less to cast for each " + filter.getMessage() + " in your graveyard";
|
||||
}
|
||||
|
||||
SourceCostReductionForEachCardInGraveyardEffect(SourceCostReductionForEachCardInGraveyardEffect effect) {
|
||||
private SourceCostReductionForEachCardInGraveyardEffect(SourceCostReductionForEachCardInGraveyardEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter.copy();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue