[AFR] Implemented Plate Armor

This commit is contained in:
Daniel Bomar 2021-07-12 08:48:12 -05:00
parent a78862d1fa
commit 66b224622a
No known key found for this signature in database
GPG key ID: C86C8658F4023918
3 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,89 @@
package mage.cards.p;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.CostAdjuster;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.WardAbility;
import mage.constants.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.common.FilterEquipmentPermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author weirddan455
*/
public final class PlateArmor extends CardImpl {
public PlateArmor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{W}");
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature gets +3/+3 and has ward {1}.
Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(3, 3));
ability.addEffect(new GainAbilityAttachedEffect(
new WardAbility(new GenericManaCost(1)),
AttachmentType.EQUIPMENT,
Duration.WhileOnBattlefield,
"and has ward {1}"
));
this.addAbility(ability);
// Equip {3}. This ability costs {1} less to activate for each other Equipment you control.
EquipAbility equipAbility = new EquipAbility(3);
equipAbility.setCostAdjuster(PlateArmorAdjuster.instance);
equipAbility.setCostReduceText("This ability costs {1} less to activate for each other Equipment you control.");
this.addAbility(equipAbility.addHint(PlateArmorAdjuster.getHint()));
}
private PlateArmor(final PlateArmor card) {
super(card);
}
@Override
public PlateArmor copy() {
return new PlateArmor(this);
}
}
enum PlateArmorAdjuster implements CostAdjuster {
instance;
private static final FilterEquipmentPermanent filter = new FilterEquipmentPermanent("Other Equipment you control");
static {
filter.add(AnotherPredicate.instance);
filter.add(TargetController.YOU.getControllerPredicate());
}
private static final DynamicValue equipmentCount = new PermanentsOnBattlefieldCount(filter);
private static final Hint hint = new ValueHint("Other Equipment you control", equipmentCount);
public static Hint getHint() {
return hint;
}
@Override
public void adjustCosts(Ability ability, Game game) {
Player controller = game.getPlayer(ability.getControllerId());
if (controller != null) {
int count = equipmentCount.calculate(game, ability, null);
CardUtil.reduceCost(ability, count);
}
}
}

View file

@ -168,6 +168,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
cards.add(new SetCardInfo("Paladin's Shield", 30, Rarity.COMMON, mage.cards.p.PaladinsShield.class));
cards.add(new SetCardInfo("Plains", 262, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Planar Ally", 31, Rarity.COMMON, mage.cards.p.PlanarAlly.class));
cards.add(new SetCardInfo("Plate Armor", 32, Rarity.UNCOMMON, mage.cards.p.PlateArmor.class));
cards.add(new SetCardInfo("Plummet", 199, Rarity.COMMON, mage.cards.p.Plummet.class));
cards.add(new SetCardInfo("Plundering Barbarian", 158, Rarity.COMMON, mage.cards.p.PlunderingBarbarian.class));
cards.add(new SetCardInfo("Portable Hole", 33, Rarity.UNCOMMON, mage.cards.p.PortableHole.class));

View file

@ -15,6 +15,8 @@ import mage.target.common.TargetControlledCreaturePermanent;
*/
public class EquipAbility extends ActivatedAbilityImpl {
private String costReduceText = null;
public EquipAbility(int cost) {
this(Outcome.AddAbility, new GenericManaCost(cost));
}
@ -31,6 +33,11 @@ public class EquipAbility extends ActivatedAbilityImpl {
public EquipAbility(final EquipAbility ability) {
super(ability);
this.costReduceText = ability.costReduceText;
}
public void setCostReduceText(String text) {
this.costReduceText = text;
}
@Override
@ -50,6 +57,10 @@ public class EquipAbility extends ActivatedAbilityImpl {
}
sb.append(costs.getText());
sb.append(manaCosts.getText());
if (costReduceText != null && !costReduceText.isEmpty()) {
sb.append(' ');
sb.append(costReduceText);
}
if (maxActivationsPerTurn == 1) {
sb.append(" Activate only once each turn.");
}