[CHK] Added 4 flip cards.

This commit is contained in:
LevelX2 2013-02-10 02:34:59 +01:00
parent 0fa76a9669
commit 4fb0471fce
5 changed files with 620 additions and 5 deletions

View file

@ -30,7 +30,10 @@
package mage.sets.championsofkamigawa;
import mage.Constants;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.common.DiesAndDealtDamageThisTurnTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -45,7 +48,7 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.WasDealtDamageThisTurnPredicate;
import mage.game.permanent.token.Token;
import java.util.UUID;
/**
* @author LevelX
@ -59,7 +62,7 @@ public class BushiTenderfoot extends CardImpl<BushiTenderfoot> {
}
public BushiTenderfoot(UUID ownerId) {
super(ownerId, 2, "Bushi Tenderfoot", Constants.Rarity.UNCOMMON, new Constants.CardType[]{Constants.CardType.CREATURE}, "{W}");
super(ownerId, 2, "Bushi Tenderfoot", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{W}");
this.expansionSetCode = "CHK";
this.subtype.add("Human");
this.subtype.add("Soldier");
@ -71,7 +74,7 @@ public class BushiTenderfoot extends CardImpl<BushiTenderfoot> {
// When that creature is put into a graveyard this turn, flip Initiate of Blood.
this.addAbility(new DiesAndDealtDamageThisTurnTriggeredAbility(new FlipSourceEffect()));
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new CopyTokenEffect(new KenzoTheHardhearted()), FlippedCondition.getInstance(), "")));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new CopyTokenEffect(new KenzoTheHardhearted()), FlippedCondition.getInstance(), "")));
}
public BushiTenderfoot(final BushiTenderfoot card) {
@ -89,7 +92,7 @@ class KenzoTheHardhearted extends Token {
KenzoTheHardhearted() {
super("Kenzo the Hardhearted", "");
supertype.add("Legendary");
cardType.add(Constants.CardType.CREATURE);
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Human");
subtype.add("Samurai");

View file

@ -0,0 +1,109 @@
/*
* 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.championsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.CardsInHandCondition;
import mage.abilities.condition.common.CardsInHandCondition.CountType;
import mage.abilities.condition.common.FlippedCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
import mage.abilities.effects.common.CopyTokenEffect;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.abilities.effects.common.FlipSourceEffect;
import mage.cards.CardImpl;
import mage.game.permanent.token.Token;
import mage.target.TargetPlayer;
/**
*
* @author LevelX2
*/
public class JushiApprentice extends CardImpl<JushiApprentice> {
public JushiApprentice(UUID ownerId) {
super(ownerId, 70, "Jushi Apprentice", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.expansionSetCode = "CHK";
this.subtype.add("Human");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
this.flipCard = true;
this.flipCardName = "Tomoya the Revealer";
// {2}{U}, {tap}: Draw a card. If you have nine or more cards in hand, flip Jushi Apprentice.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), new ManaCostsImpl("{2}{U}"));
ability.addCost(new TapSourceCost());
ability.addEffect(new ConditionalOneShotEffect(new FlipSourceEffect(), new CardsInHandCondition(CountType.MORE_THAN, 8),
"If you have nine or more cards in hand, flip Jushi Apprentice"));
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new CopyTokenEffect(new TomoyaTheRevealer()), FlippedCondition.getInstance(), "")));
}
public JushiApprentice(final JushiApprentice card) {
super(card);
}
@Override
public JushiApprentice copy() {
return new JushiApprentice(this);
}
}
class TomoyaTheRevealer extends Token {
TomoyaTheRevealer() {
super("Tomoya the Revealer", "");
supertype.add("Legendary");
cardType.add(CardType.CREATURE);
color.setBlue(true);
subtype.add("Human");
subtype.add("Wizard");
power = new MageInt(2);
toughness = new MageInt(3);
// {3}{U}{U},{T} : Target player draws X cards, where X is the number of cards in your hand.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardTargetEffect(new CardsInControllerHandCount()), new ManaCostsImpl("{3}{U}{U}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
}

View file

@ -0,0 +1,178 @@
/*
* 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.championsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EnchantedCondition;
import mage.abilities.condition.common.FlippedCondition;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyTokenEffect;
import mage.abilities.effects.common.FlipSourceEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterEnchantment;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class KitsuneMystic extends CardImpl<KitsuneMystic> {
public KitsuneMystic(UUID ownerId) {
super(ownerId, 28, "Kitsune Mystic", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.expansionSetCode = "CHK";
this.subtype.add("Fox");
this.subtype.add("Wizard");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
this.flipCard = true;
this.flipCardName = "Autumn-Tail, Kitsune Sage";
// At the beginning of the end step, if Kitsune Mystic is enchanted by two or more Auras, flip it.
this.addAbility(new ConditionalTriggeredAbility(
new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new FlipSourceEffect()),
new EnchantedCondition(2),"At the beginning of the end step, if Kitsune Mystic is enchanted by two or more Auras, flip it.", false
));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new CopyTokenEffect(new AutumnTailKitsuneSage()), FlippedCondition.getInstance(), "")));
}
public KitsuneMystic(final KitsuneMystic card) {
super(card);
}
@Override
public KitsuneMystic copy() {
return new KitsuneMystic(this);
}
}
class AutumnTailKitsuneSage extends Token {
private static final FilterEnchantment filter = new FilterEnchantment("Aura attached to a creature");
static {
filter.add(new AttachmentAttachedToCardTypePredicate(CardType.CREATURE));
filter.add(new SubtypePredicate("Aura"));
}
AutumnTailKitsuneSage() {
super("Autumn-Tail, Kitsune Sage", "");
supertype.add("Legendary");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Fox");
subtype.add("Wizard");
power = new MageInt(4);
toughness = new MageInt(5);
// {1}: Attach target Aura attached to a creature to another creature.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AutumnTailEffect(), new GenericManaCost(1));
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
}
class AttachmentAttachedToCardTypePredicate implements Predicate<Permanent> {
private final CardType cardType;
public AttachmentAttachedToCardTypePredicate(CardType cardType) {
this.cardType = cardType;
}
@Override
public boolean apply(Permanent input, Game game) {
if (input.getAttachedTo() != null) {
Permanent attachedTo = game.getPermanent(input.getAttachedTo());
if (attachedTo != null && attachedTo.getCardType().contains(cardType)) {
return true;
}
}
return false;
}
@Override
public String toString() {
return "AttachmentAttachedToCardType(" + cardType + ')';
}
}
class AutumnTailEffect extends OneShotEffect<AutumnTailEffect> {
public AutumnTailEffect() {
super(Outcome.BoostCreature);
this.staticText = "Attach target Aura attached to a creature to another creature";
}
public AutumnTailEffect(final AutumnTailEffect effect) {
super(effect);
}
@Override
public AutumnTailEffect copy() {
return new AutumnTailEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanent(source.getFirstTarget());
Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (aura != null && creature != null) {
Permanent oldCreature = game.getPermanent(aura.getAttachedTo());
if (oldCreature == null || oldCreature.equals(creature)) {
return false;
}
if (oldCreature.removeAttachment(aura.getId(), game)) {
return creature.addAttachment(aura.getId(), game);
}
}
return false;
}
}

View file

@ -0,0 +1,192 @@
/*
* 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.championsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.FlippedCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyTokenEffect;
import mage.abilities.effects.common.DiscardTargetEffect;
import mage.abilities.effects.common.FlipSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.common.TargetOpponent;
/**
*
* @author LevelX2
*/
public class NezumiShortfang extends CardImpl<NezumiShortfang> {
public NezumiShortfang(UUID ownerId) {
super(ownerId, 131, "Nezumi Shortfang", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.expansionSetCode = "CHK";
this.subtype.add("Rat");
this.subtype.add("Rogue");
this.color.setBlack(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
this.flipCard = true;
this.flipCardName = "Stabwhisker the Odious";
// {1}{B}, {tap}: Target opponent discards a card. Then if that player has no cards in hand, flip Nezumi Shortfang.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new ManaCostsImpl("{1}{B}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetOpponent());
ability.addEffect(new ConditionalOneShotEffect(
new FlipSourceEffect(),
new CardsInTargetOpponentHandCondition(CardsInTargetOpponentHandCondition.CountType.FEWER_THAN, 1),
"Then if that player has no cards in hand, flip {this}"));
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new CopyTokenEffect(new StabwhiskerTheOdious()), FlippedCondition.getInstance(), "")));
}
public NezumiShortfang(final NezumiShortfang card) {
super(card);
}
@Override
public NezumiShortfang copy() {
return new NezumiShortfang(this);
}
}
class StabwhiskerTheOdious extends Token {
StabwhiskerTheOdious() {
super("Stabwhisker the Odious", "");
supertype.add("Legendary");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Rat");
subtype.add("Shaman");
power = new MageInt(3);
toughness = new MageInt(3);
// At the beginning of each opponent's upkeep, that player loses 1 life for each card fewer than three in his or her hand.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD, new StabwhiskerLoseLifeEffect(), TargetController.OPPONENT, false, true));
}
}
class StabwhiskerLoseLifeEffect extends OneShotEffect<StabwhiskerLoseLifeEffect> {
public StabwhiskerLoseLifeEffect() {
super(Outcome.LoseLife);
this.staticText = "that player loses 1 life for each card fewer than three in his or her hand";
}
public StabwhiskerLoseLifeEffect(final StabwhiskerLoseLifeEffect effect) {
super(effect);
}
@Override
public StabwhiskerLoseLifeEffect copy() {
return new StabwhiskerLoseLifeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
if (opponent != null) {
int lifeLose = 3 - opponent.getHand().size();
if (lifeLose > 0 ) {
opponent.loseLife(lifeLose, game);
}
return true;
}
return false;
}
}
class CardsInTargetOpponentHandCondition implements Condition {
public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO };
private Condition condition;
private CountType type;
private int count;
public CardsInTargetOpponentHandCondition() {
this(CountType.EQUAL_TO, 0);
}
public CardsInTargetOpponentHandCondition (CountType type, int count ) {
this.type = type;
this.count = count;
}
public CardsInTargetOpponentHandCondition (CountType type, int count, Condition conditionToDecorate ) {
this(type, count);
this.condition = conditionToDecorate;
}
@Override
public boolean apply(Game game, Ability source) {
boolean conditionApplies = false;
Player opponent = game.getPlayer(source.getFirstTarget());
if (opponent == null) {
return false;
}
switch ( this.type ) {
case FEWER_THAN:
conditionApplies = opponent.getHand().size() < this.count;
break;
case MORE_THAN:
conditionApplies = opponent.getHand().size() > this.count;
break;
case EQUAL_TO:
conditionApplies = opponent.getHand().size() == this.count;
break;
}
//If a decorated condition exists, check it as well and apply them together.
if ( this.condition != null ) {
conditionApplies = conditionApplies && this.condition.apply(game, source);
}
return conditionApplies;
}
}

