Implemented Branching Evolution

This commit is contained in:
Evan Kranzler 2020-06-23 17:26:42 -04:00
parent b28a9c2ba2
commit 4a6a0e4d42
2 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,86 @@
package mage.cards.b;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BranchingEvolution extends CardImpl {
public BranchingEvolution(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
// If one or more +1/+1 counters would be put a on a creature you control, twice that many +1/+1 counters are put on that creature instead.
this.addAbility(new SimpleStaticAbility(new BranchingEvolutionEffect()));
}
private BranchingEvolution(final BranchingEvolution card) {
super(card);
}
@Override
public BranchingEvolution copy() {
return new BranchingEvolution(this);
}
}
class BranchingEvolutionEffect extends ReplacementEffectImpl {
BranchingEvolutionEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature, false);
staticText = "If one or more +1/+1 counters would be put on a creature you control, " +
"twice that many +1/+1 counters are put on it instead";
}
private BranchingEvolutionEffect(final BranchingEvolutionEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmountForCounters(CardUtil.addWithOverflowCheck(event.getAmount(), event.getAmount()), true);
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ADD_COUNTERS;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getData().equals(CounterType.P1P1.getName()) && event.getAmount() > 0) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null) {
permanent = game.getPermanentEntering(event.getTargetId());
}
return permanent != null && permanent.isControlledBy(source.getControllerId())
&& permanent.isCreature();
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public BranchingEvolutionEffect copy() {
return new BranchingEvolutionEffect(this);
}
}

View file

@ -79,6 +79,7 @@ public final class Jumpstart extends ExpansionSet {
cards.add(new SetCardInfo("Bone Splinters", 213, Rarity.COMMON, mage.cards.b.BoneSplinters.class));
cards.add(new SetCardInfo("Borderland Marauder", 300, Rarity.COMMON, mage.cards.b.BorderlandMarauder.class));
cards.add(new SetCardInfo("Borderland Minotaur", 301, Rarity.COMMON, mage.cards.b.BorderlandMinotaur.class));
cards.add(new SetCardInfo("Branching Evolution", 29, Rarity.RARE, mage.cards.b.BranchingEvolution.class));
cards.add(new SetCardInfo("Brightmare", 2, Rarity.UNCOMMON, mage.cards.b.Brightmare.class));
cards.add(new SetCardInfo("Brindle Shoat", 380, Rarity.UNCOMMON, mage.cards.b.BrindleShoat.class));
cards.add(new SetCardInfo("Brushstrider", 381, Rarity.UNCOMMON, mage.cards.b.Brushstrider.class));