[STX] Implemented Tanazir Quandrix

This commit is contained in:
Evan Kranzler 2021-03-31 08:15:38 -04:00
parent a76281791f
commit 3d078dce93
6 changed files with 118 additions and 32 deletions

View file

@ -40,8 +40,7 @@ public final class GrunnTheLonelyKing extends CardImpl {
//Whenever Grunn attacks alone, double its power and toughness until end of turn.
SourcePermanentPowerCount power = new SourcePermanentPowerCount();
SourcePermanentToughnessValue toughness = new SourcePermanentToughnessValue();
Effect effect = new BoostSourceEffect(power, toughness, Duration.EndOfTurn, true);
Effect effect = new BoostSourceEffect(power, SourcePermanentToughnessValue.getInstance(), Duration.EndOfTurn, true);
effect.setText("double its power and toughness until end of turn");
this.addAbility(new AttacksAloneTriggeredAbility(effect));
}

View file

@ -22,7 +22,6 @@ import java.util.UUID;
public final class OkaunEyeOfChaos extends CardImpl {
private static final DynamicValue sourcePower = new SourcePermanentPowerCount();
private static final DynamicValue sourceToughness = new SourcePermanentToughnessValue();
public OkaunEyeOfChaos(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}");
@ -43,7 +42,7 @@ public final class OkaunEyeOfChaos extends CardImpl {
this.addAbility(new WinsCoinFlipTriggeredAbility(
new BoostSourceEffect(
sourcePower,
sourceToughness,
SourcePermanentToughnessValue.getInstance(),
Duration.EndOfTurn,
true
).setText("double {this}'s power and toughness until end of turn")

View file

@ -0,0 +1,97 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount;
import mage.abilities.dynamicvalue.common.SourcePermanentToughnessValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TanazirQuandrix extends CardImpl {
private static final DynamicValue xValue = new SourcePermanentPowerCount(true);
public TanazirQuandrix(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ELDER);
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Trample
this.addAbility(TrampleAbility.getInstance());
// When Tanazir Quandrix enters the battlefield, double the number of +1/+1 counters on target creature you control.
Ability ability = new EntersBattlefieldTriggeredAbility(new TanazirQuandrixEffect());
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
// Whenever Tanazir Quandrix attacks, you may have the base power and toughness of other creatures you control become equal to Tanazir Quandrix's power and toughness until end of turn.
this.addAbility(new AttacksTriggeredAbility(new SetPowerToughnessAllEffect(
xValue, SourcePermanentToughnessValue.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_CONTROLLED_CREATURE, true
).setText("have the base power and toughness of other creatures you control " +
"become equal to {this}'s power and toughness until end of turn"), true));
}
private TanazirQuandrix(final TanazirQuandrix card) {
super(card);
}
@Override
public TanazirQuandrix copy() {
return new TanazirQuandrix(this);
}
}
class TanazirQuandrixEffect extends OneShotEffect {
TanazirQuandrixEffect() {
super(Outcome.Benefit);
staticText = "double the number of +1/+1 counters on target creature you control";
}
private TanazirQuandrixEffect(final TanazirQuandrixEffect effect) {
super(effect);
}
@Override
public TanazirQuandrixEffect copy() {
return new TanazirQuandrixEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
int counterCount = permanent.getCounters(game).getCount(CounterType.P1P1);
return counterCount > 0 && permanent.addCounters(
CounterType.P1P1.createInstance(counterCount), source.getControllerId(), source, game
);
}
}

View file

@ -103,6 +103,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Study Break", 34, Rarity.COMMON, mage.cards.s.StudyBreak.class));
cards.add(new SetCardInfo("Sudden Breakthrough", 116, Rarity.COMMON, mage.cards.s.SuddenBreakthrough.class));
cards.add(new SetCardInfo("Swamp", 370, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Tanazir Quandrix", 240, Rarity.MYTHIC, mage.cards.t.TanazirQuandrix.class));
cards.add(new SetCardInfo("Thrilling Discovery", 243, Rarity.COMMON, mage.cards.t.ThrillingDiscovery.class));
cards.add(new SetCardInfo("Thunderous Orator", 35, Rarity.UNCOMMON, mage.cards.t.ThunderousOrator.class));
cards.add(new SetCardInfo("Torrent Sculptor", 159, Rarity.RARE, mage.cards.t.TorrentSculptor.class));

View file

@ -3,7 +3,6 @@ package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -12,7 +11,7 @@ import mage.game.permanent.Permanent;
*/
public class SourcePermanentPowerCount implements DynamicValue {
boolean allowNegativeValues;
private final boolean allowNegativeValues;
public SourcePermanentPowerCount() {
this(true);
@ -30,17 +29,12 @@ public class SourcePermanentPowerCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId());
if (sourcePermanent == null
|| (sourceAbility.getSourceObjectZoneChangeCounter() > 0
&& sourcePermanent.getZoneChangeCounter(game) > sourceAbility.getSourceObjectZoneChangeCounter())) {
sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD);
Permanent sourcePermanent = sourceAbility.getSourcePermanentOrLKI(game);
if (sourcePermanent == null) {
return 0;
}
if (sourcePermanent != null
&& (allowNegativeValues || sourcePermanent.getPower().getValue() >= 0)) {
return sourcePermanent.getPower().getValue();
}
return 0;
int power = sourcePermanent.getPower().getValue();
return allowNegativeValues ? power : Integer.max(power, 0);
}
@Override

View file

@ -1,24 +1,20 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.io.ObjectStreamException;
/**
*
* @author LevelX2
*/
public class SourcePermanentToughnessValue implements DynamicValue {
private static final SourcePermanentToughnessValue instance = new SourcePermanentToughnessValue();
private static final SourcePermanentToughnessValue instance = new SourcePermanentToughnessValue();
private Object readResolve() throws ObjectStreamException {
return instance;
@ -28,16 +24,16 @@ public class SourcePermanentToughnessValue implements DynamicValue {
return instance;
}
private SourcePermanentToughnessValue() {
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId());
Permanent sourcePermanent = sourceAbility.getSourcePermanentOrLKI(game);
if (sourcePermanent == null) {
sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD);
return 0;
}
if (sourcePermanent != null) {
return sourcePermanent.getToughness().getValue();
}
return 0;
return sourcePermanent.getToughness().getValue();
}
@Override