add essence symbiote

This commit is contained in:
gp66 2020-07-07 13:41:24 -05:00
parent a5e3b93048
commit a30e628b2d

View file

@ -2,10 +2,26 @@ package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.keyword.MutateAbility;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.abilities.Ability;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -13,6 +29,12 @@ import mage.constants.CardType;
*/
public final class EssenceSymbiote extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("creature you control mutates");
static {
filter.add(new AbilityPredicate(MutateAbility.class));
}
public EssenceSymbiote(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
@ -21,6 +43,12 @@ public final class EssenceSymbiote extends CardImpl {
this.toughness = new MageInt(2);
// Whenever a creature you control mutates, put a +1/+1 counter on that creature and you gain 2 life.
Ability ability = new EssenceSymbioteTriggeredAbility(Zone.BATTLEFIELD,
new AddCountersTargetEffect(CounterType.P1P1.createInstance()).setText("put a +1/+1 counter on that creature"),
filter);
// You gain 2 life when Essence Symbiotes ability resolves, even if you cant put a +1/+1 counter on the mutated creature
ability.addEffect(new GainLifeEffect(2).concatBy("and"));
this.addAbility(ability);
}
private EssenceSymbiote(final EssenceSymbiote card) {
@ -32,3 +60,59 @@ public final class EssenceSymbiote extends CardImpl {
return new EssenceSymbiote(this);
}
}
class EssenceSymbioteTriggeredAbility extends TriggeredAbilityImpl {
private final FilterPermanent filter;
public EssenceSymbioteTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter) {
super(zone, effect, false);
this.filter = filter;
}
public EssenceSymbioteTriggeredAbility(final mage.cards.e.EssenceSymbioteTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
}
@Override
public mage.cards.e.EssenceSymbioteTriggeredAbility copy() {
return new mage.cards.e.EssenceSymbioteTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
// TODO: Implement this
//return event.getType() == GameEvent.EventType.CREATURE_MUTATED;
return false;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
// TODO: Implement this
/*
Permanent sourcePermanent = game.getPermanent(event.getSourceId());
Permanent targetPermanent = game.getPermanent(event.getTargetId());
if (sourcePermanent != null && targetPermanent != null) {
Player controller = game.getPlayer(targetPermanent.getControllerId());
if (controller != null
&& event.getTargetId().equals(targetPermanent.getId())
&& controller.getId().equals(sourcePermanent.getControllerId())
&& this.isControlledBy(controller.getId())) {
for (Effect effect : this.getEffects()) {
effect.setValue("targetId", targetPermanent.getId());
effect.setTargetPointer(new FixedTarget(targetPermanent.getId(), targetPermanent.getZoneChangeCounter(game)));
}
return true;
}
}
*/
return false;
}
@Override
public String getRule() {
return "Whenever a creature you control mutates, " + super.getRule();
}
}