mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
Move loseAbilities out of constructor
This commit is contained in:
parent
9b73c8367f
commit
00ca915581
3 changed files with 19 additions and 13 deletions
|
@ -46,9 +46,8 @@ public final class ChromiumTheMutable extends CardImpl {
|
|||
// Discard a card: Until end of turn, Chromium, the Mutable becomes a Human with base power and toughness 1/1, loses all abilities, and gains hexproof. It can't be blocked this turn.
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
new BecomesCreatureSourceEffect(
|
||||
new ChromiumTheMutableToken(), null, Duration.EndOfTurn,
|
||||
false, true
|
||||
).setText("Until end of turn, {this} becomes "
|
||||
new ChromiumTheMutableToken(), null, Duration.EndOfTurn
|
||||
).andLoseAbilities(true).setText("Until end of turn, {this} becomes "
|
||||
+ "a Human with base power and toughness 1/1, "
|
||||
+ "loses all abilities, and gains hexproof"),
|
||||
new DiscardCardCost()
|
||||
|
|
|
@ -2,6 +2,7 @@ package mage.cards.m;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -62,9 +63,8 @@ public final class MonumentToPerfection extends CardImpl {
|
|||
).withType(CardType.ARTIFACT)
|
||||
.withAbility(IndestructibleAbility.getInstance())
|
||||
.withAbility(new ToxicAbility(9)),
|
||||
null, Duration.Custom, true,
|
||||
true
|
||||
), new GenericManaCost(3), MonumentToPerfectionCondition.instance
|
||||
"", Duration.Custom
|
||||
).andLoseAbilities(true), new GenericManaCost(3), MonumentToPerfectionCondition.instance
|
||||
).addHint(MonumentToPerfectionValue.getHint()));
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ enum MonumentToPerfectionValue implements DynamicValue {
|
|||
.getBattlefield()
|
||||
.getActivePermanents(filter, sourceAbility.getControllerId(), game)
|
||||
.stream()
|
||||
.map(permanent -> permanent.getName())
|
||||
.map(MageObject::getName)
|
||||
.filter(s -> s.length() > 0)
|
||||
.distinct()
|
||||
.mapToInt(x -> 1)
|
||||
|
|
|
@ -40,7 +40,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
protected Token token;
|
||||
protected String theyAreStillType;
|
||||
protected boolean losePreviousTypes;
|
||||
protected boolean loseAbilities;
|
||||
protected boolean loseAbilities = false;
|
||||
protected DynamicValue power = null;
|
||||
protected DynamicValue toughness = null;
|
||||
protected boolean durationRuleAtStart; // put duration rule at the start of the rules text rather than the end
|
||||
|
@ -53,7 +53,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
* @param duration Duration for the effect
|
||||
*/
|
||||
public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration) {
|
||||
this(token, theyAreStillType, duration, false, false);
|
||||
this(token, theyAreStillType, duration, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
* @param duration Duration for the effect
|
||||
*/
|
||||
public BecomesCreatureSourceEffect(Token token, Duration duration) {
|
||||
this(token, "", duration, true, false);
|
||||
this(token, "", duration, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,14 +70,12 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
* @param theyAreStillType String for rules text generation
|
||||
* @param duration Duration for the effect
|
||||
* @param losePreviousTypes if true, permanent loses its previous types
|
||||
* @param loseAbilities if true, permanent loses its other abilities
|
||||
*/
|
||||
public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration, boolean losePreviousTypes, boolean loseAbilities) {
|
||||
public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration, boolean losePreviousTypes) {
|
||||
super(duration, Outcome.BecomeCreature);
|
||||
this.token = token;
|
||||
this.theyAreStillType = theyAreStillType;
|
||||
this.losePreviousTypes = losePreviousTypes;
|
||||
this.loseAbilities = loseAbilities;
|
||||
this.durationRuleAtStart = (theyAreStillType != null && theyAreStillType.contains("planeswalker"));
|
||||
setText();
|
||||
this.hasCDA = checkTokenCDA();
|
||||
|
@ -189,6 +187,15 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Source loses all other abilities as part of the effect
|
||||
* Note: need to set text manually
|
||||
*/
|
||||
public BecomesCreatureSourceEffect andLoseAbilities(boolean loseAbilities) {
|
||||
this.loseAbilities = loseAbilities;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BecomesCreatureSourceEffect withDurationRuleAtStart(boolean durationRuleAtStart) {
|
||||
this.durationRuleAtStart = durationRuleAtStart;
|
||||
setText();
|
||||
|
|
Loading…
Reference in a new issue