mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Update common effect class text generation (A-C) (#10651)
This commit is contained in:
parent
8fca717e57
commit
3886075dac
23 changed files with 80 additions and 284 deletions
|
|
@ -9,8 +9,6 @@ import mage.game.Game;
|
|||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -69,21 +67,8 @@ public class BecomeBlockedTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
return "that creature becomes blocked";
|
||||
}
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getNumberOfTargets() == 1) {
|
||||
String targetName = target.getTargetName();
|
||||
sb.append("target ").append(targetName).append(" becomes blocked");
|
||||
return sb.toString();
|
||||
}
|
||||
if (target.getMaxNumberOfTargets() != target.getMinNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets()));
|
||||
sb.append(" target ").append(target.getTargetName()).append(" become blocked");
|
||||
return sb.toString();
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "that creature") +
|
||||
(getTargetPointer().isPlural(mode.getTargets()) ? " become " : " becomes ") +
|
||||
"blocked";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -8,7 +7,6 @@ import mage.constants.Duration;
|
|||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -20,7 +18,7 @@ public class CantBeRegeneratedTargetEffect extends ContinuousRuleModifyingEffect
|
|||
super(duration, Outcome.Benefit, false, false);
|
||||
}
|
||||
|
||||
public CantBeRegeneratedTargetEffect(final CantBeRegeneratedTargetEffect effect) {
|
||||
protected CantBeRegeneratedTargetEffect(final CantBeRegeneratedTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -49,10 +47,7 @@ public class CantBeRegeneratedTargetEffect extends ContinuousRuleModifyingEffect
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(getTargetPointer().describeTargets(mode.getTargets(), "it"));
|
||||
sb.append(" can't be regenerated");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
|
|
@ -11,7 +10,6 @@ import mage.constants.TargetController;
|
|||
import mage.filter.FilterObject;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
|
|
@ -24,17 +22,13 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp
|
|||
private final FilterObject filterSource;
|
||||
private final TargetController targetController;
|
||||
|
||||
public CantBeTargetedTargetEffect(FilterObject filterSource, Duration duration) {
|
||||
this(filterSource, duration, TargetController.ANY);
|
||||
}
|
||||
|
||||
public CantBeTargetedTargetEffect(FilterObject filterSource, Duration duration, TargetController targetController) {
|
||||
super(duration, Outcome.Benefit, false, false);
|
||||
this.targetController = targetController;
|
||||
this.filterSource = filterSource;
|
||||
}
|
||||
|
||||
public CantBeTargetedTargetEffect(final CantBeTargetedTargetEffect effect) {
|
||||
protected CantBeTargetedTargetEffect(final CantBeTargetedTargetEffect effect) {
|
||||
super(effect);
|
||||
this.filterSource = effect.filterSource.copy();
|
||||
this.targetController = effect.targetController;
|
||||
|
|
@ -81,10 +75,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(getTargetPointer().describeTargets(mode.getTargets(), "it"));
|
||||
sb.append(" can't be the target of ");
|
||||
sb.append(filterSource.getMessage());
|
||||
if (!duration.toString().isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class ChooseNewTargetsTargetEffect extends OneShotEffect {
|
|||
this.onlyOneTarget = onlyOneTarget;
|
||||
}
|
||||
|
||||
public ChooseNewTargetsTargetEffect(final ChooseNewTargetsTargetEffect effect) {
|
||||
protected ChooseNewTargetsTargetEffect(final ChooseNewTargetsTargetEffect effect) {
|
||||
super(effect);
|
||||
this.forceChange = effect.forceChange;
|
||||
this.onlyOneTarget = effect.onlyOneTarget;
|
||||
|
|
@ -58,11 +58,11 @@ public class ChooseNewTargetsTargetEffect extends OneShotEffect {
|
|||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (forceChange) {
|
||||
sb.append("change the target of target ");
|
||||
sb.append("change the target of ");
|
||||
} else {
|
||||
sb.append("you may choose new targets for target ");
|
||||
sb.append("you may choose new targets for ");
|
||||
}
|
||||
sb.append(mode.getTargets().get(0).getTargetName());
|
||||
sb.append(getTargetPointer().describeTargets(mode.getTargets(), "it"));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class CopyTargetSpellEffect extends OneShotEffect {
|
|||
this.applier = applier;
|
||||
}
|
||||
|
||||
public CopyTargetSpellEffect(final CopyTargetSpellEffect effect) {
|
||||
protected CopyTargetSpellEffect(final CopyTargetSpellEffect effect) {
|
||||
super(effect);
|
||||
this.useLKI = effect.useLKI;
|
||||
this.useController = effect.useController;
|
||||
|
|
@ -104,16 +104,8 @@ public class CopyTargetSpellEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("copy ");
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
} else {
|
||||
sb.append(copyThatSpellName);
|
||||
}
|
||||
if (chooseTargets) {
|
||||
sb.append(". You may choose new targets for the copy");
|
||||
}
|
||||
return sb.toString();
|
||||
return "copy " +
|
||||
getTargetPointer().describeTargets(mode.getTargets(), copyThatSpellName) +
|
||||
(chooseTargets ? ". You may choose new targets for the copy" : "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class CounterTargetAndSearchGraveyardHandLibraryEffect extends SearchTarg
|
|||
super(graveyardExileOptional, searchWhatText, searchForText);
|
||||
}
|
||||
|
||||
public CounterTargetAndSearchGraveyardHandLibraryEffect(final CounterTargetAndSearchGraveyardHandLibraryEffect effect) {
|
||||
protected CounterTargetAndSearchGraveyardHandLibraryEffect(final CounterTargetAndSearchGraveyardHandLibraryEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -65,9 +65,8 @@ public class CounterTargetAndSearchGraveyardHandLibraryEffect extends SearchTarg
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Counter target ").append(mode.getTargets().get(0).getFilter().getMessage()).append(". ");
|
||||
sb.append(CardUtil.getTextWithFirstCharUpperCase(super.getText(mode)));
|
||||
return sb.toString();
|
||||
return "counter " +
|
||||
getTargetPointer().describeTargets(mode.getTargets(), "that spell") + ". " +
|
||||
CardUtil.getTextWithFirstCharUpperCase(super.getText(mode));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -18,7 +17,7 @@ public class CounterTargetEffect extends OneShotEffect {
|
|||
super(Outcome.Detriment);
|
||||
}
|
||||
|
||||
public CounterTargetEffect(final CounterTargetEffect effect) {
|
||||
protected CounterTargetEffect(final CounterTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -43,6 +42,6 @@ public class CounterTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "counter target " + (!mode.getTargets().isEmpty() ? mode.getTargets().get(0).getTargetName() : "spell");
|
||||
return "counter " + getTargetPointer().describeTargets(mode.getTargets(), "that spell");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.token.Token;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.target.targetpointer.FixedTargets;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.functions.CopyApplier;
|
||||
import mage.util.functions.CopyTokenFunction;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
|
@ -60,7 +59,9 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
private final int tokenPower;
|
||||
private final int tokenToughness;
|
||||
private boolean useLKI = false;
|
||||
private PermanentModifier permanentModifier = null;
|
||||
private PermanentModifier permanentModifier = null; // TODO: miss copy constructor? Make serializable?
|
||||
|
||||
// TODO: These constructors are a mess. Copy effects need to be reworked altogether, hopefully clean it up then.
|
||||
|
||||
public CreateTokenCopyTargetEffect(boolean useLKI) {
|
||||
this();
|
||||
|
|
@ -303,19 +304,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
}
|
||||
sb.append("tokens that are copies of ");
|
||||
}
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
throw new UnsupportedOperationException("Using default rule generation of target effect without having a target object");
|
||||
}
|
||||
if (mode.getTargets().get(0).getMinNumberOfTargets() == 0) {
|
||||
sb.append("up to ");
|
||||
sb.append(CardUtil.numberToText(mode.getTargets().get(0).getMaxNumberOfTargets()));
|
||||
sb.append(' ');
|
||||
}
|
||||
String targetName = mode.getTargets().get(0).getTargetName();
|
||||
if (!targetName.startsWith("another target")) {
|
||||
sb.append("target ");
|
||||
}
|
||||
sb.append(targetName);
|
||||
sb.append(getTargetPointer().describeTargets(mode.getTargets(), "it"));
|
||||
|
||||
if (attacking) {
|
||||
sb.append(" that are");
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class CreateTokenTargetEffect extends OneShotEffect {
|
|||
this.attacking = attacking;
|
||||
}
|
||||
|
||||
public CreateTokenTargetEffect(final CreateTokenTargetEffect effect) {
|
||||
protected CreateTokenTargetEffect(final CreateTokenTargetEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
this.token = effect.token.copy();
|
||||
|
|
@ -73,13 +73,7 @@ public class CreateTokenTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
sb.append("that player");
|
||||
} else {
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(getTargetPointer().describeTargets(mode.getTargets(), "that player"));
|
||||
|
||||
sb.append(" creates ");
|
||||
if (amount.toString().equals("1")) {
|
||||
|
|
|
|||
|
|
@ -76,23 +76,9 @@ public class AttacksIfAbleTargetEffect extends RequirementEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("target ");
|
||||
sb.append(mode.getTargets().get(0).getTargetName());
|
||||
switch (this.mustAttacks) {
|
||||
case YOU:
|
||||
sb.append(" attacks you");
|
||||
break;
|
||||
case ANY:
|
||||
default:
|
||||
sb.append(" attacks");
|
||||
break;
|
||||
}
|
||||
if (this.duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn if able");
|
||||
} else {
|
||||
sb.append(" each combat if able");
|
||||
}
|
||||
return sb.toString();
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "it") +
|
||||
(getTargetPointer().isPlural(mode.getTargets()) ? " attack " : " attacks ") +
|
||||
(this.mustAttacks == TargetController.YOU ? "you " : "") +
|
||||
(this.duration == Duration.EndOfTurn ? "this turn if able" : "each combat if able");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class BlocksIfAbleTargetEffect extends RequirementEffect {
|
|||
super(duration);
|
||||
}
|
||||
|
||||
public BlocksIfAbleTargetEffect(final BlocksIfAbleTargetEffect effect) {
|
||||
protected BlocksIfAbleTargetEffect(final BlocksIfAbleTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -53,12 +53,10 @@ public class BlocksIfAbleTargetEffect extends RequirementEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
if (this.duration == Duration.EndOfTurn) {
|
||||
return "target " + mode.getTargets().get(0).getTargetName() + " blocks this turn if able";
|
||||
}
|
||||
else {
|
||||
return "target " + mode.getTargets().get(0).getTargetName() + " blocks each turn if able";
|
||||
}
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "it") +
|
||||
(getTargetPointer().isPlural(mode.getTargets()) ? " block " : " blocks ") +
|
||||
(duration == Duration.EndOfTurn ? "this" : "each" ) +
|
||||
" turn if able";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class CanAttackAsThoughItDidntHaveDefenderTargetEffect extends AsThoughEf
|
|||
super(AsThoughEffectType.ATTACK, duration, Outcome.Benefit);
|
||||
}
|
||||
|
||||
public CanAttackAsThoughItDidntHaveDefenderTargetEffect(final CanAttackAsThoughItDidntHaveDefenderTargetEffect effect) {
|
||||
protected CanAttackAsThoughItDidntHaveDefenderTargetEffect(final CanAttackAsThoughItDidntHaveDefenderTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -45,14 +45,11 @@ public class CanAttackAsThoughItDidntHaveDefenderTargetEffect extends AsThoughEf
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
if (this.duration == Duration.EndOfTurn) {
|
||||
return "target " + mode.getTargets().get(0).getTargetName() + " can attack this turn as though it didn't have defender";
|
||||
} else {
|
||||
return "target " + mode.getTargets().get(0).getTargetName() + " can attack as though it didn't have defender";
|
||||
}
|
||||
} else {
|
||||
throw new UnsupportedOperationException("No target defined");
|
||||
}
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "it") +
|
||||
" can attack " +
|
||||
(duration == Duration.EndOfTurn ? "this turn " : "" ) +
|
||||
"as though" +
|
||||
(getTargetPointer().isPlural(mode.getTargets()) ? " they " : " it ") +
|
||||
"didn't have defender";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class CantAttackTargetEffect extends RestrictionEffect {
|
|||
super(duration);
|
||||
}
|
||||
|
||||
public CantAttackTargetEffect(final CantAttackTargetEffect effect) {
|
||||
protected CantAttackTargetEffect(final CantAttackTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -40,12 +40,9 @@ public class CantAttackTargetEffect extends RestrictionEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
String text = "target " + mode.getTargets().get(0).getTargetName() + " can't attack";
|
||||
if (this.duration == Duration.EndOfTurn) {
|
||||
return text + " this turn";
|
||||
} else if (this.duration == Duration.UntilYourNextTurn) {
|
||||
return text + " until your next turn";
|
||||
}
|
||||
return text;
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "it") +
|
||||
" can't attack" +
|
||||
(duration == Duration.EndOfTurn ? " this turn" : "" ) +
|
||||
(duration == Duration.UntilYourNextTurn ? " until your next turn" : "" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class CantBeBlockedByAllTargetEffect extends RestrictionEffect {
|
|||
this.filterBlockedBy = filterBlockedBy;
|
||||
}
|
||||
|
||||
public CantBeBlockedByAllTargetEffect(final CantBeBlockedByAllTargetEffect effect) {
|
||||
protected CantBeBlockedByAllTargetEffect(final CantBeBlockedByAllTargetEffect effect) {
|
||||
super(effect);
|
||||
this.filterBlockedBy = effect.filterBlockedBy;
|
||||
}
|
||||
|
|
@ -45,8 +45,7 @@ public class CantBeBlockedByAllTargetEffect extends RestrictionEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "target "
|
||||
+ mode.getTargets().get(0).getTargetName()
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "it")
|
||||
+ " can't be blocked "
|
||||
+ (duration == Duration.EndOfTurn ? "this turn " : "")
|
||||
+ (filterBlockedBy.getMessage().startsWith("except by") ? "" : "by ")
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
|
||||
package mage.abilities.effects.common.combat;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CantBeBlockedByOneTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected int amount;
|
||||
|
||||
public CantBeBlockedByOneTargetEffect(int amount) {
|
||||
this(amount, Duration.WhileOnBattlefield);
|
||||
}
|
||||
|
||||
public CantBeBlockedByOneTargetEffect(int amount, Duration duration) {
|
||||
super(duration, Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
staticText = "Target creature can't be blocked except by " + amount + " or more creatures";
|
||||
}
|
||||
|
||||
public CantBeBlockedByOneTargetEffect(final CantBeBlockedByOneTargetEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CantBeBlockedByOneTargetEffect copy() {
|
||||
return new CantBeBlockedByOneTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
for(UUID targetId: getTargetPointer().getTargets(game, source)) {
|
||||
Permanent perm = game.getPermanent(targetId);
|
||||
if (perm != null) {
|
||||
perm.setMinBlockedBy(amount);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.RulesEffects;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ import mage.abilities.effects.RestrictionEffect;
|
|||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
|
|
@ -24,7 +23,7 @@ public class CantBeBlockedByTargetSourceEffect extends RestrictionEffect {
|
|||
super(duration);
|
||||
}
|
||||
|
||||
public CantBeBlockedByTargetSourceEffect(final CantBeBlockedByTargetSourceEffect effect) {
|
||||
protected CantBeBlockedByTargetSourceEffect(final CantBeBlockedByTargetSourceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -48,21 +47,8 @@ public class CantBeBlockedByTargetSourceEffect extends RestrictionEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getNumberOfTargets() > 1) {
|
||||
if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) {
|
||||
sb.append("Up to");
|
||||
}
|
||||
sb.append(target.getMaxNumberOfTargets()).append(" target ");
|
||||
} else {
|
||||
sb.append("Target ");
|
||||
}
|
||||
sb.append(target.getTargetName()).append(" can't block {this}");
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "it") +
|
||||
" can't block {this}" +
|
||||
(duration == Duration.EndOfTurn ? " this turn" : "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ import mage.abilities.effects.RestrictionEffect;
|
|||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
|
|
@ -18,7 +16,7 @@ public class CantBlockTargetEffect extends RestrictionEffect {
|
|||
super(duration);
|
||||
}
|
||||
|
||||
public CantBlockTargetEffect(final CantBlockTargetEffect effect) {
|
||||
protected CantBlockTargetEffect(final CantBlockTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -42,26 +40,8 @@ public class CantBlockTargetEffect extends RestrictionEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) {
|
||||
sb.append("any number of ");
|
||||
} else if (target.getMaxNumberOfTargets() > 1) {
|
||||
if (target.getMinNumberOfTargets() == 0) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' ');
|
||||
}
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
|
||||
sb.append(" can't block");
|
||||
if (this.duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "it") +
|
||||
" can't block" +
|
||||
(duration == Duration.EndOfTurn ? " this turn" : "" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import mage.constants.*;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -71,6 +69,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
this.loseOtherCardTypes = effect.loseOtherCardTypes;
|
||||
this.dependencyTypes.add(DependencyType.BecomeCreature);
|
||||
this.durationRuleAtStart = effect.durationRuleAtStart;
|
||||
this.removeSubtypes = effect.removeSubtypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -184,52 +183,24 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (durationRuleAtStart && duration != Duration.Custom) {
|
||||
if (durationRuleAtStart && !duration.toString().isEmpty()) {
|
||||
sb.append(duration.toString());
|
||||
sb.append(", ");
|
||||
}
|
||||
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getMaxNumberOfTargets() != Integer.MAX_VALUE) {
|
||||
if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
if (target.getMaxNumberOfTargets() == 1) {
|
||||
sb.append("one ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName());
|
||||
if (loseAllAbilities) {
|
||||
sb.append(" lose all their abilities and");
|
||||
}
|
||||
if (target.getMaxNumberOfTargets() != Integer.MAX_VALUE) {
|
||||
sb.append(" each");
|
||||
}
|
||||
sb.append(" become ");
|
||||
} else {
|
||||
sb.append("target ").append(target.getTargetName());
|
||||
if (loseAllAbilities && !keepAbilities) {
|
||||
sb.append(" loses all abilities and");
|
||||
}
|
||||
sb.append(" becomes a ");
|
||||
sb.append(getTargetPointer().describeTargets(mode.getTargets(), "that creature"));
|
||||
sb.append(getTargetPointer().isPlural(mode.getTargets()) ? " each" : "");
|
||||
if (loseAllAbilities && !keepAbilities) {
|
||||
sb.append(getTargetPointer().isPlural(mode.getTargets()) ?
|
||||
" lose all their abilities and" :
|
||||
" loses all abilities and");
|
||||
}
|
||||
sb.append(getTargetPointer().isPlural(mode.getTargets()) ? " become " : " becomes a ");
|
||||
sb.append(token.getDescription());
|
||||
|
||||
if (!durationRuleAtStart && duration != Duration.Custom) {
|
||||
if (!durationRuleAtStart && !duration.toString().isEmpty()) {
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
|
||||
if (addStillALandText) {
|
||||
if (!sb.toString().endsWith("\" ")) {
|
||||
sb.append(". ");
|
||||
}
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
sb.append("They're still lands");
|
||||
} else {
|
||||
sb.append("It's still a land");
|
||||
}
|
||||
sb.append(getTargetPointer().isPlural(mode.getTargets()) ? ". They're still lands" : ". It's still a land");
|
||||
}
|
||||
return sb.toString().replace(" .", ".");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ public class AddPoisonCounterTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "target " + mode.getTargets().get(0).getTargetName() + " gets "
|
||||
+ CardUtil.numberToText(amount, "a") + " poison counter" + (amount > 1 ? "s" : "") + '.';
|
||||
return getTargetPointer().describeTargets(mode.getTargets(), "it") +
|
||||
(getTargetPointer().isPlural(mode.getTargets()) ? " get " : " gets ") +
|
||||
CardUtil.numberToText(amount, "a") + " poison counter" + (amount > 1 ? "s" : "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public abstract class TargetImpl implements Target {
|
|||
sb.append(CardUtil.numberToText(max));
|
||||
sb.append(' ');
|
||||
}
|
||||
if (!isNotTarget() && !getTargetName().contains("target")) {
|
||||
if (!isNotTarget() && !getTargetName().contains("target ") && !getTargetName().endsWith("any target")) {
|
||||
sb.append("target ");
|
||||
}
|
||||
if (isNotTarget() && min == 1 && max == 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue