mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Pentarch Paladin is now supported properly
This commit is contained in:
parent
bc9a3dd58a
commit
ce68a1d9ed
3 changed files with 26 additions and 32 deletions
|
@ -29,7 +29,6 @@ package mage.cards.p;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -44,23 +43,21 @@ import mage.constants.SubType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.constants.TargetAdjustment;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class PentarchPaladin extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
FilterPermanent filter = new FilterPermanent("permanent of the chosen color.");
|
||||
|
||||
public PentarchPaladin(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}{W}");
|
||||
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.KNIGHT);
|
||||
this.power = new MageInt(3);
|
||||
|
@ -71,37 +68,21 @@ public class PentarchPaladin extends CardImpl {
|
|||
|
||||
// As Pentarch Paladin enters the battlefield, choose a color.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Detriment)));
|
||||
|
||||
//TODO: Make ability properly copiable
|
||||
|
||||
// {W}{W}, {tap}: Destroy target permanent of the chosen color.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{W}{W}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
originalId = ability.getOriginalId();
|
||||
ability.setTargetAdjustment(TargetAdjustment.CHOSEN_COLOR);
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ObjectColor color = (ObjectColor) game.getState().getValue(ability.getSourceId() + "_color");
|
||||
if (ability.getOriginalId().equals(originalId)
|
||||
&& color != null) {
|
||||
ability.getTargets().clear();
|
||||
FilterPermanent filter = new FilterPermanent("permanent of the chosen color.");
|
||||
filter.add(new ColorPredicate(color));
|
||||
TargetPermanent target = new TargetPermanent(filter);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
public PentarchPaladin(final PentarchPaladin card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PentarchPaladin copy() {
|
||||
return new PentarchPaladin(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import mage.counters.Counters;
|
|||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
|
@ -351,6 +352,12 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
|
||||
break;
|
||||
case X_TARGETS:
|
||||
xValue = ability.getManaCostsToPay().getX();
|
||||
permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter();
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(xValue, permanentFilter));
|
||||
break;
|
||||
case X_POWER_LEQ:// Minamo Sightbender only
|
||||
xValue = ability.getManaCostsToPay().getX();
|
||||
oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0);
|
||||
|
@ -361,12 +368,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
|
||||
break;
|
||||
case X_TARGETS:
|
||||
xValue = ability.getManaCostsToPay().getX();
|
||||
permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter();
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(xValue, permanentFilter));
|
||||
break;
|
||||
case X_CMC_EQUAL_GY_CARD: //Geth, Lord of the Vault only
|
||||
xValue = ability.getManaCostsToPay().getX();
|
||||
TargetCard oldTarget = (TargetCard) ability.getTargets().get(0);
|
||||
|
@ -382,6 +383,18 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
TargetSpell target = new TargetSpell(1, filterSpell);
|
||||
ability.addTarget(target);
|
||||
break;
|
||||
case CHOSEN_COLOR: //Pentarch Paladin only
|
||||
ObjectColor chosenColor = (ObjectColor) game.getState().getValue(ability.getSourceId() + "_color");
|
||||
ability.getTargets().clear();
|
||||
FilterPermanent filter = new FilterPermanent("permanent of the chosen color.");
|
||||
if (chosenColor != null) {
|
||||
filter.add(new ColorPredicate(chosenColor));
|
||||
} else {
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, -5));// Pretty sure this is always false
|
||||
}
|
||||
oldTargetPermanent = new TargetPermanent(filter);
|
||||
ability.addTarget(oldTargetPermanent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,5 +6,5 @@ package mage.constants;
|
|||
*/
|
||||
public enum TargetAdjustment {
|
||||
|
||||
NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME
|
||||
NONE, X_TARGETS, X_CMC_EQUAL_PERM, X_CMC_EQUAL_GY_CARD, X_POWER_LEQ, CHOSEN_NAME, CHOSEN_COLOR
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue