mirror of
https://github.com/magefree/mage.git
synced 2026-01-22 19:29:59 -08:00
Adding Chronozoa card impl
This commit is contained in:
parent
60e512580f
commit
1567c4efe9
6 changed files with 180 additions and 62 deletions
83
Mage.Sets/src/mage/sets/planarchaos/Chronozoa.java
Normal file
83
Mage.Sets/src/mage/sets/planarchaos/Chronozoa.java
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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.MageInt;
|
||||
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.condition.common.LastTimeCounterRemovedCondition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.CopyCardAffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.VanishingSacrificeAbility;
|
||||
import mage.abilities.keyword.VanishingUpkeepAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.counters.CounterType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Gal Lerman
|
||||
|
||||
*/
|
||||
public class Chronozoa extends CardImpl {
|
||||
|
||||
private static final int timeCounters = 3;
|
||||
private static final int numCopies = 2;
|
||||
|
||||
public Chronozoa(UUID ownerId) {
|
||||
super(ownerId, 37, "Chronozoa", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
this.expansionSetCode = "PLC";
|
||||
this.subtype.add("Illusion");
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
// Vanishing 3
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.TIME.createInstance(timeCounters))));
|
||||
this.addAbility(new VanishingUpkeepAbility(timeCounters));
|
||||
this.addAbility(new VanishingSacrificeAbility());
|
||||
// When Chronozoa is put into a graveyard from play, if it had no time counters on it, put two tokens into play that are copies of it.
|
||||
this.addAbility(new ConditionalTriggeredAbility(new DiesCreatureTriggeredAbility(new CopyCardAffect(this, numCopies), false),
|
||||
new LastTimeCounterRemovedCondition(),
|
||||
"When Chronozoa is put into a graveyard from play, if it had no time counters on it, put two tokens into play that are copies of it."));
|
||||
}
|
||||
|
||||
public Chronozoa(final Chronozoa card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Chronozoa copy() {
|
||||
return new Chronozoa(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ package mage.sets.returntoravnica;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.effects.CopyCardAffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -39,18 +40,11 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.costs.common.DiscardCardCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.EmptyToken;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -89,7 +83,7 @@ public class PackRat extends CardImpl {
|
|||
// Pack Rat's power and toughness are each equal to the number of Rats you control.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filter), Duration.EndOfGame)));
|
||||
// {2}{B}, Discard a card: Put a token onto the battlefield that's a copy of Pack Rat.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PackRatEffect(this), new ManaCostsImpl("{2}{B}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CopyCardAffect(this, 1), new ManaCostsImpl("{2}{B}"));
|
||||
ability.addCost(new DiscardCardCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
@ -104,37 +98,3 @@ public class PackRat extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class PackRatEffect extends OneShotEffect {
|
||||
|
||||
private Card card;
|
||||
|
||||
public PackRatEffect(Card card) {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.card = card;
|
||||
staticText = "Put a token onto the battlefield that's a copy of {this}";
|
||||
}
|
||||
|
||||
public PackRatEffect(final PackRatEffect effect) {
|
||||
super(effect);
|
||||
this.card = effect.card;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null) {
|
||||
permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||
}
|
||||
if (permanent != null) {
|
||||
EmptyToken newToken = new EmptyToken();
|
||||
CardUtil.copyTo(newToken).from(permanent);
|
||||
return newToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackRatEffect copy() {
|
||||
return new PackRatEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue