Implemented Biogenic Upgrade

This commit is contained in:
Evan Kranzler 2019-01-04 17:16:27 -05:00
parent 4b15f44fe0
commit fd4b6e84d4
2 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,87 @@
package mage.cards.b;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.effects.common.counter.DistributeCountersEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanentAmount;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BiogenicUpgrade extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("creatures you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
public BiogenicUpgrade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}{G}");
// Distribute three +1/+1 counters among one, two, or three target creatures, then double the number of +1/+1 counters on each of those creatures.
this.getSpellAbility().addEffect(new DistributeCountersEffect(
CounterType.P1P1, 3, false,
"one, two, or three target creatures"
));
this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(3, filter));
}
private BiogenicUpgrade(final BiogenicUpgrade card) {
super(card);
}
@Override
public BiogenicUpgrade copy() {
return new BiogenicUpgrade(this);
}
}
class BiogenicUpgradeEffect extends OneShotEffect {
BiogenicUpgradeEffect() {
super(Outcome.Benefit);
staticText = ", then double the number of +1/+1 counters on each of those creatures.";
}
private BiogenicUpgradeEffect(final BiogenicUpgradeEffect effect) {
super(effect);
}
@Override
public BiogenicUpgradeEffect copy() {
return new BiogenicUpgradeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (UUID permanentId : source.getTargets().get(0).getTargets()) {
Permanent permanent = game.getPermanent(permanentId);
if (permanent == null) {
continue;
}
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(
permanent.getCounters(game).getCount(CounterType.P1P1)
));
effect.setTargetPointer(new FixedTarget(permanent, game));
effect.apply(game, source);
}
return true;
}
}

View file

@ -42,6 +42,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Bankrupt in Blood", 62, Rarity.UNCOMMON, mage.cards.b.BankruptInBlood.class));
cards.add(new SetCardInfo("Basilica Bell-Haunt", 156, Rarity.UNCOMMON, mage.cards.b.BasilicaBellHaunt.class));
cards.add(new SetCardInfo("Bedevil", 157, Rarity.RARE, mage.cards.b.Bedevil.class));
cards.add(new SetCardInfo("Biogenic Upgrade", 123, Rarity.UNCOMMON, mage.cards.b.BiogenicUpgrade.class));
cards.add(new SetCardInfo("Biomancer's Familiar", 158, Rarity.RARE, mage.cards.b.BiomancersFamiliar.class));
cards.add(new SetCardInfo("Blade Juggler", 63, Rarity.COMMON, mage.cards.b.BladeJuggler.class));
cards.add(new SetCardInfo("Blood Crypt", 245, Rarity.RARE, mage.cards.b.BloodCrypt.class));