[DOM] Update Aryel, Knight of Windgrace.

This commit is contained in:
LevelX2 2018-04-19 12:31:42 +02:00
parent 83ab8528d2
commit 265bcf5004
3 changed files with 15 additions and 26 deletions

View file

@ -32,7 +32,6 @@ import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.VariableCost;
import mage.abilities.costs.VariableCostImpl; import mage.abilities.costs.VariableCostImpl;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.common.TapTargetCost; import mage.abilities.costs.common.TapTargetCost;
@ -43,20 +42,17 @@ import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.TargetAdjustment;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.token.KnightToken; import mage.game.permanent.token.KnightToken;
import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetCreaturePermanent;
/** /**
* *
@ -64,8 +60,6 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class AryelKnightOfWindgrace extends CardImpl { public class AryelKnightOfWindgrace extends CardImpl {
private UUID adjustTargetAbilityId;
public AryelKnightOfWindgrace(UUID ownerId, CardSetInfo setInfo) { public AryelKnightOfWindgrace(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{B}");
@ -89,30 +83,13 @@ public class AryelKnightOfWindgrace extends CardImpl {
.setText("Destroy target creature with power X or less"), new ManaCostsImpl("{B}")); .setText("Destroy target creature with power X or less"), new ManaCostsImpl("{B}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new AryelTapXTargetCost()); ability.addCost(new AryelTapXTargetCost());
ability.setTargetAdjustment(TargetAdjustment.CREATURE_POWER_X_OR_LESS);
this.addAbility(ability); this.addAbility(ability);
this.adjustTargetAbilityId = ability.getOriginalId();
ability.getOriginalId(); ability.getOriginalId();
} }
@Override
public void adjustTargets(Ability ability, Game game) {
if (adjustTargetAbilityId.equals(ability.getOriginalId())) {
for (VariableCost cost : ability.getCosts().getVariableCosts()) {
if (cost instanceof AryelTapXTargetCost) {
int value = ((AryelTapXTargetCost) cost).getAmount();
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power " + value + " or less");
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, value + 1));
ability.getTargets().clear();
ability.addTarget(new TargetCreaturePermanent(filter));
break;
}
}
}
}
public AryelKnightOfWindgrace(final AryelKnightOfWindgrace card) { public AryelKnightOfWindgrace(final AryelKnightOfWindgrace card) {
super(card); super(card);
this.adjustTargetAbilityId = card.adjustTargetAbilityId;
} }
@Override @Override

View file

@ -36,6 +36,7 @@ import mage.Mana;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.*; import mage.abilities.*;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.VariableCost;
import mage.abilities.costs.common.RemoveVariableCountersTargetCost; import mage.abilities.costs.common.RemoveVariableCountersTargetCost;
import mage.abilities.effects.common.NameACardEffect; import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.ActivatedManaAbilityImpl;
@ -457,6 +458,16 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
newFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1)); newFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
ability.addTarget(new TargetCreaturePermanent(newFilter)); ability.addTarget(new TargetCreaturePermanent(newFilter));
break; break;
case CREATURE_POWER_X_OR_LESS: // Aryel, Knight of Windgrace
int value = 0;
for (VariableCost cost : ability.getCosts().getVariableCosts()) {
value = cost.getAmount();
}
FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent("creature with power " + value + " or less");
filterCreaturePermanent.add(new PowerPredicate(ComparisonType.FEWER_THAN, value + 1));
ability.getTargets().clear();
ability.addTarget(new TargetCreaturePermanent(filterCreaturePermanent));
break;
} }
} }

View file

@ -13,5 +13,6 @@ public enum TargetAdjustment {
CHOSEN_COLOR, CHOSEN_COLOR,
VERSE_COUNTER_TARGETS, VERSE_COUNTER_TARGETS,
TREASURE_COUNTER_POWER, TREASURE_COUNTER_POWER,
SIMIC_MANIPULATOR SIMIC_MANIPULATOR,
CREATURE_POWER_X_OR_LESS
} }