mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
Adding Chronozoa card impl
This commit is contained in:
parent
60e512580f
commit
1567c4efe9
6 changed files with 180 additions and 62 deletions
|
@ -1,20 +0,0 @@
|
|||
#
|
||||
# Rename this file to init.txt if you want to start using it
|
||||
#
|
||||
|
||||
# You may add any card to any zone here
|
||||
#
|
||||
# Format: <zone>:<nickname>:<card name>:<amount>
|
||||
#
|
||||
# zone ::= hand | battlefield | graveyard | library
|
||||
# nickname - Player's name you connect to the game with
|
||||
#
|
||||
#
|
||||
battlefield:player:Forest:3
|
||||
graveyard:player:Plains:1
|
||||
battlefield:player:Snapsail Glider:1
|
||||
battlefield:computer:Island:2
|
||||
battlefield:player:Plains:3
|
||||
hand:player:Whispersilk Cloak:1
|
||||
hand:computer:Lightning Bolt:1
|
||||
library:player:Shock:2
|
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package mage.sets.planarchaos;
|
||||
|
||||
import mage.abilities.condition.common.LastTimeCounterRemovedCondition;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChronozoaTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
final Chronozoa chronozoa = new Chronozoa(UUID.randomUUID());
|
||||
|
||||
final LastTimeCounterRemovedCondition cond = new LastTimeCounterRemovedCondition();
|
||||
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
51
Mage/src/mage/abilities/effects/CopyCardAffect.java
Normal file
51
Mage/src/mage/abilities/effects/CopyCardAffect.java
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue