mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 21:42:07 -08:00
refactored card.moveToExile usages E-F
This commit is contained in:
parent
4a09654743
commit
9567b19b01
12 changed files with 235 additions and 283 deletions
|
|
@ -0,0 +1,46 @@
|
|||
package mage.abilities.costs.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ExileSourceFromHandCost extends CostImpl {
|
||||
|
||||
public ExileSourceFromHandCost() {
|
||||
this.text = "exile {this} from your hand";
|
||||
}
|
||||
|
||||
private ExileSourceFromHandCost(ExileSourceFromHandCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (player != null && player.getHand().contains(source.getSourceId()) && card != null) {
|
||||
paid = player.moveCards(card, Zone.EXILED, source, game);
|
||||
}
|
||||
return paid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
return player != null && player.getHand().contains(source.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExileSourceFromHandCost copy() {
|
||||
return new ExileSourceFromHandCost(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue