mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +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.
|
// 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(
|
Ability ability = new SimpleActivatedAbility(
|
||||||
new BecomesCreatureSourceEffect(
|
new BecomesCreatureSourceEffect(
|
||||||
new ChromiumTheMutableToken(), null, Duration.EndOfTurn,
|
new ChromiumTheMutableToken(), null, Duration.EndOfTurn
|
||||||
false, true
|
).andLoseAbilities(true).setText("Until end of turn, {this} becomes "
|
||||||
).setText("Until end of turn, {this} becomes "
|
|
||||||
+ "a Human with base power and toughness 1/1, "
|
+ "a Human with base power and toughness 1/1, "
|
||||||
+ "loses all abilities, and gains hexproof"),
|
+ "loses all abilities, and gains hexproof"),
|
||||||
new DiscardCardCost()
|
new DiscardCardCost()
|
||||||
|
|
|
@ -2,6 +2,7 @@ package mage.cards.m;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
@ -62,9 +63,8 @@ public final class MonumentToPerfection extends CardImpl {
|
||||||
).withType(CardType.ARTIFACT)
|
).withType(CardType.ARTIFACT)
|
||||||
.withAbility(IndestructibleAbility.getInstance())
|
.withAbility(IndestructibleAbility.getInstance())
|
||||||
.withAbility(new ToxicAbility(9)),
|
.withAbility(new ToxicAbility(9)),
|
||||||
null, Duration.Custom, true,
|
"", Duration.Custom
|
||||||
true
|
).andLoseAbilities(true), new GenericManaCost(3), MonumentToPerfectionCondition.instance
|
||||||
), new GenericManaCost(3), MonumentToPerfectionCondition.instance
|
|
||||||
).addHint(MonumentToPerfectionValue.getHint()));
|
).addHint(MonumentToPerfectionValue.getHint()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ enum MonumentToPerfectionValue implements DynamicValue {
|
||||||
.getBattlefield()
|
.getBattlefield()
|
||||||
.getActivePermanents(filter, sourceAbility.getControllerId(), game)
|
.getActivePermanents(filter, sourceAbility.getControllerId(), game)
|
||||||
.stream()
|
.stream()
|
||||||
.map(permanent -> permanent.getName())
|
.map(MageObject::getName)
|
||||||
.filter(s -> s.length() > 0)
|
.filter(s -> s.length() > 0)
|
||||||
.distinct()
|
.distinct()
|
||||||
.mapToInt(x -> 1)
|
.mapToInt(x -> 1)
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
||||||
protected Token token;
|
protected Token token;
|
||||||
protected String theyAreStillType;
|
protected String theyAreStillType;
|
||||||
protected boolean losePreviousTypes;
|
protected boolean losePreviousTypes;
|
||||||
protected boolean loseAbilities;
|
protected boolean loseAbilities = false;
|
||||||
protected DynamicValue power = null;
|
protected DynamicValue power = null;
|
||||||
protected DynamicValue toughness = null;
|
protected DynamicValue toughness = null;
|
||||||
protected boolean durationRuleAtStart; // put duration rule at the start of the rules text rather than the end
|
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
|
* @param duration Duration for the effect
|
||||||
*/
|
*/
|
||||||
public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration) {
|
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
|
* @param duration Duration for the effect
|
||||||
*/
|
*/
|
||||||
public BecomesCreatureSourceEffect(Token token, Duration duration) {
|
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 theyAreStillType String for rules text generation
|
||||||
* @param duration Duration for the effect
|
* @param duration Duration for the effect
|
||||||
* @param losePreviousTypes if true, permanent loses its previous types
|
* @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);
|
super(duration, Outcome.BecomeCreature);
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.theyAreStillType = theyAreStillType;
|
this.theyAreStillType = theyAreStillType;
|
||||||
this.losePreviousTypes = losePreviousTypes;
|
this.losePreviousTypes = losePreviousTypes;
|
||||||
this.loseAbilities = loseAbilities;
|
|
||||||
this.durationRuleAtStart = (theyAreStillType != null && theyAreStillType.contains("planeswalker"));
|
this.durationRuleAtStart = (theyAreStillType != null && theyAreStillType.contains("planeswalker"));
|
||||||
setText();
|
setText();
|
||||||
this.hasCDA = checkTokenCDA();
|
this.hasCDA = checkTokenCDA();
|
||||||
|
@ -189,6 +187,15 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
||||||
return this;
|
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) {
|
public BecomesCreatureSourceEffect withDurationRuleAtStart(boolean durationRuleAtStart) {
|
||||||
this.durationRuleAtStart = durationRuleAtStart;
|
this.durationRuleAtStart = durationRuleAtStart;
|
||||||
setText();
|
setText();
|
||||||
|
|
Loading…
Reference in a new issue