View file

@ -0,0 +1,133 @@
/*
* 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.championsofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.FlippedCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.common.CopyTokenEffect;
import mage.abilities.effects.common.FlipSourceEffect;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
/**
*
* @author LevelX2
*/
public class StudentOfElements extends CardImpl<StudentOfElements> {
public StudentOfElements(UUID ownerId) {
super(ownerId, 93, "Student of Elements", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.expansionSetCode = "CHK";
this.subtype.add("Human");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
this.flipCard = true;
this.flipCardName = "Tobita, Master of Winds";
// When Student of Elements has flying, flip it.
this.addAbility(new StudentOfElementsHasFlyingAbility());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new CopyTokenEffect(new TobitaMasterOfWinds()), FlippedCondition.getInstance(), "")));
}
public StudentOfElements(final StudentOfElements card) {
super(card);
}
@Override
public StudentOfElements copy() {
return new StudentOfElements(this);
}
}
class StudentOfElementsHasFlyingAbility extends StateTriggeredAbility<StudentOfElementsHasFlyingAbility> {
public StudentOfElementsHasFlyingAbility() {
super(Zone.BATTLEFIELD, new FlipSourceEffect());
}
public StudentOfElementsHasFlyingAbility(final StudentOfElementsHasFlyingAbility ability) {
super(ability);
}
@Override
public StudentOfElementsHasFlyingAbility copy() {
return new StudentOfElementsHasFlyingAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(getSourceId());
if(permanent.getAbilities().contains(FlyingAbility.getInstance())){
return true;
}
return false;
}
@Override
public String getRule() {
return "When Student of Elements has flying, flip it.";
}
}
class TobitaMasterOfWinds extends Token {
TobitaMasterOfWinds() {
super("Tobita, Master of Winds", "");
supertype.add("Legendary");
cardType.add(Constants.CardType.CREATURE);
color.setBlue(true);
subtype.add("Human");
subtype.add("Wizard");
power = new MageInt(3);
toughness = new MageInt(3);
// Creatures you control have flying.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD, new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent())));
}
}