mirror of
https://github.com/correl/mage.git
synced 2025-01-12 03:00:13 +00:00
added some functions to mode implementation
This commit is contained in:
parent
1a8268889f
commit
e7af7c922a
2 changed files with 23 additions and 10 deletions
|
@ -39,17 +39,14 @@ public final class KnightOfAutumn extends CardImpl {
|
|||
);
|
||||
|
||||
// • Destroy target artifact or enchantment.
|
||||
Mode mode = new Mode();
|
||||
mode.getEffects().add(new DestroyTargetEffect());
|
||||
mode.getTargets().add(new TargetPermanent(
|
||||
Mode mode = new Mode(new DestroyTargetEffect());
|
||||
mode.addTarget(new TargetPermanent(
|
||||
StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT
|
||||
));
|
||||
ability.addMode(mode);
|
||||
|
||||
// • You gain 4 life.
|
||||
mode = new Mode();
|
||||
mode.getEffects().add(new GainLifeEffect(4));
|
||||
ability.addMode(mode);
|
||||
ability.addMode(new Mode(new GainLifeEffect(4)));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue