mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Some minor changes to framework and existing cards.
This commit is contained in:
parent
def8db4119
commit
eae5b7c61e
4 changed files with 50 additions and 16 deletions
|
@ -41,6 +41,7 @@ import mage.constants.Zone;
|
|||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +61,9 @@ public class PhyrexianDelver extends CardImpl<PhyrexianDelver> {
|
|||
|
||||
// When Phyrexian Delver enters the battlefield, return target creature card from your graveyard to the battlefield. You lose life equal to that card's converted mana cost.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new PhyrexianDelverEffect(), false);
|
||||
ability.addTarget(new TargetCardInYourGraveyard(1, new FilterCreatureCard()));
|
||||
Target target = new TargetCardInYourGraveyard(1, new FilterCreatureCard("creature card from your graveyard"));
|
||||
target.setRequired(true);
|
||||
ability.addTarget(target);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
@ -95,7 +98,10 @@ class PhyrexianDelverEffect extends OneShotEffect<PhyrexianDelverEffect> {
|
|||
Card creatureCard = game.getCard(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (creatureCard != null && controller != null) {
|
||||
boolean result = creatureCard.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
|
||||
boolean result = false;
|
||||
if (game.getState().getZone(creatureCard.getId()).equals(Zone.GRAVEYARD)) {
|
||||
result = controller.putOntoBattlefieldWithInfo(creatureCard, game, Zone.GRAVEYARD, source.getSourceId());
|
||||
}
|
||||
controller.loseLife(creatureCard.getManaCost().convertedManaCost(), game);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RitesOfReaping extends CardImpl<RitesOfReaping> {
|
|||
|
||||
// Target creature gets +3/+3 until end of turn. Another target creature gets -3/-3 until end of turn.
|
||||
this.getSpellAbility().addEffect(new RitesOfReapingEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, true));
|
||||
}
|
||||
|
||||
public RitesOfReaping(final RitesOfReaping card) {
|
||||
|
|
|
@ -89,6 +89,9 @@ public class DamageMultiEffect extends OneShotEffect<DamageMultiEffect> {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{source} deals ").append(amount.toString());
|
||||
sb.append(" damage divided as you choose among any number of target ").append(mode.getTargets().get(0).getTargetName());
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.ObjectColor;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -48,7 +49,20 @@ import mage.game.stack.StackObject;
|
|||
*/
|
||||
public class SetCardColorTargetEffect extends ContinuousEffectImpl<SetCardColorTargetEffect> {
|
||||
|
||||
private ObjectColor setColor;
|
||||
private final ObjectColor setColor;
|
||||
|
||||
/**
|
||||
* Add a color choice to your ability to use this constructor
|
||||
* Effect uses the color choice to set the color to apply
|
||||
*
|
||||
* @param duration
|
||||
*/
|
||||
public SetCardColorTargetEffect(Duration duration) {
|
||||
this(null, duration, null);
|
||||
}
|
||||
public SetCardColorTargetEffect(ObjectColor setColor, Duration duration) {
|
||||
this(setColor, duration, null);
|
||||
}
|
||||
|
||||
public SetCardColorTargetEffect(ObjectColor setColor, Duration duration, String text) {
|
||||
super(duration, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
|
||||
|
@ -56,11 +70,6 @@ public class SetCardColorTargetEffect extends ContinuousEffectImpl<SetCardColorT
|
|||
staticText = text;
|
||||
}
|
||||
|
||||
public SetCardColorTargetEffect(ObjectColor setColor, Duration duration) {
|
||||
super(duration, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
|
||||
this.setColor = setColor;
|
||||
}
|
||||
|
||||
public SetCardColorTargetEffect(final SetCardColorTargetEffect effect) {
|
||||
super(effect);
|
||||
this.setColor = effect.setColor;
|
||||
|
@ -69,12 +78,23 @@ public class SetCardColorTargetEffect extends ContinuousEffectImpl<SetCardColorT
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
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;
|
||||
ObjectColor objectColor = null;
|
||||
if (setColor == null) {
|
||||
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||
if (choice != null && choice.getColor() != null) {
|
||||
objectColor = choice.getColor();
|
||||
}
|
||||
} else {
|
||||
objectColor = this.setColor;
|
||||
}
|
||||
if (objectColor != null) {
|
||||
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(objectColor);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +118,12 @@ public class SetCardColorTargetEffect extends ContinuousEffectImpl<SetCardColorT
|
|||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Target ").append(mode.getTargets().get(0).getTargetName());
|
||||
sb.append(" becomes ").append(setColor.getDescription());
|
||||
sb.append(" becomes ");
|
||||
if (setColor == null) {
|
||||
sb.append("the color of your choice");
|
||||
} else {
|
||||
sb.append(setColor.getDescription());
|
||||
}
|
||||
sb.append(" ").append(duration.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue