mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Added Duration "Until your next turn" for continuous effects.
This commit is contained in:
parent
d14921c5c2
commit
09242a40e7
5 changed files with 34 additions and 15 deletions
|
@ -28,20 +28,33 @@
|
|||
|
||||
package mage.abilities.effects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.MageSingleton;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.DomainValue;
|
||||
import mage.abilities.dynamicvalue.common.SignInversionDynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.constants.*;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.Layer;
|
||||
import static mage.constants.Layer.AbilityAddingRemovingEffects_6;
|
||||
import static mage.constants.Layer.ColorChangingEffects_5;
|
||||
import static mage.constants.Layer.ControlChangingEffects_2;
|
||||
import static mage.constants.Layer.CopyEffects_1;
|
||||
import static mage.constants.Layer.PTChangingEffects_7;
|
||||
import static mage.constants.Layer.TextChangingEffects_3;
|
||||
import static mage.constants.Layer.TypeChangingEffects_4;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -57,6 +70,9 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
protected boolean affectedObjectsSet = false;
|
||||
protected List<UUID> objects = new ArrayList<>();
|
||||
protected Map<UUID, Integer> metadata = new HashMap<>();
|
||||
// until your next turn
|
||||
protected int startingTurn;
|
||||
protected UUID startingControllerId;
|
||||
|
||||
public ContinuousEffectImpl(Duration duration, Outcome outcome) {
|
||||
super(outcome);
|
||||
|
@ -160,10 +176,15 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
}
|
||||
}
|
||||
}
|
||||
startingTurn = game.getTurnNum();
|
||||
startingControllerId = source.getControllerId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
if (duration.equals(Duration.UntilYourNextTurn)) {
|
||||
return game.getActivePlayerId().equals(startingControllerId) && game.getTurnNum() != startingTurn;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,7 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
|
|||
}
|
||||
break;
|
||||
case Custom:
|
||||
case UntilYourNextTurn:
|
||||
if (effect.isInactive(ability , game)) {
|
||||
it.remove();
|
||||
}
|
||||
|
|
|
@ -129,11 +129,7 @@ public class SacrificeEffect extends OneShotEffect{
|
|||
} else {
|
||||
sb.append(" sacrifice ");
|
||||
}
|
||||
if (!count.toString().equals("1")) {
|
||||
sb.append(CardUtil.numberToText(count.toString())).append(" ");
|
||||
} else {
|
||||
sb.append("a ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(count.toString(), "a")).append(" ");
|
||||
sb.append(filter.getMessage());
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
|
|
@ -30,14 +30,14 @@ package mage.abilities.effects.common.continious;
|
|||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
|
@ -11,6 +11,7 @@ public enum Duration {
|
|||
WhileOnStack(""),
|
||||
WhileInGraveyard(""),
|
||||
EndOfTurn("until end of turn"),
|
||||
UntilYourNextTurn("until your next turn"),
|
||||
EndOfCombat("until end of combat"),
|
||||
Custom("");
|
||||
|
||||
|
|
Loading…
Reference in a new issue