Replace checktype enum for Cardtype enum

This commit is contained in:
ingmargoudt 2017-03-05 20:04:09 +01:00
parent 59d0262943
commit 80580d69e9
3 changed files with 13 additions and 20 deletions

View file

@ -48,10 +48,7 @@ import mage.players.Player;
import java.util.UUID;
import static mage.abilities.condition.common.TopLibraryCardTypeCondition.CheckType.CREATURE;
/**
*
* @author jeffwadsworth
*/
public class CrownOfConvergence extends CardImpl {
@ -59,13 +56,13 @@ public class CrownOfConvergence extends CardImpl {
private static final String rule1 = "As long as the top card of your library is a creature card, creatures you control that share a color with that card get +1/+1";
public CrownOfConvergence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Play with the top card of your library revealed.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithTheTopCardRevealedEffect()));
// As long as the top card of your library is a creature card, creatures you control that share a color with that card get +1/+1.
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new CrownOfConvergenceColorBoostEffect(), new TopLibraryCardTypeCondition(CREATURE), rule1);
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new CrownOfConvergenceColorBoostEffect(), new TopLibraryCardTypeCondition(CardType.CREATURE), rule1);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// {G}{W}: Put the top card of your library on the bottom of your library.
@ -82,19 +79,19 @@ public class CrownOfConvergence extends CardImpl {
}
}
class CrownOfConvergenceColorBoostEffect extends BoostAllEffect {
class CrownOfConvergenceColorBoostEffect extends BoostAllEffect {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creatures you control");
private static final String effectText = "creatures you control that share a color with that card get +1/+1";
CrownOfConvergenceColorBoostEffect() {
super(1,1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false);
staticText = effectText;
super(1, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false);
staticText = effectText;
}
CrownOfConvergenceColorBoostEffect(CrownOfConvergenceColorBoostEffect effect) {
super(effect);
super(effect);
}
@Override
@ -103,7 +100,7 @@ class CrownOfConvergenceColorBoostEffect extends BoostAllEffect {
if (you != null) {
Card topCard = you.getLibrary().getFromTop(game);
if (topCard != null) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
if (permanent.getColor(game).shares(topCard.getColor(game)) && !permanent.getColor(game).isColorless()) {
permanent.addPower(power.calculate(game, source, this));
permanent.addToughness(toughness.calculate(game, source, this));
@ -124,8 +121,8 @@ class CrownOfConvergenceColorBoostEffect extends BoostAllEffect {
class CrownOfConvergenceEffect extends OneShotEffect {
public CrownOfConvergenceEffect() {
super(Outcome.Neutral);
staticText = "Put the top card of your library on the bottom of your library";
super(Outcome.Neutral);
staticText = "Put the top card of your library on the bottom of your library";
}
public CrownOfConvergenceEffect(final CrownOfConvergenceEffect effect) {

View file

@ -72,13 +72,13 @@ public class MulDayaChannelers extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithTheTopCardRevealedEffect()));
// As long as the top card of your library is a creature card, Mul Daya Channelers gets +3/+3.
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new BoostSourceEffect(3, 3, Duration.WhileOnBattlefield), new TopLibraryCardTypeCondition(TopLibraryCardTypeCondition.CheckType.CREATURE), rule1);
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new BoostSourceEffect(3, 3, Duration.WhileOnBattlefield), new TopLibraryCardTypeCondition(CardType.CREATURE), rule1);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// As long as the top card of your library is a land card, Mul Daya Channelers has "T: Add two mana of any one color to your mana pool."
SimpleManaAbility manaAbility = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(2), new TapSourceCost());
effect = new ConditionalContinuousEffect(new GainAbilitySourceEffect(manaAbility, Duration.WhileOnBattlefield),
new TopLibraryCardTypeCondition(TopLibraryCardTypeCondition.CheckType.LAND),
new TopLibraryCardTypeCondition(CardType.LAND),
"As long as the top card of your library is a land card, Mul Daya Channelers has \"{T}: Add two mana of any one color to your mana pool.\"");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));

View file

@ -39,13 +39,9 @@ import mage.players.Player;
*/
public class TopLibraryCardTypeCondition implements Condition {
public enum CheckType {
CREATURE, LAND, SORCERY, INSTANT
}
private CardType type;
private CheckType type;
public TopLibraryCardTypeCondition(CheckType type) {
public TopLibraryCardTypeCondition(CardType type) {
this.type = type;
}