Adding Chronozoa card impl

This commit is contained in:
glerman 2015-06-21 10:10:08 +03:00 committed by Gal Lerman
parent 60e512580f
commit 1567c4efe9
6 changed files with 180 additions and 62 deletions

View file

@ -0,0 +1,27 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* Created by glerman on 20/6/15.
*/
public class LastTimeCounterRemovedCondition implements Condition{
private static final LastTimeCounterRemovedCondition fInstance = new LastTimeCounterRemovedCondition();
public static LastTimeCounterRemovedCondition getInstance() {
return fInstance;
}
@Override
public boolean apply(Game game, Ability source) {
final Permanent p = game.getPermanent(source.getSourceId());
final int timeCounters = p.getCounters().getCount(CounterType.TIME);
return timeCounters == 0;
}
}

View file

@ -0,0 +1,51 @@
package mage.abilities.effects;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.EmptyToken;
import mage.util.CardUtil;
/**
* Created by glerman on 20/6/15.
*/
public class CopyCardAffect extends OneShotEffect {
private final Card card;
private final int copies;
public CopyCardAffect(Card card, int copies) {
super(Outcome.PutCreatureInPlay);
this.card = card;
this.copies = copies;
staticText = "Put a token onto the battlefield that's a copy of {this}";
}
public CopyCardAffect(final CopyCardAffect effect) {
super(effect);
this.card = effect.card;
this.copies = effect.copies;
}
@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(copies, game, source.getSourceId(), source.getControllerId());
}
return false;
}
@Override
public CopyCardAffect copy() {
return new CopyCardAffect(this);
}
}