mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +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.filter.common.FilterCreatureCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.target.Target;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
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.
|
// 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 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);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +98,10 @@ class PhyrexianDelverEffect extends OneShotEffect<PhyrexianDelverEffect> {
|
||||||
Card creatureCard = game.getCard(this.getTargetPointer().getFirst(game, source));
|
Card creatureCard = game.getCard(this.getTargetPointer().getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (creatureCard != null && controller != null) {
|
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);
|
controller.loseLife(creatureCard.getManaCost().convertedManaCost(), game);
|
||||||
return result;
|
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.
|
// 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().addEffect(new RitesOfReapingEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2));
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public RitesOfReaping(final RitesOfReaping card) {
|
public RitesOfReaping(final RitesOfReaping card) {
|
||||||
|
|
|
@ -89,6 +89,9 @@ public class DamageMultiEffect extends OneShotEffect<DamageMultiEffect> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText(Mode mode) {
|
public String getText(Mode mode) {
|
||||||
|
if (staticText != null && !staticText.isEmpty()) {
|
||||||
|
return staticText;
|
||||||
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("{source} deals ").append(amount.toString());
|
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());
|
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.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
import mage.choices.ChoiceColor;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -48,7 +49,20 @@ import mage.game.stack.StackObject;
|
||||||
*/
|
*/
|
||||||
public class SetCardColorTargetEffect extends ContinuousEffectImpl<SetCardColorTargetEffect> {
|
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) {
|
public SetCardColorTargetEffect(ObjectColor setColor, Duration duration, String text) {
|
||||||
super(duration, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
|
super(duration, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
|
||||||
|
@ -56,11 +70,6 @@ public class SetCardColorTargetEffect extends ContinuousEffectImpl<SetCardColorT
|
||||||
staticText = text;
|
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) {
|
public SetCardColorTargetEffect(final SetCardColorTargetEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.setColor = effect.setColor;
|
this.setColor = effect.setColor;
|
||||||
|
@ -69,12 +78,23 @@ public class SetCardColorTargetEffect extends ContinuousEffectImpl<SetCardColorT
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID targetId :targetPointer.getTargets(game, source)) {
|
ObjectColor objectColor = null;
|
||||||
MageObject o = game.getObject(targetId);
|
if (setColor == null) {
|
||||||
if (o != null) {
|
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||||
if (o instanceof Permanent || o instanceof StackObject) {
|
if (choice != null && choice.getColor() != null) {
|
||||||
o.getColor().setColor(setColor);
|
objectColor = choice.getColor();
|
||||||
result = true;
|
}
|
||||||
|
} 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();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Target ").append(mode.getTargets().get(0).getTargetName());
|
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());
|
sb.append(" ").append(duration.toString());
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue