Included duration for BecomesChosenCreatureTypeSourceEffect

This commit is contained in:
L_J 2018-03-04 10:38:38 +00:00 committed by GitHub
parent d2c39a1339
commit 5bd58ca56e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@ package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -10,17 +11,28 @@ import mage.target.targetpointer.FixedTarget;
public class BecomesChosenCreatureTypeSourceEffect extends OneShotEffect {
private final boolean nonWall;
private final Duration duration;
public BecomesChosenCreatureTypeSourceEffect() {
this(false);
this(false, Duration.EndOfTurn);
}
public BecomesChosenCreatureTypeSourceEffect(boolean nonWall) {
this(nonWall, Duration.EndOfTurn);
}
public BecomesChosenCreatureTypeSourceEffect(boolean nonWall, Duration duration) {
super(Outcome.BoostCreature);
staticText = "{this} becomes the creature type of your choice until end of turn.";
this.nonWall = nonWall;
this.duration = duration;
staticText = "{this} becomes the creature type of your choice" + (duration == Duration.EndOfTurn ? " until end of turn." : "");
}
public BecomesChosenCreatureTypeSourceEffect(final BecomesChosenCreatureTypeSourceEffect effect) {
super(effect);
this.nonWall = effect.nonWall;
this.duration = effect.duration;
}
@Override
@ -29,7 +41,7 @@ public class BecomesChosenCreatureTypeSourceEffect extends OneShotEffect {
if (sourcePerm == null) {
return false;
}
Effect effect = new BecomesChosenCreatureTypeTargetEffect();
Effect effect = new BecomesChosenCreatureTypeTargetEffect(nonWall, duration);
effect.setTargetPointer(new FixedTarget(sourcePerm, game));
return effect.apply(game, source);
}