Added Taunt.

This commit is contained in:
emerald000 2015-02-12 12:58:52 -05:00
parent 890e98c4cc
commit 44deff29d5

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.portal;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.RequirementEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TurnPhase;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
/**
*
* @author emerald000
*/
public class Taunt extends CardImpl {
public Taunt(UUID ownerId) {
super(ownerId, 94, "Taunt", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{U}");
this.expansionSetCode = "POR";
// During target player's next turn, creatures that player controls attack you if able.
this.getSpellAbility().addEffect(new TauntEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public Taunt(final Taunt card) {
super(card);
}
@Override
public Taunt copy() {
return new Taunt(this);
}
}
class TauntEffect extends RequirementEffect {
TauntEffect() {
super(Duration.Custom);
staticText = "During target player's next turn, creatures that player controls attack you if able";
}
TauntEffect(final TauntEffect effect) {
super(effect);
}
@Override
public TauntEffect copy() {
return new TauntEffect(this);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
return permanent.getControllerId().equals(this.getTargetPointer().getFirst(game, source));
}
@Override
public boolean isInactive(Ability source, Game game) {
return startingTurn != game.getTurnNum() &&
(game.getPhase().getType() == TurnPhase.END &&
game.getActivePlayerId().equals(this.getTargetPointer().getFirst(game, source)));
}
@Override
public UUID mustAttackDefender(Ability source, Game game) {
return source.getControllerId();
}
@Override
public boolean mustAttack(Game game) {
return true;
}
@Override
public boolean mustBlock(Game game) {
return false;
}
}