mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TDC] Implement Become the Avalanche
This commit is contained in:
parent
fb173a8543
commit
3c6e055f41
3 changed files with 69 additions and 9 deletions
55
Mage.Sets/src/mage/cards/b/BecomeTheAvalanche.java
Normal file
55
Mage.Sets/src/mage/cards/b/BecomeTheAvalanche.java
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Duration;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BecomeTheAvalanche extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledCreaturePermanent("creature you control with power 4 or greater");
|
||||
|
||||
static {
|
||||
filter.add(new PowerPredicate(ComparisonType.MORE_THAN, 3));
|
||||
}
|
||||
|
||||
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
|
||||
private static final Hint hint = new ValueHint("Creatures you control with power 4 or greater", xValue);
|
||||
|
||||
public BecomeTheAvalanche(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}{G}");
|
||||
|
||||
// Draw a card for each creature you control with power 4 or greater. Then creatures you control get +X/+X until end of turn, where X is the number of cards in your hand.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(xValue));
|
||||
this.getSpellAbility().addEffect(new BoostControlledEffect(
|
||||
CardsInControllerHandCount.ANY, CardsInControllerHandCount.ANY, Duration.EndOfTurn
|
||||
));
|
||||
this.getSpellAbility().addHint(hint);
|
||||
}
|
||||
|
||||
private BecomeTheAvalanche(final BecomeTheAvalanche card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BecomeTheAvalanche copy() {
|
||||
return new BecomeTheAvalanche(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -47,6 +47,7 @@ public final class TarkirDragonstormCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Bastion of Remembrance", 171, Rarity.UNCOMMON, mage.cards.b.BastionOfRemembrance.class));
|
||||
cards.add(new SetCardInfo("Battlefield Forge", 340, Rarity.RARE, mage.cards.b.BattlefieldForge.class));
|
||||
cards.add(new SetCardInfo("Beast Within", 249, Rarity.UNCOMMON, mage.cards.b.BeastWithin.class));
|
||||
cards.add(new SetCardInfo("Become the Avalanche", 43, Rarity.RARE, mage.cards.b.BecomeTheAvalanche.class));
|
||||
cards.add(new SetCardInfo("Beetleback Chief", 205, Rarity.UNCOMMON, mage.cards.b.BeetlebackChief.class));
|
||||
cards.add(new SetCardInfo("Behind the Scenes", 172, Rarity.UNCOMMON, mage.cards.b.BehindTheScenes.class));
|
||||
cards.add(new SetCardInfo("Betor, Ancestor's Voice", 1, Rarity.MYTHIC, mage.cards.b.BetorAncestorsVoice.class));
|
||||
|
|
|
|||
|
|
@ -7,17 +7,21 @@ import mage.abilities.hint.Hint;
|
|||
import mage.abilities.hint.ValueHint;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public enum CardsInControllerHandCount implements DynamicValue {
|
||||
|
||||
ANY(StaticFilters.FILTER_CARD_CARDS),
|
||||
CREATURES(StaticFilters.FILTER_CARD_CREATURES),
|
||||
LANDS(StaticFilters.FILTER_CARD_LANDS);
|
||||
|
||||
FilterCard filter;
|
||||
ValueHint hint;
|
||||
private final FilterCard filter;
|
||||
private final ValueHint hint;
|
||||
|
||||
CardsInControllerHandCount(FilterCard filter) {
|
||||
this.filter = filter;
|
||||
|
|
@ -26,13 +30,13 @@ public enum CardsInControllerHandCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
if (sourceAbility != null) {
|
||||
Player controller = game.getPlayer(sourceAbility.getControllerId());
|
||||
if (controller != null) {
|
||||
return controller.getHand().size();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return Optional
|
||||
.ofNullable(sourceAbility)
|
||||
.map(Controllable::getControllerId)
|
||||
.map(game::getPlayer)
|
||||
.map(Player::getHand)
|
||||
.map(Set::size)
|
||||
.orElse(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue