Implemented Forge of Heroes

This commit is contained in:
Evan Kranzler 2018-07-23 16:52:50 -04:00
parent 3e82ba4c2f
commit d419fbbae1
2 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,97 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.CommanderPredicate;
import mage.filter.predicate.permanent.EnteredThisTurnPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
/**
*
* @author TheElk801
*/
public final class ForgeOfHeroes extends CardImpl {
private static final FilterPermanent filter
= new FilterPermanent("commander that entered the battlefield this turn");
static {
filter.add(new CommanderPredicate());
filter.add(new EnteredThisTurnPredicate());
}
public ForgeOfHeroes(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {T}: Choose target commander that entered the battlefield this turn. Put a +1/+1 counter on it if it's a creature and a loyalty counter on it if it's a planeswalker.
Ability ability = new SimpleActivatedAbility(
new ForgeOfHeroesEffect(),
new TapSourceCost()
);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
public ForgeOfHeroes(final ForgeOfHeroes card) {
super(card);
}
@Override
public ForgeOfHeroes copy() {
return new ForgeOfHeroes(this);
}
}
class ForgeOfHeroesEffect extends OneShotEffect {
public ForgeOfHeroesEffect() {
super(Outcome.Benefit);
this.staticText = "choose target commander that entered the battlefield this turn. "
+ "Put a +1/+1 counter on it if it's a creature "
+ "and a loyalty counter on it if it's a planeswalker";
}
public ForgeOfHeroesEffect(final ForgeOfHeroesEffect effect) {
super(effect);
}
@Override
public ForgeOfHeroesEffect copy() {
return new ForgeOfHeroesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
if (permanent.isCreature()) {
new AddCountersTargetEffect(
CounterType.P1P1.createInstance()
).apply(game, source);
}
if (permanent.isPlaneswalker()) {
new AddCountersTargetEffect(
CounterType.LOYALTY.createInstance()
).apply(game, source);
}
return true;
}
}

View file

@ -22,6 +22,7 @@ public final class Commander2018 extends ExpansionSet {
cards.add(new SetCardInfo("Chaos Warp", 122, Rarity.RARE, mage.cards.c.ChaosWarp.class)); cards.add(new SetCardInfo("Chaos Warp", 122, Rarity.RARE, mage.cards.c.ChaosWarp.class));
cards.add(new SetCardInfo("Enchanter's Bane", 21, Rarity.RARE, mage.cards.e.EnchantersBane.class)); cards.add(new SetCardInfo("Enchanter's Bane", 21, Rarity.RARE, mage.cards.e.EnchantersBane.class));
cards.add(new SetCardInfo("Forge of Heroes", 58, Rarity.COMMON, mage.cards.f.ForgeOfHeroes.class));
cards.add(new SetCardInfo("Loyal Drake", 10, Rarity.UNCOMMON, mage.cards.l.LoyalDrake.class)); cards.add(new SetCardInfo("Loyal Drake", 10, Rarity.UNCOMMON, mage.cards.l.LoyalDrake.class));
cards.add(new SetCardInfo("Retrofitter Foundry", 57, Rarity.RARE, mage.cards.r.RetrofitterFoundry.class)); cards.add(new SetCardInfo("Retrofitter Foundry", 57, Rarity.RARE, mage.cards.r.RetrofitterFoundry.class));
cards.add(new SetCardInfo("Saheeli's Directive", 26, Rarity.RARE, mage.cards.s.SaheelisDirective.class)); cards.add(new SetCardInfo("Saheeli's Directive", 26, Rarity.RARE, mage.cards.s.SaheelisDirective.class));