* 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

@ -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();
}
}
}