/* * Forge: Play Magic: the Gathering. * Copyright (C) 2011 Forge Team * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package forge.card.cost; import forge.Card; import forge.card.spellability.SpellAbility; import forge.game.GameState; import forge.game.player.AIPlayer; import forge.game.player.Player; /** * The Class CostTap. */ public class CostTap extends CostPart { /** * Instantiates a new cost tap. */ public CostTap() { } @Override public boolean isUndoable() { return true; } @Override public boolean isReusable() { return true; } /* * (non-Javadoc) * * @see forge.card.cost.CostPart#toString() */ @Override public final String toString() { return "Tap"; } /* * (non-Javadoc) * * @see forge.card.cost.CostPart#refund(forge.Card) */ @Override public final void refund(final Card source) { source.setTapped(false); } /* * (non-Javadoc) * * @see * forge.card.cost.CostPart#canPay(forge.card.spellability.SpellAbility, * forge.Card, forge.Player, forge.card.cost.Cost) */ @Override public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost, final GameState game) { return source.isUntapped() && (!source.isSick() || source.hasKeyword("CARDNAME may activate abilities as though it has haste.")); } /* * (non-Javadoc) * * @see forge.card.cost.CostPart#payAI(forge.card.spellability.SpellAbility, * forge.Card, forge.card.cost.Cost_Payment) */ @Override public final void payAI(final AIPlayer ai, final SpellAbility ability, final Card source, final CostPayment payment, final GameState game) { source.tap(); } /* * (non-Javadoc) * * @see * forge.card.cost.CostPart#payHuman(forge.card.spellability.SpellAbility, * forge.Card, forge.card.cost.Cost_Payment) */ @Override public final boolean payHuman(final SpellAbility ability, final GameState game) { // if (!canPay(ability, source, ability.getActivatingPlayer(), // payment.getCost())) // return false; ability.getSourceCard().tap(); return true; } /* * (non-Javadoc) * * @see * forge.card.cost.CostPart#decideAIPayment(forge.card.spellability.SpellAbility * , forge.Card, forge.card.cost.Cost_Payment) */ @Override public final boolean decideAIPayment(final AIPlayer ai, final SpellAbility ability, final Card source, final CostPayment payment) { return true; } }