mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TDC] Implement Arbor Adherent
This commit is contained in:
parent
5165282d7d
commit
2363fd6390
9 changed files with 88 additions and 73 deletions
|
|
@ -9,8 +9,6 @@ import mage.abilities.costs.mana.ManaCostsImpl;
|
|||
import mage.abilities.dynamicvalue.common.GreatestToughnessAmongControlledCreaturesValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
|
@ -41,11 +39,6 @@ public final class AbzanMonument extends CardImpl {
|
|||
));
|
||||
}
|
||||
|
||||
private static final Hint hint = new ValueHint(
|
||||
"Greatest toughness among creatures you control",
|
||||
GreatestToughnessAmongControlledCreaturesValue.instance
|
||||
);
|
||||
|
||||
public AbzanMonument(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
|
|
@ -60,7 +53,7 @@ public final class AbzanMonument extends CardImpl {
|
|||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability.addHint(hint));
|
||||
this.addAbility(ability.addHint(GreatestToughnessAmongControlledCreaturesValue.ALL.getHint()));
|
||||
}
|
||||
|
||||
private AbzanMonument(final AbzanMonument card) {
|
||||
|
|
@ -93,9 +86,7 @@ class AbzanMonumentEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return new SpiritXXToken(
|
||||
GreatestToughnessAmongControlledCreaturesValue
|
||||
.instance
|
||||
.calculate(game, source, this)
|
||||
GreatestToughnessAmongControlledCreaturesValue.ALL.calculate(game, source, this)
|
||||
).putOntoBattlefield(1, game, source);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
48
Mage.Sets/src/mage/cards/a/ArborAdherent.java
Normal file
48
Mage.Sets/src/mage/cards/a/ArborAdherent.java
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.dynamicvalue.common.GreatestToughnessAmongControlledCreaturesValue;
|
||||
import mage.abilities.mana.AnyColorManaAbility;
|
||||
import mage.abilities.mana.DynamicManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ArborAdherent extends CardImpl {
|
||||
|
||||
public ArborAdherent(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
|
||||
|
||||
this.subtype.add(SubType.DOG);
|
||||
this.subtype.add(SubType.DRUID);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// {T}: Add one mana of any color.
|
||||
this.addAbility(new AnyColorManaAbility());
|
||||
|
||||
// {T}: Add X mana of any one color, where X is the greatest toughness among other creatures you control.
|
||||
this.addAbility(new DynamicManaAbility(
|
||||
Mana.AnyMana(1), GreatestToughnessAmongControlledCreaturesValue.OTHER,
|
||||
new TapSourceCost(), "add X mana of any one color, where X is the " +
|
||||
"greatest toughness among other creatures you control", true
|
||||
).addHint(GreatestToughnessAmongControlledCreaturesValue.OTHER.getHint()));
|
||||
}
|
||||
|
||||
private ArborAdherent(final ArborAdherent card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArborAdherent copy() {
|
||||
return new ArborAdherent(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,6 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -42,8 +41,10 @@ public final class BighornerRancher extends CardImpl {
|
|||
|
||||
// Sacrifice Bighorner Rancher: You gain life equal to the greatest toughness among other creatures you control.
|
||||
this.addAbility(new SimpleActivatedAbility(
|
||||
new GainLifeEffect(GreatestToughnessAmongControlledCreaturesValue.instance).setText("You gain life equal to the greatest toughness among other creatures you control."),
|
||||
new SacrificeSourceCost()));
|
||||
new GainLifeEffect(GreatestToughnessAmongControlledCreaturesValue.OTHER)
|
||||
.setText("You gain life equal to the greatest toughness among other creatures you control."),
|
||||
new SacrificeSourceCost()
|
||||
).addHint(GreatestToughnessAmongControlledCreaturesValue.OTHER.getHint()));
|
||||
}
|
||||
|
||||
private BighornerRancher(final BighornerRancher card) {
|
||||
|
|
|
|||
|
|
@ -1,21 +1,17 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.dynamicvalue.common.GreatestToughnessAmongControlledCreaturesValue;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class FlourishingHunter extends CardImpl {
|
||||
|
|
@ -29,7 +25,10 @@ public final class FlourishingHunter extends CardImpl {
|
|||
this.toughness = new MageInt(6);
|
||||
|
||||
// When Flourishing Hunter enters the battlefield, you gain life equal to the greatest toughness among other creatures you control.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new FlourishingHunterEffect()));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(
|
||||
new GainLifeEffect(GreatestToughnessAmongControlledCreaturesValue.OTHER)
|
||||
.setText("you gain life equal to the greatest toughness among other creatures you control")
|
||||
).addHint(GreatestToughnessAmongControlledCreaturesValue.OTHER.getHint()));
|
||||
}
|
||||
|
||||
private FlourishingHunter(final FlourishingHunter card) {
|
||||
|
|
@ -41,39 +40,3 @@ public final class FlourishingHunter extends CardImpl {
|
|||
return new FlourishingHunter(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FlourishingHunterEffect extends OneShotEffect {
|
||||
|
||||
FlourishingHunterEffect() {
|
||||
super(Outcome.GainLife);
|
||||
staticText = "you gain life equal to the greatest toughness among other creatures you control";
|
||||
}
|
||||
|
||||
private FlourishingHunterEffect(final FlourishingHunterEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlourishingHunterEffect copy() {
|
||||
return new FlourishingHunterEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
int greatestToughness = 0;
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(controller.getId())) {
|
||||
if (permanent.isCreature(game) && !permanent.getId().equals(source.getSourceId())) {
|
||||
int toughness = permanent.getToughness().getValue();
|
||||
if (toughness > greatestToughness) {
|
||||
greatestToughness = toughness;
|
||||
}
|
||||
}
|
||||
}
|
||||
controller.gainLife(greatestToughness, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ public final class GlintWeaver extends CardImpl {
|
|||
|
||||
// When Glint Weaver enters the battlefield, distribute three +1/+1 counters among one, two, or three target creatures, then you gain life equal to the greatest toughness among creatures you control.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new DistributeCountersEffect());
|
||||
ability.addEffect(new GainLifeEffect(GreatestToughnessAmongControlledCreaturesValue.instance)
|
||||
ability.addEffect(new GainLifeEffect(GreatestToughnessAmongControlledCreaturesValue.ALL)
|
||||
.setText(", then you gain life equal to the greatest toughness among creatures you control"));
|
||||
ability.addTarget(new TargetCreaturePermanentAmount(3));
|
||||
this.addAbility(ability);
|
||||
this.addAbility(ability.addHint(GreatestToughnessAmongControlledCreaturesValue.ALL.getHint()));
|
||||
}
|
||||
|
||||
private GlintWeaver(final GlintWeaver card) {
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ public final class HuatliTheSunsHeart extends CardImpl {
|
|||
|
||||
// -3: You gain life equal to the greatest toughness among creatures you control.
|
||||
this.addAbility(new LoyaltyAbility(new GainLifeEffect(
|
||||
GreatestToughnessAmongControlledCreaturesValue.instance,
|
||||
GreatestToughnessAmongControlledCreaturesValue.ALL,
|
||||
"You gain life equal to the greatest toughness among creatures you control"
|
||||
), -3));
|
||||
), -3).addHint(GreatestToughnessAmongControlledCreaturesValue.ALL.getHint()));
|
||||
}
|
||||
|
||||
private HuatliTheSunsHeart(final HuatliTheSunsHeart card) {
|
||||
|
|
|
|||
|
|
@ -32,9 +32,10 @@ public final class LastMarchOfTheEnts extends CardImpl {
|
|||
|
||||
// Draw cards equal to the greatest toughness among creatures you control, then put any number of creature cards from your hand onto the battlefield.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(
|
||||
GreatestToughnessAmongControlledCreaturesValue.instance
|
||||
GreatestToughnessAmongControlledCreaturesValue.ALL
|
||||
).setText("draw cards equal to the greatest toughness among creatures you control"));
|
||||
this.getSpellAbility().addEffect(new LastMarchOfTheEntsEffect());
|
||||
this.getSpellAbility().addHint(GreatestToughnessAmongControlledCreaturesValue.ALL.getHint());
|
||||
}
|
||||
|
||||
private LastMarchOfTheEnts(final LastMarchOfTheEnts card) {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public final class TarkirDragonstormCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Angel of Invention", 109, Rarity.MYTHIC, mage.cards.a.AngelOfInvention.class));
|
||||
cards.add(new SetCardInfo("Anguished Unmaking", 279, Rarity.RARE, mage.cards.a.AnguishedUnmaking.class));
|
||||
cards.add(new SetCardInfo("Arasta of the Endless Web", 244, Rarity.RARE, mage.cards.a.ArastaOfTheEndlessWeb.class));
|
||||
cards.add(new SetCardInfo("Arbor Adherent", 42, Rarity.RARE, mage.cards.a.ArborAdherent.class));
|
||||
cards.add(new SetCardInfo("Arboreal Grazer", 245, Rarity.COMMON, mage.cards.a.ArborealGrazer.class));
|
||||
cards.add(new SetCardInfo("Arcane Signet", 105, Rarity.UNCOMMON, mage.cards.a.ArcaneSignet.class));
|
||||
cards.add(new SetCardInfo("Archmage Emeritus", 145, Rarity.RARE, mage.cards.a.ArchmageEmeritus.class));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.MageInt;
|
||||
|
|
@ -6,6 +5,9 @@ import mage.MageObject;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
|
||||
|
|
@ -13,16 +15,21 @@ import mage.game.Game;
|
|||
* @author TheElk801
|
||||
*/
|
||||
public enum GreatestToughnessAmongControlledCreaturesValue implements DynamicValue {
|
||||
instance;
|
||||
ALL(StaticFilters.FILTER_CONTROLLED_CREATURES),
|
||||
OTHER(StaticFilters.FILTER_OTHER_CONTROLLED_CREATURES);
|
||||
private final FilterPermanent filter;
|
||||
private final Hint hint;
|
||||
|
||||
GreatestToughnessAmongControlledCreaturesValue(FilterPermanent filter) {
|
||||
this.filter = filter;
|
||||
this.hint = new ValueHint("The greatest toughness among " + filter.getMessage(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return game
|
||||
.getBattlefield()
|
||||
.getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
||||
sourceAbility.getControllerId(), game
|
||||
)
|
||||
.getActivePermanents(filter, sourceAbility.getControllerId(), game)
|
||||
.stream()
|
||||
.map(MageObject::getToughness)
|
||||
.mapToInt(MageInt::getValue)
|
||||
|
|
@ -32,12 +39,12 @@ public enum GreatestToughnessAmongControlledCreaturesValue implements DynamicVal
|
|||
|
||||
@Override
|
||||
public GreatestToughnessAmongControlledCreaturesValue copy() {
|
||||
return GreatestToughnessAmongControlledCreaturesValue.instance;
|
||||
return GreatestToughnessAmongControlledCreaturesValue.ALL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "the greatest toughness among creatures you control";
|
||||
return "the greatest toughness among " + filter.getMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -45,4 +52,7 @@ public enum GreatestToughnessAmongControlledCreaturesValue implements DynamicVal
|
|||
return "X";
|
||||
}
|
||||
|
||||
public Hint getHint() {
|
||||
return hint;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue