mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
* Removed effect's ApplyEffectsAfter functionality. It's now always applied.
This commit is contained in:
parent
d9ede35857
commit
66bd5294e8
36 changed files with 92 additions and 162 deletions
|
|
@ -220,10 +220,8 @@ public abstract class AbilityImpl implements Ability {
|
|||
* too late Example:
|
||||
* {@link org.mage.test.cards.replacement.DryadMilitantTest#testDiesByDestroy testDiesByDestroy}
|
||||
*/
|
||||
if (effect.applyEffectsAfter()) {
|
||||
game.applyEffects();
|
||||
game.getState().getTriggers().checkStateTriggers(game);
|
||||
}
|
||||
game.applyEffects();
|
||||
game.getState().getTriggers().checkStateTriggers(game);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ package mage.abilities.dynamicvalue.common;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.cards.Card;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
|
|
@ -39,37 +38,21 @@ import mage.game.Game;
|
|||
*/
|
||||
public class SweepNumber implements DynamicValue {
|
||||
|
||||
private int zoneChangeCounter = 0;
|
||||
private final String sweepSubtype;
|
||||
private final boolean previousZone;
|
||||
|
||||
public SweepNumber(String sweepSubtype, boolean previousZone) {
|
||||
public SweepNumber(String sweepSubtype) {
|
||||
this.sweepSubtype = sweepSubtype;
|
||||
this.previousZone = previousZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability source, Effect effect) {
|
||||
if (zoneChangeCounter == 0) {
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null) {
|
||||
zoneChangeCounter = card.getZoneChangeCounter(game);
|
||||
if (previousZone) {
|
||||
zoneChangeCounter--;
|
||||
}
|
||||
}
|
||||
}
|
||||
int number = 0;
|
||||
Integer sweepNumber = (Integer) game.getState().getValue(new StringBuilder("sweep").append(source.getSourceId()).append(zoneChangeCounter).toString());
|
||||
if (sweepNumber != null) {
|
||||
number = sweepNumber;
|
||||
}
|
||||
return number;
|
||||
Integer sweepNumber = (Integer) game.getState().getValue("sweep" + source.getSourceId() + game.getState().getZoneChangeCounter(source.getSourceId()));
|
||||
return sweepNumber != null ? sweepNumber : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SweepNumber copy() {
|
||||
return new SweepNumber(sweepSubtype, previousZone);
|
||||
return new SweepNumber(sweepSubtype);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -79,6 +62,6 @@ public class SweepNumber implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return new StringBuilder("the number of ").append(sweepSubtype).append(sweepSubtype.endsWith("s") ? "":"s").append(" returned this way").toString();
|
||||
return "the number of " + sweepSubtype + (sweepSubtype.endsWith("s") ? "" : "s") + " returned this way";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,10 +88,6 @@ public interface Effect extends Serializable {
|
|||
|
||||
Object getValue(String key);
|
||||
|
||||
void setApplyEffectsAfter();
|
||||
|
||||
boolean applyEffectsAfter();
|
||||
|
||||
Effect copy();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,18 +138,4 @@ public abstract class EffectImpl implements Effect {
|
|||
}
|
||||
return values.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* If set, the game.applyEffects() method will be called to apply the
|
||||
* effects before the next effect (of the same ability) will resolve.
|
||||
*/
|
||||
@Override
|
||||
public void setApplyEffectsAfter() {
|
||||
applyEffectsAfter = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyEffectsAfter() {
|
||||
return applyEffectsAfter;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import mage.constants.Duration;
|
|||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -54,15 +55,15 @@ public class BoostControlledEffect extends ContinuousEffectImpl {
|
|||
protected boolean lockedIn = false;
|
||||
|
||||
public BoostControlledEffect(int power, int toughness, Duration duration) {
|
||||
this(power, toughness, duration, new FilterCreaturePermanent("creatures"), false);
|
||||
this(power, toughness, duration, StaticFilters.FILTER_PERMANENT_CREATURES, false);
|
||||
}
|
||||
|
||||
public BoostControlledEffect(DynamicValue power, DynamicValue toughness, Duration duration) {
|
||||
this(power, toughness, duration, new FilterCreaturePermanent("creatures"), false);
|
||||
this(power, toughness, duration, StaticFilters.FILTER_PERMANENT_CREATURES, false);
|
||||
}
|
||||
|
||||
public BoostControlledEffect(int power, int toughness, Duration duration, boolean excludeSource) {
|
||||
this(power, toughness, duration, new FilterCreaturePermanent("creatures"), excludeSource);
|
||||
this(power, toughness, duration, StaticFilters.FILTER_PERMANENT_CREATURES, excludeSource);
|
||||
}
|
||||
|
||||
public BoostControlledEffect(int power, int toughness, Duration duration, FilterCreaturePermanent filter) {
|
||||
|
|
@ -91,7 +92,7 @@ public class BoostControlledEffect extends ContinuousEffectImpl {
|
|||
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
this.filter = filter;
|
||||
this.filter = (filter == null ? StaticFilters.FILTER_PERMANENT_CREATURES : filter);
|
||||
this.excludeSource = excludeSource;
|
||||
this.lockedIn = lockedIn;
|
||||
setText();
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class SweepEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
FilterPermanent filter = new FilterControlledLandPermanent(new StringBuilder("any number of ").append(sweepSubtype).append("s you control").toString());
|
||||
FilterPermanent filter = new FilterControlledLandPermanent("any number of " + sweepSubtype + "s you control");
|
||||
filter.add(new SubtypePredicate(sweepSubtype));
|
||||
Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
|
||||
if (controller.chooseTarget(outcome, target, source, game)) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
|
|
@ -24,8 +24,7 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.abilities.keyword;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
|
@ -41,7 +40,6 @@ import mage.game.events.GameEvent.EventType;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class InspiredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public InspiredAbility(Effect effect) {
|
||||
|
|
@ -73,6 +71,6 @@ public class InspiredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return new StringBuilder("<i>Inspired</i> - Whenever {this} becomes untapped, ").append(super.getRule()).toString();
|
||||
return "<i>Inspired</i> - Whenever {this} becomes untapped, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue