Implemented Brine Giant

This commit is contained in:
Evan Kranzler 2019-12-30 16:58:38 -05:00
parent 11147ba7b4
commit 764fb28fb4
2 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,86 @@
package mage.cards.b;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BrineGiant extends CardImpl {
private static final DynamicValue xValue
= new PermanentsOnBattlefieldCount(BrineGiantCostReductionEffect.filter);
public BrineGiant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{U}");
this.subtype.add(SubType.GIANT);
this.power = new MageInt(5);
this.toughness = new MageInt(6);
// This spell costs {1} less to cast for each enchantment you control.
this.addAbility(new SimpleStaticAbility(
Zone.ALL, new BrineGiantCostReductionEffect()
).addHint(new ValueHint("Enchantments you control", xValue)));
}
private BrineGiant(final BrineGiant card) {
super(card);
}
@Override
public BrineGiant copy() {
return new BrineGiant(this);
}
}
class BrineGiantCostReductionEffect extends CostModificationEffectImpl {
static final FilterControlledPermanent filter = new FilterControlledPermanent();
static {
filter.add(new CardTypePredicate(CardType.ENCHANTMENT));
}
BrineGiantCostReductionEffect() {
super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "This spell costs {1} less to cast for each artifact you control";
}
private BrineGiantCostReductionEffect(final BrineGiantCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
int count = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game).size();
if (count > 0) {
CardUtil.reduceCost(abilityToModify, count);
}
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getSourceId().equals(source.getSourceId());
}
@Override
public BrineGiantCostReductionEffect copy() {
return new BrineGiantCostReductionEffect(this);
}
}

View file

@ -30,6 +30,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Ashiok, Nightmare Muse", 208, Rarity.MYTHIC, mage.cards.a.AshiokNightmareMuse.class));
cards.add(new SetCardInfo("Ashiok, Sculptor of Fears", 274, Rarity.MYTHIC, mage.cards.a.AshiokSculptorOfFears.class));
cards.add(new SetCardInfo("Athreos, Shroud-Veiled", 269, Rarity.MYTHIC, mage.cards.a.AthreosShroudVeiled.class));
cards.add(new SetCardInfo("Brine Giant", 44, Rarity.COMMON, mage.cards.b.BrineGiant.class));
cards.add(new SetCardInfo("Commanding Presence", 7, Rarity.UNCOMMON, mage.cards.c.CommandingPresence.class));
cards.add(new SetCardInfo("Daxos, Blessed by the Sun", 9, Rarity.UNCOMMON, mage.cards.d.DaxosBlessedByTheSun.class));
cards.add(new SetCardInfo("Deathbellow War Cry", 294, Rarity.RARE, mage.cards.d.DeathbellowWarCry.class));