* Xathrid Gorgon - Fixed that the targeted creatures didn't get colorless.

This commit is contained in:
LevelX2 2013-10-14 20:54:02 +02:00
parent e8d4fd1ead
commit 9d56514085
7 changed files with 67 additions and 26 deletions

View file

@ -59,9 +59,10 @@ public class SenseiGoldenTail extends CardImpl<SenseiGoldenTail> {
this.expansionSetCode = "CHK";
this.subtype.add("Fox");
this.subtype.add("Samurai");
this.color.setWhite(true);
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Bushido 1 (When this blocks or becomes blocked, it gets +1/+1 until end of turn.)
this.addAbility(new BushidoAbility(1));
// {1}{W}, {T}: Put a training counter on target creature.
@ -69,8 +70,8 @@ public class SenseiGoldenTail extends CardImpl<SenseiGoldenTail> {
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
// That creature gains bushido 1 and becomes a Samurai in addition to its other creature types. Activate this ability only any time you could cast a sorcery.
ability.addEffect(new GainAbilityTargetEffect(new BushidoAbility(1),Duration.WhileOnBattlefield));
ability.addEffect(new AddCardSubTypeTargetEffect("Samurai",Duration.WhileOnBattlefield));
ability.addEffect(new GainAbilityTargetEffect(new BushidoAbility(1),Duration.Custom));
ability.addEffect(new AddCardSubTypeTargetEffect("Samurai",Duration.Custom));
this.addAbility(ability);
}

View file

@ -110,7 +110,7 @@ class ThroughTheBreachEffect extends OneShotEffect<ThroughTheBreachEffect> {
if (card != null) {
if (card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId())) {
Permanent permanent = game.getPermanent(card.getId());
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield);
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent.getId()));
game.addEffect(effect, source);
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice boosted " + card.getName());

View file

@ -28,20 +28,26 @@
package mage.sets.magic2013;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continious.AddCardTypeTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.continious.SetCardColorTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -69,9 +75,14 @@ public class XathridGorgon extends CardImpl<XathridGorgon> {
// {2}{B}, {tap}: Put a petrification counter on target creature. It gains defender and becomes a colorless artifact in addition to its other types. Its activated abilities can't be activated.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.PETRIFICATION.createInstance()), new ManaCostsImpl("{2}{B}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
ability.addEffect(new GainAbilityTargetEffect(DefenderAbility.getInstance(), Duration.EndOfGame));
ability.addEffect(new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.EndOfGame));
ability.addTarget(new TargetCreaturePermanent(true));
Effect effect = new GainAbilityTargetEffect(DefenderAbility.getInstance(), Duration.Custom);
effect.setText("It gains defender");
ability.addEffect(effect);
effect = new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.Custom);
effect.setText("and becomes a colorless artifact in addition to its other types");
ability.addEffect(effect);
ability.addEffect(new SetCardColorTargetEffect(new ObjectColor(), Duration.Custom, ""));
ability.addEffect(new XathridGorgonEffect());
this.addAbility(ability);
@ -90,7 +101,7 @@ public class XathridGorgon extends CardImpl<XathridGorgon> {
class XathridGorgonEffect extends ReplacementEffectImpl<XathridGorgonEffect> {
public XathridGorgonEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
super(Duration.Custom, Outcome.Detriment);
staticText = "Its activated abilities can't be activated";
}
@ -115,12 +126,12 @@ class XathridGorgonEffect extends ReplacementEffectImpl<XathridGorgonEffect> {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
if (event.getType().equals(GameEvent.EventType.ACTIVATE_ABILITY) && event.getSourceId().equals(targetPointer.getFirst(game, source))) {
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
if (target != null) {
if (event.getSourceId().equals(target.getId())) {
return true;
}
} else {
this.discard();
}
}
return false;

View file

@ -87,7 +87,7 @@ public class CipherEffect extends OneShotEffect<CipherEffect> {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(true);
if (controller != null && target != null) {
if (controller != null) {
if (target.canChoose(source.getControllerId(), game)
&& controller.chooseUse(outcome, "Cipher this spell to a creature?", game)) {
controller.chooseTarget(outcome, target, source, game);

View file

@ -28,6 +28,7 @@
package mage.abilities.effects.common.continious;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffectImpl;
@ -53,12 +54,22 @@ public class AddCardTypeTargetEffect extends ContinuousEffectImpl<AddCardTypeTar
@Override
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
if (target != null) {
if (!target.getCardType().contains(addedCardType))
target.getCardType().add(addedCardType);
boolean result = false;
for (UUID targetId :targetPointer.getTargets(game, source)) {
Permanent target = game.getPermanent(targetId);
if (target != null) {
if (!target.getCardType().contains(addedCardType)) {
target.getCardType().add(addedCardType);
}
result = true;
}
}
return false;
if (!result) {
if (this.getDuration().equals(Duration.Custom)) {
this.discard();
}
}
return result;
}
@Override
@ -68,6 +79,9 @@ public class AddCardTypeTargetEffect extends ContinuousEffectImpl<AddCardTypeTar
@Override
public String getText(Mode mode) {
if (staticText != null) {
return staticText;
}
StringBuilder sb = new StringBuilder();
sb.append("Target ").append(mode.getTargets().get(0).getTargetName()).append(" becomes ").append(addedCardType.toString()).append(" in addition to its other types until end of turn");
return sb.toString();

View file

@ -108,6 +108,9 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl<GainAbilityTar
}
}
}
if (duration.equals(Duration.Custom) && affectedTargets == 0) {
this.discard();
}
return affectedTargets > 0;
}

View file

@ -29,6 +29,7 @@
*/
package mage.abilities.effects.common.continious;
import java.util.UUID;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Ability;
@ -67,14 +68,22 @@ public class SetCardColorTargetEffect extends ContinuousEffectImpl<SetCardColorT
@Override
public boolean apply(Game game, Ability source) {
MageObject o = game.getObject(targetPointer.getFirst(game, source));
if (o != null) {
if (o instanceof Permanent || o instanceof StackObject) {
o.getColor().setColor(setColor);
boolean result = false;
for (UUID targetId :targetPointer.getTargets(game, source)) {
MageObject o = game.getObject(targetId);
if (o != null) {
if (o instanceof Permanent || o instanceof StackObject) {
o.getColor().setColor(setColor);
result = true;
}
}
}
return false;
if (!result) {
if (this.getDuration().equals(Duration.Custom)) {
this.discard();
}
}
return result;
}
@Override
@ -84,10 +93,13 @@ public class SetCardColorTargetEffect extends ContinuousEffectImpl<SetCardColorT
@Override
public String getText(Mode mode) {
if (staticText != null) {
return staticText;
}
StringBuilder sb = new StringBuilder();
sb.append("Target ").append(mode.getTargets().get(0).getTargetName());
sb.append(" becomes ").append(setColor.getDescription());
sb.append(" ").append(duration.toString());
return sb.toString();
}
}
}