[PLC] Calciderm

This commit is contained in:
Loki 2012-08-01 09:49:28 +12:00
parent 37fac8d0ff
commit 37577a8a4a
2 changed files with 131 additions and 0 deletions

View file

@ -0,0 +1,71 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.planarchaos;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.ShroudAbility;
import mage.abilities.keyword.VanishingAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
/**
*
* @author Loki
*/
public class Calciderm extends CardImpl<Calciderm> {
public Calciderm(UUID ownerId) {
super(ownerId, 23, "Calciderm", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.expansionSetCode = "PLC";
this.subtype.add("Beast");
this.color.setWhite(true);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Shroud
this.addAbility(ShroudAbility.getInstance());
// Vanishing 4
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.TIME.createInstance(4))));
this.addAbility(new VanishingAbility());
}
public Calciderm(final Calciderm card) {
super(card);
}
@Override
public Calciderm copy() {
return new Calciderm(this);
}
}

View file

@ -0,0 +1,60 @@
package mage.abilities.keyword;
import mage.Constants;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
public class VanishingAbility extends BeginningOfUpkeepTriggeredAbility {
public VanishingAbility() {
super(new VanishingEffect(), Constants.TargetController.YOU, false);
}
public VanishingAbility(final VanishingAbility ability) {
super(ability);
}
@Override
public BeginningOfUpkeepTriggeredAbility copy() {
return new VanishingAbility(this);
}
@Override
public String getRule() {
return "Vanishing (This permanent enters the battlefield with time counters on it. At the beginning of your upkeep, remove a time counter from it. When the last is removed, sacrifice it.)";
}
}
class VanishingEffect extends OneShotEffect<VanishingEffect> {
VanishingEffect() {
super(Constants.Outcome.Sacrifice);
}
VanishingEffect(final VanishingEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
int amount = p.getCounters().getCount(CounterType.TIME);
if (amount > 0) {
p.getCounters().removeCounter(CounterType.TIME, 1);
} else {
p.sacrifice(source.getSourceId(), game);
}
return true;
}
return false;
}
@Override
public VanishingEffect copy() {
return new VanishingEffect(this);
}
}