Implemented Towering Titan

This commit is contained in:
Evan Kranzler 2020-06-18 20:43:07 -04:00
parent 52be5d7a17
commit 40667a207f
2 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,100 @@
package mage.cards.t;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.target.common.TargetControlledPermanent;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ToweringTitan extends CardImpl {
private static final FilterControlledPermanent filter
= new FilterControlledCreaturePermanent("a creature with defender");
static {
filter.add(new AbilityPredicate(DefenderAbility.class));
}
public ToweringTitan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add(SubType.GIANT);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Towering Titan enters the battlefield with X +1/+1 counters on it, where X is the total toughness of other creatures you control.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(
CounterType.P1P1.createInstance(), ToweringTitanCount.instance, false
), "with X +1/+1 counters on it, where X is the total toughness of other creatures you control"));
// Sacrifice a creature with defender: All creatures gain trample until end of turn.
this.addAbility(new SimpleActivatedAbility(
new GainAbilityAllEffect(
TrampleAbility.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE
).setText("All creatures gain trample until end of turn"),
new SacrificeTargetCost(new TargetControlledPermanent(filter))
));
}
private ToweringTitan(final ToweringTitan card) {
super(card);
}
@Override
public ToweringTitan copy() {
return new ToweringTitan(this);
}
}
enum ToweringTitanCount implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return game.getBattlefield()
.getActivePermanents(
StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE,
sourceAbility.getControllerId(), sourceAbility.getSourceId(), game
).stream()
.filter(Objects::nonNull)
.map(MageObject::getToughness)
.mapToInt(MageInt::getValue)
.sum();
}
@Override
public ToweringTitanCount copy() {
return null;
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -222,6 +222,7 @@ public final class Jumpstart extends ExpansionSet {
cards.add(new SetCardInfo("Thriving Moor", 37, Rarity.COMMON, mage.cards.t.ThrivingMoor.class));
cards.add(new SetCardInfo("Thundering Spineback", 437, Rarity.UNCOMMON, mage.cards.t.ThunderingSpineback.class));
cards.add(new SetCardInfo("Tithebearer Giant", 284, Rarity.COMMON, mage.cards.t.TithebearerGiant.class));
cards.add(new SetCardInfo("Towering Titan", 31, Rarity.MYTHIC, mage.cards.t.ToweringTitan.class));
cards.add(new SetCardInfo("Ulvenwald Hydra", 439, Rarity.MYTHIC, mage.cards.u.UlvenwaldHydra.class));
cards.add(new SetCardInfo("Vampire Neonate", 285, Rarity.COMMON, mage.cards.v.VampireNeonate.class));
cards.add(new SetCardInfo("Vastwood Zendikon", 440, Rarity.COMMON, mage.cards.v.VastwoodZendikon.class));