added some functions to mode implementation
-
package mage.abilities;
import java.io.Serializable;
import java.util.UUID;
+import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects;
+import mage.target.Target;
import mage.target.Targets;
/**
@@ -13,16 +14,23 @@ import mage.target.Targets;
public class Mode implements Serializable {
protected UUID id;
- protected Targets targets;
- protected Effects effects;
+ protected final Targets targets;
+ protected final Effects effects;
public Mode() {
+ this((Effect) null);
+ }
+
+ public Mode(Effect effect) {
this.id = UUID.randomUUID();
this.targets = new Targets();
this.effects = new Effects();
+ if (effect != null) {
+ this.effects.add(effect);
+ }
}
- public Mode(Mode mode) {
+ public Mode(final Mode mode) {
this.id = mode.id;
this.targets = mode.targets.copy();
this.effects = mode.effects.copy();
@@ -44,7 +52,15 @@ public class Mode implements Serializable {
return targets;
}
+ public void addTarget(Target target) {
+ targets.add(target);
+ }
+
public Effects getEffects() {
return effects;
}
+
+ public void addEffect(Effect effect) {
+ effects.add(effect);
+ }
}
