Skip to content

Commit

Permalink
update text: sacrifice "of their choice"
Browse files Browse the repository at this point in the history
  • Loading branch information
xenohedron committed Nov 30, 2024
1 parent 7292639 commit 729869e
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 69 deletions.
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/c/ClipWings.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package mage.cards.c;

import java.util.UUID;
Expand Down Expand Up @@ -26,7 +25,8 @@ public ClipWings(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}");

// Each opponent sacrifices a creature with flying.
this.getSpellAbility().addEffect(new SacrificeOpponentsEffect(filter));
this.getSpellAbility().addEffect(new SacrificeOpponentsEffect(filter)
.setText("each opponent sacrifices a creature of their choice with flying"));
}

private ClipWings(final ClipWings card) {
Expand Down
52 changes: 6 additions & 46 deletions Mage.Sets/src/mage/cards/g/GravePact.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
package mage.cards.g;

import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetSacrifice;

import java.util.ArrayList;
Expand All @@ -30,8 +25,11 @@ public final class GravePact extends CardImpl {
public GravePact(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{B}{B}");


// Whenever a creature you control dies, each other player sacrifices a creature.
this.addAbility(new GravePactTriggeredAbility());
this.addAbility(new DiesCreatureTriggeredAbility(
new GravePactEffect(), false, StaticFilters.FILTER_CONTROLLED_A_CREATURE
));
}

private GravePact(final GravePact card) {
Expand All @@ -44,49 +42,11 @@ public GravePact copy() {
}
}

class GravePactTriggeredAbility extends TriggeredAbilityImpl {

public GravePactTriggeredAbility() {
super(Zone.BATTLEFIELD, new GravePactEffect());
setTriggerPhrase("Whenever a creature you control dies, ");
this.setLeavesTheBattlefieldTrigger(true);
}

private GravePactTriggeredAbility(final GravePactTriggeredAbility ability) {
super(ability);
}

@Override
public GravePactTriggeredAbility copy() {
return new GravePactTriggeredAbility(this);
}

@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}

@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zoneChangeEvent = (ZoneChangeEvent) event;
if (zoneChangeEvent.isDiesEvent()) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
return permanent != null && permanent.isControlledBy(this.getControllerId()) && permanent.isCreature(game);
}
return false;
}

@Override
public boolean isInUseableZone(Game game, MageObject sourceObject, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, sourceObject, event, game);
}
}

