text improvements

This commit is contained in:
xenohedron 2024-04-17 20:51:15 -04:00
parent 52530b173d
commit fc3551fc0a
6 changed files with 38 additions and 31 deletions

View file

@ -13,6 +13,7 @@ import mage.constants.*;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.FilterPermanentThisOrAnother;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.game.Game; import mage.game.Game;
@ -27,12 +28,9 @@ import mage.target.targetpointer.FixedTarget;
*/ */
public final class HenryWuInGenGeneticist extends CardImpl { public final class HenryWuInGenGeneticist extends CardImpl {
public static final FilterPermanent filterYourHumans = new FilterCreaturePermanent("Human creatures you control"); private static final FilterPermanent filter = new FilterPermanentThisOrAnother(
new FilterCreaturePermanent(SubType.HUMAN, "Human creatures"), true,
static { "{this} and other Human creatures you control");
filterYourHumans.add(TargetController.YOU.getControllerPredicate());
filterYourHumans.add(SubType.HUMAN.getPredicate());
}
public HenryWuInGenGeneticist(UUID ownerId, CardSetInfo setInfo) { public HenryWuInGenGeneticist(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{G}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{G}{U}");
@ -44,8 +42,8 @@ public final class HenryWuInGenGeneticist extends CardImpl {
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// Henry Wu, InGen Geneticist and other Human creatures you control have exploit. // Henry Wu, InGen Geneticist and other Human creatures you control have exploit.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect( this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
new ExploitAbility(), Duration.WhileOnBattlefield, filterYourHumans))); new ExploitAbility(), Duration.WhileOnBattlefield, filter)));
// Whenever a creature you control exploits a non-Human creature, draw a card. If the exploited creature had power 3 or greater, create a Treasure token. // Whenever a creature you control exploits a non-Human creature, draw a card. If the exploited creature had power 3 or greater, create a Treasure token.
this.addAbility(new HenryWuInGenGeneticistTriggeredAbility()); this.addAbility(new HenryWuInGenGeneticistTriggeredAbility());
@ -89,16 +87,13 @@ class HenryWuInGenGeneticistTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent exploiter = game.getPermanentOrLKIBattlefield(event.getSourceId()); Permanent exploiter = game.getPermanentOrLKIBattlefield(event.getSourceId());
Permanent exploited = game.getPermanentOrLKIBattlefield(event.getTargetId()); Permanent exploited = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (exploiter != null && exploited != null && exploiter.isCreature(game)
if (exploiter == null || exploited == null){
return false;
}
getEffects().setTargetPointer(new FixedTarget(exploited.getId(), game));
return exploiter.isCreature(game)
&& exploiter.isControlledBy(this.getControllerId()) && exploiter.isControlledBy(this.getControllerId())
&& filterNonHumans.match(exploited, getControllerId(), this, game); && filterNonHumans.match(exploited, getControllerId(), this, game)) {
getEffects().setTargetPointer(new FixedTarget(exploited.getId(), game));
return true;
}
return false;
} }
@Override @Override
@ -109,7 +104,7 @@ class HenryWuInGenGeneticistTriggeredAbility extends TriggeredAbilityImpl {
class HenryWuInGenGeneticistEffect extends CreateTokenEffect { class HenryWuInGenGeneticistEffect extends CreateTokenEffect {
public HenryWuInGenGeneticistEffect() { HenryWuInGenGeneticistEffect() {
super(new TreasureToken()); super(new TreasureToken());
staticText = "If the exploited creature had power 3 or greater, create a Treasure token."; staticText = "If the exploited creature had power 3 or greater, create a Treasure token.";
} }

View file

@ -46,7 +46,7 @@ public final class NemesisOfMortals extends CardImpl {
// {7}{G}{G}: Monstrosity 5. This ability costs {1} less to activate for each creature card in your graveyard. // {7}{G}{G}: Monstrosity 5. This ability costs {1} less to activate for each creature card in your graveyard.
this.addAbility(new MonstrosityAbility("{7}{G}{G}", 5, this.addAbility(new MonstrosityAbility("{7}{G}{G}", 5,
NemesisOfMortalsAdjuster.instance, NemesisOfMortalsAdjuster.instance,
"This ability costs {1} less to activate for each creature card in your graveyard")); "This ability costs {1} less to activate for each creature card in your graveyard. "));
} }
private NemesisOfMortals(final NemesisOfMortals card) { private NemesisOfMortals(final NemesisOfMortals card) {

View file

@ -55,14 +55,12 @@ public class AddCountersPlayersEffect extends OneShotEffect {
case ANY: case ANY:
return game.getState().getPlayersInRange(source.getControllerId(), game); return game.getState().getPlayersInRange(source.getControllerId(), game);
case YOU: case YOU:
return Arrays.asList(source.getControllerId()); return Collections.singletonList(source.getControllerId());
case CONTROLLER_ATTACHED_TO: case CONTROLLER_ATTACHED_TO:
List<UUID> list = new ArrayList<>(); List<UUID> list = new ArrayList<>();
Optional.ofNullable(source.getSourcePermanentOrLKI(game)) Optional.ofNullable(source.getSourcePermanentOrLKI(game))
.filter(Objects::nonNull)
.map(Permanent::getAttachedTo) .map(Permanent::getAttachedTo)
.map(game::getControllerId) .map(game::getControllerId)
.filter(Objects::nonNull)
.ifPresent(list::add); .ifPresent(list::add);
return list; return list;
default: default:
@ -102,23 +100,26 @@ public class AddCountersPlayersEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
switch (targetController) { switch (targetController) {
case OPPONENT: case OPPONENT:
sb.append("each opponent gets"); sb.append("each opponent gets ");
break; break;
case ANY: case ANY:
case EACH_PLAYER: case EACH_PLAYER:
sb.append("each player gets"); sb.append("each player gets ");
break; break;
case YOU: case YOU:
sb.append("you get"); sb.append("you get ");
break; break;
case CONTROLLER_ATTACHED_TO: case CONTROLLER_ATTACHED_TO:
sb.append("its controller gets"); sb.append("its controller gets ");
break; break;
default: default:
throw new UnsupportedOperationException(targetController + " not supported"); throw new UnsupportedOperationException(targetController + " not supported");
} }
sb.append(' '); if (amount.toString().equals("X")) {
sb.append(counter.getDescription()); sb.append("X ").append(counter.getName()).append(" counters");
} else {
sb.append(counter.getDescription());
}
return sb.toString(); return sb.toString();
} }
} }

View file

@ -23,7 +23,7 @@ import java.util.UUID;
public class AddCountersTargetEffect extends OneShotEffect { public class AddCountersTargetEffect extends OneShotEffect {
private Counter counter; private Counter counter;
private DynamicValue amount; private final DynamicValue amount;
public AddCountersTargetEffect(Counter counter) { public AddCountersTargetEffect(Counter counter) {
this(counter, counter.getName().equals(CounterType.M1M1.getName()) ? Outcome.UnboostCreature : Outcome.Benefit); this(counter, counter.getName().equals(CounterType.M1M1.getName()) ? Outcome.UnboostCreature : Outcome.Benefit);

View file

@ -14,11 +14,13 @@ public class FilterPermanentThisOrAnother extends FilterPermanent {
public FilterPermanentThisOrAnother(FilterPermanent otherFilter, boolean onlyControlled) { public FilterPermanentThisOrAnother(FilterPermanent otherFilter, boolean onlyControlled) {
this(otherFilter, onlyControlled, generateFilterMessage(otherFilter)); this(otherFilter, onlyControlled, generateFilterMessage(otherFilter));
} }
public FilterPermanentThisOrAnother(FilterPermanent otherFilter, boolean onlyControlled, String name) { public FilterPermanentThisOrAnother(FilterPermanent otherFilter, boolean onlyControlled, String name) {
super(name); super(name);
this.otherFilter = otherFilter; this.otherFilter = otherFilter;
this.onlyControlled = onlyControlled; this.onlyControlled = onlyControlled;
} }
@Override @Override
public boolean match(Permanent permanent, UUID playerId, Ability source, Game game) { public boolean match(Permanent permanent, UUID playerId, Ability source, Game game) {
if (!super.match(permanent, playerId, source, game)) { if (!super.match(permanent, playerId, source, game)) {

View file

@ -916,7 +916,14 @@ public final class CardUtil {
} }
public static String getAddRemoveCountersText(DynamicValue amount, Counter counter, String description, boolean add) { public static String getAddRemoveCountersText(DynamicValue amount, Counter counter, String description, boolean add) {
StringBuilder sb = new StringBuilder(add ? "put " : "remove "); boolean targetPlayerGets = add && (description.endsWith("player") || description.endsWith("opponent"));
StringBuilder sb = new StringBuilder();
if (targetPlayerGets) {
sb.append(description);
sb.append(" gets ");
} else {
sb.append(add ? "put " : "remove ");
}
boolean xValue = amount.toString().equals("X"); boolean xValue = amount.toString().equals("X");
if (xValue) { if (xValue) {
sb.append("X ").append(counter.getName()).append(" counters"); sb.append("X ").append(counter.getName()).append(" counters");
@ -925,7 +932,9 @@ public final class CardUtil {
} else { } else {
sb.append(counter.getDescription()); sb.append(counter.getDescription());
} }
sb.append(add ? " on " : " from ").append(description); if (!targetPlayerGets) {
sb.append(add ? " on " : " from ").append(description);
}
if (!amount.getMessage().isEmpty()) { if (!amount.getMessage().isEmpty()) {
sb.append(xValue ? ", where X is " : " for each ").append(amount.getMessage()); sb.append(xValue ? ", where X is " : " for each ").append(amount.getMessage());
} }