mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Change the abilities to layer 7b where they belong
This commit is contained in:
parent
3dddfb46be
commit
9c20dd3bfc
3 changed files with 6 additions and 35 deletions
|
@ -13,10 +13,7 @@ import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
|||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.permanent.token.custom.CreatureToken;
|
||||
|
||||
|
@ -32,12 +29,12 @@ public final class ChimericMass extends CardImpl {
|
|||
this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance())));
|
||||
|
||||
// {1}: Until end of turn, Chimeric Mass becomes a Construct artifact creature with "This creature's power and toughness are each equal to the number of charge counters on it."
|
||||
// set to character defining to prevent setting P/T again to 0 becuase already set by CDA of the token
|
||||
CountersSourceCount count = new CountersSourceCount(CounterType.CHARGE);
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
|
||||
new CreatureToken(0, 0, "Construct artifact creature with \"This creature's power and toughness are each equal to the number of charge counters on it.\"")
|
||||
.withType(CardType.ARTIFACT)
|
||||
.withSubType(SubType.CONSTRUCT)
|
||||
.withAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(new CountersSourceCount(CounterType.CHARGE)))),
|
||||
.withAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(count, count, Duration.WhileOnBattlefield, SubLayer.SetPT_7b))),
|
||||
CardType.ARTIFACT, Duration.EndOfTurn).withDurationRuleAtStart(true), new GenericManaCost(1)));
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,7 @@ import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffec
|
|||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
|
||||
|
@ -32,7 +29,6 @@ public final class SvogthosTheRestlessTomb extends CardImpl {
|
|||
// {tap}: Add {C}.
|
||||
this.addAbility(new ColorlessManaAbility());
|
||||
// {3}{B}{G}: Until end of turn, Svogthos, the Restless Tomb becomes a black and green Plant Zombie creature with "This creature's power and toughness are each equal to the number of creature cards in your graveyard." It's still a land.
|
||||
// set to character defining to prevent setting P/T again to 0 becuase already set by CDA of the token
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new SvogthosToken(), CardType.LAND, Duration.EndOfTurn).withDurationRuleAtStart(true), new ManaCostsImpl<>("{3}{B}{G}"));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -59,7 +55,7 @@ class SvogthosToken extends TokenImpl {
|
|||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
CardsInControllerGraveyardCount count = new CardsInControllerGraveyardCount(new FilterCreatureCard("creature cards"));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(count)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(count, count, Duration.WhileOnBattlefield, SubLayer.SetPT_7b)));
|
||||
}
|
||||
public SvogthosToken(final SvogthosToken token) {
|
||||
super(token);
|
||||
|
|
|
@ -3,9 +3,7 @@ package mage.abilities.effects.common.continuous;
|
|||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -44,7 +42,6 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
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
|
||||
protected boolean hasCDA; // used when becoming a creature with an ability that sets P/T in layer 7a
|
||||
|
||||
/**
|
||||
* @param token Token as blueprint for creature to become
|
||||
|
@ -56,7 +53,6 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
this.token = token;
|
||||
this.retainType = retainType;
|
||||
this.durationRuleAtStart = (retainType == CardType.PLANESWALKER || retainType == CardType.CREATURE);
|
||||
this.hasCDA = checkTokenCDA();
|
||||
setText();
|
||||
this.addDependencyType(DependencyType.BecomeCreature);
|
||||
}
|
||||
|
@ -74,7 +70,6 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
this.toughness = effect.toughness.copy();
|
||||
}
|
||||
this.durationRuleAtStart = effect.durationRuleAtStart;
|
||||
this.hasCDA = effect.hasCDA;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -138,7 +133,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
break;
|
||||
|
||||
case PTChangingEffects_7:
|
||||
if ((sublayer == SubLayer.SetPT_7b) && !hasCDA) {
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
if (power != null) {
|
||||
permanent.getPower().setModifiedBaseValue(power.calculate(game, source, this)); // check all other becomes to use calculate?
|
||||
} else if (token.getPower() != null) {
|
||||
|
@ -226,21 +221,4 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
|| layer == Layer.TypeChangingEffects_4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the token contains a characteristic-defining ability in layer 7a.
|
||||
* If it does, then need to not overwrite P/T in layer 7b.
|
||||
* (It might not really be a CDA, but applied as one for consistency with the effect type.)
|
||||
* @return true if the token has an ability with an effect in layer 7a
|
||||
*/
|
||||
private boolean checkTokenCDA() {
|
||||
for (Ability ability : token.getAbilities()) {
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof ContinuousEffect && ((ContinuousEffect) effect).getSublayer() == SubLayer.CharacteristicDefining_7a) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue