[CMR] Implemented Tuya Bearclaw

This commit is contained in:
Evan Kranzler 2020-11-06 08:47:12 -05:00
parent c02399a402
commit a4e4e5d8c4
2 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,85 @@
package mage.cards.t;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.StaticFilters;
import mage.game.Game;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TuyaBearclaw extends CardImpl {
public TuyaBearclaw(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{G}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Tuya Bearclaw attacks, it gets +X/+X until end of turn, where X is the greatest power among other creatures you control.
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(
TuyaBearclawValue.instance,
TuyaBearclawValue.instance,
Duration.EndOfTurn, true
), false));
}
private TuyaBearclaw(final TuyaBearclaw card) {
super(card);
}
@Override
public TuyaBearclaw copy() {
return new TuyaBearclaw(this);
}
}
enum TuyaBearclawValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return game.getBattlefield()
.getActivePermanents(
StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE,
sourceAbility.getControllerId(), sourceAbility.getSourceId(), game
).stream()
.filter(Objects::nonNull)
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.max()
.orElse(0);
}
@Override
public TuyaBearclawValue copy() {
return instance;
}
@Override
public String getMessage() {
return "the greatest power among other creatures you control";
}
@Override
public String toString() {
return "X";
}
}

View file

@ -475,6 +475,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Tromokratis", 408, Rarity.RARE, mage.cards.t.Tromokratis.class));
cards.add(new SetCardInfo("Trove Tracker", 104, Rarity.COMMON, mage.cards.t.TroveTracker.class));
cards.add(new SetCardInfo("Trusty Packbeast", 53, Rarity.COMMON, mage.cards.t.TrustyPackbeast.class));
cards.add(new SetCardInfo("Tuya Bearclaw", 292, Rarity.UNCOMMON, mage.cards.t.TuyaBearclaw.class));
cards.add(new SetCardInfo("Tymna the Weaver", 539, Rarity.MYTHIC, mage.cards.t.TymnaTheWeaver.class));
cards.add(new SetCardInfo("Unbreakable Formation", 388, Rarity.RARE, mage.cards.u.UnbreakableFormation.class));
cards.add(new SetCardInfo("Undergrowth Stadium", 359, Rarity.RARE, mage.cards.u.UndergrowthStadium.class));