class GravePactEffect extends OneShotEffect {

GravePactEffect() {
super(Outcome.Sacrifice);
this.staticText = "each other player sacrifices a creature";
this.staticText = "each other player sacrifices a creature of their choice";
}

private GravePactEffect(final GravePactEffect effect) {
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/m/MyrkulsEdict.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MyrkulsEdictEffect extends OneShotEffect {

MyrkulsEdictEffect() {
super(Outcome.Benefit);
staticText = "choose an opponent. That player sacrifices a creature";
staticText = "choose an opponent. That player sacrifices a creature of their choice";
}

private MyrkulsEdictEffect(final MyrkulsEdictEffect effect) {
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/r/RampageOfTheValkyries.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class RampageOfTheValkyriesEffect extends OneShotEffect {

RampageOfTheValkyriesEffect() {
super(Outcome.Benefit);
staticText = "each other player sacrifices a creature";
staticText = "each other player sacrifices a creature of their choice";
}

private RampageOfTheValkyriesEffect(final RampageOfTheValkyriesEffect effect) {
Expand Down
3 changes: 2 additions & 1 deletion Mage.Sets/src/mage/cards/r/RunAfoul.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public RunAfoul(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}");

// Target opponent sacrifices a creature with flying.
this.getSpellAbility().addEffect(new SacrificeEffect(filter, 1, "Target opponent"));
this.getSpellAbility().addEffect(new SacrificeEffect(filter, 1, "Target opponent")
.setText("target opponent sacrifices a creature of their choice with flying"));
this.getSpellAbility().addTarget(new TargetOpponent());
}

Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/s/SavraQueenOfTheGolgari.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SavraSacrificeEffect extends OneShotEffect {

SavraSacrificeEffect() {
super(Outcome.Sacrifice);
this.staticText = "each other player sacrifices a creature";
this.staticText = "each other player sacrifices a creature of their choice";
}

private SavraSacrificeEffect(final SavraSacrificeEffect effect) {
Expand Down
6 changes: 4 additions & 2 deletions Mage.Sets/src/mage/cards/s/SporogenicInfection.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public SporogenicInfection(UUID ownerId, CardSetInfo setInfo) {
this.addAbility(new EnchantAbility(auraTarget));

// When Sporogenic Infection enters, target player sacrifices a creature other than enchanted creature.
Ability ability = new EntersBattlefieldTriggeredAbility(new SacrificeEffect(filter, 1, "target player"));
Ability ability = new EntersBattlefieldTriggeredAbility(new SacrificeEffect(filter, 1, "target player")
.setText("target player sacrifices a creature of their choice other than enchanted creature"));
ability.addTarget(new TargetPlayer());
this.addAbility(ability);

Expand Down Expand Up @@ -75,6 +76,7 @@ public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
return !Optional
.ofNullable(input.getSource().getSourcePermanentOrLKI(game))
.map(Permanent::getAttachedTo)
.equals(input.getObject().getId());
.map(input.getObject().getId()::equals)
.orElse(false);
}
}
5 changes: 3 additions & 2 deletions Mage.Sets/src/mage/cards/s/StructuralCollapse.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ public StructuralCollapse(UUID ownerId, CardSetInfo setInfo) {


// Target player sacrifices an artifact and a land. Structural Collapse deals 2 damage to that player.
this.getSpellAbility().addEffect(new SacrificeEffect(new FilterArtifactPermanent(), 1, "Target player"));
this.getSpellAbility().addEffect(new SacrificeEffect(new FilterArtifactPermanent(), 1, "Target player")
.setText("target player sacrifices an artifact"));
this.getSpellAbility().addEffect(new SacrificeEffect(StaticFilters.FILTER_LANDS, 1, "Target player")
.setText("and a land"));
.setText("and a land of their choice"));
this.getSpellAbility().addEffect(new DamageTargetEffect(2, true, "that player"));
this.getSpellAbility().addTarget(new TargetPlayer());
}
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/v/VileMutilator.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public VileMutilator(UUID ownerId, CardSetInfo setInfo) {

// When Vile Mutilator enters, each opponent sacrifices a nontoken enchantment, then sacrifices a nontoken creature.
Ability ability = new EntersBattlefieldTriggeredAbility(new SacrificeOpponentsEffect(filter));
ability.addEffect(new SacrificeOpponentsEffect(filter2).setText(", then sacrifices a nontoken creature"));
ability.addEffect(new SacrificeOpponentsEffect(filter2).setText(", then sacrifices a nontoken creature of their choice"));
this.addAbility(ability);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mage.abilities.effects.common;

import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
Expand All @@ -25,16 +26,6 @@ public DrawDiscardTargetEffect(int cardsToDraw, int cardsToDiscard, boolean rand
this.cardsToDraw = cardsToDraw;
this.cardsToDiscard = cardsToDiscard;
this.random = random;
staticText = new StringBuilder("target player draws ")
.append(CardUtil.numberToText(cardsToDraw, "a"))
.append(" card")
.append(cardsToDraw > 1 ? "s" : "")
.append(", then discards ")
.append(CardUtil.numberToText(cardsToDiscard, "a"))
.append(" card")
.append(cardsToDiscard > 1 ? "s" : "")
.append(random ? " at random" : "")
.toString();
}

private DrawDiscardTargetEffect(final DrawDiscardTargetEffect effect) {
Expand All @@ -59,4 +50,16 @@ public boolean apply(Game game, Ability source) {
}
return false;
}

@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
return getTargetPointer().describeTargets(mode.getTargets(), "that player") + " draws " +
CardUtil.numberToText(cardsToDraw, "a") + " card" + (cardsToDraw > 1 ? "s" : "") +
", then discards " + CardUtil.numberToText(cardsToDiscard, "a") +
" card" + (cardsToDiscard > 1 ? "s" : "") + (random ? " at random" : "");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ private void setText() {
sb.append(' ');
sb.append(filter.getMessage());
}
sb.append(" of their choice");
staticText = sb.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ private void setText() {
if (preText != null) {
sb.append(preText);
}
if (preText != null && (preText.endsWith("player") || preText.endsWith("opponent") || preText.endsWith("controller"))) {
boolean playerSacs = preText != null && (preText.endsWith("player") || preText.endsWith("opponent") || preText.endsWith("controller"));
if (playerSacs) {
sb.append(" sacrifices ");
} else {
if (preText == null || preText.isEmpty()) {
Expand All @@ -107,6 +108,9 @@ private void setText() {
sb.append(" ");
sb.append(filter.getMessage());
}
if (playerSacs && !filter.getMessage().contains("with")) {
sb.append(" of their choice");
}
staticText = sb.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public SacrificeOpponentsUnlessPayEffect(Cost cost, FilterPermanent filter) {
super(Outcome.Sacrifice);
this.cost = cost;
this.filter = filter;
this.staticText = "each opponent sacrifices " + CardUtil.addArticle(filter.getMessage()) + " unless they " + CardUtil.addCostVerb(cost.getText());
this.staticText = "each opponent sacrifices " + CardUtil.addArticle(filter.getMessage()) + " of their choice unless they " + CardUtil.addCostVerb(cost.getText());
}

protected SacrificeOpponentsUnlessPayEffect(final SacrificeOpponentsUnlessPayEffect effect) {
Expand Down

0 comments on commit 729869e

Please sign in to comment.