mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
Little fixes and code refactor
This commit is contained in:
parent
c67e937dfb
commit
ab8a4eb26a
8 changed files with 71 additions and 98 deletions
|
|
@ -191,12 +191,8 @@ public final class GuiDisplayUtil {
|
||||||
// counters
|
// counters
|
||||||
if (card.getMageObjectType().canHaveCounters()) {
|
if (card.getMageObjectType().canHaveCounters()) {
|
||||||
java.util.List<CounterView> counters = new ArrayList<>();
|
java.util.List<CounterView> counters = new ArrayList<>();
|
||||||
if (card instanceof PermanentView) {
|
if (card.getCounters() != null) {
|
||||||
if (card.getCounters() != null) {
|
counters.addAll(card.getCounters());
|
||||||
counters = new ArrayList<>(card.getCounters());
|
|
||||||
}
|
|
||||||
} else if (card.getCounters() != null) {
|
|
||||||
counters = new ArrayList<>(card.getCounters());
|
|
||||||
}
|
}
|
||||||
if (!counters.isEmpty()) {
|
if (!counters.isEmpty()) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
@ -406,9 +402,7 @@ public final class GuiDisplayUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String replaceNamesInRule(String rule, String cardName) {
|
private static String replaceNamesInRule(String rule, String cardName) {
|
||||||
String res = rule.replaceAll("\\{this\\}", cardName.isEmpty() ? "this" : cardName);
|
return rule.replaceAll("\\{this\\}", cardName.isEmpty() ? "this" : cardName);
|
||||||
res = res.replaceAll("\\{source\\}", cardName.isEmpty() ? "this" : cardName);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getResourcePath(String image) {
|
private static String getResourcePath(String image) {
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ public class MageServerImpl implements MageServer {
|
||||||
// check if user can create another table
|
// check if user can create another table
|
||||||
int notStartedTables = user.getNumberOfNotStartedTables();
|
int notStartedTables = user.getNumberOfNotStartedTables();
|
||||||
if (notStartedTables > 1) {
|
if (notStartedTables > 1) {
|
||||||
user.showUserMessage("Create table", "You have already " + notStartedTables + " not started table" + (notStartedTables == 1 ? "" : "s") + ". You can't create another.");
|
user.showUserMessage("Create table", "You have already " + notStartedTables + " not started tables. You can't create another.");
|
||||||
throw new MageException("No message");
|
throw new MageException("No message");
|
||||||
}
|
}
|
||||||
// check AI players max
|
// check AI players max
|
||||||
|
|
@ -1102,7 +1102,7 @@ public class MageServerImpl implements MageServer {
|
||||||
execute("removeTable", sessionId, () -> {
|
execute("removeTable", sessionId, () -> {
|
||||||
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
SessionManager.instance.getSession(sessionId).ifPresent(session -> {
|
||||||
UUID userId = session.getUserId();
|
UUID userId = session.getUserId();
|
||||||
TableManager.instance.removeTable(userId, tableId);
|
TableManager.instance.removeTable(userId, tableId); // delete account
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1327,7 +1327,7 @@ public class MageServerImpl implements MageServer {
|
||||||
// check if user can create another table
|
// check if user can create another table
|
||||||
int notStartedTables = user.getNumberOfNotStartedTables();
|
int notStartedTables = user.getNumberOfNotStartedTables();
|
||||||
if (notStartedTables > 1) {
|
if (notStartedTables > 1) {
|
||||||
user.showUserMessage("Create table", "You have already " + notStartedTables + " not started table" + (notStartedTables == 1 ? "" : "s") + ". You can't create another.");
|
user.showUserMessage("Create table", "You have already " + notStartedTables + " not started tables. You can't create another.");
|
||||||
throw new MageException("No message");
|
throw new MageException("No message");
|
||||||
}
|
}
|
||||||
// check if the user itself satisfies the quitRatio requirement.
|
// check if the user itself satisfies the quitRatio requirement.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.t;
|
package mage.cards.t;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.ApprovingObject;
|
import mage.ApprovingObject;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -12,11 +11,7 @@ import mage.abilities.keyword.FlashAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
|
@ -24,10 +19,10 @@ import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author fireshoes
|
* @author fireshoes
|
||||||
*/
|
*/
|
||||||
public final class TorrentialGearhulk extends CardImpl {
|
public final class TorrentialGearhulk extends CardImpl {
|
||||||
|
|
@ -85,23 +80,18 @@ class TorrentialGearhulkEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
|
||||||
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
|
if (controller != null && card != null) {
|
||||||
if (card != null) {
|
if (controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) {
|
||||||
if (controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) {
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
||||||
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
game, true, new ApprovingObject(source, game));
|
||||||
game, true, new ApprovingObject(source, game));
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
if (cardWasCast) {
|
||||||
if (cardWasCast) {
|
ContinuousEffect effect = new TorrentialGearhulkReplacementEffect(card.getId());
|
||||||
ContinuousEffect effect = new TorrentialGearhulkReplacementEffect(card.getId());
|
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));
|
game.addEffect(effect, source);
|
||||||
game.addEffect(effect, source);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (card != null) {
|
|
||||||
Logger.getLogger(TorrentialGearhulkEffect.class).error("Torrential Gearhulk - Instant card without spellAbility : " + card.getName());
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
package mage.abilities.effects;
|
package mage.abilities.effects;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.target.targetpointer.TargetPointer;
|
import mage.target.targetpointer.TargetPointer;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
|
@ -56,42 +57,41 @@ public class Effects extends ArrayList<Effect> {
|
||||||
nextRule = concatPrefix + " " + nextRule;
|
nextRule = concatPrefix + " " + nextRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextRule != null) {
|
|
||||||
//check if nextRule is a new sentence or not.
|
//check if nextRule is a new sentence or not.
|
||||||
if (nextRule.startsWith("and ") || nextRule.startsWith("with ") || nextRule.startsWith("then ")) {
|
if (nextRule.startsWith("and ") || nextRule.startsWith("with ") || nextRule.startsWith("then ")) {
|
||||||
|
endString = " ";
|
||||||
|
} else if (nextRule.startsWith(",") || nextRule.startsWith(" ")) {
|
||||||
|
endString = "";
|
||||||
|
// nextRule determined to be a new sentence, now check ending of lastRule
|
||||||
|
} else if (lastRule != null && lastRule.length() > 3) {
|
||||||
|
//check if lastRule already has appropriate punctuation, if so, add a space.
|
||||||
|
if (lastRule.endsWith(".\"")
|
||||||
|
|| lastRule.endsWith(".)")
|
||||||
|
|| lastRule.endsWith(".)</i>")
|
||||||
|
|| lastRule.endsWith(".")) {
|
||||||
endString = " ";
|
endString = " ";
|
||||||
} else if (nextRule.startsWith(",") || nextRule.startsWith(" ")) {
|
// if lastRule does not have appropriate punctuation, add the default ". "
|
||||||
endString = "";
|
} else if (!lastRule.endsWith(".") && !lastRule.endsWith("<br>")) {
|
||||||
// nextRule determined to be a new sentence, now check ending of lastRule
|
endString = ". ";
|
||||||
} else if (lastRule != null && lastRule.length() > 3) {
|
|
||||||
//check if lastRule already has appropriate punctuation, if so, add a space.
|
|
||||||
if (lastRule.endsWith(".\"")
|
|
||||||
|| lastRule.endsWith(".)")
|
|
||||||
|| lastRule.endsWith(".)</i>")
|
|
||||||
|| lastRule.endsWith(".")) {
|
|
||||||
endString = " ";
|
|
||||||
// if lastRule does not have appropriate punctuation, add the default ". "
|
|
||||||
} else if (!lastRule.endsWith(".") && !lastRule.endsWith("<br>")) {
|
|
||||||
endString = ". ";
|
|
||||||
}
|
|
||||||
if (nextRule.length() > 3) {
|
|
||||||
nextRule = Character.toUpperCase(nextRule.charAt(0)) + nextRule.substring(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (nextRule.length() > 3) {
|
||||||
String currentRule = endString + nextRule;
|
nextRule = Character.toUpperCase(nextRule.charAt(0)) + nextRule.substring(1);
|
||||||
// fix dot in the combined effect like IfDoCost
|
|
||||||
if (sbText.length() > 0 && currentRule.length() > 0) {
|
|
||||||
boolean prevTextEndsWithDot = sbText.charAt(sbText.length() - 1) == '.';
|
|
||||||
boolean currentTextStartsWithDot = currentRule.startsWith(",") || currentRule.startsWith(".");
|
|
||||||
if (prevTextEndsWithDot && currentTextStartsWithDot) {
|
|
||||||
sbText.delete(sbText.length() - 1, sbText.length());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sbText.append(currentRule);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String currentRule = endString + nextRule;
|
||||||
|
// fix dot in the combined effect like IfDoCost
|
||||||
|
if (sbText.length() > 0 && currentRule.length() > 0) {
|
||||||
|
boolean prevTextEndsWithDot = sbText.charAt(sbText.length() - 1) == '.';
|
||||||
|
boolean currentTextStartsWithDot = currentRule.startsWith(",") || currentRule.startsWith(".");
|
||||||
|
if (prevTextEndsWithDot && currentTextStartsWithDot) {
|
||||||
|
sbText.delete(sbText.length() - 1, sbText.length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sbText.append(currentRule);
|
||||||
|
|
||||||
lastRule = nextRule;
|
lastRule = nextRule;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
package mage.abilities.effects.common.continuous;
|
package mage.abilities.effects.common.continuous;
|
||||||
|
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
|
|
@ -16,13 +14,12 @@ import mage.game.permanent.Permanent;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEffect {
|
public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEffect {
|
||||||
private DynamicValue power;
|
private DynamicValue power;
|
||||||
private DynamicValue toughness;
|
private DynamicValue toughness;
|
||||||
private boolean lockedIn;
|
private final boolean lockedIn;
|
||||||
|
|
||||||
public BoostSourceEffect(int power, int toughness, Duration duration) {
|
public BoostSourceEffect(int power, int toughness, Duration duration) {
|
||||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, false);
|
this(StaticValue.get(power), StaticValue.get(toughness), duration, false);
|
||||||
|
|
@ -36,7 +33,7 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff
|
||||||
* @param power
|
* @param power
|
||||||
* @param toughness
|
* @param toughness
|
||||||
* @param duration
|
* @param duration
|
||||||
* @param lockedIn if true, power and toughness will be calculated only once, when the ability resolves
|
* @param lockedIn if true, power and toughness will be calculated only once, when the ability resolves
|
||||||
*/
|
*/
|
||||||
public BoostSourceEffect(DynamicValue power, DynamicValue toughness, Duration duration, boolean lockedIn) {
|
public BoostSourceEffect(DynamicValue power, DynamicValue toughness, Duration duration, boolean lockedIn) {
|
||||||
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
||||||
|
|
@ -94,18 +91,13 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("{this} gets ");
|
sb.append("{this} gets ");
|
||||||
String p = power.toString();
|
String p = power.toString();
|
||||||
if(!p.startsWith("-")) {
|
if (!p.startsWith("-")) {
|
||||||
sb.append('+');
|
sb.append('+');
|
||||||
}
|
}
|
||||||
sb.append(p).append('/');
|
sb.append(p).append('/');
|
||||||
String t = toughness.toString();
|
String t = toughness.toString();
|
||||||
if(!t.startsWith("-")){
|
if (!t.startsWith("-")) {
|
||||||
if(t.startsWith("-")) {
|
sb.append('+');
|
||||||
sb.append('-');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sb.append('+');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sb.append(t);
|
sb.append(t);
|
||||||
if (duration != Duration.WhileOnBattlefield) {
|
if (duration != Duration.WhileOnBattlefield) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.continuous;
|
package mage.abilities.effects.common.continuous;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -25,7 +24,7 @@ public class BoostTargetEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private DynamicValue power;
|
private DynamicValue power;
|
||||||
private DynamicValue toughness;
|
private DynamicValue toughness;
|
||||||
private boolean lockedIn;
|
private final boolean lockedIn;
|
||||||
|
|
||||||
public BoostTargetEffect(int power, int toughness) {
|
public BoostTargetEffect(int power, int toughness) {
|
||||||
this(power, toughness, Duration.EndOfTurn);
|
this(power, toughness, Duration.EndOfTurn);
|
||||||
|
|
@ -104,7 +103,7 @@ public class BoostTargetEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append(" get ");
|
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append(" get ");
|
||||||
} else {
|
} else {
|
||||||
if (!target.getTargetName().toUpperCase(Locale.ENGLISH).startsWith("ANOTHER")) {
|
if (!target.getTargetName().toLowerCase(Locale.ENGLISH).startsWith("another")) {
|
||||||
sb.append("target ");
|
sb.append("target ");
|
||||||
}
|
}
|
||||||
sb.append(target.getTargetName()).append(" gets ");
|
sb.append(target.getTargetName()).append(" gets ");
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
protected Ability ability;
|
protected Ability ability;
|
||||||
// shall a card gain the ability (otherwise permanent)
|
// shall a card gain the ability (otherwise permanent)
|
||||||
private boolean onCard;
|
private final boolean onCard;
|
||||||
|
|
||||||
// Duration until next phase step of player
|
// Duration until next phase step of player
|
||||||
private PhaseStep durationPhaseStep = null;
|
private PhaseStep durationPhaseStep = null;
|
||||||
|
|
@ -140,7 +140,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" gain ");
|
sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" gain ");
|
||||||
} else {
|
} else {
|
||||||
if (!target.getTargetName().toUpperCase(Locale.ENGLISH).startsWith("ANOTHER")) {
|
if (!target.getTargetName().toLowerCase(Locale.ENGLISH).startsWith("another")) {
|
||||||
sb.append("target ");
|
sb.append("target ");
|
||||||
}
|
}
|
||||||
sb.append(target.getTargetName()).append(" gains ");
|
sb.append(target.getTargetName()).append(" gains ");
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
package mage.abilities.effects.common.continuous;
|
package mage.abilities.effects.common.continuous;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Locale;
|
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
|
|
@ -19,16 +15,18 @@ import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private FilterPermanent filter;
|
private final FilterPermanent filter;
|
||||||
private DynamicValue power;
|
private DynamicValue power;
|
||||||
private DynamicValue toughness;
|
private DynamicValue toughness;
|
||||||
private boolean lockedInPT;
|
private final boolean lockedInPT;
|
||||||
|
|
||||||
public SetPowerToughnessAllEffect(int power, int toughness, Duration duration) {
|
public SetPowerToughnessAllEffect(int power, int toughness, Duration duration) {
|
||||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, new FilterCreaturePermanent("Creatures"), true);
|
this(StaticValue.get(power), StaticValue.get(toughness), duration, new FilterCreaturePermanent("Creatures"), true);
|
||||||
|
|
@ -63,7 +61,7 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (affectedObjectsSet) {
|
if (affectedObjectsSet) {
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
affectedObjectList.add(new MageObjectReference(perm, game));
|
affectedObjectList.add(new MageObjectReference(perm, game));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +76,7 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||||
int newPower = power.calculate(game, source, this);
|
int newPower = power.calculate(game, source, this);
|
||||||
int newToughness = toughness.calculate(game, source, this);
|
int newToughness = toughness.calculate(game, source, this);
|
||||||
if (affectedObjectsSet) {
|
if (affectedObjectsSet) {
|
||||||
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext(); ) {
|
||||||
Permanent permanent = it.next().getPermanent(game);
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.getPower().setValue(newPower);
|
permanent.getPower().setValue(newPower);
|
||||||
|
|
@ -88,7 +86,7 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
permanent.getPower().setValue(newPower);
|
permanent.getPower().setValue(newPower);
|
||||||
permanent.getToughness().setValue(newToughness);
|
permanent.getToughness().setValue(newToughness);
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +102,7 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(filter.getMessage());
|
sb.append(filter.getMessage());
|
||||||
if (filter.getMessage().toLowerCase(Locale.ENGLISH).startsWith("Each ")) {
|
if (filter.getMessage().toLowerCase(Locale.ENGLISH).startsWith("each ")) {
|
||||||
sb.append(" has base power and toughness ");
|
sb.append(" has base power and toughness ");
|
||||||
} else {
|
} else {
|
||||||
sb.append(" have base power and toughness ");
|
sb.append(" have base power and toughness ");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue