mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
implement [MH3] Golden-Tail Trainer (#12323)
This commit is contained in:
parent
2407ef0b24
commit
014033e445
3 changed files with 86 additions and 8 deletions
64
Mage.Sets/src/mage/cards/g/GoldenTailTrainer.java
Normal file
64
Mage.Sets/src/mage/cards/g/GoldenTailTrainer.java
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.ModifiedPredicate;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author grimreap124
|
||||
*/
|
||||
public final class GoldenTailTrainer extends CardImpl {
|
||||
|
||||
private static final SourcePermanentPowerCount xValue = new SourcePermanentPowerCount(false);
|
||||
private static final FilterCard filter = new FilterCard();
|
||||
private static final FilterCreaturePermanent modifiedFilter = new FilterCreaturePermanent(
|
||||
"modified creatures you control");
|
||||
|
||||
static {
|
||||
modifiedFilter.add(ModifiedPredicate.instance);
|
||||
filter.add(Predicates.or(SubType.AURA.getPredicate(), SubType.EQUIPMENT.getPredicate()));
|
||||
}
|
||||
|
||||
public GoldenTailTrainer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[] { CardType.CREATURE }, "{1}{G}{W}");
|
||||
|
||||
this.subtype.add(SubType.FOX);
|
||||
this.subtype.add(SubType.SAMURAI);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Aura and Equipment spells you cast cost {X} less to cast, where X is Golden-Tail Trainer's power.
|
||||
this.addAbility(
|
||||
new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, xValue)
|
||||
.setText(
|
||||
"Aura and Equipment spells you cast cost {X} less to cast, where X is {this}'s power")));
|
||||
|
||||
// Whenever Golden-Tail Trainer attacks, other modified creatures you control get +X/+X until end of turn, where X is Golden-Tail Trainer's power.
|
||||
this.addAbility(
|
||||
new AttacksTriggeredAbility(
|
||||
new BoostControlledEffect(xValue, xValue, Duration.EndOfTurn, modifiedFilter, true)));
|
||||
}
|
||||
|
||||
private GoldenTailTrainer(final GoldenTailTrainer card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoldenTailTrainer copy() {
|
||||
return new GoldenTailTrainer(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -97,6 +97,7 @@ public final class ModernHorizons3 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Ghostfire Slice", 123, Rarity.UNCOMMON, mage.cards.g.GhostfireSlice.class));
|
||||
cards.add(new SetCardInfo("Gift of the Viper", 156, Rarity.COMMON, mage.cards.g.GiftOfTheViper.class));
|
||||
cards.add(new SetCardInfo("Glasswing Grace", 254, Rarity.UNCOMMON, mage.cards.g.GlasswingGrace.class));
|
||||
cards.add(new SetCardInfo("Golden-Tail Trainer", 187, Rarity.UNCOMMON, mage.cards.g.GoldenTailTrainer.class));
|
||||
cards.add(new SetCardInfo("Gravedig", 96, Rarity.COMMON, mage.cards.g.Gravedig.class));
|
||||
cards.add(new SetCardInfo("Grim Servant", 97, Rarity.UNCOMMON, mage.cards.g.GrimServant.class));
|
||||
cards.add(new SetCardInfo("Grist, Voracious Larva", 251, Rarity.MYTHIC, mage.cards.g.GristVoraciousLarva.class));
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.cards.Card;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CostModificationType;
|
||||
|
|
@ -24,14 +26,14 @@ import mage.util.CardUtil;
|
|||
public class SpellsCostReductionControllerEffect extends CostModificationEffectImpl {
|
||||
|
||||
private final FilterCard filter;
|
||||
private final int amount;
|
||||
private final DynamicValue amount;
|
||||
private final boolean upTo;
|
||||
private ManaCosts<ManaCost> manaCostsToReduce = null;
|
||||
|
||||
public SpellsCostReductionControllerEffect(FilterCard filter, ManaCosts<ManaCost> manaCostsToReduce) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
this.filter = filter;
|
||||
this.amount = 0;
|
||||
this.amount = StaticValue.get(0);
|
||||
this.manaCostsToReduce = manaCostsToReduce;
|
||||
this.upTo = false;
|
||||
this.staticText = filter.getMessage() + " you cast cost " + manaCostsToReduce.getText() +
|
||||
|
|
@ -39,15 +41,24 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
|
|||
}
|
||||
|
||||
public SpellsCostReductionControllerEffect(FilterCard filter, int amount) {
|
||||
this(filter, amount, false);
|
||||
this(filter, StaticValue.get(amount), false);
|
||||
}
|
||||
|
||||
public SpellsCostReductionControllerEffect(FilterCard filter, int amount, boolean upTo) {
|
||||
this(filter, StaticValue.get(amount), upTo);
|
||||
}
|
||||
|
||||
public SpellsCostReductionControllerEffect(FilterCard filter, DynamicValue amount) {
|
||||
this(filter, amount, false);
|
||||
}
|
||||
|
||||
public SpellsCostReductionControllerEffect(FilterCard filter, DynamicValue amount, boolean upTo) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
this.filter = filter;
|
||||
this.amount = amount;
|
||||
this.upTo = upTo;
|
||||
this.staticText = (filter.getMessage().contains("you cast") ? filter.getMessage() : filter.getMessage() + " you cast")
|
||||
this.staticText = (filter.getMessage().contains("you cast") ? filter.getMessage()
|
||||
: filter.getMessage() + " you cast")
|
||||
+ " cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast";
|
||||
}
|
||||
|
||||
|
|
@ -64,11 +75,12 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
|
|||
if (manaCostsToReduce != null) {
|
||||
CardUtil.adjustCost((SpellAbility) abilityToModify, manaCostsToReduce, false);
|
||||
} else {
|
||||
int reductionAmount = this.amount.calculate(game, source, this);
|
||||
if (upTo) {
|
||||
Mana mana = abilityToModify.getManaCostsToPay().getMana();
|
||||
int reduceMax = mana.getGeneric();
|
||||
if (reduceMax > this.amount) {
|
||||
reduceMax = this.amount;
|
||||
if (reduceMax > reductionAmount) {
|
||||
reduceMax = reductionAmount;
|
||||
}
|
||||
if (reduceMax > 0) {
|
||||
Player controller = game.getPlayer(abilityToModify.getControllerId());
|
||||
|
|
@ -84,7 +96,8 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
|
|||
}
|
||||
choice.setChoices(set);
|
||||
MageObject mageObject = game.getObject(abilityToModify.getSourceId());
|
||||
choice.setMessage("Reduce cost of " + (mageObject != null ? mageObject.getIdName() : filter.getMessage()));
|
||||
choice.setMessage("Reduce cost of "
|
||||
+ (mageObject != null ? mageObject.getIdName() : filter.getMessage()));
|
||||
if (controller.choose(Outcome.Benefit, choice, game)) {
|
||||
reduce = Integer.parseInt(choice.getChoice());
|
||||
} else {
|
||||
|
|
@ -96,7 +109,7 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
|
|||
}
|
||||
}
|
||||
} else {
|
||||
CardUtil.reduceCost(abilityToModify, this.amount);
|
||||
CardUtil.reduceCost(abilityToModify, reductionAmount);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue