* Serpentine Spike - Fixed that the three targets had not to be different.

This commit is contained in:
LevelX2 2015-10-19 17:45:26 +02:00
parent 75162fc7ce
commit f72ec06ecd
8 changed files with 195 additions and 129 deletions

View file

@ -39,6 +39,7 @@ import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
@ -60,9 +61,23 @@ public class SerpentineSpike extends CardImpl {
this.addAbility(ability);
// Serpentine Spike deals 2 damage to target creature, 3 damage to another target creature, and 4 damage to a third target creature. If a creature dealt damage this way would die this turn, exile it instead.
this.getSpellAbility().addEffect(new SerpentineSpikeEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature (2 damage)")));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature (3 damage)")));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature (4 damage)")));
TargetCreaturePermanent target = new TargetCreaturePermanent(new FilterCreaturePermanent("creature (2 damage)"));
target.setTargetTag(1);
this.getSpellAbility().addTarget(target);
FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature (3 damage)");
filter.add(new AnotherTargetPredicate(2));
target = new TargetCreaturePermanent(filter);
target.setTargetTag(2);
this.getSpellAbility().addTarget(target);
filter = new FilterCreaturePermanent("another target creature (4 damage)");
filter.add(new AnotherTargetPredicate(3));
target = new TargetCreaturePermanent(filter);
target.setTargetTag(3);
this.getSpellAbility().addTarget(target);
Effect effect = new DealtDamageToCreatureBySourceDies(this, Duration.EndOfTurn);
effect.setText("If a creature dealt damage this way would die this turn, exile it instead");
this.getSpellAbility().addEffect(effect);

View file

@ -35,6 +35,8 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.TargetSource;
@ -53,8 +55,15 @@ public class KorChant extends CardImpl {
// All damage that would be dealt this turn to target creature you control by a source of your choice is dealt to another target creature instead.
this.getSpellAbility().addEffect(new KorChantEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addTarget(new KorChantSecondTarget());
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
target.setTargetTag(1);
this.getSpellAbility().addTarget(target);
FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature");
filter.add(new AnotherTargetPredicate(2));
TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter);
target2.setTargetTag(2);
this.getSpellAbility().addTarget(target2);
}
public KorChant(final KorChant card) {
@ -67,33 +76,8 @@ public class KorChant extends CardImpl {
}
}
class KorChantSecondTarget extends TargetCreaturePermanent {
KorChantSecondTarget() {
super();
this.targetName = "another creature";
}
KorChantSecondTarget(final KorChantSecondTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (source.getTargets().get(0).getTargets().contains(id)) {
return false;
}
return super.canTarget(controllerId, id, source, game);
}
@Override
public KorChantSecondTarget copy() {
return new KorChantSecondTarget(this);
}
}
class KorChantEffect extends RedirectionEffect {
protected TargetSource target = new TargetSource();
KorChantEffect() {
@ -121,7 +105,7 @@ class KorChantEffect extends RedirectionEffect {
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(this.getTargetPointer().getFirst(game, source))

View file

@ -44,6 +44,7 @@ import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
@ -66,8 +67,17 @@ public class DroolingGroodion extends CardImpl {
// {2}{B}{G}, Sacrifice a creature: Target creature gets +2/+2 until end of turn. Another target creature gets -2/-2 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DroolingGroodionEffect(), new ManaCostsImpl("{2}{B}{G}"));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true)));
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature (first target)")));
ability.addTarget(new TargetOtherCreaturePermanent(new FilterCreaturePermanent("creature (second target)")));
TargetCreaturePermanent target = new TargetCreaturePermanent(new FilterCreaturePermanent("creature (first target)"));
target.setTargetTag(1);
ability.addTarget(target);
FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature (second target");
filter.add(new AnotherTargetPredicate(2));
target = new TargetCreaturePermanent(filter);
target.setTargetTag(2);
ability.addTarget(target);
this.addAbility(ability);
}
@ -112,28 +122,3 @@ class DroolingGroodionEffect extends ContinuousEffectImpl {
return true;
}
}
class TargetOtherCreaturePermanent extends TargetCreaturePermanent {
public TargetOtherCreaturePermanent(FilterCreaturePermanent filter) {
super(filter);
}
public TargetOtherCreaturePermanent(final TargetOtherCreaturePermanent target) {
super(target);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (source.getTargets().get(0).getTargets().contains(id)) {
return false;
}
return super.canTarget(controllerId, id, source, game);
}
@Override
public TargetOtherCreaturePermanent copy() {
return new TargetOtherCreaturePermanent(this);
}
}

View file

@ -36,29 +36,39 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherTargetPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer;
/**
*
* @author fireshoes
*/
public class Deadshot extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature");
static {
filter.add(new AnotherTargetPredicate(2));
}
public Deadshot(UUID ownerId) {
super(ownerId, 129, "Deadshot", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{R}");
this.expansionSetCode = "TPR";
// Tap target creature.
this.getSpellAbility().addEffect(new TapTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
TargetCreaturePermanent target = new TargetCreaturePermanent();
target.setTargetTag(1);
this.getSpellAbility().addTarget(target);
// It deals damage equal to its power to another target creature.
this.getSpellAbility().addEffect(new DeadshotDamageEffect());
this.getSpellAbility().addTarget(new DeadshotTargetCreaturePermanent(filter));
target = new TargetCreaturePermanent(filter);
target.setTargetTag(2);
this.getSpellAbility().addTarget(target);
}
public Deadshot(final Deadshot card) {
@ -80,6 +90,7 @@ class DeadshotDamageEffect extends OneShotEffect {
public DeadshotDamageEffect(final DeadshotDamageEffect effect) {
super(effect);
this.setTargetPointer(new SecondTargetPointer());
}
@Override
@ -89,10 +100,10 @@ class DeadshotDamageEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent ownCreature = game.getPermanent(source.getFirstTarget());
Permanent ownCreature = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
if (ownCreature != null) {
int damage = ownCreature.getPower().getValue();
Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (targetCreature != null) {
targetCreature.damage(damage, ownCreature.getId(), game, false, true);
return true;
@ -101,27 +112,3 @@ class DeadshotDamageEffect extends OneShotEffect {
return false;
}
}
class DeadshotTargetCreaturePermanent extends TargetCreaturePermanent {
public DeadshotTargetCreaturePermanent(FilterCreaturePermanent filter) {
super(filter);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
if (source.getTargets().getFirstTarget().equals(id)) {
return false;
}
return super.canTarget(id, source, game);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (source.getTargets().getFirstTarget().equals(id)) {
return false;
}
return super.canTarget(controllerId, id, source, game);
}
}